]>
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; | |
36ace53b | 149 | Double_t ptMin = 1.e-2, ptMax = 20.; |
7cc34f08 | 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 | // | |
36ace53b | 172 | //padRow:phi:TPCSide:pad:detector:glZ |
173 | Int_t binsTPCClustHisto[6] = {160, 180, 2, 256, 512, 250}; | |
174 | Double_t minTPCClustHisto[6] = {0., 0., 0., -128, 0, -250}; | |
175 | Double_t maxTPCClustHisto[6] = {160., 2.*TMath::Pi(), 2., 128, 512,250}; | |
faa3b211 | 176 | |
36ace53b | 177 | fTPCClustHisto = new THnSparseF("fTPCClustHisto","padRow:phi:TPCSide:pad:detector:gZ",6,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"); | |
36ace53b | 183 | fTPCClustHisto->GetAxis(5)->SetTitle("glZ (cm)"); |
0ea40bb6 | 184 | //fTPCClustHisto->Sumw2(); |
814d192f | 185 | |
28bb9d1f | 186 | Int_t maxMult; |
187 | if (fHighMultiplicity) { maxMult = 4001; } else { maxMult = 151; } | |
886bf4d3 | 188 | // Xv:Yv:Zv:mult:multP:multN:vertStatus |
28bb9d1f | 189 | Int_t binsTPCEventHisto[7]= {100, 100, 100, maxMult, maxMult, maxMult, 2 }; |
190 | Double_t minTPCEventHisto[7]={-10., -10., -30., -0.5, -0.5, -0.5, -0.5 }; | |
191 | Double_t maxTPCEventHisto[7]={ 10., 10., 30., maxMult-0.5, maxMult-0.5, maxMult-0.5, 1.5 }; | |
a13f4653 | 192 | |
886bf4d3 | 193 | fTPCEventHisto = new THnSparseF("fTPCEventHisto","Xv:Yv:Zv:mult:multP:multN:vertStatus",7,binsTPCEventHisto,minTPCEventHisto,maxTPCEventHisto); |
a13f4653 | 194 | fTPCEventHisto->GetAxis(0)->SetTitle("Xv (cm)"); |
195 | fTPCEventHisto->GetAxis(1)->SetTitle("Yv (cm)"); | |
196 | fTPCEventHisto->GetAxis(2)->SetTitle("Zv (cm)"); | |
197 | fTPCEventHisto->GetAxis(3)->SetTitle("mult"); | |
198 | fTPCEventHisto->GetAxis(4)->SetTitle("multP"); | |
199 | fTPCEventHisto->GetAxis(5)->SetTitle("multN"); | |
886bf4d3 | 200 | fTPCEventHisto->GetAxis(6)->SetTitle("vertStatus"); |
0ea40bb6 | 201 | //fTPCEventHisto->Sumw2(); |
a13f4653 | 202 | |
203 | ||
636e5a51 | 204 | // nTPCClust:chi2PerTPCClust:nTPCClustFindRatio:DCAr:DCAz:eta:phi:pt:charge:vertStatus |
27c7c4b3 | 205 | Int_t binsTPCTrackHisto[10]= { 160, 20, 60, 30, 30, 30, 144, nPtBins, 3, 2 }; |
636e5a51 | 206 | Double_t minTPCTrackHisto[10]={ 0., 0., 0., -3, -3., -1.5, 0., ptMin, -1.5, -0.5 }; |
207 | Double_t maxTPCTrackHisto[10]={ 160., 5., 1.2, 3, 3., 1.5, 2.*TMath::Pi(), ptMax, 1.5, 1.5 }; | |
208 | ||
209 | // nTPCClust:chi2PerTPCClust:nTPCClustFindRatio:DCAr:DCAz:eta:phi:pt:charge:vertStatus | |
210 | // Int_t binsTPCTrackHisto[10]= { 160, 50, 60, 100, 100, 30, 144, nPtBins, 3, 2 }; | |
211 | // Double_t minTPCTrackHisto[10]={ 0., 0., 0., -10, -10., -1.5, 0., ptMin, -1.5, 0 }; | |
212 | // Double_t maxTPCTrackHisto[10]={ 160., 10., 1.2, 10, 10., 1.5, 2.*TMath::Pi(), ptMax, 1.5, 2 }; | |
213 | ||
214 | ||
a13f4653 | 215 | |
636e5a51 | 216 | fTPCTrackHisto = new THnSparseF("fTPCTrackHisto","nClust:chi2PerClust:nClust/nFindableClust:DCAr:DCAz:eta:phi:pt:charge:vertStatus",10,binsTPCTrackHisto,minTPCTrackHisto,maxTPCTrackHisto); |
a13f4653 | 217 | fTPCTrackHisto->SetBinEdges(7,binsPt); |
218 | ||
219 | fTPCTrackHisto->GetAxis(0)->SetTitle("nClust"); | |
220 | fTPCTrackHisto->GetAxis(1)->SetTitle("chi2PerClust"); | |
221 | fTPCTrackHisto->GetAxis(2)->SetTitle("nClust/nFindableClust"); | |
222 | fTPCTrackHisto->GetAxis(3)->SetTitle("DCAr (cm)"); | |
223 | fTPCTrackHisto->GetAxis(4)->SetTitle("DCAz (cm)"); | |
224 | fTPCTrackHisto->GetAxis(5)->SetTitle("#eta"); | |
225 | fTPCTrackHisto->GetAxis(6)->SetTitle("#phi (rad)"); | |
226 | fTPCTrackHisto->GetAxis(7)->SetTitle("p_{T} (GeV/c)"); | |
227 | fTPCTrackHisto->GetAxis(8)->SetTitle("charge"); | |
636e5a51 | 228 | fTPCTrackHisto->GetAxis(9)->SetTitle("vertStatus"); |
0ea40bb6 | 229 | //fTPCTrackHisto->Sumw2(); |
7cc34f08 | 230 | |
231 | // Init cuts | |
814d192f | 232 | if(!fCutsMC) { |
7cc34f08 | 233 | AliDebug(AliLog::kError, "ERROR: Cannot find AliMCInfoCuts object"); |
814d192f | 234 | } |
235 | if(!fCutsRC) { | |
236 | AliDebug(AliLog::kError, "ERROR: Cannot find AliRecInfoCuts object"); | |
237 | } | |
7cc34f08 | 238 | |
239 | // init folder | |
240 | fAnalysisFolder = CreateFolder("folderTPC","Analysis Resolution Folder"); | |
636e5a51 | 241 | |
7cc34f08 | 242 | } |
243 | ||
27c7c4b3 | 244 | |
7cc34f08 | 245 | //_____________________________________________________________________________ |
636e5a51 | 246 | void AliPerformanceTPC::ProcessTPC(AliStack* const stack, AliESDtrack *const esdTrack, AliESDEvent *const esdEvent, Bool_t vertStatus) |
7cc34f08 | 247 | { |
758320f7 | 248 | // |
249 | // fill TPC QA info | |
250 | // | |
251 | if(!esdEvent) return; | |
7cc34f08 | 252 | if(!esdTrack) return; |
253 | ||
758320f7 | 254 | if( IsUseTrackVertex() ) |
255 | { | |
256 | // Relate TPC inner params to prim. vertex | |
257 | const AliESDVertex *vtxESD = esdEvent->GetPrimaryVertexTracks(); | |
258 | Double_t x[3]; esdTrack->GetXYZ(x); | |
259 | Double_t b[3]; AliTracker::GetBxByBz(x,b); | |
260 | Bool_t isOK = esdTrack->RelateToVertexTPCBxByBz(vtxESD, b, kVeryBig); | |
261 | if(!isOK) return; | |
262 | ||
263 | /* | |
264 | // JMT -- recaluclate DCA for HLT if not present | |
265 | if ( dca[0] == 0. && dca[1] == 0. ) { | |
266 | track->GetDZ( vtxESD->GetX(), vtxESD->GetY(), vtxESD->GetZ(), esdEvent->GetMagneticField(), dca ); | |
267 | } | |
268 | */ | |
269 | } | |
270 | ||
7cc34f08 | 271 | // Fill TPC only resolution comparison information |
272 | const AliExternalTrackParam *track = esdTrack->GetTPCInnerParam(); | |
273 | if(!track) return; | |
274 | ||
275 | Float_t dca[2], cov[3]; // dca_xy, dca_z, sigma_xy, sigma_xy_z, sigma_z | |
276 | esdTrack->GetImpactParametersTPC(dca,cov); | |
277 | ||
a13f4653 | 278 | Float_t q = esdTrack->Charge(); |
7cc34f08 | 279 | Float_t pt = track->Pt(); |
280 | Float_t eta = track->Eta(); | |
281 | Float_t phi = track->Phi(); | |
282 | Int_t nClust = esdTrack->GetTPCclusters(0); | |
283 | Int_t nFindableClust = esdTrack->GetTPCNclsF(); | |
284 | ||
285 | Float_t chi2PerCluster = 0.; | |
286 | if(nClust>0.) chi2PerCluster = esdTrack->GetTPCchi2()/Float_t(nClust); | |
287 | ||
288 | Float_t clustPerFindClust = 0.; | |
289 | if(nFindableClust>0.) clustPerFindClust = Float_t(nClust)/nFindableClust; | |
290 | ||
a13f4653 | 291 | // |
292 | // select primaries | |
293 | // | |
294 | Double_t dcaToVertex = -1; | |
295 | if( fCutsRC->GetDCAToVertex2D() ) | |
296 | { | |
177e2662 | 297 | dcaToVertex = TMath::Sqrt(dca[0]*dca[0]/fCutsRC->GetMaxDCAToVertexXY()/fCutsRC->GetMaxDCAToVertexXY() + dca[1]*dca[1]/fCutsRC->GetMaxDCAToVertexZ()/fCutsRC->GetMaxDCAToVertexZ()); |
7cc34f08 | 298 | } |
a13f4653 | 299 | if(fCutsRC->GetDCAToVertex2D() && dcaToVertex > 1) return; |
300 | if(!fCutsRC->GetDCAToVertex2D() && TMath::Abs(dca[0]) > fCutsRC->GetMaxDCAToVertexXY()) return; | |
301 | if(!fCutsRC->GetDCAToVertex2D() && TMath::Abs(dca[1]) > fCutsRC->GetMaxDCAToVertexZ()) return; | |
302 | ||
636e5a51 | 303 | Double_t vTPCTrackHisto[10] = {nClust,chi2PerCluster,clustPerFindClust,dca[0],dca[1],eta,phi,pt,q,vertStatus}; |
a13f4653 | 304 | fTPCTrackHisto->Fill(vTPCTrackHisto); |
7cc34f08 | 305 | |
306 | // | |
307 | // Fill rec vs MC information | |
308 | // | |
309 | if(!stack) return; | |
310 | ||
311 | } | |
312 | ||
27c7c4b3 | 313 | |
7cc34f08 | 314 | //_____________________________________________________________________________ |
636e5a51 | 315 | void AliPerformanceTPC::ProcessTPCITS(AliStack* const stack, AliESDtrack *const esdTrack, AliESDEvent* const esdEvent, Bool_t vertStatus) |
7cc34f08 | 316 | { |
317 | // Fill comparison information (TPC+ITS) | |
758320f7 | 318 | if(!esdTrack) return; |
319 | if(!esdEvent) return; | |
320 | ||
321 | if( IsUseTrackVertex() ) | |
322 | { | |
323 | // Relate TPC inner params to prim. vertex | |
324 | const AliESDVertex *vtxESD = esdEvent->GetPrimaryVertexTracks(); | |
325 | Double_t x[3]; esdTrack->GetXYZ(x); | |
326 | Double_t b[3]; AliTracker::GetBxByBz(x,b); | |
327 | Bool_t isOK = esdTrack->RelateToVertexBxByBz(vtxESD, b, kVeryBig); | |
328 | if(!isOK) return; | |
329 | ||
330 | /* | |
331 | // JMT -- recaluclate DCA for HLT if not present | |
332 | if ( dca[0] == 0. && dca[1] == 0. ) { | |
333 | track->GetDZ( vtxESD->GetX(), vtxESD->GetY(), vtxESD->GetZ(), esdEvent->GetMagneticField(), dca ); | |
334 | } | |
335 | */ | |
336 | } | |
337 | ||
338 | Float_t dca[2], cov[3]; // dca_xy, dca_z, sigma_xy, sigma_xy_z, sigma_z | |
339 | esdTrack->GetImpactParameters(dca,cov); | |
340 | ||
341 | if ((esdTrack->GetStatus()&AliESDtrack::kITSrefit)==0) return; // ITS refit | |
342 | if ((esdTrack->GetStatus()&AliESDtrack::kTPCrefit)==0) return; // TPC refit | |
faa3b211 | 343 | if (esdTrack->GetITSclusters(0)<fCutsRC->GetMinNClustersITS()) return; // min. nb. ITS clusters |
758320f7 | 344 | |
345 | Float_t q = esdTrack->Charge(); | |
346 | Float_t pt = esdTrack->Pt(); | |
347 | Float_t eta = esdTrack->Eta(); | |
348 | Float_t phi = esdTrack->Phi(); | |
349 | Int_t nClust = esdTrack->GetTPCclusters(0); | |
350 | Int_t nFindableClust = esdTrack->GetTPCNclsF(); | |
351 | ||
352 | Float_t chi2PerCluster = 0.; | |
353 | if(nClust>0.) chi2PerCluster = esdTrack->GetTPCchi2()/Float_t(nClust); | |
354 | ||
355 | Float_t clustPerFindClust = 0.; | |
356 | if(nFindableClust>0.) clustPerFindClust = Float_t(nClust)/nFindableClust; | |
357 | ||
358 | // | |
359 | // select primaries | |
360 | // | |
361 | Double_t dcaToVertex = -1; | |
362 | if( fCutsRC->GetDCAToVertex2D() ) | |
363 | { | |
364 | dcaToVertex = TMath::Sqrt(dca[0]*dca[0]/fCutsRC->GetMaxDCAToVertexXY()/fCutsRC->GetMaxDCAToVertexXY() + dca[1]*dca[1]/fCutsRC->GetMaxDCAToVertexZ()/fCutsRC->GetMaxDCAToVertexZ()); | |
365 | } | |
366 | if(fCutsRC->GetDCAToVertex2D() && dcaToVertex > 1) return; | |
367 | if(!fCutsRC->GetDCAToVertex2D() && TMath::Abs(dca[0]) > fCutsRC->GetMaxDCAToVertexXY()) return; | |
368 | if(!fCutsRC->GetDCAToVertex2D() && TMath::Abs(dca[1]) > fCutsRC->GetMaxDCAToVertexZ()) return; | |
369 | ||
636e5a51 | 370 | Double_t vTPCTrackHisto[10] = {nClust,chi2PerCluster,clustPerFindClust,dca[0],dca[1],eta,phi,pt,q,vertStatus}; |
758320f7 | 371 | fTPCTrackHisto->Fill(vTPCTrackHisto); |
372 | ||
373 | // | |
374 | // Fill rec vs MC information | |
375 | // | |
376 | if(!stack) return; | |
7cc34f08 | 377 | } |
27c7c4b3 | 378 | |
379 | ||
7cc34f08 | 380 | //_____________________________________________________________________________ |
758320f7 | 381 | void AliPerformanceTPC::ProcessConstrained(AliStack* const /*stack*/, AliESDtrack *const /*esdTrack*/, AliESDEvent* const /*esdEvent*/) |
7cc34f08 | 382 | { |
383 | // Fill comparison information (constarained parameters) | |
384 | AliDebug(AliLog::kWarning, "Warning: Not implemented"); | |
385 | } | |
27c7c4b3 | 386 | |
387 | ||
7cc34f08 | 388 | //_____________________________________________________________________________ |
389 | void AliPerformanceTPC::Exec(AliMCEvent* const mcEvent, AliESDEvent *const esdEvent, AliESDfriend *const esdFriend, const Bool_t bUseMC, const Bool_t bUseESDfriend) | |
390 | { | |
391 | // Process comparison information | |
392 | // | |
393 | if(!esdEvent) | |
394 | { | |
395 | Error("Exec","esdEvent not available"); | |
396 | return; | |
397 | } | |
398 | AliHeader* header = 0; | |
399 | AliGenEventHeader* genHeader = 0; | |
400 | AliStack* stack = 0; | |
401 | TArrayF vtxMC(3); | |
402 | ||
403 | if(bUseMC) | |
404 | { | |
405 | if(!mcEvent) { | |
406 | Error("Exec","mcEvent not available"); | |
407 | return; | |
408 | } | |
409 | // get MC event header | |
410 | header = mcEvent->Header(); | |
411 | if (!header) { | |
412 | Error("Exec","Header not available"); | |
413 | return; | |
414 | } | |
415 | // MC particle stack | |
416 | stack = mcEvent->Stack(); | |
417 | if (!stack) { | |
418 | Error("Exec","Stack not available"); | |
419 | return; | |
420 | } | |
421 | // get MC vertex | |
422 | genHeader = header->GenEventHeader(); | |
423 | if (!genHeader) { | |
424 | Error("Exec","Could not retrieve genHeader from Header"); | |
425 | return; | |
426 | } | |
427 | genHeader->PrimaryVertex(vtxMC); | |
428 | } | |
429 | ||
e6a60a90 | 430 | // trigger |
046b4280 | 431 | if(!bUseMC &&GetTriggerClass()) { |
4bb5f8a9 | 432 | Bool_t isEventTriggered = esdEvent->IsTriggerClassFired(GetTriggerClass()); |
433 | if(!isEventTriggered) return; | |
434 | } | |
e6a60a90 | 435 | |
436 | // get TPC event vertex | |
177e2662 | 437 | const AliESDVertex *vtxESD = NULL; |
438 | if(fUseTrackVertex) { | |
439 | vtxESD = esdEvent->GetPrimaryVertexTracks(); | |
440 | } else { | |
441 | vtxESD = esdEvent->GetPrimaryVertexTPC(); | |
442 | } | |
9ca899e5 | 443 | if(!vtxESD) return; |
e6a60a90 | 444 | |
445 | // events with rec. vertex | |
a13f4653 | 446 | Int_t mult=0; Int_t multP=0; Int_t multN=0; |
636e5a51 | 447 | |
448 | // changed to take all events but store vertex status | |
449 | // if(vtxESD->GetStatus() >0) | |
450 | // { | |
451 | // store vertex status | |
452 | Bool_t vertStatus = vtxESD->GetStatus(); | |
e6a60a90 | 453 | // Process ESD events |
7cc34f08 | 454 | for (Int_t iTrack = 0; iTrack < esdEvent->GetNumberOfTracks(); iTrack++) |
455 | { | |
a13f4653 | 456 | AliESDtrack *track = esdEvent->GetTrack(iTrack); |
7cc34f08 | 457 | if(!track) continue; |
458 | ||
c1b69b58 | 459 | // if not fUseKinkDaughters don't use tracks with kink index > 0 |
460 | if(!fUseKinkDaughters && track->GetKinkIndex(0) > 0) continue; | |
461 | ||
faa3b211 | 462 | if(bUseESDfriend && esdFriend && esdFriend->TestSkipBit()==kFALSE) |
4e59b45c | 463 | { |
464 | AliESDfriendTrack *friendTrack=esdFriend->GetTrack(iTrack); | |
177e2662 | 465 | if(friendTrack) |
466 | { | |
faa3b211 | 467 | // |
177e2662 | 468 | TObject *calibObject=0; |
469 | AliTPCseed *seed=0; | |
faa3b211 | 470 | for (Int_t j=0;(calibObject=friendTrack->GetCalibObject(j));++j) { |
177e2662 | 471 | if ((seed=dynamic_cast<AliTPCseed*>(calibObject))) { |
472 | break; | |
473 | } | |
e6a60a90 | 474 | } |
475 | ||
faa3b211 | 476 | // |
e6a60a90 | 477 | for (Int_t irow=0;irow<159;irow++) { |
478 | if(!seed) continue; | |
479 | ||
480 | AliTPCclusterMI *cluster=seed->GetClusterPointer(irow); | |
481 | if (!cluster) continue; | |
482 | ||
faa3b211 | 483 | Float_t gclf[3]; |
484 | cluster->GetGlobalXYZ(gclf); | |
e6a60a90 | 485 | |
faa3b211 | 486 | //Double_t x[3]={cluster->GetRow(),cluster->GetPad(),cluster->GetTimeBin()}; |
487 | //Int_t i[1]={cluster->GetDetector()}; | |
488 | //transform->Transform(x,i,0,1); | |
489 | //printf("gx %f gy %f gz %f \n", cluster->GetX(), cluster->GetY(),cluster->GetZ()); | |
490 | //printf("gclf[0] %f gclf[1] %f gclf[2] %f \n", gclf[0], gclf[1], gclf[2]); | |
e6a60a90 | 491 | |
492 | Int_t TPCside; | |
493 | if(gclf[2]>0.) TPCside=0; // A side | |
494 | else TPCside=1; | |
495 | ||
faa3b211 | 496 | // |
497 | //Double_t vTPCClust1[3] = { gclf[0], gclf[1], TPCside }; | |
498 | //fTPCClustHisto1->Fill(vTPCClust1); | |
499 | ||
500 | // | |
814d192f | 501 | Float_t pad = cluster->GetPad(); |
502 | Int_t detector = cluster->GetDetector(); | |
faa3b211 | 503 | Double_t phi = TMath::ATan2(gclf[1],gclf[0]); |
504 | if(phi < 0) phi += 2.*TMath::Pi(); | |
505 | ||
36ace53b | 506 | Double_t vTPCClust[6] = { irow, phi, TPCside, pad, detector, gclf[2] }; |
e6a60a90 | 507 | fTPCClustHisto->Fill(vTPCClust); |
faa3b211 | 508 | } |
509 | } | |
e6a60a90 | 510 | } |
177e2662 | 511 | |
636e5a51 | 512 | if(GetAnalysisMode() == 0) ProcessTPC(stack,track,esdEvent,vertStatus); |
513 | else if(GetAnalysisMode() == 1) ProcessTPCITS(stack,track,esdEvent,vertStatus); | |
758320f7 | 514 | else if(GetAnalysisMode() == 2) ProcessConstrained(stack,track,esdEvent); |
7cc34f08 | 515 | else { |
516 | printf("ERROR: AnalysisMode %d \n",fAnalysisMode); | |
517 | return; | |
518 | } | |
a13f4653 | 519 | |
0ea40bb6 | 520 | // TPC only |
521 | if(!fUseHLT){ | |
522 | AliESDtrack *tpcTrack = AliESDtrackCuts::GetTPCOnlyTrack(esdEvent,iTrack); | |
523 | if(!tpcTrack) continue; | |
524 | ||
525 | // track selection | |
526 | if( fCutsRC->AcceptTrack(tpcTrack) ) { | |
527 | mult++; | |
528 | if(tpcTrack->Charge()>0.) multP++; | |
529 | if(tpcTrack->Charge()<0.) multN++; | |
530 | } | |
531 | ||
532 | if(tpcTrack) delete tpcTrack; | |
533 | } | |
534 | else | |
535 | if( fCutsRC->AcceptTrack(track) ) { | |
536 | //Printf("Still here for HLT"); | |
537 | mult++; | |
538 | if(track->Charge()>0.) multP++; | |
539 | if(track->Charge()<0.) multN++; | |
540 | } | |
541 | ||
7cc34f08 | 542 | } |
636e5a51 | 543 | // } |
a13f4653 | 544 | // |
e6a60a90 | 545 | |
886bf4d3 | 546 | Double_t vTPCEvent[7] = {vtxESD->GetXv(),vtxESD->GetYv(),vtxESD->GetZv(),mult,multP,multN,vtxESD->GetStatus()}; |
a13f4653 | 547 | fTPCEventHisto->Fill(vTPCEvent); |
7cc34f08 | 548 | } |
549 | ||
636e5a51 | 550 | |
27c7c4b3 | 551 | //_____________________________________________________________________________ |
552 | void AliPerformanceTPC::Analyse() | |
553 | { | |
554 | // | |
555 | // Analyse comparison information and store output histograms | |
556 | // in the folder "folderTPC" | |
557 | // | |
558 | TH1::AddDirectory(kFALSE); | |
0ea40bb6 | 559 | TH1::SetDefaultSumw2(kFALSE); |
27c7c4b3 | 560 | TObjArray *aFolderObj = new TObjArray; |
561 | //aFolderObj->SetOwner(); // objects are owned by fanalysisFolder | |
562 | TString selString; | |
563 | ||
564 | // | |
565 | // Cluster histograms | |
566 | // | |
28bb9d1f | 567 | AddProjection(aFolderObj, "clust", fTPCClustHisto, 0, 1, 2); |
27c7c4b3 | 568 | |
569 | selString = "all"; | |
570 | for(Int_t i=0; i <= 2; i++) { | |
28bb9d1f | 571 | AddProjection(aFolderObj, "clust", fTPCClustHisto, i, &selString); |
27c7c4b3 | 572 | } |
573 | ||
0ea40bb6 | 574 | //fTPCClustHisto->GetAxis(2)->SetRange(1,1); // A-side |
575 | //selString = "A_side"; | |
576 | //AddProjection(aFolderObj, fTPCClustHisto, 0, 1, &selString); | |
27c7c4b3 | 577 | |
0ea40bb6 | 578 | //fTPCClustHisto->GetAxis(2)->SetRange(2,2); // C-side |
579 | //selString = "C_side"; | |
580 | //AddProjection(aFolderObj, fTPCClustHisto, 0, 1, &selString); | |
27c7c4b3 | 581 | |
582 | //reset range | |
583 | fTPCClustHisto->GetAxis(2)->SetRange(1,2); | |
584 | ||
585 | // | |
586 | // event histograms | |
587 | // | |
588 | for(Int_t i=0; i<=6; i++) { | |
28bb9d1f | 589 | AddProjection(aFolderObj, "event", fTPCEventHisto, i); |
0ea40bb6 | 590 | } |
28bb9d1f | 591 | AddProjection(aFolderObj, "event", fTPCEventHisto, 4, 5); |
592 | AddProjection(aFolderObj, "event", fTPCEventHisto, 0, 1); | |
593 | AddProjection(aFolderObj, "event", fTPCEventHisto, 0, 3); | |
594 | AddProjection(aFolderObj, "event", fTPCEventHisto, 1, 3); | |
595 | AddProjection(aFolderObj, "event", fTPCEventHisto, 2, 3); | |
27c7c4b3 | 596 | |
597 | // reconstructed vertex status > 0 | |
598 | fTPCEventHisto->GetAxis(6)->SetRange(2,2); | |
599 | selString = "recVertex"; | |
600 | for(Int_t i=0; i<=5; i++) { | |
28bb9d1f | 601 | AddProjection(aFolderObj, "event", fTPCEventHisto, i, &selString); |
27c7c4b3 | 602 | } |
28bb9d1f | 603 | AddProjection(aFolderObj, "event", fTPCEventHisto, 4, 5, &selString); |
604 | AddProjection(aFolderObj, "event", fTPCEventHisto, 0, 1, &selString); | |
605 | AddProjection(aFolderObj, "event", fTPCEventHisto, 0, 3, &selString); | |
606 | AddProjection(aFolderObj, "event", fTPCEventHisto, 1, 3, &selString); | |
607 | AddProjection(aFolderObj, "event", fTPCEventHisto, 2, 3, &selString); | |
27c7c4b3 | 608 | |
609 | // reset cuts | |
610 | fTPCEventHisto->GetAxis(6)->SetRange(1,2); | |
611 | ||
612 | // | |
613 | // Track histograms | |
614 | // | |
615 | // all with vertex | |
616 | fTPCTrackHisto->GetAxis(8)->SetRangeUser(-1.5,1.5); | |
617 | fTPCTrackHisto->GetAxis(9)->SetRangeUser(0.5,1.5); | |
618 | selString = "all_recVertex"; | |
619 | for(Int_t i=0; i <= 9; i++) { | |
28bb9d1f | 620 | AddProjection(aFolderObj, "track", fTPCTrackHisto, i, &selString); |
27c7c4b3 | 621 | } |
0ea40bb6 | 622 | for(Int_t i=0; i <= 4; i++) { |
28bb9d1f | 623 | AddProjection(aFolderObj, "track", fTPCTrackHisto, i, 5, 7, &selString); |
0ea40bb6 | 624 | } |
625 | ||
626 | ||
27c7c4b3 | 627 | |
628 | // Track histograms (pos with vertex) | |
629 | fTPCTrackHisto->GetAxis(8)->SetRangeUser(0,1.5); | |
630 | selString = "pos_recVertex"; | |
631 | for(Int_t i=0; i <= 9; i++) { | |
28bb9d1f | 632 | AddProjection(aFolderObj, "track", fTPCTrackHisto, i, &selString); |
27c7c4b3 | 633 | } |
0ea40bb6 | 634 | 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 | 635 | AddProjection(aFolderObj, "track", fTPCTrackHisto, i, j, k, &selString); |
27c7c4b3 | 636 | } } } |
28bb9d1f | 637 | AddProjection(aFolderObj, "track", fTPCTrackHisto, 0, 1, 2, &selString); |
638 | AddProjection(aFolderObj, "track", fTPCTrackHisto, 0, 1, 5, &selString); | |
639 | AddProjection(aFolderObj, "track", fTPCTrackHisto, 0, 2, 5, &selString); | |
640 | AddProjection(aFolderObj, "track", fTPCTrackHisto, 1, 2, 5, &selString); | |
641 | AddProjection(aFolderObj, "track", fTPCTrackHisto, 3, 4, 5, &selString); | |
642 | AddProjection(aFolderObj, "track", fTPCTrackHisto, 5, 6, 7, &selString); | |
636e5a51 | 643 | |
27c7c4b3 | 644 | // Track histograms (neg with vertex) |
645 | fTPCTrackHisto->GetAxis(8)->SetRangeUser(-1.5,0); | |
646 | selString = "neg_recVertex"; | |
647 | for(Int_t i=0; i <= 9; i++) { | |
28bb9d1f | 648 | AddProjection(aFolderObj, "track", fTPCTrackHisto, i, &selString); |
27c7c4b3 | 649 | } |
0ea40bb6 | 650 | 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 | 651 | AddProjection(aFolderObj, "track", fTPCTrackHisto, i, j, k, &selString); |
27c7c4b3 | 652 | } } } |
28bb9d1f | 653 | AddProjection(aFolderObj, "track", fTPCTrackHisto, 0, 1, 2, &selString); |
654 | AddProjection(aFolderObj, "track", fTPCTrackHisto, 0, 1, 5, &selString); | |
655 | AddProjection(aFolderObj, "track", fTPCTrackHisto, 0, 2, 5, &selString); | |
656 | AddProjection(aFolderObj, "track", fTPCTrackHisto, 1, 2, 5, &selString); | |
657 | AddProjection(aFolderObj, "track", fTPCTrackHisto, 3, 4, 5, &selString); | |
27c7c4b3 | 658 | |
659 | //restore cuts | |
660 | fTPCTrackHisto->GetAxis(8)->SetRangeUser(-1.5,1.5); | |
661 | fTPCTrackHisto->GetAxis(9)->SetRangeUser(-0.5,1.5); | |
636e5a51 | 662 | |
663 | ||
664 | printf("exportToFolder\n"); | |
27c7c4b3 | 665 | // export objects to analysis folder |
666 | fAnalysisFolder = ExportToFolder(aFolderObj); | |
667 | if (fFolderObj) delete fFolderObj; | |
668 | fFolderObj = aFolderObj; | |
669 | aFolderObj=0; | |
7cc34f08 | 670 | } |
671 | ||
27c7c4b3 | 672 | |
7cc34f08 | 673 | //_____________________________________________________________________________ |
674 | TFolder* AliPerformanceTPC::ExportToFolder(TObjArray * array) | |
675 | { | |
676 | // recreate folder avery time and export objects to new one | |
677 | // | |
678 | AliPerformanceTPC * comp=this; | |
679 | TFolder *folder = comp->GetAnalysisFolder(); | |
680 | ||
681 | TString name, title; | |
682 | TFolder *newFolder = 0; | |
683 | Int_t i = 0; | |
684 | Int_t size = array->GetSize(); | |
685 | ||
686 | if(folder) { | |
687 | // get name and title from old folder | |
688 | name = folder->GetName(); | |
689 | title = folder->GetTitle(); | |
690 | ||
691 | // delete old one | |
692 | delete folder; | |
693 | ||
694 | // create new one | |
695 | newFolder = CreateFolder(name.Data(),title.Data()); | |
696 | newFolder->SetOwner(); | |
697 | ||
698 | // add objects to folder | |
699 | while(i < size) { | |
700 | newFolder->Add(array->At(i)); | |
701 | i++; | |
702 | } | |
703 | } | |
704 | ||
705 | return newFolder; | |
706 | } | |
707 | ||
708 | //_____________________________________________________________________________ | |
709 | Long64_t AliPerformanceTPC::Merge(TCollection* const list) | |
710 | { | |
711 | // Merge list of objects (needed by PROOF) | |
712 | ||
713 | if (!list) | |
714 | return 0; | |
715 | ||
716 | if (list->IsEmpty()) | |
717 | return 1; | |
718 | ||
719 | TIterator* iter = list->MakeIterator(); | |
720 | TObject* obj = 0; | |
636e5a51 | 721 | TObjArray* objArrayList = 0; |
722 | objArrayList = new TObjArray(); | |
7cc34f08 | 723 | |
724 | // collection of generated histograms | |
725 | Int_t count=0; | |
726 | while((obj = iter->Next()) != 0) | |
727 | { | |
a13f4653 | 728 | AliPerformanceTPC* entry = dynamic_cast<AliPerformanceTPC*>(obj); |
729 | if (entry == 0) continue; | |
27c7c4b3 | 730 | if (fgMergeTHnSparse) { |
731 | if ((fTPCClustHisto) && (entry->fTPCClustHisto)) { fTPCClustHisto->Add(entry->fTPCClustHisto); } | |
732 | if ((fTPCEventHisto) && (entry->fTPCEventHisto)) { fTPCEventHisto->Add(entry->fTPCEventHisto); } | |
733 | if ((fTPCTrackHisto) && (entry->fTPCTrackHisto)) { fTPCTrackHisto->Add(entry->fTPCTrackHisto); } | |
734 | } | |
636e5a51 | 735 | // the analysisfolder is only merged if present |
736 | if (entry->fFolderObj) { objArrayList->Add(entry->fFolderObj); } | |
7cc34f08 | 737 | |
a13f4653 | 738 | count++; |
7cc34f08 | 739 | } |
636e5a51 | 740 | if (fFolderObj) { fFolderObj->Merge(objArrayList); } |
741 | // to signal that track histos were not merged: reset | |
27c7c4b3 | 742 | if (!fgMergeTHnSparse) { fTPCTrackHisto->Reset(); fTPCClustHisto->Reset(); fTPCEventHisto->Reset(); } |
636e5a51 | 743 | // delete |
27c7c4b3 | 744 | if (objArrayList) delete objArrayList; objArrayList=0; |
7cc34f08 | 745 | return count; |
746 | } | |
747 | ||
27c7c4b3 | 748 | |
7cc34f08 | 749 | //_____________________________________________________________________________ |
814d192f | 750 | TFolder* AliPerformanceTPC::CreateFolder(TString name, TString title) |
751 | { | |
7cc34f08 | 752 | // create folder for analysed histograms |
753 | // | |
754 | TFolder *folder = 0; | |
755 | folder = new TFolder(name.Data(),title.Data()); | |
756 | ||
757 | return folder; | |
758 | } | |
636e5a51 | 759 | |
814d192f | 760 | //_____________________________________________________________________________ |
761 | TTree* AliPerformanceTPC::CreateSummary() | |
762 | { | |
763 | // implementaion removed, switched back to use AliPerformanceSummary (now called in AliPerformanceTask) | |
764 | return 0; | |
765 | } | |
766 |