]>
Commit | Line | Data |
---|---|---|
7cc34f08 | 1 | //------------------------------------------------------------------------------ |
2 | // Implementation of AliPerformanceTPC class. It keeps information from | |
3 | // comparison of reconstructed and MC particle tracks. In addtion, | |
4 | // it keeps selection cuts used during comparison. The comparison | |
5 | // information is stored in the ROOT histograms. Analysis of these | |
6 | // histograms can be done by using Analyse() class function. The result of | |
7 | // the analysis (histograms/graphs) are stored in the folder which is | |
8 | // a data member of AliPerformanceTPC. | |
9 | // | |
10 | // Author: J.Otwinowski 04/02/2008 | |
814d192f | 11 | // Changes by M.Knichel 15/10/2010 |
7cc34f08 | 12 | //------------------------------------------------------------------------------ |
13 | ||
14 | /* | |
15 | ||
16 | // after running comparison task, read the file, and get component | |
17 | gROOT->LoadMacro("$ALICE_ROOT/PWG1/Macros/LoadMyLibs.C"); | |
18 | LoadMyLibs(); | |
19 | ||
20 | TFile f("Output.root"); | |
21 | AliPerformanceTPC * compObj = (AliPerformanceTPC*)coutput->FindObject("AliPerformanceTPC"); | |
22 | ||
23 | // analyse comparison data | |
24 | compObj->Analyse(); | |
25 | ||
26 | // the output histograms/graphs will be stored in the folder "folderTPC" | |
27 | compObj->GetAnalysisFolder()->ls("*"); | |
28 | ||
29 | // user can save whole comparison object (or only folder with anlysed histograms) | |
30 | // in the seperate output file (e.g.) | |
31 | TFile fout("Analysed_TPC.root","recreate"); | |
32 | compObj->Write(); // compObj->GetAnalysisFolder()->Write(); | |
33 | fout.Close(); | |
34 | ||
35 | */ | |
36 | ||
37 | #include "TCanvas.h" | |
38 | #include "TH1.h" | |
39 | #include "TH2.h" | |
27c7c4b3 | 40 | #include "TH3.h" |
7cc34f08 | 41 | #include "TAxis.h" |
42 | #include "TPostScript.h" | |
27c7c4b3 | 43 | #include "TString.h" |
814d192f | 44 | #include "TUUID.h" |
45 | #include "TTree.h" | |
46 | #include "TChain.h" | |
47 | #include "AliTPCPerformanceSummary.h" | |
48 | #include "TSystem.h" | |
7cc34f08 | 49 | |
50 | #include "AliPerformanceTPC.h" | |
51 | #include "AliESDEvent.h" | |
52 | #include "AliESDVertex.h" | |
53 | #include "AliESDtrack.h" | |
54 | #include "AliLog.h" | |
55 | #include "AliMCEvent.h" | |
56 | #include "AliHeader.h" | |
57 | #include "AliGenEventHeader.h" | |
58 | #include "AliStack.h" | |
59 | #include "AliMCInfoCuts.h" | |
60 | #include "AliRecInfoCuts.h" | |
61 | #include "AliTracker.h" | |
62 | #include "AliTreeDraw.h" | |
e6a60a90 | 63 | #include "AliTPCTransform.h" |
64 | #include "AliTPCseed.h" | |
65 | #include "AliTPCcalibDB.h" | |
66 | #include "AliESDfriend.h" | |
67 | #include "AliESDfriendTrack.h" | |
68 | #include "AliTPCclusterMI.h" | |
7cc34f08 | 69 | |
70 | using namespace std; | |
71 | ||
72 | ClassImp(AliPerformanceTPC) | |
73 | ||
27c7c4b3 | 74 | Bool_t AliPerformanceTPC::fgMergeTHnSparse = kFALSE; |
75 | ||
636e5a51 | 76 | |
7cc34f08 | 77 | //_____________________________________________________________________________ |
814d192f | 78 | /* |
7cc34f08 | 79 | AliPerformanceTPC::AliPerformanceTPC(): |
80 | AliPerformanceObject("AliPerformanceTPC"), | |
e6a60a90 | 81 | fTPCClustHisto(0), |
a13f4653 | 82 | fTPCEventHisto(0), |
83 | fTPCTrackHisto(0), | |
636e5a51 | 84 | fFolderObj(0), |
7cc34f08 | 85 | |
86 | // Cuts | |
87 | fCutsRC(0), | |
88 | fCutsMC(0), | |
89 | ||
90 | // histogram folder | |
0ea40bb6 | 91 | fAnalysisFolder(0), |
92 | ||
93 | fUseHLT(kFALSE) | |
177e2662 | 94 | |
7cc34f08 | 95 | { |
96 | Init(); | |
97 | } | |
814d192f | 98 | */ |
27c7c4b3 | 99 | |
7cc34f08 | 100 | //_____________________________________________________________________________ |
814d192f | 101 | AliPerformanceTPC::AliPerformanceTPC(Char_t* name, Char_t* title,Int_t analysisMode,Bool_t hptGenerator, Int_t run): |
102 | AliPerformanceObject(name,title,run), | |
e6a60a90 | 103 | fTPCClustHisto(0), |
a13f4653 | 104 | fTPCEventHisto(0), |
105 | fTPCTrackHisto(0), | |
636e5a51 | 106 | fFolderObj(0), |
7cc34f08 | 107 | |
108 | // Cuts | |
109 | fCutsRC(0), | |
110 | fCutsMC(0), | |
111 | ||
112 | // histogram folder | |
0ea40bb6 | 113 | fAnalysisFolder(0), |
114 | ||
115 | fUseHLT(kFALSE) | |
177e2662 | 116 | |
7cc34f08 | 117 | { |
118 | // named constructor | |
119 | // | |
120 | SetAnalysisMode(analysisMode); | |
121 | SetHptGenerator(hptGenerator); | |
122 | ||
123 | Init(); | |
124 | } | |
125 | ||
27c7c4b3 | 126 | |
7cc34f08 | 127 | //_____________________________________________________________________________ |
128 | AliPerformanceTPC::~AliPerformanceTPC() | |
129 | { | |
130 | // destructor | |
131 | ||
e6a60a90 | 132 | if(fTPCClustHisto) delete fTPCClustHisto; fTPCClustHisto=0; |
a13f4653 | 133 | if(fTPCEventHisto) delete fTPCEventHisto; fTPCEventHisto=0; |
636e5a51 | 134 | if(fTPCTrackHisto) delete fTPCTrackHisto; fTPCTrackHisto=0; |
7cc34f08 | 135 | if(fAnalysisFolder) delete fAnalysisFolder; fAnalysisFolder=0; |
636e5a51 | 136 | if(fFolderObj) delete fFolderObj; fFolderObj=0; |
7cc34f08 | 137 | } |
138 | ||
27c7c4b3 | 139 | |
7cc34f08 | 140 | //_____________________________________________________________________________ |
27c7c4b3 | 141 | void AliPerformanceTPC::Init() |
142 | { | |
7cc34f08 | 143 | // |
144 | // histogram bining | |
145 | // | |
146 | ||
147 | // set pt bins | |
148 | Int_t nPtBins = 50; | |
149 | Double_t ptMin = 1.e-2, ptMax = 10.; | |
150 | ||
151 | Double_t *binsPt = 0; | |
152 | if (IsHptGenerator()) { | |
153 | nPtBins = 100; ptMax = 100.; | |
154 | binsPt = CreateLogAxis(nPtBins,ptMin,ptMax); | |
155 | } else { | |
156 | binsPt = CreateLogAxis(nPtBins,ptMin,ptMax); | |
157 | } | |
158 | ||
159 | /* | |
160 | Int_t nPtBins = 31; | |
161 | Double_t binsPt[32] = {0.,0.05,0.1,0.15,0.2,0.25,0.3,0.35,0.4,0.45,0.5,0.55,0.6,0.7,0.8,0.9,1.0,1.2,1.4,1.6,1.8,2.0,2.25,2.5,2.75,3.,3.5,4.,5.,6.,8.,10.}; | |
162 | Double_t ptMin = 0., ptMax = 10.; | |
163 | ||
164 | if(IsHptGenerator() == kTRUE) { | |
165 | nPtBins = 100; | |
166 | ptMin = 0.; ptMax = 100.; | |
167 | } | |
168 | */ | |
814d192f | 169 | // |
170 | ||
171 | // | |
172 | //padRow:phi:TPCSide:pad:detector | |
173 | Int_t binsTPCClustHisto[5] = {160, 180, 2, 256, 512}; | |
174 | Double_t minTPCClustHisto[5] = {0., 0., 0., -128, 0}; | |
175 | Double_t maxTPCClustHisto[5] = {160., 2.*TMath::Pi(), 2., 128, 512}; | |
faa3b211 | 176 | |
814d192f | 177 | fTPCClustHisto = new THnSparseF("fTPCClustHisto","padRow:phi:TPCSide:pad:detector",5,binsTPCClustHisto,minTPCClustHisto,maxTPCClustHisto); |
faa3b211 | 178 | fTPCClustHisto->GetAxis(0)->SetTitle("padRow"); |
179 | fTPCClustHisto->GetAxis(1)->SetTitle("phi (rad)"); | |
e6a60a90 | 180 | fTPCClustHisto->GetAxis(2)->SetTitle("TPCSide"); |
814d192f | 181 | fTPCClustHisto->GetAxis(3)->SetTitle("pad"); |
182 | fTPCClustHisto->GetAxis(4)->SetTitle("detector"); | |
0ea40bb6 | 183 | //fTPCClustHisto->Sumw2(); |
814d192f | 184 | |
28bb9d1f | 185 | Int_t maxMult; |
186 | if (fHighMultiplicity) { maxMult = 4001; } else { maxMult = 151; } | |
886bf4d3 | 187 | // Xv:Yv:Zv:mult:multP:multN:vertStatus |
28bb9d1f | 188 | Int_t binsTPCEventHisto[7]= {100, 100, 100, maxMult, maxMult, maxMult, 2 }; |
189 | Double_t minTPCEventHisto[7]={-10., -10., -30., -0.5, -0.5, -0.5, -0.5 }; | |
190 | Double_t maxTPCEventHisto[7]={ 10., 10., 30., maxMult-0.5, maxMult-0.5, maxMult-0.5, 1.5 }; | |
a13f4653 | 191 | |
886bf4d3 | 192 | fTPCEventHisto = new THnSparseF("fTPCEventHisto","Xv:Yv:Zv:mult:multP:multN:vertStatus",7,binsTPCEventHisto,minTPCEventHisto,maxTPCEventHisto); |
a13f4653 | 193 | fTPCEventHisto->GetAxis(0)->SetTitle("Xv (cm)"); |
194 | fTPCEventHisto->GetAxis(1)->SetTitle("Yv (cm)"); | |
195 | fTPCEventHisto->GetAxis(2)->SetTitle("Zv (cm)"); | |
196 | fTPCEventHisto->GetAxis(3)->SetTitle("mult"); | |
197 | fTPCEventHisto->GetAxis(4)->SetTitle("multP"); | |
198 | fTPCEventHisto->GetAxis(5)->SetTitle("multN"); | |
886bf4d3 | 199 | fTPCEventHisto->GetAxis(6)->SetTitle("vertStatus"); |
0ea40bb6 | 200 | //fTPCEventHisto->Sumw2(); |
a13f4653 | 201 | |
202 | ||
636e5a51 | 203 | // nTPCClust:chi2PerTPCClust:nTPCClustFindRatio:DCAr:DCAz:eta:phi:pt:charge:vertStatus |
27c7c4b3 | 204 | Int_t binsTPCTrackHisto[10]= { 160, 20, 60, 30, 30, 30, 144, nPtBins, 3, 2 }; |
636e5a51 | 205 | Double_t minTPCTrackHisto[10]={ 0., 0., 0., -3, -3., -1.5, 0., ptMin, -1.5, -0.5 }; |
206 | Double_t maxTPCTrackHisto[10]={ 160., 5., 1.2, 3, 3., 1.5, 2.*TMath::Pi(), ptMax, 1.5, 1.5 }; | |
207 | ||
208 | // nTPCClust:chi2PerTPCClust:nTPCClustFindRatio:DCAr:DCAz:eta:phi:pt:charge:vertStatus | |
209 | // Int_t binsTPCTrackHisto[10]= { 160, 50, 60, 100, 100, 30, 144, nPtBins, 3, 2 }; | |
210 | // Double_t minTPCTrackHisto[10]={ 0., 0., 0., -10, -10., -1.5, 0., ptMin, -1.5, 0 }; | |
211 | // Double_t maxTPCTrackHisto[10]={ 160., 10., 1.2, 10, 10., 1.5, 2.*TMath::Pi(), ptMax, 1.5, 2 }; | |
212 | ||
213 | ||
a13f4653 | 214 | |
636e5a51 | 215 | fTPCTrackHisto = new THnSparseF("fTPCTrackHisto","nClust:chi2PerClust:nClust/nFindableClust:DCAr:DCAz:eta:phi:pt:charge:vertStatus",10,binsTPCTrackHisto,minTPCTrackHisto,maxTPCTrackHisto); |
a13f4653 | 216 | fTPCTrackHisto->SetBinEdges(7,binsPt); |
217 | ||
218 | fTPCTrackHisto->GetAxis(0)->SetTitle("nClust"); | |
219 | fTPCTrackHisto->GetAxis(1)->SetTitle("chi2PerClust"); | |
220 | fTPCTrackHisto->GetAxis(2)->SetTitle("nClust/nFindableClust"); | |
221 | fTPCTrackHisto->GetAxis(3)->SetTitle("DCAr (cm)"); | |
222 | fTPCTrackHisto->GetAxis(4)->SetTitle("DCAz (cm)"); | |
223 | fTPCTrackHisto->GetAxis(5)->SetTitle("#eta"); | |
224 | fTPCTrackHisto->GetAxis(6)->SetTitle("#phi (rad)"); | |
225 | fTPCTrackHisto->GetAxis(7)->SetTitle("p_{T} (GeV/c)"); | |
226 | fTPCTrackHisto->GetAxis(8)->SetTitle("charge"); | |
636e5a51 | 227 | fTPCTrackHisto->GetAxis(9)->SetTitle("vertStatus"); |
0ea40bb6 | 228 | //fTPCTrackHisto->Sumw2(); |
7cc34f08 | 229 | |
230 | // Init cuts | |
814d192f | 231 | if(!fCutsMC) { |
7cc34f08 | 232 | AliDebug(AliLog::kError, "ERROR: Cannot find AliMCInfoCuts object"); |
814d192f | 233 | } |
234 | if(!fCutsRC) { | |
235 | AliDebug(AliLog::kError, "ERROR: Cannot find AliRecInfoCuts object"); | |
236 | } | |
7cc34f08 | 237 | |
238 | // init folder | |
239 | fAnalysisFolder = CreateFolder("folderTPC","Analysis Resolution Folder"); | |
636e5a51 | 240 | |
7cc34f08 | 241 | } |
242 | ||
27c7c4b3 | 243 | |
7cc34f08 | 244 | //_____________________________________________________________________________ |
636e5a51 | 245 | void AliPerformanceTPC::ProcessTPC(AliStack* const stack, AliESDtrack *const esdTrack, AliESDEvent *const esdEvent, Bool_t vertStatus) |
7cc34f08 | 246 | { |
758320f7 | 247 | // |
248 | // fill TPC QA info | |
249 | // | |
250 | if(!esdEvent) return; | |
7cc34f08 | 251 | if(!esdTrack) return; |
252 | ||
758320f7 | 253 | if( IsUseTrackVertex() ) |
254 | { | |
255 | // Relate TPC inner params to prim. vertex | |
256 | const AliESDVertex *vtxESD = esdEvent->GetPrimaryVertexTracks(); | |
257 | Double_t x[3]; esdTrack->GetXYZ(x); | |
258 | Double_t b[3]; AliTracker::GetBxByBz(x,b); | |
259 | Bool_t isOK = esdTrack->RelateToVertexTPCBxByBz(vtxESD, b, kVeryBig); | |
260 | if(!isOK) return; | |
261 | ||
262 | /* | |
263 | // JMT -- recaluclate DCA for HLT if not present | |
264 | if ( dca[0] == 0. && dca[1] == 0. ) { | |
265 | track->GetDZ( vtxESD->GetX(), vtxESD->GetY(), vtxESD->GetZ(), esdEvent->GetMagneticField(), dca ); | |
266 | } | |
267 | */ | |
268 | } | |
269 | ||
7cc34f08 | 270 | // Fill TPC only resolution comparison information |
271 | const AliExternalTrackParam *track = esdTrack->GetTPCInnerParam(); | |
272 | if(!track) return; | |
273 | ||
274 | Float_t dca[2], cov[3]; // dca_xy, dca_z, sigma_xy, sigma_xy_z, sigma_z | |
275 | esdTrack->GetImpactParametersTPC(dca,cov); | |
276 | ||
a13f4653 | 277 | Float_t q = esdTrack->Charge(); |
7cc34f08 | 278 | Float_t pt = track->Pt(); |
279 | Float_t eta = track->Eta(); | |
280 | Float_t phi = track->Phi(); | |
281 | Int_t nClust = esdTrack->GetTPCclusters(0); | |
282 | Int_t nFindableClust = esdTrack->GetTPCNclsF(); | |
283 | ||
284 | Float_t chi2PerCluster = 0.; | |
285 | if(nClust>0.) chi2PerCluster = esdTrack->GetTPCchi2()/Float_t(nClust); | |
286 | ||
287 | Float_t clustPerFindClust = 0.; | |
288 | if(nFindableClust>0.) clustPerFindClust = Float_t(nClust)/nFindableClust; | |
289 | ||
a13f4653 | 290 | // |
291 | // select primaries | |
292 | // | |
293 | Double_t dcaToVertex = -1; | |
294 | if( fCutsRC->GetDCAToVertex2D() ) | |
295 | { | |
177e2662 | 296 | dcaToVertex = TMath::Sqrt(dca[0]*dca[0]/fCutsRC->GetMaxDCAToVertexXY()/fCutsRC->GetMaxDCAToVertexXY() + dca[1]*dca[1]/fCutsRC->GetMaxDCAToVertexZ()/fCutsRC->GetMaxDCAToVertexZ()); |
7cc34f08 | 297 | } |
a13f4653 | 298 | if(fCutsRC->GetDCAToVertex2D() && dcaToVertex > 1) return; |
299 | if(!fCutsRC->GetDCAToVertex2D() && TMath::Abs(dca[0]) > fCutsRC->GetMaxDCAToVertexXY()) return; | |
300 | if(!fCutsRC->GetDCAToVertex2D() && TMath::Abs(dca[1]) > fCutsRC->GetMaxDCAToVertexZ()) return; | |
301 | ||
636e5a51 | 302 | Double_t vTPCTrackHisto[10] = {nClust,chi2PerCluster,clustPerFindClust,dca[0],dca[1],eta,phi,pt,q,vertStatus}; |
a13f4653 | 303 | fTPCTrackHisto->Fill(vTPCTrackHisto); |
7cc34f08 | 304 | |
305 | // | |
306 | // Fill rec vs MC information | |
307 | // | |
308 | if(!stack) return; | |
309 | ||
310 | } | |
311 | ||
27c7c4b3 | 312 | |
7cc34f08 | 313 | //_____________________________________________________________________________ |
636e5a51 | 314 | void AliPerformanceTPC::ProcessTPCITS(AliStack* const stack, AliESDtrack *const esdTrack, AliESDEvent* const esdEvent, Bool_t vertStatus) |
7cc34f08 | 315 | { |
316 | // Fill comparison information (TPC+ITS) | |
758320f7 | 317 | if(!esdTrack) return; |
318 | if(!esdEvent) return; | |
319 | ||
320 | if( IsUseTrackVertex() ) | |
321 | { | |
322 | // Relate TPC inner params to prim. vertex | |
323 | const AliESDVertex *vtxESD = esdEvent->GetPrimaryVertexTracks(); | |
324 | Double_t x[3]; esdTrack->GetXYZ(x); | |
325 | Double_t b[3]; AliTracker::GetBxByBz(x,b); | |
326 | Bool_t isOK = esdTrack->RelateToVertexBxByBz(vtxESD, b, kVeryBig); | |
327 | if(!isOK) return; | |
328 | ||
329 | /* | |
330 | // JMT -- recaluclate DCA for HLT if not present | |
331 | if ( dca[0] == 0. && dca[1] == 0. ) { | |
332 | track->GetDZ( vtxESD->GetX(), vtxESD->GetY(), vtxESD->GetZ(), esdEvent->GetMagneticField(), dca ); | |
333 | } | |
334 | */ | |
335 | } | |
336 | ||
337 | Float_t dca[2], cov[3]; // dca_xy, dca_z, sigma_xy, sigma_xy_z, sigma_z | |
338 | esdTrack->GetImpactParameters(dca,cov); | |
339 | ||
340 | if ((esdTrack->GetStatus()&AliESDtrack::kITSrefit)==0) return; // ITS refit | |
341 | if ((esdTrack->GetStatus()&AliESDtrack::kTPCrefit)==0) return; // TPC refit | |
faa3b211 | 342 | if (esdTrack->GetITSclusters(0)<fCutsRC->GetMinNClustersITS()) return; // min. nb. ITS clusters |
758320f7 | 343 | |
344 | Float_t q = esdTrack->Charge(); | |
345 | Float_t pt = esdTrack->Pt(); | |
346 | Float_t eta = esdTrack->Eta(); | |
347 | Float_t phi = esdTrack->Phi(); | |
348 | Int_t nClust = esdTrack->GetTPCclusters(0); | |
349 | Int_t nFindableClust = esdTrack->GetTPCNclsF(); | |
350 | ||
351 | Float_t chi2PerCluster = 0.; | |
352 | if(nClust>0.) chi2PerCluster = esdTrack->GetTPCchi2()/Float_t(nClust); | |
353 | ||
354 | Float_t clustPerFindClust = 0.; | |
355 | if(nFindableClust>0.) clustPerFindClust = Float_t(nClust)/nFindableClust; | |
356 | ||
357 | // | |
358 | // select primaries | |
359 | // | |
360 | Double_t dcaToVertex = -1; | |
361 | if( fCutsRC->GetDCAToVertex2D() ) | |
362 | { | |
363 | dcaToVertex = TMath::Sqrt(dca[0]*dca[0]/fCutsRC->GetMaxDCAToVertexXY()/fCutsRC->GetMaxDCAToVertexXY() + dca[1]*dca[1]/fCutsRC->GetMaxDCAToVertexZ()/fCutsRC->GetMaxDCAToVertexZ()); | |
364 | } | |
365 | if(fCutsRC->GetDCAToVertex2D() && dcaToVertex > 1) return; | |
366 | if(!fCutsRC->GetDCAToVertex2D() && TMath::Abs(dca[0]) > fCutsRC->GetMaxDCAToVertexXY()) return; | |
367 | if(!fCutsRC->GetDCAToVertex2D() && TMath::Abs(dca[1]) > fCutsRC->GetMaxDCAToVertexZ()) return; | |
368 | ||
636e5a51 | 369 | Double_t vTPCTrackHisto[10] = {nClust,chi2PerCluster,clustPerFindClust,dca[0],dca[1],eta,phi,pt,q,vertStatus}; |
758320f7 | 370 | fTPCTrackHisto->Fill(vTPCTrackHisto); |
371 | ||
372 | // | |
373 | // Fill rec vs MC information | |
374 | // | |
375 | if(!stack) return; | |
7cc34f08 | 376 | } |
27c7c4b3 | 377 | |
378 | ||
7cc34f08 | 379 | //_____________________________________________________________________________ |
758320f7 | 380 | void AliPerformanceTPC::ProcessConstrained(AliStack* const /*stack*/, AliESDtrack *const /*esdTrack*/, AliESDEvent* const /*esdEvent*/) |
7cc34f08 | 381 | { |
382 | // Fill comparison information (constarained parameters) | |
383 | AliDebug(AliLog::kWarning, "Warning: Not implemented"); | |
384 | } | |
27c7c4b3 | 385 | |
386 | ||
7cc34f08 | 387 | //_____________________________________________________________________________ |
388 | void AliPerformanceTPC::Exec(AliMCEvent* const mcEvent, AliESDEvent *const esdEvent, AliESDfriend *const esdFriend, const Bool_t bUseMC, const Bool_t bUseESDfriend) | |
389 | { | |
390 | // Process comparison information | |
391 | // | |
392 | if(!esdEvent) | |
393 | { | |
394 | Error("Exec","esdEvent not available"); | |
395 | return; | |
396 | } | |
397 | AliHeader* header = 0; | |
398 | AliGenEventHeader* genHeader = 0; | |
399 | AliStack* stack = 0; | |
400 | TArrayF vtxMC(3); | |
401 | ||
402 | if(bUseMC) | |
403 | { | |
404 | if(!mcEvent) { | |
405 | Error("Exec","mcEvent not available"); | |
406 | return; | |
407 | } | |
408 | // get MC event header | |
409 | header = mcEvent->Header(); | |
410 | if (!header) { | |
411 | Error("Exec","Header not available"); | |
412 | return; | |
413 | } | |
414 | // MC particle stack | |
415 | stack = mcEvent->Stack(); | |
416 | if (!stack) { | |
417 | Error("Exec","Stack not available"); | |
418 | return; | |
419 | } | |
420 | // get MC vertex | |
421 | genHeader = header->GenEventHeader(); | |
422 | if (!genHeader) { | |
423 | Error("Exec","Could not retrieve genHeader from Header"); | |
424 | return; | |
425 | } | |
426 | genHeader->PrimaryVertex(vtxMC); | |
427 | } | |
428 | ||
e6a60a90 | 429 | // trigger |
046b4280 | 430 | if(!bUseMC &&GetTriggerClass()) { |
4bb5f8a9 | 431 | Bool_t isEventTriggered = esdEvent->IsTriggerClassFired(GetTriggerClass()); |
432 | if(!isEventTriggered) return; | |
433 | } | |
e6a60a90 | 434 | |
435 | // get TPC event vertex | |
177e2662 | 436 | const AliESDVertex *vtxESD = NULL; |
437 | if(fUseTrackVertex) { | |
438 | vtxESD = esdEvent->GetPrimaryVertexTracks(); | |
439 | } else { | |
440 | vtxESD = esdEvent->GetPrimaryVertexTPC(); | |
441 | } | |
9ca899e5 | 442 | if(!vtxESD) return; |
e6a60a90 | 443 | |
444 | // events with rec. vertex | |
a13f4653 | 445 | Int_t mult=0; Int_t multP=0; Int_t multN=0; |
636e5a51 | 446 | |
447 | // changed to take all events but store vertex status | |
448 | // if(vtxESD->GetStatus() >0) | |
449 | // { | |
450 | // store vertex status | |
451 | Bool_t vertStatus = vtxESD->GetStatus(); | |
e6a60a90 | 452 | // Process ESD events |
7cc34f08 | 453 | for (Int_t iTrack = 0; iTrack < esdEvent->GetNumberOfTracks(); iTrack++) |
454 | { | |
a13f4653 | 455 | AliESDtrack *track = esdEvent->GetTrack(iTrack); |
7cc34f08 | 456 | if(!track) continue; |
457 | ||
faa3b211 | 458 | if(bUseESDfriend && esdFriend && esdFriend->TestSkipBit()==kFALSE) |
4e59b45c | 459 | { |
460 | AliESDfriendTrack *friendTrack=esdFriend->GetTrack(iTrack); | |
177e2662 | 461 | if(friendTrack) |
462 | { | |
faa3b211 | 463 | // |
177e2662 | 464 | TObject *calibObject=0; |
465 | AliTPCseed *seed=0; | |
faa3b211 | 466 | for (Int_t j=0;(calibObject=friendTrack->GetCalibObject(j));++j) { |
177e2662 | 467 | if ((seed=dynamic_cast<AliTPCseed*>(calibObject))) { |
468 | break; | |
469 | } | |
e6a60a90 | 470 | } |
471 | ||
faa3b211 | 472 | // |
e6a60a90 | 473 | for (Int_t irow=0;irow<159;irow++) { |
474 | if(!seed) continue; | |
475 | ||
476 | AliTPCclusterMI *cluster=seed->GetClusterPointer(irow); | |
477 | if (!cluster) continue; | |
478 | ||
faa3b211 | 479 | Float_t gclf[3]; |
480 | cluster->GetGlobalXYZ(gclf); | |
e6a60a90 | 481 | |
faa3b211 | 482 | //Double_t x[3]={cluster->GetRow(),cluster->GetPad(),cluster->GetTimeBin()}; |
483 | //Int_t i[1]={cluster->GetDetector()}; | |
484 | //transform->Transform(x,i,0,1); | |
485 | //printf("gx %f gy %f gz %f \n", cluster->GetX(), cluster->GetY(),cluster->GetZ()); | |
486 | //printf("gclf[0] %f gclf[1] %f gclf[2] %f \n", gclf[0], gclf[1], gclf[2]); | |
e6a60a90 | 487 | |
488 | Int_t TPCside; | |
489 | if(gclf[2]>0.) TPCside=0; // A side | |
490 | else TPCside=1; | |
491 | ||
faa3b211 | 492 | // |
493 | //Double_t vTPCClust1[3] = { gclf[0], gclf[1], TPCside }; | |
494 | //fTPCClustHisto1->Fill(vTPCClust1); | |
495 | ||
496 | // | |
814d192f | 497 | Float_t pad = cluster->GetPad(); |
498 | Int_t detector = cluster->GetDetector(); | |
faa3b211 | 499 | Double_t phi = TMath::ATan2(gclf[1],gclf[0]); |
500 | if(phi < 0) phi += 2.*TMath::Pi(); | |
501 | ||
814d192f | 502 | Double_t vTPCClust[5] = { irow, phi, TPCside, pad, detector }; |
e6a60a90 | 503 | fTPCClustHisto->Fill(vTPCClust); |
faa3b211 | 504 | } |
505 | } | |
e6a60a90 | 506 | } |
177e2662 | 507 | |
636e5a51 | 508 | if(GetAnalysisMode() == 0) ProcessTPC(stack,track,esdEvent,vertStatus); |
509 | else if(GetAnalysisMode() == 1) ProcessTPCITS(stack,track,esdEvent,vertStatus); | |
758320f7 | 510 | else if(GetAnalysisMode() == 2) ProcessConstrained(stack,track,esdEvent); |
7cc34f08 | 511 | else { |
512 | printf("ERROR: AnalysisMode %d \n",fAnalysisMode); | |
513 | return; | |
514 | } | |
a13f4653 | 515 | |
0ea40bb6 | 516 | // TPC only |
517 | if(!fUseHLT){ | |
518 | AliESDtrack *tpcTrack = AliESDtrackCuts::GetTPCOnlyTrack(esdEvent,iTrack); | |
519 | if(!tpcTrack) continue; | |
520 | ||
521 | // track selection | |
522 | if( fCutsRC->AcceptTrack(tpcTrack) ) { | |
523 | mult++; | |
524 | if(tpcTrack->Charge()>0.) multP++; | |
525 | if(tpcTrack->Charge()<0.) multN++; | |
526 | } | |
527 | ||
528 | if(tpcTrack) delete tpcTrack; | |
529 | } | |
530 | else | |
531 | if( fCutsRC->AcceptTrack(track) ) { | |
532 | //Printf("Still here for HLT"); | |
533 | mult++; | |
534 | if(track->Charge()>0.) multP++; | |
535 | if(track->Charge()<0.) multN++; | |
536 | } | |
537 | ||
7cc34f08 | 538 | } |
636e5a51 | 539 | // } |
a13f4653 | 540 | // |
e6a60a90 | 541 | |
886bf4d3 | 542 | Double_t vTPCEvent[7] = {vtxESD->GetXv(),vtxESD->GetYv(),vtxESD->GetZv(),mult,multP,multN,vtxESD->GetStatus()}; |
a13f4653 | 543 | fTPCEventHisto->Fill(vTPCEvent); |
7cc34f08 | 544 | } |
545 | ||
636e5a51 | 546 | |
27c7c4b3 | 547 | //_____________________________________________________________________________ |
548 | void AliPerformanceTPC::Analyse() | |
549 | { | |
550 | // | |
551 | // Analyse comparison information and store output histograms | |
552 | // in the folder "folderTPC" | |
553 | // | |
554 | TH1::AddDirectory(kFALSE); | |
0ea40bb6 | 555 | TH1::SetDefaultSumw2(kFALSE); |
27c7c4b3 | 556 | TObjArray *aFolderObj = new TObjArray; |
557 | //aFolderObj->SetOwner(); // objects are owned by fanalysisFolder | |
558 | TString selString; | |
559 | ||
560 | // | |
561 | // Cluster histograms | |
562 | // | |
28bb9d1f | 563 | AddProjection(aFolderObj, "clust", fTPCClustHisto, 0, 1, 2); |
27c7c4b3 | 564 | |
565 | selString = "all"; | |
566 | for(Int_t i=0; i <= 2; i++) { | |
28bb9d1f | 567 | AddProjection(aFolderObj, "clust", fTPCClustHisto, i, &selString); |
27c7c4b3 | 568 | } |
569 | ||
0ea40bb6 | 570 | //fTPCClustHisto->GetAxis(2)->SetRange(1,1); // A-side |
571 | //selString = "A_side"; | |
572 | //AddProjection(aFolderObj, fTPCClustHisto, 0, 1, &selString); | |
27c7c4b3 | 573 | |
0ea40bb6 | 574 | //fTPCClustHisto->GetAxis(2)->SetRange(2,2); // C-side |
575 | //selString = "C_side"; | |
576 | //AddProjection(aFolderObj, fTPCClustHisto, 0, 1, &selString); | |
27c7c4b3 | 577 | |
578 | //reset range | |
579 | fTPCClustHisto->GetAxis(2)->SetRange(1,2); | |
580 | ||
581 | // | |
582 | // event histograms | |
583 | // | |
584 | for(Int_t i=0; i<=6; i++) { | |
28bb9d1f | 585 | AddProjection(aFolderObj, "event", fTPCEventHisto, i); |
0ea40bb6 | 586 | } |
28bb9d1f | 587 | AddProjection(aFolderObj, "event", fTPCEventHisto, 4, 5); |
588 | AddProjection(aFolderObj, "event", fTPCEventHisto, 0, 1); | |
589 | AddProjection(aFolderObj, "event", fTPCEventHisto, 0, 3); | |
590 | AddProjection(aFolderObj, "event", fTPCEventHisto, 1, 3); | |
591 | AddProjection(aFolderObj, "event", fTPCEventHisto, 2, 3); | |
27c7c4b3 | 592 | |
593 | // reconstructed vertex status > 0 | |
594 | fTPCEventHisto->GetAxis(6)->SetRange(2,2); | |
595 | selString = "recVertex"; | |
596 | for(Int_t i=0; i<=5; i++) { | |
28bb9d1f | 597 | AddProjection(aFolderObj, "event", fTPCEventHisto, i, &selString); |
27c7c4b3 | 598 | } |
28bb9d1f | 599 | AddProjection(aFolderObj, "event", fTPCEventHisto, 4, 5, &selString); |
600 | AddProjection(aFolderObj, "event", fTPCEventHisto, 0, 1, &selString); | |
601 | AddProjection(aFolderObj, "event", fTPCEventHisto, 0, 3, &selString); | |
602 | AddProjection(aFolderObj, "event", fTPCEventHisto, 1, 3, &selString); | |
603 | AddProjection(aFolderObj, "event", fTPCEventHisto, 2, 3, &selString); | |
27c7c4b3 | 604 | |
605 | // reset cuts | |
606 | fTPCEventHisto->GetAxis(6)->SetRange(1,2); | |
607 | ||
608 | // | |
609 | // Track histograms | |
610 | // | |
611 | // all with vertex | |
612 | fTPCTrackHisto->GetAxis(8)->SetRangeUser(-1.5,1.5); | |
613 | fTPCTrackHisto->GetAxis(9)->SetRangeUser(0.5,1.5); | |
614 | selString = "all_recVertex"; | |
615 | for(Int_t i=0; i <= 9; i++) { | |
28bb9d1f | 616 | AddProjection(aFolderObj, "track", fTPCTrackHisto, i, &selString); |
27c7c4b3 | 617 | } |
0ea40bb6 | 618 | for(Int_t i=0; i <= 4; i++) { |
28bb9d1f | 619 | AddProjection(aFolderObj, "track", fTPCTrackHisto, i, 5, 7, &selString); |
0ea40bb6 | 620 | } |
621 | ||
622 | ||
27c7c4b3 | 623 | |
624 | // Track histograms (pos with vertex) | |
625 | fTPCTrackHisto->GetAxis(8)->SetRangeUser(0,1.5); | |
626 | selString = "pos_recVertex"; | |
627 | for(Int_t i=0; i <= 9; i++) { | |
28bb9d1f | 628 | AddProjection(aFolderObj, "track", fTPCTrackHisto, i, &selString); |
27c7c4b3 | 629 | } |
0ea40bb6 | 630 | for(Int_t i=0; i <= 4; i++) { for(Int_t j=5; j <= 5; j++) { for(Int_t k=j+1; k <= 7; k++) { |
28bb9d1f | 631 | AddProjection(aFolderObj, "track", fTPCTrackHisto, i, j, k, &selString); |
27c7c4b3 | 632 | } } } |
28bb9d1f | 633 | AddProjection(aFolderObj, "track", fTPCTrackHisto, 0, 1, 2, &selString); |
634 | AddProjection(aFolderObj, "track", fTPCTrackHisto, 0, 1, 5, &selString); | |
635 | AddProjection(aFolderObj, "track", fTPCTrackHisto, 0, 2, 5, &selString); | |
636 | AddProjection(aFolderObj, "track", fTPCTrackHisto, 1, 2, 5, &selString); | |
637 | AddProjection(aFolderObj, "track", fTPCTrackHisto, 3, 4, 5, &selString); | |
638 | AddProjection(aFolderObj, "track", fTPCTrackHisto, 5, 6, 7, &selString); | |
636e5a51 | 639 | |
27c7c4b3 | 640 | // Track histograms (neg with vertex) |
641 | fTPCTrackHisto->GetAxis(8)->SetRangeUser(-1.5,0); | |
642 | selString = "neg_recVertex"; | |
643 | for(Int_t i=0; i <= 9; i++) { | |
28bb9d1f | 644 | AddProjection(aFolderObj, "track", fTPCTrackHisto, i, &selString); |
27c7c4b3 | 645 | } |
0ea40bb6 | 646 | for(Int_t i=0; i <= 4; i++) { for(Int_t j=5; j <= 5; j++) { for(Int_t k=j+1; k <= 7; k++) { |
28bb9d1f | 647 | AddProjection(aFolderObj, "track", fTPCTrackHisto, i, j, k, &selString); |
27c7c4b3 | 648 | } } } |
28bb9d1f | 649 | AddProjection(aFolderObj, "track", fTPCTrackHisto, 0, 1, 2, &selString); |
650 | AddProjection(aFolderObj, "track", fTPCTrackHisto, 0, 1, 5, &selString); | |
651 | AddProjection(aFolderObj, "track", fTPCTrackHisto, 0, 2, 5, &selString); | |
652 | AddProjection(aFolderObj, "track", fTPCTrackHisto, 1, 2, 5, &selString); | |
653 | AddProjection(aFolderObj, "track", fTPCTrackHisto, 3, 4, 5, &selString); | |
27c7c4b3 | 654 | |
655 | //restore cuts | |
656 | fTPCTrackHisto->GetAxis(8)->SetRangeUser(-1.5,1.5); | |
657 | fTPCTrackHisto->GetAxis(9)->SetRangeUser(-0.5,1.5); | |
636e5a51 | 658 | |
659 | ||
660 | printf("exportToFolder\n"); | |
27c7c4b3 | 661 | // export objects to analysis folder |
662 | fAnalysisFolder = ExportToFolder(aFolderObj); | |
663 | if (fFolderObj) delete fFolderObj; | |
664 | fFolderObj = aFolderObj; | |
665 | aFolderObj=0; | |
7cc34f08 | 666 | } |
667 | ||
27c7c4b3 | 668 | |
7cc34f08 | 669 | //_____________________________________________________________________________ |
670 | TFolder* AliPerformanceTPC::ExportToFolder(TObjArray * array) | |
671 | { | |
672 | // recreate folder avery time and export objects to new one | |
673 | // | |
674 | AliPerformanceTPC * comp=this; | |
675 | TFolder *folder = comp->GetAnalysisFolder(); | |
676 | ||
677 | TString name, title; | |
678 | TFolder *newFolder = 0; | |
679 | Int_t i = 0; | |
680 | Int_t size = array->GetSize(); | |
681 | ||
682 | if(folder) { | |
683 | // get name and title from old folder | |
684 | name = folder->GetName(); | |
685 | title = folder->GetTitle(); | |
686 | ||
687 | // delete old one | |
688 | delete folder; | |
689 | ||
690 | // create new one | |
691 | newFolder = CreateFolder(name.Data(),title.Data()); | |
692 | newFolder->SetOwner(); | |
693 | ||
694 | // add objects to folder | |
695 | while(i < size) { | |
696 | newFolder->Add(array->At(i)); | |
697 | i++; | |
698 | } | |
699 | } | |
700 | ||
701 | return newFolder; | |
702 | } | |
703 | ||
704 | //_____________________________________________________________________________ | |
705 | Long64_t AliPerformanceTPC::Merge(TCollection* const list) | |
706 | { | |
707 | // Merge list of objects (needed by PROOF) | |
708 | ||
709 | if (!list) | |
710 | return 0; | |
711 | ||
712 | if (list->IsEmpty()) | |
713 | return 1; | |
714 | ||
715 | TIterator* iter = list->MakeIterator(); | |
716 | TObject* obj = 0; | |
636e5a51 | 717 | TObjArray* objArrayList = 0; |
718 | objArrayList = new TObjArray(); | |
7cc34f08 | 719 | |
720 | // collection of generated histograms | |
721 | Int_t count=0; | |
722 | while((obj = iter->Next()) != 0) | |
723 | { | |
a13f4653 | 724 | AliPerformanceTPC* entry = dynamic_cast<AliPerformanceTPC*>(obj); |
725 | if (entry == 0) continue; | |
27c7c4b3 | 726 | if (fgMergeTHnSparse) { |
727 | if ((fTPCClustHisto) && (entry->fTPCClustHisto)) { fTPCClustHisto->Add(entry->fTPCClustHisto); } | |
728 | if ((fTPCEventHisto) && (entry->fTPCEventHisto)) { fTPCEventHisto->Add(entry->fTPCEventHisto); } | |
729 | if ((fTPCTrackHisto) && (entry->fTPCTrackHisto)) { fTPCTrackHisto->Add(entry->fTPCTrackHisto); } | |
730 | } | |
636e5a51 | 731 | // the analysisfolder is only merged if present |
732 | if (entry->fFolderObj) { objArrayList->Add(entry->fFolderObj); } | |
7cc34f08 | 733 | |
a13f4653 | 734 | count++; |
7cc34f08 | 735 | } |
636e5a51 | 736 | if (fFolderObj) { fFolderObj->Merge(objArrayList); } |
737 | // to signal that track histos were not merged: reset | |
27c7c4b3 | 738 | if (!fgMergeTHnSparse) { fTPCTrackHisto->Reset(); fTPCClustHisto->Reset(); fTPCEventHisto->Reset(); } |
636e5a51 | 739 | // delete |
27c7c4b3 | 740 | if (objArrayList) delete objArrayList; objArrayList=0; |
7cc34f08 | 741 | return count; |
742 | } | |
743 | ||
27c7c4b3 | 744 | |
7cc34f08 | 745 | //_____________________________________________________________________________ |
814d192f | 746 | TFolder* AliPerformanceTPC::CreateFolder(TString name, TString title) |
747 | { | |
7cc34f08 | 748 | // create folder for analysed histograms |
749 | // | |
750 | TFolder *folder = 0; | |
751 | folder = new TFolder(name.Data(),title.Data()); | |
752 | ||
753 | return folder; | |
754 | } | |
636e5a51 | 755 | |
814d192f | 756 | //_____________________________________________________________________________ |
757 | TTree* AliPerformanceTPC::CreateSummary() | |
758 | { | |
759 | // implementaion removed, switched back to use AliPerformanceSummary (now called in AliPerformanceTask) | |
760 | return 0; | |
761 | } | |
762 |