]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGPP/MUON/lite/PlotMuonQA.C
Add T0 and SPD pile up and SPD background flag to counters (Cynthia)
[u/mrichter/AliRoot.git] / PWGPP / MUON / lite / PlotMuonQA.C
CommitLineData
93ce3c40 1//--------------------------------------------------------------------------
2// Macro for QA monitoring.
3//
4// In case it is not run with full aliroot, it needs the following libraries to compile:
5// - libSTEERBase.so
6// - libESD.so
7// - libAOD.so
8// - libANALYSIS.so
9// - libANALYSISalice.so
10// - libCORRFW.so
40a0a69c 11// - libPWGmuon.so
93ce3c40 12//
13bb4ca7 13// TString includePath = "-I${ALICE_ROOT}/PWGmuon "; gSystem->SetIncludePath(includePath.Data());
93ce3c40 14//
15// The macro reads results of the QA task and produce monitoring plots.
16//
13bb4ca7 17// Authors: Philippe Pillot - SUBATECH Nantes, Christophe Suire, Cynthia Hadjidakis - IPN Orsay
93f182e7 18// To be done:
19// - reorganize last part (reading and extracting info from run per run histos)
13bb4ca7 20
93ce3c40 21//--------------------------------------------------------------------------
22
23#if !defined(__CINT__) || defined(__MAKECINT__)
24
25#include <Riostream.h>
26
27// ROOT includes
28#include "TEnv.h"
29#include "TMath.h"
30#include "TGrid.h"
31#include "TGridResult.h"
32#include "THashList.h"
33#include "TFile.h"
34#include "TH1.h"
35#include "TH2.h"
005408df 36#include "TF1.h"
93ce3c40 37#include "TSystem.h"
38#include "TStyle.h"
39#include "TCanvas.h"
40#include "TPad.h"
41#include "TLegend.h"
b66f9801 42#include "TObjArray.h"
43#include "TObjString.h"
93ce3c40 44
45// ALIROOT includes
46#include "AliCounterCollection.h"
47
48#endif
49
005408df 50TString GetRunList(const char *runList, TObjArray *runs, TObjArray *runs2);
13bb4ca7 51Bool_t GetTriggerLists(const char *triggerList, TString listFromContainer, TObjArray *triggersB=0, TObjArray *triggersAC=0, TObjArray *triggersE=0, TObjArray *triggersShortName=0);
005408df 52void SetCanvas(TCanvas *canvas, Int_t logy=1);
53
b69e18be 54TH1* ProcessHisto( AliCounterCollection* counter, TString variable, TString selection, TString hName="", TString xName="", TString yName="", Int_t color=1);
005408df 55TH2* ProcessHisto2D( AliCounterCollection* counter, TString hVariable, TString hVariable2, TString hSelection, TString hName);
56
57TCanvas *ProcessCanvasTriggerContent(TObjArray *array, TH1 **histo, TH1 **histo2, TString canvasName);
13bb4ca7 58TCanvas *ProcessCanvasRelativeTriggerContent(TObjArray *array, TH1 **histo, TString canvasName, TArrayI *colorInd);
59TCanvas *ProcessCanvasPhysSelCut(TObjArray *triggersB, TObjArray *triggersAC, TObjArray *triggersE, TH1 **hBNoPS, TH1 **hACNoPS,TH1 **hENoPS, TH1 **hBWithPS, TString canvasName, TArrayI *colorInd, Bool_t isHeavyIon = kFALSE);
60TCanvas *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);
61TCanvas *ProcessCanvasCentralityPercentile(TObjArray *triggersB, TH1 **hBNoPSCent, TH1 **hBWithPSCent, Int_t k, TString canvasName, TArrayI *colorInd, TString *legendHeader);
93f182e7 62TCanvas *ProcessCanvasTracksoverTrigger(TObjArray *triggersB, TH1 **hB, TH1 **hTrackerB, TH1 **hTriggerB, TH1 **hMatchedB, TH1 **hAllTracksB, Int_t indTrigger, TString canvasName,TString legendHeader="");
63TCanvas *ProcessCanvasTrackMultB(TObjArray *triggersB, TH1 **hB, TH1 **hTrackerB, TH1 **hTriggerB, TH1 **hMatchedB, TH1 **hAllTracksB, Int_t indTrigger, TString canvasName,TString legendHeader="");
64TCanvas *ProcessCanvasRatioTrackB(TObjArray *triggersB, TH1 **hB, TH1 **hTrackerB, TH1 **hTriggerB, TH1 **hMatchedB, TH1 **hAllTracksB, Int_t indTrigger, TString canvasName,TString legendHeader="");
65TCanvas *ProcessCanvasAsymMatched(TObjArray *triggersB, TH1 **hPosMatchedB, TH1 **hNegMatchedB, TH1 **hAllMatchedB, Int_t indTrigger, TString canvasName,TString legendHeader="");
66TCanvas *ProcessCanvasHighPtMuons(TObjArray *triggersB, TH1 **hB, TH1 **hMatchedLowPtB, TH1 **hAllMatchedHightPtB, Int_t indTrigger, TString canvasName,TString legendHeader="");
13bb4ca7 67TCanvas *ProcessCanvasBeamGasMatched(TObjArray *triggersB, TH1 **hBeamGasMatchedB, TH1** hBeamGasMatchedHighPtB, TH1 **hAllMatchedB, TH1** hMatchedHighPtB, Int_t indTrigger, TString canvasName,TString legendHeader="");
68
005408df 69Bool_t IsTrigger(TObjArray *array, Int_t index, TString name);
2e7189d6 70Bool_t IsTriggerSelectedForMuonPhysics(TObjArray *array, Int_t index);
93f182e7 71Bool_t IsHeavyIonCollision(AliCounterCollection *eventCounters);
93ce3c40 72
8a0df16c 73const Int_t kNMaxTriggers = 25;
74
93ce3c40 75//--------------------------------------------------------------------------
93f182e7 76void 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") {
005408df 77
93ce3c40 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.
93f182e7 81 /// If triggerList !=0x0: only the given triggers are displayed. Otherwise use the default list of triggers (see GetTriggerLists)
82
93ce3c40 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");
40a0a69c 94 gSystem->Load("libPWGHFbase");
95 gSystem->Load("libPWGmuon");
93ce3c40 96#endif
97
98 // Cosmetics and configuration
99 gStyle->SetFillColor(10);
100 gStyle->SetPadGridX(kTRUE);
101 gStyle->SetPadGridY(kTRUE);
102 gStyle->SetPadRightMargin(0.01);
103
93ce3c40 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";
109
b66f9801 110 Int_t PRINTSTAT = 1;
005408df 111 Int_t kCMUS = 2;
93ce3c40 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);
118 }
119
120 TH1::AddDirectory(kFALSE);
121
122 TString alienBaseDir = baseDir;
123
93ce3c40 124 if (alienBaseDir.Contains("alien:") && !TGrid::Connect("alien://")) {
125 Error("MergeQA","cannot connect to grid");
126 return;
127 }
128
93f182e7 129 cout<<"//---------------------------------- //"<<endl;
130 cout<<"// Run selection //"<<endl;
131 cout<<"//---------------------------------- //"<<endl;
93ce3c40 132
005408df 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);
93f182e7 138
93ce3c40 139 // physics selection
140 TString select = selectPhysics ? "selected:yes" : "";
93f182e7 141
b66f9801 142 cout<<"//---------------------------------- //"<<endl;
005408df 143 cout<<"// Get global counter //"<<endl;
b66f9801 144 cout<<"//---------------------------------- //"<<endl;
145
146 TFile *globalFile = TFile::Open(Form("%s/%s", baseDir,QAFileName));
93ce3c40 147 if (!globalFile || ! globalFile->IsOpen()) {
b66f9801 148 Error("PlotQA", "failed to open file: %s/%s", baseDir, QAFileName);
93ce3c40 149 return;
150 }
151 globalFile->Cd("MUON_QA");
152
b66f9801 153 TString selection;
154
93ce3c40 155 // get counters
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");
005408df 159
005408df 160 cout<<"//---------------------------------- //"<<endl;
161 cout<<"// Trigger selection //"<<endl;
162 cout<<"//---------------------------------- //"<<endl;
163
13bb4ca7 164 TObjArray *triggersB, *triggersAC, *triggersE, *triggersShortName;
005408df 165 triggersB = new TObjArray();
166 triggersB->SetOwner();
167 triggersAC = new TObjArray();
168 triggersAC->SetOwner();
169 triggersE = new TObjArray();
170 triggersE->SetOwner();
13bb4ca7 171 triggersShortName = new TObjArray();
172 triggersShortName->SetOwner();
173
005408df 174 TString listFromContainer = eventCounters->GetKeyWords("trigger");
13bb4ca7 175 Bool_t success = GetTriggerLists(triggerList, listFromContainer, triggersB, triggersAC, triggersE, triggersShortName);
005408df 176 if(!success) return;
13bb4ca7 177
178
93f182e7 179
180 cout<<"//---------------------------------- //"<<endl;
181 cout<<"// Set collision type ? //"<<endl;
182 cout<<"//---------------------------------- //"<<endl;
005408df 183
93f182e7 184 Bool_t isHeavyIon = kTRUE;
185 isHeavyIon = IsHeavyIonCollision(eventCounters);
186
005408df 187 cout<<"//---------------------------------- //"<<endl;
188 cout<<"// Trigger plots //"<<endl;
189 cout<<"//---------------------------------- //"<<endl;
190
93f182e7 191 //plot all trigger from event counters without any selection
005408df 192 TString CanvasName = "cAll";
193 TCanvas *cAll = new TCanvas(CanvasName.Data(),CanvasName.Data());
93f182e7 194 cAll->SetLeftMargin(0.18);
13bb4ca7 195 cAll->SetRightMargin(0.18);
196 cAll->SetLogz(1);
005408df 197 cAll->cd();
198 //TH2* hAll = (TH2*) ProcessHisto2D(eventCounters, "trigger", "run", Form("run:any/%s",select.Data()) , "");
199 TH2* hAll = (TH2*) ProcessHisto2D(eventCounters, "trigger", "run", "run:any" , "");
93f182e7 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();
13bb4ca7 204 //cout<<currLabel<<endl;
205 //labelArray->Print();
93f182e7 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());
209 delete labelArray;
210 }
2e7189d6 211 hAll->Draw("COLZ");
005408df 212
93ce3c40 213 //declare a default canvas c1
005408df 214 CanvasName = "c1";
b66f9801 215 TCanvas *c1 = new TCanvas(CanvasName.Data(),CanvasName.Data());
93ce3c40 216 c1->cd();
93f182e7 217
218 //loop on centrality
219 Int_t centBin = 3;
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;
8a0df16c 227
228 Int_t *colorTab = new Int_t[triggersB->GetEntriesFast()];
bab36da2 229 Int_t const colorNrFirst = 8;
230 Int_t colorIndex = 0;
231 Int_t colorTabFirst[colorNrFirst] = {kGray,kRed,kBlue,kGreen,kOrange,kCyan,kMagenta,kYellow};
8a0df16c 232 for (Int_t i = 0; i< triggersB->GetEntriesFast(); i++ ) {
bab36da2 233 colorTab[i] = colorTabFirst[i] + colorIndex;
234 if ( i%colorNrFirst == 0 ) colorIndex++;
8a0df16c 235 }
236 TArrayI *colorInd = new TArrayI( triggersB->GetEntriesFast() );
237 for(Int_t i=0; i< triggersB->GetEntriesFast(); i++) colorInd->AddAt(colorTab[i],i);
238
239 TH1* hBNoPS[centBinMax][kNMaxTriggers];
240 TH1* hBWithPS[centBinMax][kNMaxTriggers];
4ccc39b4 241 TH1* hBWithPST0Flag[centBinMax][kNMaxTriggers];
242 TH1* hBWithPST0SPDFlag[centBinMax][kNMaxTriggers];
8a0df16c 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]={};
4916d740 252
8a0df16c 253 if(triggersB->GetEntriesFast()>=kNMaxTriggers){
b69e18be 254 cout<<"Too many triggers = "<<triggersB->GetEntriesFast()<<endl;
b66f9801 255 return;
256 }
13bb4ca7 257
93f182e7 258 //loop on centrality
259 for(centBin = 0; centBin < centBinMaxLoop; centBin++){
260 selectionCent = centBinName[centBin];
261
262 //Loop on trigger (last is all triggers, then for each defined trigger)
263 for(Int_t i = 0; i < triggersB->GetEntriesFast(); i++){
b66f9801 264
93f182e7 265 TString histoNameBase = "h_trig", histoName;
266 histoNameBase+= i+1;
b69e18be 267
93f182e7 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());
b69e18be 272 // cout<<selection<<endl;
93f182e7 273 histoName = histoNameBase;
274 histoName += "BNoPS";
13bb4ca7 275 hBNoPS[centBin][i] = (TH1*) ProcessHisto(eventCounters, "run", selection, histoName, "", "Trigger content w/o Phys. Sel.", colorInd->At(i));
93f182e7 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";
13bb4ca7 280 hBWithPS[centBin][i] = (TH1*) ProcessHisto(eventCounters, "run", selection, histoName, "", "Trigger content w/ Phys. Sel.", colorInd->At(i));
4ccc39b4 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));
93f182e7 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;
294 histoName += "B";
b69e18be 295 hB[centBin][i] = (TH1*) ProcessHisto(eventCounters, "run", selection, histoName);
005408df 296
93f182e7 297 TString triggerNameAC = ( (TObjString*) triggersAC->At(i) )->GetString();
93f182e7 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());
b69e18be 302 hACNoPS[centBin][i] = (TH1*) ProcessHisto(eventCounters, "run", selection, histoName);
93f182e7 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";
b69e18be 307 hACWithPS[centBin][i] = (TH1*) ProcessHisto(eventCounters, "run", selection, histoName);
005408df 308
93f182e7 309 TString triggerNameE = ( (TObjString*) triggersE->At(i) )->GetString();
2e7189d6 310 // Histo trigger without Phys. Sel. E
93f182e7 311 selection = selectionCent; selection += Form("trigger:%s/%s", triggerNameE.Data(), selectRuns.Data());
312 histoName = histoNameBase;
313 histoName += "ENoPS";
b69e18be 314 hENoPS[centBin][i] = (TH1*) ProcessHisto(eventCounters, "run", selection, histoName);
93f182e7 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";
b69e18be 319 hEWithPS[centBin][i] = (TH1*) ProcessHisto(eventCounters, "run", selection, histoName);
93f182e7 320
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, "");
005408df 324
93f182e7 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, "");
005408df 327
93f182e7 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, "");
005408df 330
93f182e7 331 selection = selectionCent; selection += Form("trigger:%s/%s/%s", triggerName.Data(), selectRuns.Data(), select.Data());
332 hAllTracksB[centBin][i] = (TH1*) ProcessHisto(trackCounters, "run", selection, "");
005408df 333
93f182e7 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, "");
005408df 336
93f182e7 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, "");
005408df 339
93f182e7 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, "");
005408df 342
93f182e7 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, "");
005408df 345
93f182e7 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, "");
005408df 348
93f182e7 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, "");
005408df 351
93f182e7 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, "");
13bb4ca7 354
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, "");
357
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, "");
360
93f182e7 361 }
b66f9801 362 }
363
005408df 364 //if there is not B triggers just stop now
365 Int_t count_trigger=0;
93f182e7 366 centBin = 0;
005408df 367 for(Int_t i = 0; i < triggersB->GetEntriesFast(); i++){
93f182e7 368 count_trigger += hBNoPS[centBin][i]->GetEntries();
005408df 369 }
370 if(count_trigger<=0) return;
371
372
8a0df16c 373 Int_t NumOfBNoPS[centBinMax][kNMaxTriggers];
374 Int_t NumOfBWithPS[centBinMax][kNMaxTriggers];
4ccc39b4 375 Int_t NumOfBWithPST0Flag[centBinMax][kNMaxTriggers];
376 Int_t NumOfBWithPST0SPDFlag[centBinMax][kNMaxTriggers];
8a0df16c 377 Int_t NumOfACNoPS[centBinMax][kNMaxTriggers];
378 Int_t NumOfENoPS[centBinMax][kNMaxTriggers];
379 Int_t NumOfACWithPS[centBinMax][kNMaxTriggers];
380 Int_t NumOfEWithPS[centBinMax][kNMaxTriggers];
93f182e7 381
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();
4ccc39b4 386 NumOfBWithPST0Flag[centBin][i] = hBWithPST0Flag[centBin][i]->Integral();
387 NumOfBWithPST0SPDFlag[centBin][i] = hBWithPST0Flag[centBin][i]->Integral();
93f182e7 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();
392 }
b66f9801 393 }
93f182e7 394 centBin = 0;
395
b66f9801 396 cout<<"//==================================================================================="<<endl;
397 cout<<"// Put all plots in a ps file, easier to publish (Twiki)"<<endl;
398 cout<<"//==================================================================================="<<endl;
399
93ce3c40 400 c1->Print(OutFileNamePDF_open.Data());
93ce3c40 401 TFile *rootFileOut = TFile::Open(OutFileNameROOT.Data(),"RECREATE");
13bb4ca7 402 rootFileOut->cd();
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;
409 dirCent->SetOwner();
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 );
418 }
419 }
420
005408df 421 cAll->Print(OutFileNamePDF.Data());
13bb4ca7 422 dirGlobal->cd();
005408df 423 cAll->Write();
13bb4ca7 424
b66f9801 425 cout<<"//==================================================================================="<<endl;
005408df 426 cout<<"// new canvas with the total number of trigger with and without Phys. Sel."<<endl;
b66f9801 427 cout<<"//==================================================================================="<<endl;
005408df 428
93f182e7 429 TCanvas *cTriggerContent = ProcessCanvasTriggerContent(triggersB, hBNoPS[centBin], hBWithPS[centBin], "TriggerContent");
005408df 430 cTriggerContent->Draw();
b66f9801 431 cTriggerContent->Print(OutFileNamePDF.Data());
13bb4ca7 432 dirGlobal->cd();
b66f9801 433 cTriggerContent->Write();
434
435 cout<<"//==================================================================================="<<endl;
005408df 436 cout<<"// new canvas with the relative content of each trigger w/o physics selection"<<endl;
b66f9801 437 cout<<"//==================================================================================="<<endl;
005408df 438
93f182e7 439 TCanvas *cRelativeTriggerContent = ProcessCanvasRelativeTriggerContent(triggersB, hBNoPS[centBin], "RelativeTriggerContent", colorInd);
005408df 440 cRelativeTriggerContent->Draw();
93ce3c40 441 cRelativeTriggerContent->Print(OutFileNamePDF.Data());
13bb4ca7 442 dirGlobal->cd();
93ce3c40 443 cRelativeTriggerContent->Write();
005408df 444
445 cout<<"//==================================================================================="<<endl;
446 cout<<"// new canvas with effect from physics selection for each trigger and background trigger "<<endl;
447 cout<<"//==================================================================================="<<endl;
448
93f182e7 449 TCanvas *cPhysSelCut = 0x0;
450 cPhysSelCut = ProcessCanvasPhysSelCut(triggersB, triggersAC, triggersE, hBNoPS[centBin], hACNoPS[centBin], hENoPS[centBin], hBWithPS[centBin], "PhysSelCutOnCollTrigger", colorInd,isHeavyIon);
005408df 451 cPhysSelCut->Draw();
452 cPhysSelCut->Print(OutFileNamePDF.Data());
13bb4ca7 453 dirGlobal->cd();
005408df 454 cPhysSelCut->Write();
13bb4ca7 455 rootFileOut->cd();
93f182e7 456
4ccc39b4 457 cout<<"//==================================================================================="<<endl;
458 cout<<"// new canvas with effect from T0 pile-up flag for each trigger and background trigger "<<endl;
459 cout<<"//==================================================================================="<<endl;
460
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());
465 dirGlobal->cd();
466 cPhysSelCutT0Flag->Write();
467 rootFileOut->cd();
468
469
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;
473
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());
478 dirGlobal->cd();
479 cPhysSelCutT0SPDFlag->Write();
480 rootFileOut->cd();
481
482
483
93f182e7 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;
487
488 Int_t k=0;
489 TString canvasName;
490 TString triggerName;
491 TString legendHeader="";
492
493
494 if ( isHeavyIon ){
13bb4ca7 495 TCanvas *cPhysSelCutCentrality;
93f182e7 496
497 //loop over trigger
498 for(k = 0; k < triggersB->GetEntriesFast(); k++){
499 //skip sum of all triggers
500 if(k == (triggersB->GetEntriesFast()-1)) continue;
93f182e7 501
502 canvasName = "PhysSel_trigger";
13bb4ca7 503 canvasName += ( (TObjString*) triggersShortName->At(k) )->GetString();
504
93f182e7 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]};
509
13bb4ca7 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();
93f182e7 515 }
516 }
13bb4ca7 517 rootFileOut->cd();
93f182e7 518
519 cout<<"//==================================================================================="<<endl;
520 cout<<"// new canvas for centrality percentile check (only in PbPb) "<<endl;
521 cout<<"//==================================================================================="<<endl;
522
523 if ( isHeavyIon ){
13bb4ca7 524 TCanvas *cCentralityCheck;
93f182e7 525
526 //loop over trigger
527 for(k = 0; k < triggersB->GetEntriesFast(); k++){
528 //skip sum of all triggers
529 if(k == (triggersB->GetEntriesFast()-1)) continue;
2e7189d6 530
93f182e7 531 canvasName = "CentralityCheck_trigger";
13bb4ca7 532 canvasName +=( (TObjString*) triggersShortName->At(k) )->GetString();
93f182e7 533
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]};
536
13bb4ca7 537 cCentralityCheck = ProcessCanvasCentralityPercentile(triggersB,hBNoPSCent,hBWithPSCent,k,canvasName,colorInd,centLegendNameShort+1 );
93f182e7 538
13bb4ca7 539 cCentralityCheck->Draw();
540 cCentralityCheck->Print(OutFileNamePDF.Data());
541 ( (TDirectoryFile*) dirTrigger->At(k) )->cd();
542 cCentralityCheck->Write();
93f182e7 543
544 }
545 }
13bb4ca7 546 rootFileOut->cd();
93f182e7 547
93ce3c40 548
005408df 549 cout<<"//==================================================================================="<<endl;
550 cout<<"// Ratio of tracks over trigger type (3 canvases) "<<endl;
551 cout<<"//==================================================================================="<<endl;
552
553 //Print a canvas per trigger type
13bb4ca7 554 TCanvas *cTracksoverTrigger;
555 TCanvas* cTrackMultB;
556 TCanvas* cRatioTrackB;
93f182e7 557
558 //loop on centrality bin
559 for ( centBin = 0; centBin < centBinMaxLoop; centBin++){
13bb4ca7 560 if ( isHeavyIon ){
561 legendHeader = "for ";
562 legendHeader += centLegendName[centBin];
563 }
564 else legendHeader ="";
93f182e7 565 //loop over trigger
566 for(k = 0; k < triggersB->GetEntriesFast(); k++){
567 //skip sum of all triggers
568 if(k == (triggersB->GetEntriesFast()-1)) continue;
13bb4ca7 569
570 ( (TDirectoryFile*) dirCent->At( k*centBinMaxLoop+centBin ) )->cd();
571
93f182e7 572 canvasName = "RatioTrackTypes_cent";
573 canvasName += centBin;
574 canvasName +="trigger";
13bb4ca7 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();
93f182e7 580
581 canvasName = "TrackMult_cent";
582 canvasName += centBin;
583 canvasName +="trigger";
13bb4ca7 584 canvasName +=( (TObjString*) triggersShortName->At(k) )->GetString();
585 cTrackMultB= ProcessCanvasTrackMultB(triggersB, hB[centBin], hTrackerB[centBin], hTriggerB[centBin], hMatchedB[centBin], hAllTracksB[centBin], k, canvasName, legendHeader);
586 cTrackMultB->Draw();
587 cTrackMultB->Print(OutFileNamePDF.Data());
588 cTrackMultB->Write();
93f182e7 589
590 canvasName = "RatioTrackB_cent";
591 canvasName += centBin;
592 canvasName +="trigger";
13bb4ca7 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();
93f182e7 598 }
b66f9801 599 }
13bb4ca7 600 rootFileOut->cd();
005408df 601
602 cout<<"//===================================================="<<endl;
603 cout<<"// Draw matched tracks asymmetry for mus type trigger "<<endl;
604 cout<<"//===================================================="<<endl;
605
606 //Print a canvas per trigger type
13bb4ca7 607 TCanvas *cAsymMatched;
93f182e7 608
609 //Loop on centrality
610 for ( centBin = 0; centBin < centBinMaxLoop; centBin++){
13bb4ca7 611 if ( isHeavyIon ){
612 legendHeader = "for ";
613 legendHeader += centLegendName[centBin];
614 }
615 else legendHeader ="";
93f182e7 616 //loop over trigger
617 for(k = 0; k < triggersB->GetEntriesFast(); k++){
618 //skip sum of all triggers
619 if(k == (triggersB->GetEntriesFast()-1)) continue;
13bb4ca7 620
621 ( (TDirectoryFile*) dirCent->At( k*centBinMaxLoop+centBin ) )->cd();
2e7189d6 622
623 canvasName = "AsymMatched";
624 canvasName += centBin;
625 canvasName +="trigger";
13bb4ca7 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();
93f182e7 631 }
005408df 632 }
13bb4ca7 633 rootFileOut->cd();
8a0df16c 634 legendHeader = "";
13bb4ca7 635
636 cout<<"//===================================================================="<<endl;
637 cout<<"// Draw beam gas contribution to matched tracks for mus type trigger "<<endl;
638 cout<<"//===================================================================="<<endl;
639
640 //Print a canvas per trigger type
641 TCanvas *cBeamGasMatched;
642
643 //loop over trigger
644 for(k = 0; k < triggersB->GetEntriesFast(); k++){
645 //skip sum of all triggers
646 if(k == (triggersB->GetEntriesFast()-1)) continue;
13bb4ca7 647
648 ( (TDirectoryFile*) dirTrigger->At(k) )->cd();
649
650 canvasName = "BeamGasMatched";
651 canvasName +="trigger";
652 canvasName +=( (TObjString*) triggersShortName->At(k) )->GetString();
653 centBin = 0;
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();
658 }
659 rootFileOut->cd();
660
b66f9801 661 cout<<"//=================================================="<<endl;
662 cout<<"// Draw high pt tracks per trigger"<<endl;
005408df 663 cout<<"//=================================================="<<endl;
664
665 //Print a canvas per trigger type
13bb4ca7 666 TCanvas *cHighPtMuons;
93f182e7 667
668 //Loop on centrality
669 for ( centBin = 0; centBin < centBinMaxLoop; centBin++){
13bb4ca7 670 if ( isHeavyIon ){
671 legendHeader = "for ";
672 legendHeader += centLegendName[centBin];
673 }
674 else legendHeader ="";
93f182e7 675 //loop over trigger
676 for(k = 0; k < triggersB->GetEntriesFast(); k++){
677 //skip sum of all triggers
678 if(k == (triggersB->GetEntriesFast()-1)) continue;
13bb4ca7 679
680 ( (TDirectoryFile*) dirCent->At( k*centBinMaxLoop+centBin ) )->cd();
681
2e7189d6 682 canvasName = "HighPtMuons";
683 canvasName += centBin;
684 canvasName +="trigger";
13bb4ca7 685 canvasName +=( (TObjString*) triggersShortName->At(k) )->GetString();
93f182e7 686
13bb4ca7 687 cHighPtMuons = ProcessCanvasHighPtMuons(triggersB, hB[centBin], hMatchedLowPtB[centBin], hMatchedHighPtB[centBin], k, canvasName,legendHeader);
688 cHighPtMuons->Draw();
689 cHighPtMuons->Print(OutFileNamePDF.Data());
690 cHighPtMuons->Write();
93f182e7 691 }
b66f9801 692 }
13bb4ca7 693 rootFileOut->cd();
005408df 694
b66f9801 695 // close merged file
93ce3c40 696 globalFile->Close();
b66f9801 697
b66f9801 698 //===================================================================================
699 //Print out the number of trigger without and with Phys. Sel.
700 //===================================================================================
701
93f182e7 702 centBin = 0;
b66f9801 703 cout << endl << endl;
704 //====================================================
705 if (PRINTSTAT){
93f182e7 706 if ( triggersB->At(kCMUS) ) {
b66f9801 707
93f182e7 708 // set the format to print labels
709 THashList* labels = hBWithPS[centBin][kCMUS]->GetXaxis()->GetLabels();
710 TString format(Form("\n%%%ds %%9d",0));
711 Int_t nRuns=0;
b66f9801 712
93f182e7 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()))) {
719 nRuns++;
720 Int_t bin = (Int_t) label->GetUniqueID();
721 printf(format.Data(), label->String().Data(), (Int_t) hBWithPS[centBin][kCMUS]->GetBinContent(bin));
722 }
723 printf("\n========== Total #runs = %d ==============\n",nRuns);
724 printf("\n\n");
b66f9801 725
b66f9801 726
93f182e7 727 cout << "-------------------------------------------------" << endl;
728 cout << "Total statistic" << endl;
729 cout << " " << endl ;
730
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();
005408df 737
93f182e7 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);
742 cutinpercent = 0;
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);
745 cutinpercent = 0;
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);
005408df 748
93f182e7 749 }
750 }
b66f9801 751 }
752
4ccc39b4 753 //temporary
754 // return;
755
b66f9801 756
93ce3c40 757 //--------------------------------------------- //
758 // monitor quantities run per run //
759 //--------------------------------------------- //
13bb4ca7 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);
765 }
766
b8e17107 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()));
772 }
8eabe3bd 773 TF1* fitMatchTrig = new TF1("fitMatchTrig","[3] + [0] * ( 1. + TMath::Erf((x - [1]) / [2] / TMath::Sqrt(2.)))", 0.1, 6.);
93ce3c40 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];
4916d740 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);
783 }
13bb4ca7 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);
788 }
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);
793 }
794
93ce3c40 795 TH1F* hClusterHitMapXInCh[10];
4916d740 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);
798 }
93ce3c40 799 TH1F* hClusterHitMapYInCh[10];
4916d740 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);
802 }
13bb4ca7 803
804
93ce3c40 805 Int_t ibin = 1;
806
807 // Are the runs stored locally or in alien?
808 Int_t isAlienFile = 0;
809 if(alienBaseDir.Contains("alien:")){
810 isAlienFile = 1;
811 alienBaseDir.ReplaceAll("alien://","");
812 }
4ccc39b4 813
b66f9801 814 cout<<"============================================================"<<endl;
005408df 815 cout<< "Monitoring quantities run per run: loop over "<<runs->GetEntriesFast()<<" runs."<<endl;
b66f9801 816 cout<<" directory = "<<alienBaseDir.Data()<<endl;
817 cout<<"============================================================"<<endl;
93ce3c40 818 // Loop over runs
005408df 819 for ( Int_t irun=0; irun<runs->GetEntriesFast(); irun++ ) {
93ce3c40 820
005408df 821 TString run = ((TObjString*)runs->UncheckedAt(irun))->GetString();
822 TString run2 = ((TObjString*)runs2->UncheckedAt(irun))->GetString();
93ce3c40 823 // get the file (or list of files) to be analyzed
824 TString command;
825 TGridResult *res = 0;
826 TObjString *objs = 0;
827
293bed3d 828 //cout<<irun<<" "<<run<<endl;
829
93ce3c40 830 if(isAlienFile){
b66f9801 831 command = Form("find %s/ %s/%s", alienBaseDir.Data(), run.Data(), QAFileName);
93ce3c40 832 res = gGrid->Command(command);
833 if (!res) {
93f182e7 834 Error("PlotMuonQA","no result for the command: %s",command.Data());
93ce3c40 835 return;
836 }
837 }
838 else{
839 res = new TGridResult();
840
841 if(runList){
b66f9801 842 objs = new TObjString(Form("%s/%s/%s", alienBaseDir.Data(), run2.Data(), QAFileName));
93ce3c40 843 res->Add(objs);
844 }
845 else {
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;
93ce3c40 850 while(kTRUE){
851 iEntry++;
852 const char* dirFilename = gSystem->GetDirEntry(dir);
853 if(!dirFilename) break;
854 sDirFilename = dirFilename;
855 if(!sDirFilename.IsDigit()) continue;
856 iFile++;
b66f9801 857 objs = new TObjString(Form("%s/%s/%s", alienBaseDir.Data(), sDirFilename.Data(), QAFileName));
93ce3c40 858 res->Add(objs);
859 }
860 }
861 }
862
863 // Loop over 'find' results and get next LFN
864 TIter nextmap(res);
865 TMap *map = 0;
866
867 //some checks
293bed3d 868 Int_t iLoop=0, iLoopMax=1000;
93ce3c40 869 while (kTRUE){
870
871 // get the current file url
872 if(isAlienFile){
873 map=(TMap*)nextmap();
874 if(!map) break;
875 objs = dynamic_cast<TObjString*>(map->GetValue("turl"));
876 }
877 else{
878 objs=(TObjString*)nextmap();
879 if(!objs) break;
880 }
881 //in case of infinite loop
882 iLoop++;
883 if(iLoop>iLoopMax) break;
884
885 if (!objs || !objs->GetString().Length()) {
93f182e7 886 Error("PlotMuonQA","turl/obj not found for the run %s... SKIPPING", run.Data());
93ce3c40 887 continue;
888 }
889
b69e18be 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');
895
2e7189d6 896 if ( ! selectRuns.Contains(run.Data()) ) continue;
b69e18be 897
93ce3c40 898 // open the outfile for this run
899 TFile *runFile = TFile::Open(objs->GetString());
900 if (!runFile || ! runFile->IsOpen()) {
93f182e7 901 Error("PlotMuonQA","failed to open file: %s", objs->GetName());
93ce3c40 902 continue;//return;
903 }
904 runFile->Cd("MUON_QA");
905
906 // get interesting histos
907 TObjArray* general1 = static_cast<TObjArray*>(runFile->FindObjectAny("general1"));
4916d740 908 TObjArray* general2 = static_cast<TObjArray*>(runFile->FindObjectAny("general2"));
93ce3c40 909 TObjArray* expert = static_cast<TObjArray*>(runFile->FindObjectAny("expert"));
b66f9801 910
4916d740 911 if (!general1 || !general2 || !expert){
93f182e7 912 Error("PlotMuonQA","All objects not here !!! ===> Skipping...for %s",objs->GetName());
4916d740 913 continue;
914 }
13bb4ca7 915
4916d740 916 TH1* hNClustersPerTrack = static_cast<TH1*>(general1->FindObject("hNClustersPerTrack"));
93ce3c40 917 TH1* hNChamberHitPerTrack = static_cast<TH1*>(general1->FindObject("hNChamberHitPerTrack"));
918 TH1* hChi2 = static_cast<TH1*>(general1->FindObject("hChi2"));
4916d740 919 TH1* hNClustersPerCh = static_cast<TH1*>(general2->FindObject("hNClustersPerCh"));
13bb4ca7 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++){
926 Int_t val = 0;
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());
932 }
b8e17107 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 ) {
13bb4ca7 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 ) {
952 ptMinFit = currPt;
953 minEff = currEff;
954 }
955 if ( currPt > 0.5 && maxEff < currEff ) {
956 ptMaxFit = currPt;
957 maxEff = currEff;
958 }
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.;
971 }
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
005408df 977 }
93ce3c40 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)));
980
981 // skip empty runs... not anymore ! cs !
982 if (!hNClustersPerCh) {
93f182e7 983 Warning("PlotMUONQA","File: %s has empty histograms !", objs->GetName());
93ce3c40 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.);
1003 }
1004 //runFile->Close();
1005 //continue;
1006 }
1007 else {
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));
13bb4ca7 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));
93ce3c40 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));
4916d740 1037 hClusterHitMapYInCh[ich]->SetBinError(ibin,hClusterHitMapInCh[ich]->GetMeanError(2));
93ce3c40 1038 }
1039 }
1040
1041 // set labels
93f182e7 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());
1045 }
93ce3c40 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());
13bb4ca7 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());
93ce3c40 1058 hClusterHitMapXInCh[ich]->GetXaxis()->SetBinLabel(ibin, run.Data());
1059 hClusterHitMapYInCh[ich]->GetXaxis()->SetBinLabel(ibin, run.Data());
1060 }
005408df 1061
93ce3c40 1062 // close outfile for this run
1063 runFile->Close();
1064 ibin++;
1065 }
1066
1067 delete res;
1068 }
1069
4916d740 1070 //sort label
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");
1077
1078 for(Int_t ich=0; ich<10; ich++){
1079 hNClustersInCh[ich]->LabelsOption("a");
13bb4ca7 1080 hClusterChargeMeanInCh[ich]->LabelsOption("a");
1081 hClusterChargeSigmaInCh[ich]->LabelsOption("a");
1082 hClusterSizeMeanInCh[ich]->LabelsOption("a");
1083 hClusterSizeSigmaInCh[ich]->LabelsOption("a");
4916d740 1084 hClusterHitMapXInCh[ich]->LabelsOption("a");
1085 hClusterHitMapYInCh[ich]->LabelsOption("a");
005408df 1086 }
13bb4ca7 1087
93ce3c40 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");
1095
1096 TCanvas* cNClusters = new TCanvas("cNClusters","cNClusters",1200,900);
1097 cNClusters->Divide(1,2);
1098 cNClusters->cd(1);
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");
4916d740 1105 hNClustersPerTrackVsRun_Mean->SetLabelSize(0.04);
93ce3c40 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");
1113
1114 cNClusters->cd(2);
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");
4916d740 1121 hNClustersPerTrackVsRun_Sigma->SetLabelSize(0.04);
93ce3c40 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");
13bb4ca7 1129
93ce3c40 1130 cNClusters->Print(OutFileNamePDF.Data());
13bb4ca7 1131 dirGlobal->cd();
93ce3c40 1132 cNClusters->Write();
13bb4ca7 1133
93ce3c40 1134
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");
b66f9801 1145 hNClustersInCh[0]->SetLabelSize(0.02);
93ce3c40 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");
1155 }
1156 lNClustersPerCh->Draw("same");
1157
1158 cNClustersPerCh->Print(OutFileNamePDF.Data());
13bb4ca7 1159 dirGlobal->cd();
93ce3c40 1160 cNClustersPerCh->Write();
1161
13bb4ca7 1162 //==================================================
1163 // Display average cluster charge per chamber
1164
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);
1169
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");
293bed3d 1175 hClusterChargeMeanInCh[0]->SetLabelSize(0.04);
13bb4ca7 1176 hClusterChargeMeanInCh[0]->SetTitle("Cluster charge mean (fC) per track in chamber i");
1177 hClusterChargeMeanInCh[0]->SetMaximum(150);
bab36da2 1178 hClusterChargeMeanInCh[0]->SetMinimum(30);
13bb4ca7 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");
1185 }
1186 lClusterChargePerCh->Draw("same");
1187
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");
293bed3d 1193 hClusterChargeSigmaInCh[0]->SetLabelSize(0.04);
13bb4ca7 1194 hClusterChargeSigmaInCh[0]->SetTitle("Cluster charge sigma per track in chamber i");
bab36da2 1195 hClusterChargeSigmaInCh[0]->SetMaximum(250);
13bb4ca7 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");
1202 }
1203 lClusterChargePerCh->Draw("same");
1204
1205 cClusterChargePerCh->Print(OutFileNamePDF.Data());
1206 dirGlobal->cd();
1207 cClusterChargePerCh->Write();
1208
1209 //==================================================
1210 // Display average cluster size per chamber
1211
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);
1216
1217 cClusterSizePerCh->cd(1);
1218 hClusterSizeMeanInCh[0]->SetStats(kFALSE);
1219 hClusterSizeMeanInCh[0]->GetXaxis()->SetRange(1,ibin-1);
1220 hClusterSizeMeanInCh[0]->GetXaxis()->SetNdivisions(1,kFALSE);
1221
293bed3d 1222 hClusterSizeMeanInCh[0]->SetLabelSize(0.04);
13bb4ca7 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");
1232 }
1233 lClusterSizePerCh->Draw("same");
1234
1235 cClusterSizePerCh->cd(2);
1236 hClusterSizeSigmaInCh[0]->SetStats(kFALSE);
1237 hClusterSizeSigmaInCh[0]->GetXaxis()->SetRange(1,ibin-1);
1238 hClusterSizeSigmaInCh[0]->GetXaxis()->SetNdivisions(1,kFALSE);
1239
293bed3d 1240 hClusterSizeSigmaInCh[0]->SetLabelSize(0.04);
13bb4ca7 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");
1249 }
1250 lClusterSizePerCh->Draw("same");
1251
1252 cClusterSizePerCh->Print(OutFileNamePDF.Data());
1253 dirGlobal->cd();
1254 cClusterSizePerCh->Write();
1255
1256
93ce3c40 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);
1264
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");
4916d740 1270 hClusterHitMapXInCh[0]->SetLabelSize(0.04);
93ce3c40 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");
1279
1280 lClusterHitMapPerCh->AddEntry(hClusterHitMapXInCh[ich],Form("ch%d",ich+1),"PL");
1281 }
1282 lClusterHitMapPerCh->Draw("same");
1283
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");
4916d740 1289 hClusterHitMapYInCh[0]->SetLabelSize(0.04);
93ce3c40 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");
1298 }
1299 lClusterHitMapPerCh->Draw("same");
1300
1301 cClusterHitMapPerCh->Print(OutFileNamePDF.Data());
13bb4ca7 1302 dirGlobal->cd();
93ce3c40 1303 cClusterHitMapPerCh->Write();
1304
1305
1306 //==================================================
1307 // Display tracks ChiSquare
1308 TCanvas* cChi2 = new TCanvas("cChi2","cChi2",1200,900);
1309 cChi2->Divide(1,2);
1310 cChi2->cd(1);
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");
4916d740 1315 hChi2_Mean->SetLabelSize(0.04);
93ce3c40 1316 hChi2_Mean->SetLineWidth(2);
1317 hChi2_Mean->Draw("e");
1318
1319 cChi2->cd(2);
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");
4916d740 1324 hChi2_Sigma->SetLabelSize(0.04);
93ce3c40 1325 hChi2_Sigma->SetLineWidth(2);
1326 hChi2_Sigma->Draw("e");
1327
1328 cChi2->Print(OutFileNamePDF.Data());
13bb4ca7 1329 dirGlobal->cd();
93ce3c40 1330 cChi2->Write();
005408df 1331
b8e17107 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);
1349 }
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");
1360 }
1361 }
1362 cLptHpt->Print(OutFileNamePDF.Data());
13bb4ca7 1363 dirGlobal->cd();
b8e17107 1364 cLptHpt->Write();
13bb4ca7 1365 }
1366
1367
1368 //==================================================
1369 // Display muon trigger
1370 //==================================================
1371
1372 TCanvas* cMuonTriggerUnlikeLike = new TCanvas("cMuonTriggerUnlikeLike","cMuonTriggerUnlikeLike",1200,900);
1373 TCanvas* cMuonTriggerHpt = new TCanvas("cMuonTriggerHpt","cMuonTriggerHpt",1200,900);
1374 cMuonTriggerHpt->Divide(1,2);
1375
1376 Int_t const ntrig = 3;
1377 Int_t const nhist = 3;
1378 TH1F *hRelMuonTrigger[ntrig], *hTot;
1379
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"}};
1383 TString sname;
1384
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");
293bed3d 1394 hRelMuonTrigger[j]->SetLabelSize(0.02);
13bb4ca7 1395 //hRelMuonTrigger[j]->GetXaxis()->SetLabelSize(0.04);
1396 hRelMuonTrigger[j]->SetLineWidth(2);
1397 hRelMuonTrigger[j]->SetTitle("");
1398
1399 }
1400 sname = "hTot";
1401 sname += (i+1);
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);
1407
1408 for(Int_t j=0; j < nhist; j++) hRelMuonTrigger[j]->Divide(hTot);
1409
1410 if(i==0) cMuonTriggerUnlikeLike->cd();
1411 else cMuonTriggerHpt->cd(i);
1412
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);
1416
1417 for(Int_t j=0; j<nhist; j++){
1418 if(j==0){
1419 hRelMuonTrigger[j]->SetMaximum(1);
1420 hRelMuonTrigger[j]->SetMinimum(0);
1421 hRelMuonTrigger[j]->Draw("e");
1422 }
1423 else hRelMuonTrigger[j]->Draw("esame");
1424 sname = sconf[i][j];
1425 leg->AddEntry(hRelMuonTrigger[j],sname,"l");
1426 }
1427 leg->Draw("same");
b8e17107 1428 }
13bb4ca7 1429 cMuonTriggerUnlikeLike->Print(OutFileNamePDF.Data());
1430 dirGlobal->cd();
1431 cMuonTriggerUnlikeLike->Write();
1432 cMuonTriggerHpt->Print(OutFileNamePDF.Data());
1433 cMuonTriggerHpt->Write();
1434
93ce3c40 1435 // close the PDF file
13bb4ca7 1436 c1->Print(OutFileNamePDF_close.Data());
1437 rootFileOut->Close();
1438
1439 delete runs;
1440 delete runs2;
1441 delete triggersB;
1442 delete triggersAC;
1443 delete triggersE;
1444 delete dirTrigger;
1445 delete dirCent;
1446 delete colorInd;
1447
1448 return;
1449
93ce3c40 1450}
005408df 1451
1452void SetCanvas(TCanvas *canvas, Int_t logy){
13bb4ca7 1453
005408df 1454 if(!canvas) return;
1455 canvas->SetTopMargin(0.05);
1456 canvas->SetRightMargin(0.01);
1457 canvas->SetGridy(1);
1458 canvas->SetLogy(logy);
1459
1460 return;
1461}
1462
1463Bool_t IsTrigger(TObjArray *array, Int_t index, TString name){
1464
1465 Bool_t process = kFALSE;
1466
1467 if( !array) return process;
1468
1469 TString triggerName = (( (TObjString*) array->At(index) )->GetString());
1470
1471 if( triggerName.Contains(name) ) process = kTRUE;
1472
1473 return process;
1474}
1475
2e7189d6 1476Bool_t IsTriggerSelectedForMuonPhysics(TObjArray *triggersB, Int_t k){
1477
1478 if ( !triggersB ) return kFALSE;
1479 Bool_t selected;
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") );
13bb4ca7 1481 if (!selected) selected = (IsTrigger(triggersB,k,"CINT7") || IsTrigger(triggersB, k, "CMUSH7") ||IsTrigger(triggersB, k, "CMUS7") || IsTrigger(triggersB, k, "CMUL7") || IsTrigger(triggersB, k, "CMUU7") );
1482
2e7189d6 1483 return selected;
1484}
1485
1486
93f182e7 1487Bool_t IsHeavyIonCollision(AliCounterCollection *eventCounters){
1488
1489 if(!eventCounters) return kFALSE;
1490
1491 Double_t sum = eventCounters->GetSum("v0mult:low,int,high");
1492 Bool_t result = kTRUE;
1493 if(sum<=0) result = kFALSE;
1494
1495 cout<<" Collision type is set to ";
1496 if( result == kFALSE) cout<<"p-p"<<endl;
1497 else cout<<"heavy-ion"<<endl;
1498
1499 return result;
1500}
1501
005408df 1502TCanvas *ProcessCanvasTriggerContent(TObjArray *array, TH1 **hBNoPS, TH1 **hBWithPS, TString canvasName){
1503
1504 if(!array || !hBNoPS || !hBWithPS) return 0x0;
b66f9801 1505
005408df 1506 TString cName = "c";
1507 cName += canvasName;
1508 TCanvas *cTriggerContent = new TCanvas(canvasName,cName,1200,900);
1509 SetCanvas(cTriggerContent);
1510 cTriggerContent->cd();
1511
1512 TLegend* legcTC = new TLegend(0.2,0.15,0.50,0.40);
1513 legcTC->SetHeader("Physics Selection");
1514 legcTC->AddEntry(".","applied :","");
b66f9801 1515
005408df 1516 for(Int_t i = 0; i < array->GetEntriesFast(); i++){
1517 //skip the sum of all triggers
93f182e7 1518 if( i == (array->GetEntriesFast()-1) ) continue;
005408df 1519 hBNoPS[i]->SetLineStyle(2);
1520 if(i==0){
1521 hBNoPS[i]->SetMinimum(1e-3);
1522 hBNoPS[i]->Draw();
1523 hBWithPS[i]->Draw("same");
1524 }
1525 else{
1526 hBNoPS[i]->Draw("same");
1527 hBWithPS[i]->Draw("same");
1528 }
1529 legcTC->AddEntry(hBWithPS[i],(( (TObjString*) array->At(i) )->GetString()).Data(),"l");
1530 }
1531 legcTC->AddEntry(".","not applied :","");
1532
1533 for(Int_t i = 0; i < array->GetEntriesFast(); i++){
1534 legcTC->AddEntry(hBNoPS[i],(( (TObjString*) array->At(i) )->GetString()).Data(),"l");
1535 }
1536
1537 legcTC->Draw("same");
1538
1539 return cTriggerContent;
1540}
1541
13bb4ca7 1542TCanvas *ProcessCanvasRelativeTriggerContent(TObjArray *triggersB, TH1 **histo, TString canvasName, TArrayI *colorInd){
005408df 1543
13bb4ca7 1544 if(!triggersB || !histo ) return 0x0;
005408df 1545
1546 TString cName = "c" ;
1547 cName += canvasName;
1548 TCanvas *cRelativeTriggerContent = new TCanvas(canvasName,cName,1200,900);
1549 SetCanvas(cRelativeTriggerContent);
1550 cRelativeTriggerContent->cd();
1551
8a0df16c 1552 TH1** ratio = new TH1*[triggersB->GetEntriesFast()];
005408df 1553 TLegend* legcRTC = new TLegend(0.2,0.15,0.50,0.40);
1554 legcRTC->SetHeader("Physics Selection");
1555
1556 TString hName, hTriggerName;
1557 Int_t indAllTrig = triggersB->GetEntriesFast()-1;
2e7189d6 1558
005408df 1559 for(Int_t i = 0; i < triggersB->GetEntriesFast()-1; i++){
1560 hName = "ratio";
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);
13bb4ca7 1565 ratio[i]->SetLineColor(colorInd->At(i));
005408df 1566 if(i==0){
1567 ratio[i]->SetMaximum(1.5);
1568 ratio[i]->SetMinimum(0.001);
293bed3d 1569 ratio[i]->SetLabelSize(0.04);
005408df 1570 ratio[i]->GetYaxis()->SetTitle("Relative trigger content");
1571 ratio[i]->Draw("E");
1572 }
1573 else{
1574 ratio[i]->Draw("ESAME");
1575 }
1576 }
1577
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");
1581 }
1582 legcRTC->Draw("same");
1583
1584 return cRelativeTriggerContent;
1585}
1586
13bb4ca7 1587TCanvas *ProcessCanvasPhysSelCut(TObjArray *triggersB, TObjArray *triggersAC, TObjArray *triggersE, TH1 **hBNoPS, TH1 **hACNoPS, TH1 **hENoPS, TH1 **hBWithPS, TString canvasName, TArrayI *colorInd, Bool_t isHeavyIon){
005408df 1588
13bb4ca7 1589 if(!triggersB || !triggersE || !triggersAC || !hBNoPS || !hACNoPS || !hENoPS || !hBWithPS) return 0x0;
005408df 1590
93f182e7 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;
1594
005408df 1595 TString cName = "c";
1596 cName += canvasName;
1597 TCanvas *c1 = new TCanvas(canvasName,cName,1200,900);
1598 SetCanvas(c1);
1599 c1->cd();
1600
8a0df16c 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()];
005408df 1604 TLegend* legcRTC = new TLegend(0.2,0.15,0.50,0.40);
1605 legcRTC->SetHeader("Physics Selection");
8a0df16c 1606
005408df 1607 TString hName;
1608 for(Int_t i = 0; i < triggersB->GetEntriesFast()-1; i++){
93f182e7 1609
1610 //scale A, C and E triggers
1611 hACNoPS[i]->Scale(scale);
1612 hENoPS[i]->Scale(scale);
1613
005408df 1614 hName = "ratio";
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);
13bb4ca7 1619 ratioB[i]->SetLineColor(colorInd->At(i));
005408df 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);
13bb4ca7 1628 ratioBNoPS[i]->SetLineColor(colorInd->At(i));
1629 ratioBNoPS[i]->SetMarkerColor(colorInd->At(i));
005408df 1630
1631 hName = "ratioACNoPS";
1632 hName += ( (TObjString*) triggersAC->At(i) )->GetString();
1633 ratioACNoPS[i] = static_cast<TH1*> (hACNoPS[i]->Clone(hName));
b69e18be 1634 if ( ratioACNoPS[i]->GetEntries() > 0 ) ratioACNoPS[i]->Divide(hBNoPS[i]);
005408df 1635 ratioACNoPS[i]->SetLineWidth(0);
1636 ratioACNoPS[i]->SetLineStyle(2);
1637 ratioACNoPS[i]->SetMarkerStyle(24+i);
1638 ratioACNoPS[i]->SetMarkerSize(1);
13bb4ca7 1639 ratioACNoPS[i]->SetLineColor(colorInd->At(i));
1640 ratioACNoPS[i]->SetMarkerColor(colorInd->At(i));
005408df 1641
1642 hName = "ratioENoPS";
1643 hName += ( (TObjString*) triggersE->At(i) )->GetString();
1644 ratioENoPS[i] = static_cast<TH1*> (hENoPS[i]->Clone(hName));
2e7189d6 1645 if ( ratioENoPS[i]->GetEntries() > 0 ) ratioENoPS[i]->Divide(hBNoPS[i]);
005408df 1646 ratioENoPS[i]->SetLineWidth(0);
1647 ratioENoPS[i]->SetLineStyle(3);
1648 ratioENoPS[i]->SetMarkerStyle(24+i);
1649 ratioENoPS[i]->SetMarkerSize(1);
13bb4ca7 1650 ratioENoPS[i]->SetLineColor(colorInd->At(i));
1651 ratioENoPS[i]->SetMarkerColor(colorInd->At(i));
005408df 1652
1653
1654 if(i==0){
1655 ratioB[i]->SetMaximum(1.5);
93f182e7 1656 ratioB[i]->SetMinimum(0.05);
005408df 1657 ratioB[i]->SetLabelSize(0.02);
93f182e7 1658 ratioB[i]->GetYaxis()->SetTitle("Accepted / All from Phys. Sel.");
1659 ratioB[i]->SetTitle("Phys. Sel. for all selected triggers");
005408df 1660 ratioB[i]->Draw("E");
1661 //ratioBNoPS[i]->Draw("EPSAME");
1662 ratioACNoPS[i]->Draw("EPSAME");
1663 ratioENoPS[i]->Draw("EPSAME");
1664 }
1665 else{
1666 ratioB[i]->Draw("ESAME");
1667 //ratioBNoPS[i]->Draw("EPSAME");
1668 ratioACNoPS[i]->Draw("EPSAME");
1669 ratioENoPS[i]->Draw("EPSAME");
1670 }
1671 }
1672
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");
1676 }
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");
93f182e7 1680 TString textLegend = ( (TObjString*) triggersAC->At(i) )->GetString();
1681 if( textLegend.CompareTo(" ") ){
1682 textLegend += " x";
1683 textLegend += scale;
1684 legcRTC->AddEntry(ratioACNoPS[i],textLegend.Data(),"pl");
1685 }
1686 textLegend = ( (TObjString*) triggersE->At(i) )->GetString();
1687 if( textLegend.CompareTo(" ") ){
1688 //cout<<"trigger="<<textLegend.Data()<<"-"<<endl;
1689 textLegend += " x";
1690 textLegend += scale;
1691 legcRTC->AddEntry(ratioENoPS[i],textLegend.Data(),"pl");
1692 }
1693 }
1694 legcRTC->Draw("same");
1695
1696
1697 return c1;
1698}
1699
13bb4ca7 1700TCanvas *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){
93f182e7 1701
13bb4ca7 1702 if(!triggersB || !triggersE || !triggersAC || !hBNoPSCent || !hACNoPSCent || !hENoPSCent || !hBWithPSCent || !legendHeader) return 0x0;
93f182e7 1703
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;
1707
1708 TString cName = "c";
1709 cName += canvasName;
1710 TCanvas *c1 = new TCanvas(canvasName,cName,1200,900);
1711 SetCanvas(c1);
1712 c1->cd();
1713
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");
1720
1721 TString hName;
1722
1723 Float_t yMin = 0.05, yMax = 2;
1724
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);
1729
1730 hName = "ratio";
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);
13bb4ca7 1735 ratioB[centBin]->SetLineColor(colorInd->At(centBin));
93f182e7 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);
13bb4ca7 1744 ratioBNoPS[centBin]->SetLineColor(colorInd->At(centBin));
1745 ratioBNoPS[centBin]->SetMarkerColor(colorInd->At(centBin));
93f182e7 1746
1747 hName = "ratioACNoPS";
1748 hName += ( (TObjString*) triggersAC->At(k) )->GetString();
1749 ratioACNoPS[centBin] = static_cast<TH1*> (hACNoPSCent[centBin]->Clone(hName));
b69e18be 1750 if ( ratioACNoPS[centBin]->GetEntries() > 0 ) ratioACNoPS[centBin]->Divide(hBNoPSCent[centBin]);
93f182e7 1751 ratioACNoPS[centBin]->SetLineWidth(0);
1752 ratioACNoPS[centBin]->SetLineStyle(2);
1753 ratioACNoPS[centBin]->SetMarkerStyle(24+centBin);
1754 ratioACNoPS[centBin]->SetMarkerSize(1);
13bb4ca7 1755 ratioACNoPS[centBin]->SetLineColor(colorInd->At(centBin));
1756 ratioACNoPS[centBin]->SetMarkerColor(colorInd->At(centBin));
93f182e7 1757
1758
1759 hName = "ratioENoPS";
1760 hName += ( (TObjString*) triggersE->At(k) )->GetString();
1761 ratioENoPS[centBin] = static_cast<TH1*> (hENoPSCent[centBin]->Clone(hName));
b69e18be 1762 if ( ratioENoPS[centBin]->GetEntries() > 0 ) ratioENoPS[centBin]->Divide(hBNoPSCent[centBin]);
93f182e7 1763 ratioENoPS[centBin]->SetLineWidth(0);
1764 ratioENoPS[centBin]->SetLineStyle(3);
1765 ratioENoPS[centBin]->SetMarkerStyle(24+centBin);
1766 ratioENoPS[centBin]->SetMarkerSize(1);
13bb4ca7 1767 ratioENoPS[centBin]->SetLineColor(colorInd->At(centBin));
1768 ratioENoPS[centBin]->SetMarkerColor(colorInd->At(centBin));
93f182e7 1769
1770
1771 if(centBin==0){
1772 ratioB[centBin]->SetMaximum(yMax);
1773 ratioB[centBin]->SetMinimum(yMin);
1774 ratioB[centBin]->SetLabelSize(0.02);
13bb4ca7 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;
1778 else sTitle = "";
1779 ratioB[centBin]->SetTitle(Form("Phys. Sel. %s - Multiplicity from V0 amplitude",sTitle.Data()));
93f182e7 1780 ratioB[centBin]->Draw("E");
1781 //ratioBNoPS[centBin]->Draw("EPSAME");
1782 ratioACNoPS[centBin]->Draw("EPSAME");
1783 ratioENoPS[centBin]->Draw("EPSAME");
1784 }
1785 else{
1786 ratioB[centBin]->Draw("ESAME");
1787 //ratioBNoPS[centBin]->Draw("EPSAME");
1788 ratioACNoPS[centBin]->Draw("EPSAME");
1789 ratioENoPS[centBin]->Draw("EPSAME");
1790 }
1791 }
1792
1793 legcRTC->AddEntry(".","applied :","");
1794 for(Int_t centBin = 0; centBin < centBinMax; centBin++){
1795 legcRTC->AddEntry(ratioB[centBin],(legendHeader[centBin]).Data(),"l");
1796 }
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 ){
1801 textLegend += " x";
1802 textLegend += scale;
1803 legcRTC->AddEntry(ratioACNoPS[centBin],textLegend.Data(),"pl");
1804 }
1805 textLegend = ( (TObjString*) triggersE->At(k) )->GetString();
1806 if( textLegend.CompareTo(" ") && ratioENoPS[centBin]->GetMaximum() > yMin){
1807 //cout<<"trigger="<<textLegend.Data()<<"-"<<endl;
1808 textLegend += " x";
1809 textLegend += scale;
1810 legcRTC->AddEntry(ratioENoPS[centBin],textLegend.Data(),"pl");
1811 }
005408df 1812 }
1813 legcRTC->Draw("same");
1814
1815
1816 return c1;
1817}
1818
13bb4ca7 1819TCanvas *ProcessCanvasCentralityPercentile(TObjArray *triggersB, TH1 **hBNoPSCent, TH1 **hBWithPSCent, Int_t k, TString canvasName, TArrayI *colorInd, TString *legendHeader){
93f182e7 1820
13bb4ca7 1821 if(!triggersB || !hBNoPSCent || !hBWithPSCent || !legendHeader) return 0x0;
93f182e7 1822
1823 TString cName = "c";
1824 cName += canvasName;
1825 TCanvas *c1 = new TCanvas(canvasName,cName,1200,900);
1826 SetCanvas(c1,0);
1827 c1->cd();
1828
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");
1833
1834 TString hName;
1835
1836 Float_t yMin = 0., yMax = 0.3;
1837
1838 for(Int_t centBin = 0; centBin < centBinMax; centBin++){
1839
1840 hName = "ratio";
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);
13bb4ca7 1846 ratioB[centBin]->SetLineColor(colorInd->At(centBin+1));
93f182e7 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);
13bb4ca7 1856 ratioBNoPS[centBin]->SetLineColor(colorInd->At(centBin+1));
1857 ratioBNoPS[centBin]->SetMarkerColor(colorInd->At(centBin+1));
93f182e7 1858
1859 if(centBin==0){
1860 ratioB[centBin]->SetMaximum(yMax);
1861 ratioB[centBin]->SetMinimum(yMin);
1862 ratioB[centBin]->SetLabelSize(0.02);
1863 ratioB[centBin]->GetYaxis()->SetTitle("Centrality percentile check");
13bb4ca7 1864 TString sTitle = "for ", sTitle2 = (( (TObjString*) triggersB->At(k) )->GetString()).Data();
1865 if ( !sTitle2.IsNull() ) sTitle += sTitle2;
1866 else sTitle = "";
1867 ratioB[centBin]->SetTitle(Form("Centrality percentile check %s - Multiplicity from V0 amplitude",sTitle.Data()));
93f182e7 1868 ratioB[centBin]->Draw("E");
1869 ratioBNoPS[centBin]->Draw("EPSAME");
1870 }
1871 else{
1872 ratioB[centBin]->Draw("ESAME");
1873 ratioBNoPS[centBin]->Draw("EPSAME");
1874 }
1875 }
1876
1877 legcRTC->AddEntry(".","applied :","");
1878 for(Int_t centBin = 0; centBin < centBinMax; centBin++){
1879 legcRTC->AddEntry(ratioB[centBin],(legendHeader[centBin+1]).Data(),"l");
1880 }
1881 legcRTC->AddEntry(".","not applied :","");
1882 for(Int_t centBin = 0; centBin < centBinMax; centBin++){
1883 legcRTC->AddEntry(ratioBNoPS[centBin],(legendHeader[centBin+1]).Data(),"l");
1884 }
1885 legcRTC->Draw("same");
1886
1887
1888 return c1;
1889}
005408df 1890
93f182e7 1891TCanvas *ProcessCanvasTracksoverTrigger(TObjArray *triggersB, TH1 **hB, TH1 **hTrackerB, TH1 **hTriggerB, TH1 **hMatchedB, TH1 **hAllTracksB, Int_t indTrigger, TString canvasName, TString legendHeader){
005408df 1892
1893 if(!triggersB || !hB || !hTrackerB || !hTriggerB || !hMatchedB || !hAllTracksB || indTrigger<0 ) return 0x0;
1894
1895 TH1 *hTrackerPerB, *hTriggerPerB, *hMatchedPerB, *hAllTracksPerB;
1896
1897 TString hName, hNameBase;
1898 hNameBase =( (TObjString*) triggersB->At(indTrigger) )->GetString();
1899
1900 hName = "hTrackerPer";
1901 hName += hNameBase;
1902 hTrackerPerB = static_cast<TH1*>(hTrackerB[indTrigger]->Clone(hName));
b69e18be 1903 if ( hTrackerPerB->GetEntries() > 0 ) hTrackerPerB->Divide(hB[indTrigger]);
005408df 1904 hTrackerPerB->SetLineWidth(2);
1905 hTrackerPerB->SetLineColor(kRed);
1906
1907 hName = "hTriggerPer";
1908 hName += hNameBase;
1909 hTriggerPerB = static_cast<TH1*>(hTriggerB[indTrigger]->Clone(hName));
b69e18be 1910 if ( hTriggerPerB->GetEntries() > 0 ) hTriggerPerB->Divide(hB[indTrigger]);
005408df 1911 hTriggerPerB->SetLineWidth(2);
1912 hTriggerPerB->SetLineColor(kBlue);
1913
1914 hName = "hMatchedPer";
1915 hName += hNameBase;
1916 hMatchedPerB = static_cast<TH1*>(hMatchedB[indTrigger]->Clone(hName));
b69e18be 1917 if ( hMatchedPerB->GetEntries() > 0 ) hMatchedPerB->Divide(hB[indTrigger]);
005408df 1918 hMatchedPerB->SetLineWidth(2);
1919 hMatchedPerB->SetLineColor(kViolet);
1920
1921 hName = "hAllTracksPer";
1922 hName += hNameBase;
1923 hAllTracksPerB = static_cast<TH1*>(hAllTracksB[indTrigger]->Clone(hName));
b69e18be 1924 if ( hAllTracksPerB->GetEntries() > 0 ) hAllTracksPerB->Divide(hB[indTrigger]);
005408df 1925 hAllTracksPerB->SetLineWidth(3);
1926 hAllTracksPerB->SetLineColor(kBlack);
13bb4ca7 1927 hAllTracksPerB->SetTitle(Form("Number of Tracks /%s %s",hNameBase.Data(),legendHeader.Data()));
005408df 1928 hAllTracksPerB->SetMinimum(0.0001);
1929 hAllTracksPerB->SetLabelSize(0.02);
1930
1931
1932 TString cName = "c";
1933 cName += canvasName;
1934 hNameBase =( (TObjString*) triggersB->At(indTrigger) )->GetString();
1935 cName += hNameBase;
005408df 1936 TCanvas *cRatioTrackTypesB = new TCanvas(canvasName,cName,1200,900);
1937 SetCanvas(cRatioTrackTypesB,0);
1938 cRatioTrackTypesB->cd();
1939
1940 TLegend* legcTTCINT1B;
1941
1942 hAllTracksPerB->Draw("E");
1943 hTrackerPerB->Draw("Esame");
1944 hMatchedPerB->Draw("Esame");
1945 hTriggerPerB->Draw("Esame");
1946
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");
005408df 1953
1954 return cRatioTrackTypesB;
1955
1956}
1957
1958
93f182e7 1959TCanvas *ProcessCanvasTrackMultB(TObjArray *triggersB, TH1 **hB, TH1 **hTrackerB, TH1 **hTriggerB, TH1 **hMatchedB, TH1 **hAllTracksB, Int_t indTrigger, TString canvasName,TString legendHeader){
005408df 1960
1961 if(!triggersB || !hB || !hTrackerB || !hTriggerB || !hMatchedB || !hAllTracksB || indTrigger<0 ) return 0x0;
1962
1963 TString cName = "c";
1964 cName += canvasName;
1965 TString hNameBase =( (TObjString*) triggersB->At(indTrigger) )->GetString();
1966 cName += hNameBase;
005408df 1967 TCanvas *cTrackMultB = new TCanvas(canvasName,cName,1200,900);
1968 SetCanvas(cTrackMultB,0);
1969
1970 cTrackMultB->Divide(1,2);
1971 cTrackMultB->cd(1);
1972
1973
1974 TH1* hSumTriggerOverB, *hSumTrackerOverB;
1975
1976 TString hName;
1977
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]);
1982
13bb4ca7 1983 hName = Form("Sum of trigger tracks (matched+trigger-only) / # events in %s %s",hNameBase.Data(),legendHeader.Data());
005408df 1984 hSumTriggerOverB->SetTitle(hName);
293bed3d 1985 hSumTriggerOverB->SetLabelSize(0.04);
005408df 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]);
13bb4ca7 1992 hName = Form("Sum of tracker tracks (matched+tracker-only) / # events in %s %s",hNameBase.Data(),legendHeader.Data());
005408df 1993 hSumTrackerOverB->SetTitle(hName);
1994 //hSumTrackerOverCINT1B->LabelsOption("u");
293bed3d 1995 hSumTrackerOverB->SetLabelSize(0.04);
005408df 1996 hSumTrackerOverB->SetLineWidth(2);
1997 hSumTrackerOverB->SetLineColor(kBlue);
1998
1999
2000
2001 hSumTriggerOverB->Draw("e");
2002 cTrackMultB->cd(2);
2003 hSumTrackerOverB->Draw("e");
2004
2005 return cTrackMultB;
2006
2007}
2008
93f182e7 2009TCanvas *ProcessCanvasRatioTrackB(TObjArray *triggersB, TH1 **hB, TH1 **hTrackerB, TH1 **hTriggerB, TH1 **hMatchedB, TH1 **hAllTracksB, Int_t indTrigger, TString canvasName,TString legendHeader){
005408df 2010
2011 if(!triggersB || !hB || !hTrackerB || !hTriggerB || !hMatchedB || !hAllTracksB || indTrigger<0 ) return 0x0;
2012
2013 TString cName = "c";
2014 cName += canvasName;
2015 TString hNameBase =( (TObjString*) triggersB->At(indTrigger) )->GetString();
2016 cName += hNameBase;
005408df 2017 TCanvas *cRatioTrackB = new TCanvas(canvasName,cName,1200,900);
2018 SetCanvas(cRatioTrackB,0);
2019
2020 TH1* hTrackerOverTriggerB, *hMatchedOverTriggerB, *hMatchedOverTrackerB;
2021
2022 TString hName = Form("hTrackerOverTrigger%s",hNameBase.Data());
2023 hTrackerOverTriggerB = static_cast<TH1*>(hTrackerB[indTrigger]->Clone(hName));
2024 hTrackerOverTriggerB->Divide(hTriggerB[indTrigger]);
13bb4ca7 2025 hName = Form("# tracker tracks / # trigger tracks in %s %s",hNameBase.Data(),legendHeader.Data());
005408df 2026 hTrackerOverTriggerB->SetTitle(hName);
2027 //hTrackerOverTriggerCINT1B->LabelsOption("u");
2028 hTrackerOverTriggerB->SetLabelSize(0.02);
2029 hTrackerOverTriggerB->SetLineWidth(2);
2030 hTrackerOverTriggerB->SetLineColor(kBlue);
2031
2032 hName = Form("hMatchedOverTrigger%s",hNameBase.Data());
2033 hMatchedOverTriggerB = static_cast<TH1*>(hMatchedB[indTrigger]->Clone(hName));
2034 hMatchedOverTriggerB->Divide(hTriggerB[indTrigger]);
2035
13bb4ca7 2036 hName = Form("# matched tracks / # trigger tracks in %s %s",hNameBase.Data(),legendHeader.Data());
005408df 2037 hMatchedOverTriggerB->SetTitle(hName);
2038 //hMatchedOverTriggerCINT1B->LabelsOption("u");
2039 hMatchedOverTriggerB->SetLabelSize(0.02);
2040 hMatchedOverTriggerB->SetLineWidth(2);
2041 hMatchedOverTriggerB->SetLineColor(kBlue);
2042
2043 hName = Form("hMatchedOverTracker%s",hNameBase.Data());
2044 hMatchedOverTrackerB = static_cast<TH1*>(hMatchedB[indTrigger]->Clone(hName));
2045 hMatchedOverTrackerB->Divide(hTrackerB[indTrigger]);
13bb4ca7 2046 hName = Form("# matched tracks / # tracker tracks in %s %s",hNameBase.Data(),legendHeader.Data());
005408df 2047 hMatchedOverTrackerB->SetTitle(hName);
2048 //hMatchedOverTrackerCINT1B->LabelsOption("u");
2049 hMatchedOverTrackerB->SetLabelSize(0.02);
2050 hMatchedOverTrackerB->SetLineWidth(2);
2051 hMatchedOverTrackerB->SetLineColor(kBlue);
2052
2053
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");
2061
2062 return cRatioTrackB;
2063
2064}
2065
93f182e7 2066TCanvas *ProcessCanvasAsymMatched(TObjArray *triggersB, TH1 **hPosMatchedB, TH1 **hNegMatchedB, TH1 **hAllMatchedB, Int_t indTrigger, TString canvasName,TString legendHeader){
005408df 2067
2068 if(!triggersB || !hPosMatchedB || !hNegMatchedB || !hAllMatchedB || indTrigger<0 ) return 0x0;
2069
2070 TString hName, hNameBase = (( (TObjString*) triggersB->At(indTrigger) )->GetString());
2071
2072 TString cName = "c";
2073 cName += canvasName;
2074 cName += hNameBase;
005408df 2075 TCanvas *cAsymMatched = new TCanvas(canvasName.Data(),cName,1200,900);
2076 SetCanvas(cAsymMatched,0);
2077 cAsymMatched->cd();
2078
2079
2080 TH1 *hDiffMatchedCMUS1B= static_cast<TH1*>(hPosMatchedB[indTrigger]->Clone("hDiffMatchedCMUS1B"));
2081 hDiffMatchedCMUS1B->Add(hNegMatchedB[indTrigger],-1);
13bb4ca7 2082 if ( hDiffMatchedCMUS1B->GetSumw2N() == 0 ) hDiffMatchedCMUS1B->Sumw2();
005408df 2083
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);
13bb4ca7 2091 hName = Form("Matched tracks charge asymmetry for %s with acc. cuts %s",hNameBase.Data(),legendHeader.Data());
005408df 2092 hAsymMatchedCMUS1B->SetTitle(hName);
2093
2094 hAsymMatchedCMUS1B->GetYaxis()->SetTitle("Charged tracks asymmetry");
2095 hAsymMatchedCMUS1B->Draw("EH");
2096
2097 return cAsymMatched;
2098
2099}
2100
93f182e7 2101TCanvas *ProcessCanvasHighPtMuons(TObjArray *triggersB, TH1 **hB, TH1 **hMatchedLowPtB, TH1 **hMatchedHighPtB, Int_t indTrigger, TString canvasName, TString legendHeader){
005408df 2102
2103 if(!triggersB || !hB || !hMatchedLowPtB || !hMatchedHighPtB || indTrigger<0 ) return 0x0;
2104
2105 TString hName, hNameBase = (( (TObjString*) triggersB->At(indTrigger) )->GetString());
2106
2107 TString cName = "c";
2108 cName += canvasName;
2109 cName += hNameBase;
005408df 2110 TCanvas *cHighPtMuons = new TCanvas(canvasName.Data(),cName,1200,900);
2111 SetCanvas(cHighPtMuons,0);
2112 cHighPtMuons->cd();
2113
2114 TLegend* legcHPM;
2115
2116 TH1* hMatchedLowPtPerB, *hMatchedHighPtPerB;
2117 hName = Form("hMatchedLowPtPer%s ",hNameBase.Data());
2118 hMatchedLowPtPerB = static_cast<TH1*> (hMatchedLowPtB[indTrigger]->Clone(hName));
13bb4ca7 2119 if ( hMatchedLowPtPerB->GetSumw2N() == 0 ) hMatchedLowPtPerB->Sumw2();
005408df 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);
2129
2130 hName = Form("hMatchedHighPtPer%s ",hNameBase.Data());
2131 hMatchedHighPtPerB = static_cast<TH1*> (hMatchedHighPtB[indTrigger]->Clone(hName));
13bb4ca7 2132 if ( hMatchedHighPtPerB->GetSumw2N() == 0 ) hMatchedHighPtPerB->Sumw2();
005408df 2133 hMatchedHighPtPerB->Divide(hB[indTrigger]);
2134 hMatchedHighPtPerB->SetLineWidth(2);
2135 hMatchedHighPtPerB->SetLineColor(kRed);
2136
13bb4ca7 2137 hName = Form("Number of matched track per %s (include Vtx and R_{Abs} cuts) %s",hNameBase.Data(),legendHeader.Data());
93f182e7 2138 hMatchedLowPtPerB->SetTitle(hName);
005408df 2139 hMatchedLowPtPerB->Draw("E");
2140 hMatchedHighPtPerB->Draw("Esame");
2141
2142 legcHPM = new TLegend(0.60,0.45,0.98,0.65);
93f182e7 2143 //legcHPM->SetHeader(hName);
005408df 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");
2148
2149 return cHighPtMuons;
13bb4ca7 2150}
2151
2152TCanvas *ProcessCanvasBeamGasMatched(TObjArray *triggersB, TH1 **hBeamGasMatchedB, TH1 **hBeamGasMatchedHighPtB, TH1 **hAllMatchedB, TH1 **hMatchedHighPtB, Int_t indTrigger, TString canvasName,TString legendHeader){
005408df 2153
13bb4ca7 2154 if(!triggersB || !hBeamGasMatchedB || !hBeamGasMatchedHighPtB || !hAllMatchedB || indTrigger<0 || !hMatchedHighPtB )
2155 return 0x0;
2156
2157 TString hName, hNameBase = (( (TObjString*) triggersB->At(indTrigger) )->GetString());
2158
2159 TString cName = "c";
2160 cName += canvasName;
2161 cName += hNameBase;
2162 TCanvas *cBeamGasMatched = new TCanvas(canvasName.Data(),cName,1200,900);
2163 SetCanvas(cBeamGasMatched,0);
2164 cBeamGasMatched->cd();
2165
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);
2174
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);
2180
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());
2183
2184 hBeamGasMatchedCMUS1B->SetTitle(hName);
2185
2186 hBeamGasMatchedCMUS1B->GetYaxis()->SetTitle("Relative beam-gas tracks");
2187 hBeamGasMatchedCMUS1B->Draw("EH");
2188 hBeamGasMatchedHighPtCMUS1B->Draw("EHsame");
2189
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");
2194 leg->Draw("same");
2195
2196 return cBeamGasMatched;
005408df 2197
2198}
2199
b69e18be 2200TH1* ProcessHisto( AliCounterCollection* counter, TString hVariable, TString hSelection, TString hName, TString xName, TString yName, Int_t color){
005408df 2201
2202
2203 TH1* h1 = 0x0;
2204 if( !counter ) return h1;
93f182e7 2205
2e7189d6 2206 //cout<<"ProcessHisto selection "<<hSelection<<endl;
b69e18be 2207
2208 if ( !hSelection.Contains("trigger: /") && !hSelection.Contains("trigger:/") ) h1 = (TH1*) counter->Draw(hVariable,hSelection);
13bb4ca7 2209 //cout<<"ProcessHisto selection2 "<<h1<<endl;
005408df 2210 if ( !h1 ) h1 = new TH1D(hName,"",10,0,10);
2211 else {
13bb4ca7 2212 if ( h1->GetSumw2N() == 0 ) h1->Sumw2();
005408df 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);
2218
2219 }
2220
2221 return h1;
2222}
2223
2224TH2* ProcessHisto2D( AliCounterCollection* counter, TString hVariable, TString hVariable2, TString hSelection, TString hName){
2225
2226
2227 TH2* h1 = 0x0;
2228 if( !counter ) return h1;
2229 Bool_t setName = kTRUE;
2230
2231 if(hName.Sizeof()==1) setName = kFALSE;
2232
2233 h1 = (TH2*) counter->Draw(hVariable,hVariable2,hSelection);
2234 if ( !h1 ) h1 = new TH2D(hName,"",10,0,10,10,0,10);
2235 else {
13bb4ca7 2236 if ( h1->GetSumw2N() == 0 ) h1->Sumw2();
005408df 2237 h1->LabelsOption("a");
2238 if(setName) h1->SetName(hName);
2239 }
2240
2241 return h1;
2242}
93f182e7 2243
13bb4ca7 2244Bool_t GetTriggerLists(const char* triggerList, TString listFromContainer, TObjArray *triggersB, TObjArray *triggersAC, TObjArray *triggersE, TObjArray *triggersShortName){
005408df 2245
2246 //Get the trigger list from a file
2247 //The file should consist of a line for each trigger with the following layout:
13bb4ca7 2248 // MB triggernameB triggerNameAC triggerNameE
2249 // or MUONUNLIKE triggernameB triggerNameA,triggerNameC triggerNameE
2250 // or NOSHOW triggernameB triggerNameACE notrigger
005408df 2251 //if filename is 0, then default trigger names (pp 2011) are used
2252
13bb4ca7 2253 if( !triggersB || !triggersAC || !triggersE || !triggersShortName) return kFALSE;
2254 Int_t const nColumn = 4;
2255 TObjArray* triggers[nColumn] = {triggersShortName, triggersB, triggersAC, triggersE};
005408df 2256
13bb4ca7 2257 TString trigSuffix[nColumn] = {"","B", "AC", "E"};
005408df 2258 TString currTrigName = "";
13bb4ca7 2259 TObjArray* fullTriggerList[nColumn];
005408df 2260
13bb4ca7 2261 for ( Int_t ibeam=0; ibeam<nColumn; ++ibeam ) {
005408df 2262 fullTriggerList[ibeam] = new TObjArray;
2263 fullTriggerList[ibeam]->SetOwner();
2264 }
2265
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()) {
93f182e7 2271 Error("PlotMuonQA","unable to open file %s", triggerList);
005408df 2272 return kFALSE;
2273 }
2274
2275 while ( !inFile.eof() ) {
2276 Bool_t isGoodB = kTRUE;
13bb4ca7 2277 for ( Int_t ibeam=0; ibeam<nColumn; ++ibeam ) {
005408df 2278 currTrigName.ReadToken( inFile );
2279 if ( ! isGoodB ) continue;
2280 if ( currTrigName.IsNull() || ! currTrigName.IsAscii() ) {
13bb4ca7 2281 if ( ibeam==0 || ibeam == 1 ) {
005408df 2282 isGoodB = kFALSE;
2283 continue;
2284 }
2285 currTrigName = "notrigger";
2286 }
2287 fullTriggerList[ibeam]->AddLast(new TObjString(currTrigName));
2288 }
2289 }
2290 inFile.close();
2291 }
2292 else {
2293 TString baseTrigName[4] = {"CINT7", "CMUSH7", "CMUL7", "CMUU7"};
2294 for ( Int_t ibase=0; ibase<4; ++ibase ) {
13bb4ca7 2295 for ( Int_t ibeam=0; ibeam<nColumn; ++ibeam ) {
005408df 2296 // by default all triggers from new period in LHC11c
2297 currTrigName = baseTrigName[ibase] + trigSuffix[ibeam];
2298 fullTriggerList[ibeam]->AddLast(new TObjString(currTrigName));
2299 }
2300 }
2301 }
2302 //
2303 // Select only existing triggers in container
2304 //
2305 TObjArray *triggersFromContainer = listFromContainer.Tokenize(",");
2306 TObjString* trigName = 0x0;
2307
13bb4ca7 2308 TString selectAllTriggers[nColumn] = {"", "", "", ""};
005408df 2309 for ( Int_t itrig=0; itrig<fullTriggerList[0]->GetEntries(); ++itrig ) {
2310 Bool_t isBadTrig = kFALSE;
13bb4ca7 2311 for ( Int_t ibeam=0; ibeam<nColumn; ++ibeam ) {
005408df 2312 currTrigName = fullTriggerList[ibeam]->At(itrig)->GetName();
005408df 2313 //condition on trigger name from trigger list
13bb4ca7 2314 if ( ibeam == 0 && currTrigName.Contains("NOSHOW") ) {
2315 break;
2316 }
005408df 2317 if ( currTrigName.Contains("notrigger") ){
2318 isBadTrig = kTRUE;
13bb4ca7 2319 if ( ibeam == 0 || ibeam == 1 ){
2320 if ( ibeam == 1) if ( triggers[0]->GetLast() ) triggers[0]->RemoveAt(triggers[0]->GetLast());
2321 break;
2322 }
005408df 2323 currTrigName = " ";
2324 }
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
13bb4ca7 2327 if ( ibeam > 0 && triggersFromContainer ) {
005408df 2328 TIter nextTrigger( triggersFromContainer );
2329 isBadTrig = kTRUE;
2330 while ( ( trigName = static_cast<TObjString*>(nextTrigger()) ) ) {
2331 if ( currTrigName.Contains(trigName->GetString()) ){
2e7189d6 2332 isBadTrig = kFALSE;
005408df 2333 }
2334 }
2335 if ( isBadTrig == kTRUE ){
13bb4ca7 2336 if ( ibeam == 1){
2337 if ( triggers[0]->GetLast() != (triggers[0]->LowerBound()-1) ) triggers[0]->RemoveAt(triggers[0]->GetLast());
2338 break;
2339 }
005408df 2340 currTrigName = " ";
2341 }
2342 }
2343 triggers[ibeam]->AddLast(new TObjString(currTrigName));
2344 if ( isBadTrig ) continue;
2345 if ( ! selectAllTriggers[ibeam].IsNull() ) selectAllTriggers[ibeam] += ",";
2346 selectAllTriggers[ibeam] += currTrigName;
2347 }
2348 }
2349 if(triggersFromContainer) delete triggersFromContainer;
2350 if(trigName) delete trigName;
2351
2352
2353 // Complete trigger list and print values
2354 cout<<" Nr of triggers read "<<triggers[0]->GetEntriesFast()<<endl;
13bb4ca7 2355 for ( Int_t ibeam=0; ibeam<nColumn; ++ibeam ) {
005408df 2356 triggers[ibeam]->AddLast(new TObjString(selectAllTriggers[ibeam]));
2357 printf(" %s triggers:\n", trigSuffix[ibeam].Data());
2358 triggers[ibeam]->Print();
2359 delete fullTriggerList[ibeam];
2360 }
2361
2362 return kTRUE;
2363}
2364
2365TString GetRunList(const char *runList, TObjArray *runs, TObjArray *runs2){
2366
2367 // list of runs to be analyzed
2368 TString selectRuns = "run:";
2369
2370 if(runList) {
2371 // only the ones in the runList
2372 ifstream inFile(runList);
2373 if (!inFile.is_open()) {
93f182e7 2374 Error("PlotMuonQA","unable to open file %s", runList);
005408df 2375 return selectRuns;
2376 }
2377
2378 TString currRun;
2379 while (!inFile.eof()) {
2380 currRun.ReadLine(inFile, kTRUE);
2381 if (currRun.IsNull()) continue;
2382 if (!currRun.IsDigit()) {
93f182e7 2383 Error("PlotMuonQA","invalid run number: %s", currRun.Data());
005408df 2384 return selectRuns;
2385 }
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());
2389 }
2390 selectRuns.Remove(TString::kTrailing, ',');
2391 inFile.close();
2392
2393 } else {
2394 // all runs
13bb4ca7 2395 cout<<"runList is not set"<<endl;
005408df 2396 if(runs) runs->AddLast(new TObjString("*"));
2397 if(runs2) runs2->AddLast(new TObjString("*"));
2398 }
2399
2e7189d6 2400 printf("selected runs from runlist %s: %s\n",runList, selectRuns.Data());
93f182e7 2401
005408df 2402 return selectRuns;
2403}