]>
Commit | Line | Data |
---|---|---|
32e449be | 1 | #ifndef ALIMULTIPLICITY_H |
2 | #define ALIMULTIPLICITY_H | |
3 | ||
59495bf1 | 4 | #include <TObject.h> |
ff44c37c | 5 | #include <TBits.h> |
59495bf1 | 6 | #include <TMath.h> |
7 | class AliRefArray; | |
32e449be | 8 | |
9 | //////////////////////////////////////////////////////// | |
10 | //// Class containing multiplicity information // | |
11 | //// to stored in the ESD // | |
12 | //////////////////////////////////////////////////////// | |
13 | ||
14 | class AliMultiplicity : public TObject { | |
15 | ||
16 | public: | |
59495bf1 | 17 | // |
18 | enum {kMultTrackRefs =BIT(14),// in new format (old is default for bwd.comp.) multiple cluster->track references are allowed | |
19 | kScaleDThtbySin2=BIT(15) // scale Dtheta by 1/sin^2(theta). Default is DON'T scale, for bwd.comp. | |
20 | }; | |
32e449be | 21 | AliMultiplicity(); // default constructor |
22 | // standard constructor | |
fa9ed8e9 | 23 | AliMultiplicity(Int_t ntr,Float_t *th, Float_t *ph, Float_t *dth, Float_t *dph, Int_t *labels, |
d7c5c1e4 | 24 | Int_t* labelsL2, Int_t ns, Float_t *ts, Float_t *ps, Int_t *labelss, Short_t nfcL1, Short_t nfcL2, const TBits & fFastOrFiredChips); |
1f9831ab | 25 | AliMultiplicity(Int_t ntr, Int_t ns, Short_t nfcL1, Short_t nfcL2, const TBits & fFastOr); |
32e449be | 26 | AliMultiplicity(const AliMultiplicity& m); |
27 | AliMultiplicity& operator=(const AliMultiplicity& m); | |
732a24fe | 28 | virtual void Copy(TObject &obj) const; |
1f9831ab | 29 | virtual void Clear(Option_t* opt=""); |
32e449be | 30 | virtual ~AliMultiplicity(); |
59495bf1 | 31 | // methods to access tracklet information |
32 | Bool_t GetMultTrackRefs() const {return TestBit(kMultTrackRefs);} | |
33 | void SetMultTrackRefs(Bool_t v) {SetBit(kMultTrackRefs,v);} | |
34 | Bool_t GetScaleDThetaBySin2T() const {return TestBit(kScaleDThtbySin2);} | |
35 | void SetScaleDThetaBySin2T(Bool_t v) {SetBit(kScaleDThtbySin2,v);} | |
36 | ||
37 | // | |
32e449be | 38 | Int_t GetNumberOfTracklets() const {return fNtracks;} |
4f499767 | 39 | Double_t GetTheta(Int_t i) const { |
40 | if(i>=0 && i<fNtracks) return fTh[i]; | |
41 | Error("GetTheta","Invalid track number %d",i); return -9999.; | |
42 | } | |
43 | Double_t GetEta(Int_t i) const { | |
44 | if(i>=0 && i<fNtracks) return -TMath::Log(TMath::Tan(fTh[i]/2.)); | |
45 | Error("GetEta","Invalid track number %d",i); return -9999.; | |
46 | } | |
47 | Double_t GetPhi(Int_t i) const { | |
48 | if(i>=0 && i<fNtracks) return fPhi[i]; | |
49 | Error("GetPhi","Invalid track number %d",i); return -9999.; | |
50 | } | |
51 | Double_t GetDeltaTheta(Int_t i) const { | |
52 | if(fDeltTh && i>=0 && i<fNtracks) return fDeltTh[i]; | |
53 | Error("GetDeltaTheta","DeltaTheta not available in data or Invalid track number %d(max %d)",i, fNtracks); return -9999.; | |
54 | } | |
55 | Double_t GetDeltaPhi(Int_t i) const { | |
56 | if(i>=0 && i<fNtracks) return fDeltPhi[i]; | |
57 | Error("GetDeltaPhi","Invalid track number %d",i); return -9999.; | |
58 | } | |
eda42f29 | 59 | |
59495bf1 | 60 | Double_t CalcDist(Int_t it) const; |
61 | ||
eda42f29 | 62 | Int_t GetLabel(Int_t i, Int_t layer) const; |
56258350 | 63 | void SetLabel(Int_t i, Int_t layer, Int_t label); |
d7c5c1e4 | 64 | Int_t GetLabelSingle(Int_t i) const; |
65 | void SetLabelSingle(Int_t i, Int_t label); | |
66 | ||
34581d1e | 67 | Bool_t FreeClustersTracklet(Int_t i, Int_t mode) const; |
68 | Bool_t FreeSingleCluster(Int_t i, Int_t mode) const; | |
1f9831ab | 69 | |
eda42f29 | 70 | |
968e8539 | 71 | // methods to access single cluster information |
72 | Int_t GetNumberOfSingleClusters() const {return fNsingle;} | |
4f499767 | 73 | Double_t GetThetaSingle(Int_t i) const { |
74 | if(i>=0 && i<fNsingle) return fThsingle[i]; | |
75 | Error("GetThetaSingle","Invalid cluster number %d",i); return -9999.; | |
76 | } | |
77 | ||
78 | Double_t GetPhiSingle(Int_t i) const { | |
79 | if(i>=0 && i<fNsingle) return fPhisingle[i]; | |
80 | Error("GetPhisingle","Invalid cluster number %d",i); return -9999.; | |
81 | } | |
32e449be | 82 | |
ab37e14c | 83 | Short_t GetNumberOfFiredChips(Int_t layer) const { return fFiredChips[layer]; } |
84 | void SetFiredChips(Int_t layer, Short_t firedChips) { fFiredChips[layer] = firedChips; } | |
466ffa28 | 85 | |
d325d83f | 86 | UInt_t GetNumberOfITSClusters(Int_t layer) const { return layer<6 ? fITSClusters[layer] : 0; } |
87 | UInt_t GetNumberOfITSClusters(Int_t layMin, Int_t layMax) const ; | |
88 | void SetITSClusters(Int_t layer, UInt_t clusters) { fITSClusters[layer] = clusters; } | |
89 | ||
ee87788b | 90 | void SetFastOrFiredChips(UInt_t chipKey){fFastOrFiredChips.SetBitNumber(chipKey);} |
adc4b00f | 91 | const TBits & GetFastOrFiredChips() const {return fFastOrFiredChips;} |
ee87788b | 92 | Bool_t TestFastOrFiredChips(UInt_t chipKey) const {return fFastOrFiredChips.TestBitNumber(chipKey);} |
ff44c37c | 93 | |
ab37e14c | 94 | void SetFiredChipMap(TBits & firedChips){fClusterFiredChips = firedChips;} |
95 | void SetFiredChipMap(UInt_t chipKey){fClusterFiredChips.SetBitNumber(chipKey);} | |
96 | const TBits & GetFiredChipMap() const {return fClusterFiredChips;} | |
97 | Bool_t TestFiredChipMap(UInt_t chipKey) const {return fClusterFiredChips.TestBitNumber(chipKey);} | |
adc4b00f | 98 | |
34581d1e | 99 | Bool_t GetTrackletTrackIDs(Int_t i, Int_t mode, Int_t &spd1, Int_t &spd2) const; |
59495bf1 | 100 | Int_t GetTrackletTrackIDsLay(Int_t lr,Int_t i, Int_t mode, UInt_t* refs, UInt_t maxRef) const; |
34581d1e | 101 | Bool_t GetSingleClusterTrackID(Int_t i, Int_t mode, Int_t &tr) const; |
59495bf1 | 102 | Int_t GetSingleClusterTrackIDs(Int_t i, Int_t mode, UInt_t* refs, UInt_t maxRef) const; |
1f9831ab | 103 | |
104 | // array getters | |
105 | Double_t* GetTheta() const {return (Double_t*)fTh;} | |
106 | Double_t* GetPhi() const {return (Double_t*)fPhi;} | |
107 | Double_t* GetDeltTheta() const {return (Double_t*)fDeltTh;} | |
108 | Double_t* GetDeltPhi() const {return (Double_t*)fDeltPhi;} | |
109 | Double_t* GetThetaSingle() const {return (Double_t*)fThsingle;} | |
110 | Double_t* GetPhiSingle() const {return (Double_t*)fPhisingle;} | |
d7c5c1e4 | 111 | Int_t* GetLabels() const {return (Int_t*)fLabels;} |
1f9831ab | 112 | Int_t* GetLabels2() const {return (Int_t*)fLabelsL2;} |
d7c5c1e4 | 113 | Int_t* GetLabelsSingle() const {return (Int_t*)fLabelssingle;} |
1f9831ab | 114 | |
59495bf1 | 115 | void AttachTracklet2TrackRefs(AliRefArray* l1t1,AliRefArray* l1t2,AliRefArray* l2t1,AliRefArray* l2t2) { |
116 | fTCl2Tracks[0][0] = l1t1; fTCl2Tracks[0][1] = l1t2; fTCl2Tracks[1][0] = l2t1; fTCl2Tracks[1][1] = l2t2; | |
117 | } | |
118 | void AttachCluster2TrackRefs(AliRefArray* l1t1,AliRefArray* l1t2) { | |
119 | fSCl2Tracks[0] = l1t1; fSCl2Tracks[1] = l1t2; | |
120 | } | |
121 | void SetTrackletData(Int_t id, const Float_t* tlet, UInt_t trSPD1=0, UInt_t trSPD2=0); | |
122 | void SetSingleClusterData(Int_t id, const Float_t* scl,UInt_t tr=0); | |
123 | void CompactBits(); | |
124 | // | |
125 | void SetDPhiWindow2(Float_t v=-1) {fDPhiWindow2 = v;} | |
126 | void SetDThetaWindow2(Float_t v=-1) {fDThetaWindow2 = v;} | |
127 | void SetDPhiShift(Float_t v=-1) {fDPhiShift = v;} | |
128 | void SetNStdDev(Float_t v=1) {fNStdDev = v;} | |
129 | // | |
130 | Float_t GetDPhiWindow2() const {return fDPhiWindow2;} | |
131 | Float_t GetDThetaWindow2() const {return fDThetaWindow2;} | |
132 | Float_t GetDPhiShift() const {return fDPhiShift;} | |
133 | Float_t GetNStdDev() const {return fNStdDev;} | |
134 | ||
135 | // | |
1f9831ab | 136 | virtual void Print(Option_t *opt="") const; |
137 | ||
32e449be | 138 | protected: |
139 | void Duplicate(const AliMultiplicity &m); // used by copy ctr. | |
32e449be | 140 | |
cd888a89 | 141 | Int_t fNtracks; // Number of tracklets |
59495bf1 | 142 | Int_t fNsingle; // Number of clusters on SPD layer 1, not associated with a tracklet on SPD layer 2 |
143 | // | |
144 | Float_t fDPhiWindow2; // sigma^2 in dphi used in reco | |
145 | Float_t fDThetaWindow2; // sigma^2 in dtheta used in reco | |
146 | Float_t fDPhiShift; // bending shift used | |
147 | Float_t fNStdDev; // number of standard deviations kept | |
148 | // | |
0939e22a | 149 | Int_t *fLabels; //[fNtracks] array with labels of cluster in L1 used for tracklet |
150 | Int_t *fLabelsL2; //[fNtracks] array with labels of cluster in L2 used for tracklet | |
59495bf1 | 151 | UInt_t* fUsedClusS; //[fNsingle] id+1 of the tracks using cluster, coded as (TPC/ITS+ITS_SA)+(ITS_SA_PURE<<16) !!! Outphased for multiple refs |
c8122432 | 152 | ULong64_t* fUsedClusT; //[fNtracks] id+1 of the tracks using clusters, coded as (TPC/ITS+ITS_SA)+(ITS_SA_PURE<<16) for SPD1 and SPD2 in low and high parts |
59495bf1 | 153 | AliRefArray *fTCl2Tracks[2][2]; // container with multiple tracklet_cluster->track references |
154 | AliRefArray *fSCl2Tracks[2]; // container with multiple single_cluster->track references | |
cd888a89 | 155 | Double32_t *fTh; //[fNtracks] array with theta values |
156 | Double32_t *fPhi; //[fNtracks] array with phi values | |
fa9ed8e9 | 157 | Double32_t *fDeltTh; //[fNtracks] array with delta theta values |
cd888a89 | 158 | Double32_t *fDeltPhi; //[fNtracks] array with delta phi values |
159 | Double32_t *fThsingle; //[fNsingle] array with theta values of L1 clusters | |
1f9831ab | 160 | Double32_t *fPhisingle; //[fNsingle] array with phi values of L1 clusters |
d7c5c1e4 | 161 | Int_t *fLabelssingle; //[fNsingle] array with labels of clusters in L1 not used for tracklets |
ab37e14c | 162 | Short_t fFiredChips[2]; // Number of fired chips in the two SPD layers |
d7c5c1e4 | 163 | UInt_t fITSClusters[6]; // Number of ITS cluster per layer |
ff44c37c | 164 | TBits fFastOrFiredChips; // Map of FastOr fired chips |
1f9831ab | 165 | TBits fClusterFiredChips; // Map of fired chips (= at least one cluster) |
ff44c37c | 166 | |
7c07de7e | 167 | ClassDef(AliMultiplicity,18); |
32e449be | 168 | }; |
169 | ||
eda42f29 | 170 | inline Int_t AliMultiplicity::GetLabel(Int_t i, Int_t layer) const |
171 | { | |
172 | if(i>=0 && i<fNtracks) { | |
173 | if (layer == 0) { | |
174 | return fLabels[i]; | |
175 | } else if (layer == 1) { | |
176 | if (fLabelsL2) { | |
177 | return fLabelsL2[i]; | |
178 | } else { | |
179 | Warning("GetLabel", "No information for layer 2 available !"); | |
180 | return -9999; | |
181 | } | |
182 | } else { | |
183 | Error("GetLabel","Invalid layer number %d",layer); return -9999; | |
184 | } | |
185 | } else { | |
186 | Error("GetLabel","Invalid track number %d",i); return -9999; | |
187 | } | |
4f499767 | 188 | return -9999; |
eda42f29 | 189 | } |
d7c5c1e4 | 190 | |
191 | inline Int_t AliMultiplicity::GetLabelSingle(Int_t i) const | |
192 | { | |
193 | if(i>=0 && i<fNsingle) { | |
194 | return fLabelssingle[i]; | |
195 | } else { | |
196 | Error("GetLabelSingle","Invalid cluster number %d",i); return -9999; | |
197 | } | |
198 | return -9999; | |
199 | } | |
200 | ||
201 | ||
59495bf1 | 202 | inline Double_t AliMultiplicity::CalcDist(Int_t i) const |
203 | { | |
204 | // calculate eliptical distance. theta is the angle of cl1, dtheta = tht(cl1)-tht(cl2) | |
205 | if (i<0 && i>=fNtracks) return -1; | |
206 | if (fDPhiWindow2<1E-9 || fDThetaWindow2<1E-9) return -1; // not stored | |
207 | double dphi = TMath::Abs(fDeltPhi[i]) - fDPhiShift; | |
208 | double dtheta = fDeltTh[i]; | |
209 | if (GetScaleDThetaBySin2T()) { | |
210 | double sinTI = TMath::Sin(fTh[i]-dtheta/2); | |
211 | sinTI *= sinTI; | |
212 | dtheta /= sinTI>1.e-6 ? sinTI : 1.e-6; | |
213 | } | |
214 | return dphi*dphi/fDPhiWindow2 + dtheta*dtheta/fDThetaWindow2; | |
215 | } | |
216 | ||
d7c5c1e4 | 217 | |
218 | ||
32e449be | 219 | #endif |