24 #if !defined(__CINT__) || defined(__MAKECINT__)
26 #include <Riostream.h>
31 #include "TGridResult.h"
32 #include "THashList.h"
42 #include "TObjArray.h"
43 #include "TObjString.h"
44 #include "TFileMerger.h"
46 #include "AliCounterCollection.h"
50 TString
GetRunList(
const char *runList, TObjArray *runs);
52 Bool_t
GetTriggerLists(
const char *triggerList, TString listFromContainer, TObjArray *triggersB=0, TObjArray *triggersShortName=0);
53 void SetCanvas(TCanvas *canvas, Int_t logy=1);
54 TH1*
ProcessHisto( AliCounterCollection* counter, TString variable, TString selection, TString hName=
"", TString xName=
"", TString yName=
"", Int_t color=1);
55 TH2*
ProcessHisto2D( AliCounterCollection* counter, TString hVariable, TString hVariable2, TString hSelection, TString hName);
56 Int_t
GetIndex(TObjArray *triggersB, Int_t trigNr, Int_t centNr);
60 TCanvas *
ProcessCanvasPhysSelCut(TObjArray *triggersB, TObjArray trigNoPS, TObjArray trigWithPS, TString canvasName);
61 TCanvas *
ProcessCanvasPhysSelCutCentrality(TObjArray *triggersB, TObjArray trigNoPS, TObjArray trigBWithPS, Int_t trigNr, TString canvasName, TString *legendHeader);
62 TCanvas *
ProcessCanvasCentralityPercentile(TObjArray *triggersB, TObjArray trigNoPS, TObjArray trigWithPS, Int_t trigNr, TString canvasName, TString *legendHeader);
63 TCanvas *
ProcessCanvasTracksoverTrigger(TObjArray *triggersB, TObjArray trigSel, TObjArray trackTracker, TObjArray trackTrigger, TObjArray trackMatched, TObjArray trackAll, Int_t trigNr, Int_t centNr, TString canvasName,TString legendHeader=
"");
64 TCanvas *
ProcessCanvasTrackMultB(TObjArray *triggersB, TObjArray trigSel, TObjArray trackTracker, TObjArray trackTrigger, TObjArray trackMatched, Int_t trigNr, Int_t centNr, TString canvasName,TString legendHeader=
"");
65 TCanvas *
ProcessCanvasRatioTrackB(TObjArray *triggersB, TObjArray trigSel, TObjArray trackTracker, TObjArray trackTrigger, TObjArray trackMatched, Int_t trigNr, Int_t centNr, TString canvasName,TString legendHeader=
"");
66 TCanvas *
ProcessCanvasAsymMatched(TObjArray *triggersB, TObjArray trackPosMatched, TObjArray trackNegMatched, TObjArray trackhAllMatched, Int_t trigNr, Int_t centNr, TString canvasName,TString legendHeader=
"");
67 TCanvas *
ProcessCanvasHighPtMuons(TObjArray *triggersB, TObjArray trigSel, TObjArray trackMatchedLowPt, TObjArray trackAllMatchedHightPt, Int_t trigNr, Int_t centNr, TString canvasName,TString legendHeader=
"");
68 TCanvas *
ProcessCanvasBeamGasMatched(TObjArray *triggersB, TObjArray trackBeamGasMatched, TObjArray trackBeamGasMatchedHighPt, TObjArray trackAllMatched, TObjArray trackMatchedHighPt, Int_t trigNr, Int_t centNr, TString canvasName,TString legendHeader=
"");
74 TString
kCentLegendName[
kCentBinMax] ={
"all collisions",
"[0-80%] from V0 amplitude",
"low mult. [60-80%] from V0 amplitude",
"high mult. [0-10%] from V0 amplitude"};
78 void PlotMuonQA(
const char* baseDir,
const char* runList = 0x0,
const char * triggerList = 0x0, Bool_t selectPhysics = kFALSE,
const char *LHCPeriod =
"LHC11c",
const char *QAFileName =
"QAresults.root") {
85 #if defined(__CINT__) && !defined(__MAKECINT__)
86 gSystem->Load(
"libTree");
87 gSystem->Load(
"libGeom");
88 gSystem->Load(
"libVMC");
89 gSystem->Load(
"libPhysics");
90 gSystem->Load(
"libSTEERBase");
91 gSystem->Load(
"libESD");
92 gSystem->Load(
"libAOD");
93 gSystem->Load(
"libANALYSIS");
94 gSystem->Load(
"libANALYSISalice");
95 gSystem->Load(
"libCORRFW");
96 gSystem->Load(
"libPWGHFbase");
97 gSystem->Load(
"libPWGmuon");
101 gStyle->SetFillColor(10);
102 gStyle->SetPadGridX(kTRUE);
103 gStyle->SetPadGridY(kTRUE);
104 gStyle->SetPadRightMargin(0.01);
106 TString OutFileName =
"QA_"; OutFileName += LHCPeriod;
107 TString OutFileNamePDF= OutFileName.Data(); OutFileNamePDF+=
".pdf";
108 TString OutFileNamePDF_open = OutFileNamePDF.Data(); OutFileNamePDF_open +=
"[";
109 TString OutFileNamePDF_close= OutFileNamePDF.Data(); OutFileNamePDF_close +=
"]";
110 TString OutFileNameROOT= OutFileName.Data(); OutFileNameROOT+=
".root";
116 gEnv->SetValue(
"XNet.ConnectTimeout",10);
117 gEnv->SetValue(
"XNet.RequestTimeout",10);
118 gEnv->SetValue(
"XNet.MaxRedirectCount",2);
119 gEnv->SetValue(
"XNet.ReconnectTimeout",10);
120 gEnv->SetValue(
"XNet.FirstConnectMaxCnt",1);
123 TH1::AddDirectory(kFALSE);
125 TString alienBaseDir = baseDir;
127 if (alienBaseDir.Contains(
"alien:") && !TGrid::Connect(
"alien://")) {
128 Error(
"MergeQA",
"cannot connect to grid");
132 cout<<
"//---------------------------------- //"<<endl;
133 cout<<
"// Run selection //"<<endl;
134 cout<<
"//---------------------------------- //"<<endl;
136 TObjArray *runs =
new TObjArray();
137 runs->SetOwner(kTRUE);
138 TString selectRuns =
GetRunList(runList,runs);
141 TString select = selectPhysics ?
"selected:yes" :
"";
143 cout<<
"//---------------------------------- //"<<endl;
144 cout<<
"// Get global counter //"<<endl;
145 cout<<
"//---------------------------------- //"<<endl;
147 TString mergedFilename = Form(
"%s/%s", baseDir,QAFileName);
150 TFile *globalFile = TFile::Open(mergedFilename.Data());
151 if (!globalFile || ! globalFile->IsOpen()) {
152 Error(
"PlotQA",
"failed to open file: %s", mergedFilename.Data());
155 globalFile->Cd(
"MUON_QA");
160 AliCounterCollection* eventCounters =
static_cast<AliCounterCollection*
>(globalFile->FindObjectAny(
"eventCounters"));
161 AliCounterCollection* trackCounters =
static_cast<AliCounterCollection*
>(globalFile->FindObjectAny(
"trackCounters"));
164 if (!runList) selectRuns += trackCounters->GetKeyWords(
"run");
166 cout<<
"//---------------------------------- //"<<endl;
167 cout<<
"// Trigger selection //"<<endl;
168 cout<<
"//---------------------------------- //"<<endl;
170 TObjArray *triggersB, *triggersShortName;
171 triggersB =
new TObjArray();
172 triggersB->SetOwner();
173 triggersShortName =
new TObjArray();
174 triggersShortName->SetOwner();
176 TString listFromContainer = eventCounters->GetKeyWords(
"trigger");
177 Bool_t success =
GetTriggerLists(triggerList, listFromContainer, triggersB, triggersShortName);
180 cout<<
"//---------------------------------- //"<<endl;
181 cout<<
"// Set collision type ? //"<<endl;
182 cout<<
"//---------------------------------- //"<<endl;
184 Bool_t isHeavyIon = kTRUE;
187 cout<<
"//---------------------------------- //"<<endl;
188 cout<<
"// Trigger plots //"<<endl;
189 cout<<
"//---------------------------------- //"<<endl;
192 TString CanvasName =
"AllTriggers";
195 cout<<
"//---------------------------------- //"<<endl;
196 cout<<
"// Processing event counters //"<<endl;
197 cout<<
"//---------------------------------- //"<<endl;
201 TCanvas *c1 =
new TCanvas(CanvasName.Data(),CanvasName.Data());
205 TString selectionCent;
207 Int_t *colorTab =
new Int_t[triggersB->GetEntriesFast()];
208 Int_t
const colorNrFirst = 8;
209 Int_t colorIndex = 0;
210 Int_t colorTabFirst[colorNrFirst] = {kGray+2,kRed,kBlue,kGreen,kOrange,kCyan,kMagenta,kYellow};
211 for ( Int_t i = 0; i < triggersB->GetEntriesFast(); i++ ) {
212 colorTab[i] = colorTabFirst[i] + colorIndex;
213 if ( i%colorNrFirst == 0 ) colorIndex++;
215 TArrayI *colorInd =
new TArrayI( triggersB->GetEntriesFast() );
217 for ( Int_t i = 0; i < triggersB->GetEntriesFast(); i++ ) colorInd->AddAt(colorTab[i],i);
219 Int_t nTrig = triggersB->GetEntriesFast();
221 TObjArray trigNoPS(nTrig*nCentBin);
222 TObjArray trigWithPS(nTrig*nCentBin);
223 TObjArray trigWithPST0Flag(nTrig*nCentBin);
224 TObjArray trigWithPST0SPDFlag(nTrig*nCentBin);
227 TObjArray trackTrigger(nTrig*nCentBin);
228 TObjArray trackTracker(nTrig*nCentBin);
229 TObjArray trackMatched(nTrig*nCentBin);
230 TObjArray trackAll(nTrig*nCentBin);
232 TObjArray trackAllMatched(nTrig*nCentBin);
233 TObjArray trackMatchedLowPt(nTrig*nCentBin);
234 TObjArray trackMatchedHighPt(nTrig*nCentBin);
236 TObjArray trackPosMatched(nTrig*nCentBin);
237 TObjArray trackNegMatched(nTrig*nCentBin);
239 TObjArray trackBeamGasMatched(nTrig*nCentBin);
240 TObjArray trackBeamGasMatchedHighPt(nTrig*nCentBin);
242 cout<<Form(
"Processing for %d triggers...",triggersB->GetEntriesFast()-1)<<endl;
245 for ( Int_t iCentBin = 0; iCentBin < nCentBin; iCentBin++){
249 for(Int_t iTrig = 0; iTrig < triggersB->GetEntriesFast(); iTrig++){
251 TString histoNameBase =
"h_trig", histoName;
252 histoNameBase+= iTrig+1;
254 Int_t index =
GetIndex(triggersB,iTrig,iCentBin);
258 TString triggerName = ( (TObjString*) triggersB->At(iTrig) )->GetString();
259 if(triggerName.EqualTo(
" "))
continue;
261 selection = selectionCent; selection += Form(
"trigger:%s/%s", triggerName.Data(), selectRuns.Data());
263 histoName = histoNameBase;
264 histoName +=
"BNoPS";
265 histo = (TH1*)
ProcessHisto(eventCounters,
"run", selection, histoName,
"",
"Trigger content w/o Phys. Sel.", colorInd->At(iTrig));
266 trigNoPS.AddAt(histo,index);
268 selection = selectionCent; selection += Form(
"trigger:%s/%s/selected:yes", triggerName.Data(), selectRuns.Data());
269 histoName = histoNameBase;
270 histoName +=
"BWithPS";
271 histo = (TH1*)
ProcessHisto(eventCounters,
"run", selection, histoName,
"",
"Trigger content w/ Phys. Sel.", colorInd->At(iTrig));
272 trigWithPS.AddAt(histo,index);
274 selection = selectionCent; selection += Form(
"trigger:%s/%s/selected:yes/t0pileup:no", triggerName.Data(), selectRuns.Data());
275 histoName = histoNameBase;
276 histoName +=
"BWithPST0Flag";
277 histo = (TH1*)
ProcessHisto(eventCounters,
"run", selection, histoName,
"",
"Trigger content w/ Phys. Sel. and no pile up from T0 flag", colorInd->At(iTrig));
278 trigWithPST0Flag.AddAt(histo,index);
280 selection = selectionCent; selection += Form(
"trigger:%s/%s/selected:yes/t0pileup:no/spdpileup:no", triggerName.Data(), selectRuns.Data());
281 histoName = histoNameBase;
282 histoName +=
"BWithPST0SPDFlag";
283 histo = (TH1*)
ProcessHisto(eventCounters,
"run", selection, histoName,
"",
"Trigger content w/ Phys. Sel. and no pile up from T0 and SPD flag", colorInd->At(iTrig));
284 trigWithPST0SPDFlag.AddAt(histo,index);
287 selection = selectionCent; selection += Form(
"track:triggeronly/trigger:%s/%s/%s", triggerName.Data(), selectRuns.Data(), select.Data());
288 histo = (TH1*)
ProcessHisto(trackCounters,
"run", selection,
"");
289 trackTrigger.AddAt(histo,index);
291 selection = selectionCent; selection += Form(
"track:trackeronly/trigger:%s/%s/%s", triggerName.Data(), selectRuns.Data(), select.Data());
292 histo = (TH1*)
ProcessHisto(trackCounters,
"run", selection,
"");
293 trackTracker.AddAt(histo,index);
295 selection = selectionCent; selection += Form(
"track:matched/trigger:%s/%s/%s", triggerName.Data(), selectRuns.Data(), select.Data());
296 histo = (TH1*)
ProcessHisto(trackCounters,
"run", selection,
"");
297 trackMatched.AddAt(histo,index);
299 histo = (TH1*) ( (TH1*) trackTrigger.At(index))->Clone(
"");
300 histo->Add( (TH1*) trackTracker.At(index) );
301 histo->Add( (TH1*) trackMatched.At(index) );
302 trackAll.AddAt(histo,index);
305 if ( iCentBin > 0 )
continue;
307 selection = selectionCent; selection += Form(
"track:matched/trigger:%s/%s/%s/pt:low/acc:in", triggerName.Data() ,selectRuns.Data(), select.Data());
308 histo = (TH1*)
ProcessHisto(trackCounters,
"run", selection,
"");
309 trackMatchedLowPt.AddAt(histo,index);
311 selection = selectionCent; selection += Form(
"track:matched/trigger:%s/%s/%s/pt:high/acc:in", triggerName.Data() ,selectRuns.Data(), select.Data());
312 histo = (TH1*)
ProcessHisto(trackCounters,
"run", selection,
"");
313 trackMatchedHighPt.AddAt(histo,index);
315 selection = selectionCent; selection += Form(
"track:matched/trigger:%s/%s/charge:pos/%s/acc:in",triggerName.Data(), select.Data(),selectRuns.Data());
316 histo = (TH1*)
ProcessHisto(trackCounters,
"run", selection,
"");
317 trackPosMatched.AddAt(histo,index);
319 selection = selectionCent; selection += Form(
"track:matched/trigger:%s/%s/charge:neg/%s/acc:in",triggerName.Data(), select.Data(),selectRuns.Data());
320 histo = (TH1*)
ProcessHisto(trackCounters,
"run", selection,
"");
321 trackNegMatched.AddAt(histo,index);
323 selection = selectionCent; selection += Form(
"track:matched/trigger:%s/%s/%s/acc:in",triggerName.Data(), select.Data(),selectRuns.Data());
324 histo = (TH1*)
ProcessHisto(trackCounters,
"run", selection,
"");
325 trackAllMatched.AddAt(histo,index);
327 selection = selectionCent; selection += Form(
"track:matched/trigger:%s/%s/%s/acc:in/tagTrack:beamGas",triggerName.Data(), select.Data(),selectRuns.Data());
328 histo = (TH1*)
ProcessHisto(trackCounters,
"run", selection,
"");
329 trackBeamGasMatched.AddAt(histo,index);
331 selection = selectionCent; selection += Form(
"track:matched/trigger:%s/%s/%s/acc:in/tagTrack:beamGas/pt:high",triggerName.Data(), select.Data(),selectRuns.Data());
332 histo = (TH1*)
ProcessHisto(trackCounters,
"run", selection,
"");
333 trackBeamGasMatchedHighPt.AddAt(histo,index);
337 if ( selectPhysics) trigSel = trigWithPS;
338 else trigSel = trigNoPS;
341 Int_t count_trigger=0;
342 for(Int_t iTrig = 0; iTrig < triggersB->GetEntriesFast(); iTrig++){
344 Int_t index =
GetIndex(triggersB,iTrig,centBinNr);
345 count_trigger += (
static_cast<TH1*
>(trigNoPS.At(index)))->GetEntries();
347 if(count_trigger<=0)
return;
349 Int_t *NumOfBNoPS =
new Int_t[nCentBin*nTrig];
350 Int_t *NumOfBWithPS =
new Int_t[nCentBin*nTrig];
352 for ( Int_t iCentBin = 0; iCentBin < nCentBin; iCentBin++){
353 for ( Int_t iTrig = 0; iTrig < nTrig; iTrig++){
354 Int_t index =
GetIndex(triggersB,iTrig,iCentBin);
355 NumOfBNoPS[index] = (
static_cast<TH1*
>(trigNoPS.At(index)))->Integral();
356 NumOfBWithPS[index] = (
static_cast<TH1*
>(trigWithPS.At(index)))->Integral();
360 cout<<
"//==================================================================================="<<endl;
361 cout<<
"// Put all plots in a ps file, easier to publish (Twiki)"<<endl;
362 cout<<
"//==================================================================================="<<endl;
364 c1->Print(OutFileNamePDF_open.Data());
365 TFile *rootFileOut = TFile::Open(OutFileNameROOT.Data(),
"RECREATE");
367 TDirectoryFile *dirGlobal =
new TDirectoryFile(
"Global",
"Global",
"",(TDirectory*)rootFileOut->GetMotherDir());
368 cout<<
"dirGlobal mother "<<(dirGlobal->GetMotherDir())->GetName()<<endl;
370 TObjArray *dirTrigger =
new TObjArray();
371 dirTrigger->SetOwner();
372 TObjArray *dirCent =
new TObjArray();
374 for ( Int_t i = 0; i < triggersB->GetEntriesFast()-1 ; i++) {
375 TString currTrigName = ( (TObjString*) triggersShortName->At(i) )->GetString();
376 TDirectoryFile *dirFile =
new TDirectoryFile( currTrigName.Data(),currTrigName.Data(),
"",(TDirectory*)rootFileOut->GetMotherDir() );
377 dirTrigger->AddLast( dirFile );
378 for( Int_t j = 0; j < nCentBin; j++) {
380 TDirectoryFile *dirFileCent =
new TDirectoryFile( centName.Data(),centName.Data(),
"",dirFile );
381 dirCent->AddLast( dirFileCent );
385 cAll->Print(OutFileNamePDF.Data());
389 cout<<
"//==================================================================================="<<endl;
390 cout<<
"// new canvas with the total number of trigger with and without Phys. Sel."<<endl;
391 cout<<
"//==================================================================================="<<endl;
394 cTriggerContent->Print(OutFileNamePDF.Data());
396 cTriggerContent->Write();
397 cTriggerContent->Close();
399 cout<<
"//==================================================================================="<<endl;
400 cout<<
"// new canvas with the relative content of each trigger w/o physics selection"<<endl;
401 cout<<
"//==================================================================================="<<endl;
404 cRelativeTriggerContent->Print(OutFileNamePDF.Data());
406 cRelativeTriggerContent->Write();
407 cRelativeTriggerContent->Close();
410 cout<<
"//==================================================================================="<<endl;
411 cout<<
"// new canvas with effect from physics selection for each trigger "<<endl;
412 cout<<
"//==================================================================================="<<endl;
414 TCanvas *cPhysSelCut = 0x0;
416 cPhysSelCut->Print(OutFileNamePDF.Data());
418 cPhysSelCut->Write();
419 cPhysSelCut->Close();
422 cout<<
"//==================================================================================="<<endl;
423 cout<<
"// new canvas with effect from T0 pile-up flag for each trigger "<<endl;
424 cout<<
"//==================================================================================="<<endl;
426 TCanvas *cPhysSelCutT0Flag = 0x0;
427 cPhysSelCutT0Flag =
ProcessCanvasPhysSelCut(triggersB, trigNoPS, trigWithPST0Flag,
"PhysSelCutOnCollTriggerT0Flag");
428 cPhysSelCutT0Flag->Print(OutFileNamePDF.Data());
430 cPhysSelCutT0Flag->Write();
431 cPhysSelCutT0Flag->Close();
435 cout<<
"//==================================================================================="<<endl;
436 cout<<
"// new canvas with effect from T0 + SPD pile-up flag for each trigger "<<endl;
437 cout<<
"//==================================================================================="<<endl;
439 TCanvas *cPhysSelCutT0SPDFlag = 0x0;
440 cPhysSelCutT0SPDFlag =
ProcessCanvasPhysSelCut(triggersB, trigNoPS, trigWithPST0SPDFlag,
"PhysSelCutOnCollTriggerT0SPDFlag");
441 cPhysSelCutT0SPDFlag->Print(OutFileNamePDF.Data());
443 cPhysSelCutT0SPDFlag->Write();
444 cPhysSelCutT0SPDFlag->Close();
449 TString legendHeader=
"";
453 cout<<
"//==================================================================================="<<endl;
454 cout<<
"// new canvas with effect from physics selection for each trigger and centrality bin (only in heavy-ion) "<<endl;
455 cout<<
"//==================================================================================="<<endl;
457 TCanvas *cPhysSelCutCentrality;
460 for( Int_t iTrig = 0; iTrig < triggersB->GetEntriesFast(); iTrig++){
462 if(iTrig == (triggersB->GetEntriesFast()-1))
continue;
464 canvasName =
"PhysSel_trigger";
465 canvasName += ( (TObjString*) triggersShortName->At(iTrig) )->GetString();
468 cPhysSelCutCentrality->Print(OutFileNamePDF.Data());
469 ( (TDirectoryFile*) dirTrigger->At(iTrig) )->cd();
470 cPhysSelCutCentrality->Write();
471 cPhysSelCutCentrality->Close();
477 cout<<
"//==================================================================================="<<endl;
478 cout<<
"// new canvas for centrality percentile check (only in PbPb) "<<endl;
479 cout<<
"//==================================================================================="<<endl;
481 TCanvas *cCentralityCheck;
484 for ( Int_t iTrig = 0; iTrig < triggersB->GetEntriesFast(); iTrig++){
486 if ( iTrig == (triggersB->GetEntriesFast()-1) )
continue;
488 canvasName =
"CentralityCheck_trigger";
489 canvasName += ( (TObjString*) triggersShortName->At(iTrig) )->GetString();
493 cCentralityCheck->Print(OutFileNamePDF.Data());
494 ( (TDirectoryFile*) dirTrigger->At(iTrig) )->cd();
495 cCentralityCheck->Write();
496 cCentralityCheck->Close();
502 cout<<
"//==================================================================================="<<endl;
503 cout<<
"// Ratio of tracks over trigger type (2 canvases) "<<endl;
504 cout<<
"//==================================================================================="<<endl;
507 TCanvas *cTracksoverTrigger;
508 TCanvas* cTrackMultB;
511 for ( Int_t iCentBin = 0; iCentBin < nCentBin; iCentBin++){
513 legendHeader =
"for ";
516 else legendHeader =
"";
518 for(Int_t iTrig = 0; iTrig < triggersB->GetEntriesFast(); iTrig++){
520 if( iTrig == (triggersB->GetEntriesFast()-1) )
continue;
522 ( (TDirectoryFile*) dirCent->At( iTrig*nCentBin+iCentBin ) )->cd();
524 canvasName =
"RatioTrackTypes_cent";
525 canvasName += iCentBin;
526 canvasName +=
"trigger";
527 canvasName += ( (TObjString*) triggersShortName->At(iTrig) )->GetString();
528 cTracksoverTrigger =
ProcessCanvasTracksoverTrigger(triggersB, trigSel, trackTracker, trackTrigger, trackMatched, trackAll, iTrig, iCentBin, canvasName,legendHeader);
529 cTracksoverTrigger->Print(OutFileNamePDF.Data());
530 cTracksoverTrigger->Write();
531 cTracksoverTrigger->Close();
533 canvasName =
"TrackMult_cent";
534 canvasName += iCentBin;
535 canvasName +=
"trigger";
536 canvasName +=( (TObjString*) triggersShortName->At(iTrig) )->GetString();
537 cTrackMultB=
ProcessCanvasTrackMultB(triggersB, trigSel, trackTracker, trackTrigger, trackMatched, iTrig, iCentBin, canvasName, legendHeader);
538 cTrackMultB->Print(OutFileNamePDF.Data());
539 cTrackMultB->Write();
540 cTrackMultB->Close();
545 cout<<
"//===================================================="<<endl;
546 cout<<
"// Draw matched tracks asymmetry for each trigger "<<endl;
547 cout<<
"//===================================================="<<endl;
550 TCanvas *cAsymMatched;
552 legendHeader =
"for all collisions";
553 for ( Int_t iTrig = 0; iTrig < triggersB->GetEntriesFast(); iTrig++){
555 if ( iTrig == (triggersB->GetEntriesFast()-1) )
continue;
557 ( (TDirectoryFile*) dirTrigger->At( iTrig ) )->cd();
559 canvasName =
"AsymMatched";
560 canvasName +=
"trigger";
561 canvasName +=( (TObjString*) triggersShortName->At(iTrig) )->GetString();
563 cAsymMatched =
ProcessCanvasAsymMatched(triggersB, trackPosMatched, trackNegMatched, trackAllMatched, iTrig, iCentBin, canvasName,legendHeader);
564 cAsymMatched->Print(OutFileNamePDF.Data());
565 cAsymMatched->Write();
566 cAsymMatched->Close();
571 cout<<
"//===================================================================="<<endl;
572 cout<<
"// Draw beam gas contribution to matched tracks for each trigger "<<endl;
573 cout<<
"//===================================================================="<<endl;
576 TCanvas *cBeamGasMatched;
579 for ( Int_t iTrig = 0; iTrig < triggersB->GetEntriesFast(); iTrig++){
581 if ( iTrig == (triggersB->GetEntriesFast()-1))
continue;
583 ( (TDirectoryFile*) dirTrigger->At(iTrig) )->cd();
584 canvasName =
"BeamGasMatched";
585 canvasName +=
"trigger";
586 canvasName +=( (TObjString*) triggersShortName->At(iTrig) )->GetString();
588 cBeamGasMatched=
ProcessCanvasBeamGasMatched(triggersB, trackBeamGasMatched, trackBeamGasMatchedHighPt, trackAllMatched, trackMatchedHighPt, iTrig, iCentBin, canvasName,legendHeader);
589 cBeamGasMatched->Print(OutFileNamePDF.Data());
590 cBeamGasMatched->Write();
591 cBeamGasMatched->Close();
595 cout<<
"//=================================================="<<endl;
596 cout<<
"// Draw high pt tracks per trigger"<<endl;
597 cout<<
"//=================================================="<<endl;
600 TCanvas *cHighPtMuons;
601 legendHeader =
"for all collisions";
603 for ( Int_t iTrig = 0; iTrig < triggersB->GetEntriesFast(); iTrig++){
605 if( iTrig == (triggersB->GetEntriesFast()-1))
continue;
607 ( (TDirectoryFile*) dirTrigger->At( iTrig ) )->cd();
609 canvasName =
"HighPtMuons";
610 canvasName +=
"trigger";
611 canvasName +=( (TObjString*) triggersShortName->At(iTrig) )->GetString();
614 cHighPtMuons =
ProcessCanvasHighPtMuons(triggersB, trigSel, trackMatchedLowPt, trackMatchedHighPt, iTrig, iCentBin, canvasName,legendHeader);
615 cHighPtMuons->Print(OutFileNamePDF.Data());
616 cHighPtMuons->Write();
617 cHighPtMuons->Close();
628 cout << endl << endl;
631 if ( triggersB->At(kCMUS) ) {
635 THashList* labels = (
static_cast<TH1*
>(trigWithPS.At(triggersB->GetEntriesFast()*centBinNr+kCMUS)))->GetXaxis()->GetLabels();
636 TString format(Form(
"\n%%%ds %%9d",0));
640 TObjString* label = 0x0;
641 TIter nextLabel(labels);
642 cout <<
"-------------------------------------------------" << endl;
643 cout <<
"Run Number" <<
"\t Number of "<< ( (TObjString*) triggersB->At(kCMUS) )->GetString()<<
" after Phys. Sel. " << endl ;
644 while ((label = static_cast<TObjString*>(nextLabel()))) {
646 Int_t bin = (Int_t) label->GetUniqueID();
647 printf(format.Data(), label->String().Data(), (Int_t) (static_cast<TH1*>(trigWithPS.At(triggersB->GetEntriesFast()*centBinNr+kCMUS)))->GetBinContent(bin));
649 printf(
"\n========== Total #runs = %d ==============\n",nRuns);
653 cout <<
"-------------------------------------------------" << endl;
654 cout <<
"Total statistic" << endl;
655 cout <<
" " << endl ;
657 cout <<
"-------------------------------------------------------------------" << endl;
658 cout<<
"Number of triggers w/o Phys. Sel./ w/ Phys. Sel (Phys. Sel. cut in %)"<<endl;
659 for(Int_t iTrig = 0; iTrig < triggersB->GetEntriesFast()-1; iTrig++){
660 TString triggerNameB = ( (TObjString*) triggersB->At(iTrig) )->GetString();
662 Int_t cutinpercent = 0;
663 printf(
"%10s\t",triggerNameB.Data());
664 Int_t index =
GetIndex(triggersB,iTrig,centBinNr);
665 if(NumOfBNoPS[index]) cutinpercent = (Int_t) ((Double_t)(NumOfBNoPS[index]-NumOfBWithPS[index])/(NumOfBNoPS[index])*100.);
666 printf(
"%5.2e / %.2e (%d%%)\n", (Double_t) NumOfBNoPS[index],(Double_t) NumOfBWithPS[index],cutinpercent);
684 Int_t
const nMuonTriggerCase = 7;
685 TH1F *hMuonTrigger[nMuonTriggerCase];
686 TString muonTriggerName[nMuonTriggerCase] = {
"Unlike-only",
"Like-only",
"Hpt-only",
"Unlike&Like",
"Unlike&Hpt",
"Like&Hpt",
"Unlike&Like&Hpt"};
687 for ( Int_t i = 0; i < nMuonTriggerCase; i++ ) {
688 hMuonTrigger[i] =
new TH1F(Form(
"hMuonTrigger_%s", muonTriggerName[i].Data()),Form(
"Trigger %s per run",muonTriggerName[i].Data()),10000,1,10000);
691 TH1F* hTriggerCutVsRun[2], *hTriggerCutWidthVsRun[2];
692 for ( Int_t ihisto=0; ihisto<2; ++ihisto ) {
693 TString cutName = ( ihisto == 0 ) ?
"Lpt" :
"Hpt";
694 hTriggerCutVsRun[ihisto] =
new TH1F(Form(
"hTriggerCutVsRun%s", cutName.Data()), Form(
"Trigger %s cut per run", cutName.Data()), 10000,1,10000);
695 hTriggerCutWidthVsRun[ihisto] = (TH1F*)hTriggerCutVsRun[ihisto]->Clone(Form(
"hTriggerCutWidthVsRun%s", cutName.Data()));
697 TF1* fitMatchTrig =
new TF1(
"fitMatchTrig",
"[3] + [0] * ( 1. + TMath::Erf((x - [1]) / [2] / TMath::Sqrt(2.)))", 0.1, 6.);
698 TH1F* hNClustersPerTrackVsRun_Mean =
new TH1F(
"hNClustersPerTrackVsRun_Mean",
"averaged number of associated clusters per track;run;<n_{clusters}>",10000,1,10000);
699 TH1F* hNClustersPerTrackVsRun_Sigma =
new TH1F(
"hNClustersPerTrackVsRun_Sigma",
"dispersion of the number of associated clusters per track;run;#sigma_{n_{clusters}}",10000,1,10000);
700 TH1F* hNChamberHitPerTrack_Mean =
new TH1F(
"hNChamberHitPerTrack_Mean",
"averaged number of chambers hit per track;run;<n_{chamber hit}>",10000,1,10000);
701 TH1F* hNChamberHitPerTrack_Sigma =
new TH1F(
"hNChamberHitPerTrack_Sigma",
"dispersion of the number of chambers hit per track;run;#sigma_{n_{chamber hit}}",10000,1,10000);
702 TH1F* hChi2_Mean =
new TH1F(
"hChi2_Mean",
"averaged normalized #chi^{2} distribution;run;<#chi^{2} / ndf>",10000,1,10000);
703 TH1F* hChi2_Sigma =
new TH1F(
"hChi2_Sigma",
"dispersion of normalized #chi^{2} distribution;run;#sigma_{#chi^{2} / ndf}",10000,1,10000);
704 TH1F* hNClustersInCh[10];
705 for (Int_t ich=0; ich<10; ich++){
706 hNClustersInCh[ich] =
new TH1F(Form(
"hNClustersInCh%d",ich+1), Form(
"averaged number of clusters in chamber %d per track;run;<n_{clusters}>",ich+1),10000,1,10000);
708 TH1F* hClusterChargeMeanInCh[10], *hClusterChargeSigmaInCh[10];
709 for (Int_t ich=0; ich<10; ich++){
710 hClusterChargeMeanInCh[ich] =
new TH1F(Form(
"hClusterChargeMeanInCh%d",ich+1), Form(
"averaged cluster charge -mean- per track in chamber %d",ich+1),10000,1,10000);
711 hClusterChargeSigmaInCh[ich] =
new TH1F(Form(
"hClusterChargeSigmaInCh%d",ich+1), Form(
"averaged cluster charge -sigma- per track in chamber %d",ich+1),10000,1,10000);
713 TH1F* hClusterSizeMeanInCh[10], *hClusterSizeSigmaInCh[10];
714 for (Int_t ich=0; ich<10; ich++){
715 hClusterSizeMeanInCh[ich] =
new TH1F(Form(
"hClusterSizeMeanInCh%d",ich+1), Form(
"averaged cluster size -mean- per track in chamber %d",ich+1),10000,1,10000);
716 hClusterSizeSigmaInCh[ich] =
new TH1F(Form(
"hClusterSizeSigmaInCh%d",ich+1), Form(
"averaged cluster size -sigma- per track in chamber %d",ich+1),10000,1,10000);
719 TH1F* hClusterHitMapXInCh[10];
720 for (Int_t ich=0; ich<10; ich++){
721 hClusterHitMapXInCh[ich] =
new TH1F(Form(
"hClusterHitMapXInCh%d",ich+1), Form(
"averaged cluster position distribution in chamber %d;X (cm)",ich+1),10000,1,10000);
723 TH1F* hClusterHitMapYInCh[10];
724 for (Int_t ich=0; ich<10; ich++){
725 hClusterHitMapYInCh[ich] =
new TH1F(Form(
"hClusterHitMapYInCh%d",ich+1), Form(
"averaged cluster position distribution in chamber %d;Y (cm)",ich+1),10000,1,10000);
732 Int_t isAlienFile = 0;
733 if(alienBaseDir.Contains(
"alien:")){
735 alienBaseDir.ReplaceAll(
"alien://",
"");
738 cout<<
"============================================================"<<endl;
739 cout<<
"Monitoring quantities run per run: loop over "<<runs->GetEntriesFast()<<
" runs."<<endl;
740 cout<<
" directory = "<<alienBaseDir.Data()<<endl;
741 cout<<
"============================================================"<<endl;
744 for ( Int_t irun=0; irun<runs->GetEntriesFast(); irun++ ) {
746 TString run = ((TObjString*)runs->UncheckedAt(irun))->GetString();
750 TGridResult *res = 0;
753 command = Form(
"find %s/ %s/%s", alienBaseDir.Data(), run.Data(), QAFileName);
754 res = gGrid->Command(command);
756 Error(
"PlotMuonQA",
"no result for the command: %s",command.Data());
761 res =
new TGridResult();
763 command = Form(
"find %s/*%s/ -name %s | xargs", alienBaseDir.Data(), run.Data(), QAFileName);
764 TString foundFiles = gSystem->GetFromPipe(command.Data());
765 TObjArray* arr = foundFiles.Tokenize(
" ");
767 for ( Int_t iarr=0; iarr<arr->GetEntries(); iarr++ ) {
768 res->Add(
new TObjString(arr->At(iarr)->GetName()));
775 TObjString *objs = 0;
776 TObject* currObj = 0x0;
777 Bool_t searchRunNr = kFALSE;
778 if ( !isAlienFile && run.Contains(
"*") ) searchRunNr = kTRUE;
781 while ( ( currObj = nextmap() ) ){
785 objs =
static_cast<TObjString*
>(
static_cast<TMap*
>(currObj)->GetValue(
"turl"));
788 objs=
static_cast<TObjString*
>(currObj);
791 if (objs->GetString().IsNull()) {
792 Error(
"PlotMuonQA",
"turl/obj not found for the run %s... SKIPPING", run.Data());
798 if (runNr > 0) run = Form(
"%i",runNr);
801 if ( run.IsDigit() && ! selectRuns.Contains(Form(
"%i",run.Atoi())) )
continue;
804 TFile *runFile = TFile::Open(objs->GetString());
805 if (!runFile || ! runFile->IsOpen()) {
806 Error(
"PlotMuonQA",
"failed to open file: %s", objs->GetName());
809 runFile->Cd(
"MUON_QA");
812 TObjArray* general1 =
static_cast<TObjArray*
>(runFile->FindObjectAny(
"general1"));
813 TObjArray* general2 =
static_cast<TObjArray*
>(runFile->FindObjectAny(
"general2"));
814 TObjArray* expert =
static_cast<TObjArray*
>(runFile->FindObjectAny(
"expert"));
816 if (!general1 || !general2 || !expert){
817 Error(
"PlotMuonQA",
"All objects not here !!! ===> Skipping...for %s",objs->GetName());
821 TH1* hNClustersPerTrack =
static_cast<TH1*
>(general1->FindObject(
"hNClustersPerTrack"));
822 TH1* hNChamberHitPerTrack =
static_cast<TH1*
>(general1->FindObject(
"hNChamberHitPerTrack"));
823 TH1* hChi2 =
static_cast<TH1*
>(general1->FindObject(
"hChi2"));
824 TH1* hNClustersPerCh =
static_cast<TH1*
>(general2->FindObject(
"hNClustersPerCh"));
825 TH1 *hClusterChargePerChMean =
static_cast<TH1*
>(general2->FindObject(
"hClusterChargePerChMean"));
826 TH1 *hClusterChargePerChSigma =
static_cast<TH1*
>(general2->FindObject(
"hClusterChargePerChSigma"));
827 TH1 *hClusterSizePerChMean =
static_cast<TH1*
>(general2->FindObject(
"hClusterSizePerChMean"));
828 TH1 *hClusterSizePerChSigma =
static_cast<TH1*
>(general2->FindObject(
"hClusterSizePerChSigma"));
829 TH1* hMuonTriggers =
static_cast<TH1*
>(general1->FindObject(
"hMuonTriggers"));
830 for (Int_t ihisto=0; ihisto<nMuonTriggerCase; ihisto++){
832 if ( hMuonTriggers ) val = hMuonTriggers->GetBinContent(ihisto+2);
833 if ( hMuonTrigger[ihisto]->GetSumw2N() == 0 ) hMuonTrigger[ihisto]->Sumw2();
834 hMuonTrigger[ihisto]->SetBinContent(ibin,val);
835 hMuonTrigger[ihisto]->SetBinError(ibin,TMath::Sqrt(val));
836 hMuonTrigger[ihisto]->GetXaxis()->SetBinLabel(ibin,run.Data());
838 TH1* hPtDistrib =
static_cast<TH1*
>(general1->FindObject(
"hPt"));
839 TH1* hPtDistribLpt =
static_cast<TH1*
>(general1->FindObject(
"hPtMatchLpt"));
840 TH1* hPtDistribHpt =
static_cast<TH1*
>(general1->FindObject(
"hPtMatchHpt"));
841 if ( hPtDistrib && hPtDistribLpt && hPtDistribHpt ) {
842 if ( hPtDistrib->GetSumw2N() == 0 ) hPtDistrib->Sumw2();
843 TH1* histoMatch[2] = {hPtDistribLpt, hPtDistribHpt};
844 for ( Int_t ihisto=0; ihisto<2; ++ihisto ) {
845 if ( histoMatch[ihisto]->GetSumw2N() == 0 ) histoMatch[ihisto]->Sumw2();
846 if ( histoMatch[ihisto]->GetEntries() == 0 )
continue;
847 histoMatch[ihisto]->Divide(hPtDistrib);
848 Double_t minEff = 99999., maxEff = -1.;
849 Double_t ptMinFit = 0.1;
850 Double_t ptMaxFit = 6.;
851 Int_t ptBinLow = histoMatch[ihisto]->GetXaxis()->FindBin(ptMinFit);
852 Int_t ptBinHigh = histoMatch[ihisto]->GetXaxis()->FindBin(ptMaxFit);
853 for ( Int_t currBin=ptBinLow; currBin<=ptBinHigh; currBin++ ) {
854 Double_t currEff = histoMatch[ihisto]->GetBinContent(currBin);
855 Double_t currPt = histoMatch[ihisto]->GetXaxis()->GetBinCenter(currBin);
856 if ( currPt < 1.5 && minEff > currEff ) {
860 if ( currPt > 0.5 && maxEff < currEff ) {
865 fitMatchTrig->SetParameters(0.5, 0.5, 0.8, 0.2);
866 fitMatchTrig->SetParLimits(0,0.,1.);
867 fitMatchTrig->SetParLimits(1,0.,5.);
868 fitMatchTrig->SetParLimits(2,0.,5.);
869 fitMatchTrig->SetParLimits(3,0.,0.5);
870 histoMatch[ihisto]->Fit(fitMatchTrig,
"RQ0",
"",ptMinFit,ptMaxFit);
871 Double_t ptCut = fitMatchTrig->GetParameter(1);
872 Double_t ptCutErr = fitMatchTrig->GetParError(1);
873 Double_t ptCutWidth = fitMatchTrig->GetParameter(2);
874 if ( ptCut < 0 || ptCut > 10. ) {
875 ptCut = ptCutErr = ptCutWidth = 0.;
877 hTriggerCutVsRun[ihisto]->SetBinContent(ibin, ptCut);
878 hTriggerCutVsRun[ihisto]->SetBinError(ibin, ptCutErr);
879 hTriggerCutWidthVsRun[ihisto]->SetBinContent(ibin, ptCut);
880 hTriggerCutWidthVsRun[ihisto]->SetBinError(ibin, ptCutWidth);
883 TH2* hClusterHitMapInCh[10];
884 for(Int_t ich=0; ich<10; ich++) hClusterHitMapInCh[ich] = static_cast<TH2*>(expert->FindObject(Form(
"hClusterHitMapInCh%d",ich+1)));
886 if (!hNClustersPerCh) {
887 Warning(
"PlotMUONQA",
"File: %s has empty histograms !", objs->GetName());
888 hNClustersPerTrackVsRun_Mean->SetBinContent(ibin, 0.);
889 hNClustersPerTrackVsRun_Mean->SetBinError(ibin, 1.);
890 hNClustersPerTrackVsRun_Sigma->SetBinContent(ibin, 0.);
891 hNClustersPerTrackVsRun_Sigma->SetBinError(ibin, 1.);
892 hNChamberHitPerTrack_Mean->SetBinContent(ibin, 0.);
893 hNChamberHitPerTrack_Mean->SetBinError(ibin, 1.);
894 hNChamberHitPerTrack_Sigma->SetBinContent(ibin, 0.);
895 hNChamberHitPerTrack_Sigma->SetBinError(ibin, 1.);
896 hChi2_Mean->SetBinContent(ibin, 0.);
897 hChi2_Mean->SetBinError(ibin, 1.);
898 hChi2_Sigma->SetBinContent(ibin, 0.);
899 hChi2_Sigma->SetBinError(ibin, 1.);
900 for (Int_t ich=0; ich<10; ich++) {
901 hNClustersInCh[ich]->SetBinContent(ibin,0.);
902 hNClustersInCh[ich]->SetBinError(ibin,1.);
903 hClusterHitMapXInCh[ich]->SetBinContent(ibin,0.);
904 hClusterHitMapXInCh[ich]->SetBinError(ibin,1.);
905 hClusterHitMapYInCh[ich]->SetBinContent(ibin,0.);
906 hClusterHitMapYInCh[ich]->SetBinError(ibin,1.);
913 hNClustersPerTrackVsRun_Mean->SetBinContent(ibin, hNClustersPerTrack->GetMean());
914 hNClustersPerTrackVsRun_Mean->SetBinError(ibin, hNClustersPerTrack->GetMeanError());
915 hNClustersPerTrackVsRun_Sigma->SetBinContent(ibin, hNClustersPerTrack->GetRMS());
916 hNClustersPerTrackVsRun_Sigma->SetBinError(ibin, hNClustersPerTrack->GetRMSError());
917 hNChamberHitPerTrack_Mean->SetBinContent(ibin, hNChamberHitPerTrack->GetMean());
918 hNChamberHitPerTrack_Mean->SetBinError(ibin, hNChamberHitPerTrack->GetMeanError());
919 hNChamberHitPerTrack_Sigma->SetBinContent(ibin, hNChamberHitPerTrack->GetRMS());
920 hNChamberHitPerTrack_Sigma->SetBinError(ibin, hNChamberHitPerTrack->GetRMSError());
921 hChi2_Mean->SetBinContent(ibin, hChi2->GetMean());
922 hChi2_Mean->SetBinError(ibin, hChi2->GetMeanError());
923 hChi2_Sigma->SetBinContent(ibin, hChi2->GetRMS());
924 hChi2_Sigma->SetBinError(ibin, hChi2->GetRMSError());
925 for (Int_t ich=0; ich<10; ich++) {
926 hNClustersInCh[ich]->SetBinContent(ibin,hNClustersPerCh->GetBinContent(ich+1));
927 hNClustersInCh[ich]->SetBinError(ibin,hNClustersPerCh->GetBinError(ich+1));
928 hClusterChargeMeanInCh[ich]->SetBinContent(ibin,hClusterChargePerChMean->GetBinContent(ich+1));
929 hClusterChargeMeanInCh[ich]->SetBinError(ibin,hClusterChargePerChMean->GetBinError(ich+1));
930 hClusterChargeSigmaInCh[ich]->SetBinContent(ibin,hClusterChargePerChSigma->GetBinContent(ich+1));
931 hClusterChargeSigmaInCh[ich]->SetBinError(ibin,hClusterChargePerChSigma->GetBinError(ich+1));
932 hClusterSizeMeanInCh[ich]->SetBinContent(ibin,hClusterSizePerChMean->GetBinContent(ich+1));
933 hClusterSizeMeanInCh[ich]->SetBinError(ibin,hClusterSizePerChMean->GetBinError(ich+1));
934 hClusterSizeSigmaInCh[ich]->SetBinContent(ibin,hClusterSizePerChSigma->GetBinContent(ich+1));
935 hClusterSizeSigmaInCh[ich]->SetBinError(ibin,hClusterSizePerChSigma->GetBinError(ich+1));
936 hNClustersInCh[ich]->SetBinContent(ibin,hNClustersPerCh->GetBinContent(ich+1));
937 hNClustersInCh[ich]->SetBinError(ibin,hNClustersPerCh->GetBinError(ich+1));
938 hClusterHitMapXInCh[ich]->SetBinContent(ibin,hClusterHitMapInCh[ich]->GetMean(1));
939 hClusterHitMapXInCh[ich]->SetBinError(ibin,hClusterHitMapInCh[ich]->GetMeanError(1));
940 hClusterHitMapYInCh[ich]->SetBinContent(ibin,hClusterHitMapInCh[ich]->GetMean(2));
941 hClusterHitMapYInCh[ich]->SetBinError(ibin,hClusterHitMapInCh[ich]->GetMeanError(2));
946 for ( Int_t ihisto=0; ihisto<2; ++ihisto ) {
947 hTriggerCutVsRun[ihisto]->GetXaxis()->SetBinLabel(ibin,run.Data());
948 hTriggerCutWidthVsRun[ihisto]->GetXaxis()->SetBinLabel(ibin,run.Data());
950 hNClustersPerTrackVsRun_Mean->GetXaxis()->SetBinLabel(ibin, run.Data());
951 hNClustersPerTrackVsRun_Sigma->GetXaxis()->SetBinLabel(ibin, run.Data());
952 hNChamberHitPerTrack_Mean->GetXaxis()->SetBinLabel(ibin, run.Data());
953 hNChamberHitPerTrack_Sigma->GetXaxis()->SetBinLabel(ibin, run.Data());
954 hChi2_Mean->GetXaxis()->SetBinLabel(ibin, run.Data());
955 hChi2_Sigma->GetXaxis()->SetBinLabel(ibin, run.Data());
956 for (Int_t ich=0; ich<10; ich++){
957 hNClustersInCh[ich]->GetXaxis()->SetBinLabel(ibin, run.Data());
958 hClusterChargeMeanInCh[ich]->GetXaxis()->SetBinLabel(ibin, run.Data());
959 hClusterChargeSigmaInCh[ich]->GetXaxis()->SetBinLabel(ibin, run.Data());
960 hClusterSizeMeanInCh[ich]->GetXaxis()->SetBinLabel(ibin, run.Data());
961 hClusterSizeSigmaInCh[ich]->GetXaxis()->SetBinLabel(ibin, run.Data());
962 hClusterHitMapXInCh[ich]->GetXaxis()->SetBinLabel(ibin, run.Data());
963 hClusterHitMapYInCh[ich]->GetXaxis()->SetBinLabel(ibin, run.Data());
975 hNClustersPerTrackVsRun_Mean->LabelsOption(
"a");
976 hNClustersPerTrackVsRun_Sigma->LabelsOption(
"a");
977 hNChamberHitPerTrack_Mean->LabelsOption(
"a");
978 hNChamberHitPerTrack_Sigma->LabelsOption(
"a");
979 hChi2_Mean->LabelsOption(
"a");
980 hChi2_Sigma->LabelsOption(
"a");
982 for(Int_t ich=0; ich<10; ich++){
983 hNClustersInCh[ich]->LabelsOption(
"a");
984 hClusterChargeMeanInCh[ich]->LabelsOption(
"a");
985 hClusterChargeSigmaInCh[ich]->LabelsOption(
"a");
986 hClusterSizeMeanInCh[ich]->LabelsOption(
"a");
987 hClusterSizeSigmaInCh[ich]->LabelsOption(
"a");
988 hClusterHitMapXInCh[ich]->LabelsOption(
"a");
989 hClusterHitMapYInCh[ich]->LabelsOption(
"a");
992 TString dirToGo = OutFileNameROOT.Data(); dirToGo+=
":/";
993 gDirectory->Cd(dirToGo.Data());
994 cout<<
"=================================================="<<endl;
995 cout<<
"Display Mean and Sigma of the number of associated clusters to a track "<<endl;
996 cout<<
"=================================================="<<endl;
997 TLegend *lNClusters =
new TLegend(0.75,0.85,0.99,0.99);
998 lNClusters->AddEntry(hNClustersPerTrackVsRun_Mean,
"clusters",
"PL");
999 lNClusters->AddEntry(hNChamberHitPerTrack_Mean,
"chamber hit",
"PL");
1001 TCanvas* cNClusters =
new TCanvas(
"cNClusters",
"cNClusters",1200,900);
1002 cNClusters->Divide(1,2);
1005 hNClustersPerTrackVsRun_Mean->SetMinimum(7);
1006 hNClustersPerTrackVsRun_Mean->SetStats(kFALSE);
1007 hNClustersPerTrackVsRun_Mean->GetXaxis()->SetRange(1,ibin-1);
1008 hNClustersPerTrackVsRun_Mean->GetXaxis()->SetNdivisions(1,kFALSE);
1010 hNClustersPerTrackVsRun_Mean->SetLabelSize(0.04);
1011 hNClustersPerTrackVsRun_Mean->SetTitle(
"averaged number of associated clusters or of the number of chamber hit per track");
1012 hNClustersPerTrackVsRun_Mean->SetLineWidth(2);
1013 hNClustersPerTrackVsRun_Mean->Draw(
"e");
1014 hNChamberHitPerTrack_Mean->SetLineColor(kRed);
1015 hNChamberHitPerTrack_Mean->SetLineWidth(2);
1016 hNChamberHitPerTrack_Mean->Draw(
"esame");
1017 lNClusters->Draw(
"same");
1021 hNClustersPerTrackVsRun_Sigma->SetMinimum(0.4);
1022 hNClustersPerTrackVsRun_Sigma->SetStats(kFALSE);
1023 hNClustersPerTrackVsRun_Sigma->GetXaxis()->SetRange(1,ibin-1);
1024 hNClustersPerTrackVsRun_Sigma->GetXaxis()->SetNdivisions(1,kFALSE);
1026 hNClustersPerTrackVsRun_Sigma->SetLabelSize(0.04);
1027 hNClustersPerTrackVsRun_Sigma->SetTitle(
"dispersion of the number of associated clusters or of the number of chamber hit per track");
1028 hNClustersPerTrackVsRun_Sigma->SetLineWidth(2);
1029 hNClustersPerTrackVsRun_Sigma->Draw(
"e");
1030 hNChamberHitPerTrack_Sigma->SetLineWidth(2);
1031 hNChamberHitPerTrack_Sigma->SetLineColor(kRed);
1032 hNChamberHitPerTrack_Sigma->Draw(
"esame");
1033 lNClusters->Draw(
"same");
1035 cNClusters->Print(OutFileNamePDF.Data());
1037 cNClusters->Write();
1039 cout<<
"=================================================="<<endl;
1040 cout<<
" Display average number of cluster per chamber "<<endl;
1041 cout<<
"=================================================="<<endl;
1043 TLegend *lNClustersPerCh =
new TLegend(0.92,0.45,0.99,0.99);
1044 TCanvas* cNClustersPerCh =
new TCanvas(
"cNClustersPerCh",
"cNClustersPerCh",1200,900);
1045 cNClustersPerCh->cd();
1046 cNClustersPerCh->SetRightMargin(0.1);
1047 hNClustersInCh[0]->SetStats(kFALSE);
1048 hNClustersInCh[0]->GetXaxis()->SetRange(1,ibin-1);
1049 hNClustersInCh[0]->GetXaxis()->SetNdivisions(1,kFALSE);
1051 hNClustersInCh[0]->SetLabelSize(0.02);
1052 hNClustersInCh[0]->SetTitle(
"averaged number of clusters in chamber i per track");
1053 hNClustersInCh[0]->SetMaximum(1.2);
1054 hNClustersInCh[0]->SetMinimum(0.01);
1055 for (Int_t ich=0; ich<10; ich++) {
1056 hNClustersInCh[ich]->SetLineColor(ich+1+ich/9);
1057 hNClustersInCh[ich]->SetLineWidth(2);
1058 if (ich == 0) hNClustersInCh[ich]->Draw(
"e");
1059 else hNClustersInCh[ich]->Draw(
"esame");
1060 lNClustersPerCh->AddEntry(hNClustersInCh[ich],Form(
"ch%d",ich+1),
"PL");
1062 lNClustersPerCh->Draw(
"same");
1064 cNClustersPerCh->Print(OutFileNamePDF.Data());
1066 cNClustersPerCh->Write();
1068 cout<<
"=================================================="<<endl;
1069 cout<<
" Display average cluster charge per chamber "<<endl;
1070 cout<<
"=================================================="<<endl;
1072 TLegend *lClusterChargePerCh =
new TLegend(0.92,0.45,0.99,0.99);
1073 TCanvas* cClusterChargePerCh =
new TCanvas(
"cClustersChargePerCh",
"cClustersChargePerCh",1200,900);
1074 cClusterChargePerCh->SetRightMargin(0.1);
1075 cClusterChargePerCh->Divide(1,2);
1077 cClusterChargePerCh->cd(1);
1078 hClusterChargeMeanInCh[0]->SetStats(kFALSE);
1079 hClusterChargeMeanInCh[0]->GetXaxis()->SetRange(1,ibin-1);
1080 hClusterChargeMeanInCh[0]->GetXaxis()->SetNdivisions(1,kFALSE);
1082 hClusterChargeMeanInCh[0]->SetLabelSize(0.04);
1083 hClusterChargeMeanInCh[0]->SetTitle(
"Cluster charge mean (fC) per track in chamber i");
1084 hClusterChargeMeanInCh[0]->SetMaximum(150);
1085 hClusterChargeMeanInCh[0]->SetMinimum(30);
1086 for (Int_t ich=0; ich<10; ich++) {
1087 hClusterChargeMeanInCh[ich]->SetLineColor(ich+1+ich/9);
1088 hClusterChargeMeanInCh[ich]->SetLineWidth(2);
1089 if (ich == 0) hClusterChargeMeanInCh[ich]->Draw(
"e");
1090 else hClusterChargeMeanInCh[ich]->Draw(
"esame");
1091 lClusterChargePerCh->AddEntry(hClusterChargeMeanInCh[ich],Form(
"ch%d",ich+1),
"PL");
1093 lClusterChargePerCh->Draw(
"same");
1095 cClusterChargePerCh->cd(2);
1096 hClusterChargeSigmaInCh[0]->SetStats(kFALSE);
1097 hClusterChargeSigmaInCh[0]->GetXaxis()->SetRange(1,ibin-1);
1098 hClusterChargeSigmaInCh[0]->GetXaxis()->SetNdivisions(1,kFALSE);
1100 hClusterChargeSigmaInCh[0]->SetLabelSize(0.04);
1101 hClusterChargeSigmaInCh[0]->SetTitle(
"Cluster charge sigma per track in chamber i");
1102 hClusterChargeSigmaInCh[0]->SetMaximum(250);
1103 hClusterChargeSigmaInCh[0]->SetMinimum(50);
1104 for (Int_t ich=0; ich<10; ich++) {
1105 hClusterChargeSigmaInCh[ich]->SetLineColor(ich+1+ich/9);
1106 hClusterChargeSigmaInCh[ich]->SetLineWidth(2);
1107 if (ich == 0) hClusterChargeSigmaInCh[ich]->Draw(
"e");
1108 else hClusterChargeSigmaInCh[ich]->Draw(
"esame");
1110 lClusterChargePerCh->Draw(
"same");
1112 cClusterChargePerCh->Print(OutFileNamePDF.Data());
1114 cClusterChargePerCh->Write();
1116 cout<<
"=================================================="<<endl;
1117 cout<<
" Display average cluster size per chamber "<<endl;
1118 cout<<
"=================================================="<<endl;
1120 TLegend *lClusterSizePerCh =
new TLegend(0.92,0.45,0.99,0.99);
1121 TCanvas* cClusterSizePerCh =
new TCanvas(
"cClustersSizePerCh",
"cClustersSizePerCh",1200,900);
1122 cClusterSizePerCh->SetRightMargin(0.1);
1123 cClusterSizePerCh->Divide(1,2);
1125 cClusterSizePerCh->cd(1);
1126 hClusterSizeMeanInCh[0]->SetStats(kFALSE);
1127 hClusterSizeMeanInCh[0]->GetXaxis()->SetRange(1,ibin-1);
1128 hClusterSizeMeanInCh[0]->GetXaxis()->SetNdivisions(1,kFALSE);
1130 hClusterSizeMeanInCh[0]->SetLabelSize(0.04);
1131 hClusterSizeMeanInCh[0]->SetTitle(
"Cluster size mean (npads) per track in chamber i");
1132 hClusterSizeMeanInCh[0]->SetMaximum(18);
1133 hClusterSizeMeanInCh[0]->SetMinimum(0);
1134 for (Int_t ich=0; ich<10; ich++) {
1135 hClusterSizeMeanInCh[ich]->SetLineColor(ich+1+ich/9);
1136 hClusterSizeMeanInCh[ich]->SetLineWidth(2);
1137 if (ich == 0) hClusterSizeMeanInCh[ich]->Draw(
"e");
1138 else hClusterSizeMeanInCh[ich]->Draw(
"esame");
1139 lClusterSizePerCh->AddEntry(hClusterSizeMeanInCh[ich],Form(
"ch%d",ich+1),
"PL");
1141 lClusterSizePerCh->Draw(
"same");
1143 cClusterSizePerCh->cd(2);
1144 hClusterSizeSigmaInCh[0]->SetStats(kFALSE);
1145 hClusterSizeSigmaInCh[0]->GetXaxis()->SetRange(1,ibin-1);
1146 hClusterSizeSigmaInCh[0]->GetXaxis()->SetNdivisions(1,kFALSE);
1148 hClusterSizeSigmaInCh[0]->SetLabelSize(0.04);
1149 hClusterSizeSigmaInCh[0]->SetTitle(
"Cluster size sigma (npads) per track in chamber i");
1150 hClusterSizeSigmaInCh[0]->SetMaximum(7);
1151 hClusterSizeSigmaInCh[0]->SetMinimum(0);
1152 for (Int_t ich=0; ich<10; ich++) {
1153 hClusterSizeSigmaInCh[ich]->SetLineColor(ich+1+ich/9);
1154 hClusterSizeSigmaInCh[ich]->SetLineWidth(2);
1155 if (ich == 0) hClusterSizeSigmaInCh[ich]->Draw(
"e");
1156 else hClusterSizeSigmaInCh[ich]->Draw(
"esame");
1158 lClusterSizePerCh->Draw(
"same");
1160 cClusterSizePerCh->Print(OutFileNamePDF.Data());
1162 cClusterSizePerCh->Write();
1165 cout<<
"=================================================="<<endl;
1166 cout<<
"Display average X and Y position of clusters per chamber"<<endl;
1167 cout<<
"=================================================="<<endl;
1168 TLegend *lClusterHitMapPerCh =
new TLegend(0.92,0.45,0.99,0.99);
1169 TCanvas* cClusterHitMapPerCh =
new TCanvas(
"cClusterHitMapPerCh",
"cClusterHitMapPerCh",1200,900);
1170 cClusterHitMapPerCh->Divide(1,2);
1171 cClusterHitMapPerCh->GetPad(1)->SetRightMargin(0.1);
1172 cClusterHitMapPerCh->GetPad(2)->SetRightMargin(0.1);
1174 cClusterHitMapPerCh->cd(1);
1175 hClusterHitMapXInCh[0]->SetStats(kFALSE);
1176 hClusterHitMapXInCh[0]->GetXaxis()->SetRange(1,ibin-1);
1177 hClusterHitMapXInCh[0]->GetXaxis()->SetNdivisions(1,kFALSE);
1179 hClusterHitMapXInCh[0]->SetLabelSize(0.04);
1180 hClusterHitMapXInCh[0]->SetTitle(
"<X> of clusters - associated to a track - in chamber i");
1181 hClusterHitMapXInCh[0]->SetMaximum(30);
1182 hClusterHitMapXInCh[0]->SetMinimum(-30);
1183 for (Int_t ich=0; ich<10; ich++) {
1184 hClusterHitMapXInCh[ich]->SetLineColor(ich+1+ich/9);
1185 hClusterHitMapXInCh[ich]->SetLineWidth(2);
1186 if (ich == 0) hClusterHitMapXInCh[ich]->Draw(
"e");
1187 else hClusterHitMapXInCh[ich]->Draw(
"esame");
1189 lClusterHitMapPerCh->AddEntry(hClusterHitMapXInCh[ich],Form(
"ch%d",ich+1),
"PL");
1191 lClusterHitMapPerCh->Draw(
"same");
1193 cClusterHitMapPerCh->cd(2);
1194 hClusterHitMapYInCh[0]->SetStats(kFALSE);
1195 hClusterHitMapYInCh[0]->GetXaxis()->SetRange(1,ibin-1);
1196 hClusterHitMapYInCh[0]->GetXaxis()->SetNdivisions(1,kFALSE);
1198 hClusterHitMapYInCh[0]->SetLabelSize(0.04);
1199 hClusterHitMapYInCh[0]->SetTitle(
"<Y> of clusters - associated to a track - in chamber i");
1200 hClusterHitMapYInCh[0]->SetMaximum(30);
1201 hClusterHitMapYInCh[0]->SetMinimum(-30);
1202 for (Int_t ich=0; ich<10; ich++) {
1203 hClusterHitMapYInCh[ich]->SetLineColor(ich+1+ich/9);
1204 hClusterHitMapYInCh[ich]->SetLineWidth(2);
1205 if (ich == 0) hClusterHitMapYInCh[ich]->Draw(
"e");
1206 else hClusterHitMapYInCh[ich]->Draw(
"esame");
1208 lClusterHitMapPerCh->Draw(
"same");
1210 cClusterHitMapPerCh->Print(OutFileNamePDF.Data());
1212 cClusterHitMapPerCh->Write();
1215 cout<<
"=================================================="<<endl;
1216 cout<<
" Display tracks ChiSquare "<<endl;
1217 cout<<
"=================================================="<<endl;
1218 TCanvas* cChi2 =
new TCanvas(
"cChi2",
"cChi2",1200,900);
1221 hChi2_Mean->SetStats(kFALSE);
1222 hChi2_Mean->GetXaxis()->SetRange(1,ibin-1);
1223 hChi2_Mean->GetXaxis()->SetNdivisions(1,kFALSE);
1225 hChi2_Mean->SetLabelSize(0.04);
1226 hChi2_Mean->SetLineWidth(2);
1227 hChi2_Mean->Draw(
"e");
1230 hChi2_Sigma->SetStats(kFALSE);
1231 hChi2_Sigma->GetXaxis()->SetRange(1,ibin-1);
1232 hChi2_Sigma->GetXaxis()->SetNdivisions(1,kFALSE);
1234 hChi2_Sigma->SetLabelSize(0.04);
1235 hChi2_Sigma->SetLineWidth(2);
1236 hChi2_Sigma->Draw(
"e");
1238 cChi2->Print(OutFileNamePDF.Data());
1242 cout<<
"=================================================="<<endl;
1243 cout<<
" Display track Lpt/Hpt "<<endl;
1244 cout<<
"=================================================="<<endl;
1246 if ( hTriggerCutVsRun[0] && hTriggerCutVsRun[1] ) {
1247 TCanvas* cLptHpt =
new TCanvas(
"cLptHpt",
"cLptHpt",1200,900);
1248 cLptHpt->Divide(1,2);
1249 TLegend* legLptHpt =
new TLegend(0.72,0.7,0.9,0.85);
1250 legLptHpt->SetBorderSize(1);
1251 for ( Int_t ihisto=0; ihisto<2; ++ihisto) {
1252 cLptHpt->cd(ihisto+1);
1253 TH1* currHistos[2] = {hTriggerCutVsRun[ihisto], hTriggerCutWidthVsRun[ihisto]};
1254 for ( Int_t jhisto=0; jhisto<2; jhisto++ ) {
1255 currHistos[jhisto]->GetXaxis()->SetRange(1,ibin-1);
1256 currHistos[jhisto]->GetYaxis()->SetRangeUser(0.,5.);
1257 currHistos[jhisto]->LabelsOption(
"a");
1258 currHistos[jhisto]->SetStats(kFALSE);
1259 currHistos[jhisto]->GetXaxis()->SetLabelSize(0.04);
1260 currHistos[jhisto]->SetLineWidth(2);
1262 hTriggerCutWidthVsRun[ihisto]->SetLineColor(2);
1263 hTriggerCutWidthVsRun[ihisto]->SetMarkerColor(2);
1264 hTriggerCutWidthVsRun[ihisto]->SetFillColor(2);
1265 hTriggerCutWidthVsRun[ihisto]->SetFillStyle(3001);
1266 hTriggerCutWidthVsRun[ihisto]->Draw(
"e2");
1267 hTriggerCutVsRun[ihisto]->Draw(
"esame");
1268 if ( ihisto == 0 ) {
1269 legLptHpt->AddEntry(hTriggerCutWidthVsRun[ihisto],
"Fit width",
"f");
1270 legLptHpt->AddEntry(hTriggerCutVsRun[ihisto],
"pt cut from fit (stat error)",
"lp");
1271 legLptHpt->Draw(
"same");
1274 cLptHpt->Print(OutFileNamePDF.Data());
1280 cout<<
"=================================================="<<endl;
1281 cout<<
" Display muon trigger "<<endl;
1282 cout<<
"=================================================="<<endl;
1284 TCanvas* cMuonTriggerUnlikeLike =
new TCanvas(
"cMuonTriggerUnlikeLike",
"cMuonTriggerUnlikeLike",1200,900);
1285 TCanvas* cMuonTriggerHpt =
new TCanvas(
"cMuonTriggerHpt",
"cMuonTriggerHpt",1200,900);
1286 cMuonTriggerHpt->Divide(1,2);
1288 Int_t
const ntrig = 3;
1289 Int_t
const nhist = 3;
1290 TH1F *hRelMuonTrigger[ntrig], *hTot;
1293 Int_t conf[ntrig][nhist]={{0,1,3},{0,2,4},{1,2,5}};
1294 TString sconf[ntrig][nhist]={{
"hTriggerUnlikeOnly",
"hTriggerLikeOnly",
"hTriggerUnlikeAndLike"},{
"hTriggerUnlikeOnly",
"hTriggerHptOnly",
"hTriggerUnlikeAndHpt"},{
"hTriggerLikeOnly",
"hTriggerHptOnly",
"hTriggerLikeAndHpt"}};
1297 for ( Int_t i=0; i < ntrig; i++ ) {
1298 for ( Int_t j=0; j < nhist; j++ ) {
1299 sname = sconf[i][j]; sname +=(i+1);
1300 hMuonTrigger[conf[i][j]]->GetXaxis()->SetRange(1,ibin-1);
1301 hRelMuonTrigger[j] = (TH1F*)hMuonTrigger[conf[i][j]]->Clone(sname);
1302 hRelMuonTrigger[j]->SetLineColor(j+1);
1303 hRelMuonTrigger[j]->SetStats(kFALSE);
1304 hRelMuonTrigger[j]->GetXaxis()->SetNdivisions(1,kFALSE);
1305 hRelMuonTrigger[j]->LabelsOption(
"a");
1306 hRelMuonTrigger[j]->SetLabelSize(0.02);
1308 hRelMuonTrigger[j]->SetLineWidth(2);
1309 hRelMuonTrigger[j]->SetTitle(
"");
1314 hTot = (TH1F*) hRelMuonTrigger[0]->Clone(sname);
1315 hTot->Add(hRelMuonTrigger[1]);
1316 hTot->Add(hRelMuonTrigger[2],-1);
1317 hRelMuonTrigger[0]->Add(hRelMuonTrigger[2],-1);
1318 hRelMuonTrigger[1]->Add(hRelMuonTrigger[2],-1);
1320 for(Int_t j=0; j < nhist; j++) hRelMuonTrigger[j]->Divide(hTot);
1322 if(i==0) cMuonTriggerUnlikeLike->cd();
1323 else cMuonTriggerHpt->cd(i);
1325 if (i==0) hRelMuonTrigger[i]->SetTitle(
"Relative muon triggers content");
1326 TLegend *leg =
new TLegend(0.72,0.7,0.9,0.85);
1327 leg->SetBorderSize(1);
1329 for(Int_t j=0; j<nhist; j++){
1331 hRelMuonTrigger[j]->SetMaximum(1);
1332 hRelMuonTrigger[j]->SetMinimum(0);
1333 hRelMuonTrigger[j]->Draw(
"e");
1335 else hRelMuonTrigger[j]->Draw(
"esame");
1336 sname = sconf[i][j];
1337 leg->AddEntry(hRelMuonTrigger[j],sname,
"l");
1341 cMuonTriggerUnlikeLike->Print(OutFileNamePDF.Data());
1343 cMuonTriggerUnlikeLike->Write();
1344 cMuonTriggerHpt->Print(OutFileNamePDF.Data());
1345 cMuonTriggerHpt->Write();
1348 c1->Print(OutFileNamePDF_close.Data());
1351 rootFileOut->Close();
1365 canvas->SetTopMargin(0.05);
1366 canvas->SetRightMargin(0.01);
1367 canvas->SetGridy(1);
1368 canvas->SetLogy(logy);
1375 if(!eventCounters)
return kFALSE;
1377 Double_t sum = eventCounters->GetSum(
"v0mult:low,int,high");
1378 Bool_t result = kTRUE;
1379 if(sum<=0) result = kFALSE;
1381 cout<<
" Collision type is set to ";
1382 if( result == kFALSE) cout<<
"p-p"<<endl;
1383 else cout<<
"heavy-ion"<<endl;
1390 if ( !eventCounters )
return 0;
1392 TString cName = Form(
"c%s",canvasName.Data());
1393 TCanvas *cAll =
new TCanvas(canvasName.Data(),canvasName.Data());
1394 cAll->SetLeftMargin(0.18);
1395 cAll->SetRightMargin(0.18);
1399 TH2* hAll = (TH2*)
ProcessHisto2D(eventCounters,
"trigger",
"run",
"run:any" ,
"");
1400 for ( Int_t ibin=1; ibin <= hAll->GetYaxis()->GetNbins(); ++ibin ) {
1401 TString currLabel = hAll->GetYaxis()->GetBinLabel(ibin);
1402 TObjArray* labelArray = currLabel.Tokenize(
"-");
1403 labelArray->SetOwner();
1405 TString newLabel = labelArray->At(0)->GetName();
1406 if ( labelArray->GetEntries() >= 2 ) newLabel = Form(
"%s-%s", newLabel.Data(), labelArray->At(1)->GetName());
1407 hAll->GetYaxis()->SetBinLabel(ibin, newLabel.Data());
1417 if(!array)
return 0x0;
1419 TString cName =
"c";
1420 cName += canvasName;
1421 TCanvas *cTriggerContent =
new TCanvas(canvasName,cName,1200,900);
1423 cTriggerContent->cd();
1425 TLegend* legcTC =
new TLegend(0.2,0.15,0.50,0.40);
1426 legcTC->SetHeader(
"Physics Selection");
1427 legcTC->AddEntry(
".",
"applied :",
"");
1429 for(Int_t iTrig = 0; iTrig < array->GetEntriesFast(); iTrig++){
1431 if( iTrig == (array->GetEntriesFast()-1) )
continue;
1432 TH1* hNoPS =
static_cast<TH1*
>(trigNoPS.At(iTrig));
1433 TH1* hWithPS =
static_cast<TH1*
>(trigWithPS.At(iTrig));
1434 if (!hNoPS ||!hWithPS)
continue;
1435 hNoPS->SetLineStyle(2);
1437 hNoPS->SetMinimum(1e-3);
1439 hWithPS->Draw(
"same");
1442 hNoPS->Draw(
"same");
1443 hWithPS->Draw(
"same");
1445 legcTC->AddEntry(hWithPS,(( (TObjString*) array->At(iTrig) )->GetString()).Data(),
"l");
1447 legcTC->AddEntry(
".",
"not applied :",
"");
1449 for(Int_t iTrig = 0; iTrig < array->GetEntriesFast(); iTrig++){
1450 if( iTrig == (array->GetEntriesFast()-1) )
continue;
1451 TH1* hNoPS =
static_cast<TH1*
>(trigNoPS.At(iTrig));
1452 if(hNoPS) legcTC->AddEntry(hNoPS,(( (TObjString*) array->At(iTrig) )->GetString()).Data(),
"l");
1455 legcTC->Draw(
"same");
1457 return cTriggerContent;
1462 if(!triggersB)
return 0x0;
1464 TString cName =
"c" ;
1465 cName += canvasName;
1466 TCanvas *cRelativeTriggerContent =
new TCanvas(canvasName,cName,1200,900);
1468 cRelativeTriggerContent->cd();
1470 TObjArray relTrigNoPS(triggersB->GetEntriesFast());
1471 TLegend* legcRTC =
new TLegend(0.2,0.15,0.50,0.40);
1473 TString hName, hTriggerName;
1474 Int_t indAllTrig = triggersB->GetEntriesFast()-1;
1475 TH1* hAllTrig =
static_cast<TH1*
> (trigNoPS.At(indAllTrig));
1476 if(!hAllTrig)
return 0;
1478 for(Int_t iTrig = 0; iTrig < triggersB->GetEntriesFast()-1; iTrig++){
1480 hName += ( (TObjString*) triggersB->At(iTrig) )->GetString();
1481 TH1* histo =
static_cast<TH1*
> (trigNoPS.At(iTrig));
1482 if(!histo)
continue;
1483 TH1* hRatio = (TH1*) histo->Clone(hName);
1484 hRatio->Divide(hAllTrig);
1485 hRatio->SetLineStyle(1);
1487 hRatio->SetMaximum(1.5);
1488 hRatio->SetMinimum(0.001);
1489 hRatio->SetLabelSize(0.04);
1490 hRatio->GetYaxis()->SetTitle(
"Relative trigger content");
1494 hRatio->Draw(
"ESAME");
1496 relTrigNoPS.AddAt(hRatio,iTrig);
1499 legcRTC->SetHeader(
"Physics Selection not applied");
1500 for(Int_t iTrig = 0; iTrig < triggersB->GetEntriesFast()-1; iTrig++){
1501 TH1* hRatio =
static_cast<TH1*
>(relTrigNoPS.At(iTrig));
1502 if (!hRatio)
continue;
1503 legcRTC->AddEntry(hRatio,(( (TObjString*) triggersB->At(iTrig) )->GetString()).Data(),
"l");
1505 legcRTC->Draw(
"same");
1507 return cRelativeTriggerContent;
1512 if(!triggersB)
return 0x0;
1514 TString cName =
"c";
1515 cName += canvasName;
1516 TCanvas *c1 =
new TCanvas(canvasName,cName,1200,900);
1520 TObjArray trigRatio(triggersB->GetEntriesFast());
1521 TLegend* legcRTC =
new TLegend(0.2,0.15,0.50,0.40);
1522 TString header =
"Physics Selection Cut on selected triggers:";
1523 if (canvasName.Contains(
"T0Flag")) header +=
" and T0 pile-up event selection";
1524 if (canvasName.Contains(
"T0SPDFlag")) header +=
" and T0, SPD pile-up event selection";
1525 legcRTC->SetHeader(header.Data());
1528 for(Int_t iTrig = 0; iTrig < triggersB->GetEntriesFast()-1; iTrig++){
1531 hName += ( (TObjString*) triggersB->At(iTrig) )->GetString();
1532 TH1 * hWithPS = (TH1*) (static_cast<TH1*> (trigWithPS.At(iTrig)));
1533 TH1 * hNoPS = (TH1*) (static_cast<TH1*> (trigNoPS.At(iTrig)));
1534 if (!hNoPS || !hWithPS)
continue;
1535 TH1 *hRatio = (TH1*) hWithPS->Clone(hName);
1536 hRatio->Divide(hNoPS);
1537 hName =
"ratioNoPS";
1538 hName += ( (TObjString*) triggersB->At(iTrig) )->GetString();
1541 hRatio->SetMaximum(1.5);
1542 hRatio->SetMinimum(0.05);
1543 hRatio->SetLabelSize(0.02);
1544 hRatio->GetYaxis()->SetTitle(
"Accepted / All from Phys. Sel.");
1545 hRatio->SetTitle(
"Physics Selection Cut");
1549 hRatio->Draw(
"ESAME");
1551 trigRatio.AddAt(hRatio,iTrig);
1554 for(Int_t iTrig = 0; iTrig < triggersB->GetEntriesFast()-1; iTrig++){
1555 TH1 * histo =
static_cast<TH1*
> (trigRatio.At(iTrig));
1556 if (!histo)
continue;
1557 legcRTC->AddEntry(histo,(( (TObjString*) triggersB->At(iTrig) )->GetString()).Data(),
"l");
1559 legcRTC->Draw(
"same");
1566 if(!triggersB || !legendHeader)
return 0x0;
1568 TString cName =
"c";
1569 cName += canvasName;
1570 TCanvas *c1 =
new TCanvas(canvasName,cName,1200,900);
1575 TObjArray trigWithPSRatio(centBinMaxi);
1576 TLegend* legcRTC =
new TLegend(0.2,0.15,0.50,0.40);
1577 legcRTC->SetHeader(
"V0 amplitude bins:");
1578 Int_t colorTab[3] = {kBlack,kRed,kBlue};
1579 TArrayI colorInd(centBinMaxi);
1580 for (Int_t i = 0; i < centBinMaxi; i++ ) {
1581 if(i<3) colorInd.AddAt(colorTab[i],i);
1582 else colorInd.AddAt(colorTab[2]+i-2,i);
1587 Float_t yMin = 0.05, yMax = 2;
1589 for(Int_t iCentBin = 0; iCentBin < centBinMaxi; iCentBin++){
1591 Int_t index =
GetIndex(triggersB,trigNr,iCentBin);
1592 TH1 *hWithPS =
static_cast<TH1*
> (trigWithPS.At(index));
1593 TH1 *hNoPS =
static_cast<TH1*
> (trigNoPS.At(index));
1594 if (!hNoPS || !hWithPS)
continue;
1597 hName += ( (TObjString*) triggersB->At(trigNr) )->GetString();
1598 TH1 *hRatio = (TH1*) hWithPS->Clone(hName);
1599 hRatio->Divide(hNoPS);
1600 hRatio->SetLineColor(colorInd.At(iCentBin));
1601 if ( iCentBin == 0 ) {
1602 hRatio->SetMaximum(yMax);
1603 hRatio->SetMinimum(yMin);
1604 hRatio->SetLabelSize(0.02);
1605 hRatio->GetYaxis()->SetTitle(
"Accepted / All from Phys. Sel.");
1606 TString sTitle =
"for ", sTitle2 = (( (TObjString*) triggersB->At(trigNr) )->GetString()).Data();
1607 if ( !sTitle2.IsNull() ) sTitle += sTitle2;
1609 hRatio->SetTitle(Form(
"Phys. Sel. %s - Multiplicity from V0 amplitude",sTitle.Data()));
1613 hRatio->Draw(
"ESAME");
1615 trigWithPSRatio.AddAt(hRatio,iCentBin);
1618 for ( Int_t centBin = 0; centBin < centBinMaxi; centBin++ ){
1619 TH1 *hRatio =
static_cast<TH1*
> (trigWithPSRatio.At(centBin));
1620 if ( !hRatio )
continue;
1621 legcRTC->AddEntry(hRatio,(legendHeader[centBin]).Data(),
"l");
1623 legcRTC->Draw(
"same");
1631 if(!triggersB || !legendHeader)
return 0x0;
1633 TString cName =
"c";
1634 cName += canvasName;
1635 TCanvas *c1 =
new TCanvas(canvasName,cName,1200,900);
1639 Int_t
const centBinMaxi = 2;
1640 TObjArray trigRatio(centBinMaxi), trigRatioNoPS(centBinMaxi);
1641 TLegend* legcRTC =
new TLegend(0.2,0.15,0.50,0.40);
1642 legcRTC->SetHeader(
"Physics Selection");
1644 Int_t colorTab[2] = {kRed,kBlue};
1645 TArrayI colorInd(centBinMaxi);
1646 for (Int_t i = 0; i < centBinMaxi; i++ ) {
1647 if(i<2) colorInd.AddAt(colorTab[i],i);
1648 else colorInd.AddAt(colorTab[1]+i-1,i);
1653 Float_t yMin = 0., yMax = 0.3;
1656 Int_t centBinMin = 2;
1657 TH1 *hWithPSAll =
static_cast<TH1*
> (trigWithPS.At(1*triggersB->GetEntriesFast()+trigNr));
1658 TH1 *hNoPSAll =
static_cast<TH1*
> (trigNoPS.At(1*triggersB->GetEntriesFast()+trigNr));
1659 if (!hNoPSAll || !hWithPSAll)
return 0;
1661 for ( Int_t centBin = centBinMin; centBin < centBinMaxi+centBinMin; centBin++){
1665 Int_t index =
GetIndex(triggersB,trigNr,centBin);
1666 TH1 *hWithPS =
static_cast<TH1*
> (trigWithPS.At(index));
1667 TH1 *hNoPS =
static_cast<TH1*
> (trigNoPS.At(index));
1668 if (!hNoPS || !hWithPS)
continue;
1671 hName += ( (TObjString*) triggersB->At(trigNr) )->GetString();
1672 TH1 *hRatio = (TH1*) hWithPS->Clone(hName);
1673 hRatio->Divide(hWithPSAll);
1675 hRatio->SetLineColor(colorInd.At(centBin-centBinMin));
1676 hName =
"ratioNoPS";
1677 hName += ( (TObjString*) triggersB->At(trigNr) )->GetString();
1678 TH1 *hRatioNoPS = (TH1*) (hNoPS->Clone(hName));
1679 hRatioNoPS->Divide(hNoPSAll);
1680 hRatioNoPS->Scale(0.8);
1681 hRatioNoPS->SetLineStyle(2);
1682 hRatioNoPS->SetLineColor(colorInd.At(centBin-centBinMin));
1684 if ( centBin == centBinMin ){
1685 hRatio->SetMaximum(yMax);
1686 hRatio->SetMinimum(yMin);
1687 hRatio->SetLabelSize(0.02);
1688 hRatio->GetYaxis()->SetTitle(
"Centrality percentile check");
1689 TString sTitle =
"for ", sTitle2 = (( (TObjString*) triggersB->At(trigNr) )->GetString()).Data();
1690 if ( !sTitle2.IsNull() ) sTitle += sTitle2;
1692 hRatio->SetTitle(Form(
"Centrality percentile check %s - Multiplicity from V0 amplitude",sTitle.Data()));
1694 hRatioNoPS->Draw(
"EPSAME");
1697 hRatio->Draw(
"ESAME");
1698 hRatioNoPS->Draw(
"EPSAME");
1700 trigRatio.AddAt(hRatio,centBin-centBinMin);
1701 trigRatioNoPS.AddAt(hRatioNoPS,centBin-centBinMin);
1704 legcRTC->AddEntry(
".",
"applied :",
"");
1705 for(Int_t centBin = centBinMin; centBin < centBinMaxi+centBinMin; centBin++){
1706 TH1 *hRatio =
static_cast<TH1*
> (trigRatio.At(centBin-centBinMin));
1707 if (!hRatio)
continue;
1708 legcRTC->AddEntry(hRatio,(legendHeader[centBin]).Data(),
"l");
1710 legcRTC->AddEntry(
".",
"not applied :",
"");
1711 for(Int_t centBin = centBinMin; centBin < centBinMaxi+centBinMin; centBin++){
1712 TH1 *hRatioNoPS =
static_cast<TH1*
> (trigRatioNoPS.At(centBin-centBinMin));
1713 if (!hRatioNoPS)
continue;
1714 legcRTC->AddEntry(hRatioNoPS,(legendHeader[centBin]).Data(),
"l");
1716 legcRTC->Draw(
"same");
1722 TCanvas *
ProcessCanvasTracksoverTrigger(TObjArray *triggersB, TObjArray trigSel, TObjArray trackTracker, TObjArray trackTrigger, TObjArray trackMatched, TObjArray trackAll, Int_t trigNr, Int_t centNr, TString canvasName,TString legendHeader){
1724 if(!triggersB || trigNr<0 || centNr<0 )
return 0x0;
1726 Int_t index =
GetIndex(triggersB,trigNr,centNr);
1728 TH1 *hTrackerPerB, *hTriggerPerB, *hMatchedPerB, *hAllTracksPerB, *hTrigSel, *histo;
1730 TString hName, hNameBase;
1731 hNameBase =( (TObjString*) triggersB->At(trigNr) )->GetString();
1733 hTrigSel =
static_cast<TH1*
> (trigSel.At(index));
1734 if (!hTrigSel)
return 0;
1736 hName = Form(
"hTrackerPer%s",hNameBase.Data());
1737 histo =
static_cast<TH1*
> (trackTracker.At(index));
1738 if (!histo)
return 0;
1739 hTrackerPerB = (TH1*) histo->Clone(hName);
1740 if ( hTrackerPerB->GetEntries() ) hTrackerPerB->Divide(hTrigSel);
1741 hTrackerPerB->SetLineColor(kRed);
1743 hName = Form(
"hTriggerPer%s",hNameBase.Data());
1744 histo =
static_cast<TH1*
> (trackTrigger.At(index));
1745 if (!histo)
return 0;
1746 hTriggerPerB = (TH1*) histo->Clone(hName);
1747 if ( hTriggerPerB->GetEntries() > 0 ) hTriggerPerB->Divide(hTrigSel);
1748 hTriggerPerB->SetLineColor(kBlue);
1750 hName = Form(
"hMatchedPer%s",hNameBase.Data());
1751 histo =
static_cast<TH1*
> (trackMatched.At(index));
1752 if (!histo)
return 0;
1753 hMatchedPerB = (TH1*) histo->Clone(hName);
1754 if ( hMatchedPerB->GetEntries() > 0 ) hMatchedPerB->Divide(hTrigSel);
1755 hMatchedPerB->SetLineColor(kViolet);
1757 hName = Form(
"hAllTracksPer%s",hNameBase.Data());
1758 histo =
static_cast<TH1*
> (trackAll.At(index));
1759 if (!histo)
return 0;
1760 hAllTracksPerB = (TH1*) histo->Clone(hName);
1761 if ( hAllTracksPerB->GetEntries() > 0 ) hAllTracksPerB->Divide(hTrigSel);
1763 hAllTracksPerB->SetLineWidth(3);
1764 hAllTracksPerB->SetLineColor(kBlack);
1765 hAllTracksPerB->SetTitle(Form(
"Number of Tracks /%s %s",hNameBase.Data(),legendHeader.Data()));
1766 hAllTracksPerB->SetMinimum(0.0001);
1767 if ( hAllTracksPerB->GetEntries() == 0 ) hAllTracksPerB->SetMaximum(0.1);
1768 hAllTracksPerB->SetLabelSize(0.02);
1770 TString cName =
"c";
1771 cName += canvasName;
1772 hNameBase = ( (TObjString*) triggersB->At(trigNr) )->GetString();
1774 TCanvas *cRatioTrackTypesB =
new TCanvas(canvasName,cName,1200,900);
1776 cRatioTrackTypesB->cd();
1778 TLegend* legcTTCINT1B;
1780 hAllTracksPerB->Draw(
"E");
1781 hTrackerPerB->Draw(
"Esame");
1782 hMatchedPerB->Draw(
"Esame");
1783 hTriggerPerB->Draw(
"Esame");
1785 legcTTCINT1B =
new TLegend(0.70,0.5,0.90,0.70);
1786 legcTTCINT1B->AddEntry(hAllTracksPerB,
"All tracks",
"l");
1787 legcTTCINT1B->AddEntry(hTrackerPerB,
"Tracking (only) tracks",
"l");
1788 legcTTCINT1B->AddEntry(hMatchedPerB,
"Matched tracks",
"l");
1789 legcTTCINT1B->AddEntry(hTriggerPerB,
"Trigger (only) tracks",
"l");
1790 legcTTCINT1B->Draw(
"same");
1792 return cRatioTrackTypesB;
1796 TCanvas *
ProcessCanvasTrackMultB(TObjArray *triggersB, TObjArray trigSel, TObjArray trackTracker, TObjArray trackTrigger, TObjArray trackMatched, Int_t trigNr, Int_t centNr, TString canvasName,TString legendHeader){
1798 if( !triggersB || centNr < 0 || trigNr < 0 )
return 0x0;
1800 Int_t index =
GetIndex(triggersB,trigNr,centNr);
1801 TString hNameBase = ( (TObjString*) triggersB->At(trigNr) )->GetString();
1803 TString cName = Form(
"c%s%s",canvasName.Data(),hNameBase.Data());
1804 TCanvas *cTrackMultB =
new TCanvas(canvasName,cName,1200,900);
1806 cTrackMultB->Divide(1,2);
1809 TH1* hSumTriggerOverB, *hSumTrackerOverB, *hTrigSel, *hTracker, *hTrigger, *hMatched;
1812 hTrigSel =
static_cast<TH1*
> (trigSel.At(index));
1813 if (!hTrigSel)
return 0;
1814 hTracker =
static_cast<TH1*
> (trackTracker.At(index));
1815 if (!hTracker)
return 0;
1816 hTrigger =
static_cast<TH1*
> (trackTrigger.At(index));
1817 if (!hTrigger)
return 0;
1818 hMatched =
static_cast<TH1*
> (trackMatched.At(index));
1819 if (!hMatched)
return 0;
1821 hName = Form(
"hSumTriggerOver%s",hNameBase.Data());
1822 hSumTriggerOverB = (TH1*) hTrigger->Clone(hName);
1823 hSumTriggerOverB->Add(hMatched);
1824 hSumTriggerOverB->Divide(hTrigSel);
1825 hName = Form(
"Sum of trigger tracks (matched + trigger-only) / # events in %s %s",hNameBase.Data(),legendHeader.Data());
1826 hSumTriggerOverB->SetTitle(hName);
1827 hSumTriggerOverB->SetLabelSize(0.04);
1828 hSumTriggerOverB->SetLineColor(kBlue);
1830 hName = Form(
"hSumTrackerOver%s",hNameBase.Data());
1831 hSumTrackerOverB = (TH1*) hTracker->Clone(hName);
1832 hSumTrackerOverB->Add(hMatched);
1833 hSumTrackerOverB->Divide(hTrigSel);
1834 hName = Form(
"Sum of tracker tracks (matched + tracker-only) / # events in %s %s",hNameBase.Data(),legendHeader.Data());
1835 hSumTrackerOverB->SetTitle(hName);
1837 hSumTrackerOverB->SetLabelSize(0.04);
1838 hSumTrackerOverB->SetLineColor(kBlue);
1840 hSumTriggerOverB->Draw(
"e");
1842 hSumTrackerOverB->Draw(
"e");
1848 TCanvas *
ProcessCanvasRatioTrackB(TObjArray *triggersB, TObjArray trigSel, TObjArray trackTracker, TObjArray trackTrigger, TObjArray trackMatched, Int_t trigNr, Int_t centNr, TString canvasName,TString legendHeader) {
1850 if(!triggersB || trigNr < 0 || centNr < 0 )
return 0x0;
1852 Int_t index =
GetIndex(triggersB,trigNr,centNr);
1853 TString hNameBase =( (TObjString*) triggersB->At(trigNr) )->GetString();
1855 TString cName = Form(
"c%s%s",canvasName.Data(),hNameBase.Data());
1856 TCanvas *cRatioTrackB =
new TCanvas(canvasName,cName,1200,900);
1859 TH1* hTrackerOverTriggerB, *hMatchedOverTriggerB, *hMatchedOverTrackerB, *hTrigSel, *hTracker, *hTrigger, *hMatched;
1860 hTrigSel =
static_cast<TH1*
> (trigSel.At(index));
1861 if (!hTrigSel)
return 0;
1862 hTracker =
static_cast<TH1*
> (trackTracker.At(index));
1863 if (!hTracker)
return 0;
1864 hTrigger =
static_cast<TH1*
> (trackTrigger.At(index));
1865 if (!hTrigger)
return 0;
1866 hMatched =
static_cast<TH1*
> (trackMatched.At(index));
1867 if (!hMatched)
return 0;
1869 TString hName = Form(
"hTrackerOverTrigger%s",hNameBase.Data());
1870 hTrackerOverTriggerB = (TH1*) hTracker->Clone(hName);
1871 hTrackerOverTriggerB->Divide(hTrigger);
1872 hName = Form(
"# tracker tracks / # trigger tracks in %s %s",hNameBase.Data(),legendHeader.Data());
1873 hTrackerOverTriggerB->SetTitle(hName);
1875 hTrackerOverTriggerB->SetLabelSize(0.02);
1876 hTrackerOverTriggerB->SetLineColor(kBlue);
1878 hName = Form(
"hMatchedOverTrigger%s",hNameBase.Data());
1879 hMatchedOverTriggerB = (TH1*) hMatched->Clone(hName);
1880 hMatchedOverTriggerB->Divide(hTrigger);
1881 hName = Form(
"# matched tracks / # trigger tracks in %s %s",hNameBase.Data(),legendHeader.Data());
1882 hMatchedOverTriggerB->SetTitle(hName);
1884 hMatchedOverTriggerB->SetLabelSize(0.02);
1885 hMatchedOverTriggerB->SetLineColor(kBlue);
1887 hName = Form(
"hMatchedOverTracker%s",hNameBase.Data());
1888 hMatchedOverTrackerB = (TH1*) hMatched->Clone(hName);
1889 hMatchedOverTrackerB->Divide(hTracker);
1890 hName = Form(
"# matched tracks / # tracker tracks in %s %s",hNameBase.Data(),legendHeader.Data());
1891 hMatchedOverTrackerB->SetTitle(hName);
1893 hMatchedOverTrackerB->SetLabelSize(0.02);
1894 hMatchedOverTrackerB->SetLineColor(kBlue);
1896 cRatioTrackB->Divide(1,3);
1897 cRatioTrackB->cd(1);
1898 hTrackerOverTriggerB->Draw(
"e");
1899 cRatioTrackB->cd(2);
1900 hMatchedOverTriggerB->Draw(
"e");
1901 cRatioTrackB->cd(3);
1902 hMatchedOverTrackerB->Draw(
"e");
1904 return cRatioTrackB;
1907 TCanvas *
ProcessCanvasAsymMatched(TObjArray *triggersB, TObjArray trackPosMatched, TObjArray trackNegMatched, TObjArray trackAllMatched, Int_t trigNr, Int_t centNr, TString canvasName,TString legendHeader) {
1909 if(!triggersB || trigNr < 0 || centNr < 0 )
return 0x0;
1911 Int_t index =
GetIndex(triggersB,trigNr,centNr);
1912 TString hName, hNameBase = (( (TObjString*) triggersB->At(trigNr) )->GetString());
1914 TString cName = Form(
"c%s%s",canvasName.Data(),hNameBase.Data());
1915 TCanvas *cAsymMatched =
new TCanvas(canvasName.Data(),cName,1200,900);
1919 TH1* hPosMatched, *hNegMatched, *hAllMatched;
1921 hPosMatched =
static_cast<TH1*
> (trackPosMatched.At(index));
1922 if (!hPosMatched)
return 0;
1923 hNegMatched =
static_cast<TH1*
> (trackNegMatched.At(index));
1924 if (!hNegMatched)
return 0;
1925 hAllMatched =
static_cast<TH1*
> (trackAllMatched.At(index));
1926 if (!hAllMatched)
return 0;
1928 hName = Form(
"hAsyMatchedFor%s",hNameBase.Data());
1929 TH1 *hAsymMatched = (TH1*) hPosMatched->Clone(hName);
1930 hAsymMatched->Add(hNegMatched,-1);
1931 hAsymMatched->Divide(hAllMatched);
1932 hAsymMatched->SetLineColor(kRed);
1933 hAsymMatched->SetMinimum(-0.3);
1934 hAsymMatched->SetMaximum(0.3);
1935 hAsymMatched->SetLabelSize(0.02);
1936 hName = Form(
"Matched tracks charge asymmetry for %s with acc. cuts %s",hNameBase.Data(),legendHeader.Data());
1937 hAsymMatched->SetTitle(hName);
1938 hAsymMatched->GetYaxis()->SetTitle(
"Charged tracks asymmetry");
1939 hAsymMatched->Draw(
"EH");
1941 return cAsymMatched;
1945 TCanvas *
ProcessCanvasHighPtMuons(TObjArray *triggersB, TObjArray trigSel, TObjArray trackMatchedLowPt, TObjArray trackAllMatchedHighPt, Int_t trigNr, Int_t centNr, TString canvasName,TString legendHeader) {
1947 if ( !triggersB || trigNr < 0 || centNr < 0 )
return 0x0;
1949 Int_t index =
GetIndex(triggersB,trigNr,centNr);
1950 TString hName, hNameBase = (( (TObjString*) triggersB->At(trigNr) )->GetString());
1952 TString cName = Form(
"c%s%s",canvasName.Data(),hNameBase.Data());
1953 TCanvas *cHighPtMuons =
new TCanvas(canvasName.Data(),cName,1200,900);
1958 TH1* hRelMatchedLowPt, *hRelMatchedHighPt, *hTrigSel, *hMatchedLowPt, *hAllMatchedHighPt;
1959 hTrigSel =
static_cast<TH1*
> (trigSel.At(index));
1960 if (!hTrigSel)
return 0;
1961 hMatchedLowPt =
static_cast<TH1*
> (trackMatchedLowPt.At(index));
1962 if (!hMatchedLowPt)
return 0;
1963 hAllMatchedHighPt =
static_cast<TH1*
> (trackAllMatchedHighPt.At(index));
1964 if (!hAllMatchedHighPt)
return 0;
1966 hName = Form(
"hMatchedLowPtPer%s ",hNameBase.Data());
1967 hRelMatchedLowPt = (TH1*) hMatchedLowPt->Clone(hName);
1968 hRelMatchedLowPt->Divide(hTrigSel);
1969 hRelMatchedLowPt->SetLineColor(kBlue);
1970 hRelMatchedLowPt->SetTitle(
"");
1971 hName = Form(
"Ratio per %s ",hNameBase.Data());
1972 hRelMatchedLowPt->GetYaxis()->SetTitle(hName);
1973 hRelMatchedLowPt->SetMinimum(0.0001);
1974 hRelMatchedLowPt->SetLabelSize(0.02);
1976 hName = Form(
"hMatchedHighPtPer%s ",hNameBase.Data());
1977 hRelMatchedHighPt = (TH1*) hAllMatchedHighPt->Clone(hName);
1978 hRelMatchedHighPt->Divide(hTrigSel);
1979 hRelMatchedHighPt->SetLineColor(kRed);
1981 hName = Form(
"Number of matched track per %s (include Vtx and R_{Abs} cuts) %s",hNameBase.Data(),legendHeader.Data());
1982 hRelMatchedLowPt->SetTitle(hName);
1983 hRelMatchedLowPt->Draw(
"E");
1984 hRelMatchedHighPt->Draw(
"Esame");
1986 legcHPM =
new TLegend(0.60,0.45,0.98,0.65);
1988 legcHPM->AddEntry(
".",
"Physics selection applied :",
"");
1989 legcHPM->AddEntry(hRelMatchedLowPt,
" p_{T} > 1 GeV/c ",
"l");
1990 legcHPM->AddEntry(hRelMatchedHighPt,
" p_{T} > 2 GeV/c ",
"l");
1991 legcHPM->Draw(
"same");
1993 return cHighPtMuons;
1996 TCanvas *
ProcessCanvasBeamGasMatched ( TObjArray *triggersB, TObjArray trackBeamGasMatched, TObjArray trackBeamGasMatchedHighPt, TObjArray trackAllMatched, TObjArray trackMatchedHighPt, Int_t trigNr, Int_t centNr, TString canvasName,TString legendHeader) {
1998 if(!triggersB || trigNr < 0 || centNr < 0 )
return 0x0;
2000 Int_t index =
GetIndex(triggersB,trigNr,centNr);
2001 TString hName, hNameBase = (( (TObjString*) triggersB->At(trigNr) )->GetString());
2003 TString cName = Form(
"c%s%s",canvasName.Data(),hNameBase.Data());
2004 TCanvas *cBeamGasMatched =
new TCanvas(canvasName.Data(),cName,1200,900);
2006 cBeamGasMatched->cd();
2008 TH1* hBeamGasMatched, *hBeamGasMatchedHighPt, *hAllMatched, *hMatchedHighPt;
2010 hBeamGasMatched =
static_cast<TH1*
> (trackBeamGasMatched.At(index));
2011 if (!hBeamGasMatched)
return 0;
2012 hBeamGasMatchedHighPt =
static_cast<TH1*
> (trackBeamGasMatchedHighPt.At(index));
2013 if (!hBeamGasMatchedHighPt)
return 0;
2014 hAllMatched =
static_cast<TH1*
> (trackAllMatched.At(index));
2015 if (!hAllMatched)
return 0;
2016 hMatchedHighPt =
static_cast<TH1*
> (trackMatchedHighPt.At(index));
2017 if (!hMatchedHighPt)
return 0;
2019 hName = Form(
"hBeamGasMatchedPer%s ",hNameBase.Data());
2020 TH1 *hRelBeamGasMatched = (TH1*) hBeamGasMatched->Clone(hName);
2021 hRelBeamGasMatched->Divide(hAllMatched);
2022 hRelBeamGasMatched->SetLineColor(kBlack);
2023 hRelBeamGasMatched->SetMinimum(0.0);
2024 hRelBeamGasMatched->SetMaximum(1.1);
2025 hRelBeamGasMatched->SetLabelSize(0.02);
2027 hName = Form(
"hBeamGasMatchedHightPtPer%s ",hNameBase.Data());
2028 TH1 *hRelBeamGasMatchedHighPt = (TH1*) hBeamGasMatchedHighPt->Clone(hName);
2029 hRelBeamGasMatchedHighPt->Divide(hMatchedHighPt);
2030 hRelBeamGasMatchedHighPt->SetLineColor(kRed);
2032 hName = Form(
"Identified beam-gas tracks (pxDCA cuts) in matched tracks for %s",hNameBase.Data());
2033 if(!legendHeader.IsNull()) hName += Form(
" %s",legendHeader.Data());
2034 hRelBeamGasMatched->SetTitle(hName);
2035 hRelBeamGasMatched->GetYaxis()->SetTitle(
"Relative beam-gas tracks");
2036 hRelBeamGasMatched->Draw(
"EH");
2037 hRelBeamGasMatchedHighPt->Draw(
"EHsame");
2039 TLegend *leg =
new TLegend(0.60,0.45,0.98,0.65);
2040 leg->AddEntry(
".",
"Physics selection applied :",
"");
2041 leg->AddEntry(hRelBeamGasMatched,
" All p_{T}",
"l");
2042 leg->AddEntry(hRelBeamGasMatchedHighPt,
" p_{T} > 2 GeV/c ",
"l");
2045 return cBeamGasMatched;
2048 Int_t
GetIndex( TObjArray *triggers, Int_t trigNr, Int_t centNr ) {
2050 return ( centNr * triggers->GetEntriesFast() + trigNr );
2053 TH1*
ProcessHisto( AliCounterCollection* counter, TString hVariable, TString hSelection, TString hName, TString xName, TString yName, Int_t color){
2057 if( !counter )
return h1;
2061 if ( !hSelection.Contains(
"trigger: /") && !hSelection.Contains(
"trigger:/") ) h1 = (TH1*) counter->Draw(hVariable,hSelection);
2063 if ( !h1 ) h1 =
new TH1D(hName,
"",10,0,10);
2065 if ( h1->GetSumw2N() == 0 ) h1->Sumw2();
2066 h1->LabelsOption(
"a");
2067 if(hName.Sizeof()>1) h1->SetName(hName);
2068 if(xName.Sizeof()>1) h1->GetXaxis()->SetTitle(xName);
2069 if(yName.Sizeof()>1) h1->GetYaxis()->SetTitle(yName);
2070 if(color>0) h1->SetLineColor(color);
2071 h1->SetLineWidth(2);
2078 TH2*
ProcessHisto2D( AliCounterCollection* counter, TString hVariable, TString hVariable2, TString hSelection, TString hName){
2082 if( !counter )
return h1;
2083 Bool_t setName = kTRUE;
2085 if(hName.Sizeof()==1) setName = kFALSE;
2087 h1 = (TH2*) counter->Draw(hVariable,hVariable2,hSelection);
2088 if ( !h1 ) h1 =
new TH2D(hName,
"",10,0,10,10,0,10);
2090 if ( h1->GetSumw2N() == 0 ) h1->Sumw2();
2091 h1->LabelsOption(
"a");
2092 if(setName) h1->SetName(hName);
2098 Bool_t
GetTriggerLists(
const char* triggerList, TString listFromContainer, TObjArray *triggersB, TObjArray *triggersShortName){
2106 if( !triggersB || !triggersShortName)
return kFALSE;
2107 Int_t
const nColumn = 2;
2108 TObjArray* triggers[nColumn] = {triggersShortName, triggersB};
2110 TString trigSuffix[nColumn] = {
"",
"B"};
2111 TString currTrigName =
"";
2112 TObjArray* fullTriggerList[nColumn];
2114 for ( Int_t ibeam=0; ibeam<nColumn; ++ibeam ) {
2115 fullTriggerList[ibeam] =
new TObjArray();
2116 fullTriggerList[ibeam]->SetOwner();
2120 if ( triggerList ) {
2122 ifstream inFile(triggerList);
2123 if (!inFile.is_open()) {
2124 Error(
"PlotMuonQA",
"unable to open file %s", triggerList);
2128 while ( !inFile.eof() ) {
2129 Bool_t isGoodB = kTRUE;
2130 for ( Int_t ibeam=0; ibeam<nColumn; ++ibeam ) {
2131 currTrigName.ReadToken( inFile );
2132 if ( ! isGoodB )
continue;
2133 if ( currTrigName.IsNull() || ! currTrigName.IsAscii() ) {
2134 if ( ibeam==0 || ibeam == 1 ) {
2138 currTrigName =
"notrigger";
2140 fullTriggerList[ibeam]->AddLast(
new TObjString(currTrigName));
2146 TObjArray *triggersInContainer = listFromContainer.Tokenize(
",");
2148 for ( Int_t iTrig = 0; iTrig < triggersInContainer->GetEntriesFast(); iTrig++ ) {
2149 currTrigName = triggersInContainer->At(iTrig)->GetName();
2150 Bool_t keep = kTRUE;
2151 TString rejectPatterns =
"-E- -A- -C- WU UP SPI PHI EMC ZED TRUE SHM TPC BEAM 1A 1C";
2152 TObjArray* rejArray = rejectPatterns.Tokenize(
" ");
2153 for ( Int_t ipat=0; ipat<rejArray->GetEntriesFast(); ipat++ ) {
2154 if ( currTrigName.Contains(rejArray->At(ipat)->GetName()) ) {
2160 if (!keep)
continue;
2162 for (Int_t ibeam = 0; ibeam < nColumn; ibeam++) {
2163 fullTriggerList[ibeam]->AddLast(
new TObjString(currTrigName) );
2168 printf(
"INFO: no trigger selected over %d triggers: all triggers kept!!\n",
2169 triggersInContainer->GetEntriesFast());
2170 for ( Int_t iTrig = 0; iTrig < triggersInContainer->GetEntriesFast(); iTrig++ ) {
2171 currTrigName = triggersInContainer->At(iTrig)->GetName();
2172 for (Int_t ibeam = 0; ibeam < nColumn; ibeam++) {
2173 fullTriggerList[ibeam]->AddLast(
new TObjString(currTrigName) );
2177 if ( triggersInContainer )
delete triggersInContainer;
2183 TObjArray *triggersFromContainer = listFromContainer.Tokenize(
",");
2184 TObjString* trigName = 0x0;
2186 TString selectAllTriggers[nColumn];
2187 for ( Int_t ibeam=0; ibeam<nColumn; ++ibeam ) selectAllTriggers[ibeam]=
"";
2189 for ( Int_t itrig=0; itrig<fullTriggerList[0]->GetEntries(); ++itrig ) {
2190 Bool_t isBadTrig = kFALSE;
2191 for ( Int_t ibeam=0; ibeam<nColumn; ++ibeam ) {
2192 currTrigName = fullTriggerList[ibeam]->At(itrig)->GetName();
2194 if ( ibeam == 0 && currTrigName.Contains(
"NOSHOW") ) {
2199 if ( ibeam > 0 && triggersFromContainer ) {
2200 TIter nextTrigger( triggersFromContainer );
2202 while ( ( trigName = static_cast<TObjString*>(nextTrigger()) ) ) {
2203 if ( currTrigName.Contains(trigName->GetString()) ){
2207 if ( isBadTrig == kTRUE ){
2209 if ( triggers[0]->GetLast() != (triggers[0]->LowerBound()-1) ) triggers[0]->RemoveAt(triggers[0]->GetLast());
2215 triggers[ibeam]->AddLast(
new TObjString(currTrigName));
2216 if ( isBadTrig )
continue;
2217 if ( ! selectAllTriggers[ibeam].IsNull() ) selectAllTriggers[ibeam] +=
",";
2218 selectAllTriggers[ibeam] += currTrigName;
2221 if(triggersFromContainer)
delete triggersFromContainer;
2222 if(trigName)
delete trigName;
2226 cout<<
" Nr of triggers read "<<triggers[0]->GetEntriesFast()<<endl;
2227 for ( Int_t ibeam=0; ibeam<nColumn; ++ibeam ) {
2228 triggers[ibeam]->AddLast(
new TObjString(selectAllTriggers[ibeam]));
2229 printf(
" %s triggers:\n", trigSuffix[ibeam].Data());
2230 triggers[ibeam]->Print();
2231 delete fullTriggerList[ibeam];
2240 TObjArray* array = filePath.Tokenize(
"/");
2242 TString auxString =
"";
2244 for ( Int_t ientry=0; ientry<array->GetEntries(); ientry++ ) {
2245 auxString = array->At(ientry)->GetName();
2246 if ( auxString.IsDigit() && auxString.Length()>=6 && auxString.Length()<=9 ) {
2247 runNum = auxString.Atoi();
2254 array = auxString.Tokenize(
"_");
2256 auxString = array->Last()->GetName();
2257 auxString.ReplaceAll(
".root",
"");
2258 if ( auxString.IsDigit() ) runNum = auxString.Atoi();
2268 TString selectRuns =
"run:";
2272 ifstream inFile(runList);
2273 if (!inFile.is_open()) {
2274 Error(
"PlotMuonQA",
"unable to open file %s", runList);
2279 while (!inFile.eof()) {
2280 currLine.ReadLine(inFile);
2281 if ( currLine.IsNull() )
continue;
2284 Warning(
"PlotMuonQA",
"invalid run number: %s", currLine.Data());
2287 if(runs) runs->AddLast(
new TObjString(Form(
"%d", currRun)));
2288 selectRuns += Form(
"%i,",currRun);
2290 selectRuns.Remove(TString::kTrailing,
',');
2295 cout<<
"runList is not set"<<endl;
2296 if(runs) runs->AddLast(
new TObjString(
"*"));
2299 printf(
"selected runs from runlist %s: %s\n",runList, selectRuns.Data());
2306 ifstream inFile(inputList);
2307 if ( ! inFile.is_open()) {
2308 printf(
"Error: cannot find inputList %s\n", inputList);
2311 TString currLine =
"";
2312 TFileMerger fileMerger;
2313 Int_t mergeType = ( TFileMerger::kRegular | TFileMerger::kAll | TFileMerger::kOnlyListed );
2314 fileMerger.AddObjectNames(
"MUON_QA");
2315 while ( ! inFile.eof() ) {
2316 currLine.ReadLine(inFile);
2317 if ( ! currLine.EndsWith(
".root") )
continue;
2318 fileMerger.AddFile(currLine.Data());
2321 if ( fileMerger.GetMergeList()->GetEntries() == 0 )
return kFALSE;
2322 fileMerger.OutputFile(outFilename,kTRUE,1);
2323 fileMerger.PartialMerge(mergeType);
TString kCentLegendName[kCentBinMax]
TCanvas * ProcessCanvasPhysSelCutCentrality(TObjArray *triggersB, TObjArray trigNoPS, TObjArray trigBWithPS, Int_t trigNr, TString canvasName, TString *legendHeader)
void PlotMuonQA(const char *baseDir, const char *runList=0x0, const char *triggerList=0x0, Bool_t selectPhysics=kFALSE, const char *LHCPeriod="LHC11c", const char *QAFileName="QAresults.root")
TH1 * ProcessHisto(AliCounterCollection *counter, TString variable, TString selection, TString hName="", TString xName="", TString yName="", Int_t color=1)
TCanvas * ProcessCanvasTrackMultB(TObjArray *triggersB, TObjArray trigSel, TObjArray trackTracker, TObjArray trackTrigger, TObjArray trackMatched, Int_t trigNr, Int_t centNr, TString canvasName, TString legendHeader="")
void SetCanvas(TCanvas *canvas, Int_t logy=1)
TCanvas * ProcessCanvasCentralityPercentile(TObjArray *triggersB, TObjArray trigNoPS, TObjArray trigWithPS, Int_t trigNr, TString canvasName, TString *legendHeader)
Bool_t MergeOutputs(const char *, const char *)
Bool_t IsHeavyIonCollision(AliCounterCollection *eventCounters)
TCanvas * ProcessCanvasRatioTrackB(TObjArray *triggersB, TObjArray trigSel, TObjArray trackTracker, TObjArray trackTrigger, TObjArray trackMatched, Int_t trigNr, Int_t centNr, TString canvasName, TString legendHeader="")
TCanvas * ProcessCanvasBeamGasMatched(TObjArray *triggersB, TObjArray trackBeamGasMatched, TObjArray trackBeamGasMatchedHighPt, TObjArray trackAllMatched, TObjArray trackMatchedHighPt, Int_t trigNr, Int_t centNr, TString canvasName, TString legendHeader="")
Bool_t GetTriggerLists(const char *triggerList, TString listFromContainer, TObjArray *triggersB=0, TObjArray *triggersShortName=0)
TString GetRunList(const char *runList, TObjArray *runs)
TH2 * ProcessHisto2D(AliCounterCollection *counter, TString hVariable, TString hVariable2, TString hSelection, TString hName)
TCanvas * ProcessCanvasTracksoverTrigger(TObjArray *triggersB, TObjArray trigSel, TObjArray trackTracker, TObjArray trackTrigger, TObjArray trackMatched, TObjArray trackAll, Int_t trigNr, Int_t centNr, TString canvasName, TString legendHeader="")
TCanvas * ProcessCanvasAllTrigger(AliCounterCollection *counter, TString canvasName)
Int_t GetIndex(TObjArray *triggersB, Int_t trigNr, Int_t centNr)
TCanvas * ProcessCanvasTriggerContent(TObjArray *trigName, TObjArray trigNoPS, TObjArray trigWithPS, TString canvasName)
TCanvas * ProcessCanvasHighPtMuons(TObjArray *triggersB, TObjArray trigSel, TObjArray trackMatchedLowPt, TObjArray trackAllMatchedHightPt, Int_t trigNr, Int_t centNr, TString canvasName, TString legendHeader="")
TCanvas * ProcessCanvasPhysSelCut(TObjArray *triggersB, TObjArray trigNoPS, TObjArray trigWithPS, TString canvasName)
TCanvas * ProcessCanvasRelativeTriggerContent(TObjArray *array, TObjArray trigNoPS, TString canvasName)
TCanvas * ProcessCanvasAsymMatched(TObjArray *triggersB, TObjArray trackPosMatched, TObjArray trackNegMatched, TObjArray trackhAllMatched, Int_t trigNr, Int_t centNr, TString canvasName, TString legendHeader="")
Int_t GetRunNumber(TString)
TString kCentLegendNameShort[kCentBinMax]
TString kCentBinName[kCentBinMax]