4 #include "AliExternalTrackParam.h"
5 #include "AliITSUAux.h"
8 using namespace AliITSUAux;
11 class AliITSUSeed: public AliExternalTrackParam
14 enum {kKilled=BIT(14),kSave=BIT(15),kMark=BIT(16),kFake=BIT(17)};
15 enum {kF02,kF04,kF12,kF13,kF14,kF24, kF44,kNFElem}; // non-trivial elems of propagation matrix
16 enum {kK00,kK01,kK10,kK11,kK20,kK21,kK30,kK31,kK40,kK41, kNKElem}; // non-trivial elems of gain matrix
17 enum {kS00,kS10,kS11,kS20,kS21,kS22,kS30,kS31,kS32,kS33,kS40,kS41,kS42,kS43,kS44,kNSElem}; // elements of 5x5 sym matrix
18 enum {kR00,kR22,kNRElem}; // non trivial elements of rotation matrix
21 AliITSUSeed(const AliITSUSeed& src);
22 AliITSUSeed &operator=(const AliITSUSeed &src);
23 virtual ~AliITSUSeed();
24 virtual void Print(Option_t* option = "") const;
26 void SetLrClusterID(Int_t lr, Int_t cl);
27 void SetLr(Int_t lr) {SetLrClusterID(lr,-1);} // lr w/o cluster
28 void SetLrClusterID(UInt_t id) {fClID = id;}
29 void SetParent(TObject* par) {fParent = par;}
30 void SetChi2Cl(Double_t v) {fChi2Cl= v; v>0 ? fChi2Glo+=v : fChi2Penalty -= v;}
31 void Kill(Bool_t v=kTRUE) {SetBit(kKilled, v);}
32 void SetFake(Bool_t v=kTRUE) {SetBit(kFake, v);}
33 void Save(Bool_t v=kTRUE) {SetBit(kSave,v);}
34 void SetMark(Bool_t v=kTRUE) {SetBit(kMark,v);}
35 void FlagTree(UInt_t bits, Bool_t v=kTRUE);
36 void SetChi2ITSTPC(Float_t v) {fChi2Match = v;}
37 void SetChi2ITSSA(Float_t v) {fChi2ITSSA = v;}
39 UInt_t GetLrClusterID() const {return fClID;}
40 Int_t GetLrCluster(Int_t &lr) const {return UnpackCluster(fClID,lr);}
41 Int_t GetLayerID() const {return UnpackLayer(fClID);}
42 Int_t GetClusterID() const {return UnpackCluster(fClID);}
43 Bool_t HasClusterOnLayer(Int_t lr) const {return fHitsPattern&(0x1<<lr);}
44 Bool_t HasCluster() const {return IsCluster(fClID);}
45 Int_t GetNLayersHit() const {return NumberOfBitsSet(fHitsPattern);}
46 Int_t GetNClusters() const;
47 Int_t GetClusterIndex(Int_t ind) const;
48 UShort_t GetHitsPattern() const {return fHitsPattern;}
49 Float_t GetChi2Cl() const {return fChi2Cl;}
50 Float_t GetChi2Glo() const {return fChi2Glo;}
51 Float_t GetChi2Penalty() const {return fChi2Penalty;}
52 Float_t GetChi2GloNrm() const;
53 Float_t GetChi2ITSTPC() const {return fChi2Match;}
54 Float_t GetChi2ITSSA() const {return fChi2ITSSA;}
55 Float_t GetQualityVar() const;
56 Bool_t IsKilled() const {return TestBit(kKilled);}
57 Bool_t IsFake() const {return TestBit(kFake);}
58 Bool_t IsSaved() const {return TestBit(kSave);}
59 Bool_t IsMarked() const {return TestBit(kMark);}
60 Bool_t ContainsFake() const;
61 Int_t FetchClusterInfo(Int_t *clIDarr) const;
63 Int_t GetPoolID() const {return int(GetUniqueID())-1;}
64 void SetPoolID(Int_t id) {SetUniqueID(id+1);}
66 TObject* GetParent() const {return fParent;}
67 const AliITSUSeed* GetParent(Int_t lr) const;
69 virtual Bool_t IsSortable() const {return kTRUE;}
70 virtual Bool_t IsEqual(const TObject* obj) const;
71 virtual Int_t Compare(const TObject* obj) const;
74 void InitFromSeed(const AliExternalTrackParam* seed);
76 void ApplyELoss2FMatrix(Double_t frac, Bool_t beforeProp);
77 Bool_t ApplyMaterialCorrection(Double_t xOverX0, Double_t xTimesRho, Double_t mass, Bool_t beforeProp);
78 Bool_t PropagateToX(Double_t xk, Double_t b);
79 Bool_t RotateToAlpha(Double_t alpha);
80 Bool_t GetTrackingXAtXAlpha(double xOther,double alpOther,double bz, double &x);
81 Double_t GetPredictedChi2(Double_t p[2],Double_t cov[3]);
83 Bool_t Smooth(Double_t vecL[5],Double_t matL[15]);
84 Double_t* ProdABA(const double a[15],const double b[15]) const;
86 UInt_t GetNChildren() const {return fNChildren;}
87 Int_t IncChildren() {return ++fNChildren;}
88 Int_t DecChildren() {return --fNChildren;}
89 Double_t GetResidY() const {return fResid[0];}
90 Double_t GetResidZ() const {return fResid[1];}
92 #ifdef _ITSU_TUNING_MODE_ // this is used only for tuning histo filling
93 void SetOrdBranch(UShort_t v) {fOrdBranch=v;}
94 void SetOrdCand(UShort_t v) {fOrdCand=v;}
95 Int_t GetOrdBranch() const {return fOrdBranch;}
96 Int_t GetOrdCand() const {return fOrdCand;}
97 Double_t GetPullY() const {return fResid[0]*Sqrt(fCovIYZ[0]);}
98 Double_t GetPullZ() const {return fResid[1]*Sqrt(fCovIYZ[2]);}
103 UShort_t fHitsPattern; // bit pattern of hits
104 UShort_t fNChildren; // number of children (prolongations)
105 UInt_t fClID; // packed cluster info (see AliITSUAux::PackCluster)
106 Float_t fChi2Glo; // current chi2 global (sum of track-cluster chi2's on layers with hit)
107 Float_t fChi2Cl; // track-cluster chi2 (if >0) or penalty for missing cluster (if < 0)
108 Float_t fChi2Penalty; // total penalty (e.g. for missing clusters)
109 Float_t fChi2Match; // ITS/TPC matching chi2 (per NDF) // RS: to move to separate object of final seed
110 Float_t fChi2ITSSA; // ITSSA backward fit chi2 (per NDF) // RS: to move to separate object of final seed
111 Double_t fFMatrix[kNFElem]; // matrix of propagation from prev layer (non-trivial elements)
112 Double_t fKMatrix[kNKElem]; // Gain matrix non-trivial elements (note: standard MBF formula uses I-K*H)
113 Double_t fRMatrix[kNRElem]; // rotation matrix non-trivial elements
114 Double_t fCovIYZ[3]; // inverted matrix of propagation + meas errors = [Hi * Pi|i-1 * Hi^T + Ri]^-1
115 Double_t fResid[2]; // residuals vector
116 TObject* fParent; // parent track (in higher tree hierarchy)
118 #ifdef _ITSU_TUNING_MODE_ // this is used only for tuning histo filling
119 UShort_t fOrdBranch; //! order in the seed branching
120 UShort_t fOrdCand; //! order in candidates tree
123 ClassDef(AliITSUSeed,1)
126 //_________________________________________________________________________
127 inline void AliITSUSeed::SetLrClusterID(Int_t lr, Int_t cl)
129 // assign layer, cluster (if -1 - no hit on this layer)
130 fClID = PackCluster(lr,cl);
131 if (cl>=0) fHitsPattern |= 0x1<<lr;
134 //_________________________________________________________________________
135 inline void AliITSUSeed::ResetFMatrix()
137 // reset transport matrix
138 fFMatrix[kF02] = fFMatrix[kF04] = fFMatrix[kF12] = fFMatrix[kF13] = fFMatrix[kF14] = fFMatrix[kF24] = 0;
139 fFMatrix[kF44] = 1.0; // this element accumulates eloss
142 //_________________________________________________________________________
143 inline Bool_t AliITSUSeed::ApplyMaterialCorrection(Double_t xOverX0, Double_t xTimesRho, Double_t mass, Bool_t beforeProp)
145 // apply material correction and modify transport matrix
146 double pold = Get1P();
147 if (!CorrectForMeanMaterial(xOverX0,xTimesRho,mass)) return kFALSE;
148 ApplyELoss2FMatrix( Get1P()/pold, beforeProp);
153 //_________________________________________________________________________
154 inline void AliITSUSeed::ApplyELoss2FMatrix(Double_t frac, Bool_t beforeProp)
156 // Accounts for the energy loss in the transport matrix
157 // equivalent to multiplying Fmatix by E=diag{1,1,1,1,P4new/P4old}, where P4 is the 1/pt param.
158 // If beforeProp is true, then it is assumed that the eloss was applied before the transport,
159 // i.e. F' = F * E, otherwise, after transport, F' = E * F
160 fFMatrix[kF44] *= frac;
162 fFMatrix[kF04] *= frac;
163 fFMatrix[kF14] *= frac;
164 fFMatrix[kF24] *= frac;
168 //_________________________________________________________________________
169 inline const AliITSUSeed* AliITSUSeed::GetParent(Int_t lr) const
171 // get parent at given layer
172 const AliITSUSeed* par=this;
174 while( par && (lrt=par->GetLayerID())>=0 ) {
176 par = dynamic_cast<const AliITSUSeed*>(par->GetParent());
181 //__________________________________________________________________
182 inline Int_t AliITSUSeed::GetNClusters() const
184 // count number of clusters (some layers may have >1 hit)
186 const AliITSUSeed* seed = this;
188 if (seed->HasCluster()) ncl++;
189 seed = (AliITSUSeed*)seed->GetParent();
195 //__________________________________________________________________
196 inline void AliITSUSeed::FlagTree(UInt_t bits, Bool_t v)
198 // set bits on all tree levels
199 AliITSUSeed* seed = this;
200 do {seed->SetBit(bits,v);} while ( (seed=(AliITSUSeed*)seed->GetParent()) );
204 //__________________________________________________________________
205 inline Float_t AliITSUSeed::GetQualityVar() const
207 // return variable for quality check (the smaller - the better)
208 // return GetChi2ITSSA()/Pt(); // this may change! RS
209 return GetChi2GloNrm()/Pt();