changes for Vertex and Tracks classes
[u/mrichter/AliRoot.git] / PWGPP / TRD / AliTRDcheckESD.cxx
CommitLineData
69656036
AB
1/**************************************************************************
2* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3* *
4* Author: The ALICE Off-line Project. *
5* Contributors are mentioned in the code where appropriate. *
6* *
7* Permission to use, copy, modify and distribute this software and its *
8* documentation strictly for non-commercial purposes is hereby granted *
9* without fee, provided that the above copyright notice appears in all *
10* copies and that both the copyright notice and this permission notice *
11* appear in the supporting documentation. The authors make no claims *
12* about the suitability of this software for any purpose. It is *
13* provided "as is" without express or implied warranty. *
14**************************************************************************/
15
16//////////////////////////////////////////////////////////////////////////
17// //
18// Check basic detector results at ESD level //
19// - Geometrical efficiency //
20// - Tracking efficiency //
21// - PID efficiency //
22// - Refit efficiency //
23// //
24// Author //
25// Alex Bercuci <A.Bercuci@gsi.de> //
26// Ionut Arsene <i.c.arsene@gsi.de> //
27// //
28// The analysis task fills AliCFContainer objects defined in the //
29// configuration macro using the AddCFContainer() method. //
30// The CF containers can be filled with any of the variables defined //
31// in ETrdCfVariables and at any of the steps defined in ETrdCfSteps. //
32// To define a new variable one needs to: //
33// 1. Add an entry in the ETrdCfVariables enumeration //
34// 2. Add the corresponding variable name (and in the correct order) //
35// in fgkVarNames //
36// 3. Define how the variable is filled in one of the Fill functions: //
37// FillEventInfo(), FillTrackInfo(), FillTrackletInfo(), //
38// FillTrackletSliceInfo(). //
39// To define a new step one needs to: //
40// 1. Add an entry in the ETrdCfSteps //
41// 2. Add the corresponding name in fgkStepNames //
42// 3. Define the track level cuts for this step in IsTrackSelected() //
43// //
44//////////////////////////////////////////////////////////////////////////
45
46#include <TClonesArray.h>
47#include <TCanvas.h>
48#include <TObjArray.h>
49#include <TPad.h>
50#include <TLegend.h>
51#include <TLatex.h>
52#include <TLine.h>
53#include <TF1.h>
54#include <TH1D.h>
55#include <TH2D.h>
56#include <TH3D.h>
57#include <TH2I.h>
58#include <TH2F.h>
59#include <TH3S.h>
60#include <TH3F.h>
61#include <TProfile2D.h>
62#include <TProfile.h>
63#include <TGraphErrors.h>
64#include <TGraphAsymmErrors.h>
65#include <TFile.h>
66#include <TTree.h>
67#include <TROOT.h>
68#include <TChain.h>
69#include <TParticle.h>
70#include <TTimeStamp.h>
71#include <TRandom.h>
72#include <TString.h>
73
74#include "AliLog.h"
75#include "AliAnalysisManager.h"
76#include "AliAnalysisCuts.h"
77#include "AliPhysicsSelection.h"
78#include "AliESDEvent.h"
79#include "AliESDkink.h"
80#include "AliMCEvent.h"
81#include "AliESDInputHandler.h"
82#include "AliMCEventHandler.h"
83#include "AliESDpid.h"
84#include "AliExternalTrackParam.h"
85
86#include "AliESDtrack.h"
87#include "AliMCParticle.h"
88#include "AliPID.h"
89#include "AliStack.h"
90#include "AliTrackReference.h"
91#include "AliMultiplicity.h"
92#include "AliCFContainer.h"
93
94#include "AliTRDcheckESD.h"
95#include <iostream>
96using std::cout;
97using std::endl;
98
99ClassImp(AliTRDcheckESD)
100
101const Float_t AliTRDcheckESD::fgkxTPC = 290.;
102const Float_t AliTRDcheckESD::fgkxTOF = 365.;
103const Char_t* AliTRDcheckESD::fgkVarNames[AliTRDcheckESD::kNTrdCfVariables] = {
104 "vtxZ", "multiplicity", "trigger", "BC", "TOFBC", "DCAxy", "DCAz", "charge", "OuterParam rad.", "phiVtx", "phi",
105 "etaVtx", "eta", "pt", "ptTRD", "P", "PTRD", "TRDchi2", "tracklets", "clusters", "TrdQuality",
c2c78193 106 "TrdBudget", "TOFchi2", "Qtot0", "ClustersPerRows", "Clusters/tracklet", "TrdP", "TrdPloss", "layer", "slice", "PH0"
69656036
AB
107};
108const Char_t* AliTRDcheckESD::fgkStepNames[AliTRDcheckESD::kNSteps] = {"TPC", "TRD", "TOF", "TOFin", "TOFout"};
109
110FILE* AliTRDcheckESD::fgFile = NULL;
111
112//____________________________________________________________________
113AliTRDcheckESD::AliTRDcheckESD():
114 AliAnalysisTaskSE()
115 ,fStatus(0)
116 ,fNRefFigures(0)
117 ,fESD(NULL)
118 ,fMC(NULL)
119 ,fESDpid(new AliESDpid)
120 ,fHistos(NULL)
121 ,fReferenceTrackFilter(NULL)
122 ,fPhysSelTriggersEnabled(kFALSE)
123 ,fUserEnabledTriggers("")
124 ,fNAssignedTriggers(0)
125{
126 //
127 // Default constructor
128 //
129 SetNameTitle("TRDcheckESD", "Check TRD @ ESD level");
130 SetMC(kTRUE);
131}
132
133//____________________________________________________________________
134AliTRDcheckESD::AliTRDcheckESD(char* name):
135 AliAnalysisTaskSE(name)
136 ,fStatus(0)
137 ,fNRefFigures(0)
138 ,fESD(NULL)
139 ,fMC(NULL)
140 ,fESDpid(new AliESDpid)
141 ,fHistos(NULL)
142 ,fReferenceTrackFilter(NULL)
143 ,fPhysSelTriggersEnabled(kFALSE)
144 ,fUserEnabledTriggers("")
145 ,fNAssignedTriggers(0)
146{
147 //
148 // Default constructor
149 //
150 SetMC(kTRUE);
151 SetTitle("Check TRD @ ESD level");
152 DefineOutput(1, TObjArray::Class());
153}
154
155//____________________________________________________________________
156AliTRDcheckESD::~AliTRDcheckESD()
157{
158 // Destructor
159 if(fHistos && !(AliAnalysisManager::GetAnalysisManager() && AliAnalysisManager::GetAnalysisManager()->IsProofMode())){
160 if(fHistos->IsOwner()) fHistos->Delete();
161 delete fHistos;
162 fHistos = NULL;
163 }
164}
165
166//____________________________________________________________________
167void AliTRDcheckESD::FillEventInfo(Double_t* values) {
168 //
169 // Fill event information
170 //
e690d4d0 171 values[kEventVtxZ] = fESD->GetPrimaryVertex()->GetZ();
69656036
AB
172 values[kEventBC] = fESD->GetBunchCrossNumber();
173
174 const AliMultiplicity* mult=fESD->GetMultiplicity();
175 Double_t itsNTracklets = mult->GetNumberOfTracklets();
176 values[kEventMult] = itsNTracklets;
177}
178
179//____________________________________________________________________
180void AliTRDcheckESD::FillTrackInfo(Double_t* values, AliESDtrack* esdTrack) {
181 //
182 // Fill track information
183 //
184 Float_t dcaxy,dcaz;
185 esdTrack->GetImpactParameters(dcaxy,dcaz);
186 values[kTrackDCAxy] = dcaxy;
187 values[kTrackDCAz] = dcaz;
188 values[kTrackCharge] = esdTrack->Charge();
189 values[kTrackPt] = esdTrack->Pt();
190 values[kTrackPhi] = esdTrack->Phi();
191 values[kTrackEta] = esdTrack->Eta();
192 values[kTrackP] = esdTrack->P();
193 values[kTrackTrdTracklets] = esdTrack->GetTRDntracklets();
194 values[kTrackTrdClusters] = esdTrack->GetTRDncls();
195 values[kTrackTrdChi2] = esdTrack->GetTRDchi2()/(esdTrack->GetTRDntracklets()>0 ? esdTrack->GetTRDntracklets() : 1.0);
196 values[kTrackTrdQuality] = esdTrack->GetTRDQuality();
c2c78193 197 values[kTrackTRDBudget] = -1.0*esdTrack->GetTRDBudget();
69656036 198 values[kTrackTOFBC] = esdTrack->GetTOFBunchCrossing(fESD->GetMagneticField());
c2c78193 199 values[kTrackTOFchi2] = esdTrack->GetTOFchi2();
69656036
AB
200 const AliExternalTrackParam *out=esdTrack->GetOuterParam();
201 Double_t p[3];
202 if(out->GetXYZ(p))
203 values[kTrackOuterParamRadius] = TMath::Sqrt(p[0]*p[0]+p[1]*p[1]);
204 else
205 values[kTrackOuterParamRadius] = 0.0;
206}
207
208//____________________________________________________________________
209void AliTRDcheckESD::FillTrackletInfo(Double_t* values, AliESDtrack* esdTrack, Int_t iPlane,
210 Double_t* localSagitaPhi, Double_t localMom[][3], Bool_t* localMomGood) {
211 //
212 // Fill TRD tracklet info
213 //
214 values[kTrackletClustersVsRows] = esdTrack->GetTRDtrkltClCross(iPlane);
215 values[kTrackletClusters] = esdTrack->GetTRDtrkltOccupancy(iPlane);
216 values[kTrackletQtot] = esdTrack->GetTRDslice(iPlane, 0);
217 values[kTrackletP] = esdTrack->GetTRDmomentum(iPlane);
c2c78193 218 values[kTrackPlossTRDlayer] = 1000.0*(esdTrack->P() - values[kTrackletP]); // p loss in MeV
69656036
AB
219 values[kTrackletLayer] = iPlane;
220 values[kTrackPhiTRD] = localSagitaPhi[iPlane];
221 values[kTrackPtTRD] = (localMomGood[iPlane] ? TMath::Sqrt(localMom[iPlane][0]*localMom[iPlane][0]+
222 localMom[iPlane][1]*localMom[iPlane][1]) : values[kTrackPt]);
223 values[kTrackPTRD] = (localMomGood[iPlane] ? TMath::Sqrt(values[kTrackPtTRD]*values[kTrackPtTRD]+
224 localMom[iPlane][2]*localMom[iPlane][2]) : values[kTrackP]);
225 values[kTrackEtaTRD] = values[kTrackPTRD]-(localMomGood[iPlane] ? localMom[iPlane][2] : esdTrack->Pz());
226 values[kTrackEtaTRD] = (TMath::Abs(values[kTrackPTRD])>1.0e-8 ? (values[kTrackPTRD]+(localMomGood[iPlane] ? localMom[iPlane][2] : esdTrack->Pz()))/values[kTrackEtaTRD] : 0.0);
227 values[kTrackEtaTRD] = (values[kTrackEtaTRD]>1.0e-8 ? 0.5*TMath::Log(values[kTrackEtaTRD]) : -999.);
228}
229
230//____________________________________________________________________
231void AliTRDcheckESD::FillTrackletSliceInfo(Double_t* values, AliESDtrack* esdTrack, Int_t iSlice) {
232 //
233 // Fill TRD tracklet info
234 //
235 values[kTrackletPHslice] = esdTrack->GetTRDslice(Int_t(values[kTrackletLayer]), iSlice);
236 values[kTrackletSlice] = iSlice;
237}
238
239//____________________________________________________________________
240Bool_t AliTRDcheckESD::IsTrackSelected(AliESDtrack* track, Double_t* /*values*/, Int_t step) {
241 //
242 // Select tracks at each step
098f177f 243 //
69656036
AB
244 Bool_t referenceFilter = fReferenceTrackFilter->IsSelected(track);
245 if(step==kTPCreference) { // reference track filter
246 return referenceFilter;
247 }
248 if(step==kTRD) { // TRD reference track filter
098f177f 249 return (referenceFilter && Int_t(track->GetTRDntracklets()>0));
69656036 250 }
098f177f 251 if(step==kTOF) { // TRD+(TOFout || TOFpid) request
252 return (referenceFilter && Int_t(track->GetTRDntracklets())>0 &&
253 ((track->GetStatus() & AliESDtrack::kTOFout) || (track->GetStatus() & AliESDtrack::kTOFpid)));
69656036
AB
254 }
255 if(step==kTOFin) { // TOFin request
256 return (referenceFilter && (track->GetStatus() & AliESDtrack::kTOFin));
257 }
258 if(step==kTOFout) { // TOFout request
259 return (referenceFilter && (track->GetStatus() & AliESDtrack::kTOFout));
260 }
261 return kFALSE;
262}
263
264//____________________________________________________________________
265void AliTRDcheckESD::UserCreateOutputObjects()
266{
267 //
268 // Create Output Containers (TObjectArray containing 1D histograms)
269 //
270 Histos();
271 PostData(1, fHistos);
272}
273
274//____________________________________________________________________
275void AliTRDcheckESD::MakeSummaryFromCF(Double_t* trendValues, const Char_t* /*triggerName*/, Bool_t /*useIsolatedBC*/, Bool_t /*cutTOFbc*/){
276 //
277 // Draw summary plots for the ESDcheck task using the CF container
278 //
279
280 cout << "Make summary from CF" << endl;
281 TCanvas *cOut=0x0;
282 if(gROOT->FindObject("trackingSummary")) delete gROOT->FindObject("trackingSummary");
283 cOut = new TCanvas("trackingSummary", "Tracking summary for the ESD task", 1600, 1200);
284 cOut->cd();
285 //PlotTrackingSummaryFromCF(trendValues, triggerName, useIsolatedBC, cutTOFbc);
286 PlotTrackingSummaryFromCF(trendValues);
287 cOut->SaveAs("trackingSummary.gif");
288
289 if(gROOT->FindObject("pidSummary")) delete gROOT->FindObject("pidSummary");
290 cOut = new TCanvas("pidSummary", "PID summary for the ESD task", 1600, 1200);
291 cOut->cd();
292 //PlotPidSummaryFromCF(trendValues, triggerName, useIsolatedBC, cutTOFbc);
293 PlotPidSummaryFromCF(trendValues);
294 cOut->SaveAs("pidSummary.gif");
295
296 if(gROOT->FindObject("centSummary")) delete gROOT->FindObject("centSummary");
297 cOut = new TCanvas("centSummary", "Centrality summary for the ESD task", 1600, 1200);
298 cOut->cd();
299 //PlotCentSummaryFromCF(trendValues, triggerName, useIsolatedBC, cutTOFbc);
300 PlotCentSummaryFromCF(trendValues);
301 cOut->SaveAs("centSummary.gif");
302
303 PlotOtherSummaryFromCF(trendValues);
304
305 if(trendValues)
306 for(Int_t i=0;i<50;++i) cout << "trend #" << i << " :: " << trendValues[i] << endl;
307}
308
309
310//____________________________________________________________________
311void AliTRDcheckESD::UserExec(Option_t *){
312 //
313 // Run the Analysis
314 //
315 fESD = dynamic_cast<AliESDEvent*>(InputEvent());
316 fMC = MCEvent();
317
318 if(!fESD){
319 AliError("ESD event missing.");
320 return;
321 }
322
323 AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();
324 AliInputEventHandler* inputHandler = (AliInputEventHandler*) (man->GetInputEventHandler());
325 if(!inputHandler) return;
326
327 if(!fPhysSelTriggersEnabled) {
328 InitializeCFContainers();
329 fPhysSelTriggersEnabled = kTRUE;
330 }
331
332 UInt_t isSelected = AliVEvent::kAny;
333 if(inputHandler){
334 if(inputHandler->GetEventSelection()) {
335 isSelected = inputHandler->IsEventSelected();
336 }
337 }
338 if(!isSelected) return;
339
340 TString triggerClasses = fESD->GetFiredTriggerClasses();
341 //cout << "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++triggers fired: " << triggerClasses.Data() << endl;
342 TObjArray* triggers = triggerClasses.Tokenize(" ");
343 TObjArray* userTriggers = fUserEnabledTriggers.Tokenize(";");
344 if(triggers->GetEntries()<1) {delete triggers; delete userTriggers; return;}
345 Bool_t hasGoodTriggers = kFALSE;
346 Int_t triggerIndices[kNMaxAssignedTriggers] = {0};
347 Int_t nTrigFired=0;
348 Bool_t trigAlreadyChecked = kFALSE;
349 Bool_t trigSelected = kFALSE;
350 Int_t trigIdx = 0;
351 for(Int_t i=0; i<triggers->GetEntries(); ++i) {
352 TString trigStr=triggers->At(i)->GetName();
353 if(!trigStr.Contains("NOTRD") && !trigStr.Contains("MUON")) hasGoodTriggers = kTRUE; // check wheter TRD was read out in this event
354 if(trigStr.Contains("NOTRD")) continue;
355 if(trigStr.Contains("MUON")) continue;
356 if(i>=kNMaxAssignedTriggers) continue;
357
358 hasGoodTriggers = kTRUE;
359 // enable the "All triggers" bit
360 trigIdx = 1;
361 trigAlreadyChecked = kFALSE;
362 for(Int_t k=0;k<nTrigFired;++k)
363 if(triggerIndices[k]==trigIdx) {
364 trigAlreadyChecked = kTRUE;
365 break;
366 }
367 if(!trigAlreadyChecked) triggerIndices[nTrigFired++] = trigIdx;
368
369 trigSelected = kFALSE;
370 // check whether this trigger matches any of the user defined trigger families
371 for(Int_t j=0;j<userTriggers->GetEntries();++j) {
372 TString userTrigStr=userTriggers->At(j)->GetName();
373 if(trigStr.Contains(userTrigStr.Data())) {
374 trigSelected = kTRUE;
375 trigIdx = GetTriggerIndex(userTrigStr.Data(), kFALSE);
376 trigAlreadyChecked = kFALSE;
377 for(Int_t k=0;k<nTrigFired;++k)
378 if(triggerIndices[k]==trigIdx) {
379 trigAlreadyChecked = kTRUE;
380 break;
381 }
382 if(!trigAlreadyChecked) { // add trigger to the list of enabled triggers only if it was not added already
383 triggerIndices[nTrigFired++] = trigIdx;
384 }
385 }
386 }
387
388 trigIdx = GetTriggerIndex(trigStr.Data(), kFALSE);
389 if(trigIdx>0) trigSelected = kTRUE;
390 if(trigIdx==-1) trigIdx=1;
391 trigAlreadyChecked = kFALSE;
392 for(Int_t k=0;k<nTrigFired;++k)
393 if(triggerIndices[k]==trigIdx) {
394 trigAlreadyChecked = kTRUE;
395 break;
396 }
397 if(!trigAlreadyChecked) {
398 triggerIndices[nTrigFired++]=1; // 0-assigned to all other triggers
399 }
400 } // end loop over triggers
401
402 if(!trigSelected && hasGoodTriggers) {
403 triggerIndices[nTrigFired++]=2;
404 }
405
406 TH1F* hTrig = (TH1F*)fHistos->FindObject("hTriggerDefs");
407 for(Int_t i=0; i<nTrigFired; ++i)
408 hTrig->Fill(triggerIndices[i]);
409
410 if(!hasGoodTriggers) {
411 PostData(1, fHistos);
412 delete triggers;
413 delete userTriggers;
414 return;
415 }
416
417 Int_t* trigFiredIdx=new Int_t[nTrigFired];
418 for(Int_t i=0;i<nTrigFired;++i) trigFiredIdx[i] = triggerIndices[i];
419
420 // Get MC information if available
5cf184fe 421 //AliStack * fStack = NULL;
69656036
AB
422 if(HasMC()){
423 if(!fMC){
424 AliWarning("MC event missing");
425 SetMC(kFALSE);
426 } else {
5cf184fe 427 if(!fMC->Stack()){
69656036
AB
428 AliWarning("MC stack missing");
429 SetMC(kFALSE);
430 }
431 }
432 }
433
434 Double_t values[kNTrdCfVariables]; // array where the CF container variables are stored
435 for(Int_t i=0;i<kNTrdCfVariables; ++i) values[i] = -999.;
436 FillEventInfo(values);
437
438 Int_t multLimits[6] = {0, 700, 1400, 2100, 2800, 3500};
439 Int_t centralityClass = 0;
440 for(Int_t iCent=0; iCent<5; ++iCent) {
441 if(values[kEventMult]>=multLimits[iCent] && values[kEventMult]<multLimits[iCent+1])
442 centralityClass=iCent+1;
443 }
444 if(centralityClass == 0) return;
445
446 // radius of TRD entrance plane in each layer
447 Double_t rTRD[6] = {298.0, 311.0, 324.0, 337.0, 350.0, 363.0};
448
449 AliESDtrack *esdTrack(NULL);
450 for(Int_t itrk = 0; itrk < fESD->GetNumberOfTracks(); itrk++){
451 esdTrack = fESD->GetTrack(itrk);
452
453 Bool_t stepSelections[kNSteps];
454 for(Int_t is=0;is<kNSteps;++is) {
455 stepSelections[is] = IsTrackSelected(esdTrack, values, is);
456 }
457 if(!stepSelections[0]) continue;
458
459 FillTrackInfo(values, esdTrack);
460
461 // find position and momentum of the track at entrance in TRD
462 const AliExternalTrackParam *outerParam = esdTrack->GetOuterParam();
463 Double_t localCoord[6][3] = {{0.0}};
464 Bool_t localCoordGood[6];
465 for(Int_t il=0;il<6;++il)
466 localCoordGood[il] = (outerParam ? outerParam : esdTrack)->GetXYZAt(rTRD[il], fESD->GetMagneticField(), localCoord[il]);
467 Double_t localMom[6][3] = {{0.0}};
468 Bool_t localMomGood[6];
469 for(Int_t il=0; il<6; ++il)
470 localMomGood[il] = (outerParam ? outerParam : esdTrack)->GetPxPyPzAt(rTRD[il], fESD->GetMagneticField(), localMom[il]);
471 Double_t localSagitaPhi[6] = {-999.};
472 for(Int_t il=0; il<6; ++il)
473 localSagitaPhi[il] = (localCoordGood[il] ? TMath::ATan2(localCoord[il][1], localCoord[il][0]) : -999.);
474 if(!localMomGood[0]) continue;
475
c2c78193 476 // fill tracklet values such that the TRD local coordinates are filled
69656036
AB
477 FillTrackletInfo(values, esdTrack, 0, localSagitaPhi, localMom, localMomGood);
478
479 for(Int_t itrig=0; itrig<nTrigFired; ++itrig) {
480 values[kEventTrigger] = Double_t(trigFiredIdx[itrig]);
481
482 // check if cf needs tracklet or slice info
483 FillGlobalTrackContainers(values, stepSelections, itrig);
484
485 for(Int_t iPlane=0; iPlane<6; iPlane++) {
486 FillTrackletInfo(values, esdTrack, iPlane, localSagitaPhi, localMom, localMomGood);
487 if(values[kTrackletQtot]>20.0) FillTrdTrackletContainers(values, stepSelections, itrig);
488
489 for(Int_t iSlice=0; iSlice<8; iSlice++) {
490 FillTrackletSliceInfo(values, esdTrack, iSlice);
491 if(values[kTrackletPHslice]>20.0) FillTrdSliceContainers(values, stepSelections, itrig);
492 } // end loop over slices
493 } // end loop over TRD layers
494 } // end loop over triggers
495 } // end loop over tracks
496
497 delete triggers;
498 delete userTriggers;
499 delete [] trigFiredIdx;
500
501 PostData(1, fHistos);
502}
503
504//____________________________________________________________________
505TObjArray* AliTRDcheckESD::Histos()
506{
507 // Retrieve histograms array if already build or build it
508 if(!fHistos) {
509 fHistos = new TObjArray();
510 fHistos->SetOwner(kTRUE);
511 }
512
513 TH1* h = 0x0;
514 // Trigger definitions
515 if(!(h=(TH1F*)gROOT->FindObject("hTriggerDefs"))) {
516 h = new TH1F("hTriggerDefs", "Trigger definitions", kNMaxAssignedTriggers, 0.5, 0.5+Float_t(kNMaxAssignedTriggers));
517 }
518 else h->Reset();
519 fHistos->Add(h);
520
521 return fHistos;
522}
523
524
525//__________________________________________________________________________________________________________
526void AliTRDcheckESD::InitializeCFContainers() {
527 //
528 // Initialize the CF container
529 //
530 AliAnalysisManager* man=AliAnalysisManager::GetAnalysisManager();
531 AliInputEventHandler* inputHandler = (AliInputEventHandler*) (man->GetInputEventHandler());
532 if(!inputHandler) return;
533
534 GetTriggerIndex("All triggers", kTRUE);
535 GetTriggerIndex("Not specified triggers", kTRUE);
536
537 AliPhysicsSelection* physSel = (AliPhysicsSelection*)inputHandler->GetEventSelection();
538 const TList* trigList = (physSel ? physSel->GetCollisionTriggerClasses() : 0x0);
539 const TList* bgTrigList = (physSel ? physSel->GetBGTriggerClasses() : 0x0);
540
541 // Add collision triggers from PhysicsSelection
542 if(trigList) {
543 for(Int_t it=0; it<trigList->GetEntries(); ++it) {
544 TString trigName = trigList->At(it)->GetName();
545 TObjArray* arr = trigName.Tokenize(" ");
546 trigName = arr->At(0)->GetName();
547 trigName.Remove(0,1);
548 TObjArray* arr2 = trigName.Tokenize(",");
549 for(Int_t jt=0; jt<arr2->GetEntries(); ++jt) {
550 // Assign an index into the trigger histogram and the CF container for this trigger
551 GetTriggerIndex(arr2->At(jt)->GetName(), kTRUE);
552 }
553 delete arr;
554 }
555 }
556 // Add background triggers from PhysicsSelection
557 if(bgTrigList) {
558 for(Int_t it=0; it<bgTrigList->GetEntries(); ++it) {
559 TString trigName = bgTrigList->At(it)->GetName();
560 TObjArray* arr = trigName.Tokenize(" ");
561 trigName = arr->At(0)->GetName();
562 trigName.Remove(0,1);
563 TObjArray* arr2 = trigName.Tokenize(",");
564 for(Int_t jt=0; jt<arr2->GetEntries(); ++jt) {
565 // Assign an index into the trigger histogram and the CF container for this trigger
566 GetTriggerIndex(arr2->At(jt)->GetName(), kTRUE);
567 }
568 delete arr;
569 }
570 }
571
572 // Add user enabled triggers
573 TObjArray* arr = fUserEnabledTriggers.Tokenize(";");
574 for(Int_t it=0; it<arr->GetEntries(); ++it) {
575 GetTriggerIndex(arr->At(it)->GetName(), kTRUE);
576 }
577 delete arr;
578}
579
580
581//__________________________________________________________________________________________________________
582void AliTRDcheckESD::AddCFContainer(const Char_t* name, const Char_t* title,
583 Int_t nSteps, Int_t* steps,
584 Int_t nVars, UInt_t* vars, TArrayD* binLimits) {
585 //
586 // Add a CF container
587 //
588 if(!fHistos) {
589 fHistos = new TObjArray();
590 fHistos->SetOwner(kTRUE);
591 }
592 // get number of bins for each variable
593 Int_t* nBins = new Int_t[nVars];
594 for(Int_t iv=0;iv<nVars;++iv)
595 nBins[iv] = binLimits[iv].GetSize()-1;
596 // create the CF container
597 AliCFContainer* cf = new AliCFContainer(name, title, nSteps, nVars, nBins);
598 // set CF container variable binning and name
599 for(Int_t iv=0;iv<nVars;++iv) {
600 cf->SetBinLimits(iv, binLimits[iv].GetArray());
601 cf->SetVarTitle(iv, fgkVarNames[vars[iv]]);
602 }
603 // set the step names
604 for(Int_t is=0; is<nSteps; ++is) {
605 cf->SetStepTitle(is, fgkStepNames[steps[is]]);
606 for(Int_t iv=0;iv<nVars;++iv) cf->GetAxis(iv, is)->SetUniqueID(vars[iv]);
607 }
608 fHistos->Add(cf);
609}
610
611//__________________________________________________________________________________________________
612void AliTRDcheckESD::FillTrdSliceContainers(Double_t* values, Bool_t* stepSelections, Int_t itrig) {
613 //
614 // fill TRD slice info
615 //
616 if(!fHistos) return;
617 for(Int_t i=0;i<fHistos->GetEntries();++i) {
618 TString objType = fHistos->At(i)->IsA()->GetName();
619 if(!objType.Contains("AliCFContainer")) continue;
620 AliCFContainer* cf = (AliCFContainer*)fHistos->At(i);
098f177f 621 TString varNames="";
622 for(Int_t ivar=0;ivar<cf->GetNVar();++ivar) {
623 varNames += cf->GetVarTitle(ivar); varNames += ";";
624 }
625 //if(cf->GetVar(fgkVarNames[kTrackletSlice])<0 && cf->GetVar(fgkVarNames[kTrackletPHslice])<0) continue;
626 if(!varNames.Contains(fgkVarNames[kTrackletSlice]) && !varNames.Contains(fgkVarNames[kTrackletPHslice])) continue;
627 //if((cf->GetVar(fgkVarNames[kEventTrigger])<0 && itrig==0) || (cf->GetVar(fgkVarNames[kEventTrigger])>=0))
628 if((!varNames.Contains(fgkVarNames[kEventTrigger]) && itrig==0) || varNames.Contains(fgkVarNames[kEventTrigger]))
69656036
AB
629 FillCFContainer(cf, values, stepSelections);
630 }
631}
632
633//__________________________________________________________________________________________________
634void AliTRDcheckESD::FillTrdTrackletContainers(Double_t* values, Bool_t* stepSelections, Int_t itrig) {
635 //
636 // fill global track info
637 //
638 if(!fHistos) return;
639 for(Int_t i=0;i<fHistos->GetEntries();++i) {
640 TString objType = fHistos->At(i)->IsA()->GetName();
641 if(!objType.Contains("AliCFContainer")) continue;
642 AliCFContainer* cf = (AliCFContainer*)fHistos->At(i);
098f177f 643 TString varNames="";
644 for(Int_t ivar=0;ivar<cf->GetNVar();++ivar) {
645 varNames += cf->GetVarTitle(ivar); varNames += ";";
646 }
647 //if(cf->GetVar(fgkVarNames[kTrackletSlice])>=0 || cf->GetVar(fgkVarNames[kTrackletPHslice])>=0) continue;
648 if(varNames.Contains(fgkVarNames[kTrackletSlice]) || varNames.Contains(fgkVarNames[kTrackletPHslice])) continue;
649 //if(cf->GetVar(fgkVarNames[kTrackletLayer])<0 && cf->GetVar(fgkVarNames[kTrackletQtot])<0) continue;
650 if(!varNames.Contains(fgkVarNames[kTrackletLayer]) && !varNames.Contains(fgkVarNames[kTrackletQtot])) continue;
651 //if((cf->GetVar(fgkVarNames[kEventTrigger])<0 && itrig==0) || (cf->GetVar(fgkVarNames[kEventTrigger])>=0))
652 if((!varNames.Contains(fgkVarNames[kEventTrigger]) && itrig==0) || varNames.Contains(fgkVarNames[kEventTrigger]))
69656036
AB
653 FillCFContainer(cf, values, stepSelections);
654 }
655}
656
657//__________________________________________________________________________________________________
658void AliTRDcheckESD::FillGlobalTrackContainers(Double_t* values, Bool_t* stepSelections, Int_t itrig) {
659 //
660 // fill global track info
661 //
662 if(!fHistos) return;
663 for(Int_t i=0;i<fHistos->GetEntries();++i) {
664 TString objType = fHistos->At(i)->IsA()->GetName();
665 if(!objType.Contains("AliCFContainer")) continue;
666 AliCFContainer* cf = (AliCFContainer*)fHistos->At(i);
098f177f 667 TString varNames="";
668 for(Int_t ivar=0;ivar<cf->GetNVar();++ivar) {
669 varNames += cf->GetVarTitle(ivar); varNames += ";";
670 }
671 /*if(cf->GetVar(fgkVarNames[kTrackletLayer])>=0 ||
69656036
AB
672 cf->GetVar(fgkVarNames[kTrackletSlice])>=0 ||
673 cf->GetVar(fgkVarNames[kTrackletQtot])>=0 ||
098f177f 674 cf->GetVar(fgkVarNames[kTrackletPHslice])>=0) continue;*/
675 if(varNames.Contains(fgkVarNames[kTrackletLayer]) ||
676 varNames.Contains(fgkVarNames[kTrackletSlice]) ||
677 varNames.Contains(fgkVarNames[kTrackletQtot]) ||
678 varNames.Contains(fgkVarNames[kTrackletPHslice])) continue;
679 /*if((cf->GetVar(fgkVarNames[kEventTrigger])<0 && itrig==0) ||
680 (cf->GetVar(fgkVarNames[kEventTrigger])>=0))*/
681 if((!varNames.Contains(fgkVarNames[kEventTrigger]) && itrig==0) ||
682 varNames.Contains(fgkVarNames[kEventTrigger]))
69656036
AB
683 FillCFContainer(cf, values, stepSelections);
684 }
685}
686
687//__________________________________________________________________________________________________
688void AliTRDcheckESD::FillCFContainer(AliCFContainer* cf, Double_t* values, Bool_t* stepSelections) {
689 //
690 // Fill CF container
691 //
692 Double_t* cfValues=new Double_t[cf->GetNVar()];
693 for(Int_t iv=0;iv<cf->GetNVar();++iv)
694 cfValues[iv] = values[cf->GetAxis(iv,0)->GetUniqueID()];
695
696 for(Int_t istep=0; istep<cf->GetNStep(); ++istep) {
697 TString stepTitle = cf->GetStepTitle(istep);
698 Int_t stepNo = -1;
699 for(Int_t is=0;is<kNSteps;++is)
700 if(!stepTitle.CompareTo(fgkStepNames[is])) {
701 stepNo = is;
702 break;
703 }
704 if(stepSelections[stepNo]) cf->Fill(cfValues, istep);
705 } // end loop over steps
5cf184fe
AB
706
707 delete [] cfValues;
69656036
AB
708}
709
710//____________________________________________________________________
711Bool_t AliTRDcheckESD::Load(const Char_t *file, const Char_t *dir, const Char_t *name)
712{
713 //
714 // Load data from performance file
715 //
716 if(!TFile::Open(file)){
717 AliWarning(Form("Couldn't open file %s.", file));
718 return kFALSE;
719 }
720 if(dir){
721 if(!gFile->cd(dir)){
722 AliWarning(Form("Couldn't cd to %s in %s.", dir, file));
723 return kFALSE;
724 }
725 }
726 TObjArray *o(NULL);
727 const Char_t *tn=(name ? name : GetName());
728 if(!(o = (TObjArray*)gDirectory->Get(tn))){
729 AliWarning(Form("Missing histogram container %s.", tn));
730 return kFALSE;
731 }
732 fHistos = (TObjArray*)o->Clone(GetName());
733
734 TH1F* trigHist = (TH1F*)fHistos->FindObject("hTriggerDefs");
735 for(Int_t i=1;i<=trigHist->GetXaxis()->GetNbins();++i) {
736 if(trigHist->GetXaxis()->GetBinLabel(i)[0]!='\0') ++fNAssignedTriggers;
737 }
738 gFile->Close();
739 return kTRUE;
740}
741
742//_______________________________________________________
743Bool_t AliTRDcheckESD::PutTrendValue(const Char_t *name, Double_t val)
744{
745// Dump trending value to default file
746
747 if(!fgFile){
748 fgFile = fopen("TRD.Performance.txt", "at");
749 }
750 fprintf(fgFile, "%s_%s %f\n", GetName(), name, val);
751 return kTRUE;
752}
753
754//____________________________________________________________________
755void AliTRDcheckESD::Terminate(Option_t *)
756{
757 // Steer post-processing
758 if(!fHistos){
759 fHistos = dynamic_cast<TObjArray *>(GetOutputData(1));
760 if(!fHistos){
761 AliError("Histogram container not found in output");
762 return;
763 }
764 }
765}
766
767//____________________________________________________________________
768Int_t AliTRDcheckESD::Pdg2Idx(Int_t pdg) const
769{
770 //
771 // Helper function converting PDG code into AliPID index
772 //
773 switch(pdg){
774 case kElectron:
775 case kPositron: return AliPID::kElectron;
776 case kMuonPlus:
777 case kMuonMinus: return AliPID::kMuon;
778 case kPiPlus:
779 case kPiMinus: return AliPID::kPion;
780 case kKPlus:
781 case kKMinus: return AliPID::kKaon;
782 case kProton:
783 case kProtonBar: return AliPID::kProton;
784 }
785 return -1;
786}
787
788
789//________________________________________________________
790void AliTRDcheckESD::Process2D(TH2 * const h2, TGraphErrors **g)
791{
792 //
793 // Do the processing
794 //
795
796 Int_t n = 0;
797 if((n=g[0]->GetN())) for(;n--;) g[0]->RemovePoint(n);
798 if((n=g[1]->GetN())) for(;n--;) g[1]->RemovePoint(n);
799 TF1 f("fg", "gaus", -3.,3.);
800 for(Int_t ibin = 1; ibin <= h2->GetNbinsX(); ibin++){
801 Double_t x = h2->GetXaxis()->GetBinCenter(ibin);
802 TH1D *h = h2->ProjectionY("py", ibin, ibin);
803 if(h->GetEntries()<100) continue;
804 //AdjustF1(h, f);
805
806 h->Fit(&f, "QN");
807 Int_t ip = g[0]->GetN();
808 g[0]->SetPoint(ip, x, f.GetParameter(1));
809 g[0]->SetPointError(ip, 0., f.GetParError(1));
810 g[1]->SetPoint(ip, x, f.GetParameter(2));
811 g[1]->SetPointError(ip, 0., f.GetParError(2));
812 }
813 return;
814}
815//____________________________________________________________________
816void AliTRDcheckESD::PrintStatus(ULong_t status)
817{
818// Dump track status to stdout
819
820 printf("ITS[i(%d) o(%d) r(%d)] TPC[i(%d) o(%d) r(%d) p(%d)] TRD[i(%d) o(%d) r(%d) p(%d) s(%d)] HMPID[o(%d) p(%d)]\n"
821 ,Bool_t(status & AliESDtrack::kITSin)
822 ,Bool_t(status & AliESDtrack::kITSout)
823 ,Bool_t(status & AliESDtrack::kITSrefit)
824 ,Bool_t(status & AliESDtrack::kTPCin)
825 ,Bool_t(status & AliESDtrack::kTPCout)
826 ,Bool_t(status & AliESDtrack::kTPCrefit)
827 ,Bool_t(status & AliESDtrack::kTPCpid)
828 ,Bool_t(status & AliESDtrack::kTRDin)
829 ,Bool_t(status & AliESDtrack::kTRDout)
830 ,Bool_t(status & AliESDtrack::kTRDrefit)
831 ,Bool_t(status & AliESDtrack::kTRDpid)
832 ,Bool_t(status & AliESDtrack::kTRDStop)
833 ,Bool_t(status & AliESDtrack::kHMPIDout)
834 ,Bool_t(status & AliESDtrack::kHMPIDpid)
835 );
836}
837
838//____________________________________________________________________
839TH1D* AliTRDcheckESD::Proj2D(TH2* hist, TH1* mpvErr, TH1* widthErr, TH1* chi2) {
840 //
841 // project the PH vs Slice 2D-histo into a 1D histo with Landau MPV and widths
842 //
843
844 TH1D* hProjection = (TH1D*)hist->ProjectionX(Form("hProjection_%f", gRandom->Rndm()));
845 hProjection->Reset();
846
847 TF1* fitLandau = new TF1("landauFunc","landau",20.,3000.);
848 TH1D *hD;
849 for(Int_t iBin=1;iBin<=hist->GetXaxis()->GetNbins();iBin++) {
850 if(gROOT->FindObject("projection"))
851 delete gROOT->FindObject("projection");
852 hD = (TH1D*)hist->ProjectionY("projection",iBin,iBin);
853 //hD->Rebin(4);
854 if(hD->Integral()>10) {
855 fitLandau->SetParameter(1, hD->GetBinCenter(hD->GetMaximumBin()));
856 fitLandau->SetParLimits(1, 0.2*hD->GetBinCenter(hD->GetMaximumBin()), 3.0*hD->GetBinCenter(hD->GetMaximumBin()));
857 fitLandau->SetParameter(0, 1000.);
858 fitLandau->SetParLimits(0, 1., 10000000.);
859 fitLandau->SetParameter(2, 0.5*hD->GetBinCenter(hD->GetMaximumBin()));
860 fitLandau->SetParLimits(2, 0.01*hD->GetBinCenter(hD->GetMaximumBin()), 1.0*hD->GetRMS());
861 hD->Fit(fitLandau, "Q0", "", hD->GetXaxis()->GetXmin(), hD->GetXaxis()->GetXmax());
862 hD->Fit(fitLandau, "Q0", "", hD->GetXaxis()->GetXmin(), hD->GetXaxis()->GetXmax());
863 hProjection->SetBinContent(iBin, fitLandau->GetParameter(1));
864 hProjection->SetBinError(iBin, fitLandau->GetParameter(2));
865 if(mpvErr) {
866 mpvErr->SetBinContent(iBin, fitLandau->GetParameter(1));
867 mpvErr->SetBinError(iBin, fitLandau->GetParError(1));
868 }
869 if(widthErr) {
870 widthErr->SetBinContent(iBin, fitLandau->GetParameter(2));
871 widthErr->SetBinError(iBin, fitLandau->GetParError(2));
872 }
873 if(chi2) {
874 chi2->SetBinContent(iBin, (fitLandau->GetNDF()>0 ? fitLandau->GetChisquare()/Double_t(fitLandau->GetNDF()) : 0.0));
875 }
876 }
877 else{
878 hProjection->SetBinContent(iBin, 0);
879 hProjection->SetBinError(iBin, 0);
880 }
881 }
882 return hProjection;
883}
884
885//____________________________________________________________________
886TH2F* AliTRDcheckESD::Proj3D(TH3* hist, TH2* accMap, Int_t zbinLow, Int_t zbinHigh, Float_t &entries) {
887 //
888 // Project a 3D histogram to a 2D histogram in the Z axis interval [zbinLow,zbinHigh]
889 // Return the 2D histogram and also the number of entries into this projection (entries)
890
891 Int_t nBinsX = hist->GetXaxis()->GetNbins(); // X and Y axis bins are assumed to be all equal
892 Float_t minX = hist->GetXaxis()->GetXmin();
893 Float_t maxX = hist->GetXaxis()->GetXmax();
894 Int_t nBinsY = hist->GetYaxis()->GetNbins();
895 Float_t minY = hist->GetYaxis()->GetXmin();
896 Float_t maxY = hist->GetYaxis()->GetXmax();
897 Int_t nBinsZ = hist->GetZaxis()->GetNbins(); // Z axis bins (pt) might have different widths
898
899 TH2F* projHisto = (TH2F*)gROOT->FindObject("projHisto");
900 if(projHisto)
901 projHisto->Reset();
902 else
903 projHisto = new TH2F("projHisto", "projection", nBinsX, minX, maxX, nBinsY, minY, maxY);
904
905 for(Int_t iZ=1; iZ<=nBinsZ; iZ++) {
906 if(iZ<zbinLow) continue;
907 if(iZ>zbinHigh) continue;
908 for(Int_t iX=1; iX<=nBinsX; iX++) {
909 for(Int_t iY=1; iY<=nBinsY; iY++) {
910 if(accMap) {
911 if(accMap->GetBinContent(iX,iY)>0.1)
912 projHisto->SetBinContent(iX, iY, projHisto->GetBinContent(iX, iY)+hist->GetBinContent(iX,iY,iZ));
913 }
914 else // no acc. cut
915 projHisto->SetBinContent(iX, iY, projHisto->GetBinContent(iX, iY)+hist->GetBinContent(iX,iY,iZ));
916 // count only the entries which are inside the acceptance map
917 if(accMap) {
918 if(accMap->GetBinContent(iX,iY)>0.1)
919 entries+=hist->GetBinContent(iX,iY,iZ);
920 }
921 else // no acc. cut
922 entries+=hist->GetBinContent(iX,iY,iZ);
923 }
924 }
925 }
926 return projHisto;
927}
928
929//____________________________________________________________________
930void AliTRDcheckESD::CheckActiveSM(TH1D* phiProj, Bool_t activeSM[18]) {
931 //
932 // Check the active super-modules
933 //
934 Double_t entries[18] = {0.0};
935 Double_t smPhiLimits[19];
936 for(Int_t ism=0; ism<=18; ++ism) smPhiLimits[ism] = -TMath::Pi() + (2.0*TMath::Pi()/18.0)*ism;
937 for(Int_t phiBin=1; phiBin<=phiProj->GetXaxis()->GetNbins(); ++phiBin) {
938 Double_t phi = phiProj->GetBinCenter(phiBin);
939 Int_t sm = -1;
940 for(Int_t ism=0; ism<18; ++ism)
941 if(phi>=smPhiLimits[ism] && phi<smPhiLimits[ism+1]) sm = ism;
942 if(sm==-1) continue;
943 entries[sm] += phiProj->GetBinContent(phiBin);
944 }
945 Double_t avEntries = Double_t(phiProj->Integral())/18.0;
946 for(Int_t ism=0; ism<18; ++ism)
947 if(entries[ism]>0.5*avEntries) activeSM[ism] = kTRUE;
948}
949
950
951//__________________________________________________________________________________________________
952TH1F* AliTRDcheckESD::EfficiencyFromPhiPt(AliCFContainer* cf, Int_t minNtrkl, Int_t maxNtrkl,
953 Int_t stepNom, Int_t stepDenom, Int_t var) {
954 //
c2c78193 955 // Use the CF container to extract the efficiency vs pt (other variables beside pt also posible)
69656036
AB
956 //
957 Int_t varTrackPhi = cf->GetVar(fgkVarNames[kTrackPhiTRD]);
c2c78193 958 Int_t otherVar = cf->GetVar(fgkVarNames[var]);
959 Int_t trdStepNumber = cf->GetStep(fgkStepNames[kTRD]);
960 Int_t tpcStepNumber = cf->GetStep(fgkStepNames[kTPCreference]);
961
962 TH1D* phiProj = (TH1D*)cf->Project(trdStepNumber, varTrackPhi);
69656036
AB
963 Bool_t activeSM[18] = {kFALSE};
964 CheckActiveSM(phiProj, activeSM); delete phiProj;
965 Double_t smPhiLimits[19];
966 for(Int_t ism=0; ism<=18; ++ism) smPhiLimits[ism] = -TMath::Pi() + (2.0*TMath::Pi()/18.0)*ism;
967
c2c78193 968 TH2D* hNomPhiVar=0x0;
969 TH2D* hDenomPhiVar=0x0;
69656036 970
c2c78193 971 if((stepNom!=tpcStepNumber) &&
972 (minNtrkl>-1 && minNtrkl<7 && maxNtrkl>-1 && maxNtrkl<7)) {
973 cf->SetRangeUser(cf->GetVar(fgkVarNames[kTrackTrdTracklets]), Double_t(minNtrkl), Double_t(maxNtrkl));
974 hNomPhiVar = (TH2D*)cf->Project(stepNom, otherVar, varTrackPhi);
69656036 975 cf->SetRangeUser(cf->GetVar(fgkVarNames[kTrackTrdTracklets]), 0.0,6.0);
c2c78193 976 }
977 else
978 hNomPhiVar = (TH2D*)cf->Project(stepNom, otherVar, varTrackPhi);
979 if((stepDenom!=tpcStepNumber) &&
980 (minNtrkl>-1 && minNtrkl<7 && maxNtrkl>-1 && maxNtrkl<7)) {
981 cf->SetRangeUser(cf->GetVar(fgkVarNames[kTrackTrdTracklets]), Double_t(minNtrkl), Double_t(maxNtrkl));
982 hDenomPhiVar = (TH2D*)cf->Project(stepDenom, otherVar, varTrackPhi);
983 cf->SetRangeUser(cf->GetVar(fgkVarNames[kTrackTrdTracklets]), 0.0,6.0);
984 }
985 else
986 hDenomPhiVar = (TH2D*)cf->Project(stepDenom, otherVar, varTrackPhi);
987
69656036
AB
988 TH1F* hEff = new TH1F(Form("hEff%s_%d_%d_%f", fgkVarNames[var], stepNom, stepDenom, gRandom->Rndm()), "",
989 hNomPhiVar->GetXaxis()->GetNbins(), hNomPhiVar->GetXaxis()->GetXbins()->GetArray());
990 for(Int_t ib=1;ib<=hNomPhiVar->GetXaxis()->GetNbins();++ib)
991 hEff->GetXaxis()->SetBinLabel(ib, hNomPhiVar->GetXaxis()->GetBinLabel(ib));
992
993 for(Int_t ivar=1; ivar<=hEff->GetXaxis()->GetNbins(); ++ivar) {
994 Double_t nom = 0.0; Double_t denom = 0.0;
995 Double_t eff = 0.0; Double_t err = 0.0;
996 for(Int_t iphi=1; iphi<=hNomPhiVar->GetYaxis()->GetNbins(); ++iphi) {
997 Double_t phi = hNomPhiVar->GetYaxis()->GetBinCenter(iphi);
998 Bool_t isActive = kFALSE;
999 for(Int_t ism=0; ism<18; ++ism)
1000 if(phi>=smPhiLimits[ism] && phi<smPhiLimits[ism+1] && activeSM[ism])
1001 isActive = kTRUE;
1002 if(!isActive) continue;
1003 nom += hNomPhiVar->GetBinContent(ivar, iphi);
1004 denom += hDenomPhiVar->GetBinContent(ivar, iphi);
1005 }
1006 eff = (denom>0.001 ? nom/denom : 0.0);
1007 err = (denom>0.001 && (denom-nom)>0.001 && nom>0.001 ? (TMath::Sqrt(nom*(denom-nom)/denom/denom/denom)) : 0.0);
1008 hEff->SetBinContent(ivar, eff);
1009 hEff->SetBinError(ivar, err);
1010 } // end loop over pt bins
1011 delete hNomPhiVar; delete hDenomPhiVar;
1012 return hEff;
1013}
1014
1015
1016//____________________________________________________________________
1017TH1F* AliTRDcheckESD::EfficiencyTRD(TH3* tpc3D, TH3* trd3D, Bool_t useAcceptance) {
1018 //
1019 // Calculate the TRD-TPC matching efficiency as function of pt
1020 //
1021
1022 if(!tpc3D || !trd3D) return NULL;
1023 Int_t nBinsZ = trd3D->GetZaxis()->GetNbins();
1024 // project everything on the eta-phi map to obtain an acceptance map
1025 Float_t nada = 0.;
1026 TH2F *trdAcc = (useAcceptance ? (TH2F*)Proj3D(trd3D, 0x0, 1, nBinsZ, nada)->Clone(Form("trdAcc%f", gRandom->Rndm())) : 0x0);
1027 TH1D *phiProj = (trdAcc ? trdAcc->ProjectionY(Form("phiProj%f", gRandom->Rndm())) : 0x0);
1028
1029 // prepare the acceptance map
1030 Bool_t activeSM[18] = {kFALSE};
1031 Double_t smPhiLimits[19];
1032 for(Int_t ism=0; ism<=18; ++ism) smPhiLimits[ism] = -TMath::Pi() + (2.0*TMath::Pi()/18.0)*ism;
1033 if(phiProj) {
1034 CheckActiveSM(phiProj, activeSM); // get the active SMs
1035 trdAcc->Reset();
1036 // Put 1 entry in every bin which belongs to an active SM
1037 for(Int_t iY=1; iY<=trdAcc->GetYaxis()->GetNbins(); ++iY) {
1038 Double_t phi = trdAcc->GetYaxis()->GetBinCenter(iY);
1039 Bool_t isActive = kFALSE;
1040 for(Int_t ism=0; ism<18; ++ism) {
1041 if(phi>=smPhiLimits[ism] && phi<smPhiLimits[ism+1] && activeSM[ism]) {
1042 isActive = kTRUE;
1043 }
1044 }
1045 if(!isActive) continue;
1046 for(Int_t iX=1; iX<=trdAcc->GetXaxis()->GetNbins(); ++iX)
1047 if(trdAcc->GetXaxis()->GetBinCenter(iX)>=-0.85 && trdAcc->GetXaxis()->GetBinCenter(iX)<=0.85) trdAcc->SetBinContent(iX, iY, 1.0);
1048 } // end for over Y(phi) bins
1049 } // end if phiProj
1050
1051 // get the bin limits from the Z axis of 3D histos
1052 Float_t *ptBinLimits = new Float_t[nBinsZ+1];
1053 for(Int_t i=1; i<=nBinsZ; i++) {
1054 ptBinLimits[i-1] = trd3D->GetZaxis()->GetBinLowEdge(i);
1055 }
1056 ptBinLimits[nBinsZ] = trd3D->GetZaxis()->GetBinUpEdge(nBinsZ);
1057
1058 TH1F *efficiency = new TH1F(Form("eff%d", Int_t(1000000.0*gRandom->Rndm())), "TRD-TPC matching efficiency", nBinsZ, ptBinLimits);
1059
1060 // loop over Z bins
1061 Bool_t effGood = kFALSE;
1062 for(Int_t i=1; i<=nBinsZ; i++) {
1063 Float_t tpcEntries = 0.0; Float_t trdEntries = 0.0;
1064 Proj3D(tpc3D, trdAcc, i, i, tpcEntries);
1065 Proj3D(trd3D, trdAcc, i, i, trdEntries);
1066 Float_t ratio = 0;
1067 if(tpcEntries>0) ratio = trdEntries/tpcEntries;
1068 Float_t error = 0;
1069 if(tpcEntries>0 && trdEntries>0 && (tpcEntries-trdEntries)>=0.0)
1070 error = TMath::Sqrt(trdEntries*(tpcEntries-trdEntries)/tpcEntries/tpcEntries/tpcEntries);
1071 if(ratio>0.001) {
1072 efficiency->SetBinContent(i,ratio);
1073 efficiency->SetBinError(i,error);
1074 effGood = kTRUE;
1075 }
1076 } // end loop over Z bins
1077 if(!effGood) return 0x0;
1078
1079 return efficiency;
1080}
1081
1082
1083//__________________________________________________________________________________________________
1084void AliTRDcheckESD::PlotCentSummaryFromCF(Double_t* /*trendValues*/, const Char_t* /*triggerName*/, Bool_t /*useIsolatedBC*/, Bool_t /*cutTOFbc*/) {
1085 //
1086 // Make the centrality summary figure from the CF container
1087 //
1088 if(!fHistos) return;
1089 AliCFContainer* matchPt=(AliCFContainer*)fHistos->FindObject("MatchingPt");
1090 if(!matchPt) return;
1091 AliCFContainer* centCF=(AliCFContainer*)fHistos->FindObject("CentralityCF");
1092 if(!centCF) return;
c2c78193 1093 AliCFContainer* clustersCF=(AliCFContainer*)fHistos->FindObject("ClustersCF");
1094 if(!clustersCF) return;
69656036
AB
1095
1096 TLatex* lat=new TLatex();
1097 lat->SetTextSize(0.06);
1098 lat->SetTextColor(2);
1099
1100 gPad->SetTopMargin(0.05); gPad->SetBottomMargin(0.001); gPad->SetLeftMargin(0.001); gPad->SetRightMargin(0.001);
1101 gPad->Divide(3,3,0.,0.);
1102 TList* l=gPad->GetListOfPrimitives();
1103 TVirtualPad* pad=0x0;
1104
1105 if(gROOT->FindObject("rangeEffPt")) delete gROOT->FindObject("rangeEffPt");
1106 TH2F* rangeEffPt=new TH2F("rangeEffPt", "",10,0.,10.,10,0.,1.3);
1107 rangeEffPt->SetStats(kFALSE);
1108 SetStyle(rangeEffPt->GetXaxis(), "p_{T} [GeV/c]", 0.07, 0.8, kTRUE, 0.05);
1109 SetStyle(rangeEffPt->GetYaxis(), "efficiency", 0.07, 0.8, kTRUE, 0.05);
1110
1111 Int_t padsForEffs[5] = {0,3,6,1,4};
1112 for(Int_t iCent=1; iCent<6; ++iCent) {
1113 pad = ((TVirtualPad*)l->At(padsForEffs[iCent-1])); pad->cd();
1114 pad->SetLeftMargin(0.15); pad->SetRightMargin(0.02); pad->SetTopMargin(0.1); pad->SetBottomMargin(0.15);
1115 pad->SetGridx(kFALSE); pad->SetGridy(kFALSE);
1116 rangeEffPt->Draw();
1117 TLine line;
1118 line.SetLineStyle(2);
1119 line.SetLineWidth(2);
1120 line.DrawLine(rangeEffPt->GetXaxis()->GetXmin(), 0.7, rangeEffPt->GetXaxis()->GetXmax(), 0.7);
1121 line.DrawLine(rangeEffPt->GetXaxis()->GetXmin(), 0.9, rangeEffPt->GetXaxis()->GetXmax(), 0.9);
1122
1123 matchPt->SetRangeUser(matchPt->GetVar(fgkVarNames[kEventMult]), Double_t(iCent), Double_t(iCent), kTRUE);
1124
1125 matchPt->SetRangeUser(matchPt->GetVar(fgkVarNames[kTrackCharge]), +1.0, +1.0);
1126 TH1F* hEffPosAll = EfficiencyFromPhiPt(matchPt, 0, 6, 1, 0);
1127 TH1F* hEffPosTrk4 = EfficiencyFromPhiPt(matchPt, 4, 4, 1, 0);
1128 TH1F* hEffPosTrk5 = EfficiencyFromPhiPt(matchPt, 5, 5, 1, 0);
1129 TH1F* hEffPosTrk6 = EfficiencyFromPhiPt(matchPt, 6, 6, 1, 0);
1130
1131 matchPt->SetRangeUser(matchPt->GetVar(fgkVarNames[kTrackCharge]), -1.0, -1.0);
1132 TH1F* hEffNegAll = EfficiencyFromPhiPt(matchPt, 0, 6, 1, 0);
1133 TH1F* hEffNegTrk4 = EfficiencyFromPhiPt(matchPt, 4, 4, 1, 0);
1134 TH1F* hEffNegTrk5 = EfficiencyFromPhiPt(matchPt, 5, 5, 1, 0);
1135 TH1F* hEffNegTrk6 = EfficiencyFromPhiPt(matchPt, 6, 6, 1, 0);
1136 matchPt->SetRangeUser(matchPt->GetVar(fgkVarNames[kTrackTrdTracklets]), 0.0, 6.0);
1137 matchPt->SetRangeUser(matchPt->GetVar(fgkVarNames[kTrackCharge]), -1.0, +1.0);
1138
1139 SetStyle(hEffPosAll, 1, kRed, 1, 24, kRed, 1);
1140 SetStyle(hEffPosTrk4, 1, kRed, 1, 25, kRed, 1);
1141 SetStyle(hEffPosTrk5, 1, kRed, 1, 26, kRed, 1);
1142 SetStyle(hEffPosTrk6, 1, kRed, 1, 27, kRed, 1);
1143 SetStyle(hEffNegAll, 1, kBlue, 1, 24, kBlue, 1);
1144 SetStyle(hEffNegTrk4, 1, kBlue, 1, 25, kBlue, 1);
1145 SetStyle(hEffNegTrk5, 1, kBlue, 1, 26, kBlue, 1);
1146 SetStyle(hEffNegTrk6, 1, kBlue, 1, 27, kBlue, 1);
1147 hEffPosAll->Draw("same");
1148 hEffNegAll->Draw("same");
1149 hEffPosTrk4->Draw("same");
1150 hEffNegTrk4->Draw("same");
1151 hEffPosTrk5->Draw("same");
1152 hEffNegTrk5->Draw("same");
1153 hEffPosTrk6->Draw("same");
1154 hEffNegTrk6->Draw("same");
1155
1156 TLegend* leg=new TLegend(0.18, 0.7, 0.77, 0.89);
1157 if(iCent==1) {
1158 leg->SetFillColor(0);
1159 leg->SetNColumns(2);
1160 leg->SetMargin(0.1);
1161 leg->SetBorderSize(0);
1162 leg->AddEntry(hEffPosAll, "pos. (#geq 1 tracklet)", "p");
1163 leg->AddEntry(hEffNegAll, "neg. (#geq 1 tracklet)", "p");
1164 leg->AddEntry(hEffPosTrk4, "pos. (4 tracklets)", "p");
1165 leg->AddEntry(hEffNegTrk4, "neg. (4 tracklets)", "p");
1166 leg->AddEntry(hEffPosTrk5, "pos. (5 tracklets)", "p");
1167 leg->AddEntry(hEffNegTrk5, "neg. (5 tracklets)", "p");
1168 leg->AddEntry(hEffPosTrk6, "pos. (6 tracklets)", "p");
1169 leg->AddEntry(hEffNegTrk6, "neg. (6 tracklets)", "p");
1170 leg->Draw();
1171 }
1172 lat->DrawLatex(0.2, 1.32, Form("%.0f < SPD tracklets < %.0f", matchPt->GetAxis(matchPt->GetVar(fgkVarNames[kEventMult]),0)->GetBinLowEdge(iCent), matchPt->GetAxis(matchPt->GetVar(fgkVarNames[kEventMult]),0)->GetBinUpEdge(iCent)));
1173 } // end for loop over multiplicity classes
1174
1175 // Reset the modified user ranges of the CF container
1176 matchPt->SetRangeUser(matchPt->GetVar(fgkVarNames[kEventMult]), 0., 3500.);
1177
1178 // Cluster distributions in all multiplicity classes
1179 pad = ((TVirtualPad*)l->At(2)); pad->cd();
1180 pad->SetLeftMargin(0.15); pad->SetRightMargin(0.02);
1181 pad->SetTopMargin(0.02); pad->SetBottomMargin(0.15);
1182 pad->SetGridx(kFALSE); pad->SetGridy(kFALSE);
1183 if(gROOT->FindObject("rangeNcls")) delete gROOT->FindObject("rangeNcls");
1184 TH2F* rangeNcls = new TH2F("rangeNcls", "", 10, 0.0, 199.9, 10, 0.0, 1.199);
1185 SetStyle(rangeNcls->GetXaxis(), "# TRD clusters", 0.07, 0.8, kTRUE, 0.05);
1186 SetStyle(rangeNcls->GetYaxis(), "entries (a.u.)", 0.07, 0.8, kTRUE, 0.05);
1187 rangeNcls->SetStats(kFALSE);
1188 rangeNcls->Draw();
1189
1190 TH1D* hNcls[6]={0x0};
1191 TLegend* legCls=new TLegend(0.7, 0.75, 0.97, 0.97);
1192 legCls->SetBorderSize(0);
1193 legCls->SetFillColor(0);
1194 legCls->SetMargin(0.15);
1195
1196 for(Int_t iCent=0; iCent<6; ++iCent) {
1197 if(iCent>0)
c2c78193 1198 clustersCF->SetRangeUser(clustersCF->GetVar(fgkVarNames[kEventMult]), Double_t(iCent), Double_t(iCent), kTRUE);
1199 hNcls[iCent] = (TH1D*)clustersCF->Project(0, clustersCF->GetVar(fgkVarNames[kTrackTrdClusters]));
69656036
AB
1200 if(!hNcls[iCent]) continue;
1201
1202 hNcls[iCent]->SetLineColor(iCent<4 ? iCent+1 : iCent+2);
1203 Double_t maximum = hNcls[iCent]->GetMaximum();
1204 if(maximum>1.0)
1205 hNcls[iCent]->Scale(1.0/maximum);
1206 hNcls[iCent]->SetStats(kFALSE);
1207 hNcls[iCent]->SetTitle("");
1208 hNcls[iCent]->SetLineWidth(2);
1209
1210 if(hNcls[iCent]->Integral()>0.01) {
1211 hNcls[iCent]->Draw("same");
c2c78193 1212 legCls->AddEntry(hNcls[iCent], (iCent==0 ? "all centralities" : Form("%.0f < SPD tracklets < %.0f", clustersCF->GetAxis(clustersCF->GetVar(fgkVarNames[kEventMult]),0)->GetBinLowEdge(iCent),
1213 clustersCF->GetAxis(clustersCF->GetVar(fgkVarNames[kEventMult]),0)->GetBinUpEdge(iCent))), "l");
69656036
AB
1214 }
1215 }
1216 legCls->Draw();
c2c78193 1217 clustersCF->SetRangeUser(clustersCF->GetVar(fgkVarNames[kEventMult]), 0.0, 6.0, kTRUE);
69656036 1218
098f177f 1219 // Qtot distributions
69656036
AB
1220 pad = ((TVirtualPad*)l->At(5)); pad->cd();
1221 pad->SetLeftMargin(0.15); pad->SetRightMargin(0.02);
1222 pad->SetTopMargin(0.02); pad->SetBottomMargin(0.15);
1223 pad->SetGridx(kFALSE); pad->SetGridy(kFALSE);
1224 if(gROOT->FindObject("rangeQtot")) delete gROOT->FindObject("rangeQtot");
1225 TH2F* rangeQtot = new TH2F("rangeQtot", "", 10, 0.0, 9.999, 10, 0.0, 1.199);
1226 SetStyle(rangeQtot->GetXaxis(), "Q_{tot} (a.u.)", 0.07, 0.8, kTRUE, 0.05);
1227 SetStyle(rangeQtot->GetYaxis(), "entries (a.u.)", 0.07, 0.8, kTRUE, 0.05);
1228 rangeQtot->SetStats(kFALSE);
1229 rangeQtot->Draw();
1230
098f177f 1231 TH1D* hQtot[6+1]={0x0};
69656036
AB
1232 TLegend* leg2=new TLegend(0.6, 0.7, 0.9, 0.97);
1233 leg2->SetFillColor(0);
1234 leg2->SetBorderSize(0);
1235
1236 for(Int_t iCent=0; iCent<6; ++iCent) {
1237 if(iCent>0)
1238 centCF->SetRangeUser(centCF->GetVar(fgkVarNames[kEventMult]), Double_t(iCent), Double_t(iCent), kTRUE);
1239
1240 hQtot[iCent] = (TH1D*)centCF->Project(0, centCF->GetVar(fgkVarNames[kTrackletQtot]));
1241 if(!hQtot[iCent]) continue;
1242 hQtot[iCent]->SetBinContent(1, 0);
1243
1244 Double_t maximum = hQtot[iCent]->GetMaximum();
1245 if(maximum>1.0)
1246 hQtot[iCent]->Scale(1.0/maximum);
1247 hQtot[iCent]->SetLineColor(iCent<4 ? iCent+1 : iCent+2);
1248 hQtot[iCent]->SetStats(kFALSE);
1249 hQtot[iCent]->SetTitle("");
1250 hQtot[iCent]->SetLineWidth(2);
1251 if(hQtot[iCent]->Integral()>0.01) {
1252 hQtot[iCent]->Draw(iCent==0 ? "" : "same");
1253 leg2->AddEntry(hQtot[iCent], (iCent==0 ? "all centralities" : Form("%.0f < SPD tracklets < %.0f", centCF->GetAxis(centCF->GetVar(fgkVarNames[kEventMult]),0)->GetBinLowEdge(iCent),
1254 centCF->GetAxis(centCF->GetVar(fgkVarNames[kEventMult]),0)->GetBinUpEdge(iCent))), "l");
1255 }
1256 }
1257 leg2->Draw();
1258 centCF->SetRangeUser(centCF->GetVar(fgkVarNames[kEventMult]), 0.0, 5.0, kTRUE);
1259}
1260
1261
1262
1263//_________________________________________________________________
1264void AliTRDcheckESD::PlotTrackingSummaryFromCF(Double_t* trendValues, const Char_t* /*triggerName*/, Bool_t /*useIsolatedBC*/, Bool_t /*cutTOFbc*/) {
1265 //
1266 // Plot tracking summary
1267 //
c2c78193 1268 // trendValues will be filled with trending variables
1269 // trendValues[0] : TPC-TRD matching efficiency for positive tracks in the range 1.0<pt<3.0 GeV/c
1270 // trendValues[1] : statistical error of trendValues[0]
1271 // trendValues[2] : TPC-TRD matching efficiency for negative tracks in the range 1.0<pt<3.0 GeV/c
1272 // trendValues[3] : statistical error of trendValues[2]
1273 // trendValues[4] : TRD-TOF matching efficiency for positive tracks in the range 1.0<pt<3.0 GeV/c
1274 // trendValues[5] : statistical error of trendValues[4]
1275 // trendValues[6] : TRD-TOF matching efficiency for negative tracks in the range 1.0<pt<3.0 GeV/c
1276 // trendValues[7] : statistical error of trendValues[6]
1277 // trendValues[8] : Average number of TRD tracklets per track in the range 1.0<pt<3.0 GeV/c
1278 // trendValues[9] : statistical error of trendValues[8]
1279 // trendValues[10]: Average number of TRD clusters per track in the range 1.0<p<3.0 GeV/c
1280 // trendValues[11]: statistical error of trendValues[10]
1281 //
69656036
AB
1282 if(!fHistos) return;
1283 AliCFContainer* matchPhiEta=(AliCFContainer*)fHistos->FindObject("MatchingPhiEta");
1284 if(!matchPhiEta) return;
1285 AliCFContainer* matchPt=(AliCFContainer*)fHistos->FindObject("MatchingPt");
1286 if(!matchPt) return;
c2c78193 1287 AliCFContainer* clustersCF=(AliCFContainer*)fHistos->FindObject("ClustersCF");
69656036
AB
1288 if(!clustersCF) return;
1289 AliCFContainer* bcCF=(AliCFContainer*)fHistos->FindObject("BunchCrossingsCF");
1290 if(!bcCF) return;
1291
1292 TLatex *lat=new TLatex();
1293 lat->SetTextSize(0.06);
1294 lat->SetTextColor(2);
1295 lat->SetTextFont(42);
1296
1297 gPad->SetTopMargin(0.05); gPad->SetBottomMargin(0.001);
1298 gPad->SetLeftMargin(0.001); gPad->SetRightMargin(0.001);
1299 gPad->Divide(3,3,0.,0.);
1300 TList* l=gPad->GetListOfPrimitives();
1301
1302 // eta-phi distr. for positive TPC tracks
1303 TVirtualPad* pad = ((TVirtualPad*)l->At(0)); pad->cd();
1304 pad->SetLeftMargin(0.15); pad->SetRightMargin(0.1);
1305 pad->SetTopMargin(0.1); pad->SetBottomMargin(0.15);
1306 pad->SetGridx(kFALSE); pad->SetGridy(kFALSE);
1307
1308 TH2D* hTPCrefPos = 0x0; TH2D* hTRDrefPos = 0x0; TH2D* hTOFrefPos = 0x0;
1309 TH2D* hTPCrefNeg = 0x0; TH2D* hTRDrefNeg = 0x0; TH2D* hTOFrefNeg = 0x0;
1310 matchPhiEta->SetRangeUser(matchPhiEta->GetVar(fgkVarNames[kTrackTrdTracklets]), 0.0, 6.0);
1311 matchPhiEta->SetRangeUser(matchPhiEta->GetVar(fgkVarNames[kTrackCharge]), +1.0, +1.0); // positive charges
1312 hTPCrefPos = (TH2D*)matchPhiEta->Project(0, matchPhiEta->GetVar(fgkVarNames[kTrackEtaTRD]), matchPhiEta->GetVar(fgkVarNames[kTrackPhiTRD]));
1313 hTRDrefPos = (TH2D*)matchPhiEta->Project(1, matchPhiEta->GetVar(fgkVarNames[kTrackEtaTRD]), matchPhiEta->GetVar(fgkVarNames[kTrackPhiTRD]));
1314 hTOFrefPos = (TH2D*)matchPhiEta->Project(2, matchPhiEta->GetVar(fgkVarNames[kTrackEtaTRD]), matchPhiEta->GetVar(fgkVarNames[kTrackPhiTRD]));
1315 matchPhiEta->SetRangeUser(matchPhiEta->GetVar(fgkVarNames[kTrackCharge]), -1.0, -1.0); // negative charges
1316 hTPCrefNeg = (TH2D*)matchPhiEta->Project(0, matchPhiEta->GetVar(fgkVarNames[kTrackEtaTRD]), matchPhiEta->GetVar(fgkVarNames[kTrackPhiTRD]));
1317 hTRDrefNeg = (TH2D*)matchPhiEta->Project(1, matchPhiEta->GetVar(fgkVarNames[kTrackEtaTRD]), matchPhiEta->GetVar(fgkVarNames[kTrackPhiTRD]));
1318 hTOFrefNeg = (TH2D*)matchPhiEta->Project(2, matchPhiEta->GetVar(fgkVarNames[kTrackEtaTRD]), matchPhiEta->GetVar(fgkVarNames[kTrackPhiTRD]));
1319 matchPhiEta->SetRangeUser(matchPhiEta->GetVar(fgkVarNames[kTrackCharge]), -1.0, +1.0); // reset charge cut
1320
1321 if(gROOT->FindObject("rangeEtaPhi")) delete gROOT->FindObject("rangeEtaPhi");
1322 TH2F* rangeEtaPhi = new TH2F("rangeEtaPhi", "", 10, -0.99, +0.99, 10, -3.15, 3.15);
1323 SetStyle(rangeEtaPhi->GetXaxis(), "#eta", 0.07, 0.8, kTRUE, 0.05);
1324 SetStyle(rangeEtaPhi->GetYaxis(), "detector #varphi", 0.07, 0.8, kTRUE, 0.05);
1325 rangeEtaPhi->SetStats(kFALSE);
1326
1327 //----------------------------------------------
1328 // eta-phi efficiency for positive TRD tracks
1329 pad = ((TVirtualPad*)l->At(0)); pad->cd();
1330 pad->SetLeftMargin(0.15); pad->SetRightMargin(0.1);
1331 pad->SetTopMargin(0.1); pad->SetBottomMargin(0.15);
1332 pad->SetGridx(kFALSE); pad->SetGridy(kFALSE);
1333 rangeEtaPhi->Draw();
1334
1335 TH2D* hTRDeffPos = (hTRDrefPos ? (TH2D*)hTRDrefPos->Clone("hTRDeffPos") : 0x0);
1336 if(hTRDeffPos) {
1337 hTRDeffPos->Reset();
1338 hTRDeffPos->SetStats(kFALSE);
1339 hTRDeffPos->Divide(hTRDrefPos, hTPCrefPos);
1340 hTRDeffPos->SetMaximum(1.0);
1341 hTRDeffPos->Draw("samecolz");
1342 lat->DrawLatex(-0.9, 3.3, "TPC-TRD matching for positive tracks");
1343 DrawTRDGrid();
1344 }
1345
1346 //----------------------------------------------
1347 // eta-phi efficiency for negative TRD tracks
1348 pad = ((TVirtualPad*)l->At(3)); pad->cd();
1349 pad->SetLeftMargin(0.15); pad->SetRightMargin(0.1);
1350 pad->SetTopMargin(0.1); pad->SetBottomMargin(0.15);
1351 pad->SetGridx(kFALSE); pad->SetGridy(kFALSE);
1352 rangeEtaPhi->Draw();
1353
1354 TH2D* hTRDeffNeg = (hTRDrefNeg ? (TH2D*)hTRDrefNeg->Clone("hTRDeffNeg") : 0x0);
1355 if(hTRDeffNeg) {
1356 hTRDeffNeg->Reset();
1357 hTRDeffNeg->SetStats(kFALSE);
1358 hTRDeffNeg->Divide(hTRDrefNeg, hTPCrefNeg);
1359 hTRDeffNeg->SetMaximum(1.0);
1360 hTRDeffNeg->Draw("samecolz");
1361 lat->DrawLatex(-0.9, 3.3, "TPC-TRD matching for negative tracks");
1362 DrawTRDGrid();
1363 }
1364
1365 //----------------------------------------------
1366 // eta-phi TRD-TOF matching efficiency for positive tracks
1367 pad = ((TVirtualPad*)l->At(1)); pad->cd();
1368 pad->SetLeftMargin(0.15); pad->SetRightMargin(0.1);
1369 pad->SetTopMargin(0.1); pad->SetBottomMargin(0.15);
1370 pad->SetGridx(kFALSE); pad->SetGridy(kFALSE);
1371 rangeEtaPhi->Draw();
1372
1373 TH2D* hTOFeffPos = (hTOFrefPos ? (TH2D*)hTOFrefPos->Clone("hTOFeffPos") : 0x0);
1374 if(hTOFeffPos) {
1375 hTOFeffPos->Reset();
1376 hTOFeffPos->SetStats(kFALSE);
1377 hTOFeffPos->Divide(hTOFrefPos, hTRDrefPos);
1378 hTOFeffPos->SetMaximum(1.0);
1379 hTOFeffPos->Draw("samecolz");
1380 lat->DrawLatex(-0.9, 3.3, "TRD-TOF matching for positive tracks");
1381 DrawTRDGrid();
1382 }
1383
1384 //----------------------------------------------
1385 // eta-phi TRD-TOF matching efficiency for negative tracks
1386 pad = ((TVirtualPad*)l->At(4)); pad->cd();
1387 pad->SetLeftMargin(0.15); pad->SetRightMargin(0.1);
1388 pad->SetTopMargin(0.1); pad->SetBottomMargin(0.15);
1389 pad->SetGridx(kFALSE); pad->SetGridy(kFALSE);
1390 rangeEtaPhi->Draw();
1391
1392 TH2D* hTOFeffNeg = (hTOFrefNeg ? (TH2D*)hTOFrefNeg->Clone("hTOFeffNeg") : 0x0);
1393 if(hTOFeffNeg) {
1394 hTOFeffNeg->Reset();
1395 hTOFeffNeg->SetStats(kFALSE);
1396 hTOFeffNeg->Divide(hTOFrefNeg, hTRDrefNeg);
1397 hTOFeffNeg->SetMaximum(1.0);
1398 hTOFeffNeg->Draw("samecolz");
1399 lat->DrawLatex(-0.9, 3.3, "TRD-TOF matching for negative tracks");
1400 DrawTRDGrid();
1401 }
1402
1403 if(hTRDrefPos) delete hTRDrefPos; if(hTPCrefPos) delete hTPCrefPos; if(hTOFrefPos) delete hTOFrefPos;
1404 if(hTRDrefNeg) delete hTRDrefNeg; if(hTPCrefNeg) delete hTPCrefNeg; if(hTOFrefNeg) delete hTOFrefNeg;
1405
1406 // switch to the Pt cf container
1407 matchPt->SetRangeUser(matchPt->GetVar(fgkVarNames[kTrackCharge]), +1.0, +1.0);
1408 TH1F* hTRDEffPtPosAll = EfficiencyFromPhiPt(matchPt, 0, 6, 1, 0);
1409 TH1F* hTOFEffPtPosAll = EfficiencyFromPhiPt(matchPt, 0, 6, 2, 1);
1410 TH1F* hTRDEffPtPosTrk4 = EfficiencyFromPhiPt(matchPt, 4, 4, 1, 0);
1411 TH1F* hTOFEffPtPosTrk4 = EfficiencyFromPhiPt(matchPt, 4, 4, 2, 1);
1412 TH1F* hTRDEffPtPosTrk5 = EfficiencyFromPhiPt(matchPt, 5, 5, 1, 0);
1413 TH1F* hTOFEffPtPosTrk5 = EfficiencyFromPhiPt(matchPt, 5, 5, 2, 1);
1414 TH1F* hTRDEffPtPosTrk6 = EfficiencyFromPhiPt(matchPt, 6, 6, 1, 0);
1415 TH1F* hTOFEffPtPosTrk6 = EfficiencyFromPhiPt(matchPt, 6, 6, 2, 1);
1416
1417 matchPt->SetRangeUser(matchPt->GetVar(fgkVarNames[kTrackCharge]), -1.0, -1.0);
1418 TH1F* hTRDEffPtNegAll = EfficiencyFromPhiPt(matchPt, 0, 6, 1, 0);
1419 TH1F* hTOFEffPtNegAll = EfficiencyFromPhiPt(matchPt, 0, 6, 2, 1);
1420 TH1F* hTRDEffPtNegTrk4 = EfficiencyFromPhiPt(matchPt, 4, 4, 1, 0);
1421 TH1F* hTOFEffPtNegTrk4 = EfficiencyFromPhiPt(matchPt, 4, 4, 2, 1);
1422 TH1F* hTRDEffPtNegTrk5 = EfficiencyFromPhiPt(matchPt, 5, 5, 1, 0);
1423 TH1F* hTOFEffPtNegTrk5 = EfficiencyFromPhiPt(matchPt, 5, 5, 2, 1);
1424 TH1F* hTRDEffPtNegTrk6 = EfficiencyFromPhiPt(matchPt, 6, 6, 1, 0);
1425 TH1F* hTOFEffPtNegTrk6 = EfficiencyFromPhiPt(matchPt, 6, 6, 2, 1);
1426 matchPt->SetRangeUser(matchPt->GetVar(fgkVarNames[kTrackCharge]), -1.0, +1.0);
1427
c2c78193 1428
69656036
AB
1429 TF1* funcConst = new TF1("constFunc", "[0]", 1.0, 3.0);
1430 if(trendValues) {
1431 if(hTRDEffPtPosAll && hTRDEffPtPosAll->Integral()>0.1) {
1432 hTRDEffPtPosAll->Fit(funcConst, "Q0ME", "goff", 1.0, 3.0);
1433 trendValues[0] = funcConst->GetParameter(0);
1434 trendValues[1] = funcConst->GetParError(0);
1435 }
1436 }
1437 if(trendValues) {
1438 if(hTRDEffPtNegAll && hTRDEffPtNegAll->Integral()>0.1) {
1439 hTRDEffPtNegAll->Fit(funcConst, "Q0ME", "goff", 1.0, 3.0);
1440 trendValues[2] = funcConst->GetParameter(0);
1441 trendValues[3] = funcConst->GetParError(0);
1442 }
1443 }
1444 if(trendValues) {
1445 if(hTOFEffPtPosAll && hTOFEffPtPosAll->Integral()>0.1) {
1446 hTOFEffPtPosAll->Fit(funcConst, "Q0ME", "goff", 1.0, 3.0);
1447 trendValues[4] = funcConst->GetParameter(0);
1448 trendValues[5] = funcConst->GetParError(0);
1449 }
1450 }
1451 if(trendValues) {
1452 if(hTOFEffPtNegAll && hTOFEffPtNegAll->Integral()>0.1) {
1453 hTOFEffPtNegAll->Fit(funcConst, "Q0ME", "goff", 1.0, 3.0);
1454 trendValues[6] = funcConst->GetParameter(0);
1455 trendValues[7] = funcConst->GetParError(0);
1456 }
1457 }
1458
1459 //---------------------------------------------------------
1460 // TPC-TRD matching efficiency vs pt
1461 pad = ((TVirtualPad*)l->At(6)); pad->cd();
1462 pad->SetLeftMargin(0.15); pad->SetRightMargin(0.02);
1463 pad->SetTopMargin(0.1); pad->SetBottomMargin(0.15);
1464 pad->SetGridx(kFALSE); pad->SetGridy(kFALSE);
1465
1466 if(gROOT->FindObject("rangeEffPt2")) delete gROOT->FindObject("rangeEffPt2");
1467 TH2F* rangeEffPt=new TH2F("rangeEffPt2", "",10,0.,10.,10,0.,1.4);
1468 rangeEffPt->SetStats(kFALSE);
1469 SetStyle(rangeEffPt->GetXaxis(), "p_{T} [GeV/c]", 0.07, 0.8, kTRUE, 0.05);
1470 SetStyle(rangeEffPt->GetYaxis(), "efficiency", 0.07, 0.8, kTRUE, 0.05);
1471 rangeEffPt->Draw();
1472 lat->DrawLatex(0.2, 1.44, "TPC-TRD matching efficiency");
1473 //++++++++++++++++++
1474 TLine line;
1475 line.SetLineStyle(2);
1476 line.SetLineWidth(2);
1477 line.DrawLine(rangeEffPt->GetXaxis()->GetXmin(), 0.7, rangeEffPt->GetXaxis()->GetXmax(), 0.7);
1478 line.DrawLine(rangeEffPt->GetXaxis()->GetXmin(), 0.9, rangeEffPt->GetXaxis()->GetXmax(), 0.9);
1479 TLegend* leg=new TLegend(0.2, 0.7, 0.7, 0.89);
1480 leg->SetNColumns(2);
1481 leg->SetMargin(0.15);
1482 leg->SetBorderSize(0);
1483 leg->SetFillColor(0);
1484
1485 SetStyle(hTRDEffPtPosAll, 1, kRed, 1, 24, kRed, 1);
1486 SetStyle(hTRDEffPtNegAll, 1, kBlue, 1, 24, kBlue, 1);
1487 SetStyle(hTRDEffPtPosTrk4, 1, kRed, 1, 25, kRed, 1);
1488 SetStyle(hTRDEffPtNegTrk4, 1, kBlue, 1, 25, kBlue, 1);
1489 SetStyle(hTRDEffPtPosTrk5, 1, kRed, 1, 26, kRed, 1);
1490 SetStyle(hTRDEffPtNegTrk5, 1, kBlue, 1, 26, kBlue, 1);
1491 SetStyle(hTRDEffPtPosTrk6, 1, kRed, 1, 27, kRed, 1);
1492 SetStyle(hTRDEffPtNegTrk6, 1, kBlue, 1, 27, kBlue, 1);
1493 if(hTRDEffPtPosAll) {hTRDEffPtPosAll->Draw("same"); leg->AddEntry(hTRDEffPtPosAll, "pos. (#geq 1 tracklet)", "p");}
1494 if(hTRDEffPtNegAll) {hTRDEffPtNegAll->Draw("same"); leg->AddEntry(hTRDEffPtNegAll, "neg. (#geq 1 tracklet)", "p");}
1495 hTRDEffPtPosTrk4->Draw("same"); leg->AddEntry(hTRDEffPtPosTrk4, "pos. (4 tracklets)", "p");
1496 hTRDEffPtNegTrk4->Draw("same"); leg->AddEntry(hTRDEffPtNegTrk4, "neg. (4 tracklets)", "p");
1497 hTRDEffPtPosTrk5->Draw("same"); leg->AddEntry(hTRDEffPtPosTrk5, "pos. (5 tracklets)", "p");
1498 hTRDEffPtNegTrk5->Draw("same"); leg->AddEntry(hTRDEffPtNegTrk5, "neg. (5 tracklets)", "p");
1499 hTRDEffPtPosTrk6->Draw("same"); leg->AddEntry(hTRDEffPtPosTrk6, "pos. (6 tracklets)", "p");
1500 hTRDEffPtNegTrk6->Draw("same"); leg->AddEntry(hTRDEffPtNegTrk6, "neg. (6 tracklets)", "p");
69656036
AB
1501 leg->Draw();
1502
1503 //---------------------------------------------------------
1504 // TRD-TOF matching efficiency vs pt
1505 pad = ((TVirtualPad*)l->At(7)); pad->cd();
1506 pad->SetLeftMargin(0.15); pad->SetRightMargin(0.02);
1507 pad->SetTopMargin(0.1); pad->SetBottomMargin(0.15);
1508 pad->SetGridx(kFALSE); pad->SetGridy(kFALSE);
1509
1510 rangeEffPt->Draw();
1511 lat->DrawLatex(0.2, 1.44, "TRD-TOF matching efficiency");
1512 SetStyle(hTOFEffPtPosAll, 1, kRed, 1, 24, kRed, 1);
1513 SetStyle(hTOFEffPtPosTrk4, 1, kRed, 1, 25, kRed, 1);
1514 SetStyle(hTOFEffPtPosTrk5, 1, kRed, 1, 26, kRed, 1);
1515 SetStyle(hTOFEffPtPosTrk6, 1, kRed, 1, 27, kRed, 1);
1516 SetStyle(hTOFEffPtNegAll, 1, kBlue, 1, 24, kBlue, 1);
1517 SetStyle(hTOFEffPtNegTrk4, 1, kBlue, 1, 25, kBlue, 1);
1518 SetStyle(hTOFEffPtNegTrk5, 1, kBlue, 1, 26, kBlue, 1);
1519 SetStyle(hTOFEffPtNegTrk6, 1, kBlue, 1, 27, kBlue, 1);
1520 if(hTOFEffPtPosAll) hTOFEffPtPosAll->Draw("same");
1521 hTOFEffPtPosTrk4->Draw("same");
1522 hTOFEffPtPosTrk5->Draw("same");
1523 hTOFEffPtPosTrk6->Draw("same");
1524 if(hTOFEffPtNegAll) hTOFEffPtNegAll->Draw("same");
1525 hTOFEffPtNegTrk4->Draw("same");
1526 hTOFEffPtNegTrk5->Draw("same");
1527 hTOFEffPtNegTrk6->Draw("same");
1528
1529 //-----------------------------------------------------
1530 // <ntracklets> vs (phi,eta)
1531 pad = ((TVirtualPad*)l->At(2)); pad->cd();
1532 pad->SetLeftMargin(0.15); pad->SetRightMargin(0.1);
1533 pad->SetTopMargin(0.1); pad->SetBottomMargin(0.15);
1534 pad->SetGridx(kFALSE); pad->SetGridy(kFALSE);
1535
1536 rangeEtaPhi->Draw();
1537 lat->DrawLatex(-0.9, 3.3, "TRD <N_{tracklets}>");
1538
1539 TH3D* hNtracklets = (TH3D*)matchPhiEta->Project(kTRD, matchPhiEta->GetVar(fgkVarNames[kTrackPhiTRD]), matchPhiEta->GetVar(fgkVarNames[kTrackEtaTRD]), matchPhiEta->GetVar(fgkVarNames[kTrackTrdTracklets]));
1540
1541 TProfile2D* hNtrackletsProf = hNtracklets->Project3DProfile();
1542 delete hNtracklets;
1543 if(hNtrackletsProf) {
1544 hNtrackletsProf->SetStats(kFALSE);
1545 hNtrackletsProf->SetMinimum(0.);
1546 hNtrackletsProf->SetMaximum(6.);
1547 hNtrackletsProf->Draw("samecolz");
1548 DrawTRDGrid();
1549 }
1550
1551 // calculate the trend value for tracklets/track
1552 TH2D* hNtrackletsVsP = (TH2D*)matchPt->Project(kTRD, matchPt->GetVar(fgkVarNames[kTrackPt]), matchPt->GetVar(fgkVarNames[kTrackTrdTracklets]));
1553 if(trendValues && hNtrackletsVsP && hNtrackletsVsP->GetEntries()>0.1) {
1554 TProfile* hNtrackletsVsPprof = hNtrackletsVsP->ProfileX("hNtrackletsVsPprof");
1555 hNtrackletsVsPprof->Fit(funcConst, "QME0", "goff", 1.0, 3.0);
1556 trendValues[8] = funcConst->GetParameter(0);
1557 trendValues[9] = funcConst->GetParError(0);
1558 delete hNtrackletsVsP;
1559 }
1560
1561 //--------------------------------------------------------------
1562 // Nclusters per TRD track vs momentum
1563 pad = ((TVirtualPad*)l->At(5)); pad->cd();
1564 pad->SetLeftMargin(0.15); pad->SetRightMargin(0.12);
1565 pad->SetTopMargin(0.1); pad->SetBottomMargin(0.15);
1566 pad->SetGridx(kFALSE); pad->SetGridy(kFALSE);
1567 pad->SetLogz();
1568
1569 if(gROOT->FindObject("rangeNclsP")) delete gROOT->FindObject("rangeNclsP");
1570 TH2F* rangeNclsP = new TH2F("rangeNclsP", "", 10, 0.0, 11.99, 10, 0.0, 199.0);
1571 SetStyle(rangeNclsP->GetXaxis(), "p [GeV/c]", 0.07, 0.8, kTRUE, 0.05);
1572 SetStyle(rangeNclsP->GetYaxis(), "#clusters", 0.07, 0.8, kTRUE, 0.05);
1573 rangeNclsP->SetStats(kFALSE);
1574 rangeNclsP->Draw();
1575 lat->DrawLatex(1.0, 205., "TRD Clusters / track");
1576
1577 TH2D* hNclsVsP = (TH2D*)clustersCF->Project(0, clustersCF->GetVar(fgkVarNames[kTrackP]), clustersCF->GetVar(fgkVarNames[kTrackTrdClusters]));
1578 if(hNclsVsP) {
1579 hNclsVsP->SetStats(kFALSE);
1580 hNclsVsP->Draw("samecolz");
1581 }
098f177f 1582
69656036
AB
1583 if(trendValues && hNclsVsP && hNclsVsP->GetEntries()>10) {
1584 TProfile* hNclsVsPprof = hNclsVsP->ProfileX("hNclsVsPprof");
1585 hNclsVsPprof->Fit(funcConst, "QME0", "goff", 1.0, 3.0);
1586 trendValues[10] = funcConst->GetParameter(0);
1587 trendValues[11] = funcConst->GetParError(0);
1588 }
1589
1590 //--------------------------------------------------------------
1591 // TRD-TPC and TOF-TRD matching efficiency vs bunch crossing
1592 pad = ((TVirtualPad*)l->At(8)); pad->cd();
1593 pad->SetLeftMargin(0.15); pad->SetRightMargin(0.02);
1594 pad->SetTopMargin(0.1); pad->SetBottomMargin(0.15);
1595 pad->SetGridx(kFALSE); pad->SetGridy(kFALSE);
1596
1597 TH1F* hTRDEffBC = EfficiencyFromPhiPt(bcCF, -1, -1, 1, 0, kEventBC);
1598 TH1F* hTOFEffBC = EfficiencyFromPhiPt(bcCF, -1, -1, 2, 1, kEventBC);
1599
1600 if(gROOT->FindObject("rangeBC")) delete gROOT->FindObject("rangeBC");
1601 TH2F* rangeBC = new TH2F("rangeBC", "", 10, -0.5, 3499.5, 10, 0.0, 1.4);
1602 rangeBC->SetStats(kFALSE);
1603 SetStyle(rangeBC->GetXaxis(), "Bunch crossing", 0.07, 0.8, kTRUE, 0.05);
1604 SetStyle(rangeBC->GetYaxis(), "efficiency", 0.07, 0.8, kTRUE, 0.05);
1605 rangeBC->Draw();
1606
1607 TLegend* legBC=new TLegend(0.8, 0.7, 0.95, 0.89);
1608 legBC->SetBorderSize(0);
1609 legBC->SetMargin(0.15);
1610 legBC->SetFillColor(0);
1611 if(hTRDEffBC) {
1612 hTRDEffBC->SetStats(kFALSE);
1613 SetStyle(hTRDEffBC, 1, kRed, 2, 24, kRed, 1); legBC->AddEntry(hTRDEffBC, "TPC-TRD", "p");
1614 SetStyle(hTOFEffBC, 1, kBlue, 2, 24, kBlue, 1); legBC->AddEntry(hTOFEffBC, "TRD-TOF", "p");
1615 hTRDEffBC->Draw("same");
1616 hTOFEffBC->Draw("same");
1617 legBC->Draw();
1618 lat->DrawLatex(200., 1.44, "Matching efficiency at 1<p_{T}<3 GeV/c");
1619 }
1620
1621 delete funcConst;
1622}
1623
1624
1625
1626//_________________________________________________________________
1627void AliTRDcheckESD::PlotPidSummaryFromCF(Double_t* trendValues, const Char_t* /*triggerName*/, Bool_t /*useIsolatedBC*/, Bool_t /*cutTOFbc*/) {
1628 //
1629 // PID summary
1630 //
c2c78193 1631 // trendValues will be filled with trending variables
1632 // trendValues[12] : PH plateau height from slices times 0.002
1633 // trendValues[13] : statistical error of trendValues[12]
1634 // trendValues[14] : PH slope from slices times 0.002
1635 // trendValues[15] : statistical error of trendValues[14]
1636 // trendValues[16] : Landau MPV of tracklet Qtot distribution at p=1GeV/c times 0.002
1637 // trendValues[17] : Landau width of tracklet Qtot distribution at p=1GeV/c times 0.002
1638 // trendValues[18] : PH plateau height from slices
1639 // trendValues[19] : statistical error of trendValues[19]
1640 // trendValues[20] : PH slope from slices
1641 // trendValues[21] : statistical error of trendValues[20]
1642 // trendValues[22] : Landau MPV of tracklet Qtot distribution at p=1GeV/c
1643 // trendValues[23] : Landau width of tracklet Qtot distribution at p=1GeV/c
1644 //
69656036
AB
1645 if(!fHistos) return;
1646 AliCFContainer* qtotCF = (AliCFContainer*)fHistos->FindObject("QtotCF");
1647 if(!qtotCF) return;
1648 AliCFContainer* phCF = (AliCFContainer*)fHistos->FindObject("PulseHeightCF");
1649 if(!phCF) return;
1650 AliCFContainer* centCF = (AliCFContainer*)fHistos->FindObject("CentralityCF");
1651 if(!centCF) return;
1652
1653 TLatex *lat=new TLatex();
1654 lat->SetTextSize(0.07);
1655 lat->SetTextColor(2);
1656 lat->SetTextFont(42);
1657 gPad->SetTopMargin(0.05); gPad->SetBottomMargin(0.001);
1658 gPad->SetLeftMargin(0.001); gPad->SetRightMargin(0.001);
1659 gPad->Divide(3,3,0.,0.);
1660 TList* l=gPad->GetListOfPrimitives();
1661
1662 if(gROOT->FindObject("rangeEtaPhi2")) delete gROOT->FindObject("rangeEtaPhi2");
1663 TH2F* rangeEtaPhi = new TH2F("rangeEtaPhi2", "", 10, -0.99, +0.99, 10, -3.15, 3.15);
1664 SetStyle(rangeEtaPhi->GetXaxis(), "#eta", 0.07, 0.8, kTRUE, 0.05);
1665 SetStyle(rangeEtaPhi->GetYaxis(), "detector #varphi", 0.07, 0.8, kTRUE, 0.05);
1666 rangeEtaPhi->SetStats(kFALSE);
1667
1668 // eta-phi distr. for <Qtot> in layer 0
1669 TVirtualPad* pad;
1670 TProfile2D* hProf2D;
1671 TH1D* hqtot = (TH1D*)qtotCF->Project(0, qtotCF->GetVar(fgkVarNames[kTrackletQtot]));
1672 for(Int_t iLayer=0; iLayer<6; ++iLayer) {
1673 pad = ((TVirtualPad*)l->At((iLayer<3 ? iLayer*3 : (iLayer-3)*3+1))); pad->cd();
1674 pad->SetLeftMargin(0.15); pad->SetRightMargin(0.1);
1675 pad->SetTopMargin(0.1); pad->SetBottomMargin(0.15);
1676 pad->SetGridx(kFALSE); pad->SetGridy(kFALSE);
1677 rangeEtaPhi->Draw();
1678 qtotCF->SetRangeUser(qtotCF->GetVar(fgkVarNames[kTrackletLayer]), Double_t(iLayer), Double_t(iLayer));
1679 TH3D* hQtotEtaPhi = (TH3D*)qtotCF->Project(0, qtotCF->GetVar(fgkVarNames[kTrackPhiTRD]), qtotCF->GetVar(fgkVarNames[kTrackEtaTRD]), qtotCF->GetVar(fgkVarNames[kTrackletQtot]));
1680 hProf2D = (hQtotEtaPhi ? hQtotEtaPhi->Project3DProfile() : 0x0);
1681 if(hQtotEtaPhi) delete hQtotEtaPhi;
1682
1683 if(hProf2D) {
1684 hProf2D->SetName(Form("Qtot_layer%d",iLayer));
1685 hProf2D->SetStats(kFALSE);
1686 hProf2D->SetMinimum(0.);
1687 hProf2D->SetMaximum((hqtot->GetMean()<10 ? 4.0 : 2000.));
1688 hProf2D->Draw("samecolz");
1689 }
1690 lat->DrawLatex(-0.9, 3.3, Form("TRD <Q_{tot}> Layer %d", iLayer));
1691 DrawTRDGrid();
1692 }
1693 qtotCF->SetRangeUser(qtotCF->GetVar(fgkVarNames[kTrackletLayer]), 0.0, 5.0);
1694 // PH versus slice number
1695 pad = ((TVirtualPad*)l->At(2)); pad->cd();
1696 pad->SetLeftMargin(0.15); pad->SetRightMargin(0.1);
1697 pad->SetTopMargin(0.03); pad->SetBottomMargin(0.15);
1698 pad->SetGridx(kFALSE); pad->SetGridy(kFALSE);
1699
1700 if(gROOT->FindObject("rangePHslice")) delete gROOT->FindObject("rangePHslice");
1701 TH2F* rangePHslice=new TH2F("rangePHslice", "", 8, -0.5, 7.5, 10, 0.0, (hqtot->GetMean()<10.0 ? 6.0 : 3000.));
1702 rangePHslice->SetStats(kFALSE);
1703 SetStyle(rangePHslice->GetXaxis(), "slice", 0.07, 0.8, kTRUE, 0.05);
1704 SetStyle(rangePHslice->GetYaxis(), "PH", 0.07, 0.8, kTRUE, 0.05);
1705 rangePHslice->Draw();
1706
1707 TF1* funcPol1 = new TF1("funcPol1", "[0]+[1]*x", 2.9, 6.4);
1708
1709 TH2D* hPH = (TH2D*)phCF->Project(0, phCF->GetVar(fgkVarNames[kTrackletSlice]), phCF->GetVar(fgkVarNames[kTrackletPHslice]));
1710 TH1D* hSliceErr = new TH1D(Form("hSliceErr%f", gRandom->Rndm()), "", hPH->GetXaxis()->GetNbins(), hPH->GetXaxis()->GetXbins()->GetArray());
1711 TH1D* hLandauFit = Proj2D(hPH, hSliceErr);
1712 hPH->SetStats(kFALSE);
1713 hPH->Draw("samecolz");
1714 const Double_t kQx = 0.002;
1715 if(trendValues) {
1716 hSliceErr->Fit(funcPol1, "QME0", "goff", 2.9, 6.4);
1717 trendValues[12] = kQx*funcPol1->GetParameter(0); // PH plateau
1718 trendValues[13] = kQx*funcPol1->GetParError(0); // PH plateau
1719 trendValues[14] = kQx*funcPol1->GetParameter(1); // PH slope
1720 trendValues[15] = kQx*funcPol1->GetParError(1); // PH slope
c2c78193 1721 trendValues[18] = funcPol1->GetParameter(0); // PH plateau
1722 trendValues[19] = funcPol1->GetParError(0); // PH plateau
1723 trendValues[20] = funcPol1->GetParameter(1); // PH slope
1724 trendValues[21] = funcPol1->GetParError(1); // PH slope
69656036
AB
1725 }
1726 hLandauFit->SetLineWidth(2);
1727 hLandauFit->SetLineStyle(2);
1728 hLandauFit->Draw("same");
1729
1730 delete funcPol1; delete hSliceErr;
1731 // Qtot vs P
1732 pad = ((TVirtualPad*)l->At(5)); pad->cd();
1733 pad->SetLeftMargin(0.15); pad->SetRightMargin(0.1);
1734 pad->SetTopMargin(0.03); pad->SetBottomMargin(0.15);
1735 pad->SetGridx(kFALSE); pad->SetGridy(kFALSE);
1736 pad->SetLogz();
1737
1738 if(gROOT->FindObject("rangeQtotP")) delete gROOT->FindObject("rangeQtotP");
1739 TH2F* rangeQtotP = new TH2F("rangeQtotP", "", 10, 0.0, 11.99, 10, 0.0, (hqtot->GetMean()<10.0 ? 11.99 : 5999.));
1740 SetStyle(rangeQtotP->GetXaxis(), "P [GeV/c]", 0.07, 0.8, kTRUE, 0.05);
1741 SetStyle(rangeQtotP->GetYaxis(), "Q_{tot}", 0.07, 0.8, kTRUE, 0.05);
1742 rangeQtotP->SetStats(kFALSE);
1743 rangeQtotP->Draw();
1744
1745 Int_t pVar = centCF->GetVar(fgkVarNames[kTrackP]);
1746 if(pVar<0) pVar = centCF->GetVar(fgkVarNames[kTrackletP]);
1747 TH2D* hQtotP = (TH2D*)centCF->Project(0, pVar, centCF->GetVar(fgkVarNames[kTrackletQtot]));
1748 TH1D* mpvErr=new TH1D("mpvErr", "Landau MPV error vs. P", hQtotP->GetXaxis()->GetNbins(), hQtotP->GetXaxis()->GetXbins()->GetArray());
1749 TH1D* widthErr=new TH1D("widthErr", "Landau width error vs. P", hQtotP->GetXaxis()->GetNbins(), hQtotP->GetXaxis()->GetXbins()->GetArray());
1750 TH1D* landauChi2=new TH1D("landauChi2", "Landau fit #chi^{2} vs. P", hQtotP->GetXaxis()->GetNbins(), hQtotP->GetXaxis()->GetXbins()->GetArray());
1751 if(hQtotP)
1752 for(Int_t i=1; i<=hQtotP->GetXaxis()->GetNbins(); ++i)
1753 hQtotP->SetBinContent(i, 1, 0.0);
1754 TH1D* hQtotProj = (hQtotP ? Proj2D(hQtotP, mpvErr, widthErr, landauChi2) : 0x0);
1755 //landauChi2->Scale(0.001);
1756 if(hQtotProj) SetStyle(hQtotProj, 2, kBlue, 2, 1, kBlue, 1);
1757 if(trendValues && hQtotProj && hQtotProj->GetEntries()>2) {
1758 trendValues[16] = kQx*hQtotProj->GetBinContent(hQtotProj->FindBin(1.0)); // Landau MPV at 1GeV/c
1759 trendValues[17] = kQx*hQtotProj->GetBinError(hQtotProj->FindBin(1.0)); // Landau width at 1 GeV/c
098f177f 1760 trendValues[22] = hQtotProj->GetBinContent(hQtotProj->FindBin(1.0)); // Landau MPV at 1GeV/c
1761 trendValues[23] = hQtotProj->GetBinError(hQtotProj->FindBin(1.0)); // Landau width at 1 GeV/c
69656036
AB
1762 }
1763 if(hQtotP) {
1764 hQtotP->SetStats(kFALSE);
1765 hQtotP->Draw("samecolz");
1766 hQtotProj->Draw("same");
1767 }
1768
1769 // Qtot vs P (fit results)
1770 pad = ((TVirtualPad*)l->At(8)); pad->cd();
1771 pad->SetLeftMargin(0.15); pad->SetRightMargin(0.1);
1772 pad->SetTopMargin(0.03); pad->SetBottomMargin(0.15);
1773 pad->SetGridx(kFALSE); pad->SetGridy(kFALSE);
1774 pad->SetLogz();
1775
1776 if(gROOT->FindObject("rangeQtotPfit")) delete gROOT->FindObject("rangeQtotPfit");
1777 TH2F* rangeQtotPfit = new TH2F("rangeQtotPfit", "", 100, 0.0, 11.99, 100, 0.0, (hqtot->GetMean()<10.0 ? 6.0 : 3999.));
1778 SetStyle(rangeQtotPfit->GetXaxis(), "P [GeV/c]", 0.07, 0.8, kTRUE, 0.05);
1779 SetStyle(rangeQtotPfit->GetYaxis(), "Q_{tot}", 0.07, 0.8, kTRUE, 0.05);
1780 rangeQtotPfit->SetStats(kFALSE);
1781 rangeQtotPfit->Draw();
1782
1783 if(mpvErr) SetStyle(mpvErr, 1, kBlue, 2, 1, kBlue, 1);
1784 if(widthErr) SetStyle(widthErr, 2, kRed, 2, 1, kRed, 1);
1785 if(mpvErr) {
1786 mpvErr->SetStats(kFALSE);
1787 mpvErr->Draw("same");
1788 }
1789 if(widthErr) {
1790 widthErr->SetStats(kFALSE);
1791 widthErr->Draw("same");
1792 }
1793 TLegend* leg=new TLegend(0.2,0.6,0.5,0.9);
1794 leg->SetFillColor(0);
1795 leg->SetBorderSize(0);
1796 leg->AddEntry("mpvErr","Landau MPV","l");
1797 leg->AddEntry("widthErr","Landau width","l");
1798 leg->Draw();
1799}
1800
1801
1802//__________________________________________________________________________________________________
5cf184fe 1803void AliTRDcheckESD::PlotOtherSummaryFromCF(Double_t* /*trendValues*/) {
69656036 1804 //
c2c78193 1805 // Plot additional QA
69656036
AB
1806 //
1807 if(!fHistos) return;
1808 AliCFContainer* matchPhiEta = (AliCFContainer*)fHistos->FindObject("MatchingPhiEta");
69656036
AB
1809 AliCFContainer* trdChi2 = (AliCFContainer*)fHistos->FindObject("trdChi2");
1810 AliCFContainer* trdBudget = (AliCFContainer*)fHistos->FindObject("trdBudget");
1811 AliCFContainer* ploss = (AliCFContainer*)fHistos->FindObject("Ploss");
1812 AliCFContainer* clusters = (AliCFContainer*)fHistos->FindObject("clustersPerTracklet");
1813 AliCFContainer* clsRows = (AliCFContainer*)fHistos->FindObject("clustersVsRows");
c2c78193 1814
69656036
AB
1815 TLatex *lat=new TLatex();
1816 lat->SetTextSize(0.06);
1817 lat->SetTextColor(2);
1818 lat->SetNDC();
1819 lat->SetTextFont(42);
1820 TCanvas* c1 = new TCanvas("ESDsummary", "ESD summary 1", 1600, 1200);
1821 gPad->SetTopMargin(0.05); gPad->SetBottomMargin(0.001);
1822 gPad->SetLeftMargin(0.001); gPad->SetRightMargin(0.001);
1823 gPad->Divide(3,3,0.,0.);
1824 TList* l=gPad->GetListOfPrimitives();
1825 TVirtualPad* pad=0x0;
1826
1827 // matching as a function of trigger class
1828 if(matchPhiEta) {
1829 matchPhiEta->SetRangeUser(matchPhiEta->GetVar(fgkVarNames[kTrackCharge]), -1.0, -1.0);
1830 TH1F* hTRDEffTriggerNeg = EfficiencyFromPhiPt(matchPhiEta, -1, -1, 1, 0, kEventTrigger);
1831 matchPhiEta->SetRangeUser(matchPhiEta->GetVar(fgkVarNames[kTrackCharge]), +1.0, +1.0);
1832 TH1F* hTRDEffTriggerPos = EfficiencyFromPhiPt(matchPhiEta, -1, -1, 1, 0, kEventTrigger);
1833
1834 pad = ((TVirtualPad*)l->At(0)); pad->cd();
1835 pad->SetLeftMargin(0.15); pad->SetRightMargin(0.01);
1836 pad->SetTopMargin(0.06); pad->SetBottomMargin(0.15);
1837 hTRDEffTriggerNeg->SetStats(kFALSE);
1838 SetStyle(hTRDEffTriggerNeg->GetYaxis(), "efficiency", 0.06, 1.0, kTRUE, 0.06);
1839 hTRDEffTriggerNeg->GetXaxis()->SetRange(1,fNAssignedTriggers);
1840 hTRDEffTriggerPos->GetXaxis()->SetRange(1,fNAssignedTriggers);
1841 SetStyle(hTRDEffTriggerNeg, 1, 2, 2, 20, 2, 1);
1842 SetStyle(hTRDEffTriggerPos, 1, 4, 2, 20, 4, 1);
1843 hTRDEffTriggerNeg->Draw();
1844 hTRDEffTriggerPos->Draw("same");
1845 TLegend* legEff=new TLegend(0.5,0.5,0.7,0.7);
1846 legEff->SetFillColor(0);
1847 legEff->SetBorderSize(0);
1848 legEff->AddEntry(hTRDEffTriggerNeg, "negatives", "l");
1849 legEff->AddEntry(hTRDEffTriggerPos, "positives", "l");
1850 legEff->Draw();
1851 lat->DrawLatex(0.2, 0.95, "TPC-TRD matching efficiency");
1852 }
1853
69656036
AB
1854 if(trdChi2) {
1855 // Track TRD chi2 vs (eta,phi)
1856 TH3D* trdChi23D = (TH3D*)trdChi2->Project(0, trdChi2->GetVar(fgkVarNames[kTrackEtaTRD]),
1857 trdChi2->GetVar(fgkVarNames[kTrackPhiTRD]),
1858 trdChi2->GetVar(fgkVarNames[kTrackTrdChi2]));
1859 trdChi23D->SetName("trdChi23D");
1860 TProfile2D* prof2DChi2 = trdChi23D->Project3DProfile("yx");
1861 prof2DChi2->SetName("prof2DChi2");
c2c78193 1862 pad = ((TVirtualPad*)l->At(3)); pad->cd();
69656036
AB
1863 pad->SetLeftMargin(0.15); pad->SetRightMargin(0.1);
1864 pad->SetTopMargin(0.06); pad->SetBottomMargin(0.15);
1865 prof2DChi2->SetStats(kFALSE);
1866 prof2DChi2->SetTitle("");
1867 SetStyle(prof2DChi2->GetXaxis(), "#eta", 0.06, 1.0, kTRUE, 0.06);
1868 SetStyle(prof2DChi2->GetYaxis(), "#varphi (rad.)", 0.06, 1.0, kTRUE, 0.06);
1869 prof2DChi2->SetMaximum(2.9);
1870 prof2DChi2->Draw("colz");
1871 lat->DrawLatex(0.2, 0.95, "TRD #chi^{2}");
c2c78193 1872 DrawTRDGrid();
69656036
AB
1873
1874 // Track TRD chi2 vs pt and charge
1875 trdChi2->SetRangeUser(trdChi2->GetVar(fgkVarNames[kTrackCharge]), -1.0, -1.0);
1876 TH2D* trdChi2VsPtNeg = (TH2D*)trdChi2->Project(0, trdChi2->GetVar(fgkVarNames[kTrackPt]),
1877 trdChi2->GetVar(fgkVarNames[kTrackTrdChi2]));
1878 trdChi2VsPtNeg->SetName("trdChi2VsPtNeg");
1879 TProfile* trdChi2VsPtNegProf = trdChi2VsPtNeg->ProfileX();
1880 trdChi2VsPtNegProf->SetName("trdChi2VsPtNegProf");
1881 trdChi2->SetRangeUser(trdChi2->GetVar(fgkVarNames[kTrackCharge]), 1.0, 1.0);
1882 TH2D* trdChi2VsPtPos = (TH2D*)trdChi2->Project(0, trdChi2->GetVar(fgkVarNames[kTrackPt]),
1883 trdChi2->GetVar(fgkVarNames[kTrackTrdChi2]));
1884 trdChi2VsPtPos->SetName("trdChi2VsPtPos");
1885 TProfile* trdChi2VsPtPosProf = trdChi2VsPtPos->ProfileX();
1886 trdChi2VsPtPosProf->SetName("trdChi2VsPtPosProf");
c2c78193 1887 pad = ((TVirtualPad*)l->At(6)); pad->cd();
69656036
AB
1888 pad->SetLeftMargin(0.15); pad->SetRightMargin(0.01);
1889 pad->SetTopMargin(0.06); pad->SetBottomMargin(0.15);
1890 trdChi2VsPtNegProf->SetStats(kFALSE);
1891 trdChi2VsPtNegProf->SetTitle("");
1892 SetStyle(trdChi2VsPtNegProf->GetXaxis(), "p_{T} (GeV/c)", 0.06, 1.0, kTRUE, 0.06);
1893 SetStyle(trdChi2VsPtNegProf->GetYaxis(), "<TRD #chi^{2}>", 0.06, 1.0, kTRUE, 0.06);
1894 SetStyle(trdChi2VsPtNegProf, 1, 2, 2, 20, 2, 1);
1895 SetStyle(trdChi2VsPtPosProf, 1, 4, 2, 20, 4, 1);
1896 trdChi2VsPtNegProf->Draw();
1897 trdChi2VsPtPosProf->Draw("same");
1898 lat->DrawLatex(0.2, 0.95, "TRD #chi^{2}");
1899 }
1900
1901 if(trdBudget) {
1902 // Track TRD budget vs (eta,phi)
1903 TH3D* trdBudget3D = (TH3D*)trdBudget->Project(0, trdBudget->GetVar(fgkVarNames[kTrackEtaTRD]),
1904 trdBudget->GetVar(fgkVarNames[kTrackPhiTRD]),
1905 trdBudget->GetVar(fgkVarNames[kTrackTRDBudget]));
1906 trdBudget3D->SetName("trdBudget3D");
1907 TProfile2D* prof2DBudget = trdBudget3D->Project3DProfile("yx");
1908 prof2DBudget->SetName("prof2DBudget");
c2c78193 1909 pad = ((TVirtualPad*)l->At(1)); pad->cd();
69656036
AB
1910 pad->SetLeftMargin(0.15); pad->SetRightMargin(0.1);
1911 pad->SetTopMargin(0.06); pad->SetBottomMargin(0.15);
1912 prof2DBudget->SetStats(kFALSE);
1913 prof2DBudget->SetTitle("");
1914 SetStyle(prof2DBudget->GetXaxis(), "#eta", 0.06, 1.0, kTRUE, 0.06);
1915 SetStyle(prof2DBudget->GetYaxis(), "#varphi (rad.)", 0.06, 1.0, kTRUE, 0.06);
1916 prof2DBudget->Draw("colz");
1917 lat->DrawLatex(0.2, 0.95, "TRD budget");
c2c78193 1918 DrawTRDGrid();
69656036
AB
1919 }
1920
1921 if(ploss) {
1922 // momentum loss
1923 ploss->SetRangeUser(ploss->GetVar(fgkVarNames[kTrackCharge]), -1.0, -1.0);
1924 TH2D* plossLayerNeg = (TH2D*)ploss->Project(0, ploss->GetVar(fgkVarNames[kTrackletLayer]),
1925 ploss->GetVar(fgkVarNames[kTrackPlossTRDlayer]));
1926 plossLayerNeg->SetName("plossLayerNeg");
1927 TProfile* plossLayerNegProf = plossLayerNeg->ProfileX();
1928 plossLayerNegProf->SetName("plossLayerNegProf");
1929 ploss->SetRangeUser(ploss->GetVar(fgkVarNames[kTrackCharge]), +1.0, +1.0);
1930 TH2D* plossLayerPos = (TH2D*)ploss->Project(0, ploss->GetVar(fgkVarNames[kTrackletLayer]),
1931 ploss->GetVar(fgkVarNames[kTrackPlossTRDlayer]));
1932 plossLayerPos->SetName("plossLayerPos");
1933 TProfile* plossLayerPosProf = plossLayerPos->ProfileX();
1934 plossLayerPosProf->SetName("plossLayerPosProf");
1935 ploss->SetRangeUser(ploss->GetVar(fgkVarNames[kTrackCharge]), -1.5, +1.5);
1936
1937 ploss->SetRangeUser(ploss->GetVar(fgkVarNames[kTrackletLayer]), 0.0, 0.0);
1938 TH3D* ploss3Dl0 = (TH3D*)ploss->Project(0, ploss->GetVar(fgkVarNames[kTrackEtaTRD]),
1939 ploss->GetVar(fgkVarNames[kTrackPhiTRD]),
1940 ploss->GetVar(fgkVarNames[kTrackPlossTRDlayer]));
1941 ploss3Dl0->SetName("ploss3Dl0");
1942 TProfile2D* plossEtaPhiL0Prof = ploss3Dl0->Project3DProfile("yx");
1943 plossEtaPhiL0Prof->SetName("plossEtaPhiL0Prof");
1944 ploss->SetRangeUser(ploss->GetVar(fgkVarNames[kTrackletLayer]), 5.0, 5.0);
1945 TH3D* ploss3Dl5 = (TH3D*)ploss->Project(0, ploss->GetVar(fgkVarNames[kTrackEtaTRD]),
1946 ploss->GetVar(fgkVarNames[kTrackPhiTRD]),
1947 ploss->GetVar(fgkVarNames[kTrackPlossTRDlayer]));
1948 ploss3Dl5->SetName("ploss3Dl5");
1949 TProfile2D* plossEtaPhiL5Prof = ploss3Dl5->Project3DProfile("yx");
1950 plossEtaPhiL5Prof->SetName("plossEtaPhiL5Prof");
c2c78193 1951 pad = ((TVirtualPad*)l->At(4)); pad->cd();
69656036
AB
1952 pad->SetLeftMargin(0.15); pad->SetRightMargin(0.1);
1953 pad->SetTopMargin(0.06); pad->SetBottomMargin(0.15);
1954 plossEtaPhiL0Prof->SetStats(kFALSE);
1955 plossEtaPhiL0Prof->SetTitle("");
1956 SetStyle(plossEtaPhiL0Prof->GetXaxis(), "#eta", 0.06, 1.0, kTRUE, 0.06);
1957 SetStyle(plossEtaPhiL0Prof->GetYaxis(), "#varphi (rad.)", 0.06, 1.0, kTRUE, 0.06);
c2c78193 1958 plossEtaPhiL0Prof->SetMaximum(80.0);
1959 plossEtaPhiL0Prof->SetMinimum(-20.0);
69656036
AB
1960 plossEtaPhiL0Prof->Draw("colz");
1961 lat->DrawLatex(0.2, 0.95, "P_{loss} at layer 0");
c2c78193 1962 DrawTRDGrid();
1963 pad = ((TVirtualPad*)l->At(7)); pad->cd();
69656036
AB
1964 pad->SetLeftMargin(0.15); pad->SetRightMargin(0.1);
1965 pad->SetTopMargin(0.06); pad->SetBottomMargin(0.15);
1966 plossEtaPhiL5Prof->SetStats(kFALSE);
1967 plossEtaPhiL5Prof->SetTitle("");
1968 SetStyle(plossEtaPhiL5Prof->GetXaxis(), "#eta", 0.06, 1.0, kTRUE, 0.06);
1969 SetStyle(plossEtaPhiL5Prof->GetYaxis(), "#varphi (rad.)", 0.06, 1.0, kTRUE, 0.06);
c2c78193 1970 plossEtaPhiL5Prof->SetMaximum(80.0);
1971 plossEtaPhiL5Prof->SetMinimum(-20.0);
69656036
AB
1972 plossEtaPhiL5Prof->Draw("colz");
1973 lat->DrawLatex(0.2, 0.95, "P_{loss} at layer 5");
c2c78193 1974 DrawTRDGrid();
1975 pad = ((TVirtualPad*)l->At(2)); pad->cd();
69656036
AB
1976 pad->SetLeftMargin(0.15); pad->SetRightMargin(0.01);
1977 pad->SetTopMargin(0.06); pad->SetBottomMargin(0.15);
1978 plossLayerNegProf->SetStats(kFALSE);
1979 plossLayerNegProf->SetTitle("");
c2c78193 1980 SetStyle(plossLayerNegProf->GetYaxis(), "#Delta P (MeV/c)", 0.06, 1.0, kTRUE, 0.06);
69656036
AB
1981 SetStyle(plossLayerNegProf->GetXaxis(), "TRD layer", 0.06, 1.0, kTRUE, 0.06);
1982 SetStyle(plossLayerNegProf, 1, 2, 2, 20, 2, 1);
1983 SetStyle(plossLayerPosProf, 1, 4, 2, 20, 4, 1);
c2c78193 1984 plossLayerNegProf->GetYaxis()->SetRangeUser(TMath::Min(plossLayerNegProf->GetMinimum(),plossLayerPosProf->GetMinimum()-5.0),
1985 TMath::Max(plossLayerNegProf->GetMaximum(),plossLayerPosProf->GetMaximum())+5.0);
69656036
AB
1986 plossLayerNegProf->Draw();
1987 plossLayerPosProf->Draw("same");
1988 lat->DrawLatex(0.2, 0.95, "P_{loss} vs layer");
1989 }
1990
1991 // clusters/tracklet and clusters/crossed rows
1992 TH3D* clustersEtaPhi[6]={0x0};
1993 TH3D* clsRowsEtaPhi[6]={0x0};
1994 for(Int_t il=0;il<6;++il) {
1995 if(clusters) {
1996 clusters->SetRangeUser(clusters->GetVar(fgkVarNames[kTrackletLayer]), Double_t(il), Double_t(il));
1997 clustersEtaPhi[il]=(TH3D*)clusters->Project(0, clusters->GetVar(fgkVarNames[kTrackEtaTRD]),
1998 clusters->GetVar(fgkVarNames[kTrackPhiTRD]),
1999 clusters->GetVar(fgkVarNames[kTrackletClusters]));
2000 clustersEtaPhi[il]->SetName(Form("clustersEtaPhi%d",il));
2001 }
2002 if(clsRows) {
2003 clsRows->SetRangeUser(clsRows->GetVar(fgkVarNames[kTrackletLayer]), Double_t(il), Double_t(il));
2004 clsRowsEtaPhi[il]=(TH3D*)clsRows->Project(0, clsRows->GetVar(fgkVarNames[kTrackEtaTRD]),
2005 clsRows->GetVar(fgkVarNames[kTrackPhiTRD]),
2006 clsRows->GetVar(fgkVarNames[kTrackletClustersVsRows]));
2007 clsRowsEtaPhi[il]->SetName(Form("clsRowsEtaPhi%d",il));
2008 }
2009 }
2010
2011 lat->SetTextSize(0.05);
2012 Int_t layerPads[6] = {0, 2, 4, 1, 3, 5};
2013
2014 TCanvas* c2=0x0;
2015 if(clusters) {
2016 c2 = new TCanvas("ESDsummary2", "ESD summary 2", 1600, 1200);
2017 gPad->SetTopMargin(0.05); gPad->SetBottomMargin(0.001);
2018 gPad->SetLeftMargin(0.001); gPad->SetRightMargin(0.001);
2019 gPad->Divide(3,2,0.,0.);
2020 l=gPad->GetListOfPrimitives();
2021 for(Int_t il=0;il<6;++il) {
2022 TProfile2D* clustersEtaPhiProf = clustersEtaPhi[il]->Project3DProfile("yx");
2023 pad = ((TVirtualPad*)l->At(layerPads[il])); pad->cd();
2024 pad->SetLeftMargin(0.15); pad->SetRightMargin(0.1);
2025 pad->SetTopMargin(0.06); pad->SetBottomMargin(0.15);
2026 clustersEtaPhiProf->SetStats(kFALSE);
2027 clustersEtaPhiProf->SetTitle("");
2028 SetStyle(clustersEtaPhiProf->GetXaxis(), "#eta", 0.06, 1.0, kTRUE, 0.06);
2029 SetStyle(clustersEtaPhiProf->GetYaxis(), "#varphi (rad.)", 0.06, 1.0, kTRUE, 0.06);
098f177f 2030 clustersEtaPhiProf->SetMaximum(30.);
69656036
AB
2031 clustersEtaPhiProf->Draw("colz");
2032 lat->DrawLatex(0.2, 0.95, Form("Clusters / tracklet, layer %d", il));
c2c78193 2033 DrawTRDGrid();
69656036
AB
2034 }
2035 }
2036
2037 TCanvas* c3=0x0;
2038 if(clsRows) {
2039 c3 = new TCanvas("ESDsummary3", "ESD summary 3", 1600, 1200);
2040 gPad->SetTopMargin(0.05); gPad->SetBottomMargin(0.001);
2041 gPad->SetLeftMargin(0.001); gPad->SetRightMargin(0.001);
2042 gPad->Divide(3,2,0.,0.);
2043 l=gPad->GetListOfPrimitives();
2044 for(Int_t il=0;il<6;++il) {
2045 TProfile2D* clsRowsEtaPhiProf = clsRowsEtaPhi[il]->Project3DProfile("yx");
2046 pad = ((TVirtualPad*)l->At(layerPads[il])); pad->cd();
c2c78193 2047 pad->SetLeftMargin(0.15); pad->SetRightMargin(0.13);
69656036
AB
2048 pad->SetTopMargin(0.06); pad->SetBottomMargin(0.15);
2049 clsRowsEtaPhiProf->SetStats(kFALSE);
2050 clsRowsEtaPhiProf->SetTitle("");
2051 SetStyle(clsRowsEtaPhiProf->GetXaxis(), "#eta", 0.06, 1.0, kTRUE, 0.06);
2052 SetStyle(clsRowsEtaPhiProf->GetYaxis(), "#varphi (rad.)", 0.06, 1.0, kTRUE, 0.06);
2053 clsRowsEtaPhiProf->Draw("colz");
2054 lat->DrawLatex(0.2, 0.95, Form("Clusters / crossed rows, layer %d", il));
c2c78193 2055 DrawTRDGrid();
69656036
AB
2056 }
2057 }
2058
c2c78193 2059 if(matchPhiEta || trdChi2 || trdBudget || ploss) c1->SaveAs("esdSummary1.gif");
69656036
AB
2060 if(clusters) c2->SaveAs("esdSummary2.gif");
2061 if(clsRows) c3->SaveAs("esdSummary3.gif");
69656036
AB
2062}
2063
2064
2065//__________________________________________________________________________________________________
2066void AliTRDcheckESD::DrawTRDGrid() {
2067 //
2068 // Draw a grid of lines showing the TRD supermodule and stack structure in (eta,phi) coordinates.
2069 // The canvas on which to draw must already exist.
2070 //
2071 TLine line;
2072 line.SetLineColor(2);
2073 line.SetLineWidth(1);
2074 line.SetLineStyle(2);
2075 for(Int_t i=-9; i<=9; ++i) {
c2c78193 2076 line.DrawLine(-0.92, 2.0*TMath::Pi()/18.0*i, +0.92, 2.0*TMath::Pi()/18.0*i);
69656036
AB
2077 }
2078 line.DrawLine(-0.85, -3.15, -0.85, 3.15);
2079 line.DrawLine(-0.54, -3.15, -0.54, 3.15);
2080 line.DrawLine(-0.16, -3.15, -0.16, 3.15);
2081 line.DrawLine(+0.16, -3.15, +0.16, 3.15);
2082 line.DrawLine(+0.54, -3.15, +0.54, 3.15);
2083 line.DrawLine(+0.85, -3.15, +0.85, 3.15);
2084}
2085
2086//_________________________________________________________________
2087void AliTRDcheckESD::SetStyle(TH1* hist,
2088 Int_t lineStyle, Int_t lineColor, Int_t lineWidth,
2089 Int_t markerStyle, Int_t markerColor, Int_t markerSize) {
2090 //
2091 // Set style settings for histograms
2092 //
2093 if(!hist) return;
2094 hist->SetLineStyle(lineStyle);
2095 hist->SetLineColor(lineColor);
2096 hist->SetLineWidth(lineWidth);
2097 hist->SetMarkerStyle(markerStyle);
2098 hist->SetMarkerColor(markerColor);
2099 hist->SetMarkerSize(markerSize);
2100}
2101
2102//____________________________________________________________________
2103void AliTRDcheckESD::SetStyle(TAxis* axis, const Char_t* title, Float_t titleSize, Float_t titleOffset, Bool_t centerTitle,
2104 Float_t labelSize) {
2105 //
2106 // Set style settings for axes
2107 //
2108 if(!axis) return;
2109 axis->SetTitle(title);
2110 axis->SetTitleSize(titleSize);
2111 axis->SetTitleOffset(titleOffset);
2112 axis->CenterTitle(centerTitle);
2113 axis->SetLabelSize(labelSize);
2114 axis->SetTitleFont(42);
2115 axis->SetLabelFont(42);
2116 axis->SetNdivisions(507);
2117}
2118
2119//____________________________________________________________________
2120void AliTRDcheckESD::FindIsolatedBCs(TH1D* bcHist, Bool_t isIsolated[3500]) {
2121 //
2122 // Find the isolated bunch crossings
2123 //
2124 Int_t isolationSize = 5; // number of free bunches in both directions
2125 for(Int_t bcBin=1; bcBin<=bcHist->GetXaxis()->GetNbins(); ++bcBin) {
2126 Int_t bc = TMath::Nint(bcHist->GetBinCenter(bcBin));
2127 if(bc<-0.001 || bc>3499.01) {
2128 isIsolated[bc] = kFALSE;
2129 continue;
2130 }
2131 Double_t entries = bcHist->GetBinContent(bcBin);
2132 if(entries<0.001) {
2133 isIsolated[bc] = kFALSE;
2134 continue; // no entries
2135 }
2136
2137 // check isolation
2138 isIsolated[bc] = kTRUE;
2139 for(Int_t ibc = TMath::Max(1,bcBin-isolationSize); ibc<=TMath::Min(3499, bcBin+isolationSize); ++ibc) {
2140 if(ibc==bcBin) continue;
2141 if(bcHist->GetBinContent(ibc)>0.01) {
2142 isIsolated[bc] = kFALSE;
2143 break;
2144 }
2145 }
2146 } // end loop over BC bins
2147
2148 cout << "Isolated bunches: " << endl;
2149 for(Int_t ibc=0; ibc<3500; ++ibc)
2150 if(isIsolated[ibc]) cout << "BC #" << ibc << endl;
2151}
2152
2153
2154//__________________________________________________________________________________________________
2155Int_t AliTRDcheckESD::GetTriggerIndex(const Char_t* name, Bool_t createNew/*=kTRUE*/) {
2156 //
2157 // Return the index of trigger "name" in the trigger histogram.
2158 // If the index for this trigger does not exist yet, then assign one if createNew is set to TRUE
2159 //
2160 //cout << "GetTriggerIndex for " << name << endl;
2161 TH1F* triggerHist = (TH1F*)fHistos->FindObject("hTriggerDefs");
2162 TString nameStr=name;
2163 for(Int_t i=1; i<=triggerHist->GetXaxis()->GetNbins(); ++i) {
2164 if(!nameStr.CompareTo(triggerHist->GetXaxis()->GetBinLabel(i))) {
2165 //cout << " index found: " << i << endl;
2166 return i;
2167 }
2168 }
2169 if(createNew) {
2170 triggerHist->GetXaxis()->SetBinLabel(fNAssignedTriggers+1, name);
2171 for(Int_t i=1;i<fHistos->GetEntries();++i) {
2172 TString objType = fHistos->At(i)->IsA()->GetName();
2173 if(!objType.Contains("AliCFContainer")) continue;
2174 AliCFContainer* cf=(AliCFContainer*)fHistos->At(i);
2175 Int_t trigVar = cf->GetVar(fgkVarNames[kEventTrigger]);
2176 if(trigVar>=0)
2177 for(Int_t istep=0;istep<cf->GetNStep();++istep)
2178 cf->GetAxis(trigVar, istep)->SetBinLabel(fNAssignedTriggers+1, name);
2179 } // end loop over histograms and CFs
2180
2181 ++fNAssignedTriggers;
2182 return fNAssignedTriggers+1;
2183 }
2184 else {
2185 return -1;
2186 }
2187}
2188
2189//__________________________________________________________________________________________________
2190void AliTRDcheckESD::PrintTriggers() const {
2191 //
2192 // Print the available triggers for this run
2193 //
2194 if(!fHistos) {
2195 cout << "Warning in AliTRDcheckESD::PrintTriggers(): No file loaded!" << endl;
2196 return;
2197 }
2198 TH1F* hTriggers = (TH1F*)fHistos->FindObject("hTriggerDefs");
2199 cout << "Triggers found in this run" << endl;
2200 cout << "==========================" << endl;
2201 cout << "Name Index Entries " << endl;
2202 for(Int_t it=1; it<hTriggers->GetXaxis()->GetNbins(); ++it) {
2203 if(hTriggers->GetXaxis()->GetBinLabel(it)[0]!='\0') {
2204 cout << hTriggers->GetXaxis()->GetBinLabel(it) << " " << hTriggers->GetXaxis()->GetBinCenter(it) << " " << hTriggers->GetBinContent(it) << endl;
2205 }
2206 }
2207}
2208
2209
2210//__________________________________________________________________________________________________
2211Int_t AliTRDcheckESD::GetTriggerCounter(const Char_t* triggerName) const {
2212 //
2213 // Get the number of events for a given trigger name
2214 //
2215 if(!fHistos) {
2216 cout << "Warning in AliTRDcheckESD::PrintTriggers(): No file loaded!" << endl;
2217 return -1;
2218 }
2219 TH1F* hTriggers = (TH1F*)fHistos->FindObject("hTriggerDefs");
2220 Int_t counter = -1;
2221 for(Int_t it=1; it<hTriggers->GetXaxis()->GetNbins(); ++it) {
2222 TString trgString = hTriggers->GetXaxis()->GetBinLabel(it);
2223 if(!trgString.CompareTo(triggerName))
2224 counter = (Int_t)hTriggers->GetBinContent(it);
2225 }
2226 if(counter<0) {cout << "AliTRDcheckESD::GetTriggerCounter() Trigger not found !!";}
2227 return counter;
2228}
2229
2230
2231//__________________________________________________________________________________________________________
2232Int_t AliTRDcheckESD::GetNAssignedTriggers() {
2233 //
2234 // Return the number of assigned triggers
2235 //
2236 return fNAssignedTriggers;
2237}