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