1 //--------------------------------------------------------------------------
2 // Macro for QA monitoring.
4 // In case it is not run with full aliroot, it needs the following libraries to compile:
9 // - libANALYSISalice.so
13 // TString includePath = "-I${ALICE_ROOT}/PWG3/base/ "; gSystem->SetIncludePath(includePath.Data());
15 // The macro reads results of the QA task and produce monitoring plots.
17 // Author: Philippe Pillot - SUBATECH Nantes
18 // Modified by Christophe Suire, Cynthia Hadjidakis - IPN Orsay
20 // - reorganize last part (reading and extracting info from run per run histos)
21 // - warning and error messages
22 //--------------------------------------------------------------------------
24 #if !defined(__CINT__) || defined(__MAKECINT__)
26 #include <Riostream.h>
32 #include "TGridResult.h"
33 #include "THashList.h"
43 #include "TObjArray.h"
44 #include "TObjString.h"
47 #include "AliCounterCollection.h"
51 TString GetRunList(const char *runList, TObjArray *runs, TObjArray *runs2);
52 Bool_t GetTriggerLists(const char *triggerList, TString listFromContainer, TObjArray *triggersB=0, TObjArray *triggersAC=0, TObjArray *triggersE=0);
53 void SetCanvas(TCanvas *canvas, Int_t logy=1);
55 TH1* ProcessHisto( AliCounterCollection* counter, TString variable, TString selection, TString hName="", TString xName="", TString yName="", Int_t color=1);
56 TH2* ProcessHisto2D( AliCounterCollection* counter, TString hVariable, TString hVariable2, TString hSelection, TString hName);
58 TCanvas *ProcessCanvasTriggerContent(TObjArray *array, TH1 **histo, TH1 **histo2, TString canvasName);
59 TCanvas *ProcessCanvasRelativeTriggerContent(TObjArray *array, TH1 **histo, TString canvasName, Int_t *colorTab);
60 TCanvas *ProcessCanvasPhysSelCut(TObjArray *triggersB, TObjArray *triggersAC, TObjArray *triggersE, TH1 **hBNoPS, TH1 **hACNoPS,TH1 **hENoPS, TH1 **hBWithPS, TString canvasName, Int_t *colorInd, Bool_t isHeavyIon = kFALSE);
61 TCanvas *ProcessCanvasPhysSelCutCentrality(TObjArray *triggersB, TObjArray *triggersAC, TObjArray *triggersE, TH1 **hBNoPS, TH1 **hACNoPS, TH1 **hENoPS, TH1 **hBWithPS, Int_t k, TString canvasName, Int_t *colorInd, TString *legendHeader, Bool_t isHeavyIon = kFALSE);
62 TCanvas *ProcessCanvasCentralityPercentile(TObjArray *triggersB, TH1 **hBNoPSCent, TH1 **hBWithPSCent, Int_t k, TString canvasName, Int_t *colorInd, TString *legendHeader);
63 TCanvas *ProcessCanvasTracksoverTrigger(TObjArray *triggersB, TH1 **hB, TH1 **hTrackerB, TH1 **hTriggerB, TH1 **hMatchedB, TH1 **hAllTracksB, Int_t indTrigger, TString canvasName,TString legendHeader="");
64 TCanvas *ProcessCanvasTrackMultB(TObjArray *triggersB, TH1 **hB, TH1 **hTrackerB, TH1 **hTriggerB, TH1 **hMatchedB, TH1 **hAllTracksB, Int_t indTrigger, TString canvasName,TString legendHeader="");
65 TCanvas *ProcessCanvasRatioTrackB(TObjArray *triggersB, TH1 **hB, TH1 **hTrackerB, TH1 **hTriggerB, TH1 **hMatchedB, TH1 **hAllTracksB, Int_t indTrigger, TString canvasName,TString legendHeader="");
66 TCanvas *ProcessCanvasAsymMatched(TObjArray *triggersB, TH1 **hPosMatchedB, TH1 **hNegMatchedB, TH1 **hAllMatchedB, Int_t indTrigger, TString canvasName,TString legendHeader="");
67 TCanvas *ProcessCanvasHighPtMuons(TObjArray *triggersB, TH1 **hB, TH1 **hMatchedLowPtB, TH1 **hAllMatchedHightPtB, Int_t indTrigger, TString canvasName,TString legendHeader="");
68 Bool_t IsTrigger(TObjArray *array, Int_t index, TString name);
69 Bool_t IsHeavyIonCollision(AliCounterCollection *eventCounters);
71 //--------------------------------------------------------------------------
72 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") {
74 /// Macro for QA monitoring.
75 /// Example: baseDir = "alien:///alice/cern.ch/user/p/ppillot/pp7TeV/LHC10d/MuonQA/pass1/results/".
76 /// If runList != 0x0: only the given runs will be used. Otherwise use all runs found in baseDir.
77 /// If triggerList !=0x0: only the given triggers are displayed. Otherwise use the default list of triggers (see GetTriggerLists)
79 #if defined(__CINT__) && !defined(__MAKECINT__)
80 gSystem->Load("libTree");
81 gSystem->Load("libGeom");
82 gSystem->Load("libVMC");
83 gSystem->Load("libPhysics");
84 gSystem->Load("libSTEERBase");
85 gSystem->Load("libESD");
86 gSystem->Load("libAOD");
87 gSystem->Load("libANALYSIS");
88 gSystem->Load("libANALYSISalice");
89 gSystem->Load("libCORRFW");
90 gSystem->Load("libPWG3base");
91 gSystem->Load("libPWG3muon");
94 // Cosmetics and configuration
95 gStyle->SetFillColor(10);
96 gStyle->SetPadGridX(kTRUE);
97 gStyle->SetPadGridY(kTRUE);
98 gStyle->SetPadRightMargin(0.01);
100 Int_t colorInd[10]={1,4,2,3,6,7,12};
102 TString OutFileName = "QA_"; OutFileName += LHCPeriod;
103 TString OutFileNamePDF= OutFileName.Data(); OutFileNamePDF+= ".pdf";
104 TString OutFileNamePDF_open = OutFileNamePDF.Data(); OutFileNamePDF_open += "[";
105 TString OutFileNamePDF_close= OutFileNamePDF.Data(); OutFileNamePDF_close += "]";
106 TString OutFileNameROOT= OutFileName.Data(); OutFileNameROOT+= ".root";
110 if (0){ // Equivalent to the fast read option
111 gEnv->SetValue("XNet.ConnectTimeout",10);
112 gEnv->SetValue("XNet.RequestTimeout",10);
113 gEnv->SetValue("XNet.MaxRedirectCount",2);
114 gEnv->SetValue("XNet.ReconnectTimeout",10);
115 gEnv->SetValue("XNet.FirstConnectMaxCnt",1);
118 TH1::AddDirectory(kFALSE);
120 TString alienBaseDir = baseDir;
122 if (alienBaseDir.Contains("alien:") && !TGrid::Connect("alien://")) {
123 Error("MergeQA","cannot connect to grid");
128 cout<<"//---------------------------------- //"<<endl;
129 cout<<"// Run selection //"<<endl;
130 cout<<"//---------------------------------- //"<<endl;
132 TObjArray *runs = new TObjArray();
133 runs->SetOwner(kTRUE);
134 TObjArray *runs2 = new TObjArray();
135 runs2->SetOwner(kTRUE);
136 TString selectRuns = GetRunList(runList,runs,runs2);
139 TString select = selectPhysics ? "selected:yes" : "";
141 cout<<"//---------------------------------- //"<<endl;
142 cout<<"// Get global counter //"<<endl;
143 cout<<"//---------------------------------- //"<<endl;
145 TFile *globalFile = TFile::Open(Form("%s/%s", baseDir,QAFileName));
146 if (!globalFile || ! globalFile->IsOpen()) {
147 Error("PlotQA", "failed to open file: %s/%s", baseDir, QAFileName);
150 globalFile->Cd("MUON_QA");
155 AliCounterCollection* eventCounters = static_cast<AliCounterCollection*>(globalFile->FindObjectAny("eventCounters"));
156 AliCounterCollection* trackCounters = static_cast<AliCounterCollection*>(globalFile->FindObjectAny("trackCounters"));
157 if (!runList) selectRuns += trackCounters->GetKeyWords("run");
160 cout<<"//---------------------------------- //"<<endl;
161 cout<<"// Trigger selection //"<<endl;
162 cout<<"//---------------------------------- //"<<endl;
164 TObjArray *triggersB, *triggersAC, *triggersE;
165 triggersB = new TObjArray();
166 triggersB->SetOwner();
167 triggersAC = new TObjArray();
168 triggersAC->SetOwner();
169 triggersE = new TObjArray();
170 triggersE->SetOwner();
172 TString listFromContainer = eventCounters->GetKeyWords("trigger");
173 Bool_t success = GetTriggerLists(triggerList, listFromContainer, triggersB, triggersAC, triggersE);
176 cout<<"//---------------------------------- //"<<endl;
177 cout<<"// Set collision type ? //"<<endl;
178 cout<<"//---------------------------------- //"<<endl;
180 Bool_t isHeavyIon = kTRUE;
181 isHeavyIon = IsHeavyIonCollision(eventCounters);
183 cout<<"//---------------------------------- //"<<endl;
184 cout<<"// Trigger plots //"<<endl;
185 cout<<"//---------------------------------- //"<<endl;
187 //plot all trigger from event counters without any selection
188 TString CanvasName = "cAll";
189 TCanvas *cAll = new TCanvas(CanvasName.Data(),CanvasName.Data());
190 cAll->SetLeftMargin(0.18);
192 //TH2* hAll = (TH2*) ProcessHisto2D(eventCounters, "trigger", "run", Form("run:any/%s",select.Data()) , "");
193 TH2* hAll = (TH2*) ProcessHisto2D(eventCounters, "trigger", "run", "run:any" , "");
194 for ( Int_t ibin=1; ibin<=hAll->GetYaxis()->GetNbins(); ++ibin ) {
195 TString currLabel = hAll->GetYaxis()->GetBinLabel(ibin);
196 TObjArray* labelArray = currLabel.Tokenize("-");
197 labelArray->SetOwner();
198 TString newLabel = labelArray->At(0)->GetName();
199 if ( labelArray->GetEntries() >= 2 ) newLabel = Form("%s-%s", newLabel.Data(), labelArray->At(1)->GetName());
200 hAll->GetYaxis()->SetBinLabel(ibin, newLabel.Data());
206 //declare a default canvas c1
208 TCanvas *c1 = new TCanvas(CanvasName.Data(),CanvasName.Data());
211 //Add a dimension here: All collisions / M.B / low mult. / high mult.
215 Int_t const centBinMax = 4;
216 Int_t centBinMaxLoop = centBinMax;
217 if(!isHeavyIon) centBinMaxLoop = 1;
218 TString centBinName[centBinMax] = {"v0mult:any/","v0mult:low,int,high/","v0mult:low/","v0mult:high/"};
219 TString centLegendName[centBinMax] ={"All collisions","[0-80%] from V0 amplitude","low mult. [60-80%] from V0 amplitude","high mult. [0-10%] from V0 amplitude"};
220 TString centLegendNameShort[centBinMax] ={"All","[0-80%]","[60-80%]","[0-10%]"};
221 TString selectionCent;
224 TH1* hBNoPS[centBinMax][10]={};
225 TH1* hBWithPS[centBinMax][10]={};
226 TH1* hB[centBinMax][10]={};
227 TH1* hTriggerB[centBinMax][10], *hTrackerB[centBinMax][10], *hMatchedB[centBinMax][10], *hAllTracksB[centBinMax][10], *hMatchedLowPtB[centBinMax][10], *hMatchedHighPtB[centBinMax][10];
228 TH1* hMatchedLowPtBNoPS[centBinMax][10], *hMatchedHighPtBNoPS[centBinMax][10];
229 TH1* hPosMatchedB[centBinMax][10], *hNegMatchedB[centBinMax][10], *hAllMatchedB[centBinMax][10];
230 TH1 *hACWithPS[centBinMax][10]={};
231 TH1 *hACNoPS[centBinMax][10]={};
232 TH1 *hEWithPS[centBinMax][10]={};
233 TH1 *hENoPS[centBinMax][10]={};
235 if(triggersB->GetEntriesFast()>=10){
236 cout<<"Too many triggers = "<<triggersB->GetEntriesFast()<<endl;
243 for(centBin = 0; centBin < centBinMaxLoop; centBin++){
244 selectionCent = centBinName[centBin];
246 //Loop on trigger (last is all triggers, then for each defined trigger)
247 for(Int_t i = 0; i < triggersB->GetEntriesFast(); i++){
249 TString histoNameBase = "h_trig", histoName;
252 TString triggerName = ( (TObjString*) triggersB->At(i) )->GetString();
253 if(triggerName.EqualTo(" ")) continue;
254 // Histo trigger without Phys. Sel.
255 selection = selectionCent; selection += Form("trigger:%s/%s", triggerName.Data(), selectRuns.Data());
256 // cout<<selection<<endl;
257 histoName = histoNameBase;
258 histoName += "BNoPS";
259 hBNoPS[centBin][i] = (TH1*) ProcessHisto(eventCounters, "run", selection, histoName, "", "Trigger content w/o Phys. Sel.", colorInd[i]);
260 // Histo trigger with Phys. Sel.
261 selection = selectionCent; selection += Form("trigger:%s/%s/selected:yes", triggerName.Data(), selectRuns.Data());
262 histoName = histoNameBase;
263 histoName += "BWithPS";
264 hBWithPS[centBin][i] = (TH1*) ProcessHisto(eventCounters, "run", selection, histoName, "", "Trigger content w/ Phys. Sel.", colorInd[i]);
265 // Histo trigger : Phys. Sel. is selected or not depending on the macro arguments
266 selection = selectionCent; selection += Form("trigger:%s/%s/%s", triggerName.Data(), selectRuns.Data(), select.Data());
267 histoName = histoNameBase;
269 hB[centBin][i] = (TH1*) ProcessHisto(eventCounters, "run", selection, histoName);
271 TString triggerNameAC = ( (TObjString*) triggersAC->At(i) )->GetString();
272 // Histo trigger without Phys. Sel. AC
273 histoName = histoNameBase;
274 histoName += "ACNoPS";
275 selection = selectionCent; selection += Form("trigger:%s/%s", triggerNameAC.Data(), selectRuns.Data());
276 hACNoPS[centBin][i] = (TH1*) ProcessHisto(eventCounters, "run", selection, histoName);
277 // Histo trigger with Phys. Sel. AC
278 selection = selectionCent; selection += Form("trigger:%s/%s/selected:yes", triggerNameAC.Data(), selectRuns.Data());
279 histoName = histoNameBase;
280 histoName += "ACWithPS";
281 hACWithPS[centBin][i] = (TH1*) ProcessHisto(eventCounters, "run", selection, histoName);
283 TString triggerNameE = ( (TObjString*) triggersE->At(i) )->GetString();
284 // Histo trigger without Phys. Sel. E
285 selection = selectionCent; selection += Form("trigger:%s/%s", triggerNameE.Data(), selectRuns.Data());
286 histoName = histoNameBase;
287 histoName += "ENoPS";
288 hENoPS[centBin][i] = (TH1*) ProcessHisto(eventCounters, "run", selection, histoName);
289 // Histo trigger with Phys. Sel. E
290 selection = selectionCent; selection += Form("trigger:%s/%s/selected:yes", triggerNameE.Data(), selectRuns.Data());
291 histoName = histoNameBase;
292 histoName += "EWithPS";
293 hEWithPS[centBin][i] = (TH1*) ProcessHisto(eventCounters, "run", selection, histoName);
295 // Histo tracking : Phys. Sel. is selected or not depending on the macro arguments
296 selection = selectionCent; selection += Form("track:triggeronly/trigger:%s/%s/%s", triggerName.Data(), selectRuns.Data(), select.Data());
297 hTriggerB[centBin][i] = (TH1*) ProcessHisto(trackCounters, "run", selection, "");
299 selection = selectionCent; selection += Form("track:trackeronly/trigger:%s/%s/%s", triggerName.Data(), selectRuns.Data(), select.Data());
300 hTrackerB[centBin][i] = (TH1*) ProcessHisto(trackCounters, "run", selection, "");
302 selection = selectionCent; selection += Form("track:matched/trigger:%s/%s/%s", triggerName.Data(), selectRuns.Data(), select.Data());
303 hMatchedB[centBin][i] = (TH1*) ProcessHisto(trackCounters, "run", selection, "");
305 selection = selectionCent; selection += Form("trigger:%s/%s/%s", triggerName.Data(), selectRuns.Data(), select.Data());
306 hAllTracksB[centBin][i] = (TH1*) ProcessHisto(trackCounters, "run", selection, "");
308 selection = selectionCent; selection += Form("track:matched/trigger:%s/%s/%s/pt:low/acc:in", triggerName.Data() ,selectRuns.Data(), select.Data());
309 hMatchedLowPtB[centBin][i] = (TH1*) ProcessHisto(trackCounters, "run", selection, "");
311 selection = selectionCent; selection += Form("track:matched/trigger:%s/%s/%s/pt:high/acc:in", triggerName.Data() ,selectRuns.Data(), select.Data());
312 hMatchedHighPtB[centBin][i] = (TH1*) ProcessHisto(trackCounters, "run", selection, "");
314 selection = selectionCent; selection += Form("track:matched/trigger:%s/%s/pt:low/acc:in", triggerName.Data() ,selectRuns.Data());
315 hMatchedLowPtBNoPS[centBin][i] = (TH1*) ProcessHisto(trackCounters, "run", selection, "");
317 selection = selectionCent; selection += Form("track:matched/trigger:%s/%s/pt:high/acc:in", triggerName.Data() ,selectRuns.Data());
318 hMatchedHighPtBNoPS[centBin][i] = (TH1*) ProcessHisto(trackCounters, "run", selection, "");
320 selection = selectionCent; selection += Form("track:matched/trigger:%s/%s/charge:pos/%s/acc:in",triggerName.Data(), select.Data(),selectRuns.Data());
321 hPosMatchedB[centBin][i] = (TH1*) ProcessHisto(trackCounters, "run", selection, "");
323 selection = selectionCent; selection += Form("track:matched/trigger:%s/%s/charge:neg/%s/acc:in",triggerName.Data(), select.Data(),selectRuns.Data());
324 hNegMatchedB[centBin][i] = (TH1*) ProcessHisto(trackCounters, "run", selection, "");
326 selection = selectionCent; selection += Form("track:matched/trigger:%s/%s/%s/acc:in",triggerName.Data(), select.Data(),selectRuns.Data());
327 hAllMatchedB[centBin][i] = (TH1*) ProcessHisto(trackCounters, "run", selection, "");
331 //if there is not B triggers just stop now
332 Int_t count_trigger=0;
334 for(Int_t i = 0; i < triggersB->GetEntriesFast(); i++){
335 count_trigger += hBNoPS[centBin][i]->GetEntries();
337 if(count_trigger<=0) return;
340 Int_t NumOfBNoPS[centBinMax][10];
341 Int_t NumOfBWithPS[centBinMax][10];
342 Int_t NumOfACNoPS[centBinMax][10];
343 Int_t NumOfENoPS[centBinMax][10];
344 Int_t NumOfACWithPS[centBinMax][10];
345 Int_t NumOfEWithPS[centBinMax][10];
347 for(centBin = 0; centBin < centBinMaxLoop; centBin++){
348 for(Int_t i = 0; i < triggersB->GetEntriesFast(); i++){
349 NumOfBNoPS[centBin][i] = hBNoPS[centBin][i]->Integral();
350 NumOfBWithPS[centBin][i] = hBWithPS[centBin][i]->Integral();
351 NumOfACNoPS[centBin][i] = hACNoPS[centBin][i]->Integral();
352 NumOfENoPS[centBin][i] = hENoPS[centBin][i]->Integral();
353 NumOfACWithPS[centBin][i] = hACWithPS[centBin][i]->Integral();
354 NumOfEWithPS[centBin][i] = hEWithPS[centBin][i]->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");
366 cAll->Print(OutFileNamePDF.Data());
370 cout<<"//==================================================================================="<<endl;
371 cout<<"// new canvas with the total number of trigger with and without Phys. Sel."<<endl;
372 cout<<"//==================================================================================="<<endl;
374 TCanvas *cTriggerContent = ProcessCanvasTriggerContent(triggersB, hBNoPS[centBin], hBWithPS[centBin], "TriggerContent");
375 cTriggerContent->Draw();
376 cTriggerContent->Print(OutFileNamePDF.Data());
377 cTriggerContent->Write();
379 cout<<"//==================================================================================="<<endl;
380 cout<<"// new canvas with the relative content of each trigger w/o physics selection"<<endl;
381 cout<<"//==================================================================================="<<endl;
383 TCanvas *cRelativeTriggerContent = ProcessCanvasRelativeTriggerContent(triggersB, hBNoPS[centBin], "RelativeTriggerContent", colorInd);
384 cRelativeTriggerContent->Draw();
385 cRelativeTriggerContent->Print(OutFileNamePDF.Data());
386 cRelativeTriggerContent->Write();
388 cout<<"//==================================================================================="<<endl;
389 cout<<"// new canvas with effect from physics selection for each trigger and background trigger "<<endl;
390 cout<<"//==================================================================================="<<endl;
392 TCanvas *cPhysSelCut = 0x0;
393 cPhysSelCut = ProcessCanvasPhysSelCut(triggersB, triggersAC, triggersE, hBNoPS[centBin], hACNoPS[centBin], hENoPS[centBin], hBWithPS[centBin], "PhysSelCutOnCollTrigger", colorInd,isHeavyIon);
395 cPhysSelCut->Print(OutFileNamePDF.Data());
396 cPhysSelCut->Write();
398 cout<<"//==================================================================================="<<endl;
399 cout<<"// new canvas with effect from physics selection for each trigger and centrality bin (only in PbPb) "<<endl;
400 cout<<"//==================================================================================="<<endl;
405 TString legendHeader="";
409 TCanvas *cPhysSelCutCentrality[10];
412 for(k = 0; k < triggersB->GetEntriesFast(); k++){
413 //skip sum of all triggers
414 if(k == (triggersB->GetEntriesFast()-1)) continue;
416 if( !IsTrigger(triggersB,k,"CMB")&&!IsTrigger(triggersB, k, "CPBI")&&!IsTrigger(triggersB, k, "CVHN")&&!IsTrigger(triggersB, k, "CVLN") ) continue;
418 canvasName = "PhysSel_trigger";
421 TH1* hBNoPSCent[centBinMax-1]={hBNoPS[1][k],hBNoPS[2][k],hBNoPS[3][k]};
422 TH1* hACNoPSCent[centBinMax-1]={hACNoPS[1][k],hACNoPS[2][k],hACNoPS[3][k]};
423 TH1* hENoPSCent[centBinMax-1]={hENoPS[1][k],hENoPS[2][k],hENoPS[3][k]};
424 TH1* hBWithPSCent[centBinMax-1]={hBWithPS[1][k],hBWithPS[2][k],hBWithPS[3][k]};
426 cPhysSelCutCentrality[k] = ProcessCanvasPhysSelCutCentrality(triggersB, triggersAC, triggersE, hBNoPSCent, hACNoPSCent, hENoPSCent, hBWithPSCent, k, canvasName, colorInd, centLegendNameShort+1, isHeavyIon);
427 cPhysSelCutCentrality[k]->Draw();
428 cPhysSelCutCentrality[k]->Print(OutFileNamePDF.Data());
429 cPhysSelCutCentrality[k]->Write();
435 cout<<"//==================================================================================="<<endl;
436 cout<<"// new canvas for centrality percentile check (only in PbPb) "<<endl;
437 cout<<"//==================================================================================="<<endl;
440 TCanvas *cCentralityCheck[10];
443 for(k = 0; k < triggersB->GetEntriesFast(); k++){
444 //skip sum of all triggers
445 if(k == (triggersB->GetEntriesFast()-1)) continue;
447 if( !IsTrigger(triggersB,k,"CMB")&&!IsTrigger(triggersB, k, "CPBI")&&!IsTrigger(triggersB, k, "CVHN")&&!IsTrigger(triggersB, k, "CVLN")) continue;
449 canvasName = "CentralityCheck_trigger";
452 TH1* hBNoPSCent[centBinMax-1]={hBNoPS[1][k],hBNoPS[2][k],hBNoPS[3][k]};
453 TH1* hBWithPSCent[centBinMax-1]={hBWithPS[1][k],hBWithPS[2][k],hBWithPS[3][k]};
455 cCentralityCheck[k] = ProcessCanvasCentralityPercentile(triggersB,hBNoPSCent,hBWithPSCent,k,canvasName,colorInd,centLegendNameShort+1 );
457 cCentralityCheck[k]->Draw();
458 cCentralityCheck[k]->Print(OutFileNamePDF.Data());
459 cCentralityCheck[k]->Write();
466 cout<<"//==================================================================================="<<endl;
467 cout<<"// Ratio of tracks over trigger type (3 canvases) "<<endl;
468 cout<<"//==================================================================================="<<endl;
470 //Print a canvas per trigger type
471 TCanvas *cTracksoverTrigger[centBinMax][10];
472 TCanvas* cTrackMultB[centBinMax][10];
473 TCanvas* cRatioTrackB[centBinMax][10];
477 //loop on centrality bin
478 for ( centBin = 0; centBin < centBinMaxLoop; centBin++){
479 if ( isHeavyIon ) legendHeader = centLegendName[centBin];
481 for(k = 0; k < triggersB->GetEntriesFast(); k++){
482 //skip sum of all triggers
483 if(k == (triggersB->GetEntriesFast()-1)) continue;
485 if( !IsTrigger(triggersB, k, "INT") && !IsTrigger(triggersB, k, "MUS" ) && !IsTrigger(triggersB, k, "ANY") && !IsTrigger(triggersB,k,"CMB")&&!IsTrigger(triggersB, k, "CPBI")&&!IsTrigger(triggersB, k, "CVHN")&&!IsTrigger(triggersB, k, "CVLN") ) continue;
487 canvasName = "RatioTrackTypes_cent";
488 canvasName += centBin;
489 canvasName +="trigger";
491 cTracksoverTrigger[centBin][k]= ProcessCanvasTracksoverTrigger(triggersB, hB[centBin], hTrackerB[centBin], hTriggerB[centBin], hMatchedB[centBin], hAllTracksB[centBin], k, canvasName,legendHeader);
492 cTracksoverTrigger[centBin][k]->Draw();
493 cTracksoverTrigger[centBin][k]->Print(OutFileNamePDF.Data());
494 cTracksoverTrigger[centBin][k]->Write();
496 canvasName = "TrackMult_cent";
497 canvasName += centBin;
498 canvasName +="trigger";
500 cTrackMultB[centBin][k]= ProcessCanvasTrackMultB(triggersB, hB[centBin], hTrackerB[centBin], hTriggerB[centBin], hMatchedB[centBin], hAllTracksB[centBin], k, canvasName, legendHeader);
501 cTrackMultB[centBin][k]->Draw();
502 cTrackMultB[centBin][k]->Print(OutFileNamePDF.Data());
503 cTrackMultB[centBin][k]->Write();
505 canvasName = "RatioTrackB_cent";
506 canvasName += centBin;
507 canvasName +="trigger";
509 cRatioTrackB[centBin][k]= ProcessCanvasRatioTrackB(triggersB, hB[centBin], hTrackerB[centBin], hTriggerB[centBin], hMatchedB[centBin], hAllTracksB[centBin], k, canvasName, legendHeader);
510 cRatioTrackB[centBin][k]->Draw();
511 cRatioTrackB[centBin][k]->Print(OutFileNamePDF.Data());
512 cRatioTrackB[centBin][k]->Write();
516 cout<<"//===================================================="<<endl;
517 cout<<"// Draw matched tracks asymmetry for mus type trigger "<<endl;
518 cout<<"//===================================================="<<endl;
520 //Print a canvas per trigger type
521 TCanvas *cAsymMatched[centBinMax][10];
524 for ( centBin = 0; centBin < centBinMaxLoop; centBin++){
525 if ( isHeavyIon ) legendHeader = centLegendName[centBin];
527 for(k = 0; k < triggersB->GetEntriesFast(); k++){
528 //skip sum of all triggers
529 if(k == (triggersB->GetEntriesFast()-1)) continue;
531 if( !(IsTrigger(triggersB, k, "INT") || IsTrigger(triggersB, k, "MUS" ) || IsTrigger(triggersB,k,"CMB")|| IsTrigger(triggersB, k, "CPBI") || IsTrigger(triggersB, k, "CVHN") || IsTrigger(triggersB, k, "CVLN") ) ) continue;
533 canvasName = "AsymMatched";
534 canvasName += centBin;
535 canvasName +="trigger";
537 cAsymMatched[centBin][k]= ProcessCanvasAsymMatched(triggersB, hPosMatchedB[centBin], hNegMatchedB[centBin], hAllMatchedB[centBin], k, canvasName,legendHeader);
538 cAsymMatched[centBin][k]->Draw();
539 cAsymMatched[centBin][k]->Print(OutFileNamePDF.Data());
540 cAsymMatched[centBin][k]->Write();
543 cout<<"//=================================================="<<endl;
544 cout<<"// Draw high pt tracks per trigger"<<endl;
545 cout<<"//=================================================="<<endl;
547 //Print a canvas per trigger type
548 TCanvas *cHighPtMuons[3][10];
551 for ( centBin = 0; centBin < centBinMaxLoop; centBin++){
552 if ( isHeavyIon ) legendHeader = centLegendName[centBin];
554 for(k = 0; k < triggersB->GetEntriesFast(); k++){
555 //skip sum of all triggers
556 if(k == (triggersB->GetEntriesFast()-1)) continue;
558 if( !(IsTrigger(triggersB, k, "INT") || IsTrigger(triggersB, k, "MUS" ) || IsTrigger(triggersB,k,"CMB") || IsTrigger(triggersB, k, "CPBI") || IsTrigger(triggersB, k, "CVHN") || IsTrigger(triggersB, k, "CVLN") ) ) continue;
560 canvasName = "HighPtMuons";
561 canvasName += centBin;
562 canvasName +="trigger";
565 cHighPtMuons[centBin][k]= ProcessCanvasHighPtMuons(triggersB, hB[centBin], hMatchedLowPtB[centBin], hMatchedHighPtB[centBin], k, canvasName,legendHeader);
566 cHighPtMuons[centBin][k]->Draw();
567 cHighPtMuons[centBin][k]->Print(OutFileNamePDF.Data());
568 cHighPtMuons[centBin][k]->Write();
575 //===================================================================================
576 //Print out the number of trigger without and with Phys. Sel.
577 //===================================================================================
580 cout << endl << endl;
581 //====================================================
583 if ( triggersB->At(kCMUS) ) {
585 // set the format to print labels
586 THashList* labels = hBWithPS[centBin][kCMUS]->GetXaxis()->GetLabels();
587 TString format(Form("\n%%%ds %%9d",0));
590 // print value for each label
591 TObjString* label = 0x0;
592 TIter nextLabel(labels);
593 cout << "-------------------------------------------------" << endl;
594 cout << "Run Number" << "\t Number of "<< ( (TObjString*) triggersB->At(kCMUS) )->GetString()<<" after Phys. Sel. " << endl ;
595 while ((label = static_cast<TObjString*>(nextLabel()))) {
597 Int_t bin = (Int_t) label->GetUniqueID();
598 printf(format.Data(), label->String().Data(), (Int_t) hBWithPS[centBin][kCMUS]->GetBinContent(bin));
600 printf("\n========== Total #runs = %d ==============\n",nRuns);
604 cout << "-------------------------------------------------" << endl;
605 cout << "Total statistic" << endl;
606 cout << " " << endl ;
608 cout << "-------------------------------------------------------------------" << endl;
609 cout<<"Number of triggers w/o Phys. Sel./ w/ Phys. Sel (Phys. Sel. cut in %)"<<endl;
610 for(Int_t i = 0; i < triggersB->GetEntriesFast()-1; i++){
611 TString triggerNameB = ( (TObjString*) triggersB->At(i) )->GetString();
612 TString triggerNameAC = ( (TObjString*) triggersAC->At(i) )->GetString();
613 TString triggerNameE = ( (TObjString*) triggersE->At(i) )->GetString();
615 Int_t cutinpercent = 0;
616 printf("%10s %30s %30s\n",triggerNameB.Data(),triggerNameAC.Data(),triggerNameE.Data());
617 if(NumOfBNoPS[centBin][i]) cutinpercent = (Int_t) ((Double_t)(NumOfBNoPS[centBin][i]-NumOfBWithPS[centBin][i])/(NumOfBNoPS[centBin][i])*100.);
618 printf("%5.2e / %.2e (%d%%)", (Double_t) NumOfBNoPS[centBin][i],(Double_t) NumOfBWithPS[centBin][i],cutinpercent);
620 if(NumOfACNoPS[centBin][i]) cutinpercent = (Int_t) ((Double_t)(NumOfACNoPS[centBin][i]-NumOfACWithPS[centBin][i])/(NumOfACNoPS[centBin][i])*100.);
621 printf("%15.2e / %.2e (%d%%)", (Double_t)NumOfACNoPS[centBin][i],(Double_t)NumOfACWithPS[centBin][i],cutinpercent);
623 if(NumOfENoPS[centBin][i]) cutinpercent = (Int_t) ((Double_t)(NumOfENoPS[centBin][i]-NumOfEWithPS[centBin][i])/(NumOfENoPS[centBin][i])*100.);
624 printf("%15.2e / %.2e (%d%%)\n", (Double_t)NumOfENoPS[centBin][i],(Double_t)NumOfEWithPS[centBin][i],cutinpercent);
634 //--------------------------------------------- //
635 // monitor quantities run per run //
636 //--------------------------------------------- //
637 TH1F* hTriggerCutVsRun[2], *hTriggerCutWidthVsRun[2];
638 for ( Int_t ihisto=0; ihisto<2; ++ihisto ) {
639 TString cutName = ( ihisto == 0 ) ? "Lpt" : "Hpt";
640 hTriggerCutVsRun[ihisto] = new TH1F(Form("hTriggerCutVsRun%s", cutName.Data()), Form("Trigger %s cut per run", cutName.Data()), 10000,1,10000);
641 hTriggerCutWidthVsRun[ihisto] = (TH1F*)hTriggerCutVsRun[ihisto]->Clone(Form("hTriggerCutWidthVsRun%s", cutName.Data()));
643 TF1* fitMatchTrig = new TF1("fitMatchTrig","[3] + [0] * ( 1. + TMath::Erf((x - [1]) / [2]))", 0.1, 6.);
644 TH1F* hNClustersPerTrackVsRun_Mean = new TH1F("hNClustersPerTrackVsRun_Mean", "averaged number of associated clusters per track;run;<n_{clusters}>",10000,1,10000);
645 TH1F* hNClustersPerTrackVsRun_Sigma = new TH1F("hNClustersPerTrackVsRun_Sigma", "dispersion of the number of associated clusters per track;run;#sigma_{n_{clusters}}",10000,1,10000);
646 TH1F* hNChamberHitPerTrack_Mean = new TH1F("hNChamberHitPerTrack_Mean", "averaged number of chambers hit per track;run;<n_{chamber hit}>",10000,1,10000);
647 TH1F* hNChamberHitPerTrack_Sigma = new TH1F("hNChamberHitPerTrack_Sigma", "dispersion of the number of chambers hit per track;run;#sigma_{n_{chamber hit}}",10000,1,10000);
648 TH1F* hChi2_Mean = new TH1F("hChi2_Mean", "averaged normalized #chi^{2} distribution;run;<#chi^{2} / ndf>",10000,1,10000);
649 TH1F* hChi2_Sigma = new TH1F("hChi2_Sigma", "dispersion of normalized #chi^{2} distribution;run;#sigma_{#chi^{2} / ndf}",10000,1,10000);
650 TH1F* hNClustersInCh[10];
651 for (Int_t ich=0; ich<10; ich++){
652 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);
654 TH1F* hClusterHitMapXInCh[10];
655 for (Int_t ich=0; ich<10; ich++){
656 hClusterHitMapXInCh[ich] = new TH1F(Form("hClusterHitMapXInCh%d",ich+1), Form("averaged cluster position distribution in chamber %d;X (cm)",ich+1),10000,1,10000);
658 TH1F* hClusterHitMapYInCh[10];
659 for (Int_t ich=0; ich<10; ich++){
660 hClusterHitMapYInCh[ich] = new TH1F(Form("hClusterHitMapYInCh%d",ich+1), Form("averaged cluster position distribution in chamber %d;Y (cm)",ich+1),10000,1,10000);
664 // Are the runs stored locally or in alien?
665 Int_t isAlienFile = 0;
666 if(alienBaseDir.Contains("alien:")){
668 alienBaseDir.ReplaceAll("alien://","");
670 cout<<"============================================================"<<endl;
671 cout<< "Monitoring quantities run per run: loop over "<<runs->GetEntriesFast()<<" runs."<<endl;
672 cout<<" directory = "<<alienBaseDir.Data()<<endl;
673 cout<<"============================================================"<<endl;
675 for ( Int_t irun=0; irun<runs->GetEntriesFast(); irun++ ) {
677 TString run = ((TObjString*)runs->UncheckedAt(irun))->GetString();
678 TString run2 = ((TObjString*)runs2->UncheckedAt(irun))->GetString();
679 // get the file (or list of files) to be analyzed
681 TGridResult *res = 0;
682 TObjString *objs = 0;
685 command = Form("find %s/ %s/%s", alienBaseDir.Data(), run.Data(), QAFileName);
686 res = gGrid->Command(command);
688 Error("PlotMuonQA","no result for the command: %s",command.Data());
693 res = new TGridResult();
696 objs = new TObjString(Form("%s/%s/%s", alienBaseDir.Data(), run2.Data(), QAFileName));
700 //loop over the directory to find the root files
701 void *dir = gSystem->OpenDirectory(alienBaseDir.Data());
702 TString sDirFilename;
703 Int_t iEntry=0, iFile=0;
706 const char* dirFilename = gSystem->GetDirEntry(dir);
707 if(!dirFilename) break;
708 sDirFilename = dirFilename;
709 if(!sDirFilename.IsDigit()) continue;
711 objs = new TObjString(Form("%s/%s/%s", alienBaseDir.Data(), sDirFilename.Data(), QAFileName));
717 // Loop over 'find' results and get next LFN
722 Int_t iLoop=0, iLoopMax=200;
725 // get the current file url
727 map=(TMap*)nextmap();
729 objs = dynamic_cast<TObjString*>(map->GetValue("turl"));
732 objs=(TObjString*)nextmap();
735 //in case of infinite loop
737 if(iLoop>iLoopMax) break;
739 if (!objs || !objs->GetString().Length()) {
740 Error("PlotMuonQA","turl/obj not found for the run %s... SKIPPING", run.Data());
744 run = objs->GetString();
745 run.ReplaceAll(Form("/%s",QAFileName), "");
746 run.ReplaceAll(alienBaseDir, "");
747 run.Remove(TString::kLeading, '/');
748 run.Remove(TString::kLeading, '0');
750 if ( ! selectRuns.Contains(run.Data()) ) continue;
752 // open the outfile for this run
753 TFile *runFile = TFile::Open(objs->GetString());
754 if (!runFile || ! runFile->IsOpen()) {
755 Error("PlotMuonQA","failed to open file: %s", objs->GetName());
758 runFile->Cd("MUON_QA");
760 // get interesting histos
761 TObjArray* general1 = static_cast<TObjArray*>(runFile->FindObjectAny("general1"));
762 TObjArray* general2 = static_cast<TObjArray*>(runFile->FindObjectAny("general2"));
763 TObjArray* expert = static_cast<TObjArray*>(runFile->FindObjectAny("expert"));
765 if (!general1 || !general2 || !expert){
766 Error("PlotMuonQA","All objects not here !!! ===> Skipping...for %s",objs->GetName());
770 TH1* hNClustersPerTrack = static_cast<TH1*>(general1->FindObject("hNClustersPerTrack"));
771 TH1* hNChamberHitPerTrack = static_cast<TH1*>(general1->FindObject("hNChamberHitPerTrack"));
772 TH1* hChi2 = static_cast<TH1*>(general1->FindObject("hChi2"));
773 TH1* hNClustersPerCh = static_cast<TH1*>(general2->FindObject("hNClustersPerCh"));
774 TH1* hPtDistrib = static_cast<TH1*>(general1->FindObject("hPt"));
775 TH1* hPtDistribLpt = static_cast<TH1*>(general1->FindObject("hPtMatchLpt"));
776 TH1* hPtDistribHpt = static_cast<TH1*>(general1->FindObject("hPtMatchHpt"));
777 if ( hPtDistrib && hPtDistribLpt && hPtDistribHpt ) {
778 if ( hPtDistrib->GetSumw2N() == 0 ) hPtDistrib->Sumw2();
779 TH1* histoMatch[2] = {hPtDistribLpt, hPtDistribHpt};
780 for ( Int_t ihisto=0; ihisto<2; ++ihisto ) {
781 if ( histoMatch[ihisto]->GetSumw2N() == 0 ) histoMatch[ihisto]->Sumw2();
782 if ( histoMatch[ihisto]->GetEntries() == 0 ) continue;
783 histoMatch[ihisto]->Divide(hPtDistrib);
784 Double_t minEff = 99999., maxEff = -1.;
785 Double_t ptMinFit = 0.1;
786 Double_t ptMaxFit = 6.;
787 Int_t ptBinLow = histoMatch[ihisto]->GetXaxis()->FindBin(ptMinFit);
788 Int_t ptBinHigh = histoMatch[ihisto]->GetXaxis()->FindBin(ptMaxFit);
789 for ( Int_t currBin=ptBinLow; currBin<=ptBinHigh; currBin++ ) {
790 Double_t currEff = histoMatch[ihisto]->GetBinContent(currBin);
791 Double_t currPt = histoMatch[ihisto]->GetXaxis()->GetBinCenter(currBin);
792 if ( currPt < 1.5 && minEff > currEff ) {
796 if ( currPt > 0.5 && maxEff < currEff ) {
800 } // loop on histo bins
801 fitMatchTrig->SetParameters(0.5, 0.5, 0.8, 0.2);
802 fitMatchTrig->SetParLimits(0,0.,1.);
803 fitMatchTrig->SetParLimits(1,0.,5.);
804 fitMatchTrig->SetParLimits(2,0.,5.);
805 fitMatchTrig->SetParLimits(3,0.,0.5);
806 histoMatch[ihisto]->Fit(fitMatchTrig,"RQ0","",ptMinFit,ptMaxFit);
807 Double_t ptCut = fitMatchTrig->GetParameter(1);
808 Double_t ptCutErr = fitMatchTrig->GetParError(1);
809 Double_t ptCutWidth = fitMatchTrig->GetParameter(2);
810 if ( ptCut < 0 || ptCut > 10. ) {
811 ptCut = ptCutErr = ptCutWidth = 0.;
813 hTriggerCutVsRun[ihisto]->SetBinContent(ibin, ptCut);
814 hTriggerCutVsRun[ihisto]->SetBinError(ibin, ptCutErr);
815 hTriggerCutWidthVsRun[ihisto]->SetBinContent(ibin, ptCut);
816 hTriggerCutWidthVsRun[ihisto]->SetBinError(ibin, ptCutWidth);
817 } // loop on match histos
819 TH2* hClusterHitMapInCh[10];
820 for(Int_t ich=0; ich<10; ich++) hClusterHitMapInCh[ich] = static_cast<TH2*>(expert->FindObject(Form("hClusterHitMapInCh%d",ich+1)));
822 // skip empty runs... not anymore ! cs !
823 if (!hNClustersPerCh) {
824 Warning("PlotMUONQA","File: %s has empty histograms !", objs->GetName());
825 hNClustersPerTrackVsRun_Mean->SetBinContent(ibin, 0.);
826 hNClustersPerTrackVsRun_Mean->SetBinError(ibin, 1.);
827 hNClustersPerTrackVsRun_Sigma->SetBinContent(ibin, 0.);
828 hNClustersPerTrackVsRun_Sigma->SetBinError(ibin, 1.);
829 hNChamberHitPerTrack_Mean->SetBinContent(ibin, 0.);
830 hNChamberHitPerTrack_Mean->SetBinError(ibin, 1.);
831 hNChamberHitPerTrack_Sigma->SetBinContent(ibin, 0.);
832 hNChamberHitPerTrack_Sigma->SetBinError(ibin, 1.);
833 hChi2_Mean->SetBinContent(ibin, 0.);
834 hChi2_Mean->SetBinError(ibin, 1.);
835 hChi2_Sigma->SetBinContent(ibin, 0.);
836 hChi2_Sigma->SetBinError(ibin, 1.);
837 for (Int_t ich=0; ich<10; ich++) {
838 hNClustersInCh[ich]->SetBinContent(ibin,0.);
839 hNClustersInCh[ich]->SetBinError(ibin,1.);
840 hClusterHitMapXInCh[ich]->SetBinContent(ibin,0.);
841 hClusterHitMapXInCh[ich]->SetBinError(ibin,1.);
842 hClusterHitMapYInCh[ich]->SetBinContent(ibin,0.);
843 hClusterHitMapYInCh[ich]->SetBinError(ibin,1.);
849 // fill monitoring plots
850 hNClustersPerTrackVsRun_Mean->SetBinContent(ibin, hNClustersPerTrack->GetMean());
851 hNClustersPerTrackVsRun_Mean->SetBinError(ibin, hNClustersPerTrack->GetMeanError());
852 hNClustersPerTrackVsRun_Sigma->SetBinContent(ibin, hNClustersPerTrack->GetRMS());
853 hNClustersPerTrackVsRun_Sigma->SetBinError(ibin, hNClustersPerTrack->GetRMSError());
854 hNChamberHitPerTrack_Mean->SetBinContent(ibin, hNChamberHitPerTrack->GetMean());
855 hNChamberHitPerTrack_Mean->SetBinError(ibin, hNChamberHitPerTrack->GetMeanError());
856 hNChamberHitPerTrack_Sigma->SetBinContent(ibin, hNChamberHitPerTrack->GetRMS());
857 hNChamberHitPerTrack_Sigma->SetBinError(ibin, hNChamberHitPerTrack->GetRMSError());
858 hChi2_Mean->SetBinContent(ibin, hChi2->GetMean());
859 hChi2_Mean->SetBinError(ibin, hChi2->GetMeanError());
860 hChi2_Sigma->SetBinContent(ibin, hChi2->GetRMS());
861 hChi2_Sigma->SetBinError(ibin, hChi2->GetRMSError());
862 for (Int_t ich=0; ich<10; ich++) {
863 hNClustersInCh[ich]->SetBinContent(ibin,hNClustersPerCh->GetBinContent(ich+1));
864 hNClustersInCh[ich]->SetBinError(ibin,hNClustersPerCh->GetBinError(ich+1));
865 hClusterHitMapXInCh[ich]->SetBinContent(ibin,hClusterHitMapInCh[ich]->GetMean(1));
866 hClusterHitMapXInCh[ich]->SetBinError(ibin,hClusterHitMapInCh[ich]->GetMeanError(1));
867 hClusterHitMapYInCh[ich]->SetBinContent(ibin,hClusterHitMapInCh[ich]->GetMean(2));
868 hClusterHitMapYInCh[ich]->SetBinError(ibin,hClusterHitMapInCh[ich]->GetMeanError(2));
873 for ( Int_t ihisto=0; ihisto<2; ++ihisto ) {
874 hTriggerCutVsRun[ihisto]->GetXaxis()->SetBinLabel(ibin,run.Data());
875 hTriggerCutWidthVsRun[ihisto]->GetXaxis()->SetBinLabel(ibin,run.Data());
877 hNClustersPerTrackVsRun_Mean->GetXaxis()->SetBinLabel(ibin, run.Data());
878 hNClustersPerTrackVsRun_Sigma->GetXaxis()->SetBinLabel(ibin, run.Data());
879 hNChamberHitPerTrack_Mean->GetXaxis()->SetBinLabel(ibin, run.Data());
880 hNChamberHitPerTrack_Sigma->GetXaxis()->SetBinLabel(ibin, run.Data());
881 hChi2_Mean->GetXaxis()->SetBinLabel(ibin, run.Data());
882 hChi2_Sigma->GetXaxis()->SetBinLabel(ibin, run.Data());
883 for (Int_t ich=0; ich<10; ich++){
884 hNClustersInCh[ich]->GetXaxis()->SetBinLabel(ibin, run.Data());
885 hClusterHitMapXInCh[ich]->GetXaxis()->SetBinLabel(ibin, run.Data());
886 hClusterHitMapYInCh[ich]->GetXaxis()->SetBinLabel(ibin, run.Data());
889 // close outfile for this run
898 hNClustersPerTrackVsRun_Mean->LabelsOption("a");
899 hNClustersPerTrackVsRun_Sigma->LabelsOption("a");
900 hNChamberHitPerTrack_Mean->LabelsOption("a");
901 hNChamberHitPerTrack_Sigma->LabelsOption("a");
902 hChi2_Mean->LabelsOption("a");
903 hChi2_Sigma->LabelsOption("a");
905 for(Int_t ich=0; ich<10; ich++){
906 hNClustersInCh[ich]->LabelsOption("a");
907 hClusterHitMapXInCh[ich]->LabelsOption("a");
908 hClusterHitMapYInCh[ich]->LabelsOption("a");
911 TString dirToGo = OutFileNameROOT.Data(); dirToGo+=":/";
912 gDirectory->Cd(dirToGo.Data());
913 //==================================================
914 //Display Mean and Sigma of the number of associated clusters to a track
915 TLegend *lNClusters = new TLegend(0.75,0.85,0.99,0.99);
916 lNClusters->AddEntry(hNClustersPerTrackVsRun_Mean,"clusters","PL");
917 lNClusters->AddEntry(hNChamberHitPerTrack_Mean,"chamber hit","PL");
919 TCanvas* cNClusters = new TCanvas("cNClusters","cNClusters",1200,900);
920 cNClusters->Divide(1,2);
922 //hNClustersPerTrackVsRun_Mean->SetMaximum(11);
923 hNClustersPerTrackVsRun_Mean->SetMinimum(7);
924 hNClustersPerTrackVsRun_Mean->SetStats(kFALSE);
925 hNClustersPerTrackVsRun_Mean->GetXaxis()->SetRange(1,ibin-1);
926 hNClustersPerTrackVsRun_Mean->GetXaxis()->SetNdivisions(1,kFALSE);
927 //hNClustersPerTrackVsRun_Mean->LabelsOption("u");
928 hNClustersPerTrackVsRun_Mean->SetLabelSize(0.04);
929 hNClustersPerTrackVsRun_Mean->SetTitle("averaged number of associated clusters or of the number of chamber hit per track");
930 hNClustersPerTrackVsRun_Mean->SetLineWidth(2);
931 hNClustersPerTrackVsRun_Mean->Draw("e");
932 hNChamberHitPerTrack_Mean->SetLineColor(kRed);
933 hNChamberHitPerTrack_Mean->SetLineWidth(2);
934 hNChamberHitPerTrack_Mean->Draw("esame");
935 lNClusters->Draw("same");
938 //hNClustersPerTrackVsRun_Sigma->SetMaximum(1.1);
939 hNClustersPerTrackVsRun_Sigma->SetMinimum(0.4);
940 hNClustersPerTrackVsRun_Sigma->SetStats(kFALSE);
941 hNClustersPerTrackVsRun_Sigma->GetXaxis()->SetRange(1,ibin-1);
942 hNClustersPerTrackVsRun_Sigma->GetXaxis()->SetNdivisions(1,kFALSE);
943 //hNClustersPerTrackVsRun_Sigma->LabelsOption("u");
944 hNClustersPerTrackVsRun_Sigma->SetLabelSize(0.04);
945 hNClustersPerTrackVsRun_Sigma->SetTitle("dispersion of the number of associated clusters or of the number of chamber hit per track");
946 hNClustersPerTrackVsRun_Sigma->SetLineWidth(2);
947 hNClustersPerTrackVsRun_Sigma->Draw("e");
948 hNChamberHitPerTrack_Sigma->SetLineWidth(2);
949 hNChamberHitPerTrack_Sigma->SetLineColor(kRed);
950 hNChamberHitPerTrack_Sigma->Draw("esame");
951 lNClusters->Draw("same");
953 cNClusters->Print(OutFileNamePDF.Data());
957 //==================================================
958 // Display average number of cluster per chamber
959 TLegend *lNClustersPerCh = new TLegend(0.92,0.45,0.99,0.99);
960 TCanvas* cNClustersPerCh = new TCanvas("cNClustersPerCh","cNClustersPerCh",1200,900);
961 cNClustersPerCh->cd();
962 cNClustersPerCh->SetRightMargin(0.1);
963 hNClustersInCh[0]->SetStats(kFALSE);
964 hNClustersInCh[0]->GetXaxis()->SetRange(1,ibin-1);
965 hNClustersInCh[0]->GetXaxis()->SetNdivisions(1,kFALSE);
966 //hNClustersInCh[0]->LabelsOption("u");
967 hNClustersInCh[0]->SetLabelSize(0.02);
968 hNClustersInCh[0]->SetTitle("averaged number of clusters in chamber i per track");
969 hNClustersInCh[0]->SetMaximum(1.2);
970 hNClustersInCh[0]->SetMinimum(0.01);
971 for (Int_t ich=0; ich<10; ich++) {
972 hNClustersInCh[ich]->SetLineColor(ich+1+ich/9);
973 hNClustersInCh[ich]->SetLineWidth(2);
974 if (ich == 0) hNClustersInCh[ich]->Draw("e");
975 else hNClustersInCh[ich]->Draw("esame");
976 lNClustersPerCh->AddEntry(hNClustersInCh[ich],Form("ch%d",ich+1),"PL");
978 lNClustersPerCh->Draw("same");
980 cNClustersPerCh->Print(OutFileNamePDF.Data());
981 cNClustersPerCh->Write();
983 //==================================================
984 // Display average X and Y position of clusters per chamber
985 TLegend *lClusterHitMapPerCh = new TLegend(0.92,0.45,0.99,0.99);
986 TCanvas* cClusterHitMapPerCh = new TCanvas("cClusterHitMapPerCh","cClusterHitMapPerCh",1200,900);
987 cClusterHitMapPerCh->Divide(1,2);
988 cClusterHitMapPerCh->GetPad(1)->SetRightMargin(0.1);
989 cClusterHitMapPerCh->GetPad(2)->SetRightMargin(0.1);
991 cClusterHitMapPerCh->cd(1);
992 hClusterHitMapXInCh[0]->SetStats(kFALSE);
993 hClusterHitMapXInCh[0]->GetXaxis()->SetRange(1,ibin-1);
994 hClusterHitMapXInCh[0]->GetXaxis()->SetNdivisions(1,kFALSE);
995 //hNClustersInCh[0]->LabelsOption("u");
996 hClusterHitMapXInCh[0]->SetLabelSize(0.04);
997 hClusterHitMapXInCh[0]->SetTitle("<X> of clusters - associated to a track - in chamber i");
998 hClusterHitMapXInCh[0]->SetMaximum(30);
999 hClusterHitMapXInCh[0]->SetMinimum(-30);
1000 for (Int_t ich=0; ich<10; ich++) {
1001 hClusterHitMapXInCh[ich]->SetLineColor(ich+1+ich/9);
1002 hClusterHitMapXInCh[ich]->SetLineWidth(2);
1003 if (ich == 0) hClusterHitMapXInCh[ich]->Draw("e");
1004 else hClusterHitMapXInCh[ich]->Draw("esame");
1006 lClusterHitMapPerCh->AddEntry(hClusterHitMapXInCh[ich],Form("ch%d",ich+1),"PL");
1008 lClusterHitMapPerCh->Draw("same");
1010 cClusterHitMapPerCh->cd(2);
1011 hClusterHitMapYInCh[0]->SetStats(kFALSE);
1012 hClusterHitMapYInCh[0]->GetXaxis()->SetRange(1,ibin-1);
1013 hClusterHitMapYInCh[0]->GetXaxis()->SetNdivisions(1,kFALSE);
1014 //hNClustersInCh[0]->LabelsOption("u");
1015 hClusterHitMapYInCh[0]->SetLabelSize(0.04);
1016 hClusterHitMapYInCh[0]->SetTitle("<Y> of clusters - associated to a track - in chamber i");
1017 hClusterHitMapYInCh[0]->SetMaximum(30);
1018 hClusterHitMapYInCh[0]->SetMinimum(-30);
1019 for (Int_t ich=0; ich<10; ich++) {
1020 hClusterHitMapYInCh[ich]->SetLineColor(ich+1+ich/9);
1021 hClusterHitMapYInCh[ich]->SetLineWidth(2);
1022 if (ich == 0) hClusterHitMapYInCh[ich]->Draw("e");
1023 else hClusterHitMapYInCh[ich]->Draw("esame");
1025 lClusterHitMapPerCh->Draw("same");
1027 cClusterHitMapPerCh->Print(OutFileNamePDF.Data());
1028 cClusterHitMapPerCh->Write();
1031 //==================================================
1032 // Display tracks ChiSquare
1033 TCanvas* cChi2 = new TCanvas("cChi2","cChi2",1200,900);
1036 hChi2_Mean->SetStats(kFALSE);
1037 hChi2_Mean->GetXaxis()->SetRange(1,ibin-1);
1038 hChi2_Mean->GetXaxis()->SetNdivisions(1,kFALSE);
1039 //hChi2_Mean->LabelsOption("u");
1040 hChi2_Mean->SetLabelSize(0.04);
1041 hChi2_Mean->SetLineWidth(2);
1042 hChi2_Mean->Draw("e");
1045 hChi2_Sigma->SetStats(kFALSE);
1046 hChi2_Sigma->GetXaxis()->SetRange(1,ibin-1);
1047 hChi2_Sigma->GetXaxis()->SetNdivisions(1,kFALSE);
1048 //hChi2_Sigma->LabelsOption("u");
1049 hChi2_Sigma->SetLabelSize(0.04);
1050 hChi2_Sigma->SetLineWidth(2);
1051 hChi2_Sigma->Draw("e");
1053 cChi2->Print(OutFileNamePDF.Data());
1056 //==================================================
1057 // Display track Lpt/Hpt
1058 if ( hTriggerCutVsRun[0] && hTriggerCutVsRun[1] ) {
1059 TCanvas* cLptHpt = new TCanvas("cLptHpt","cLptHpt",1200,900);
1060 cLptHpt->Divide(1,2);
1061 TLegend* legLptHpt = new TLegend(0.72,0.7,0.9,0.85);
1062 legLptHpt->SetBorderSize(1);
1063 for ( Int_t ihisto=0; ihisto<2; ++ihisto) {
1064 cLptHpt->cd(ihisto+1);
1065 TH1* currHistos[2] = {hTriggerCutVsRun[ihisto], hTriggerCutWidthVsRun[ihisto]};
1066 for ( Int_t jhisto=0; jhisto<2; jhisto++ ) {
1067 currHistos[jhisto]->GetXaxis()->SetRange(1,ibin-1);
1068 currHistos[jhisto]->GetYaxis()->SetRangeUser(0.,5.);
1069 currHistos[jhisto]->LabelsOption("a");
1070 currHistos[jhisto]->SetStats(kFALSE);
1071 currHistos[jhisto]->GetXaxis()->SetLabelSize(0.04);
1072 currHistos[jhisto]->SetLineWidth(2);
1074 hTriggerCutWidthVsRun[ihisto]->SetLineColor(2);
1075 hTriggerCutWidthVsRun[ihisto]->SetMarkerColor(2);
1076 hTriggerCutWidthVsRun[ihisto]->SetFillColor(2);
1077 hTriggerCutWidthVsRun[ihisto]->SetFillStyle(3001);
1078 hTriggerCutWidthVsRun[ihisto]->Draw("e2");
1079 hTriggerCutVsRun[ihisto]->Draw("esame");
1080 if ( ihisto == 0 ) {
1081 legLptHpt->AddEntry(hTriggerCutWidthVsRun[ihisto],"Fit width","f");
1082 legLptHpt->AddEntry(hTriggerCutVsRun[ihisto],"pt cut from fit (stat error)","lp");
1083 legLptHpt->Draw("same");
1086 cLptHpt->Print(OutFileNamePDF.Data());
1091 // close the PDF file
1092 c1->Print(OutFileNamePDF_close.Data());
1093 rootFileOut->Close();
1107 void SetCanvas(TCanvas *canvas, Int_t logy){
1110 canvas->SetTopMargin(0.05);
1111 canvas->SetRightMargin(0.01);
1112 canvas->SetGridy(1);
1113 canvas->SetLogy(logy);
1118 Bool_t IsTrigger(TObjArray *array, Int_t index, TString name){
1120 Bool_t process = kFALSE;
1122 if( !array) return process;
1124 TString triggerName = (( (TObjString*) array->At(index) )->GetString());
1126 if( triggerName.Contains(name) ) process = kTRUE;
1131 Bool_t IsHeavyIonCollision(AliCounterCollection *eventCounters){
1133 if(!eventCounters) return kFALSE;
1135 Double_t sum = eventCounters->GetSum("v0mult:low,int,high");
1136 Bool_t result = kTRUE;
1137 if(sum<=0) result = kFALSE;
1139 cout<<" Collision type is set to ";
1140 if( result == kFALSE) cout<<"p-p"<<endl;
1141 else cout<<"heavy-ion"<<endl;
1146 TCanvas *ProcessCanvasTriggerContent(TObjArray *array, TH1 **hBNoPS, TH1 **hBWithPS, TString canvasName){
1148 if(!array || !hBNoPS || !hBWithPS) return 0x0;
1150 TString cName = "c";
1151 cName += canvasName;
1152 TCanvas *cTriggerContent = new TCanvas(canvasName,cName,1200,900);
1153 SetCanvas(cTriggerContent);
1154 cTriggerContent->cd();
1156 TLegend* legcTC = new TLegend(0.2,0.15,0.50,0.40);
1157 legcTC->SetHeader("Physics Selection");
1158 legcTC->AddEntry(".","applied :","");
1160 for(Int_t i = 0; i < array->GetEntriesFast(); i++){
1161 //skip the sum of all triggers
1162 if( i == (array->GetEntriesFast()-1) ) continue;
1163 hBNoPS[i]->SetLineStyle(2);
1165 hBNoPS[i]->SetMinimum(1e-3);
1167 hBWithPS[i]->Draw("same");
1170 hBNoPS[i]->Draw("same");
1171 hBWithPS[i]->Draw("same");
1173 legcTC->AddEntry(hBWithPS[i],(( (TObjString*) array->At(i) )->GetString()).Data(),"l");
1175 legcTC->AddEntry(".","not applied :","");
1177 for(Int_t i = 0; i < array->GetEntriesFast(); i++){
1178 legcTC->AddEntry(hBNoPS[i],(( (TObjString*) array->At(i) )->GetString()).Data(),"l");
1181 legcTC->Draw("same");
1183 return cTriggerContent;
1186 TCanvas *ProcessCanvasRelativeTriggerContent(TObjArray *triggersB, TH1 **histo, TString canvasName, Int_t *colorInd){
1188 if(!triggersB || !histo || !colorInd) return 0x0;
1190 TString cName = "c" ;
1191 cName += canvasName;
1192 TCanvas *cRelativeTriggerContent = new TCanvas(canvasName,cName,1200,900);
1193 SetCanvas(cRelativeTriggerContent);
1194 cRelativeTriggerContent->cd();
1197 TLegend* legcRTC = new TLegend(0.2,0.15,0.50,0.40);
1198 legcRTC->SetHeader("Physics Selection");
1200 TString hName, hTriggerName;
1201 Int_t indAllTrig = triggersB->GetEntriesFast()-1;
1202 cout<<indAllTrig<<endl;
1203 for(Int_t i = 0; i < triggersB->GetEntriesFast()-1; i++){
1205 hName += ( (TObjString*) triggersB->At(i) )->GetString();
1206 ratio[i] = static_cast<TH1*> (histo[i]->Clone(hName));
1207 ratio[i]->Divide(histo[indAllTrig]);
1208 ratio[i]->SetLineWidth(2);
1209 ratio[i]->SetLineColor(colorInd[i]);
1211 ratio[i]->SetMaximum(1.5);
1212 ratio[i]->SetMinimum(0.001);
1213 ratio[i]->SetLabelSize(0.02);
1214 ratio[i]->GetYaxis()->SetTitle("Relative trigger content");
1215 ratio[i]->Draw("E");
1218 ratio[i]->Draw("ESAME");
1222 legcRTC->AddEntry(".","not applied :","");
1223 for(Int_t i = 0; i < triggersB->GetEntriesFast()-1; i++){
1224 legcRTC->AddEntry(ratio[i],(( (TObjString*) triggersB->At(i) )->GetString()).Data(),"l");
1226 legcRTC->Draw("same");
1228 return cRelativeTriggerContent;
1231 TCanvas *ProcessCanvasPhysSelCut(TObjArray *triggersB, TObjArray *triggersAC, TObjArray *triggersE, TH1 **hBNoPS, TH1 **hACNoPS, TH1 **hENoPS, TH1 **hBWithPS, TString canvasName, Int_t *colorInd, Bool_t isHeavyIon){
1233 if(!triggersB || !triggersE || !triggersAC || !hBNoPS || !hACNoPS || !hENoPS || !hBWithPS || !colorInd) return 0x0;
1235 //Multiplicative factor for A,C and E triggers
1236 Float_t scale = 3; //3 for pp - 10 for PbPb
1237 if(isHeavyIon) scale = 10;
1239 TString cName = "c";
1240 cName += canvasName;
1241 TCanvas *c1 = new TCanvas(canvasName,cName,1200,900);
1245 TH1* ratioB[10], *ratioBNoPS[10];
1246 TH1* ratioACNoPS[10];
1247 TH1* ratioENoPS[10];
1248 TLegend* legcRTC = new TLegend(0.2,0.15,0.50,0.40);
1249 legcRTC->SetHeader("Physics Selection");
1252 for(Int_t i = 0; i < triggersB->GetEntriesFast()-1; i++){
1254 //scale A, C and E triggers
1255 hACNoPS[i]->Scale(scale);
1256 hENoPS[i]->Scale(scale);
1259 hName += ( (TObjString*) triggersB->At(i) )->GetString();
1260 ratioB[i] = static_cast<TH1*> (hBWithPS[i]->Clone(hName));
1261 ratioB[i]->Divide(hBNoPS[i]);
1262 ratioB[i]->SetLineWidth(2);
1263 ratioB[i]->SetLineColor(colorInd[i]);
1264 hName = "ratioNoPS";
1265 hName += ( (TObjString*) triggersB->At(i) )->GetString();
1266 ratioBNoPS[i] = static_cast<TH1*> (hBNoPS[i]->Clone(hName));
1267 ratioBNoPS[i]->Divide(hBNoPS[i]);
1268 ratioBNoPS[i]->SetLineWidth(0);
1269 ratioBNoPS[i]->SetLineStyle(1);
1270 ratioBNoPS[i]->SetMarkerStyle(24+i);
1271 ratioBNoPS[i]->SetMarkerSize(1);
1272 ratioBNoPS[i]->SetLineColor(colorInd[i]);
1273 ratioBNoPS[i]->SetMarkerColor(colorInd[i]);
1275 hName = "ratioACNoPS";
1276 hName += ( (TObjString*) triggersAC->At(i) )->GetString();
1277 ratioACNoPS[i] = static_cast<TH1*> (hACNoPS[i]->Clone(hName));
1278 if ( ratioACNoPS[i]->GetEntries() > 0 ) ratioACNoPS[i]->Divide(hBNoPS[i]);
1279 ratioACNoPS[i]->SetLineWidth(0);
1280 ratioACNoPS[i]->SetLineStyle(2);
1281 ratioACNoPS[i]->SetMarkerStyle(24+i);
1282 ratioACNoPS[i]->SetMarkerSize(1);
1283 ratioACNoPS[i]->SetLineColor(colorInd[i]);
1284 ratioACNoPS[i]->SetMarkerColor(colorInd[i]);
1287 hName = "ratioENoPS";
1288 hName += ( (TObjString*) triggersE->At(i) )->GetString();
1289 ratioENoPS[i] = static_cast<TH1*> (hENoPS[i]->Clone(hName));
1290 if ( ratioENoPS[i]->GetEntries() > 0 ) ratioENoPS[i]->Divide(hBNoPS[i]);
1291 ratioENoPS[i]->SetLineWidth(0);
1292 ratioENoPS[i]->SetLineStyle(3);
1293 ratioENoPS[i]->SetMarkerStyle(24+i);
1294 ratioENoPS[i]->SetMarkerSize(1);
1295 ratioENoPS[i]->SetLineColor(colorInd[i]);
1296 ratioENoPS[i]->SetMarkerColor(colorInd[i]);
1300 ratioB[i]->SetMaximum(1.5);
1301 ratioB[i]->SetMinimum(0.05);
1302 ratioB[i]->SetLabelSize(0.02);
1303 ratioB[i]->GetYaxis()->SetTitle("Accepted / All from Phys. Sel.");
1304 ratioB[i]->SetTitle("Phys. Sel. for all selected triggers");
1305 ratioB[i]->Draw("E");
1306 //ratioBNoPS[i]->Draw("EPSAME");
1307 ratioACNoPS[i]->Draw("EPSAME");
1308 ratioENoPS[i]->Draw("EPSAME");
1311 ratioB[i]->Draw("ESAME");
1312 //ratioBNoPS[i]->Draw("EPSAME");
1313 ratioACNoPS[i]->Draw("EPSAME");
1314 ratioENoPS[i]->Draw("EPSAME");
1318 legcRTC->AddEntry(".","applied :","");
1319 for(Int_t i = 0; i < triggersB->GetEntriesFast()-1; i++){
1320 legcRTC->AddEntry(ratioB[i],(( (TObjString*) triggersB->At(i) )->GetString()).Data(),"l");
1322 legcRTC->AddEntry(".","not applied :","");
1323 for(Int_t i = 0; i < triggersB->GetEntriesFast()-1; i++){
1324 //legcRTC->AddEntry(ratioBNoPS[i],(( (TObjString*) triggersB->At(i) )->GetString()).Data(),"pl");
1325 TString textLegend = ( (TObjString*) triggersAC->At(i) )->GetString();
1326 if( textLegend.CompareTo(" ") ){
1328 textLegend += scale;
1329 legcRTC->AddEntry(ratioACNoPS[i],textLegend.Data(),"pl");
1331 textLegend = ( (TObjString*) triggersE->At(i) )->GetString();
1332 if( textLegend.CompareTo(" ") ){
1333 //cout<<"trigger="<<textLegend.Data()<<"-"<<endl;
1335 textLegend += scale;
1336 legcRTC->AddEntry(ratioENoPS[i],textLegend.Data(),"pl");
1339 legcRTC->Draw("same");
1345 TCanvas *ProcessCanvasPhysSelCutCentrality(TObjArray *triggersB, TObjArray *triggersAC, TObjArray *triggersE, TH1 **hBNoPSCent, TH1 **hACNoPSCent, TH1 **hENoPSCent, TH1 **hBWithPSCent, Int_t k, TString canvasName, Int_t *colorInd, TString *legendHeader, Bool_t isHeavyIon){
1347 if(!triggersB || !triggersE || !triggersAC || !hBNoPSCent || !hACNoPSCent || !hENoPSCent || !hBWithPSCent || !colorInd || !legendHeader) return 0x0;
1349 //Multiplicative factor for A,C and E triggers
1350 Float_t scale = 3; //3 for pp - 10 for PbPb
1351 if(isHeavyIon) scale = 10;
1353 TString cName = "c";
1354 cName += canvasName;
1355 TCanvas *c1 = new TCanvas(canvasName,cName,1200,900);
1359 Int_t const centBinMax =3;
1360 TH1* ratioB[centBinMax], *ratioBNoPS[centBinMax];
1361 TH1* ratioACNoPS[centBinMax];
1362 TH1* ratioENoPS[centBinMax];
1363 TLegend* legcRTC = new TLegend(0.2,0.15,0.50,0.40);
1364 legcRTC->SetHeader("Physics Selection");
1368 Float_t yMin = 0.05, yMax = 2;
1370 for(Int_t centBin = 0; centBin < centBinMax; centBin++){
1371 //scale A, C and E triggers
1372 hACNoPSCent[centBin]->Scale(scale);
1373 hENoPSCent[centBin]->Scale(scale);
1376 hName += ( (TObjString*) triggersB->At(k) )->GetString();
1377 ratioB[centBin] = static_cast<TH1*> (hBWithPSCent[centBin]->Clone(hName));
1378 ratioB[centBin]->Divide(hBNoPSCent[centBin]);
1379 ratioB[centBin]->SetLineWidth(2);
1380 ratioB[centBin]->SetLineColor(colorInd[centBin]);
1381 hName = "ratioNoPS";
1382 hName += ( (TObjString*) triggersB->At(k) )->GetString();
1383 ratioBNoPS[centBin] = static_cast<TH1*> (hBNoPSCent[centBin]->Clone(hName));
1384 ratioBNoPS[centBin]->Divide(hBNoPSCent[centBin]);
1385 ratioBNoPS[centBin]->SetLineWidth(0);
1386 ratioBNoPS[centBin]->SetLineStyle(1);
1387 ratioBNoPS[centBin]->SetMarkerStyle(24+centBin);
1388 ratioBNoPS[centBin]->SetMarkerSize(1);
1389 ratioBNoPS[centBin]->SetLineColor(colorInd[centBin]);
1390 ratioBNoPS[centBin]->SetMarkerColor(colorInd[centBin]);
1392 hName = "ratioACNoPS";
1393 hName += ( (TObjString*) triggersAC->At(k) )->GetString();
1394 ratioACNoPS[centBin] = static_cast<TH1*> (hACNoPSCent[centBin]->Clone(hName));
1395 if ( ratioACNoPS[centBin]->GetEntries() > 0 ) ratioACNoPS[centBin]->Divide(hBNoPSCent[centBin]);
1396 ratioACNoPS[centBin]->SetLineWidth(0);
1397 ratioACNoPS[centBin]->SetLineStyle(2);
1398 ratioACNoPS[centBin]->SetMarkerStyle(24+centBin);
1399 ratioACNoPS[centBin]->SetMarkerSize(1);
1400 ratioACNoPS[centBin]->SetLineColor(colorInd[centBin]);
1401 ratioACNoPS[centBin]->SetMarkerColor(colorInd[centBin]);
1404 hName = "ratioENoPS";
1405 hName += ( (TObjString*) triggersE->At(k) )->GetString();
1406 ratioENoPS[centBin] = static_cast<TH1*> (hENoPSCent[centBin]->Clone(hName));
1407 if ( ratioENoPS[centBin]->GetEntries() > 0 ) ratioENoPS[centBin]->Divide(hBNoPSCent[centBin]);
1408 ratioENoPS[centBin]->SetLineWidth(0);
1409 ratioENoPS[centBin]->SetLineStyle(3);
1410 ratioENoPS[centBin]->SetMarkerStyle(24+centBin);
1411 ratioENoPS[centBin]->SetMarkerSize(1);
1412 ratioENoPS[centBin]->SetLineColor(colorInd[centBin]);
1413 ratioENoPS[centBin]->SetMarkerColor(colorInd[centBin]);
1417 ratioB[centBin]->SetMaximum(yMax);
1418 ratioB[centBin]->SetMinimum(yMin);
1419 ratioB[centBin]->SetLabelSize(0.02);
1420 ratioB[centBin]->GetYaxis()->SetTitle("Accepted / All from Phys. Sel.");
1421 ratioB[centBin]->SetTitle(Form("Phys. Sel. for %s - Multiplicity from V0 amplitude",(( (TObjString*) triggersB->At(k) )->GetString()).Data() ));
1422 ratioB[centBin]->Draw("E");
1423 //ratioBNoPS[centBin]->Draw("EPSAME");
1424 ratioACNoPS[centBin]->Draw("EPSAME");
1425 ratioENoPS[centBin]->Draw("EPSAME");
1428 ratioB[centBin]->Draw("ESAME");
1429 //ratioBNoPS[centBin]->Draw("EPSAME");
1430 ratioACNoPS[centBin]->Draw("EPSAME");
1431 ratioENoPS[centBin]->Draw("EPSAME");
1435 legcRTC->AddEntry(".","applied :","");
1436 for(Int_t centBin = 0; centBin < centBinMax; centBin++){
1437 legcRTC->AddEntry(ratioB[centBin],(legendHeader[centBin]).Data(),"l");
1439 legcRTC->AddEntry(".","not applied :","");
1440 for(Int_t centBin = 0; centBin < centBinMax; centBin++){
1441 TString textLegend = ( (TObjString*) triggersAC->At(k) )->GetString();
1442 if( textLegend.CompareTo(" ") && ratioACNoPS[centBin]->GetMaximum() > yMin ){
1444 textLegend += scale;
1445 legcRTC->AddEntry(ratioACNoPS[centBin],textLegend.Data(),"pl");
1447 textLegend = ( (TObjString*) triggersE->At(k) )->GetString();
1448 if( textLegend.CompareTo(" ") && ratioENoPS[centBin]->GetMaximum() > yMin){
1449 //cout<<"trigger="<<textLegend.Data()<<"-"<<endl;
1451 textLegend += scale;
1452 legcRTC->AddEntry(ratioENoPS[centBin],textLegend.Data(),"pl");
1455 legcRTC->Draw("same");
1461 TCanvas *ProcessCanvasCentralityPercentile(TObjArray *triggersB, TH1 **hBNoPSCent, TH1 **hBWithPSCent, Int_t k, TString canvasName, Int_t *colorInd, TString *legendHeader){
1463 if(!triggersB || !hBNoPSCent || !hBWithPSCent || !colorInd || !legendHeader) return 0x0;
1465 TString cName = "c";
1466 cName += canvasName;
1467 TCanvas *c1 = new TCanvas(canvasName,cName,1200,900);
1471 Int_t const centBinMax =2;
1472 TH1* ratioB[centBinMax], *ratioBNoPS[centBinMax];
1473 TLegend* legcRTC = new TLegend(0.2,0.15,0.50,0.40);
1474 legcRTC->SetHeader("Physics Selection");
1478 Float_t yMin = 0., yMax = 0.3;
1480 for(Int_t centBin = 0; centBin < centBinMax; centBin++){
1483 hName += ( (TObjString*) triggersB->At(k) )->GetString();
1484 ratioB[centBin] = static_cast<TH1*> (hBWithPSCent[centBin+1]->Clone(hName));
1485 ratioB[centBin]->Divide(hBWithPSCent[0]);
1486 ratioB[centBin]->Scale(0.8);
1487 ratioB[centBin]->SetLineWidth(2);
1488 ratioB[centBin]->SetLineColor(colorInd[centBin+1]);
1489 hName = "ratioNoPS";
1490 hName += ( (TObjString*) triggersB->At(k) )->GetString();
1491 ratioBNoPS[centBin] = static_cast<TH1*> (hBNoPSCent[centBin+1]->Clone(hName));
1492 ratioBNoPS[centBin]->Divide(hBNoPSCent[0]);
1493 ratioBNoPS[centBin]->Scale(0.8);
1494 ratioBNoPS[centBin]->SetLineWidth(0);
1495 ratioBNoPS[centBin]->SetLineStyle(1);
1496 ratioBNoPS[centBin]->SetMarkerStyle(24+centBin+1);
1497 ratioBNoPS[centBin]->SetMarkerSize(1);
1498 ratioBNoPS[centBin]->SetLineColor(colorInd[centBin+1]);
1499 ratioBNoPS[centBin]->SetMarkerColor(colorInd[centBin+1]);
1502 ratioB[centBin]->SetMaximum(yMax);
1503 ratioB[centBin]->SetMinimum(yMin);
1504 ratioB[centBin]->SetLabelSize(0.02);
1505 ratioB[centBin]->GetYaxis()->SetTitle("Centrality percentile check");
1506 ratioB[centBin]->SetTitle(Form("Centrality percentile check for %s - Multiplicity from V0 amplitude",(( (TObjString*) triggersB->At(k) )->GetString()).Data() ));
1507 ratioB[centBin]->Draw("E");
1508 ratioBNoPS[centBin]->Draw("EPSAME");
1511 ratioB[centBin]->Draw("ESAME");
1512 ratioBNoPS[centBin]->Draw("EPSAME");
1516 legcRTC->AddEntry(".","applied :","");
1517 for(Int_t centBin = 0; centBin < centBinMax; centBin++){
1518 legcRTC->AddEntry(ratioB[centBin],(legendHeader[centBin+1]).Data(),"l");
1520 legcRTC->AddEntry(".","not applied :","");
1521 for(Int_t centBin = 0; centBin < centBinMax; centBin++){
1522 legcRTC->AddEntry(ratioBNoPS[centBin],(legendHeader[centBin+1]).Data(),"l");
1524 legcRTC->Draw("same");
1530 TCanvas *ProcessCanvasTracksoverTrigger(TObjArray *triggersB, TH1 **hB, TH1 **hTrackerB, TH1 **hTriggerB, TH1 **hMatchedB, TH1 **hAllTracksB, Int_t indTrigger, TString canvasName, TString legendHeader){
1532 if(!triggersB || !hB || !hTrackerB || !hTriggerB || !hMatchedB || !hAllTracksB || indTrigger<0 ) return 0x0;
1534 TH1 *hTrackerPerB, *hTriggerPerB, *hMatchedPerB, *hAllTracksPerB;
1536 TString hName, hNameBase;
1537 hNameBase =( (TObjString*) triggersB->At(indTrigger) )->GetString();
1539 hName = "hTrackerPer";
1541 hTrackerPerB = static_cast<TH1*>(hTrackerB[indTrigger]->Clone(hName));
1542 if ( hTrackerPerB->GetEntries() > 0 ) hTrackerPerB->Divide(hB[indTrigger]);
1543 hTrackerPerB->SetLineWidth(2);
1544 hTrackerPerB->SetLineColor(kRed);
1546 hName = "hTriggerPer";
1548 hTriggerPerB = static_cast<TH1*>(hTriggerB[indTrigger]->Clone(hName));
1549 if ( hTriggerPerB->GetEntries() > 0 ) hTriggerPerB->Divide(hB[indTrigger]);
1550 hTriggerPerB->SetLineWidth(2);
1551 hTriggerPerB->SetLineColor(kBlue);
1553 hName = "hMatchedPer";
1555 hMatchedPerB = static_cast<TH1*>(hMatchedB[indTrigger]->Clone(hName));
1556 if ( hMatchedPerB->GetEntries() > 0 ) hMatchedPerB->Divide(hB[indTrigger]);
1557 hMatchedPerB->SetLineWidth(2);
1558 hMatchedPerB->SetLineColor(kViolet);
1560 hName = "hAllTracksPer";
1562 hAllTracksPerB = static_cast<TH1*>(hAllTracksB[indTrigger]->Clone(hName));
1563 if ( hAllTracksPerB->GetEntries() > 0 ) hAllTracksPerB->Divide(hB[indTrigger]);
1564 hAllTracksPerB->SetLineWidth(3);
1565 hAllTracksPerB->SetLineColor(kBlack);
1566 hAllTracksPerB->SetTitle(Form("Number of Tracks /%s for %s",hNameBase.Data(),legendHeader.Data()));
1567 hAllTracksPerB->SetMinimum(0.0001);
1568 hAllTracksPerB->SetLabelSize(0.02);
1571 TString cName = "c";
1572 cName += canvasName;
1573 hNameBase =( (TObjString*) triggersB->At(indTrigger) )->GetString();
1575 canvasName += indTrigger;
1576 TCanvas *cRatioTrackTypesB = new TCanvas(canvasName,cName,1200,900);
1577 SetCanvas(cRatioTrackTypesB,0);
1578 cRatioTrackTypesB->cd();
1580 TLegend* legcTTCINT1B;
1582 hAllTracksPerB->Draw("E");
1583 hTrackerPerB->Draw("Esame");
1584 hMatchedPerB->Draw("Esame");
1585 hTriggerPerB->Draw("Esame");
1587 legcTTCINT1B = new TLegend(0.70,0.5,0.90,0.70);
1588 legcTTCINT1B->AddEntry(hAllTracksPerB,"All tracks","l");
1589 legcTTCINT1B->AddEntry(hTrackerPerB,"Tracking (only) tracks","l");
1590 legcTTCINT1B->AddEntry(hMatchedPerB,"Matched tracks","l");
1591 legcTTCINT1B->AddEntry(hTriggerPerB,"Trigger (only) tracks","l");
1592 legcTTCINT1B->Draw("same");
1596 return cRatioTrackTypesB;
1601 TCanvas *ProcessCanvasTrackMultB(TObjArray *triggersB, TH1 **hB, TH1 **hTrackerB, TH1 **hTriggerB, TH1 **hMatchedB, TH1 **hAllTracksB, Int_t indTrigger, TString canvasName,TString legendHeader){
1603 if(!triggersB || !hB || !hTrackerB || !hTriggerB || !hMatchedB || !hAllTracksB || indTrigger<0 ) return 0x0;
1605 TString cName = "c";
1606 cName += canvasName;
1607 TString hNameBase =( (TObjString*) triggersB->At(indTrigger) )->GetString();
1609 canvasName += indTrigger;
1610 TCanvas *cTrackMultB = new TCanvas(canvasName,cName,1200,900);
1611 SetCanvas(cTrackMultB,0);
1613 cTrackMultB->Divide(1,2);
1617 TH1* hSumTriggerOverB, *hSumTrackerOverB;
1621 hName = Form("hSumTriggerOver%s",hNameBase.Data());
1622 hSumTriggerOverB = static_cast<TH1*>(hTriggerB[indTrigger]->Clone(hName));
1623 hSumTriggerOverB->Add(hMatchedB[indTrigger]);
1624 hSumTriggerOverB->Divide(hB[indTrigger]);
1626 hName = Form("Sum of trigger tracks (matched+trigger-only) / # events in %s for %s",hNameBase.Data(),legendHeader.Data());
1627 hSumTriggerOverB->SetTitle(hName);
1628 hSumTriggerOverB->SetLabelSize(0.02);
1629 hSumTriggerOverB->SetLineWidth(2);
1630 hSumTriggerOverB->SetLineColor(kBlue);
1631 hName = Form("hSumTrackerOver%s",hNameBase.Data());
1632 hSumTrackerOverB = static_cast<TH1*>(hTrackerB[indTrigger]->Clone(hName));
1633 hSumTrackerOverB->Add(hMatchedB[indTrigger]);
1634 hSumTrackerOverB->Divide(hB[indTrigger]);
1635 hName = Form("Sum of tracker tracks (matched+tracker-only) / # events in %s for %s",hNameBase.Data(),legendHeader.Data());
1636 hSumTrackerOverB->SetTitle(hName);
1637 //hSumTrackerOverCINT1B->LabelsOption("u");
1638 hSumTrackerOverB->SetLabelSize(0.02);
1639 hSumTrackerOverB->SetLineWidth(2);
1640 hSumTrackerOverB->SetLineColor(kBlue);
1644 hSumTriggerOverB->Draw("e");
1646 hSumTrackerOverB->Draw("e");
1652 TCanvas *ProcessCanvasRatioTrackB(TObjArray *triggersB, TH1 **hB, TH1 **hTrackerB, TH1 **hTriggerB, TH1 **hMatchedB, TH1 **hAllTracksB, Int_t indTrigger, TString canvasName,TString legendHeader){
1654 if(!triggersB || !hB || !hTrackerB || !hTriggerB || !hMatchedB || !hAllTracksB || indTrigger<0 ) return 0x0;
1656 TString cName = "c";
1657 cName += canvasName;
1658 TString hNameBase =( (TObjString*) triggersB->At(indTrigger) )->GetString();
1660 canvasName += indTrigger;
1661 TCanvas *cRatioTrackB = new TCanvas(canvasName,cName,1200,900);
1662 SetCanvas(cRatioTrackB,0);
1664 TH1* hTrackerOverTriggerB, *hMatchedOverTriggerB, *hMatchedOverTrackerB;
1666 TString hName = Form("hTrackerOverTrigger%s",hNameBase.Data());
1667 hTrackerOverTriggerB = static_cast<TH1*>(hTrackerB[indTrigger]->Clone(hName));
1668 hTrackerOverTriggerB->Divide(hTriggerB[indTrigger]);
1669 hName = Form("# tracker tracks / # trigger tracks in %s for %s",hNameBase.Data(),legendHeader.Data());
1670 hTrackerOverTriggerB->SetTitle(hName);
1671 //hTrackerOverTriggerCINT1B->LabelsOption("u");
1672 hTrackerOverTriggerB->SetLabelSize(0.02);
1673 hTrackerOverTriggerB->SetLineWidth(2);
1674 hTrackerOverTriggerB->SetLineColor(kBlue);
1676 hName = Form("hMatchedOverTrigger%s",hNameBase.Data());
1677 hMatchedOverTriggerB = static_cast<TH1*>(hMatchedB[indTrigger]->Clone(hName));
1678 hMatchedOverTriggerB->Divide(hTriggerB[indTrigger]);
1680 hName = Form("# matched tracks / # trigger tracks in %s for %s",hNameBase.Data(),legendHeader.Data());
1681 hMatchedOverTriggerB->SetTitle(hName);
1682 //hMatchedOverTriggerCINT1B->LabelsOption("u");
1683 hMatchedOverTriggerB->SetLabelSize(0.02);
1684 hMatchedOverTriggerB->SetLineWidth(2);
1685 hMatchedOverTriggerB->SetLineColor(kBlue);
1687 hName = Form("hMatchedOverTracker%s",hNameBase.Data());
1688 hMatchedOverTrackerB = static_cast<TH1*>(hMatchedB[indTrigger]->Clone(hName));
1689 hMatchedOverTrackerB->Divide(hTrackerB[indTrigger]);
1690 hName = Form("# matched tracks / # tracker tracks in %s for %s",hNameBase.Data(),legendHeader.Data());
1691 hMatchedOverTrackerB->SetTitle(hName);
1692 //hMatchedOverTrackerCINT1B->LabelsOption("u");
1693 hMatchedOverTrackerB->SetLabelSize(0.02);
1694 hMatchedOverTrackerB->SetLineWidth(2);
1695 hMatchedOverTrackerB->SetLineColor(kBlue);
1698 cRatioTrackB->Divide(1,3);
1699 cRatioTrackB->cd(1);
1700 hTrackerOverTriggerB->Draw("e");
1701 cRatioTrackB->cd(2);
1702 hMatchedOverTriggerB->Draw("e");
1703 cRatioTrackB->cd(3);
1704 hMatchedOverTrackerB->Draw("e");
1706 return cRatioTrackB;
1710 TCanvas *ProcessCanvasAsymMatched(TObjArray *triggersB, TH1 **hPosMatchedB, TH1 **hNegMatchedB, TH1 **hAllMatchedB, Int_t indTrigger, TString canvasName,TString legendHeader){
1712 if(!triggersB || !hPosMatchedB || !hNegMatchedB || !hAllMatchedB || indTrigger<0 ) return 0x0;
1714 TString hName, hNameBase = (( (TObjString*) triggersB->At(indTrigger) )->GetString());
1716 TString cName = "c";
1717 cName += canvasName;
1719 canvasName += indTrigger;
1720 TCanvas *cAsymMatched = new TCanvas(canvasName.Data(),cName,1200,900);
1721 SetCanvas(cAsymMatched,0);
1725 TH1 *hDiffMatchedCMUS1B= static_cast<TH1*>(hPosMatchedB[indTrigger]->Clone("hDiffMatchedCMUS1B"));
1726 hDiffMatchedCMUS1B->Add(hNegMatchedB[indTrigger],-1);
1727 hDiffMatchedCMUS1B->Sumw2();
1729 TH1 *hAsymMatchedCMUS1B= static_cast<TH1*>(hDiffMatchedCMUS1B->Clone("hAsymMatchedCMUS1B"));
1730 hAsymMatchedCMUS1B->Divide(hAllMatchedB[indTrigger]);
1731 hAsymMatchedCMUS1B->SetLineColor(kRed);
1732 hAsymMatchedCMUS1B->SetLineWidth(2);
1733 hAsymMatchedCMUS1B->SetMinimum(-0.3);
1734 hAsymMatchedCMUS1B->SetMaximum(0.3);
1735 hAsymMatchedCMUS1B->SetLabelSize(0.02);
1736 hName = Form("Matched tracks charge asymmetry for %s with acc. cuts for %s",hNameBase.Data(),legendHeader.Data());
1737 hAsymMatchedCMUS1B->SetTitle(hName);
1739 hAsymMatchedCMUS1B->GetYaxis()->SetTitle("Charged tracks asymmetry");
1740 hAsymMatchedCMUS1B->Draw("EH");
1742 return cAsymMatched;
1746 TCanvas *ProcessCanvasHighPtMuons(TObjArray *triggersB, TH1 **hB, TH1 **hMatchedLowPtB, TH1 **hMatchedHighPtB, Int_t indTrigger, TString canvasName, TString legendHeader){
1748 if(!triggersB || !hB || !hMatchedLowPtB || !hMatchedHighPtB || indTrigger<0 ) return 0x0;
1750 TString hName, hNameBase = (( (TObjString*) triggersB->At(indTrigger) )->GetString());
1752 TString cName = "c";
1753 cName += canvasName;
1755 canvasName += indTrigger;
1756 TCanvas *cHighPtMuons = new TCanvas(canvasName.Data(),cName,1200,900);
1757 SetCanvas(cHighPtMuons,0);
1762 TH1* hMatchedLowPtPerB, *hMatchedHighPtPerB;
1763 hName = Form("hMatchedLowPtPer%s ",hNameBase.Data());
1764 hMatchedLowPtPerB = static_cast<TH1*> (hMatchedLowPtB[indTrigger]->Clone(hName));
1765 hMatchedLowPtPerB->Sumw2();
1766 hMatchedLowPtPerB->Divide(hB[indTrigger]);
1767 hMatchedLowPtPerB->SetLineWidth(2);
1768 hMatchedLowPtPerB->SetLineColor(kBlue);
1769 hMatchedLowPtPerB->SetTitle("");
1770 hName = Form("Ratio per %s ",hNameBase.Data());
1771 hMatchedLowPtPerB->GetYaxis()->SetTitle(hName);
1772 //hMatchedLowPtPerB->SetMaximum(0.15);
1773 hMatchedLowPtPerB->SetMinimum(0.0001);
1774 hMatchedLowPtPerB->SetLabelSize(0.02);
1776 hName = Form("hMatchedHighPtPer%s ",hNameBase.Data());
1777 hMatchedHighPtPerB = static_cast<TH1*> (hMatchedHighPtB[indTrigger]->Clone(hName));
1778 hMatchedHighPtPerB->Sumw2();
1779 hMatchedHighPtPerB->Divide(hB[indTrigger]);
1780 hMatchedHighPtPerB->SetLineWidth(2);
1781 hMatchedHighPtPerB->SetLineColor(kRed);
1783 hName = Form("Number of matched track per %s (include Vtx and R_{Abs} cuts) for %s",hNameBase.Data(),legendHeader.Data());
1784 hMatchedLowPtPerB->SetTitle(hName);
1785 hMatchedLowPtPerB->Draw("E");
1786 hMatchedHighPtPerB->Draw("Esame");
1788 legcHPM = new TLegend(0.60,0.45,0.98,0.65);
1789 //legcHPM->SetHeader(hName);
1790 legcHPM->AddEntry(".","Physics selection applied :","");
1791 legcHPM->AddEntry(hMatchedLowPtPerB," p_{T} > 1 GeV/c ","l");
1792 legcHPM->AddEntry(hMatchedHighPtPerB," p_{T} > 2 GeV/c ","l");
1793 legcHPM->Draw("same");
1795 return cHighPtMuons;
1800 TH1* ProcessHisto( AliCounterCollection* counter, TString hVariable, TString hSelection, TString hName, TString xName, TString yName, Int_t color){
1804 if( !counter ) return h1;
1806 //cout<<"ProcessHisto selection "<<hSelection<<endl;
1808 if ( !hSelection.Contains("trigger: /") && !hSelection.Contains("trigger:/") ) h1 = (TH1*) counter->Draw(hVariable,hSelection);
1809 if ( !h1 ) h1 = new TH1D(hName,"",10,0,10);
1812 h1->LabelsOption("a");
1813 if(hName.Sizeof()>1) h1->SetName(hName);
1814 if(xName.Sizeof()>1) h1->GetXaxis()->SetTitle(xName);
1815 if(yName.Sizeof()>1) h1->GetYaxis()->SetTitle(yName);
1816 if(color>0) h1->SetLineColor(color);
1823 TH2* ProcessHisto2D( AliCounterCollection* counter, TString hVariable, TString hVariable2, TString hSelection, TString hName){
1827 if( !counter ) return h1;
1828 Bool_t setName = kTRUE;
1830 if(hName.Sizeof()==1) setName = kFALSE;
1832 h1 = (TH2*) counter->Draw(hVariable,hVariable2,hSelection);
1833 if ( !h1 ) h1 = new TH2D(hName,"",10,0,10,10,0,10);
1836 h1->LabelsOption("a");
1837 if(setName) h1->SetName(hName);
1843 Bool_t GetTriggerLists(const char* triggerList, TString listFromContainer, TObjArray *triggersB, TObjArray *triggersAC, TObjArray *triggersE){
1845 //Get the trigger list from a file
1846 //The file should consist of a line for each trigger with the following layout:
1847 // triggernameB triggerNameAC triggerNameE
1848 // or triggernameB triggerNameA,triggerNameC triggerNameE
1849 // or triggernameB triggerNameACE notrigger
1850 //if filename is 0, then default trigger names (pp 2011) are used
1852 if( !triggersB || !triggersAC || !triggersE) return kFALSE;
1853 TObjArray* triggers[3] = {triggersB, triggersAC, triggersE};
1855 TString trigSuffix[3] = {"B", "AC", "E"};
1856 TString currTrigName = "";
1857 TObjArray* fullTriggerList[3];
1859 for ( Int_t ibeam=0; ibeam<3; ++ibeam ) {
1860 fullTriggerList[ibeam] = new TObjArray;
1861 fullTriggerList[ibeam]->SetOwner();
1864 // Build trigger list (from file or default)
1865 if ( triggerList ) {
1866 // only the ones in the triggerList
1867 ifstream inFile(triggerList);
1868 if (!inFile.is_open()) {
1869 Error("PlotMuonQA","unable to open file %s", triggerList);
1873 while ( !inFile.eof() ) {
1874 Bool_t isGoodB = kTRUE;
1875 for ( Int_t ibeam=0; ibeam<3; ++ibeam ) {
1876 currTrigName.ReadToken( inFile );
1877 if ( ! isGoodB ) continue;
1878 if ( currTrigName.IsNull() || ! currTrigName.IsAscii() ) {
1883 currTrigName = "notrigger";
1885 fullTriggerList[ibeam]->AddLast(new TObjString(currTrigName));
1891 TString baseTrigName[4] = {"CINT7", "CMUSH7", "CMUL7", "CMUU7"};
1892 for ( Int_t ibase=0; ibase<4; ++ibase ) {
1893 for ( Int_t ibeam=0; ibeam<3; ++ibeam ) {
1894 // by default all triggers from new period in LHC11c
1895 currTrigName = baseTrigName[ibase] + trigSuffix[ibeam];
1896 fullTriggerList[ibeam]->AddLast(new TObjString(currTrigName));
1901 // Select only existing triggers in container
1903 TObjArray *triggersFromContainer = listFromContainer.Tokenize(",");
1904 TObjString* trigName = 0x0;
1906 TString selectAllTriggers[3] = {"", "", ""};
1907 for ( Int_t itrig=0; itrig<fullTriggerList[0]->GetEntries(); ++itrig ) {
1908 Bool_t isBadTrig = kFALSE;
1909 for ( Int_t ibeam=0; ibeam<3; ++ibeam ) {
1910 currTrigName = fullTriggerList[ibeam]->At(itrig)->GetName();
1912 //condition on trigger name from trigger list
1913 if ( currTrigName.Contains("notrigger") ){
1915 if ( ibeam == 0 ) break;
1918 //select only the existing triggers in the container
1919 //note that the trigger in the trigger file can be a list of different trigger
1920 if ( triggersFromContainer ) {
1921 TIter nextTrigger( triggersFromContainer );
1923 while ( ( trigName = static_cast<TObjString*>(nextTrigger()) ) ) {
1924 if ( currTrigName.Contains(trigName->GetString()) ){
1928 if ( isBadTrig == kTRUE ){
1929 if ( ibeam == 0 ) break;
1933 triggers[ibeam]->AddLast(new TObjString(currTrigName));
1934 if ( isBadTrig ) continue;
1935 if ( ! selectAllTriggers[ibeam].IsNull() ) selectAllTriggers[ibeam] += ",";
1936 selectAllTriggers[ibeam] += currTrigName;
1939 if(triggersFromContainer) delete triggersFromContainer;
1940 if(trigName) delete trigName;
1943 // Complete trigger list and print values
1944 cout<<" Nr of triggers read "<<triggers[0]->GetEntriesFast()<<endl;
1945 for ( Int_t ibeam=0; ibeam<3; ++ibeam ) {
1946 triggers[ibeam]->AddLast(new TObjString(selectAllTriggers[ibeam]));
1947 printf(" %s triggers:\n", trigSuffix[ibeam].Data());
1948 triggers[ibeam]->Print();
1949 delete fullTriggerList[ibeam];
1955 TString GetRunList(const char *runList, TObjArray *runs, TObjArray *runs2){
1957 // list of runs to be analyzed
1958 TString selectRuns = "run:";
1961 // only the ones in the runList
1962 ifstream inFile(runList);
1963 if (!inFile.is_open()) {
1964 Error("PlotMuonQA","unable to open file %s", runList);
1969 while (!inFile.eof()) {
1970 currRun.ReadLine(inFile, kTRUE);
1971 if (currRun.IsNull()) continue;
1972 if (!currRun.IsDigit()) {
1973 Error("PlotMuonQA","invalid run number: %s", currRun.Data());
1976 if(runs) runs->AddLast(new TObjString(Form("%09d", currRun.Atoi())));
1977 if(runs2) runs2->AddLast(new TObjString(Form("%d", currRun.Atoi())));
1978 selectRuns += Form("%s,",currRun.Data());
1980 selectRuns.Remove(TString::kTrailing, ',');
1985 if(runs) runs->AddLast(new TObjString("*"));
1986 if(runs2) runs2->AddLast(new TObjString("*"));
1989 printf("selected runs from runlist %s: %s\n",runList, selectRuns.Data());