]>
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) |
20 | ,fNLayers(0) | |
9cdcba2c | 21 | ,fMaxITSTPCMatchChi2(fgkMaxMatchChi2) |
22 | ,fMaxITSSAChi2(fgkMaxITSSAChi2) | |
c03e4f8a | 23 | ,fClSharing(0) |
38997c3c | 24 | ,fMaxBranches(0) |
25 | ,fMaxCandidates(0) | |
ee54014a | 26 | ,fMaxTr2ClChi2(0) |
08419930 | 27 | ,fMaxChi2GloNrm(0) |
ee54014a | 28 | ,fMissPenalty(0) |
29 | ,fNSigmaRoadY(0) | |
30 | ,fNSigmaRoadZ(0) | |
3c18eefd | 31 | ,fNConditions(0) |
32 | ,fConditions(0) | |
33 | ,fAuxData(0) | |
34 | { | |
35 | // def c-tor | |
38997c3c | 36 | if (nLayers) SetNLayers(nLayers); |
3c18eefd | 37 | } |
38 | ||
39 | //______________________________________________________________ | |
40 | AliITSUTrackCond::AliITSUTrackCond(const AliITSUTrackCond& src) | |
ee54014a | 41 | :TObject(src) |
42 | ,fInitDone(src.fInitDone) | |
43 | ,fNLayers(0) | |
9cdcba2c | 44 | ,fMaxITSTPCMatchChi2(src.fMaxITSTPCMatchChi2) |
45 | ,fMaxITSSAChi2(src.fMaxITSSAChi2) | |
c03e4f8a | 46 | ,fClSharing(0) |
38997c3c | 47 | ,fMaxBranches(0) |
48 | ,fMaxCandidates(0) | |
ee54014a | 49 | ,fMaxTr2ClChi2(0) |
08419930 | 50 | ,fMaxChi2GloNrm(0) |
ee54014a | 51 | ,fMissPenalty(0) |
52 | ,fNSigmaRoadY(0) | |
53 | ,fNSigmaRoadZ(0) | |
3c18eefd | 54 | ,fNConditions(src.fNConditions) |
55 | ,fConditions(src.fConditions) | |
56 | ,fAuxData(src.fAuxData) | |
57 | { | |
58 | // copy c-tor | |
ee54014a | 59 | SetNLayers(src.fNLayers); |
60 | for (int i=fNLayers;i--;) { | |
61 | SetMaxBranches(i,src.GetMaxBranches(i)); | |
62 | SetMaxCandidates(i,src.GetMaxCandidates(i)); | |
63 | SetMaxTr2ClChi2(i,src.GetMaxTr2ClChi2(i)); | |
08419930 | 64 | SetMaxChi2GloNrm(i,src.GetMaxChi2GloNrm(i)); |
ee54014a | 65 | SetMissPenalty(i,src.GetMissPenalty(i)); |
66 | SetNSigmaRoadY(i,src.GetNSigmaRoadY(i)); | |
67 | SetNSigmaRoadZ(i,src.GetNSigmaRoadZ(i)); | |
c03e4f8a | 68 | SetClSharing(i,src.GetClSharing(i)); |
38997c3c | 69 | } |
3c18eefd | 70 | } |
71 | ||
72 | //______________________________________________________________ | |
73 | AliITSUTrackCond& AliITSUTrackCond::operator=(const AliITSUTrackCond& src) | |
74 | { | |
75 | // copy op. | |
76 | if (this!=&src) { | |
ee54014a | 77 | fInitDone = src.fInitDone; |
3c18eefd | 78 | fNConditions = src.fNConditions; |
79 | fConditions = src.fConditions; | |
9cdcba2c | 80 | fMaxITSTPCMatchChi2 = src.fMaxITSTPCMatchChi2; |
81 | fMaxITSSAChi2 = src.fMaxITSSAChi2; | |
ee54014a | 82 | // |
83 | SetNLayers(src.fNLayers); | |
84 | // | |
85 | for (int i=fNLayers;i--;) { | |
86 | SetMaxBranches(i,src.GetMaxBranches(i)); | |
87 | SetMaxCandidates(i,src.GetMaxCandidates(i)); | |
88 | SetMaxTr2ClChi2(i,src.GetMaxTr2ClChi2(i)); | |
08419930 | 89 | SetMaxChi2GloNrm(i,src.GetMaxChi2GloNrm(i)); |
ee54014a | 90 | SetMissPenalty(i,src.GetMissPenalty(i)); |
91 | SetNSigmaRoadY(i,src.GetNSigmaRoadY(i)); | |
92 | SetNSigmaRoadZ(i,src.GetNSigmaRoadZ(i)); | |
c03e4f8a | 93 | SetClSharing(i,src.GetClSharing(i)); |
38997c3c | 94 | } |
3c18eefd | 95 | fAuxData = src.fAuxData; |
96 | } | |
97 | return *this; | |
98 | } | |
99 | ||
38997c3c | 100 | //______________________________________________________________ |
101 | void AliITSUTrackCond::SetNLayers(int nLayers) | |
102 | { | |
103 | // set number of layers | |
ee54014a | 104 | fInitDone = kFALSE; |
105 | if (fNLayers) { | |
9a2806bf | 106 | delete[] fClSharing; |
107 | delete[] fMaxBranches; | |
108 | delete[] fMaxCandidates; | |
109 | delete[] fMaxTr2ClChi2; | |
08419930 | 110 | delete[] fMaxChi2GloNrm; |
9a2806bf | 111 | delete[] fMissPenalty; |
112 | delete[] fNSigmaRoadY; | |
113 | delete[] fNSigmaRoadZ; | |
ee54014a | 114 | } |
38997c3c | 115 | fNLayers = nLayers; |
ee54014a | 116 | // |
38997c3c | 117 | if (fNLayers>0) { |
c03e4f8a | 118 | fClSharing = new Char_t[fNLayers]; |
119 | fMaxBranches = new Short_t[fNLayers]; | |
38997c3c | 120 | fMaxCandidates = new Short_t[fNLayers]; |
ee54014a | 121 | fMaxTr2ClChi2 = new Float_t[fNLayers]; |
08419930 | 122 | fMaxChi2GloNrm = new Float_t[fNLayers]; |
ee54014a | 123 | fMissPenalty = new Float_t[fNLayers]; |
124 | fNSigmaRoadY = new Float_t[fNLayers]; | |
125 | fNSigmaRoadZ = new Float_t[fNLayers]; | |
38997c3c | 126 | for (int i=fNLayers;i--;) { |
c03e4f8a | 127 | SetClSharing(i,fgkClSharing); |
ee54014a | 128 | SetMaxBranches(i,fgkMaxBranches); |
129 | SetMaxCandidates(i,fgkMaxCandidates); | |
130 | SetMaxTr2ClChi2(i,fgkMaxTr2ClChi2); | |
08419930 | 131 | SetMaxChi2GloNrm(i,fgkMaxChi2GloNrm); |
ee54014a | 132 | SetMissPenalty(i,fgkMissPenalty); |
133 | SetNSigmaRoadY(i,-1); // force recalculation | |
134 | SetNSigmaRoadZ(i,-1); // force recalculation | |
38997c3c | 135 | } |
136 | } | |
ee54014a | 137 | else { |
c03e4f8a | 138 | fClSharing = 0; |
ee54014a | 139 | fMaxBranches = 0; |
140 | fMaxCandidates = 0; | |
141 | fMaxTr2ClChi2 = 0; | |
08419930 | 142 | fMaxChi2GloNrm = 0; |
ee54014a | 143 | fMissPenalty = 0; |
144 | fNSigmaRoadY = 0; | |
145 | fNSigmaRoadZ = 0; | |
146 | } | |
147 | // | |
38997c3c | 148 | } |
149 | ||
3c18eefd | 150 | //______________________________________________________________ |
151 | void AliITSUTrackCond::AddGroupPattern(UShort_t patt) | |
152 | { | |
153 | // add new group pattern to last condition | |
154 | if (fNConditions<1) AliFatal("Can be called only after AddCondition"); | |
155 | int ind = fConditions.GetSize(); | |
156 | fConditions.Set(ind+1); | |
157 | fConditions[ind] = patt; | |
158 | fAuxData[(fNConditions-1)*kNAuxSz + kNGroups]++; | |
159 | } | |
160 | ||
161 | //______________________________________________________________ | |
162 | void AliITSUTrackCond::AddNewCondition(Int_t minClusters) | |
163 | { | |
164 | // add new track condition | |
165 | fAuxData.Set( (1+fNConditions)*kNAuxSz ); | |
166 | fAuxData[fNConditions*kNAuxSz+kCondStart] = fConditions.GetSize(); | |
167 | fAuxData[fNConditions*kNAuxSz+kNGroups] = 0; | |
168 | fAuxData[fNConditions*kNAuxSz+kMinClus] = minClusters; | |
169 | fNConditions++; | |
170 | // | |
171 | } | |
172 | ||
173 | //______________________________________________________________ | |
c8d1f258 | 174 | Bool_t AliITSUTrackCond::CheckPattern(UShort_t patt) const |
3c18eefd | 175 | { |
176 | // check if the pattern matches to some condition | |
177 | Short_t *arrAux = (Short_t*)fAuxData.GetArray(); | |
178 | Short_t *arrGrp = (Short_t*)fConditions.GetArray(); | |
c8d1f258 | 179 | int ncl = NumberOfBitsSet(patt); |
3c18eefd | 180 | int cntCond = 0; |
181 | for (int ic=0;ic<fNConditions;ic++) { | |
182 | if (arrAux[cntCond+kMinClus]>ncl) {cntCond+=kNAuxSz; continue;} // check number of clusters | |
183 | int grAddr = arrAux[cntCond+kCondStart]; // 1st group pattern address in the condition | |
184 | Bool_t ok = kTRUE; | |
185 | // if every group of the condition does not match, check next contition | |
186 | for (int ig=arrAux[cntCond+kNGroups];ig--;) if ( !(patt&arrGrp[grAddr++]) ) {ok = kFALSE; break;} | |
187 | if (ok) return kTRUE; | |
188 | cntCond += kNAuxSz; | |
189 | } | |
190 | return kFALSE; | |
191 | } | |
192 | ||
193 | //______________________________________________________________ | |
194 | void AliITSUTrackCond::Print(Option_t*) const | |
195 | { | |
196 | // print conditions | |
197 | int nc = GetNConditions(); | |
198 | Short_t *arrAux = (Short_t*)fAuxData.GetArray(); | |
199 | Short_t *arrGrp = (Short_t*)fConditions.GetArray(); | |
200 | int cntCond = 0; | |
201 | printf("Conditions set ID=%d : %d entries\n",GetID(),nc); | |
202 | for (int i=0;i<nc;i++) { | |
203 | printf("#%2d: MinCl:%2d | %d groups :",i,arrAux[cntCond+kMinClus],arrAux[cntCond+kNGroups]); | |
204 | int grAddr = arrAux[cntCond+kCondStart]; | |
205 | for (int ig=arrAux[cntCond+kNGroups];ig--;) { | |
206 | printf("{"); | |
207 | PrintBits(arrGrp[grAddr++], fNLayers); | |
208 | printf("}"); | |
209 | } | |
210 | printf("\n"); | |
211 | cntCond += kNAuxSz; | |
212 | } | |
08419930 | 213 | 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 | 214 | for (int i=0;i<fNLayers;i++) { |
08419930 | 215 | 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, |
216 | fMaxBranches[i],fMaxCandidates[i],fClSharing[i],fMaxTr2ClChi2[i],fMaxChi2GloNrm[i],fMissPenalty[i],fNSigmaRoadY[i],fNSigmaRoadZ[i]); | |
ee54014a | 217 | } |
218 | // | |
9cdcba2c | 219 | printf("ITS/TPC matching MaxChi2: %.3f\n",fMaxITSTPCMatchChi2); |
70cb7fe4 | 220 | printf("ITS_SA BWD fit MaxChi2: %.3f\n",fMaxITSSAChi2); |
9cdcba2c | 221 | // |
ee54014a | 222 | } |
223 | ||
224 | //______________________________________________________________ | |
225 | void AliITSUTrackCond::Init() | |
226 | { | |
227 | // finalize and check consistency | |
228 | if (fInitDone) return; | |
229 | // | |
230 | for (int ilr=0;ilr<fNLayers;ilr++) { | |
231 | if (IsLayerExcluded(ilr)) continue; | |
08419930 | 232 | float nsig = Sqrt(2*GetMaxTr2ClChi2(ilr)); |
ee54014a | 233 | if (GetNSigmaRoadY(ilr)<0) SetNSigmaRoadY(ilr,nsig); |
234 | if (GetNSigmaRoadZ(ilr)<0) SetNSigmaRoadZ(ilr,nsig); | |
235 | // | |
236 | } | |
70cb7fe4 | 237 | if (fMaxITSTPCMatchChi2<1e-6) SetMaxITSTPCMatchChi2(fgkMaxMatchChi2); |
238 | if (fMaxITSSAChi2<1e-6) SetMaxITSSAChi2(fgkMaxITSSAChi2); | |
ee54014a | 239 | // |
240 | fInitDone = kTRUE; | |
3c18eefd | 241 | } |