LCOV - code coverage report
Current view: top level - HLT/ITS/trackingSAP - AliITSSAPTracker.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 1 37 2.7 %
Date: 2016-06-14 17:26:59 Functions: 1 46 2.2 %

          Line data    Source code
       1             : #ifndef ALIITSSAPTRACKER_H
       2             : #define ALIITSSAPTRACKER_H
       3             : 
       4             : #include <TH1.h>
       5             : #include <TH2.h>
       6             : #include <TBits.h>
       7             : #include <TStopwatch.h>
       8             : #include <TObjArray.h>
       9             : #include <algorithm>
      10             : #include <vector>
      11             : #include "AliExternalTrackParam.h"
      12             : #include "AliESDVertex.h"
      13             : 
      14             : //------- compilation options, comment out all for best performance ------
      15             : //#define _TIMING_                            // print timing info, use only in offline mode
      16             : //#define _CONTROLH_                          // fill control histos, use only in offline mode
      17             : //#define _DEBUG_                             // print debug info, use only in offline mode
      18             : //------------------------------------------------------------------------
      19             : 
      20             : class AliITSRecPoint;
      21             : class AliESDVertex;
      22             : class AliITSSAPLayer;
      23             : 
      24             : class AliITSSAPTracker : public TObject
      25             : {
      26             :  public:
      27             :   enum {kALrSPD1,kALrSPD2, kALrSDD1,kALrSDD2, kALrSSD1,kALrSSD2,kNLrActive};
      28             :   enum {kLrBeamPime, kLrSPD1,kLrSPD2, kLrShield1, kLrSDD1,kLrSDD2, kLrShield2, kLrSSD1,kLrSSD2,
      29             :         kMaxLrITS,kNLrPassive=kMaxLrITS-kNLrActive};
      30             :   enum {kInvalidBit=BIT(14),kVtUsedBit=BIT(15)};
      31             :   //
      32             :   struct SPDtracklet {
      33           0 :   SPDtracklet() : id1(0),id2(0),label(0),dphi(0),dtht(0),chi2(0) {}
      34             :     int id1;
      35             :     int id2;
      36             :     int label;
      37             :     float dphi;
      38             :     float dtht;
      39             :     float chi2;
      40             :   };
      41             :   typedef struct SPDtracklet SPDtracklet_t;
      42             :   //
      43           0 :   struct ITStrack {
      44           0 :   ITStrack() : paramOut(),paramInw(),chi2(0),ncl(0),nmiss(0),label(0),trackletID(0) {}
      45             :     AliExternalTrackParam paramOut;
      46             :     AliExternalTrackParam paramInw;
      47             :     float chi2;
      48             :     short ncl;
      49             :     short nmiss;
      50             :     int clID[6];
      51             :     int label;
      52             :     int trackletID;
      53             :   };
      54             :   typedef struct ITStrack ITStrack_t;
      55             :   //
      56             :   AliITSSAPTracker();
      57             :   virtual ~AliITSSAPTracker();
      58             :   //
      59             :   void ProcessEvent();
      60             :   void Init();
      61             :   void Clear(Option_t *opt="");
      62             :   void ClearTracklets();
      63           0 :   void ClearTracks()                               {fTracks.clear();}
      64             :   //
      65           0 :   void SetSPDVertex(const AliESDVertex* v)         {fSPDVertex = v;}
      66           0 :   const AliESDVertex* GetSPDVertex()  const        {return fSPDVertex;}
      67             :   void AddCluster(AliITSRecPoint* cl);
      68           0 :   void SetBz(float v)                              {fBz = v;}
      69           0 :   void SetMaxRSPDVtx(float v=1.5)                  {fMaxRSPDVtx = v>0.5 ? v:0.5;}
      70             :   //
      71             :   // methods for trackleting ---------------->>>
      72             :   Bool_t FindTracklets();
      73             :   Int_t  AssociateClusterOfL2(int icl2);
      74             :   Bool_t IsBlacklisted(int id1,int id2);
      75             :   void   Blacklist(int id1,int id2);
      76             :   //
      77           0 :   void SetPhiShift(float v=0.0045)                  {fPhiShift = v;}
      78           0 :   void SetSigThetaTracklet(float v=0.025)           {fSigThetaTracklet = v;}
      79           0 :   void SetSigPhiTracklet(float v=0.08)              {fSigPhiTracklet = v;}
      80           0 :   void SetChi2CutTracklet(float v=1.5)              {fChi2CutTracklet = v;}
      81           0 :   void SetMaxTrackletsToRunTracking(int n=9999)     {fMaxTrackletsToRunTracking = n;}
      82           0 :   Int_t GetMaxTrackletsToRunTracking() const        {return fMaxTrackletsToRunTracking;}
      83             :   //
      84           0 :   Double_t GetClSystYErr2(Int_t lr)    const        {return fgkClSystYErr2[lr];}
      85           0 :   Double_t GetClSystZErr2(Int_t lr)    const        {return fgkClSystZErr2[lr];}
      86             :   //
      87           0 :   int  GetNTracklets()                 const        {return (int)fTracklets.size();}
      88           0 :   int  GetNTracks()                    const        {return fNTracks;}
      89             :   void PrintTracklets()                const;
      90             :   void PrintTracklet(Int_t itr)        const;
      91           0 :   const AliITSSAPTracker::SPDtracklet_t& GetTracklet(int i) const {return fTracklets[i];}
      92             :   // methods for trackleting ----------------<<<
      93             :   //
      94             :   // methods for track reconstruction ------->>>
      95           0 :   Float_t GetMinPt()                   const        {return fMinPt;}
      96           0 :   void    SetMinPt(Float_t v=0.3)                   {fMinPt = v<0.2 ? 0.2 : v;}
      97             :   void    CalcAuxTracking();
      98             :   Bool_t  CreateTrack(AliITSSAPTracker::ITStrack_t& track, AliITSSAPTracker::SPDtracklet_t& trlet);
      99             :   void    Tracklets2Tracks();
     100           0 :   AliITSSAPLayer* GetLayer(int i)         const        {return (AliITSSAPLayer*)fLayers[i];}
     101           0 :   Int_t   GetActiveLayerID(int i)      const        {return fgkLr2Active[i];}
     102             :   Float_t GetChi2TotCut(int ncl)       const;
     103             :   Bool_t  CrossPassiveLayer(AliExternalTrackParam& track, Int_t lrID);
     104             :   Bool_t  FollowToLayer(AliITSSAPTracker::ITStrack_t& track, Int_t lrID);
     105             :   Double_t GetXatLabRLin(AliExternalTrackParam& track, double r);
     106             :   void    CookLabel(AliITSSAPTracker::ITStrack_t& track);
     107             :   void    CookLabel(AliITSSAPTracker::SPDtracklet_t& tracklet);
     108             :   void    PrintTrack(const AliITSSAPTracker::ITStrack_t& track) const;
     109           0 :   Bool_t  GetSkipLayer(int lr)                    const  {return fSkipLayer[lr];}
     110           0 :   void    SetSkipLayer(int lr, Bool_t v=kTRUE)           {fSkipLayer[lr] = v;}
     111             :   Bool_t  IsAcceptableTrack(const AliITSSAPTracker::ITStrack_t& track) const;
     112             :   void    PrintTracks()                const;
     113             :   Int_t   GetTrackletMCTruth(AliITSSAPTracker::SPDtracklet_t& trlet) const;
     114             :   void    RefitInward();
     115             :   Bool_t  RefitInward(int itr);
     116           0 :   void    SetMaxMissedLayers(int n=0)  { fMaxMissedLayers = n;}
     117           0 :   Int_t   GetMaxMissedLayers()    const  { return fMaxMissedLayers;}
     118           0 :   AliITSSAPTracker::ITStrack_t& GetTrack(int i) const {return (ITStrack_t &)fTracks[i];}
     119             :   // methods for track reconstruction -------<<<
     120             :   //
     121             :   // methods for vertex reconstruction ------>>>
     122             :   Bool_t  FitTrackVertex();
     123           0 :   AliESDVertex& GetTrackVertex()      const       {return (AliESDVertex&)fTrackVertex;}
     124           0 :   void      SetMaxVtxIter(Int_t n=5)              {fMaxVtxIter = n;}
     125           0 :   Int_t     GetMaxVtxIter()           const       {return fMaxVtxIter;}
     126           0 :   void      SetStopScaleChange(float v=0.8)       {fStopScaleChange = v;}
     127           0 :   Float_t   GetStopScaleChange()           const  {return fStopScaleChange;}
     128             :   // methods for vertex reconstruction ------<<<
     129             :   //
     130             :  protected:
     131             :   //
     132             :   AliITSSAPLayer* fLayers[kNLrActive];
     133             :   Bool_t    fSkipLayer[kNLrActive];                     //! skip layer
     134             :   Int_t     fNClusters[kNLrActive];                     //! number of clusters per event
     135             :   //
     136             :   // for SPD trackleting ----------------- >>>
     137             :   std::vector<bool> fSPD2Discard;                       //! status of SPD2 clusters during trackleting
     138             :   std::vector<SPDtracklet_t> fTracklets;                //! found tracklets
     139             :   std::vector<int> fSPD1Tracklet;                       //! id+1 of traclet using this SPD1 cluster
     140             :   TBits*   fBlacklist;                            //! blacklisted combinations
     141             :   Float_t  fPhiShift;                             //! Phi shift reference value (at 0.5 T)
     142             :   Float_t  fSigThetaTracklet;                     //! sigTheta for tracklets
     143             :   Float_t  fSigPhiTracklet;                       //! sigPhi for tracklets
     144             :   Float_t  fChi2CutTracklet;                      //! cut on tracklet total chi2
     145             :   Float_t  fPhiShiftSc;                           //! dPhi offset to account for bending
     146             :   Float_t  fDThetaTrackletSc;                     //! max dTheta for tracklets with scaling from chi2 cut
     147             :   Float_t  fDPhiTrackletSc;                       //! max dPhi for tracklets with scaling from chi2 cut
     148             :   Float_t  fBz;                                   //! Bz field in ITS
     149             :   Float_t  fMaxRSPDVtx;                           //! max allowed R of SPD vertex
     150             :   //
     151             :   // auxilary precomputed stuff
     152             :   Float_t  fDPhiTol;                              //! tolerance on phi, accounting for bending
     153             :   Float_t  fDThSig2Inv;                           //! inverse of sigma dTheta
     154             :   Float_t  fDPhSig2Inv;                           //! inverse of sigma dPhi
     155             :   // for SPD trackleting ----------------- <<<
     156             :   //
     157             :   // for track reconstruction ------------ >>>
     158             :   Float_t  fMinPt;                                //! user pt cutoff
     159             :   Float_t  fCurvMax;                              //! max curvature to reconstruct
     160             :   Float_t  fZSPD2CutMin;                          //! min Z of tracklet SPD2 to consider tracking
     161             :   Float_t  fZSPD2CutMax;                          //! max Z of tracklet SPD2 to consider tracking
     162             :   Float_t  fMaxChi2Tr2Cl;                         //! cut on cluster-to-track chi2
     163             :   Float_t  fAddErr2YspdVtx;                       //! additional error to Y of the SPD vertex in track fit
     164             :   Float_t  fAddErr2ZspdVtx;                       //! additional error to Z of the SPD vertex in track fit
     165             :   Float_t  fChi2TotCut[kNLrActive];               //! cut on total chi2 depending on track length
     166             :   //
     167             :   Float_t  fNSigma2[kNLrActive];                  //! N^2 sigma margin for cluster search
     168             :   Float_t  fYToler2[kNLrActive];                  //! Y additional margin^2 for cluster search
     169             :   Float_t  fZToler2[kNLrActive];                  //! Z additional margin^2 for cluster search
     170             :   Float_t  fMaxDRPhi;                             //! maximal search window in rphi
     171             :   Float_t  fMaxDZ;                                //! maximal search window in z
     172             : 
     173             :   Float_t  fMSDist[kNLrActive];                   //! shift due to the MS for 1 GeV particle
     174             :   Float_t  fMSPhi[kNLrActive];                    //! dphi due to the MS for 1 GeV particle
     175             :   Float_t  fTolPhiCrude[kNLrActive];              //! tolerance in dphi for particle of unknown momentum
     176             :   Float_t  fTolZCrude[kNLrActive];                //! tolerance in Z for particle of unknown momentum
     177             :   Float_t  fMissChi2Penalty;                      //! penalize missed clusters
     178             :   Int_t    fMaxMissedLayers;                      //! allow to miss at most this number of layers
     179             :   Int_t    fNTracks;                              //! n found tracks
     180             :   Int_t    fMaxTrackletsToRunTracking;            //! skip tracking if too many SPD tracklets
     181             :   //
     182             :   Int_t    fMaxVtxIter;                           //! max number of vertexing iterations
     183             :   Float_t  fStopScaleChange;                      //! stop vertexing if sigma scaling change is above this
     184             :   //
     185             :   std::vector<ITStrack_t> fTracks;                //! found tracks container
     186             :   AliESDVertex fTrackVertex;                      //! fitted track vertex
     187             :   Bool_t    fFitVertex;                           //! fit vertex with tracks
     188             :   // for track reconstruction ------------ <<<
     189             :   //                  
     190             :                       
     191             :   const AliESDVertex* fSPDVertex;                  //! external vertex
     192             : 
     193             :   static const Float_t fgkRhoLITS[kMaxLrITS];      // <rho*L> for each material layer
     194             :   static const Float_t fgkX2X0ITS[kMaxLrITS];      // <x/x0> for each material layer
     195             :   static const Float_t fgkRLayITS[kMaxLrITS];     // radii of material layers
     196             :   static const Float_t fgkRSpanITS[kMaxLrITS];    // half R span of the material layer
     197             :   static const Float_t fgkZSpanITS[kMaxLrITS];    // half Z span of the material layer
     198             :   static const Int_t   fgkPassivLrITS[kNLrPassive];  // list of passive layer enums
     199             :   static const Int_t   fgkActiveLrITS[kNLrActive]; // list of active layer enums
     200             :   static const Double_t fgkClSystYErr2[kNLrActive]; // syst error^2 for Y direction
     201             :   static const Double_t fgkClSystZErr2[kNLrActive]; // syst error^2 for Y direction
     202             : 
     203             :   static const Int_t   fgkLr2Active[kMaxLrITS]; // conversion from LrID to ActiveLr ID
     204             :   static const Int_t   fgkLrDefBins[kNLrActive][2]; // default binning for cluster navigator
     205             :   static const Int_t   fgkDummyLabel;               // dummy MC label
     206             :   static const Float_t fgkDefMass;                  // default mass for tracking
     207             :   //
     208             : #ifdef _TIMING_
     209             :  public:
     210             :   enum {kSWTotal,kSWTracklets,kSWTracks,kSWVertex,kNSW};
     211             :   void PrintTiming();
     212             :   const TStopwatch& GetStopwatch(int i)     const {return fSW[i];}
     213             :   const char*       GetStopwatchName(int i) const {return fgkSWNames[i];}
     214             :  protected:
     215             :   static const char* fgkSWNames[kNSW];
     216             :   TStopwatch fSW[kNSW];
     217             : #endif
     218             :   //
     219             : #ifdef _CONTROLH_
     220             :  protected:
     221             :   TObjArray fArrHisto;
     222             :   TH2F *fHTrackletMC,*fHTrackletAll,*fHTrackletFake,*fHTrackMC,*fHTrackAll,*fHTrackFake,*fHVtxDiffXY
     223             :     ,*fHVtxDiffXMlt,*fHVtxDiffYMlt,*fHVtxDiffZMlt
     224             :     ,*fHVtxPullXMlt,*fHVtxPullYMlt,*fHVtxPullZMlt
     225             :     ,*fHVtxMCSPDDiffXY
     226             :     ,*fHVtxMCSPDDiffXMlt,*fHVtxMCSPDDiffYMlt,*fHVtxMCSPDDiffZMlt
     227             :     ,*fHVtxMCSPDPullXY
     228             :     ,*fHVtxMCSPDPullXMlt,*fHVtxMCSPDPullYMlt,*fHVtxMCSPDPullZMlt
     229             :     ,*fHChi2NDFvsPT,*fHChi2vsNC;
     230             :   TH1F *fHVtxMltRef,*fHVtxOKMlt,*fHVtxDiffZ,*fHVtxMCSPDDiffZ;
     231             :   //
     232             :   void FillRecoStat();
     233             :   void FillTrackingControlHistos(int lrID,int lbl,const AliExternalTrackParam* bestTr,
     234             :                                  const double cpar[2],const double ccov[3],const AliITSRecPoint* bestCl);
     235             :   void BookHistos();
     236             :   Double_t* DefLogAx(double xMn,double xMx, int nbin);
     237             :  public:
     238             :   void SaveHistos(const char* outFName="XXXITSTrackerControlH.root");
     239             :   TObjArray* GetHistos() const {return (TObjArray*)&fArrHisto;}
     240             :   enum {kHResidY,kHPullY,kHResidZ,kHPullZ,kHChi2Cl};
     241             : #endif
     242             : 
     243             :  private:
     244             :   AliITSSAPTracker(const AliITSSAPTracker&);
     245             :   AliITSSAPTracker& operator=(const AliITSSAPTracker&);
     246           6 :   ClassDef(AliITSSAPTracker,0) // ITS SA primaries tracker/vertexer
     247             : };
     248             : 
     249             : 
     250             : //______________________________________________
     251             : inline Bool_t AliITSSAPTracker::IsBlacklisted(int id1,int id2)
     252             : {
     253             :   // check if this combination is blacklisted
     254           0 :   return fBlacklist->TestBitNumber(UInt_t(id1*fNClusters[0])+id2);
     255             : }
     256             : 
     257             : //______________________________________________
     258             : inline void AliITSSAPTracker::Blacklist(int id1,int id2)
     259             : {
     260             :   // blacklist this combination
     261           0 :   return fBlacklist->SetBitNumber(UInt_t(id1*fNClusters[0])+id2);
     262             : }
     263             : 
     264             : //______________________________________________
     265             : inline Float_t AliITSSAPTracker::GetChi2TotCut(int ncl) const
     266             : {
     267             :   // return chi2 cut for given number of clusters. Min ncl=3
     268           0 :   return fChi2TotCut[ncl-2];
     269             : }
     270             : 
     271             : #endif

Generated by: LCOV version 1.11