From 606e9fc49da0e636e7ae83552af97d99f76548b1 Mon Sep 17 00:00:00 2001
From: Valentina <v.akishina@gsi.de>
Date: Sat, 7 Aug 2021 15:49:19 +0200
Subject: [PATCH] L1: limit max number of reconstructed triplets, doubles

---
 reco/L1/L1Algo/L1Algo.h            |  5 +++--
 reco/L1/L1Algo/L1CATrackFinder.cxx | 11 +++++++----
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/reco/L1/L1Algo/L1Algo.h b/reco/L1/L1Algo/L1Algo.h
index 84a26ec8fc..92506cbb76 100644
--- a/reco/L1/L1Algo/L1Algo.h
+++ b/reco/L1/L1Algo/L1Algo.h
@@ -105,7 +105,7 @@ public:
   static constexpr unsigned int fkMaxNtriplets = (1 << fkTripletBits);  // 2^20 = 262,144
 
   unsigned int fMaxDoubletsPerSinglet = 150;
-  unsigned int fMaxTripletPerDoublets = 50;
+  unsigned int fMaxTripletPerDoublets = 15;
 
   /// pack station, thread and triplet indices to an unique triplet ID
   static unsigned int PackTripletId(unsigned int Station, unsigned int Thread, unsigned int Triplet)
@@ -638,7 +638,8 @@ private:
   float Pick_gather {0.f};    // same for attaching additional hits to track
   float PickNeighbour {0.f};  // (PickNeighbour < dp/dp_error)  =>  triplets are neighbours
   fvec MaxInvMom {0.f};       // max considered q/p for tracks
-  fvec MaxSlope {0.f};        // max slope (tx\ty) in prim vertex
+  fvec MaxSlopePV {0.f};      // max slope (tx\ty) in prim vertex
+  float MaxSlope {0.f};       // max slope (tx\ty) in 3d hit position of a triplet
   fvec targX {0.f};  // target coor TODO: set defaults to a crasy value to be sure that the target is initialised later
   fvec targY {0.f};
   fvec targZ {0.f};
diff --git a/reco/L1/L1Algo/L1CATrackFinder.cxx b/reco/L1/L1Algo/L1CATrackFinder.cxx
index 0a531b0904..b772c355a2 100644
--- a/reco/L1/L1Algo/L1CATrackFinder.cxx
+++ b/reco/L1/L1Algo/L1CATrackFinder.cxx
@@ -234,7 +234,7 @@ inline void L1Algo::f11(  /// input 1st stage of singlet search
     T.C30 = T.C31 = T.C32 = 0;
     T.C40 = T.C41 = T.C42 = T.C43 = 0;
     T.C50 = T.C51 = T.C52 = T.C53 = T.C54 = 0;
-    T.C22 = T.C33 = MaxSlope * MaxSlope / 9.;
+    T.C22 = T.C33 = MaxSlopePV * MaxSlopePV / 9.;
     if (fTrackingMode == kGlobal || fTrackingMode == kMcbm) T.C22 = T.C33 = 10;
     T.C44 = MaxInvMom / 3. * MaxInvMom / 3.;
     T.C55 = timeEr * timeEr;
@@ -705,6 +705,9 @@ inline void L1Algo::f30(  // input
         if (fTrackingMode == kSts && (T2.C44[i2_4] < 0)) { continue; }
         if (T2.C00[i2_4] < 0 || T2.C11[i2_4] < 0 || T2.C22[i2_4] < 0 || T2.C33[i2_4] < 0 || T2.C55[i2_4] < 0) continue;
 
+        if (fabs(T2.tx[i2_4]) > MaxSlope) continue;
+        if (fabs(T2.ty[i2_4]) > MaxSlope) continue;
+
         const fvec Pick_r22    = (TRIPLET_CHI2_CUT - T2.chi2);
         const float& timeError = T2.C55[i2_4];
         const float& time      = T2.t[i2_4];
@@ -720,7 +723,6 @@ inline void L1Algo::f30(  // input
                            (sqrt(Pick_r22 * (T2.C11 + stam.XYInfo.C11)) + MaxDZ * fabs(T2.ty))[i2_4] * iz, time,
                            sqrt(timeError) * 5);
 
-
         THitI irh       = 0;
         THitI Ntriplets = 0;
         int irh1        = -1;
@@ -1848,11 +1850,12 @@ void L1Algo::CATrackFinder()
         if ((isec == kAllPrimJumpIter) || (isec == kAllSecIter) || (isec == kAllSecJumpIter)) MaxInvMom = 1.0 / 0.1;
         if ((isec == kAllPrimIter) || (isec == kAllPrimEIter) || (isec == kAllSecEIter)) MaxInvMom = 1. / 0.05;
 
-        MaxSlope = 1.1;
+        MaxSlopePV = 1.1;
         if (  // (isec == kAllPrimIter) || (isec == kAllPrimEIter) || (isec == kAllPrimJumpIter) ||
           (isec == kAllSecIter) || (isec == kAllSecEIter) || (isec == kAllSecJumpIter))
-          MaxSlope = 1.5;
+          MaxSlopePV = 1.5;
 
+        MaxSlope = 2.748;  // corresponds to 70 grad
         // define the target
         targX = 0;
         targY = 0;
-- 
GitLab