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