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}/PWGmuon "; gSystem->SetIncludePath(includePath.Data());
15 // The macro reads results of the QA task and produce monitoring plots.
17 // Authors: Philippe Pillot - SUBATECH Nantes, Christophe Suire, Cynthia Hadjidakis - IPN Orsay
19 // - reorganize last part (reading and extracting info from run per run histos)
21 //--------------------------------------------------------------------------
23 #if !defined(__CINT__) || defined(__MAKECINT__)
25 #include <Riostream.h>
31 #include "TGridResult.h"
32 #include "THashList.h"
42 #include "TObjArray.h"
43 #include "TObjString.h"
46 #include "AliCounterCollection.h"
50 TString GetRunList(const char *runList, TObjArray *runs, TObjArray *runs2);
51 Bool_t GetTriggerLists(const char *triggerList, TString listFromContainer, TObjArray *triggersB=0, TObjArray *triggersAC=0, TObjArray *triggersE=0, TObjArray *triggersShortName=0);
52 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);
57 TCanvas *ProcessCanvasTriggerContent(TObjArray *array, TH1 **histo, TH1 **histo2, TString canvasName);
58 TCanvas *ProcessCanvasRelativeTriggerContent(TObjArray *array, TH1 **histo, TString canvasName, TArrayI *colorInd);
59 TCanvas *ProcessCanvasPhysSelCut(TObjArray *triggersB, TObjArray *triggersAC, TObjArray *triggersE, TH1 **hBNoPS, TH1 **hACNoPS,TH1 **hENoPS, TH1 **hBWithPS, TString canvasName, TArrayI *colorInd, Bool_t isHeavyIon = kFALSE);
60 TCanvas *ProcessCanvasPhysSelCutCentrality(TObjArray *triggersB, TObjArray *triggersAC, TObjArray *triggersE, TH1 **hBNoPS, TH1 **hACNoPS, TH1 **hENoPS, TH1 **hBWithPS, Int_t k, TString canvasName, TArrayI *colorInd, TString *legendHeader, Bool_t isHeavyIon = kFALSE);
61 TCanvas *ProcessCanvasCentralityPercentile(TObjArray *triggersB, TH1 **hBNoPSCent, TH1 **hBWithPSCent, Int_t k, TString canvasName, TArrayI *colorInd, TString *legendHeader);
62 TCanvas *ProcessCanvasTracksoverTrigger(TObjArray *triggersB, TH1 **hB, TH1 **hTrackerB, TH1 **hTriggerB, TH1 **hMatchedB, TH1 **hAllTracksB, Int_t indTrigger, TString canvasName,TString legendHeader="");
63 TCanvas *ProcessCanvasTrackMultB(TObjArray *triggersB, TH1 **hB, TH1 **hTrackerB, TH1 **hTriggerB, TH1 **hMatchedB, TH1 **hAllTracksB, Int_t indTrigger, TString canvasName,TString legendHeader="");
64 TCanvas *ProcessCanvasRatioTrackB(TObjArray *triggersB, TH1 **hB, TH1 **hTrackerB, TH1 **hTriggerB, TH1 **hMatchedB, TH1 **hAllTracksB, Int_t indTrigger, TString canvasName,TString legendHeader="");
65 TCanvas *ProcessCanvasAsymMatched(TObjArray *triggersB, TH1 **hPosMatchedB, TH1 **hNegMatchedB, TH1 **hAllMatchedB, Int_t indTrigger, TString canvasName,TString legendHeader="");
66 TCanvas *ProcessCanvasHighPtMuons(TObjArray *triggersB, TH1 **hB, TH1 **hMatchedLowPtB, TH1 **hAllMatchedHightPtB, Int_t indTrigger, TString canvasName,TString legendHeader="");
67 TCanvas *ProcessCanvasBeamGasMatched(TObjArray *triggersB, TH1 **hBeamGasMatchedB, TH1** hBeamGasMatchedHighPtB, TH1 **hAllMatchedB, TH1** hMatchedHighPtB, Int_t indTrigger, TString canvasName,TString legendHeader="");
69 Bool_t IsTrigger(TObjArray *array, Int_t index, TString name);
70 Bool_t IsTriggerSelectedForMuonPhysics(TObjArray *array, Int_t index);
71 Bool_t IsHeavyIonCollision(AliCounterCollection *eventCounters);
73 const Int_t kNMaxTriggers = 25;
75 //--------------------------------------------------------------------------
76 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") {
78 /// Macro for QA monitoring.
79 /// Example: baseDir = "alien:///alice/cern.ch/user/p/ppillot/pp7TeV/LHC10d/MuonQA/pass1/results/".
80 /// If runList != 0x0: only the given runs will be used. Otherwise use all runs found in baseDir.
81 /// If triggerList !=0x0: only the given triggers are displayed. Otherwise use the default list of triggers (see GetTriggerLists)
83 #if defined(__CINT__) && !defined(__MAKECINT__)
84 gSystem->Load("libTree");
85 gSystem->Load("libGeom");
86 gSystem->Load("libVMC");
87 gSystem->Load("libPhysics");
88 gSystem->Load("libSTEERBase");
89 gSystem->Load("libESD");
90 gSystem->Load("libAOD");
91 gSystem->Load("libANALYSIS");
92 gSystem->Load("libANALYSISalice");
93 gSystem->Load("libCORRFW");
94 gSystem->Load("libPWGHFbase");
95 gSystem->Load("libPWGmuon");
98 // Cosmetics and configuration
99 gStyle->SetFillColor(10);
100 gStyle->SetPadGridX(kTRUE);
101 gStyle->SetPadGridY(kTRUE);
102 gStyle->SetPadRightMargin(0.01);
104 TString OutFileName = "QA_"; OutFileName += LHCPeriod;
105 TString OutFileNamePDF= OutFileName.Data(); OutFileNamePDF+= ".pdf";
106 TString OutFileNamePDF_open = OutFileNamePDF.Data(); OutFileNamePDF_open += "[";
107 TString OutFileNamePDF_close= OutFileNamePDF.Data(); OutFileNamePDF_close += "]";
108 TString OutFileNameROOT= OutFileName.Data(); OutFileNameROOT+= ".root";
112 if (0){ // Equivalent to the fast read option
113 gEnv->SetValue("XNet.ConnectTimeout",10);
114 gEnv->SetValue("XNet.RequestTimeout",10);
115 gEnv->SetValue("XNet.MaxRedirectCount",2);
116 gEnv->SetValue("XNet.ReconnectTimeout",10);
117 gEnv->SetValue("XNet.FirstConnectMaxCnt",1);
120 TH1::AddDirectory(kFALSE);
122 TString alienBaseDir = baseDir;
124 if (alienBaseDir.Contains("alien:") && !TGrid::Connect("alien://")) {
125 Error("MergeQA","cannot connect to grid");
129 cout<<"//---------------------------------- //"<<endl;
130 cout<<"// Run selection //"<<endl;
131 cout<<"//---------------------------------- //"<<endl;
133 TObjArray *runs = new TObjArray();
134 runs->SetOwner(kTRUE);
135 TObjArray *runs2 = new TObjArray();
136 runs2->SetOwner(kTRUE);
137 TString selectRuns = GetRunList(runList,runs,runs2);
140 TString select = selectPhysics ? "selected:yes" : "";
142 cout<<"//---------------------------------- //"<<endl;
143 cout<<"// Get global counter //"<<endl;
144 cout<<"//---------------------------------- //"<<endl;
146 TFile *globalFile = TFile::Open(Form("%s/%s", baseDir,QAFileName));
147 if (!globalFile || ! globalFile->IsOpen()) {
148 Error("PlotQA", "failed to open file: %s/%s", baseDir, QAFileName);
151 globalFile->Cd("MUON_QA");
156 AliCounterCollection* eventCounters = static_cast<AliCounterCollection*>(globalFile->FindObjectAny("eventCounters"));
157 AliCounterCollection* trackCounters = static_cast<AliCounterCollection*>(globalFile->FindObjectAny("trackCounters"));
158 if (!runList) selectRuns += trackCounters->GetKeyWords("run");
160 cout<<"//---------------------------------- //"<<endl;
161 cout<<"// Trigger selection //"<<endl;
162 cout<<"//---------------------------------- //"<<endl;
164 TObjArray *triggersB, *triggersAC, *triggersE, *triggersShortName;
165 triggersB = new TObjArray();
166 triggersB->SetOwner();
167 triggersAC = new TObjArray();
168 triggersAC->SetOwner();
169 triggersE = new TObjArray();
170 triggersE->SetOwner();
171 triggersShortName = new TObjArray();
172 triggersShortName->SetOwner();
174 TString listFromContainer = eventCounters->GetKeyWords("trigger");
175 Bool_t success = GetTriggerLists(triggerList, listFromContainer, triggersB, triggersAC, triggersE, triggersShortName);
180 cout<<"//---------------------------------- //"<<endl;
181 cout<<"// Set collision type ? //"<<endl;
182 cout<<"//---------------------------------- //"<<endl;
184 Bool_t isHeavyIon = kTRUE;
185 isHeavyIon = IsHeavyIonCollision(eventCounters);
187 cout<<"//---------------------------------- //"<<endl;
188 cout<<"// Trigger plots //"<<endl;
189 cout<<"//---------------------------------- //"<<endl;
191 //plot all trigger from event counters without any selection
192 TString CanvasName = "cAll";
193 TCanvas *cAll = new TCanvas(CanvasName.Data(),CanvasName.Data());
194 cAll->SetLeftMargin(0.18);
195 cAll->SetRightMargin(0.18);
198 //TH2* hAll = (TH2*) ProcessHisto2D(eventCounters, "trigger", "run", Form("run:any/%s",select.Data()) , "");
199 TH2* hAll = (TH2*) ProcessHisto2D(eventCounters, "trigger", "run", "run:any" , "");
200 for ( Int_t ibin=1; ibin<=hAll->GetYaxis()->GetNbins(); ++ibin ) {
201 TString currLabel = hAll->GetYaxis()->GetBinLabel(ibin);
202 TObjArray* labelArray = currLabel.Tokenize("-");
203 labelArray->SetOwner();
204 //cout<<currLabel<<endl;
205 //labelArray->Print();
206 TString newLabel = labelArray->At(0)->GetName();
207 if ( labelArray->GetEntries() >= 2 ) newLabel = Form("%s-%s", newLabel.Data(), labelArray->At(1)->GetName());
208 hAll->GetYaxis()->SetBinLabel(ibin, newLabel.Data());
213 //declare a default canvas c1
215 TCanvas *c1 = new TCanvas(CanvasName.Data(),CanvasName.Data());
220 Int_t const centBinMax = 4;
221 Int_t centBinMaxLoop = centBinMax;
222 if(!isHeavyIon) centBinMaxLoop = 1;
223 TString centBinName[centBinMax] = {"v0mult:any/","v0mult:low,int,high/","v0mult:low/","v0mult:high/"};
224 TString centLegendName[centBinMax] ={"All collisions","[0-80%] from V0 amplitude","low mult. [60-80%] from V0 amplitude","high mult. [0-10%] from V0 amplitude"};
225 TString centLegendNameShort[centBinMax] ={"All","[0-80%]","[60-80%]","[0-10%]"};
226 TString selectionCent;
228 Int_t *colorTab = new Int_t[triggersB->GetEntriesFast()];
229 Int_t const colorNrFirst = 8;
230 Int_t colorIndex = 0;
231 Int_t colorTabFirst[colorNrFirst] = {kGray,kRed,kBlue,kGreen,kOrange,kCyan,kMagenta,kYellow};
232 for (Int_t i = 0; i< triggersB->GetEntriesFast(); i++ ) {
233 colorTab[i] = colorTabFirst[i] + colorIndex;
234 if ( i%colorNrFirst == 0 ) colorIndex++;
236 TArrayI *colorInd = new TArrayI( triggersB->GetEntriesFast() );
237 for(Int_t i=0; i< triggersB->GetEntriesFast(); i++) colorInd->AddAt(colorTab[i],i);
239 TH1* hBNoPS[centBinMax][kNMaxTriggers];
240 TH1* hBWithPS[centBinMax][kNMaxTriggers];
241 TH1* hBWithPST0Flag[centBinMax][kNMaxTriggers];
242 TH1* hBWithPST0SPDFlag[centBinMax][kNMaxTriggers];
243 TH1* hB[centBinMax][kNMaxTriggers]={};
244 TH1* hTriggerB[centBinMax][kNMaxTriggers], *hTrackerB[centBinMax][kNMaxTriggers], *hMatchedB[centBinMax][kNMaxTriggers], *hAllTracksB[centBinMax][kNMaxTriggers], *hMatchedLowPtB[centBinMax][kNMaxTriggers], *hMatchedHighPtB[centBinMax][kNMaxTriggers];
245 TH1* hMatchedLowPtBNoPS[centBinMax][kNMaxTriggers], *hMatchedHighPtBNoPS[centBinMax][kNMaxTriggers];
246 TH1* hPosMatchedB[centBinMax][kNMaxTriggers], *hNegMatchedB[centBinMax][kNMaxTriggers], *hAllMatchedB[centBinMax][kNMaxTriggers];
247 TH1* hBeamGasMatchedB[centBinMax][kNMaxTriggers], *hBeamGasMatchedHighPtB[centBinMax][kNMaxTriggers];
248 TH1 *hACWithPS[centBinMax][kNMaxTriggers]={};
249 TH1 *hACNoPS[centBinMax][kNMaxTriggers]={};
250 TH1 *hEWithPS[centBinMax][kNMaxTriggers]={};
251 TH1 *hENoPS[centBinMax][kNMaxTriggers]={};
253 if(triggersB->GetEntriesFast()>=kNMaxTriggers){
254 cout<<"Too many triggers = "<<triggersB->GetEntriesFast()<<endl;
259 for(centBin = 0; centBin < centBinMaxLoop; centBin++){
260 selectionCent = centBinName[centBin];
262 //Loop on trigger (last is all triggers, then for each defined trigger)
263 for(Int_t i = 0; i < triggersB->GetEntriesFast(); i++){
265 TString histoNameBase = "h_trig", histoName;
268 TString triggerName = ( (TObjString*) triggersB->At(i) )->GetString();
269 if(triggerName.EqualTo(" ")) continue;
270 // Histo trigger without Phys. Sel.
271 selection = selectionCent; selection += Form("trigger:%s/%s", triggerName.Data(), selectRuns.Data());
272 // cout<<selection<<endl;
273 histoName = histoNameBase;
274 histoName += "BNoPS";
275 hBNoPS[centBin][i] = (TH1*) ProcessHisto(eventCounters, "run", selection, histoName, "", "Trigger content w/o Phys. Sel.", colorInd->At(i));
276 // Histo trigger with Phys. Sel.
277 selection = selectionCent; selection += Form("trigger:%s/%s/selected:yes", triggerName.Data(), selectRuns.Data());
278 histoName = histoNameBase;
279 histoName += "BWithPS";
280 hBWithPS[centBin][i] = (TH1*) ProcessHisto(eventCounters, "run", selection, histoName, "", "Trigger content w/ Phys. Sel.", colorInd->At(i));
281 // Histo trigger with Phys. Sel. and T0 pile up not flagged
282 selection = selectionCent; selection += Form("trigger:%s/%s/selected:yes/t0pileup:no", triggerName.Data(), selectRuns.Data());
283 histoName = histoNameBase;
284 histoName += "BWithPST0Flag";
285 hBWithPST0Flag[centBin][i] = (TH1*) ProcessHisto(eventCounters, "run", selection, histoName, "", "Trigger content w/ Phys. Sel. and no pile up from T0 flag", colorInd->At(i));
286 // Histo trigger with Phys. Sel. and T0 + SPD pile up not flagged
287 selection = selectionCent; selection += Form("trigger:%s/%s/selected:yes/t0pileup:no/spdpileup:no", triggerName.Data(), selectRuns.Data());
288 histoName = histoNameBase;
289 histoName += "BWithPST0SPDFlag";
290 hBWithPST0SPDFlag[centBin][i] = (TH1*) ProcessHisto(eventCounters, "run", selection, histoName, "", "Trigger content w/ Phys. Sel. and no pile up from T0 and SPD flag", colorInd->At(i));
291 // Histo trigger : Phys. Sel. is selected or not depending on the macro arguments
292 selection = selectionCent; selection += Form("trigger:%s/%s/%s", triggerName.Data(), selectRuns.Data(), select.Data());
293 histoName = histoNameBase;
295 hB[centBin][i] = (TH1*) ProcessHisto(eventCounters, "run", selection, histoName);
297 TString triggerNameAC = ( (TObjString*) triggersAC->At(i) )->GetString();
298 // Histo trigger without Phys. Sel. AC
299 histoName = histoNameBase;
300 histoName += "ACNoPS";
301 selection = selectionCent; selection += Form("trigger:%s/%s", triggerNameAC.Data(), selectRuns.Data());
302 hACNoPS[centBin][i] = (TH1*) ProcessHisto(eventCounters, "run", selection, histoName);
303 // Histo trigger with Phys. Sel. AC
304 selection = selectionCent; selection += Form("trigger:%s/%s/selected:yes", triggerNameAC.Data(), selectRuns.Data());
305 histoName = histoNameBase;
306 histoName += "ACWithPS";
307 hACWithPS[centBin][i] = (TH1*) ProcessHisto(eventCounters, "run", selection, histoName);
309 TString triggerNameE = ( (TObjString*) triggersE->At(i) )->GetString();
310 // Histo trigger without Phys. Sel. E
311 selection = selectionCent; selection += Form("trigger:%s/%s", triggerNameE.Data(), selectRuns.Data());
312 histoName = histoNameBase;
313 histoName += "ENoPS";
314 hENoPS[centBin][i] = (TH1*) ProcessHisto(eventCounters, "run", selection, histoName);
315 // Histo trigger with Phys. Sel. E
316 selection = selectionCent; selection += Form("trigger:%s/%s/selected:yes", triggerNameE.Data(), selectRuns.Data());
317 histoName = histoNameBase;
318 histoName += "EWithPS";
319 hEWithPS[centBin][i] = (TH1*) ProcessHisto(eventCounters, "run", selection, histoName);
321 // Histo tracking : Phys. Sel. is selected or not depending on the macro arguments
322 selection = selectionCent; selection += Form("track:triggeronly/trigger:%s/%s/%s", triggerName.Data(), selectRuns.Data(), select.Data());
323 hTriggerB[centBin][i] = (TH1*) ProcessHisto(trackCounters, "run", selection, "");
325 selection = selectionCent; selection += Form("track:trackeronly/trigger:%s/%s/%s", triggerName.Data(), selectRuns.Data(), select.Data());
326 hTrackerB[centBin][i] = (TH1*) ProcessHisto(trackCounters, "run", selection, "");
328 selection = selectionCent; selection += Form("track:matched/trigger:%s/%s/%s", triggerName.Data(), selectRuns.Data(), select.Data());
329 hMatchedB[centBin][i] = (TH1*) ProcessHisto(trackCounters, "run", selection, "");
331 selection = selectionCent; selection += Form("trigger:%s/%s/%s", triggerName.Data(), selectRuns.Data(), select.Data());
332 hAllTracksB[centBin][i] = (TH1*) ProcessHisto(trackCounters, "run", selection, "");
334 selection = selectionCent; selection += Form("track:matched/trigger:%s/%s/%s/pt:low/acc:in", triggerName.Data() ,selectRuns.Data(), select.Data());
335 hMatchedLowPtB[centBin][i] = (TH1*) ProcessHisto(trackCounters, "run", selection, "");
337 selection = selectionCent; selection += Form("track:matched/trigger:%s/%s/%s/pt:high/acc:in", triggerName.Data() ,selectRuns.Data(), select.Data());
338 hMatchedHighPtB[centBin][i] = (TH1*) ProcessHisto(trackCounters, "run", selection, "");
340 selection = selectionCent; selection += Form("track:matched/trigger:%s/%s/pt:low/acc:in", triggerName.Data() ,selectRuns.Data());
341 hMatchedLowPtBNoPS[centBin][i] = (TH1*) ProcessHisto(trackCounters, "run", selection, "");
343 selection = selectionCent; selection += Form("track:matched/trigger:%s/%s/pt:high/acc:in", triggerName.Data() ,selectRuns.Data());
344 hMatchedHighPtBNoPS[centBin][i] = (TH1*) ProcessHisto(trackCounters, "run", selection, "");
346 selection = selectionCent; selection += Form("track:matched/trigger:%s/%s/charge:pos/%s/acc:in",triggerName.Data(), select.Data(),selectRuns.Data());
347 hPosMatchedB[centBin][i] = (TH1*) ProcessHisto(trackCounters, "run", selection, "");
349 selection = selectionCent; selection += Form("track:matched/trigger:%s/%s/charge:neg/%s/acc:in",triggerName.Data(), select.Data(),selectRuns.Data());
350 hNegMatchedB[centBin][i] = (TH1*) ProcessHisto(trackCounters, "run", selection, "");
352 selection = selectionCent; selection += Form("track:matched/trigger:%s/%s/%s/acc:in",triggerName.Data(), select.Data(),selectRuns.Data());
353 hAllMatchedB[centBin][i] = (TH1*) ProcessHisto(trackCounters, "run", selection, "");
355 selection = selectionCent; selection += Form("track:matched/trigger:%s/%s/%s/acc:in/tagTrack:beamGas",triggerName.Data(), select.Data(),selectRuns.Data());
356 hBeamGasMatchedB[centBin][i] = (TH1*) ProcessHisto(trackCounters, "run", selection, "");
358 selection = selectionCent; selection += Form("track:matched/trigger:%s/%s/%s/acc:in/tagTrack:beamGas/pt:high",triggerName.Data(), select.Data(),selectRuns.Data());
359 hBeamGasMatchedHighPtB[centBin][i] = (TH1*) ProcessHisto(trackCounters, "run", selection, "");
364 //if there is not B triggers just stop now
365 Int_t count_trigger=0;
367 for(Int_t i = 0; i < triggersB->GetEntriesFast(); i++){
368 count_trigger += hBNoPS[centBin][i]->GetEntries();
370 if(count_trigger<=0) return;
373 Int_t NumOfBNoPS[centBinMax][kNMaxTriggers];
374 Int_t NumOfBWithPS[centBinMax][kNMaxTriggers];
375 Int_t NumOfBWithPST0Flag[centBinMax][kNMaxTriggers];
376 Int_t NumOfBWithPST0SPDFlag[centBinMax][kNMaxTriggers];
377 Int_t NumOfACNoPS[centBinMax][kNMaxTriggers];
378 Int_t NumOfENoPS[centBinMax][kNMaxTriggers];
379 Int_t NumOfACWithPS[centBinMax][kNMaxTriggers];
380 Int_t NumOfEWithPS[centBinMax][kNMaxTriggers];
382 for(centBin = 0; centBin < centBinMaxLoop; centBin++){
383 for(Int_t i = 0; i < triggersB->GetEntriesFast(); i++){
384 NumOfBNoPS[centBin][i] = hBNoPS[centBin][i]->Integral();
385 NumOfBWithPS[centBin][i] = hBWithPS[centBin][i]->Integral();
386 NumOfBWithPST0Flag[centBin][i] = hBWithPST0Flag[centBin][i]->Integral();
387 NumOfBWithPST0SPDFlag[centBin][i] = hBWithPST0Flag[centBin][i]->Integral();
388 NumOfACNoPS[centBin][i] = hACNoPS[centBin][i]->Integral();
389 NumOfENoPS[centBin][i] = hENoPS[centBin][i]->Integral();
390 NumOfACWithPS[centBin][i] = hACWithPS[centBin][i]->Integral();
391 NumOfEWithPS[centBin][i] = hEWithPS[centBin][i]->Integral();
396 cout<<"//==================================================================================="<<endl;
397 cout<<"// Put all plots in a ps file, easier to publish (Twiki)"<<endl;
398 cout<<"//==================================================================================="<<endl;
400 c1->Print(OutFileNamePDF_open.Data());
401 TFile *rootFileOut = TFile::Open(OutFileNameROOT.Data(),"RECREATE");
403 TDirectoryFile *dirGlobal = new TDirectoryFile("Global","Global","",(TDirectory*)rootFileOut->GetMotherDir());
404 cout<<"dirGlobal mother "<<(dirGlobal->GetMotherDir())->GetName()<<endl;
405 //An array of TDirectoryFile
406 TObjArray *dirTrigger = new TObjArray;
407 dirTrigger->SetOwner();
408 TObjArray *dirCent = new TObjArray;
410 for ( Int_t i = 0; i < triggersB->GetEntriesFast()-1 ; i++) {
411 TString currTrigName = ( (TObjString*) triggersShortName->At(i) )->GetString();
412 TDirectoryFile *dirFile = new TDirectoryFile( currTrigName.Data(),currTrigName.Data(),"",(TDirectory*)rootFileOut->GetMotherDir() );
413 dirTrigger->AddLast( dirFile );
414 for( Int_t j = 0; j < centBinMaxLoop; j++) {
415 TString centName = centLegendNameShort[j];
416 TDirectoryFile *dirFileCent = new TDirectoryFile( centName.Data(),centName.Data(),"",dirFile );
417 dirCent->AddLast( dirFileCent );
421 cAll->Print(OutFileNamePDF.Data());
425 cout<<"//==================================================================================="<<endl;
426 cout<<"// new canvas with the total number of trigger with and without Phys. Sel."<<endl;
427 cout<<"//==================================================================================="<<endl;
429 TCanvas *cTriggerContent = ProcessCanvasTriggerContent(triggersB, hBNoPS[centBin], hBWithPS[centBin], "TriggerContent");
430 cTriggerContent->Draw();
431 cTriggerContent->Print(OutFileNamePDF.Data());
433 cTriggerContent->Write();
435 cout<<"//==================================================================================="<<endl;
436 cout<<"// new canvas with the relative content of each trigger w/o physics selection"<<endl;
437 cout<<"//==================================================================================="<<endl;
439 TCanvas *cRelativeTriggerContent = ProcessCanvasRelativeTriggerContent(triggersB, hBNoPS[centBin], "RelativeTriggerContent", colorInd);
440 cRelativeTriggerContent->Draw();
441 cRelativeTriggerContent->Print(OutFileNamePDF.Data());
443 cRelativeTriggerContent->Write();
445 cout<<"//==================================================================================="<<endl;
446 cout<<"// new canvas with effect from physics selection for each trigger and background trigger "<<endl;
447 cout<<"//==================================================================================="<<endl;
449 TCanvas *cPhysSelCut = 0x0;
450 cPhysSelCut = ProcessCanvasPhysSelCut(triggersB, triggersAC, triggersE, hBNoPS[centBin], hACNoPS[centBin], hENoPS[centBin], hBWithPS[centBin], "PhysSelCutOnCollTrigger", colorInd,isHeavyIon);
452 cPhysSelCut->Print(OutFileNamePDF.Data());
454 cPhysSelCut->Write();
457 cout<<"//==================================================================================="<<endl;
458 cout<<"// new canvas with effect from T0 pile-up flag for each trigger and background trigger "<<endl;
459 cout<<"//==================================================================================="<<endl;
461 TCanvas *cPhysSelCutT0Flag = 0x0;
462 cPhysSelCutT0Flag = ProcessCanvasPhysSelCut(triggersB, triggersAC, triggersE, hBWithPS[centBin], hACNoPS[centBin], hENoPS[centBin], hBWithPST0Flag[centBin], "PhysSelCutOnCollTriggerT0Flag", colorInd,isHeavyIon);
463 cPhysSelCutT0Flag->Draw();
464 cPhysSelCutT0Flag->Print(OutFileNamePDF.Data());
466 cPhysSelCutT0Flag->Write();
470 cout<<"//==================================================================================="<<endl;
471 cout<<"// new canvas with effect from T0 + SPD pile-up flag for each trigger and background trigger "<<endl;
472 cout<<"//==================================================================================="<<endl;
474 TCanvas *cPhysSelCutT0SPDFlag = 0x0;
475 cPhysSelCutT0SPDFlag = ProcessCanvasPhysSelCut(triggersB, triggersAC, triggersE, hBWithPS[centBin], hACNoPS[centBin], hENoPS[centBin], hBWithPST0SPDFlag[centBin], "PhysSelCutOnCollTriggerT0Flag", colorInd,isHeavyIon);
476 cPhysSelCutT0SPDFlag->Draw();
477 cPhysSelCutT0SPDFlag->Print(OutFileNamePDF.Data());
479 cPhysSelCutT0SPDFlag->Write();
484 cout<<"//==================================================================================="<<endl;
485 cout<<"// new canvas with effect from physics selection for each trigger and centrality bin (only in PbPb) "<<endl;
486 cout<<"//==================================================================================="<<endl;
491 TString legendHeader="";
495 TCanvas *cPhysSelCutCentrality;
498 for(k = 0; k < triggersB->GetEntriesFast(); k++){
499 //skip sum of all triggers
500 if(k == (triggersB->GetEntriesFast()-1)) continue;
502 canvasName = "PhysSel_trigger";
503 canvasName += ( (TObjString*) triggersShortName->At(k) )->GetString();
505 TH1* hBNoPSCent[centBinMax-1]={hBNoPS[1][k],hBNoPS[2][k],hBNoPS[3][k]};
506 TH1* hACNoPSCent[centBinMax-1]={hACNoPS[1][k],hACNoPS[2][k],hACNoPS[3][k]};
507 TH1* hENoPSCent[centBinMax-1]={hENoPS[1][k],hENoPS[2][k],hENoPS[3][k]};
508 TH1* hBWithPSCent[centBinMax-1]={hBWithPS[1][k],hBWithPS[2][k],hBWithPS[3][k]};
510 cPhysSelCutCentrality = ProcessCanvasPhysSelCutCentrality(triggersB, triggersAC, triggersE, hBNoPSCent, hACNoPSCent, hENoPSCent, hBWithPSCent, k, canvasName, colorInd, centLegendNameShort+1, isHeavyIon);
511 cPhysSelCutCentrality->Draw();
512 cPhysSelCutCentrality->Print(OutFileNamePDF.Data());
513 ( (TDirectoryFile*) dirTrigger->At(k) )->cd();
514 cPhysSelCutCentrality->Write();
519 cout<<"//==================================================================================="<<endl;
520 cout<<"// new canvas for centrality percentile check (only in PbPb) "<<endl;
521 cout<<"//==================================================================================="<<endl;
524 TCanvas *cCentralityCheck;
527 for(k = 0; k < triggersB->GetEntriesFast(); k++){
528 //skip sum of all triggers
529 if(k == (triggersB->GetEntriesFast()-1)) continue;
531 canvasName = "CentralityCheck_trigger";
532 canvasName +=( (TObjString*) triggersShortName->At(k) )->GetString();
534 TH1* hBNoPSCent[centBinMax-1]={hBNoPS[1][k],hBNoPS[2][k],hBNoPS[3][k]};
535 TH1* hBWithPSCent[centBinMax-1]={hBWithPS[1][k],hBWithPS[2][k],hBWithPS[3][k]};
537 cCentralityCheck = ProcessCanvasCentralityPercentile(triggersB,hBNoPSCent,hBWithPSCent,k,canvasName,colorInd,centLegendNameShort+1 );
539 cCentralityCheck->Draw();
540 cCentralityCheck->Print(OutFileNamePDF.Data());
541 ( (TDirectoryFile*) dirTrigger->At(k) )->cd();
542 cCentralityCheck->Write();
549 cout<<"//==================================================================================="<<endl;
550 cout<<"// Ratio of tracks over trigger type (3 canvases) "<<endl;
551 cout<<"//==================================================================================="<<endl;
553 //Print a canvas per trigger type
554 TCanvas *cTracksoverTrigger;
555 TCanvas* cTrackMultB;
556 TCanvas* cRatioTrackB;
558 //loop on centrality bin
559 for ( centBin = 0; centBin < centBinMaxLoop; centBin++){
561 legendHeader = "for ";
562 legendHeader += centLegendName[centBin];
564 else legendHeader ="";
566 for(k = 0; k < triggersB->GetEntriesFast(); k++){
567 //skip sum of all triggers
568 if(k == (triggersB->GetEntriesFast()-1)) continue;
570 ( (TDirectoryFile*) dirCent->At( k*centBinMaxLoop+centBin ) )->cd();
572 canvasName = "RatioTrackTypes_cent";
573 canvasName += centBin;
574 canvasName +="trigger";
575 canvasName += ( (TObjString*) triggersShortName->At(k) )->GetString();
576 cTracksoverTrigger = ProcessCanvasTracksoverTrigger(triggersB, hB[centBin], hTrackerB[centBin], hTriggerB[centBin], hMatchedB[centBin], hAllTracksB[centBin], k, canvasName,legendHeader);
577 cTracksoverTrigger->Draw();
578 cTracksoverTrigger->Print(OutFileNamePDF.Data());
579 cTracksoverTrigger->Write();
581 canvasName = "TrackMult_cent";
582 canvasName += centBin;
583 canvasName +="trigger";
584 canvasName +=( (TObjString*) triggersShortName->At(k) )->GetString();
585 cTrackMultB= ProcessCanvasTrackMultB(triggersB, hB[centBin], hTrackerB[centBin], hTriggerB[centBin], hMatchedB[centBin], hAllTracksB[centBin], k, canvasName, legendHeader);
587 cTrackMultB->Print(OutFileNamePDF.Data());
588 cTrackMultB->Write();
590 canvasName = "RatioTrackB_cent";
591 canvasName += centBin;
592 canvasName +="trigger";
593 canvasName +=( (TObjString*) triggersShortName->At(k) )->GetString();
594 cRatioTrackB = ProcessCanvasRatioTrackB(triggersB, hB[centBin], hTrackerB[centBin], hTriggerB[centBin], hMatchedB[centBin], hAllTracksB[centBin], k, canvasName, legendHeader);
595 cRatioTrackB->Draw();
596 cRatioTrackB->Print(OutFileNamePDF.Data());
597 cRatioTrackB->Write();
602 cout<<"//===================================================="<<endl;
603 cout<<"// Draw matched tracks asymmetry for mus type trigger "<<endl;
604 cout<<"//===================================================="<<endl;
606 //Print a canvas per trigger type
607 TCanvas *cAsymMatched;
610 for ( centBin = 0; centBin < centBinMaxLoop; centBin++){
612 legendHeader = "for ";
613 legendHeader += centLegendName[centBin];
615 else legendHeader ="";
617 for(k = 0; k < triggersB->GetEntriesFast(); k++){
618 //skip sum of all triggers
619 if(k == (triggersB->GetEntriesFast()-1)) continue;
621 ( (TDirectoryFile*) dirCent->At( k*centBinMaxLoop+centBin ) )->cd();
623 canvasName = "AsymMatched";
624 canvasName += centBin;
625 canvasName +="trigger";
626 canvasName +=( (TObjString*) triggersShortName->At(k) )->GetString();
627 cAsymMatched = ProcessCanvasAsymMatched(triggersB, hPosMatchedB[centBin], hNegMatchedB[centBin], hAllMatchedB[centBin], k, canvasName,legendHeader);
628 cAsymMatched->Draw();
629 cAsymMatched->Print(OutFileNamePDF.Data());
630 cAsymMatched->Write();
636 cout<<"//===================================================================="<<endl;
637 cout<<"// Draw beam gas contribution to matched tracks for mus type trigger "<<endl;
638 cout<<"//===================================================================="<<endl;
640 //Print a canvas per trigger type
641 TCanvas *cBeamGasMatched;
644 for(k = 0; k < triggersB->GetEntriesFast(); k++){
645 //skip sum of all triggers
646 if(k == (triggersB->GetEntriesFast()-1)) continue;
648 ( (TDirectoryFile*) dirTrigger->At(k) )->cd();
650 canvasName = "BeamGasMatched";
651 canvasName +="trigger";
652 canvasName +=( (TObjString*) triggersShortName->At(k) )->GetString();
654 cBeamGasMatched= ProcessCanvasBeamGasMatched(triggersB, hBeamGasMatchedB[centBin], hBeamGasMatchedHighPtB[centBin], hAllMatchedB[centBin], hMatchedHighPtB[centBin], k, canvasName,legendHeader);
655 cBeamGasMatched->Draw();
656 cBeamGasMatched->Print(OutFileNamePDF.Data());
657 cBeamGasMatched->Write();
661 cout<<"//=================================================="<<endl;
662 cout<<"// Draw high pt tracks per trigger"<<endl;
663 cout<<"//=================================================="<<endl;
665 //Print a canvas per trigger type
666 TCanvas *cHighPtMuons;
669 for ( centBin = 0; centBin < centBinMaxLoop; centBin++){
671 legendHeader = "for ";
672 legendHeader += centLegendName[centBin];
674 else legendHeader ="";
676 for(k = 0; k < triggersB->GetEntriesFast(); k++){
677 //skip sum of all triggers
678 if(k == (triggersB->GetEntriesFast()-1)) continue;
680 ( (TDirectoryFile*) dirCent->At( k*centBinMaxLoop+centBin ) )->cd();
682 canvasName = "HighPtMuons";
683 canvasName += centBin;
684 canvasName +="trigger";
685 canvasName +=( (TObjString*) triggersShortName->At(k) )->GetString();
687 cHighPtMuons = ProcessCanvasHighPtMuons(triggersB, hB[centBin], hMatchedLowPtB[centBin], hMatchedHighPtB[centBin], k, canvasName,legendHeader);
688 cHighPtMuons->Draw();
689 cHighPtMuons->Print(OutFileNamePDF.Data());
690 cHighPtMuons->Write();
698 //===================================================================================
699 //Print out the number of trigger without and with Phys. Sel.
700 //===================================================================================
703 cout << endl << endl;
704 //====================================================
706 if ( triggersB->At(kCMUS) ) {
708 // set the format to print labels
709 THashList* labels = hBWithPS[centBin][kCMUS]->GetXaxis()->GetLabels();
710 TString format(Form("\n%%%ds %%9d",0));
713 // print value for each label
714 TObjString* label = 0x0;
715 TIter nextLabel(labels);
716 cout << "-------------------------------------------------" << endl;
717 cout << "Run Number" << "\t Number of "<< ( (TObjString*) triggersB->At(kCMUS) )->GetString()<<" after Phys. Sel. " << endl ;
718 while ((label = static_cast<TObjString*>(nextLabel()))) {
720 Int_t bin = (Int_t) label->GetUniqueID();
721 printf(format.Data(), label->String().Data(), (Int_t) hBWithPS[centBin][kCMUS]->GetBinContent(bin));
723 printf("\n========== Total #runs = %d ==============\n",nRuns);
727 cout << "-------------------------------------------------" << endl;
728 cout << "Total statistic" << endl;
729 cout << " " << endl ;
731 cout << "-------------------------------------------------------------------" << endl;
732 cout<<"Number of triggers w/o Phys. Sel./ w/ Phys. Sel (Phys. Sel. cut in %)"<<endl;
733 for(Int_t i = 0; i < triggersB->GetEntriesFast()-1; i++){
734 TString triggerNameB = ( (TObjString*) triggersB->At(i) )->GetString();
735 TString triggerNameAC = ( (TObjString*) triggersAC->At(i) )->GetString();
736 TString triggerNameE = ( (TObjString*) triggersE->At(i) )->GetString();
738 Int_t cutinpercent = 0;
739 printf("%10s %30s %30s\n",triggerNameB.Data(),triggerNameAC.Data(),triggerNameE.Data());
740 if(NumOfBNoPS[centBin][i]) cutinpercent = (Int_t) ((Double_t)(NumOfBNoPS[centBin][i]-NumOfBWithPS[centBin][i])/(NumOfBNoPS[centBin][i])*100.);
741 printf("%5.2e / %.2e (%d%%)", (Double_t) NumOfBNoPS[centBin][i],(Double_t) NumOfBWithPS[centBin][i],cutinpercent);
743 if(NumOfACNoPS[centBin][i]) cutinpercent = (Int_t) ((Double_t)(NumOfACNoPS[centBin][i]-NumOfACWithPS[centBin][i])/(NumOfACNoPS[centBin][i])*100.);
744 printf("%15.2e / %.2e (%d%%)", (Double_t)NumOfACNoPS[centBin][i],(Double_t)NumOfACWithPS[centBin][i],cutinpercent);
746 if(NumOfENoPS[centBin][i]) cutinpercent = (Int_t) ((Double_t)(NumOfENoPS[centBin][i]-NumOfEWithPS[centBin][i])/(NumOfENoPS[centBin][i])*100.);
747 printf("%15.2e / %.2e (%d%%)\n", (Double_t)NumOfENoPS[centBin][i],(Double_t)NumOfEWithPS[centBin][i],cutinpercent);
757 //--------------------------------------------- //
758 // monitor quantities run per run //
759 //--------------------------------------------- //
760 Int_t const nMuonTriggerCase = 7;
761 TH1F *hMuonTrigger[nMuonTriggerCase];
762 TString muonTriggerName[nMuonTriggerCase] = {"Unlike-only","Like-only","Hpt-only","Unlike&Like","Unlike&Hpt","Like&Hpt","Unlike&Like&Hpt"};
763 for ( Int_t i = 0; i < nMuonTriggerCase; i++ ) {
764 hMuonTrigger[i] = new TH1F(Form("hMuonTrigger_%s", muonTriggerName[i].Data()),Form("Trigger %s per run",muonTriggerName[i].Data()),10000,1,10000);
767 TH1F* hTriggerCutVsRun[2], *hTriggerCutWidthVsRun[2];
768 for ( Int_t ihisto=0; ihisto<2; ++ihisto ) {
769 TString cutName = ( ihisto == 0 ) ? "Lpt" : "Hpt";
770 hTriggerCutVsRun[ihisto] = new TH1F(Form("hTriggerCutVsRun%s", cutName.Data()), Form("Trigger %s cut per run", cutName.Data()), 10000,1,10000);
771 hTriggerCutWidthVsRun[ihisto] = (TH1F*)hTriggerCutVsRun[ihisto]->Clone(Form("hTriggerCutWidthVsRun%s", cutName.Data()));
773 TF1* fitMatchTrig = new TF1("fitMatchTrig","[3] + [0] * ( 1. + TMath::Erf((x - [1]) / [2] / TMath::Sqrt(2.)))", 0.1, 6.);
774 TH1F* hNClustersPerTrackVsRun_Mean = new TH1F("hNClustersPerTrackVsRun_Mean", "averaged number of associated clusters per track;run;<n_{clusters}>",10000,1,10000);
775 TH1F* hNClustersPerTrackVsRun_Sigma = new TH1F("hNClustersPerTrackVsRun_Sigma", "dispersion of the number of associated clusters per track;run;#sigma_{n_{clusters}}",10000,1,10000);
776 TH1F* hNChamberHitPerTrack_Mean = new TH1F("hNChamberHitPerTrack_Mean", "averaged number of chambers hit per track;run;<n_{chamber hit}>",10000,1,10000);
777 TH1F* hNChamberHitPerTrack_Sigma = new TH1F("hNChamberHitPerTrack_Sigma", "dispersion of the number of chambers hit per track;run;#sigma_{n_{chamber hit}}",10000,1,10000);
778 TH1F* hChi2_Mean = new TH1F("hChi2_Mean", "averaged normalized #chi^{2} distribution;run;<#chi^{2} / ndf>",10000,1,10000);
779 TH1F* hChi2_Sigma = new TH1F("hChi2_Sigma", "dispersion of normalized #chi^{2} distribution;run;#sigma_{#chi^{2} / ndf}",10000,1,10000);
780 TH1F* hNClustersInCh[10];
781 for (Int_t ich=0; ich<10; ich++){
782 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);
784 TH1F* hClusterChargeMeanInCh[10], *hClusterChargeSigmaInCh[10];
785 for (Int_t ich=0; ich<10; ich++){
786 hClusterChargeMeanInCh[ich] = new TH1F(Form("hClusterChargeMeanInCh%d",ich+1), Form("averaged cluster charge -mean- per track in chamber %d",ich+1),10000,1,10000);
787 hClusterChargeSigmaInCh[ich] = new TH1F(Form("hClusterChargeSigmaInCh%d",ich+1), Form("averaged cluster charge -sigma- per track in chamber %d",ich+1),10000,1,10000);
789 TH1F* hClusterSizeMeanInCh[10], *hClusterSizeSigmaInCh[10];
790 for (Int_t ich=0; ich<10; ich++){
791 hClusterSizeMeanInCh[ich] = new TH1F(Form("hClusterSizeMeanInCh%d",ich+1), Form("averaged cluster size -mean- per track in chamber %d",ich+1),10000,1,10000);
792 hClusterSizeSigmaInCh[ich] = new TH1F(Form("hClusterSizeSigmaInCh%d",ich+1), Form("averaged cluster size -sigma- per track in chamber %d",ich+1),10000,1,10000);
795 TH1F* hClusterHitMapXInCh[10];
796 for (Int_t ich=0; ich<10; ich++){
797 hClusterHitMapXInCh[ich] = new TH1F(Form("hClusterHitMapXInCh%d",ich+1), Form("averaged cluster position distribution in chamber %d;X (cm)",ich+1),10000,1,10000);
799 TH1F* hClusterHitMapYInCh[10];
800 for (Int_t ich=0; ich<10; ich++){
801 hClusterHitMapYInCh[ich] = new TH1F(Form("hClusterHitMapYInCh%d",ich+1), Form("averaged cluster position distribution in chamber %d;Y (cm)",ich+1),10000,1,10000);
807 // Are the runs stored locally or in alien?
808 Int_t isAlienFile = 0;
809 if(alienBaseDir.Contains("alien:")){
811 alienBaseDir.ReplaceAll("alien://","");
814 cout<<"============================================================"<<endl;
815 cout<< "Monitoring quantities run per run: loop over "<<runs->GetEntriesFast()<<" runs."<<endl;
816 cout<<" directory = "<<alienBaseDir.Data()<<endl;
817 cout<<"============================================================"<<endl;
819 for ( Int_t irun=0; irun<runs->GetEntriesFast(); irun++ ) {
821 TString run = ((TObjString*)runs->UncheckedAt(irun))->GetString();
822 TString run2 = ((TObjString*)runs2->UncheckedAt(irun))->GetString();
823 // get the file (or list of files) to be analyzed
825 TGridResult *res = 0;
826 TObjString *objs = 0;
828 //cout<<irun<<" "<<run<<endl;
831 command = Form("find %s/ %s/%s", alienBaseDir.Data(), run.Data(), QAFileName);
832 res = gGrid->Command(command);
834 Error("PlotMuonQA","no result for the command: %s",command.Data());
839 res = new TGridResult();
842 objs = new TObjString(Form("%s/%s/%s", alienBaseDir.Data(), run2.Data(), QAFileName));
846 //loop over the directory to find the root files
847 void *dir = gSystem->OpenDirectory(alienBaseDir.Data());
848 TString sDirFilename;
849 Int_t iEntry=0, iFile=0;
852 const char* dirFilename = gSystem->GetDirEntry(dir);
853 if(!dirFilename) break;
854 sDirFilename = dirFilename;
855 if(!sDirFilename.IsDigit()) continue;
857 objs = new TObjString(Form("%s/%s/%s", alienBaseDir.Data(), sDirFilename.Data(), QAFileName));
863 // Loop over 'find' results and get next LFN
868 Int_t iLoop=0, iLoopMax=1000;
871 // get the current file url
873 map=(TMap*)nextmap();
875 objs = dynamic_cast<TObjString*>(map->GetValue("turl"));
878 objs=(TObjString*)nextmap();
881 //in case of infinite loop
883 if(iLoop>iLoopMax) break;
885 if (!objs || !objs->GetString().Length()) {
886 Error("PlotMuonQA","turl/obj not found for the run %s... SKIPPING", run.Data());
890 run = objs->GetString();
891 run.ReplaceAll(Form("/%s",QAFileName), "");
892 run.ReplaceAll(alienBaseDir, "");
893 run.Remove(TString::kLeading, '/');
894 run.Remove(TString::kLeading, '0');
896 if ( ! selectRuns.Contains(run.Data()) ) continue;
898 // open the outfile for this run
899 TFile *runFile = TFile::Open(objs->GetString());
900 if (!runFile || ! runFile->IsOpen()) {
901 Error("PlotMuonQA","failed to open file: %s", objs->GetName());
904 runFile->Cd("MUON_QA");
906 // get interesting histos
907 TObjArray* general1 = static_cast<TObjArray*>(runFile->FindObjectAny("general1"));
908 TObjArray* general2 = static_cast<TObjArray*>(runFile->FindObjectAny("general2"));
909 TObjArray* expert = static_cast<TObjArray*>(runFile->FindObjectAny("expert"));
911 if (!general1 || !general2 || !expert){
912 Error("PlotMuonQA","All objects not here !!! ===> Skipping...for %s",objs->GetName());
916 TH1* hNClustersPerTrack = static_cast<TH1*>(general1->FindObject("hNClustersPerTrack"));
917 TH1* hNChamberHitPerTrack = static_cast<TH1*>(general1->FindObject("hNChamberHitPerTrack"));
918 TH1* hChi2 = static_cast<TH1*>(general1->FindObject("hChi2"));
919 TH1* hNClustersPerCh = static_cast<TH1*>(general2->FindObject("hNClustersPerCh"));
920 TH1 *hClusterChargePerChMean =static_cast<TH1*>(general2->FindObject("hClusterChargePerChMean"));
921 TH1 *hClusterChargePerChSigma =static_cast<TH1*>(general2->FindObject("hClusterChargePerChSigma"));
922 TH1 *hClusterSizePerChMean =static_cast<TH1*>(general2->FindObject("hClusterSizePerChMean"));
923 TH1 *hClusterSizePerChSigma =static_cast<TH1*>(general2->FindObject("hClusterSizePerChSigma"));
924 TH1* hMuonTriggers = static_cast<TH1*>(general1->FindObject("hMuonTriggers"));
925 for (Int_t ihisto=0; ihisto<nMuonTriggerCase; ihisto++){
927 if ( hMuonTriggers ) val = hMuonTriggers->GetBinContent(ihisto+2);
928 if ( hMuonTrigger[ihisto]->GetSumw2N() == 0 ) hMuonTrigger[ihisto]->Sumw2();
929 hMuonTrigger[ihisto]->SetBinContent(ibin,val);
930 hMuonTrigger[ihisto]->SetBinError(ibin,TMath::Sqrt(val));
931 hMuonTrigger[ihisto]->GetXaxis()->SetBinLabel(ibin,run.Data());
933 TH1* hPtDistrib = static_cast<TH1*>(general1->FindObject("hPt"));
934 TH1* hPtDistribLpt = static_cast<TH1*>(general1->FindObject("hPtMatchLpt"));
935 TH1* hPtDistribHpt = static_cast<TH1*>(general1->FindObject("hPtMatchHpt"));
936 if ( hPtDistrib && hPtDistribLpt && hPtDistribHpt ) {
937 if ( hPtDistrib->GetSumw2N() == 0 ) hPtDistrib->Sumw2();
938 TH1* histoMatch[2] = {hPtDistribLpt, hPtDistribHpt};
939 for ( Int_t ihisto=0; ihisto<2; ++ihisto ) {
940 if ( histoMatch[ihisto]->GetSumw2N() == 0 ) histoMatch[ihisto]->Sumw2();
941 if ( histoMatch[ihisto]->GetEntries() == 0 ) continue;
942 histoMatch[ihisto]->Divide(hPtDistrib);
943 Double_t minEff = 99999., maxEff = -1.;
944 Double_t ptMinFit = 0.1;
945 Double_t ptMaxFit = 6.;
946 Int_t ptBinLow = histoMatch[ihisto]->GetXaxis()->FindBin(ptMinFit);
947 Int_t ptBinHigh = histoMatch[ihisto]->GetXaxis()->FindBin(ptMaxFit);
948 for ( Int_t currBin=ptBinLow; currBin<=ptBinHigh; currBin++ ) {
949 Double_t currEff = histoMatch[ihisto]->GetBinContent(currBin);
950 Double_t currPt = histoMatch[ihisto]->GetXaxis()->GetBinCenter(currBin);
951 if ( currPt < 1.5 && minEff > currEff ) {
955 if ( currPt > 0.5 && maxEff < currEff ) {
959 } // loop on histo bins
960 fitMatchTrig->SetParameters(0.5, 0.5, 0.8, 0.2);
961 fitMatchTrig->SetParLimits(0,0.,1.);
962 fitMatchTrig->SetParLimits(1,0.,5.);
963 fitMatchTrig->SetParLimits(2,0.,5.);
964 fitMatchTrig->SetParLimits(3,0.,0.5);
965 histoMatch[ihisto]->Fit(fitMatchTrig,"RQ0","",ptMinFit,ptMaxFit);
966 Double_t ptCut = fitMatchTrig->GetParameter(1);
967 Double_t ptCutErr = fitMatchTrig->GetParError(1);
968 Double_t ptCutWidth = fitMatchTrig->GetParameter(2);
969 if ( ptCut < 0 || ptCut > 10. ) {
970 ptCut = ptCutErr = ptCutWidth = 0.;
972 hTriggerCutVsRun[ihisto]->SetBinContent(ibin, ptCut);
973 hTriggerCutVsRun[ihisto]->SetBinError(ibin, ptCutErr);
974 hTriggerCutWidthVsRun[ihisto]->SetBinContent(ibin, ptCut);
975 hTriggerCutWidthVsRun[ihisto]->SetBinError(ibin, ptCutWidth);
976 } // loop on match histos
978 TH2* hClusterHitMapInCh[10];
979 for(Int_t ich=0; ich<10; ich++) hClusterHitMapInCh[ich] = static_cast<TH2*>(expert->FindObject(Form("hClusterHitMapInCh%d",ich+1)));
981 // skip empty runs... not anymore ! cs !
982 if (!hNClustersPerCh) {
983 Warning("PlotMUONQA","File: %s has empty histograms !", objs->GetName());
984 hNClustersPerTrackVsRun_Mean->SetBinContent(ibin, 0.);
985 hNClustersPerTrackVsRun_Mean->SetBinError(ibin, 1.);
986 hNClustersPerTrackVsRun_Sigma->SetBinContent(ibin, 0.);
987 hNClustersPerTrackVsRun_Sigma->SetBinError(ibin, 1.);
988 hNChamberHitPerTrack_Mean->SetBinContent(ibin, 0.);
989 hNChamberHitPerTrack_Mean->SetBinError(ibin, 1.);
990 hNChamberHitPerTrack_Sigma->SetBinContent(ibin, 0.);
991 hNChamberHitPerTrack_Sigma->SetBinError(ibin, 1.);
992 hChi2_Mean->SetBinContent(ibin, 0.);
993 hChi2_Mean->SetBinError(ibin, 1.);
994 hChi2_Sigma->SetBinContent(ibin, 0.);
995 hChi2_Sigma->SetBinError(ibin, 1.);
996 for (Int_t ich=0; ich<10; ich++) {
997 hNClustersInCh[ich]->SetBinContent(ibin,0.);
998 hNClustersInCh[ich]->SetBinError(ibin,1.);
999 hClusterHitMapXInCh[ich]->SetBinContent(ibin,0.);
1000 hClusterHitMapXInCh[ich]->SetBinError(ibin,1.);
1001 hClusterHitMapYInCh[ich]->SetBinContent(ibin,0.);
1002 hClusterHitMapYInCh[ich]->SetBinError(ibin,1.);
1008 // fill monitoring plots
1009 hNClustersPerTrackVsRun_Mean->SetBinContent(ibin, hNClustersPerTrack->GetMean());
1010 hNClustersPerTrackVsRun_Mean->SetBinError(ibin, hNClustersPerTrack->GetMeanError());
1011 hNClustersPerTrackVsRun_Sigma->SetBinContent(ibin, hNClustersPerTrack->GetRMS());
1012 hNClustersPerTrackVsRun_Sigma->SetBinError(ibin, hNClustersPerTrack->GetRMSError());
1013 hNChamberHitPerTrack_Mean->SetBinContent(ibin, hNChamberHitPerTrack->GetMean());
1014 hNChamberHitPerTrack_Mean->SetBinError(ibin, hNChamberHitPerTrack->GetMeanError());
1015 hNChamberHitPerTrack_Sigma->SetBinContent(ibin, hNChamberHitPerTrack->GetRMS());
1016 hNChamberHitPerTrack_Sigma->SetBinError(ibin, hNChamberHitPerTrack->GetRMSError());
1017 hChi2_Mean->SetBinContent(ibin, hChi2->GetMean());
1018 hChi2_Mean->SetBinError(ibin, hChi2->GetMeanError());
1019 hChi2_Sigma->SetBinContent(ibin, hChi2->GetRMS());
1020 hChi2_Sigma->SetBinError(ibin, hChi2->GetRMSError());
1021 for (Int_t ich=0; ich<10; ich++) {
1022 hNClustersInCh[ich]->SetBinContent(ibin,hNClustersPerCh->GetBinContent(ich+1));
1023 hNClustersInCh[ich]->SetBinError(ibin,hNClustersPerCh->GetBinError(ich+1));
1024 hClusterChargeMeanInCh[ich]->SetBinContent(ibin,hClusterChargePerChMean->GetBinContent(ich+1));
1025 hClusterChargeMeanInCh[ich]->SetBinError(ibin,hClusterChargePerChMean->GetBinError(ich+1));
1026 hClusterChargeSigmaInCh[ich]->SetBinContent(ibin,hClusterChargePerChSigma->GetBinContent(ich+1));
1027 hClusterChargeSigmaInCh[ich]->SetBinError(ibin,hClusterChargePerChSigma->GetBinError(ich+1));
1028 hClusterSizeMeanInCh[ich]->SetBinContent(ibin,hClusterSizePerChMean->GetBinContent(ich+1));
1029 hClusterSizeMeanInCh[ich]->SetBinError(ibin,hClusterSizePerChMean->GetBinError(ich+1));
1030 hClusterSizeSigmaInCh[ich]->SetBinContent(ibin,hClusterSizePerChSigma->GetBinContent(ich+1));
1031 hClusterSizeSigmaInCh[ich]->SetBinError(ibin,hClusterSizePerChSigma->GetBinError(ich+1));
1032 hNClustersInCh[ich]->SetBinContent(ibin,hNClustersPerCh->GetBinContent(ich+1));
1033 hNClustersInCh[ich]->SetBinError(ibin,hNClustersPerCh->GetBinError(ich+1));
1034 hClusterHitMapXInCh[ich]->SetBinContent(ibin,hClusterHitMapInCh[ich]->GetMean(1));
1035 hClusterHitMapXInCh[ich]->SetBinError(ibin,hClusterHitMapInCh[ich]->GetMeanError(1));
1036 hClusterHitMapYInCh[ich]->SetBinContent(ibin,hClusterHitMapInCh[ich]->GetMean(2));
1037 hClusterHitMapYInCh[ich]->SetBinError(ibin,hClusterHitMapInCh[ich]->GetMeanError(2));
1042 for ( Int_t ihisto=0; ihisto<2; ++ihisto ) {
1043 hTriggerCutVsRun[ihisto]->GetXaxis()->SetBinLabel(ibin,run.Data());
1044 hTriggerCutWidthVsRun[ihisto]->GetXaxis()->SetBinLabel(ibin,run.Data());
1046 hNClustersPerTrackVsRun_Mean->GetXaxis()->SetBinLabel(ibin, run.Data());
1047 hNClustersPerTrackVsRun_Sigma->GetXaxis()->SetBinLabel(ibin, run.Data());
1048 hNChamberHitPerTrack_Mean->GetXaxis()->SetBinLabel(ibin, run.Data());
1049 hNChamberHitPerTrack_Sigma->GetXaxis()->SetBinLabel(ibin, run.Data());
1050 hChi2_Mean->GetXaxis()->SetBinLabel(ibin, run.Data());
1051 hChi2_Sigma->GetXaxis()->SetBinLabel(ibin, run.Data());
1052 for (Int_t ich=0; ich<10; ich++){
1053 hNClustersInCh[ich]->GetXaxis()->SetBinLabel(ibin, run.Data());
1054 hClusterChargeMeanInCh[ich]->GetXaxis()->SetBinLabel(ibin, run.Data());
1055 hClusterChargeSigmaInCh[ich]->GetXaxis()->SetBinLabel(ibin, run.Data());
1056 hClusterSizeMeanInCh[ich]->GetXaxis()->SetBinLabel(ibin, run.Data());
1057 hClusterSizeSigmaInCh[ich]->GetXaxis()->SetBinLabel(ibin, run.Data());
1058 hClusterHitMapXInCh[ich]->GetXaxis()->SetBinLabel(ibin, run.Data());
1059 hClusterHitMapYInCh[ich]->GetXaxis()->SetBinLabel(ibin, run.Data());
1062 // close outfile for this run
1071 hNClustersPerTrackVsRun_Mean->LabelsOption("a");
1072 hNClustersPerTrackVsRun_Sigma->LabelsOption("a");
1073 hNChamberHitPerTrack_Mean->LabelsOption("a");
1074 hNChamberHitPerTrack_Sigma->LabelsOption("a");
1075 hChi2_Mean->LabelsOption("a");
1076 hChi2_Sigma->LabelsOption("a");
1078 for(Int_t ich=0; ich<10; ich++){
1079 hNClustersInCh[ich]->LabelsOption("a");
1080 hClusterChargeMeanInCh[ich]->LabelsOption("a");
1081 hClusterChargeSigmaInCh[ich]->LabelsOption("a");
1082 hClusterSizeMeanInCh[ich]->LabelsOption("a");
1083 hClusterSizeSigmaInCh[ich]->LabelsOption("a");
1084 hClusterHitMapXInCh[ich]->LabelsOption("a");
1085 hClusterHitMapYInCh[ich]->LabelsOption("a");
1088 TString dirToGo = OutFileNameROOT.Data(); dirToGo+=":/";
1089 gDirectory->Cd(dirToGo.Data());
1090 //==================================================
1091 //Display Mean and Sigma of the number of associated clusters to a track
1092 TLegend *lNClusters = new TLegend(0.75,0.85,0.99,0.99);
1093 lNClusters->AddEntry(hNClustersPerTrackVsRun_Mean,"clusters","PL");
1094 lNClusters->AddEntry(hNChamberHitPerTrack_Mean,"chamber hit","PL");
1096 TCanvas* cNClusters = new TCanvas("cNClusters","cNClusters",1200,900);
1097 cNClusters->Divide(1,2);
1099 //hNClustersPerTrackVsRun_Mean->SetMaximum(11);
1100 hNClustersPerTrackVsRun_Mean->SetMinimum(7);
1101 hNClustersPerTrackVsRun_Mean->SetStats(kFALSE);
1102 hNClustersPerTrackVsRun_Mean->GetXaxis()->SetRange(1,ibin-1);
1103 hNClustersPerTrackVsRun_Mean->GetXaxis()->SetNdivisions(1,kFALSE);
1104 //hNClustersPerTrackVsRun_Mean->LabelsOption("u");
1105 hNClustersPerTrackVsRun_Mean->SetLabelSize(0.04);
1106 hNClustersPerTrackVsRun_Mean->SetTitle("averaged number of associated clusters or of the number of chamber hit per track");
1107 hNClustersPerTrackVsRun_Mean->SetLineWidth(2);
1108 hNClustersPerTrackVsRun_Mean->Draw("e");
1109 hNChamberHitPerTrack_Mean->SetLineColor(kRed);
1110 hNChamberHitPerTrack_Mean->SetLineWidth(2);
1111 hNChamberHitPerTrack_Mean->Draw("esame");
1112 lNClusters->Draw("same");
1115 //hNClustersPerTrackVsRun_Sigma->SetMaximum(1.1);
1116 hNClustersPerTrackVsRun_Sigma->SetMinimum(0.4);
1117 hNClustersPerTrackVsRun_Sigma->SetStats(kFALSE);
1118 hNClustersPerTrackVsRun_Sigma->GetXaxis()->SetRange(1,ibin-1);
1119 hNClustersPerTrackVsRun_Sigma->GetXaxis()->SetNdivisions(1,kFALSE);
1120 //hNClustersPerTrackVsRun_Sigma->LabelsOption("u");
1121 hNClustersPerTrackVsRun_Sigma->SetLabelSize(0.04);
1122 hNClustersPerTrackVsRun_Sigma->SetTitle("dispersion of the number of associated clusters or of the number of chamber hit per track");
1123 hNClustersPerTrackVsRun_Sigma->SetLineWidth(2);
1124 hNClustersPerTrackVsRun_Sigma->Draw("e");
1125 hNChamberHitPerTrack_Sigma->SetLineWidth(2);
1126 hNChamberHitPerTrack_Sigma->SetLineColor(kRed);
1127 hNChamberHitPerTrack_Sigma->Draw("esame");
1128 lNClusters->Draw("same");
1130 cNClusters->Print(OutFileNamePDF.Data());
1132 cNClusters->Write();
1135 //==================================================
1136 // Display average number of cluster per chamber
1137 TLegend *lNClustersPerCh = new TLegend(0.92,0.45,0.99,0.99);
1138 TCanvas* cNClustersPerCh = new TCanvas("cNClustersPerCh","cNClustersPerCh",1200,900);
1139 cNClustersPerCh->cd();
1140 cNClustersPerCh->SetRightMargin(0.1);
1141 hNClustersInCh[0]->SetStats(kFALSE);
1142 hNClustersInCh[0]->GetXaxis()->SetRange(1,ibin-1);
1143 hNClustersInCh[0]->GetXaxis()->SetNdivisions(1,kFALSE);
1144 //hNClustersInCh[0]->LabelsOption("u");
1145 hNClustersInCh[0]->SetLabelSize(0.02);
1146 hNClustersInCh[0]->SetTitle("averaged number of clusters in chamber i per track");
1147 hNClustersInCh[0]->SetMaximum(1.2);
1148 hNClustersInCh[0]->SetMinimum(0.01);
1149 for (Int_t ich=0; ich<10; ich++) {
1150 hNClustersInCh[ich]->SetLineColor(ich+1+ich/9);
1151 hNClustersInCh[ich]->SetLineWidth(2);
1152 if (ich == 0) hNClustersInCh[ich]->Draw("e");
1153 else hNClustersInCh[ich]->Draw("esame");
1154 lNClustersPerCh->AddEntry(hNClustersInCh[ich],Form("ch%d",ich+1),"PL");
1156 lNClustersPerCh->Draw("same");
1158 cNClustersPerCh->Print(OutFileNamePDF.Data());
1160 cNClustersPerCh->Write();
1162 //==================================================
1163 // Display average cluster charge per chamber
1165 TLegend *lClusterChargePerCh = new TLegend(0.92,0.45,0.99,0.99);
1166 TCanvas* cClusterChargePerCh = new TCanvas("cClustersChargePerCh","cClustersChargePerCh",1200,900);
1167 cClusterChargePerCh->SetRightMargin(0.1);
1168 cClusterChargePerCh->Divide(1,2);
1170 cClusterChargePerCh->cd(1);
1171 hClusterChargeMeanInCh[0]->SetStats(kFALSE);
1172 hClusterChargeMeanInCh[0]->GetXaxis()->SetRange(1,ibin-1);
1173 hClusterChargeMeanInCh[0]->GetXaxis()->SetNdivisions(1,kFALSE);
1174 //hClusterChargeInCh[0]->LabelsOption("u");
1175 hClusterChargeMeanInCh[0]->SetLabelSize(0.04);
1176 hClusterChargeMeanInCh[0]->SetTitle("Cluster charge mean (fC) per track in chamber i");
1177 hClusterChargeMeanInCh[0]->SetMaximum(150);
1178 hClusterChargeMeanInCh[0]->SetMinimum(30);
1179 for (Int_t ich=0; ich<10; ich++) {
1180 hClusterChargeMeanInCh[ich]->SetLineColor(ich+1+ich/9);
1181 hClusterChargeMeanInCh[ich]->SetLineWidth(2);
1182 if (ich == 0) hClusterChargeMeanInCh[ich]->Draw("e");
1183 else hClusterChargeMeanInCh[ich]->Draw("esame");
1184 lClusterChargePerCh->AddEntry(hClusterChargeMeanInCh[ich],Form("ch%d",ich+1),"PL");
1186 lClusterChargePerCh->Draw("same");
1188 cClusterChargePerCh->cd(2);
1189 hClusterChargeSigmaInCh[0]->SetStats(kFALSE);
1190 hClusterChargeSigmaInCh[0]->GetXaxis()->SetRange(1,ibin-1);
1191 hClusterChargeSigmaInCh[0]->GetXaxis()->SetNdivisions(1,kFALSE);
1192 //hClusterChargeInCh[0]->LabelsOption("u");
1193 hClusterChargeSigmaInCh[0]->SetLabelSize(0.04);
1194 hClusterChargeSigmaInCh[0]->SetTitle("Cluster charge sigma per track in chamber i");
1195 hClusterChargeSigmaInCh[0]->SetMaximum(250);
1196 hClusterChargeSigmaInCh[0]->SetMinimum(50);
1197 for (Int_t ich=0; ich<10; ich++) {
1198 hClusterChargeSigmaInCh[ich]->SetLineColor(ich+1+ich/9);
1199 hClusterChargeSigmaInCh[ich]->SetLineWidth(2);
1200 if (ich == 0) hClusterChargeSigmaInCh[ich]->Draw("e");
1201 else hClusterChargeSigmaInCh[ich]->Draw("esame");
1203 lClusterChargePerCh->Draw("same");
1205 cClusterChargePerCh->Print(OutFileNamePDF.Data());
1207 cClusterChargePerCh->Write();
1209 //==================================================
1210 // Display average cluster size per chamber
1212 TLegend *lClusterSizePerCh = new TLegend(0.92,0.45,0.99,0.99);
1213 TCanvas* cClusterSizePerCh = new TCanvas("cClustersSizePerCh","cClustersSizePerCh",1200,900);
1214 cClusterSizePerCh->SetRightMargin(0.1);
1215 cClusterSizePerCh->Divide(1,2);
1217 cClusterSizePerCh->cd(1);
1218 hClusterSizeMeanInCh[0]->SetStats(kFALSE);
1219 hClusterSizeMeanInCh[0]->GetXaxis()->SetRange(1,ibin-1);
1220 hClusterSizeMeanInCh[0]->GetXaxis()->SetNdivisions(1,kFALSE);
1222 hClusterSizeMeanInCh[0]->SetLabelSize(0.04);
1223 hClusterSizeMeanInCh[0]->SetTitle("Cluster size mean (npads) per track in chamber i");
1224 hClusterSizeMeanInCh[0]->SetMaximum(18);
1225 hClusterSizeMeanInCh[0]->SetMinimum(0);
1226 for (Int_t ich=0; ich<10; ich++) {
1227 hClusterSizeMeanInCh[ich]->SetLineColor(ich+1+ich/9);
1228 hClusterSizeMeanInCh[ich]->SetLineWidth(2);
1229 if (ich == 0) hClusterSizeMeanInCh[ich]->Draw("e");
1230 else hClusterSizeMeanInCh[ich]->Draw("esame");
1231 lClusterSizePerCh->AddEntry(hClusterSizeMeanInCh[ich],Form("ch%d",ich+1),"PL");
1233 lClusterSizePerCh->Draw("same");
1235 cClusterSizePerCh->cd(2);
1236 hClusterSizeSigmaInCh[0]->SetStats(kFALSE);
1237 hClusterSizeSigmaInCh[0]->GetXaxis()->SetRange(1,ibin-1);
1238 hClusterSizeSigmaInCh[0]->GetXaxis()->SetNdivisions(1,kFALSE);
1240 hClusterSizeSigmaInCh[0]->SetLabelSize(0.04);
1241 hClusterSizeSigmaInCh[0]->SetTitle("Cluster size sigma (npads) per track in chamber i");
1242 hClusterSizeSigmaInCh[0]->SetMaximum(7);
1243 hClusterSizeSigmaInCh[0]->SetMinimum(0);
1244 for (Int_t ich=0; ich<10; ich++) {
1245 hClusterSizeSigmaInCh[ich]->SetLineColor(ich+1+ich/9);
1246 hClusterSizeSigmaInCh[ich]->SetLineWidth(2);
1247 if (ich == 0) hClusterSizeSigmaInCh[ich]->Draw("e");
1248 else hClusterSizeSigmaInCh[ich]->Draw("esame");
1250 lClusterSizePerCh->Draw("same");
1252 cClusterSizePerCh->Print(OutFileNamePDF.Data());
1254 cClusterSizePerCh->Write();
1257 //==================================================
1258 // Display average X and Y position of clusters per chamber
1259 TLegend *lClusterHitMapPerCh = new TLegend(0.92,0.45,0.99,0.99);
1260 TCanvas* cClusterHitMapPerCh = new TCanvas("cClusterHitMapPerCh","cClusterHitMapPerCh",1200,900);
1261 cClusterHitMapPerCh->Divide(1,2);
1262 cClusterHitMapPerCh->GetPad(1)->SetRightMargin(0.1);
1263 cClusterHitMapPerCh->GetPad(2)->SetRightMargin(0.1);
1265 cClusterHitMapPerCh->cd(1);
1266 hClusterHitMapXInCh[0]->SetStats(kFALSE);
1267 hClusterHitMapXInCh[0]->GetXaxis()->SetRange(1,ibin-1);
1268 hClusterHitMapXInCh[0]->GetXaxis()->SetNdivisions(1,kFALSE);
1269 //hNClustersInCh[0]->LabelsOption("u");
1270 hClusterHitMapXInCh[0]->SetLabelSize(0.04);
1271 hClusterHitMapXInCh[0]->SetTitle("<X> of clusters - associated to a track - in chamber i");
1272 hClusterHitMapXInCh[0]->SetMaximum(30);
1273 hClusterHitMapXInCh[0]->SetMinimum(-30);
1274 for (Int_t ich=0; ich<10; ich++) {
1275 hClusterHitMapXInCh[ich]->SetLineColor(ich+1+ich/9);
1276 hClusterHitMapXInCh[ich]->SetLineWidth(2);
1277 if (ich == 0) hClusterHitMapXInCh[ich]->Draw("e");
1278 else hClusterHitMapXInCh[ich]->Draw("esame");
1280 lClusterHitMapPerCh->AddEntry(hClusterHitMapXInCh[ich],Form("ch%d",ich+1),"PL");
1282 lClusterHitMapPerCh->Draw("same");
1284 cClusterHitMapPerCh->cd(2);
1285 hClusterHitMapYInCh[0]->SetStats(kFALSE);
1286 hClusterHitMapYInCh[0]->GetXaxis()->SetRange(1,ibin-1);
1287 hClusterHitMapYInCh[0]->GetXaxis()->SetNdivisions(1,kFALSE);
1288 //hNClustersInCh[0]->LabelsOption("u");
1289 hClusterHitMapYInCh[0]->SetLabelSize(0.04);
1290 hClusterHitMapYInCh[0]->SetTitle("<Y> of clusters - associated to a track - in chamber i");
1291 hClusterHitMapYInCh[0]->SetMaximum(30);
1292 hClusterHitMapYInCh[0]->SetMinimum(-30);
1293 for (Int_t ich=0; ich<10; ich++) {
1294 hClusterHitMapYInCh[ich]->SetLineColor(ich+1+ich/9);
1295 hClusterHitMapYInCh[ich]->SetLineWidth(2);
1296 if (ich == 0) hClusterHitMapYInCh[ich]->Draw("e");
1297 else hClusterHitMapYInCh[ich]->Draw("esame");
1299 lClusterHitMapPerCh->Draw("same");
1301 cClusterHitMapPerCh->Print(OutFileNamePDF.Data());
1303 cClusterHitMapPerCh->Write();
1306 //==================================================
1307 // Display tracks ChiSquare
1308 TCanvas* cChi2 = new TCanvas("cChi2","cChi2",1200,900);
1311 hChi2_Mean->SetStats(kFALSE);
1312 hChi2_Mean->GetXaxis()->SetRange(1,ibin-1);
1313 hChi2_Mean->GetXaxis()->SetNdivisions(1,kFALSE);
1314 //hChi2_Mean->LabelsOption("u");
1315 hChi2_Mean->SetLabelSize(0.04);
1316 hChi2_Mean->SetLineWidth(2);
1317 hChi2_Mean->Draw("e");
1320 hChi2_Sigma->SetStats(kFALSE);
1321 hChi2_Sigma->GetXaxis()->SetRange(1,ibin-1);
1322 hChi2_Sigma->GetXaxis()->SetNdivisions(1,kFALSE);
1323 //hChi2_Sigma->LabelsOption("u");
1324 hChi2_Sigma->SetLabelSize(0.04);
1325 hChi2_Sigma->SetLineWidth(2);
1326 hChi2_Sigma->Draw("e");
1328 cChi2->Print(OutFileNamePDF.Data());
1332 //==================================================
1333 // Display track Lpt/Hpt
1334 if ( hTriggerCutVsRun[0] && hTriggerCutVsRun[1] ) {
1335 TCanvas* cLptHpt = new TCanvas("cLptHpt","cLptHpt",1200,900);
1336 cLptHpt->Divide(1,2);
1337 TLegend* legLptHpt = new TLegend(0.72,0.7,0.9,0.85);
1338 legLptHpt->SetBorderSize(1);
1339 for ( Int_t ihisto=0; ihisto<2; ++ihisto) {
1340 cLptHpt->cd(ihisto+1);
1341 TH1* currHistos[2] = {hTriggerCutVsRun[ihisto], hTriggerCutWidthVsRun[ihisto]};
1342 for ( Int_t jhisto=0; jhisto<2; jhisto++ ) {
1343 currHistos[jhisto]->GetXaxis()->SetRange(1,ibin-1);
1344 currHistos[jhisto]->GetYaxis()->SetRangeUser(0.,5.);
1345 currHistos[jhisto]->LabelsOption("a");
1346 currHistos[jhisto]->SetStats(kFALSE);
1347 currHistos[jhisto]->GetXaxis()->SetLabelSize(0.04);
1348 currHistos[jhisto]->SetLineWidth(2);
1350 hTriggerCutWidthVsRun[ihisto]->SetLineColor(2);
1351 hTriggerCutWidthVsRun[ihisto]->SetMarkerColor(2);
1352 hTriggerCutWidthVsRun[ihisto]->SetFillColor(2);
1353 hTriggerCutWidthVsRun[ihisto]->SetFillStyle(3001);
1354 hTriggerCutWidthVsRun[ihisto]->Draw("e2");
1355 hTriggerCutVsRun[ihisto]->Draw("esame");
1356 if ( ihisto == 0 ) {
1357 legLptHpt->AddEntry(hTriggerCutWidthVsRun[ihisto],"Fit width","f");
1358 legLptHpt->AddEntry(hTriggerCutVsRun[ihisto],"pt cut from fit (stat error)","lp");
1359 legLptHpt->Draw("same");
1362 cLptHpt->Print(OutFileNamePDF.Data());
1368 //==================================================
1369 // Display muon trigger
1370 //==================================================
1372 TCanvas* cMuonTriggerUnlikeLike = new TCanvas("cMuonTriggerUnlikeLike","cMuonTriggerUnlikeLike",1200,900);
1373 TCanvas* cMuonTriggerHpt = new TCanvas("cMuonTriggerHpt","cMuonTriggerHpt",1200,900);
1374 cMuonTriggerHpt->Divide(1,2);
1376 Int_t const ntrig = 3;
1377 Int_t const nhist = 3;
1378 TH1F *hRelMuonTrigger[ntrig], *hTot;
1380 //3 configurations (3x3 histos for 3 canvases)
1381 Int_t conf[ntrig][nhist]={{0,1,3},{0,2,4},{1,2,5}};
1382 TString sconf[ntrig][nhist]={{"hTriggerUnlikeOnly","hTriggerLikeOnly","hTriggerUnlikeAndLike"},{"hTriggerUnlikeOnly","hTriggerHptOnly","hTriggerUnlikeAndHpt"},{"hTriggerLikeOnly","hTriggerHptOnly","hTriggerLikeAndHpt"}};
1385 for ( Int_t i=0; i < ntrig; i++ ) {
1386 for ( Int_t j=0; j < nhist; j++ ) {
1387 sname = sconf[i][j]; sname +=(i+1);
1388 hMuonTrigger[conf[i][j]]->GetXaxis()->SetRange(1,ibin-1);
1389 hRelMuonTrigger[j] = (TH1F*)hMuonTrigger[conf[i][j]]->Clone(sname);
1390 hRelMuonTrigger[j]->SetLineColor(j+1);
1391 hRelMuonTrigger[j]->SetStats(kFALSE);
1392 hRelMuonTrigger[j]->GetXaxis()->SetNdivisions(1,kFALSE);
1393 hRelMuonTrigger[j]->LabelsOption("a");
1394 hRelMuonTrigger[j]->SetLabelSize(0.02);
1395 //hRelMuonTrigger[j]->GetXaxis()->SetLabelSize(0.04);
1396 hRelMuonTrigger[j]->SetLineWidth(2);
1397 hRelMuonTrigger[j]->SetTitle("");
1402 hTot = (TH1F*) hRelMuonTrigger[0]->Clone(sname);
1403 hTot->Add(hRelMuonTrigger[1]);
1404 hTot->Add(hRelMuonTrigger[2],-1);
1405 hRelMuonTrigger[0]->Add(hRelMuonTrigger[2],-1);
1406 hRelMuonTrigger[1]->Add(hRelMuonTrigger[2],-1);
1408 for(Int_t j=0; j < nhist; j++) hRelMuonTrigger[j]->Divide(hTot);
1410 if(i==0) cMuonTriggerUnlikeLike->cd();
1411 else cMuonTriggerHpt->cd(i);
1413 if (i==0) hRelMuonTrigger[i]->SetTitle("Relative muon triggers content");
1414 TLegend *leg = new TLegend(0.72,0.7,0.9,0.85);
1415 leg->SetBorderSize(1);
1417 for(Int_t j=0; j<nhist; j++){
1419 hRelMuonTrigger[j]->SetMaximum(1);
1420 hRelMuonTrigger[j]->SetMinimum(0);
1421 hRelMuonTrigger[j]->Draw("e");
1423 else hRelMuonTrigger[j]->Draw("esame");
1424 sname = sconf[i][j];
1425 leg->AddEntry(hRelMuonTrigger[j],sname,"l");
1429 cMuonTriggerUnlikeLike->Print(OutFileNamePDF.Data());
1431 cMuonTriggerUnlikeLike->Write();
1432 cMuonTriggerHpt->Print(OutFileNamePDF.Data());
1433 cMuonTriggerHpt->Write();
1435 // close the PDF file
1436 c1->Print(OutFileNamePDF_close.Data());
1437 rootFileOut->Close();
1452 void SetCanvas(TCanvas *canvas, Int_t logy){
1455 canvas->SetTopMargin(0.05);
1456 canvas->SetRightMargin(0.01);
1457 canvas->SetGridy(1);
1458 canvas->SetLogy(logy);
1463 Bool_t IsTrigger(TObjArray *array, Int_t index, TString name){
1465 Bool_t process = kFALSE;
1467 if( !array) return process;
1469 TString triggerName = (( (TObjString*) array->At(index) )->GetString());
1471 if( triggerName.Contains(name) ) process = kTRUE;
1476 Bool_t IsTriggerSelectedForMuonPhysics(TObjArray *triggersB, Int_t k){
1478 if ( !triggersB ) return kFALSE;
1480 selected = (IsTrigger(triggersB,k,"CMB") || IsTrigger(triggersB, k, "CPBI") || IsTrigger(triggersB, k, "CVHN") || IsTrigger(triggersB, k, "CVLN") || IsTrigger(triggersB, k, "CCENT") || IsTrigger(triggersB, k, "CSEMI") );
1481 if (!selected) selected = (IsTrigger(triggersB,k,"CINT7") || IsTrigger(triggersB, k, "CMUSH7") ||IsTrigger(triggersB, k, "CMUS7") || IsTrigger(triggersB, k, "CMUL7") || IsTrigger(triggersB, k, "CMUU7") );
1487 Bool_t IsHeavyIonCollision(AliCounterCollection *eventCounters){
1489 if(!eventCounters) return kFALSE;
1491 Double_t sum = eventCounters->GetSum("v0mult:low,int,high");
1492 Bool_t result = kTRUE;
1493 if(sum<=0) result = kFALSE;
1495 cout<<" Collision type is set to ";
1496 if( result == kFALSE) cout<<"p-p"<<endl;
1497 else cout<<"heavy-ion"<<endl;
1502 TCanvas *ProcessCanvasTriggerContent(TObjArray *array, TH1 **hBNoPS, TH1 **hBWithPS, TString canvasName){
1504 if(!array || !hBNoPS || !hBWithPS) return 0x0;
1506 TString cName = "c";
1507 cName += canvasName;
1508 TCanvas *cTriggerContent = new TCanvas(canvasName,cName,1200,900);
1509 SetCanvas(cTriggerContent);
1510 cTriggerContent->cd();
1512 TLegend* legcTC = new TLegend(0.2,0.15,0.50,0.40);
1513 legcTC->SetHeader("Physics Selection");
1514 legcTC->AddEntry(".","applied :","");
1516 for(Int_t i = 0; i < array->GetEntriesFast(); i++){
1517 //skip the sum of all triggers
1518 if( i == (array->GetEntriesFast()-1) ) continue;
1519 hBNoPS[i]->SetLineStyle(2);
1521 hBNoPS[i]->SetMinimum(1e-3);
1523 hBWithPS[i]->Draw("same");
1526 hBNoPS[i]->Draw("same");
1527 hBWithPS[i]->Draw("same");
1529 legcTC->AddEntry(hBWithPS[i],(( (TObjString*) array->At(i) )->GetString()).Data(),"l");
1531 legcTC->AddEntry(".","not applied :","");
1533 for(Int_t i = 0; i < array->GetEntriesFast(); i++){
1534 legcTC->AddEntry(hBNoPS[i],(( (TObjString*) array->At(i) )->GetString()).Data(),"l");
1537 legcTC->Draw("same");
1539 return cTriggerContent;
1542 TCanvas *ProcessCanvasRelativeTriggerContent(TObjArray *triggersB, TH1 **histo, TString canvasName, TArrayI *colorInd){
1544 if(!triggersB || !histo ) return 0x0;
1546 TString cName = "c" ;
1547 cName += canvasName;
1548 TCanvas *cRelativeTriggerContent = new TCanvas(canvasName,cName,1200,900);
1549 SetCanvas(cRelativeTriggerContent);
1550 cRelativeTriggerContent->cd();
1552 TH1** ratio = new TH1*[triggersB->GetEntriesFast()];
1553 TLegend* legcRTC = new TLegend(0.2,0.15,0.50,0.40);
1554 legcRTC->SetHeader("Physics Selection");
1556 TString hName, hTriggerName;
1557 Int_t indAllTrig = triggersB->GetEntriesFast()-1;
1559 for(Int_t i = 0; i < triggersB->GetEntriesFast()-1; i++){
1561 hName += ( (TObjString*) triggersB->At(i) )->GetString();
1562 ratio[i] = static_cast<TH1*> (histo[i]->Clone(hName));
1563 ratio[i]->Divide(histo[indAllTrig]);
1564 ratio[i]->SetLineWidth(2);
1565 ratio[i]->SetLineColor(colorInd->At(i));
1567 ratio[i]->SetMaximum(1.5);
1568 ratio[i]->SetMinimum(0.001);
1569 ratio[i]->SetLabelSize(0.04);
1570 ratio[i]->GetYaxis()->SetTitle("Relative trigger content");
1571 ratio[i]->Draw("E");
1574 ratio[i]->Draw("ESAME");
1578 legcRTC->AddEntry(".","not applied :","");
1579 for(Int_t i = 0; i < triggersB->GetEntriesFast()-1; i++){
1580 legcRTC->AddEntry(ratio[i],(( (TObjString*) triggersB->At(i) )->GetString()).Data(),"l");
1582 legcRTC->Draw("same");
1584 return cRelativeTriggerContent;
1587 TCanvas *ProcessCanvasPhysSelCut(TObjArray *triggersB, TObjArray *triggersAC, TObjArray *triggersE, TH1 **hBNoPS, TH1 **hACNoPS, TH1 **hENoPS, TH1 **hBWithPS, TString canvasName, TArrayI *colorInd, Bool_t isHeavyIon){
1589 if(!triggersB || !triggersE || !triggersAC || !hBNoPS || !hACNoPS || !hENoPS || !hBWithPS) return 0x0;
1591 //Multiplicative factor for A,C and E triggers
1592 Float_t scale = 3; //3 for pp - 10 for PbPb
1593 if(isHeavyIon) scale = 10;
1595 TString cName = "c";
1596 cName += canvasName;
1597 TCanvas *c1 = new TCanvas(canvasName,cName,1200,900);
1601 TH1** ratioB = new TH1*[triggersB->GetEntriesFast()], **ratioBNoPS = new TH1*[triggersB->GetEntriesFast()];
1602 TH1** ratioACNoPS = new TH1*[triggersB->GetEntriesFast()];
1603 TH1** ratioENoPS = new TH1*[triggersB->GetEntriesFast()];
1604 TLegend* legcRTC = new TLegend(0.2,0.15,0.50,0.40);
1605 legcRTC->SetHeader("Physics Selection");
1608 for(Int_t i = 0; i < triggersB->GetEntriesFast()-1; i++){
1610 //scale A, C and E triggers
1611 hACNoPS[i]->Scale(scale);
1612 hENoPS[i]->Scale(scale);
1615 hName += ( (TObjString*) triggersB->At(i) )->GetString();
1616 ratioB[i] = static_cast<TH1*> (hBWithPS[i]->Clone(hName));
1617 ratioB[i]->Divide(hBNoPS[i]);
1618 ratioB[i]->SetLineWidth(2);
1619 ratioB[i]->SetLineColor(colorInd->At(i));
1620 hName = "ratioNoPS";
1621 hName += ( (TObjString*) triggersB->At(i) )->GetString();
1622 ratioBNoPS[i] = static_cast<TH1*> (hBNoPS[i]->Clone(hName));
1623 ratioBNoPS[i]->Divide(hBNoPS[i]);
1624 ratioBNoPS[i]->SetLineWidth(0);
1625 ratioBNoPS[i]->SetLineStyle(1);
1626 ratioBNoPS[i]->SetMarkerStyle(24+i);
1627 ratioBNoPS[i]->SetMarkerSize(1);
1628 ratioBNoPS[i]->SetLineColor(colorInd->At(i));
1629 ratioBNoPS[i]->SetMarkerColor(colorInd->At(i));
1631 hName = "ratioACNoPS";
1632 hName += ( (TObjString*) triggersAC->At(i) )->GetString();
1633 ratioACNoPS[i] = static_cast<TH1*> (hACNoPS[i]->Clone(hName));
1634 if ( ratioACNoPS[i]->GetEntries() > 0 ) ratioACNoPS[i]->Divide(hBNoPS[i]);
1635 ratioACNoPS[i]->SetLineWidth(0);
1636 ratioACNoPS[i]->SetLineStyle(2);
1637 ratioACNoPS[i]->SetMarkerStyle(24+i);
1638 ratioACNoPS[i]->SetMarkerSize(1);
1639 ratioACNoPS[i]->SetLineColor(colorInd->At(i));
1640 ratioACNoPS[i]->SetMarkerColor(colorInd->At(i));
1642 hName = "ratioENoPS";
1643 hName += ( (TObjString*) triggersE->At(i) )->GetString();
1644 ratioENoPS[i] = static_cast<TH1*> (hENoPS[i]->Clone(hName));
1645 if ( ratioENoPS[i]->GetEntries() > 0 ) ratioENoPS[i]->Divide(hBNoPS[i]);
1646 ratioENoPS[i]->SetLineWidth(0);
1647 ratioENoPS[i]->SetLineStyle(3);
1648 ratioENoPS[i]->SetMarkerStyle(24+i);
1649 ratioENoPS[i]->SetMarkerSize(1);
1650 ratioENoPS[i]->SetLineColor(colorInd->At(i));
1651 ratioENoPS[i]->SetMarkerColor(colorInd->At(i));
1655 ratioB[i]->SetMaximum(1.5);
1656 ratioB[i]->SetMinimum(0.05);
1657 ratioB[i]->SetLabelSize(0.02);
1658 ratioB[i]->GetYaxis()->SetTitle("Accepted / All from Phys. Sel.");
1659 ratioB[i]->SetTitle("Phys. Sel. for all selected triggers");
1660 ratioB[i]->Draw("E");
1661 //ratioBNoPS[i]->Draw("EPSAME");
1662 ratioACNoPS[i]->Draw("EPSAME");
1663 ratioENoPS[i]->Draw("EPSAME");
1666 ratioB[i]->Draw("ESAME");
1667 //ratioBNoPS[i]->Draw("EPSAME");
1668 ratioACNoPS[i]->Draw("EPSAME");
1669 ratioENoPS[i]->Draw("EPSAME");
1673 legcRTC->AddEntry(".","applied :","");
1674 for(Int_t i = 0; i < triggersB->GetEntriesFast()-1; i++){
1675 legcRTC->AddEntry(ratioB[i],(( (TObjString*) triggersB->At(i) )->GetString()).Data(),"l");
1677 legcRTC->AddEntry(".","not applied :","");
1678 for(Int_t i = 0; i < triggersB->GetEntriesFast()-1; i++){
1679 //legcRTC->AddEntry(ratioBNoPS[i],(( (TObjString*) triggersB->At(i) )->GetString()).Data(),"pl");
1680 TString textLegend = ( (TObjString*) triggersAC->At(i) )->GetString();
1681 if( textLegend.CompareTo(" ") ){
1683 textLegend += scale;
1684 legcRTC->AddEntry(ratioACNoPS[i],textLegend.Data(),"pl");
1686 textLegend = ( (TObjString*) triggersE->At(i) )->GetString();
1687 if( textLegend.CompareTo(" ") ){
1688 //cout<<"trigger="<<textLegend.Data()<<"-"<<endl;
1690 textLegend += scale;
1691 legcRTC->AddEntry(ratioENoPS[i],textLegend.Data(),"pl");
1694 legcRTC->Draw("same");
1700 TCanvas *ProcessCanvasPhysSelCutCentrality(TObjArray *triggersB, TObjArray *triggersAC, TObjArray *triggersE, TH1 **hBNoPSCent, TH1 **hACNoPSCent, TH1 **hENoPSCent, TH1 **hBWithPSCent, Int_t k, TString canvasName, TArrayI *colorInd, TString *legendHeader, Bool_t isHeavyIon){
1702 if(!triggersB || !triggersE || !triggersAC || !hBNoPSCent || !hACNoPSCent || !hENoPSCent || !hBWithPSCent || !legendHeader) return 0x0;
1704 //Multiplicative factor for A,C and E triggers
1705 Float_t scale = 3; //3 for pp - 10 for PbPb
1706 if(isHeavyIon) scale = 10;
1708 TString cName = "c";
1709 cName += canvasName;
1710 TCanvas *c1 = new TCanvas(canvasName,cName,1200,900);
1714 Int_t const centBinMax =3;
1715 TH1* ratioB[centBinMax], *ratioBNoPS[centBinMax];
1716 TH1* ratioACNoPS[centBinMax];
1717 TH1* ratioENoPS[centBinMax];
1718 TLegend* legcRTC = new TLegend(0.2,0.15,0.50,0.40);
1719 legcRTC->SetHeader("Physics Selection");
1723 Float_t yMin = 0.05, yMax = 2;
1725 for(Int_t centBin = 0; centBin < centBinMax; centBin++){
1726 //scale A, C and E triggers
1727 hACNoPSCent[centBin]->Scale(scale);
1728 hENoPSCent[centBin]->Scale(scale);
1731 hName += ( (TObjString*) triggersB->At(k) )->GetString();
1732 ratioB[centBin] = static_cast<TH1*> (hBWithPSCent[centBin]->Clone(hName));
1733 ratioB[centBin]->Divide(hBNoPSCent[centBin]);
1734 ratioB[centBin]->SetLineWidth(2);
1735 ratioB[centBin]->SetLineColor(colorInd->At(centBin));
1736 hName = "ratioNoPS";
1737 hName += ( (TObjString*) triggersB->At(k) )->GetString();
1738 ratioBNoPS[centBin] = static_cast<TH1*> (hBNoPSCent[centBin]->Clone(hName));
1739 ratioBNoPS[centBin]->Divide(hBNoPSCent[centBin]);
1740 ratioBNoPS[centBin]->SetLineWidth(0);
1741 ratioBNoPS[centBin]->SetLineStyle(1);
1742 ratioBNoPS[centBin]->SetMarkerStyle(24+centBin);
1743 ratioBNoPS[centBin]->SetMarkerSize(1);
1744 ratioBNoPS[centBin]->SetLineColor(colorInd->At(centBin));
1745 ratioBNoPS[centBin]->SetMarkerColor(colorInd->At(centBin));
1747 hName = "ratioACNoPS";
1748 hName += ( (TObjString*) triggersAC->At(k) )->GetString();
1749 ratioACNoPS[centBin] = static_cast<TH1*> (hACNoPSCent[centBin]->Clone(hName));
1750 if ( ratioACNoPS[centBin]->GetEntries() > 0 ) ratioACNoPS[centBin]->Divide(hBNoPSCent[centBin]);
1751 ratioACNoPS[centBin]->SetLineWidth(0);
1752 ratioACNoPS[centBin]->SetLineStyle(2);
1753 ratioACNoPS[centBin]->SetMarkerStyle(24+centBin);
1754 ratioACNoPS[centBin]->SetMarkerSize(1);
1755 ratioACNoPS[centBin]->SetLineColor(colorInd->At(centBin));
1756 ratioACNoPS[centBin]->SetMarkerColor(colorInd->At(centBin));
1759 hName = "ratioENoPS";
1760 hName += ( (TObjString*) triggersE->At(k) )->GetString();
1761 ratioENoPS[centBin] = static_cast<TH1*> (hENoPSCent[centBin]->Clone(hName));
1762 if ( ratioENoPS[centBin]->GetEntries() > 0 ) ratioENoPS[centBin]->Divide(hBNoPSCent[centBin]);
1763 ratioENoPS[centBin]->SetLineWidth(0);
1764 ratioENoPS[centBin]->SetLineStyle(3);
1765 ratioENoPS[centBin]->SetMarkerStyle(24+centBin);
1766 ratioENoPS[centBin]->SetMarkerSize(1);
1767 ratioENoPS[centBin]->SetLineColor(colorInd->At(centBin));
1768 ratioENoPS[centBin]->SetMarkerColor(colorInd->At(centBin));
1772 ratioB[centBin]->SetMaximum(yMax);
1773 ratioB[centBin]->SetMinimum(yMin);
1774 ratioB[centBin]->SetLabelSize(0.02);
1775 ratioB[centBin]->GetYaxis()->SetTitle("Accepted / All from Phys. Sel.");
1776 TString sTitle = "for ", sTitle2 = (( (TObjString*) triggersB->At(k) )->GetString()).Data();
1777 if ( !sTitle2.IsNull() ) sTitle += sTitle2;
1779 ratioB[centBin]->SetTitle(Form("Phys. Sel. %s - Multiplicity from V0 amplitude",sTitle.Data()));
1780 ratioB[centBin]->Draw("E");
1781 //ratioBNoPS[centBin]->Draw("EPSAME");
1782 ratioACNoPS[centBin]->Draw("EPSAME");
1783 ratioENoPS[centBin]->Draw("EPSAME");
1786 ratioB[centBin]->Draw("ESAME");
1787 //ratioBNoPS[centBin]->Draw("EPSAME");
1788 ratioACNoPS[centBin]->Draw("EPSAME");
1789 ratioENoPS[centBin]->Draw("EPSAME");
1793 legcRTC->AddEntry(".","applied :","");
1794 for(Int_t centBin = 0; centBin < centBinMax; centBin++){
1795 legcRTC->AddEntry(ratioB[centBin],(legendHeader[centBin]).Data(),"l");
1797 legcRTC->AddEntry(".","not applied :","");
1798 for(Int_t centBin = 0; centBin < centBinMax; centBin++){
1799 TString textLegend = ( (TObjString*) triggersAC->At(k) )->GetString();
1800 if( textLegend.CompareTo(" ") && ratioACNoPS[centBin]->GetMaximum() > yMin ){
1802 textLegend += scale;
1803 legcRTC->AddEntry(ratioACNoPS[centBin],textLegend.Data(),"pl");
1805 textLegend = ( (TObjString*) triggersE->At(k) )->GetString();
1806 if( textLegend.CompareTo(" ") && ratioENoPS[centBin]->GetMaximum() > yMin){
1807 //cout<<"trigger="<<textLegend.Data()<<"-"<<endl;
1809 textLegend += scale;
1810 legcRTC->AddEntry(ratioENoPS[centBin],textLegend.Data(),"pl");
1813 legcRTC->Draw("same");
1819 TCanvas *ProcessCanvasCentralityPercentile(TObjArray *triggersB, TH1 **hBNoPSCent, TH1 **hBWithPSCent, Int_t k, TString canvasName, TArrayI *colorInd, TString *legendHeader){
1821 if(!triggersB || !hBNoPSCent || !hBWithPSCent || !legendHeader) return 0x0;
1823 TString cName = "c";
1824 cName += canvasName;
1825 TCanvas *c1 = new TCanvas(canvasName,cName,1200,900);
1829 Int_t const centBinMax =2;
1830 TH1* ratioB[centBinMax], *ratioBNoPS[centBinMax];
1831 TLegend* legcRTC = new TLegend(0.2,0.15,0.50,0.40);
1832 legcRTC->SetHeader("Physics Selection");
1836 Float_t yMin = 0., yMax = 0.3;
1838 for(Int_t centBin = 0; centBin < centBinMax; centBin++){
1841 hName += ( (TObjString*) triggersB->At(k) )->GetString();
1842 ratioB[centBin] = static_cast<TH1*> (hBWithPSCent[centBin+1]->Clone(hName));
1843 ratioB[centBin]->Divide(hBWithPSCent[0]);
1844 ratioB[centBin]->Scale(0.8);
1845 ratioB[centBin]->SetLineWidth(2);
1846 ratioB[centBin]->SetLineColor(colorInd->At(centBin+1));
1847 hName = "ratioNoPS";
1848 hName += ( (TObjString*) triggersB->At(k) )->GetString();
1849 ratioBNoPS[centBin] = static_cast<TH1*> (hBNoPSCent[centBin+1]->Clone(hName));
1850 ratioBNoPS[centBin]->Divide(hBNoPSCent[0]);
1851 ratioBNoPS[centBin]->Scale(0.8);
1852 ratioBNoPS[centBin]->SetLineWidth(0);
1853 ratioBNoPS[centBin]->SetLineStyle(1);
1854 ratioBNoPS[centBin]->SetMarkerStyle(24+centBin+1);
1855 ratioBNoPS[centBin]->SetMarkerSize(1);
1856 ratioBNoPS[centBin]->SetLineColor(colorInd->At(centBin+1));
1857 ratioBNoPS[centBin]->SetMarkerColor(colorInd->At(centBin+1));
1860 ratioB[centBin]->SetMaximum(yMax);
1861 ratioB[centBin]->SetMinimum(yMin);
1862 ratioB[centBin]->SetLabelSize(0.02);
1863 ratioB[centBin]->GetYaxis()->SetTitle("Centrality percentile check");
1864 TString sTitle = "for ", sTitle2 = (( (TObjString*) triggersB->At(k) )->GetString()).Data();
1865 if ( !sTitle2.IsNull() ) sTitle += sTitle2;
1867 ratioB[centBin]->SetTitle(Form("Centrality percentile check %s - Multiplicity from V0 amplitude",sTitle.Data()));
1868 ratioB[centBin]->Draw("E");
1869 ratioBNoPS[centBin]->Draw("EPSAME");
1872 ratioB[centBin]->Draw("ESAME");
1873 ratioBNoPS[centBin]->Draw("EPSAME");
1877 legcRTC->AddEntry(".","applied :","");
1878 for(Int_t centBin = 0; centBin < centBinMax; centBin++){
1879 legcRTC->AddEntry(ratioB[centBin],(legendHeader[centBin+1]).Data(),"l");
1881 legcRTC->AddEntry(".","not applied :","");
1882 for(Int_t centBin = 0; centBin < centBinMax; centBin++){
1883 legcRTC->AddEntry(ratioBNoPS[centBin],(legendHeader[centBin+1]).Data(),"l");
1885 legcRTC->Draw("same");
1891 TCanvas *ProcessCanvasTracksoverTrigger(TObjArray *triggersB, TH1 **hB, TH1 **hTrackerB, TH1 **hTriggerB, TH1 **hMatchedB, TH1 **hAllTracksB, Int_t indTrigger, TString canvasName, TString legendHeader){
1893 if(!triggersB || !hB || !hTrackerB || !hTriggerB || !hMatchedB || !hAllTracksB || indTrigger<0 ) return 0x0;
1895 TH1 *hTrackerPerB, *hTriggerPerB, *hMatchedPerB, *hAllTracksPerB;
1897 TString hName, hNameBase;
1898 hNameBase =( (TObjString*) triggersB->At(indTrigger) )->GetString();
1900 hName = "hTrackerPer";
1902 hTrackerPerB = static_cast<TH1*>(hTrackerB[indTrigger]->Clone(hName));
1903 if ( hTrackerPerB->GetEntries() > 0 ) hTrackerPerB->Divide(hB[indTrigger]);
1904 hTrackerPerB->SetLineWidth(2);
1905 hTrackerPerB->SetLineColor(kRed);
1907 hName = "hTriggerPer";
1909 hTriggerPerB = static_cast<TH1*>(hTriggerB[indTrigger]->Clone(hName));
1910 if ( hTriggerPerB->GetEntries() > 0 ) hTriggerPerB->Divide(hB[indTrigger]);
1911 hTriggerPerB->SetLineWidth(2);
1912 hTriggerPerB->SetLineColor(kBlue);
1914 hName = "hMatchedPer";
1916 hMatchedPerB = static_cast<TH1*>(hMatchedB[indTrigger]->Clone(hName));
1917 if ( hMatchedPerB->GetEntries() > 0 ) hMatchedPerB->Divide(hB[indTrigger]);
1918 hMatchedPerB->SetLineWidth(2);
1919 hMatchedPerB->SetLineColor(kViolet);
1921 hName = "hAllTracksPer";
1923 hAllTracksPerB = static_cast<TH1*>(hAllTracksB[indTrigger]->Clone(hName));
1924 if ( hAllTracksPerB->GetEntries() > 0 ) hAllTracksPerB->Divide(hB[indTrigger]);
1925 hAllTracksPerB->SetLineWidth(3);
1926 hAllTracksPerB->SetLineColor(kBlack);
1927 hAllTracksPerB->SetTitle(Form("Number of Tracks /%s %s",hNameBase.Data(),legendHeader.Data()));
1928 hAllTracksPerB->SetMinimum(0.0001);
1929 hAllTracksPerB->SetLabelSize(0.02);
1932 TString cName = "c";
1933 cName += canvasName;
1934 hNameBase =( (TObjString*) triggersB->At(indTrigger) )->GetString();
1936 TCanvas *cRatioTrackTypesB = new TCanvas(canvasName,cName,1200,900);
1937 SetCanvas(cRatioTrackTypesB,0);
1938 cRatioTrackTypesB->cd();
1940 TLegend* legcTTCINT1B;
1942 hAllTracksPerB->Draw("E");
1943 hTrackerPerB->Draw("Esame");
1944 hMatchedPerB->Draw("Esame");
1945 hTriggerPerB->Draw("Esame");
1947 legcTTCINT1B = new TLegend(0.70,0.5,0.90,0.70);
1948 legcTTCINT1B->AddEntry(hAllTracksPerB,"All tracks","l");
1949 legcTTCINT1B->AddEntry(hTrackerPerB,"Tracking (only) tracks","l");
1950 legcTTCINT1B->AddEntry(hMatchedPerB,"Matched tracks","l");
1951 legcTTCINT1B->AddEntry(hTriggerPerB,"Trigger (only) tracks","l");
1952 legcTTCINT1B->Draw("same");
1954 return cRatioTrackTypesB;
1959 TCanvas *ProcessCanvasTrackMultB(TObjArray *triggersB, TH1 **hB, TH1 **hTrackerB, TH1 **hTriggerB, TH1 **hMatchedB, TH1 **hAllTracksB, Int_t indTrigger, TString canvasName,TString legendHeader){
1961 if(!triggersB || !hB || !hTrackerB || !hTriggerB || !hMatchedB || !hAllTracksB || indTrigger<0 ) return 0x0;
1963 TString cName = "c";
1964 cName += canvasName;
1965 TString hNameBase =( (TObjString*) triggersB->At(indTrigger) )->GetString();
1967 TCanvas *cTrackMultB = new TCanvas(canvasName,cName,1200,900);
1968 SetCanvas(cTrackMultB,0);
1970 cTrackMultB->Divide(1,2);
1974 TH1* hSumTriggerOverB, *hSumTrackerOverB;
1978 hName = Form("hSumTriggerOver%s",hNameBase.Data());
1979 hSumTriggerOverB = static_cast<TH1*>(hTriggerB[indTrigger]->Clone(hName));
1980 hSumTriggerOverB->Add(hMatchedB[indTrigger]);
1981 hSumTriggerOverB->Divide(hB[indTrigger]);
1983 hName = Form("Sum of trigger tracks (matched+trigger-only) / # events in %s %s",hNameBase.Data(),legendHeader.Data());
1984 hSumTriggerOverB->SetTitle(hName);
1985 hSumTriggerOverB->SetLabelSize(0.04);
1986 hSumTriggerOverB->SetLineWidth(2);
1987 hSumTriggerOverB->SetLineColor(kBlue);
1988 hName = Form("hSumTrackerOver%s",hNameBase.Data());
1989 hSumTrackerOverB = static_cast<TH1*>(hTrackerB[indTrigger]->Clone(hName));
1990 hSumTrackerOverB->Add(hMatchedB[indTrigger]);
1991 hSumTrackerOverB->Divide(hB[indTrigger]);
1992 hName = Form("Sum of tracker tracks (matched+tracker-only) / # events in %s %s",hNameBase.Data(),legendHeader.Data());
1993 hSumTrackerOverB->SetTitle(hName);
1994 //hSumTrackerOverCINT1B->LabelsOption("u");
1995 hSumTrackerOverB->SetLabelSize(0.04);
1996 hSumTrackerOverB->SetLineWidth(2);
1997 hSumTrackerOverB->SetLineColor(kBlue);
2001 hSumTriggerOverB->Draw("e");
2003 hSumTrackerOverB->Draw("e");
2009 TCanvas *ProcessCanvasRatioTrackB(TObjArray *triggersB, TH1 **hB, TH1 **hTrackerB, TH1 **hTriggerB, TH1 **hMatchedB, TH1 **hAllTracksB, Int_t indTrigger, TString canvasName,TString legendHeader){
2011 if(!triggersB || !hB || !hTrackerB || !hTriggerB || !hMatchedB || !hAllTracksB || indTrigger<0 ) return 0x0;
2013 TString cName = "c";
2014 cName += canvasName;
2015 TString hNameBase =( (TObjString*) triggersB->At(indTrigger) )->GetString();
2017 TCanvas *cRatioTrackB = new TCanvas(canvasName,cName,1200,900);
2018 SetCanvas(cRatioTrackB,0);
2020 TH1* hTrackerOverTriggerB, *hMatchedOverTriggerB, *hMatchedOverTrackerB;
2022 TString hName = Form("hTrackerOverTrigger%s",hNameBase.Data());
2023 hTrackerOverTriggerB = static_cast<TH1*>(hTrackerB[indTrigger]->Clone(hName));
2024 hTrackerOverTriggerB->Divide(hTriggerB[indTrigger]);
2025 hName = Form("# tracker tracks / # trigger tracks in %s %s",hNameBase.Data(),legendHeader.Data());
2026 hTrackerOverTriggerB->SetTitle(hName);
2027 //hTrackerOverTriggerCINT1B->LabelsOption("u");
2028 hTrackerOverTriggerB->SetLabelSize(0.02);
2029 hTrackerOverTriggerB->SetLineWidth(2);
2030 hTrackerOverTriggerB->SetLineColor(kBlue);
2032 hName = Form("hMatchedOverTrigger%s",hNameBase.Data());
2033 hMatchedOverTriggerB = static_cast<TH1*>(hMatchedB[indTrigger]->Clone(hName));
2034 hMatchedOverTriggerB->Divide(hTriggerB[indTrigger]);
2036 hName = Form("# matched tracks / # trigger tracks in %s %s",hNameBase.Data(),legendHeader.Data());
2037 hMatchedOverTriggerB->SetTitle(hName);
2038 //hMatchedOverTriggerCINT1B->LabelsOption("u");
2039 hMatchedOverTriggerB->SetLabelSize(0.02);
2040 hMatchedOverTriggerB->SetLineWidth(2);
2041 hMatchedOverTriggerB->SetLineColor(kBlue);
2043 hName = Form("hMatchedOverTracker%s",hNameBase.Data());
2044 hMatchedOverTrackerB = static_cast<TH1*>(hMatchedB[indTrigger]->Clone(hName));
2045 hMatchedOverTrackerB->Divide(hTrackerB[indTrigger]);
2046 hName = Form("# matched tracks / # tracker tracks in %s %s",hNameBase.Data(),legendHeader.Data());
2047 hMatchedOverTrackerB->SetTitle(hName);
2048 //hMatchedOverTrackerCINT1B->LabelsOption("u");
2049 hMatchedOverTrackerB->SetLabelSize(0.02);
2050 hMatchedOverTrackerB->SetLineWidth(2);
2051 hMatchedOverTrackerB->SetLineColor(kBlue);
2054 cRatioTrackB->Divide(1,3);
2055 cRatioTrackB->cd(1);
2056 hTrackerOverTriggerB->Draw("e");
2057 cRatioTrackB->cd(2);
2058 hMatchedOverTriggerB->Draw("e");
2059 cRatioTrackB->cd(3);
2060 hMatchedOverTrackerB->Draw("e");
2062 return cRatioTrackB;
2066 TCanvas *ProcessCanvasAsymMatched(TObjArray *triggersB, TH1 **hPosMatchedB, TH1 **hNegMatchedB, TH1 **hAllMatchedB, Int_t indTrigger, TString canvasName,TString legendHeader){
2068 if(!triggersB || !hPosMatchedB || !hNegMatchedB || !hAllMatchedB || indTrigger<0 ) return 0x0;
2070 TString hName, hNameBase = (( (TObjString*) triggersB->At(indTrigger) )->GetString());
2072 TString cName = "c";
2073 cName += canvasName;
2075 TCanvas *cAsymMatched = new TCanvas(canvasName.Data(),cName,1200,900);
2076 SetCanvas(cAsymMatched,0);
2080 TH1 *hDiffMatchedCMUS1B= static_cast<TH1*>(hPosMatchedB[indTrigger]->Clone("hDiffMatchedCMUS1B"));
2081 hDiffMatchedCMUS1B->Add(hNegMatchedB[indTrigger],-1);
2082 if ( hDiffMatchedCMUS1B->GetSumw2N() == 0 ) hDiffMatchedCMUS1B->Sumw2();
2084 TH1 *hAsymMatchedCMUS1B= static_cast<TH1*>(hDiffMatchedCMUS1B->Clone("hAsymMatchedCMUS1B"));
2085 hAsymMatchedCMUS1B->Divide(hAllMatchedB[indTrigger]);
2086 hAsymMatchedCMUS1B->SetLineColor(kRed);
2087 hAsymMatchedCMUS1B->SetLineWidth(2);
2088 hAsymMatchedCMUS1B->SetMinimum(-0.3);
2089 hAsymMatchedCMUS1B->SetMaximum(0.3);
2090 hAsymMatchedCMUS1B->SetLabelSize(0.02);
2091 hName = Form("Matched tracks charge asymmetry for %s with acc. cuts %s",hNameBase.Data(),legendHeader.Data());
2092 hAsymMatchedCMUS1B->SetTitle(hName);
2094 hAsymMatchedCMUS1B->GetYaxis()->SetTitle("Charged tracks asymmetry");
2095 hAsymMatchedCMUS1B->Draw("EH");
2097 return cAsymMatched;
2101 TCanvas *ProcessCanvasHighPtMuons(TObjArray *triggersB, TH1 **hB, TH1 **hMatchedLowPtB, TH1 **hMatchedHighPtB, Int_t indTrigger, TString canvasName, TString legendHeader){
2103 if(!triggersB || !hB || !hMatchedLowPtB || !hMatchedHighPtB || indTrigger<0 ) return 0x0;
2105 TString hName, hNameBase = (( (TObjString*) triggersB->At(indTrigger) )->GetString());
2107 TString cName = "c";
2108 cName += canvasName;
2110 TCanvas *cHighPtMuons = new TCanvas(canvasName.Data(),cName,1200,900);
2111 SetCanvas(cHighPtMuons,0);
2116 TH1* hMatchedLowPtPerB, *hMatchedHighPtPerB;
2117 hName = Form("hMatchedLowPtPer%s ",hNameBase.Data());
2118 hMatchedLowPtPerB = static_cast<TH1*> (hMatchedLowPtB[indTrigger]->Clone(hName));
2119 if ( hMatchedLowPtPerB->GetSumw2N() == 0 ) hMatchedLowPtPerB->Sumw2();
2120 hMatchedLowPtPerB->Divide(hB[indTrigger]);
2121 hMatchedLowPtPerB->SetLineWidth(2);
2122 hMatchedLowPtPerB->SetLineColor(kBlue);
2123 hMatchedLowPtPerB->SetTitle("");
2124 hName = Form("Ratio per %s ",hNameBase.Data());
2125 hMatchedLowPtPerB->GetYaxis()->SetTitle(hName);
2126 //hMatchedLowPtPerB->SetMaximum(0.15);
2127 hMatchedLowPtPerB->SetMinimum(0.0001);
2128 hMatchedLowPtPerB->SetLabelSize(0.02);
2130 hName = Form("hMatchedHighPtPer%s ",hNameBase.Data());
2131 hMatchedHighPtPerB = static_cast<TH1*> (hMatchedHighPtB[indTrigger]->Clone(hName));
2132 if ( hMatchedHighPtPerB->GetSumw2N() == 0 ) hMatchedHighPtPerB->Sumw2();
2133 hMatchedHighPtPerB->Divide(hB[indTrigger]);
2134 hMatchedHighPtPerB->SetLineWidth(2);
2135 hMatchedHighPtPerB->SetLineColor(kRed);
2137 hName = Form("Number of matched track per %s (include Vtx and R_{Abs} cuts) %s",hNameBase.Data(),legendHeader.Data());
2138 hMatchedLowPtPerB->SetTitle(hName);
2139 hMatchedLowPtPerB->Draw("E");
2140 hMatchedHighPtPerB->Draw("Esame");
2142 legcHPM = new TLegend(0.60,0.45,0.98,0.65);
2143 //legcHPM->SetHeader(hName);
2144 legcHPM->AddEntry(".","Physics selection applied :","");
2145 legcHPM->AddEntry(hMatchedLowPtPerB," p_{T} > 1 GeV/c ","l");
2146 legcHPM->AddEntry(hMatchedHighPtPerB," p_{T} > 2 GeV/c ","l");
2147 legcHPM->Draw("same");
2149 return cHighPtMuons;
2152 TCanvas *ProcessCanvasBeamGasMatched(TObjArray *triggersB, TH1 **hBeamGasMatchedB, TH1 **hBeamGasMatchedHighPtB, TH1 **hAllMatchedB, TH1 **hMatchedHighPtB, Int_t indTrigger, TString canvasName,TString legendHeader){
2154 if(!triggersB || !hBeamGasMatchedB || !hBeamGasMatchedHighPtB || !hAllMatchedB || indTrigger<0 || !hMatchedHighPtB )
2157 TString hName, hNameBase = (( (TObjString*) triggersB->At(indTrigger) )->GetString());
2159 TString cName = "c";
2160 cName += canvasName;
2162 TCanvas *cBeamGasMatched = new TCanvas(canvasName.Data(),cName,1200,900);
2163 SetCanvas(cBeamGasMatched,0);
2164 cBeamGasMatched->cd();
2166 hName = Form("hBeamGasMatchedPer%s ",hNameBase.Data());
2167 TH1 *hBeamGasMatchedCMUS1B= static_cast<TH1*>(hBeamGasMatchedB[indTrigger]->Clone(hName));
2168 hBeamGasMatchedCMUS1B->Divide(hAllMatchedB[indTrigger]);
2169 hBeamGasMatchedCMUS1B->SetLineColor(kBlack);
2170 hBeamGasMatchedCMUS1B->SetLineWidth(2);
2171 hBeamGasMatchedCMUS1B->SetMinimum(0.0);
2172 hBeamGasMatchedCMUS1B->SetMaximum(1.1);
2173 hBeamGasMatchedCMUS1B->SetLabelSize(0.02);
2175 hName = Form("hBeamGasMatchedHightPtPer%s ",hNameBase.Data());
2176 TH1 *hBeamGasMatchedHighPtCMUS1B= static_cast<TH1*>(hBeamGasMatchedHighPtB[indTrigger]->Clone(hName));
2177 hBeamGasMatchedHighPtCMUS1B->Divide(hMatchedHighPtB[indTrigger]);
2178 hBeamGasMatchedHighPtCMUS1B->SetLineColor(kRed);
2179 hBeamGasMatchedHighPtCMUS1B->SetLineWidth(2);
2181 hName = Form("Identified beam-gas tracks (pxDCA cuts) in matched tracks for %s",hNameBase.Data());
2182 if(!legendHeader.IsNull()) hName += Form(" %s",legendHeader.Data());
2184 hBeamGasMatchedCMUS1B->SetTitle(hName);
2186 hBeamGasMatchedCMUS1B->GetYaxis()->SetTitle("Relative beam-gas tracks");
2187 hBeamGasMatchedCMUS1B->Draw("EH");
2188 hBeamGasMatchedHighPtCMUS1B->Draw("EHsame");
2190 TLegend *leg = new TLegend(0.60,0.45,0.98,0.65);
2191 leg->AddEntry(".","Physics selection applied :","");
2192 leg->AddEntry(hBeamGasMatchedCMUS1B," All p_{T}","l");
2193 leg->AddEntry(hBeamGasMatchedHighPtCMUS1B," p_{T} > 2 GeV/c ","l");
2196 return cBeamGasMatched;
2200 TH1* ProcessHisto( AliCounterCollection* counter, TString hVariable, TString hSelection, TString hName, TString xName, TString yName, Int_t color){
2204 if( !counter ) return h1;
2206 //cout<<"ProcessHisto selection "<<hSelection<<endl;
2208 if ( !hSelection.Contains("trigger: /") && !hSelection.Contains("trigger:/") ) h1 = (TH1*) counter->Draw(hVariable,hSelection);
2209 //cout<<"ProcessHisto selection2 "<<h1<<endl;
2210 if ( !h1 ) h1 = new TH1D(hName,"",10,0,10);
2212 if ( h1->GetSumw2N() == 0 ) h1->Sumw2();
2213 h1->LabelsOption("a");
2214 if(hName.Sizeof()>1) h1->SetName(hName);
2215 if(xName.Sizeof()>1) h1->GetXaxis()->SetTitle(xName);
2216 if(yName.Sizeof()>1) h1->GetYaxis()->SetTitle(yName);
2217 if(color>0) h1->SetLineColor(color);
2224 TH2* ProcessHisto2D( AliCounterCollection* counter, TString hVariable, TString hVariable2, TString hSelection, TString hName){
2228 if( !counter ) return h1;
2229 Bool_t setName = kTRUE;
2231 if(hName.Sizeof()==1) setName = kFALSE;
2233 h1 = (TH2*) counter->Draw(hVariable,hVariable2,hSelection);
2234 if ( !h1 ) h1 = new TH2D(hName,"",10,0,10,10,0,10);
2236 if ( h1->GetSumw2N() == 0 ) h1->Sumw2();
2237 h1->LabelsOption("a");
2238 if(setName) h1->SetName(hName);
2244 Bool_t GetTriggerLists(const char* triggerList, TString listFromContainer, TObjArray *triggersB, TObjArray *triggersAC, TObjArray *triggersE, TObjArray *triggersShortName){
2246 //Get the trigger list from a file
2247 //The file should consist of a line for each trigger with the following layout:
2248 // MB triggernameB triggerNameAC triggerNameE
2249 // or MUONUNLIKE triggernameB triggerNameA,triggerNameC triggerNameE
2250 // or NOSHOW triggernameB triggerNameACE notrigger
2251 //if filename is 0, then default trigger names (pp 2011) are used
2253 if( !triggersB || !triggersAC || !triggersE || !triggersShortName) return kFALSE;
2254 Int_t const nColumn = 4;
2255 TObjArray* triggers[nColumn] = {triggersShortName, triggersB, triggersAC, triggersE};
2257 TString trigSuffix[nColumn] = {"","B", "AC", "E"};
2258 TString currTrigName = "";
2259 TObjArray* fullTriggerList[nColumn];
2261 for ( Int_t ibeam=0; ibeam<nColumn; ++ibeam ) {
2262 fullTriggerList[ibeam] = new TObjArray;
2263 fullTriggerList[ibeam]->SetOwner();
2266 // Build trigger list (from file or default)
2267 if ( triggerList ) {
2268 // only the ones in the triggerList
2269 ifstream inFile(triggerList);
2270 if (!inFile.is_open()) {
2271 Error("PlotMuonQA","unable to open file %s", triggerList);
2275 while ( !inFile.eof() ) {
2276 Bool_t isGoodB = kTRUE;
2277 for ( Int_t ibeam=0; ibeam<nColumn; ++ibeam ) {
2278 currTrigName.ReadToken( inFile );
2279 if ( ! isGoodB ) continue;
2280 if ( currTrigName.IsNull() || ! currTrigName.IsAscii() ) {
2281 if ( ibeam==0 || ibeam == 1 ) {
2285 currTrigName = "notrigger";
2287 fullTriggerList[ibeam]->AddLast(new TObjString(currTrigName));
2293 TString baseTrigName[4] = {"CINT7", "CMUSH7", "CMUL7", "CMUU7"};
2294 for ( Int_t ibase=0; ibase<4; ++ibase ) {
2295 for ( Int_t ibeam=0; ibeam<nColumn; ++ibeam ) {
2296 // by default all triggers from new period in LHC11c
2297 currTrigName = baseTrigName[ibase] + trigSuffix[ibeam];
2298 fullTriggerList[ibeam]->AddLast(new TObjString(currTrigName));
2303 // Select only existing triggers in container
2305 TObjArray *triggersFromContainer = listFromContainer.Tokenize(",");
2306 TObjString* trigName = 0x0;
2308 TString selectAllTriggers[nColumn] = {"", "", "", ""};
2309 for ( Int_t itrig=0; itrig<fullTriggerList[0]->GetEntries(); ++itrig ) {
2310 Bool_t isBadTrig = kFALSE;
2311 for ( Int_t ibeam=0; ibeam<nColumn; ++ibeam ) {
2312 currTrigName = fullTriggerList[ibeam]->At(itrig)->GetName();
2313 //condition on trigger name from trigger list
2314 if ( ibeam == 0 && currTrigName.Contains("NOSHOW") ) {
2317 if ( currTrigName.Contains("notrigger") ){
2319 if ( ibeam == 0 || ibeam == 1 ){
2320 if ( ibeam == 1) if ( triggers[0]->GetLast() ) triggers[0]->RemoveAt(triggers[0]->GetLast());
2325 //select only the existing triggers in the container
2326 //note that the trigger in the trigger file can be a list of different trigger
2327 if ( ibeam > 0 && triggersFromContainer ) {
2328 TIter nextTrigger( triggersFromContainer );
2330 while ( ( trigName = static_cast<TObjString*>(nextTrigger()) ) ) {
2331 if ( currTrigName.Contains(trigName->GetString()) ){
2335 if ( isBadTrig == kTRUE ){
2337 if ( triggers[0]->GetLast() != (triggers[0]->LowerBound()-1) ) triggers[0]->RemoveAt(triggers[0]->GetLast());
2343 triggers[ibeam]->AddLast(new TObjString(currTrigName));
2344 if ( isBadTrig ) continue;
2345 if ( ! selectAllTriggers[ibeam].IsNull() ) selectAllTriggers[ibeam] += ",";
2346 selectAllTriggers[ibeam] += currTrigName;
2349 if(triggersFromContainer) delete triggersFromContainer;
2350 if(trigName) delete trigName;
2353 // Complete trigger list and print values
2354 cout<<" Nr of triggers read "<<triggers[0]->GetEntriesFast()<<endl;
2355 for ( Int_t ibeam=0; ibeam<nColumn; ++ibeam ) {
2356 triggers[ibeam]->AddLast(new TObjString(selectAllTriggers[ibeam]));
2357 printf(" %s triggers:\n", trigSuffix[ibeam].Data());
2358 triggers[ibeam]->Print();
2359 delete fullTriggerList[ibeam];
2365 TString GetRunList(const char *runList, TObjArray *runs, TObjArray *runs2){
2367 // list of runs to be analyzed
2368 TString selectRuns = "run:";
2371 // only the ones in the runList
2372 ifstream inFile(runList);
2373 if (!inFile.is_open()) {
2374 Error("PlotMuonQA","unable to open file %s", runList);
2379 while (!inFile.eof()) {
2380 currRun.ReadLine(inFile, kTRUE);
2381 if (currRun.IsNull()) continue;
2382 if (!currRun.IsDigit()) {
2383 Error("PlotMuonQA","invalid run number: %s", currRun.Data());
2386 if(runs) runs->AddLast(new TObjString(Form("%09d", currRun.Atoi())));
2387 if(runs2) runs2->AddLast(new TObjString(Form("%d", currRun.Atoi())));
2388 selectRuns += Form("%s,",currRun.Data());
2390 selectRuns.Remove(TString::kTrailing, ',');
2395 cout<<"runList is not set"<<endl;
2396 if(runs) runs->AddLast(new TObjString("*"));
2397 if(runs2) runs2->AddLast(new TObjString("*"));
2400 printf("selected runs from runlist %s: %s\n",runList, selectRuns.Data());