]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/UPGRADE/AliITSUSeed.h
Coverity fixes
[u/mrichter/AliRoot.git] / ITS / UPGRADE / AliITSUSeed.h
1 #ifndef ALIITSUSEED_H
2 #define ALIITSUSEED_H
3
4 #include "AliExternalTrackParam.h"
5 #include "AliITSUAux.h"
6 using namespace AliITSUAux;
7
8
9 class AliITSUSeed: public AliExternalTrackParam
10 {
11  public:
12   enum {kKilled=BIT(14)};
13   enum {kF02,kF04,kF12,kF13,kF14,kF24, kF44,kNFElem}; // non-trivial elems of propagation matrix
14   enum {kB00,kB01,kB02,kB03,kB04,kB10,kB11,kB12,kB13,kB14, kNBElem}; // non-trivial elems of B matrix (I - K*H)
15   //
16   AliITSUSeed();
17   AliITSUSeed(const AliITSUSeed& src);
18   AliITSUSeed &operator=(const AliITSUSeed &src);
19   virtual ~AliITSUSeed();
20   virtual void    Print(Option_t* option = "") const;
21   //
22   void            SetLrClusterID(Int_t lr, Int_t cl);
23   void            SetLr(Int_t lr)                        {SetLrClusterID(lr,-1);} // lr w/o cluster
24   void            SetLrClusterID(UInt_t id)              {fClID = id;}
25   void            SetParent(TObject* par)                {fParent = par;}
26   void            SetChi2Cl(Double_t v)                  {fChi2Glo += fChi2Cl= v;}
27   void            Kill(Bool_t v=kTRUE)                   {SetBit(kKilled, v);}
28   //
29   UInt_t          GetLrClusterID()                 const {return fClID;}
30   Int_t           GetLrCluster(Int_t &lr)          const {return UnpackCluster(fClID,lr);}
31   Int_t           GetLayerID()                     const {return UnpackLayer(fClID);}
32   Int_t           GetClusterID()                   const {return UnpackCluster(fClID);}
33   Bool_t          HasClusterOnLayer(Int_t lr)      const {return fHitsPattern&(0x1<<lr);}
34   Int_t           GetNLayersHit()                  const {return NumberOfBitsSet(fHitsPattern);}
35   UShort_t        GetHitsPattern()                 const {return fHitsPattern;}
36   Float_t         GetChi2Cl()                      const {return fChi2Cl;}
37   Float_t         GetChi2Glo()                     const {return fChi2Glo;}
38   Float_t         GetChi2GloNrm()                  const;
39   Bool_t          IsKilled()                       const {return TestBit(kKilled);}
40   //
41   TObject*        GetParent()                      const {return fParent;}
42   //
43   virtual Bool_t  IsSortable()                     const {return kTRUE;}
44   virtual Bool_t  IsEqual(const TObject* obj)      const;
45   virtual Int_t   Compare(const TObject* obj)      const;
46   //
47   // test
48   void            ResetFMatrix();
49   void            ApplyELoss2FMatrix(Double_t frac, Bool_t beforeProp);
50   Bool_t          ApplyMaterialCorrection(Double_t xOverX0, Double_t xTimesRho, Double_t mass, Bool_t beforeProp);
51   Bool_t          PropagateToX(Double_t xk, Double_t b);
52   //
53  protected:
54   //
55   Double_t              fFMatrix[kNFElem];  // matxif of propagation from prev layer (non-trivial elements)
56   Double_t              fResid[2];          // residuals vector
57   Double_t              fCombErrI[3];       // inverse combined error matrix
58   Double_t              fBMatix[kNBElem];   // I - K*H matix non-trivial elements
59   UShort_t              fHitsPattern;       // bit pattern of hits
60   UInt_t                fClID;              // packed cluster info (see AliITSUAux::PackCluster)
61   Float_t               fChi2Glo;           // current chi2 global
62   Float_t               fChi2Cl;            // track-cluster chi2
63   TObject*              fParent;            // parent track (in higher tree hierarchy)
64   
65   ClassDef(AliITSUSeed,1)
66 };
67
68 //_________________________________________________________________________
69 inline void AliITSUSeed::SetLrClusterID(Int_t lr, Int_t cl)
70 {
71   // assign layer, cluster (if -1 - no hit on this layer)
72   fClID = PackCluster(lr,cl);
73   if (cl>=0) fHitsPattern |= 0x1<<lr;
74 }
75
76 //_________________________________________________________________________
77 inline void AliITSUSeed::ResetFMatrix()
78 {
79   // reset transport matrix
80   fFMatrix[kF02] = fFMatrix[kF04] = fFMatrix[kF12] = fFMatrix[kF13] = fFMatrix[kF14] = fFMatrix[kF24] = 0;
81   fFMatrix[kF44] = 1.0;  // this element accumulates eloss 
82 }
83
84 //_________________________________________________________________________
85 inline Bool_t AliITSUSeed::ApplyMaterialCorrection(Double_t xOverX0, Double_t xTimesRho, Double_t mass, Bool_t beforeProp)
86 {
87   // apply material correction and modify transport matrix
88   double pold = Get1P();
89   if (!CorrectForMeanMaterial(xOverX0,xTimesRho,mass)) return kFALSE;
90   ApplyELoss2FMatrix( Get1P()/pold, beforeProp);
91   return kTRUE;
92 }
93
94
95 //_________________________________________________________________________
96 inline void AliITSUSeed::ApplyELoss2FMatrix(Double_t frac, Bool_t beforeProp)
97 {
98   // Accounts for the energy loss in the transport matrix
99   // equivalent to multiplying Fmatix by E=diag{1,1,1,1,P4new/P4old}, where P4 is the 1/pt param.
100   // If beforeProp is true, then it is assumed that the eloss was applied before the transport,
101   // i.e. F' = F * E, otherwise, after transport, F' = E * F
102   fFMatrix[kF44] *= frac;
103   if (beforeProp) {
104     fFMatrix[kF04] *= frac;
105     fFMatrix[kF14] *= frac;
106     fFMatrix[kF24] *= frac;
107   }
108 }
109
110
111 #endif