]>
Commit | Line | Data |
---|---|---|
3c18eefd | 1 | #include "AliITSUTrackCond.h" |
2 | #include "AliITSUAux.h" | |
3 | #include "AliLog.h" | |
ee54014a | 4 | #include <TMath.h> |
3c18eefd | 5 | |
6 | using namespace AliITSUAux; | |
ee54014a | 7 | using namespace TMath; |
8 | ||
c03e4f8a | 9 | Char_t AliITSUTrackCond::fgkClSharing = 0; |
ee54014a | 10 | Int_t AliITSUTrackCond::fgkMaxBranches = 50; |
11 | Int_t AliITSUTrackCond::fgkMaxCandidates = 500; | |
12 | Float_t AliITSUTrackCond::fgkMaxTr2ClChi2 = 50.; | |
08419930 | 13 | Float_t AliITSUTrackCond::fgkMaxChi2GloNrm = 50.; |
ee54014a | 14 | Float_t AliITSUTrackCond::fgkMissPenalty = 2.; |
9cdcba2c | 15 | Float_t AliITSUTrackCond::fgkMaxMatchChi2 = 15.; |
16 | Float_t AliITSUTrackCond::fgkMaxITSSAChi2 = 15; | |
3c18eefd | 17 | //______________________________________________________________ |
18 | AliITSUTrackCond::AliITSUTrackCond(int nLayers) | |
ee54014a | 19 | :fInitDone(kFALSE) |
d99994b2 | 20 | ,fActiveLrInner(0) |
21 | ,fActiveLrOuter(0) | |
097e4cdf | 22 | ,fAllowLayers(0) |
ee54014a | 23 | ,fNLayers(0) |
9cdcba2c | 24 | ,fMaxITSTPCMatchChi2(fgkMaxMatchChi2) |
c03e4f8a | 25 | ,fClSharing(0) |
38997c3c | 26 | ,fMaxBranches(0) |
27 | ,fMaxCandidates(0) | |
5e3587be | 28 | ,fMaxITSSAChi2(0) |
ee54014a | 29 | ,fMaxTr2ClChi2(0) |
08419930 | 30 | ,fMaxChi2GloNrm(0) |
ee54014a | 31 | ,fMissPenalty(0) |
32 | ,fNSigmaRoadY(0) | |
33 | ,fNSigmaRoadZ(0) | |
3c18eefd | 34 | ,fNConditions(0) |
35 | ,fConditions(0) | |
36 | ,fAuxData(0) | |
37 | { | |
38 | // def c-tor | |
38997c3c | 39 | if (nLayers) SetNLayers(nLayers); |
3c18eefd | 40 | } |
41 | ||
42 | //______________________________________________________________ | |
43 | AliITSUTrackCond::AliITSUTrackCond(const AliITSUTrackCond& src) | |
ee54014a | 44 | :TObject(src) |
45 | ,fInitDone(src.fInitDone) | |
d99994b2 | 46 | ,fActiveLrInner(src.fActiveLrInner) |
47 | ,fActiveLrOuter(src.fActiveLrOuter) | |
097e4cdf | 48 | ,fAllowLayers(src.fAllowLayers) |
ee54014a | 49 | ,fNLayers(0) |
9cdcba2c | 50 | ,fMaxITSTPCMatchChi2(src.fMaxITSTPCMatchChi2) |
c03e4f8a | 51 | ,fClSharing(0) |
38997c3c | 52 | ,fMaxBranches(0) |
53 | ,fMaxCandidates(0) | |
5e3587be | 54 | ,fMaxITSSAChi2(0) |
ee54014a | 55 | ,fMaxTr2ClChi2(0) |
08419930 | 56 | ,fMaxChi2GloNrm(0) |
ee54014a | 57 | ,fMissPenalty(0) |
58 | ,fNSigmaRoadY(0) | |
59 | ,fNSigmaRoadZ(0) | |
3c18eefd | 60 | ,fNConditions(src.fNConditions) |
61 | ,fConditions(src.fConditions) | |
62 | ,fAuxData(src.fAuxData) | |
63 | { | |
64 | // copy c-tor | |
ee54014a | 65 | SetNLayers(src.fNLayers); |
66 | for (int i=fNLayers;i--;) { | |
67 | SetMaxBranches(i,src.GetMaxBranches(i)); | |
68 | SetMaxCandidates(i,src.GetMaxCandidates(i)); | |
69 | SetMaxTr2ClChi2(i,src.GetMaxTr2ClChi2(i)); | |
08419930 | 70 | SetMaxChi2GloNrm(i,src.GetMaxChi2GloNrm(i)); |
ee54014a | 71 | SetMissPenalty(i,src.GetMissPenalty(i)); |
72 | SetNSigmaRoadY(i,src.GetNSigmaRoadY(i)); | |
73 | SetNSigmaRoadZ(i,src.GetNSigmaRoadZ(i)); | |
c03e4f8a | 74 | SetClSharing(i,src.GetClSharing(i)); |
5e3587be | 75 | SetMaxITSSAChi2(1+2*i,src.GetMaxITSSAChi2(1+2*i)); |
76 | SetMaxITSSAChi2(1+2*i+1,src.GetMaxITSSAChi2(1+2*i+1)); | |
38997c3c | 77 | } |
3c18eefd | 78 | } |
79 | ||
80 | //______________________________________________________________ | |
81 | AliITSUTrackCond& AliITSUTrackCond::operator=(const AliITSUTrackCond& src) | |
82 | { | |
83 | // copy op. | |
84 | if (this!=&src) { | |
ee54014a | 85 | fInitDone = src.fInitDone; |
d99994b2 | 86 | fActiveLrInner = src.fActiveLrInner; |
87 | fActiveLrOuter = src.fActiveLrOuter; | |
88 | // | |
097e4cdf | 89 | fAllowLayers = src.fAllowLayers; |
3c18eefd | 90 | fNConditions = src.fNConditions; |
91 | fConditions = src.fConditions; | |
9cdcba2c | 92 | fMaxITSTPCMatchChi2 = src.fMaxITSTPCMatchChi2; |
ee54014a | 93 | // |
94 | SetNLayers(src.fNLayers); | |
95 | // | |
96 | for (int i=fNLayers;i--;) { | |
97 | SetMaxBranches(i,src.GetMaxBranches(i)); | |
98 | SetMaxCandidates(i,src.GetMaxCandidates(i)); | |
99 | SetMaxTr2ClChi2(i,src.GetMaxTr2ClChi2(i)); | |
08419930 | 100 | SetMaxChi2GloNrm(i,src.GetMaxChi2GloNrm(i)); |
ee54014a | 101 | SetMissPenalty(i,src.GetMissPenalty(i)); |
102 | SetNSigmaRoadY(i,src.GetNSigmaRoadY(i)); | |
103 | SetNSigmaRoadZ(i,src.GetNSigmaRoadZ(i)); | |
c03e4f8a | 104 | SetClSharing(i,src.GetClSharing(i)); |
5e3587be | 105 | SetMaxITSSAChi2(1+2*i,src.GetMaxITSSAChi2(1+2*i)); |
106 | SetMaxITSSAChi2(1+2*i+1,src.GetMaxITSSAChi2(1+2*i+1)); | |
38997c3c | 107 | } |
3c18eefd | 108 | fAuxData = src.fAuxData; |
109 | } | |
110 | return *this; | |
111 | } | |
112 | ||
38997c3c | 113 | //______________________________________________________________ |
114 | void AliITSUTrackCond::SetNLayers(int nLayers) | |
115 | { | |
116 | // set number of layers | |
ee54014a | 117 | fInitDone = kFALSE; |
118 | if (fNLayers) { | |
9a2806bf | 119 | delete[] fClSharing; |
120 | delete[] fMaxBranches; | |
121 | delete[] fMaxCandidates; | |
122 | delete[] fMaxTr2ClChi2; | |
08419930 | 123 | delete[] fMaxChi2GloNrm; |
9a2806bf | 124 | delete[] fMissPenalty; |
125 | delete[] fNSigmaRoadY; | |
126 | delete[] fNSigmaRoadZ; | |
5e3587be | 127 | delete[] fMaxITSSAChi2; |
ee54014a | 128 | } |
38997c3c | 129 | fNLayers = nLayers; |
097e4cdf | 130 | fAllowLayers = 0; |
ee54014a | 131 | // |
38997c3c | 132 | if (fNLayers>0) { |
d99994b2 | 133 | fActiveLrInner = 0; |
134 | fActiveLrOuter = fNLayers-1; | |
c03e4f8a | 135 | fClSharing = new Char_t[fNLayers]; |
136 | fMaxBranches = new Short_t[fNLayers]; | |
38997c3c | 137 | fMaxCandidates = new Short_t[fNLayers]; |
ee54014a | 138 | fMaxTr2ClChi2 = new Float_t[fNLayers]; |
08419930 | 139 | fMaxChi2GloNrm = new Float_t[fNLayers]; |
ee54014a | 140 | fMissPenalty = new Float_t[fNLayers]; |
141 | fNSigmaRoadY = new Float_t[fNLayers]; | |
142 | fNSigmaRoadZ = new Float_t[fNLayers]; | |
5e3587be | 143 | fMaxITSSAChi2 = new Float_t[2*fNLayers]; |
38997c3c | 144 | for (int i=fNLayers;i--;) { |
097e4cdf | 145 | fAllowLayers |= 0x1<<i; |
c03e4f8a | 146 | SetClSharing(i,fgkClSharing); |
ee54014a | 147 | SetMaxBranches(i,fgkMaxBranches); |
148 | SetMaxCandidates(i,fgkMaxCandidates); | |
149 | SetMaxTr2ClChi2(i,fgkMaxTr2ClChi2); | |
08419930 | 150 | SetMaxChi2GloNrm(i,fgkMaxChi2GloNrm); |
ee54014a | 151 | SetMissPenalty(i,fgkMissPenalty); |
5e3587be | 152 | SetMaxITSSAChi2(1+2*i,fgkMaxITSSAChi2); |
153 | SetMaxITSSAChi2(1+2*i+1,fgkMaxITSSAChi2); | |
ee54014a | 154 | SetNSigmaRoadY(i,-1); // force recalculation |
155 | SetNSigmaRoadZ(i,-1); // force recalculation | |
38997c3c | 156 | } |
157 | } | |
ee54014a | 158 | else { |
c03e4f8a | 159 | fClSharing = 0; |
ee54014a | 160 | fMaxBranches = 0; |
161 | fMaxCandidates = 0; | |
162 | fMaxTr2ClChi2 = 0; | |
08419930 | 163 | fMaxChi2GloNrm = 0; |
ee54014a | 164 | fMissPenalty = 0; |
165 | fNSigmaRoadY = 0; | |
166 | fNSigmaRoadZ = 0; | |
167 | } | |
168 | // | |
38997c3c | 169 | } |
170 | ||
3c18eefd | 171 | //______________________________________________________________ |
70f61d86 | 172 | void AliITSUTrackCond::AddGroupPattern(UShort_t patt,Int_t minCl) |
3c18eefd | 173 | { |
70f61d86 | 174 | // add new group pattern to last condition: the track should have at least minCl clusters at layers given by patt |
3c18eefd | 175 | if (fNConditions<1) AliFatal("Can be called only after AddCondition"); |
70f61d86 | 176 | if (minCl>int(AliITSUAux::kMaxLayers)) AliFatal(Form("Requested Nlayers=%d exceeds max alowed %d",minCl,AliITSUAux::kMaxLayers)); |
177 | if (minCl<1) AliFatal(Form("Requested Nlayers=%d for pattern %x",minCl,patt)); | |
3c18eefd | 178 | int ind = fConditions.GetSize(); |
179 | fConditions.Set(ind+1); | |
70f61d86 | 180 | fConditions[ind] = (patt&AliITSUAux::kMaxLrMask) | (minCl<<kShiftNcl); |
3c18eefd | 181 | fAuxData[(fNConditions-1)*kNAuxSz + kNGroups]++; |
182 | } | |
183 | ||
184 | //______________________________________________________________ | |
185 | void AliITSUTrackCond::AddNewCondition(Int_t minClusters) | |
186 | { | |
187 | // add new track condition | |
188 | fAuxData.Set( (1+fNConditions)*kNAuxSz ); | |
189 | fAuxData[fNConditions*kNAuxSz+kCondStart] = fConditions.GetSize(); | |
190 | fAuxData[fNConditions*kNAuxSz+kNGroups] = 0; | |
191 | fAuxData[fNConditions*kNAuxSz+kMinClus] = minClusters; | |
192 | fNConditions++; | |
193 | // | |
194 | } | |
195 | ||
196 | //______________________________________________________________ | |
c8d1f258 | 197 | Bool_t AliITSUTrackCond::CheckPattern(UShort_t patt) const |
3c18eefd | 198 | { |
199 | // check if the pattern matches to some condition | |
200 | Short_t *arrAux = (Short_t*)fAuxData.GetArray(); | |
70f61d86 | 201 | UInt_t *arrGrp = (UInt_t*)fConditions.GetArray(); |
c8d1f258 | 202 | int ncl = NumberOfBitsSet(patt); |
3c18eefd | 203 | int cntCond = 0; |
204 | for (int ic=0;ic<fNConditions;ic++) { | |
205 | if (arrAux[cntCond+kMinClus]>ncl) {cntCond+=kNAuxSz; continue;} // check number of clusters | |
206 | int grAddr = arrAux[cntCond+kCondStart]; // 1st group pattern address in the condition | |
207 | Bool_t ok = kTRUE; | |
208 | // if every group of the condition does not match, check next contition | |
70f61d86 | 209 | for (int ig=arrAux[cntCond+kNGroups];ig--;) { |
210 | UInt_t pattReq = arrGrp[grAddr++]; | |
211 | UShort_t actLr = (pattReq&AliITSUAux::kMaxLrMask)&patt; // patter of active layers satisfying to mask | |
aab41398 | 212 | if (!actLr || NumberOfBitsSet(actLr)<int(pattReq>>kShiftNcl)) {ok = kFALSE; break;} |
70f61d86 | 213 | } |
3c18eefd | 214 | if (ok) return kTRUE; |
215 | cntCond += kNAuxSz; | |
216 | } | |
217 | return kFALSE; | |
218 | } | |
219 | ||
220 | //______________________________________________________________ | |
221 | void AliITSUTrackCond::Print(Option_t*) const | |
222 | { | |
223 | // print conditions | |
224 | int nc = GetNConditions(); | |
225 | Short_t *arrAux = (Short_t*)fAuxData.GetArray(); | |
70f61d86 | 226 | UInt_t *arrGrp = (UInt_t*)fConditions.GetArray(); |
3c18eefd | 227 | int cntCond = 0; |
228 | printf("Conditions set ID=%d : %d entries\n",GetID(),nc); | |
229 | for (int i=0;i<nc;i++) { | |
230 | printf("#%2d: MinCl:%2d | %d groups :",i,arrAux[cntCond+kMinClus],arrAux[cntCond+kNGroups]); | |
231 | int grAddr = arrAux[cntCond+kCondStart]; | |
232 | for (int ig=arrAux[cntCond+kNGroups];ig--;) { | |
70f61d86 | 233 | UInt_t patt = arrGrp[grAddr]; |
3c18eefd | 234 | printf("{"); |
70f61d86 | 235 | PrintBits(patt, fNLayers); |
236 | printf("|%d}",patt>>kShiftNcl); | |
237 | grAddr++; | |
3c18eefd | 238 | } |
239 | printf("\n"); | |
240 | cntCond += kNAuxSz; | |
241 | } | |
097e4cdf | 242 | if (fAllowLayers) { |
243 | printf("Allowed Layers: "); | |
244 | for (int i=0;i<fNLayers;i++) if (!IsLayerExcluded(i)) printf(" %d",i); printf("\n"); | |
d99994b2 | 245 | } |
08419930 | 246 | printf("Cuts:\t%6s\t%6s\t%4s\t%8s\t%8s\t%8s\t%8s\t%8s\n", "MaxBrn","MaxCnd","ClSh","Chi2Cl","Chi2Glo","Mis.Pen.","NSig.Y","NSig.Z"); |
ee54014a | 247 | for (int i=0;i<fNLayers;i++) { |
08419930 | 248 | printf("Lr%2d:\t%6d\t%6d\t%4d\t%8.1f\t%8.2f\t%8.2f\t%8.2f\t%8.2f\n",i, |
249 | fMaxBranches[i],fMaxCandidates[i],fClSharing[i],fMaxTr2ClChi2[i],fMaxChi2GloNrm[i],fMissPenalty[i],fNSigmaRoadY[i],fNSigmaRoadZ[i]); | |
ee54014a | 250 | } |
251 | // | |
9cdcba2c | 252 | printf("ITS/TPC matching MaxChi2: %.3f\n",fMaxITSTPCMatchChi2); |
5e3587be | 253 | printf("ITS_SA BWD fit MaxChi2 vs Ncl :"); |
254 | for (int i=1;i<=2*fNLayers;i++) if (GetMaxITSSAChi2(i)>1e-6) printf("\t%d: %.2f",i,GetMaxITSSAChi2(i)); printf("\n"); | |
9cdcba2c | 255 | // |
ee54014a | 256 | } |
257 | ||
258 | //______________________________________________________________ | |
259 | void AliITSUTrackCond::Init() | |
260 | { | |
261 | // finalize and check consistency | |
262 | if (fInitDone) return; | |
263 | // | |
d99994b2 | 264 | fActiveLrInner = -1; |
ee54014a | 265 | for (int ilr=0;ilr<fNLayers;ilr++) { |
266 | if (IsLayerExcluded(ilr)) continue; | |
d99994b2 | 267 | if (fActiveLrInner<0) fActiveLrInner = ilr; |
268 | fActiveLrOuter = ilr; | |
08419930 | 269 | float nsig = Sqrt(2*GetMaxTr2ClChi2(ilr)); |
ee54014a | 270 | if (GetNSigmaRoadY(ilr)<0) SetNSigmaRoadY(ilr,nsig); |
271 | if (GetNSigmaRoadZ(ilr)<0) SetNSigmaRoadZ(ilr,nsig); | |
5e3587be | 272 | if (GetMaxITSSAChi2(1+2*ilr)<1e-6) SetMaxITSSAChi2(1+2*ilr,fgkMaxITSSAChi2); |
273 | if (GetMaxITSSAChi2(1+2*ilr+1)<1e-6) SetMaxITSSAChi2(1+2*ilr+1,fgkMaxITSSAChi2); | |
ee54014a | 274 | // |
275 | } | |
70cb7fe4 | 276 | if (fMaxITSTPCMatchChi2<1e-6) SetMaxITSTPCMatchChi2(fgkMaxMatchChi2); |
ee54014a | 277 | // |
278 | fInitDone = kTRUE; | |
3c18eefd | 279 | } |