]>
Commit | Line | Data |
---|---|---|
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 | |
11 | // - libPWG3muon.so | |
12 | // | |
13 | // TString includePath = "-I${ALICE_ROOT}/PWG3/base/ "; gSystem->SetIncludePath(includePath.Data()); | |
14 | // | |
15 | // The macro reads results of the QA task and produce monitoring plots. | |
16 | // | |
17 | // Author: Philippe Pillot - SUBATECH Nantes | |
18 | // Modified by Christophe Suire, Cynthia Hadjidakis - IPN Orsay | |
93f182e7 | 19 | // To be done: |
20 | // - reorganize last part (reading and extracting info from run per run histos) | |
21 | // - warning and error messages | |
93ce3c40 | 22 | //-------------------------------------------------------------------------- |
23 | ||
24 | #if !defined(__CINT__) || defined(__MAKECINT__) | |
25 | ||
26 | #include <Riostream.h> | |
27 | ||
28 | // ROOT includes | |
29 | #include "TEnv.h" | |
30 | #include "TMath.h" | |
31 | #include "TGrid.h" | |
32 | #include "TGridResult.h" | |
33 | #include "THashList.h" | |
34 | #include "TFile.h" | |
35 | #include "TH1.h" | |
36 | #include "TH2.h" | |
005408df | 37 | #include "TF1.h" |
93ce3c40 | 38 | #include "TSystem.h" |
39 | #include "TStyle.h" | |
40 | #include "TCanvas.h" | |
41 | #include "TPad.h" | |
42 | #include "TLegend.h" | |
b66f9801 | 43 | #include "TObjArray.h" |
44 | #include "TObjString.h" | |
93ce3c40 | 45 | |
46 | // ALIROOT includes | |
47 | #include "AliCounterCollection.h" | |
48 | ||
49 | #endif | |
50 | ||
005408df | 51 | TString GetRunList(const char *runList, TObjArray *runs, TObjArray *runs2); |
005408df | 52 | Bool_t GetTriggerLists(const char *triggerList, TString listFromContainer, TObjArray *triggersB=0, TObjArray *triggersAC=0, TObjArray *triggersE=0); |
53 | void SetCanvas(TCanvas *canvas, Int_t logy=1); | |
54 | ||
93f182e7 | 55 | TH1* ProcessHisto( AliCounterCollection* counter, TString variable, TString selection, TString hName="", TString xName="", TString yName="", Int_t color=1, Bool_t empty = kFALSE); |
005408df | 56 | TH2* ProcessHisto2D( AliCounterCollection* counter, TString hVariable, TString hVariable2, TString hSelection, TString hName); |
57 | ||
58 | TCanvas *ProcessCanvasTriggerContent(TObjArray *array, TH1 **histo, TH1 **histo2, TString canvasName); | |
59 | TCanvas *ProcessCanvasRelativeTriggerContent(TObjArray *array, TH1 **histo, TString canvasName, Int_t *colorTab); | |
93f182e7 | 60 | TCanvas *ProcessCanvasPhysSelCut(TObjArray *triggersB, TObjArray *triggersAC, TObjArray *triggersE, TH1 **hBNoPS, TH1 **hACNoPS,TH1 **hENoPS, TH1 **hBWithPS, TString canvasName, Int_t *colorInd, Bool_t isHeavyIon = kFALSE); |
61 | TCanvas *ProcessCanvasPhysSelCutCentrality(TObjArray *triggersB, TObjArray *triggersAC, TObjArray *triggersE, TH1 **hBNoPS, TH1 **hACNoPS, TH1 **hENoPS, TH1 **hBWithPS, Int_t k, TString canvasName, Int_t *colorInd, TString *legendHeader, Bool_t isHeavyIon = kFALSE); | |
62 | TCanvas *ProcessCanvasCentralityPercentile(TObjArray *triggersB, TH1 **hBNoPSCent, TH1 **hBWithPSCent, Int_t k, TString canvasName, Int_t *colorInd, TString *legendHeader); | |
63 | TCanvas *ProcessCanvasTracksoverTrigger(TObjArray *triggersB, TH1 **hB, TH1 **hTrackerB, TH1 **hTriggerB, TH1 **hMatchedB, TH1 **hAllTracksB, Int_t indTrigger, TString canvasName,TString legendHeader=""); | |
64 | TCanvas *ProcessCanvasTrackMultB(TObjArray *triggersB, TH1 **hB, TH1 **hTrackerB, TH1 **hTriggerB, TH1 **hMatchedB, TH1 **hAllTracksB, Int_t indTrigger, TString canvasName,TString legendHeader=""); | |
65 | TCanvas *ProcessCanvasRatioTrackB(TObjArray *triggersB, TH1 **hB, TH1 **hTrackerB, TH1 **hTriggerB, TH1 **hMatchedB, TH1 **hAllTracksB, Int_t indTrigger, TString canvasName,TString legendHeader=""); | |
66 | TCanvas *ProcessCanvasAsymMatched(TObjArray *triggersB, TH1 **hPosMatchedB, TH1 **hNegMatchedB, TH1 **hAllMatchedB, Int_t indTrigger, TString canvasName,TString legendHeader=""); | |
67 | TCanvas *ProcessCanvasHighPtMuons(TObjArray *triggersB, TH1 **hB, TH1 **hMatchedLowPtB, TH1 **hAllMatchedHightPtB, Int_t indTrigger, TString canvasName,TString legendHeader=""); | |
005408df | 68 | Bool_t IsTrigger(TObjArray *array, Int_t index, TString name); |
93f182e7 | 69 | Bool_t IsHeavyIonCollision(AliCounterCollection *eventCounters); |
93ce3c40 | 70 | |
93ce3c40 | 71 | //-------------------------------------------------------------------------- |
93f182e7 | 72 | void PlotMuonQA(const char* baseDir, const char* runList = 0x0, const char * triggerList = 0x0, Bool_t selectPhysics = kFALSE, const char *LHCPeriod = "LHC11c", const char *QAFileName = "QAresults.root") { |
005408df | 73 | |
93ce3c40 | 74 | /// Macro for QA monitoring. |
75 | /// Example: baseDir = "alien:///alice/cern.ch/user/p/ppillot/pp7TeV/LHC10d/MuonQA/pass1/results/". | |
76 | /// If runList != 0x0: only the given runs will be used. Otherwise use all runs found in baseDir. | |
93f182e7 | 77 | /// If triggerList !=0x0: only the given triggers are displayed. Otherwise use the default list of triggers (see GetTriggerLists) |
78 | ||
93ce3c40 | 79 | #if defined(__CINT__) && !defined(__MAKECINT__) |
80 | gSystem->Load("libTree"); | |
81 | gSystem->Load("libGeom"); | |
82 | gSystem->Load("libVMC"); | |
83 | gSystem->Load("libPhysics"); | |
84 | gSystem->Load("libSTEERBase"); | |
85 | gSystem->Load("libESD"); | |
86 | gSystem->Load("libAOD"); | |
87 | gSystem->Load("libANALYSIS"); | |
88 | gSystem->Load("libANALYSISalice"); | |
89 | gSystem->Load("libCORRFW"); | |
90 | gSystem->Load("libPWG3base"); | |
91 | gSystem->Load("libPWG3muon"); | |
92 | #endif | |
93 | ||
94 | // Cosmetics and configuration | |
95 | gStyle->SetFillColor(10); | |
96 | gStyle->SetPadGridX(kTRUE); | |
97 | gStyle->SetPadGridY(kTRUE); | |
98 | gStyle->SetPadRightMargin(0.01); | |
99 | ||
005408df | 100 | Int_t colorInd[10]={1,4,2,3,6,7,12}; |
b66f9801 | 101 | |
93ce3c40 | 102 | TString OutFileName = "QA_"; OutFileName += LHCPeriod; |
103 | TString OutFileNamePDF= OutFileName.Data(); OutFileNamePDF+= ".pdf"; | |
104 | TString OutFileNamePDF_open = OutFileNamePDF.Data(); OutFileNamePDF_open += "["; | |
105 | TString OutFileNamePDF_close= OutFileNamePDF.Data(); OutFileNamePDF_close += "]"; | |
106 | TString OutFileNameROOT= OutFileName.Data(); OutFileNameROOT+= ".root"; | |
107 | ||
b66f9801 | 108 | Int_t PRINTSTAT = 1; |
005408df | 109 | Int_t kCMUS = 2; |
93ce3c40 | 110 | if (0){ // Equivalent to the fast read option |
111 | gEnv->SetValue("XNet.ConnectTimeout",10); | |
112 | gEnv->SetValue("XNet.RequestTimeout",10); | |
113 | gEnv->SetValue("XNet.MaxRedirectCount",2); | |
114 | gEnv->SetValue("XNet.ReconnectTimeout",10); | |
115 | gEnv->SetValue("XNet.FirstConnectMaxCnt",1); | |
116 | } | |
117 | ||
118 | TH1::AddDirectory(kFALSE); | |
119 | ||
120 | TString alienBaseDir = baseDir; | |
121 | ||
93ce3c40 | 122 | if (alienBaseDir.Contains("alien:") && !TGrid::Connect("alien://")) { |
123 | Error("MergeQA","cannot connect to grid"); | |
124 | return; | |
125 | } | |
126 | ||
005408df | 127 | |
93f182e7 | 128 | cout<<"//---------------------------------- //"<<endl; |
129 | cout<<"// Run selection //"<<endl; | |
130 | cout<<"//---------------------------------- //"<<endl; | |
93ce3c40 | 131 | |
005408df | 132 | TObjArray *runs = new TObjArray(); |
133 | runs->SetOwner(kTRUE); | |
134 | TObjArray *runs2 = new TObjArray(); | |
135 | runs2->SetOwner(kTRUE); | |
136 | TString selectRuns = GetRunList(runList,runs,runs2); | |
93f182e7 | 137 | |
93ce3c40 | 138 | // physics selection |
139 | TString select = selectPhysics ? "selected:yes" : ""; | |
93f182e7 | 140 | |
b66f9801 | 141 | cout<<"//---------------------------------- //"<<endl; |
005408df | 142 | cout<<"// Get global counter //"<<endl; |
b66f9801 | 143 | cout<<"//---------------------------------- //"<<endl; |
144 | ||
145 | TFile *globalFile = TFile::Open(Form("%s/%s", baseDir,QAFileName)); | |
93ce3c40 | 146 | if (!globalFile || ! globalFile->IsOpen()) { |
b66f9801 | 147 | Error("PlotQA", "failed to open file: %s/%s", baseDir, QAFileName); |
93ce3c40 | 148 | return; |
149 | } | |
150 | globalFile->Cd("MUON_QA"); | |
151 | ||
b66f9801 | 152 | TString selection; |
153 | ||
93ce3c40 | 154 | // get counters |
155 | AliCounterCollection* eventCounters = static_cast<AliCounterCollection*>(globalFile->FindObjectAny("eventCounters")); | |
156 | AliCounterCollection* trackCounters = static_cast<AliCounterCollection*>(globalFile->FindObjectAny("trackCounters")); | |
157 | if (!runList) selectRuns += trackCounters->GetKeyWords("run"); | |
005408df | 158 | |
159 | ||
160 | cout<<"//---------------------------------- //"<<endl; | |
161 | cout<<"// Trigger selection //"<<endl; | |
162 | cout<<"//---------------------------------- //"<<endl; | |
163 | ||
164 | TObjArray *triggersB, *triggersAC, *triggersE; | |
165 | triggersB = new TObjArray(); | |
166 | triggersB->SetOwner(); | |
167 | triggersAC = new TObjArray(); | |
168 | triggersAC->SetOwner(); | |
169 | triggersE = new TObjArray(); | |
170 | triggersE->SetOwner(); | |
171 | ||
172 | TString listFromContainer = eventCounters->GetKeyWords("trigger"); | |
173 | Bool_t success = GetTriggerLists(triggerList, listFromContainer, triggersB, triggersAC, triggersE); | |
174 | if(!success) return; | |
93f182e7 | 175 | |
176 | cout<<"//---------------------------------- //"<<endl; | |
177 | cout<<"// Set collision type ? //"<<endl; | |
178 | cout<<"//---------------------------------- //"<<endl; | |
005408df | 179 | |
93f182e7 | 180 | Bool_t isHeavyIon = kTRUE; |
181 | isHeavyIon = IsHeavyIonCollision(eventCounters); | |
182 | ||
005408df | 183 | cout<<"//---------------------------------- //"<<endl; |
184 | cout<<"// Trigger plots //"<<endl; | |
185 | cout<<"//---------------------------------- //"<<endl; | |
186 | ||
93f182e7 | 187 | //plot all trigger from event counters without any selection |
005408df | 188 | TString CanvasName = "cAll"; |
189 | TCanvas *cAll = new TCanvas(CanvasName.Data(),CanvasName.Data()); | |
93f182e7 | 190 | cAll->SetLeftMargin(0.18); |
005408df | 191 | cAll->cd(); |
192 | //TH2* hAll = (TH2*) ProcessHisto2D(eventCounters, "trigger", "run", Form("run:any/%s",select.Data()) , ""); | |
193 | TH2* hAll = (TH2*) ProcessHisto2D(eventCounters, "trigger", "run", "run:any" , ""); | |
93f182e7 | 194 | for ( Int_t ibin=1; ibin<=hAll->GetYaxis()->GetNbins(); ++ibin ) { |
195 | TString currLabel = hAll->GetYaxis()->GetBinLabel(ibin); | |
196 | TObjArray* labelArray = currLabel.Tokenize("-"); | |
197 | labelArray->SetOwner(); | |
198 | TString newLabel = labelArray->At(0)->GetName(); | |
199 | if ( labelArray->GetEntries() >= 2 ) newLabel = Form("%s-%s", newLabel.Data(), labelArray->At(1)->GetName()); | |
200 | hAll->GetYaxis()->SetBinLabel(ibin, newLabel.Data()); | |
201 | delete labelArray; | |
202 | } | |
005408df | 203 | hAll->Draw("TEXT"); |
204 | ||
205 | ||
93ce3c40 | 206 | //declare a default canvas c1 |
005408df | 207 | CanvasName = "c1"; |
b66f9801 | 208 | TCanvas *c1 = new TCanvas(CanvasName.Data(),CanvasName.Data()); |
93ce3c40 | 209 | c1->cd(); |
005408df | 210 | |
93f182e7 | 211 | //Add a dimension here: All collisions / M.B / low mult. / high mult. |
212 | ||
213 | //loop on centrality | |
214 | Int_t centBin = 3; | |
215 | Int_t const centBinMax = 4; | |
216 | Int_t centBinMaxLoop = centBinMax; | |
217 | if(!isHeavyIon) centBinMaxLoop = 1; | |
218 | TString centBinName[centBinMax] = {"v0mult:any/","v0mult:low,int,high/","v0mult:low/","v0mult:high/"}; | |
219 | TString centLegendName[centBinMax] ={"All collisions","[0-80%] from V0 amplitude","low mult. [60-80%] from V0 amplitude","high mult. [0-10%] from V0 amplitude"}; | |
220 | TString centLegendNameShort[centBinMax] ={"All","[0-80%]","[60-80%]","[0-10%]"}; | |
221 | TString selectionCent; | |
222 | ||
223 | ||
224 | TH1* hBNoPS[centBinMax][10]={}; | |
225 | TH1* hBWithPS[centBinMax][10]={}; | |
226 | TH1* hB[centBinMax][10]={}; | |
227 | TH1* hTriggerB[centBinMax][10], *hTrackerB[centBinMax][10], *hMatchedB[centBinMax][10], *hAllTracksB[centBinMax][10], *hMatchedLowPtB[centBinMax][10], *hMatchedHighPtB[centBinMax][10]; | |
228 | TH1* hMatchedLowPtBNoPS[centBinMax][10], *hMatchedHighPtBNoPS[centBinMax][10]; | |
229 | TH1* hPosMatchedB[centBinMax][10], *hNegMatchedB[centBinMax][10], *hAllMatchedB[centBinMax][10]; | |
230 | TH1 *hACWithPS[centBinMax][10]={}; | |
231 | TH1 *hACNoPS[centBinMax][10]={}; | |
232 | TH1 *hEWithPS[centBinMax][10]={}; | |
233 | TH1 *hENoPS[centBinMax][10]={}; | |
4916d740 | 234 | |
005408df | 235 | if(triggersB->GetEntriesFast()>=10){ |
b66f9801 | 236 | cout<<"Too many triggers"<<endl; |
237 | return; | |
238 | } | |
005408df | 239 | |
93f182e7 | 240 | |
241 | ||
242 | //loop on centrality | |
243 | for(centBin = 0; centBin < centBinMaxLoop; centBin++){ | |
244 | selectionCent = centBinName[centBin]; | |
245 | ||
246 | //Loop on trigger (last is all triggers, then for each defined trigger) | |
247 | for(Int_t i = 0; i < triggersB->GetEntriesFast(); i++){ | |
b66f9801 | 248 | |
93f182e7 | 249 | TString histoNameBase = "h_trig", histoName; |
250 | histoNameBase+= i+1; | |
251 | Bool_t empty = kFALSE; | |
005408df | 252 | |
93f182e7 | 253 | TString triggerName = ( (TObjString*) triggersB->At(i) )->GetString(); |
254 | if(triggerName.EqualTo(" ")) continue; | |
255 | // Histo trigger without Phys. Sel. | |
256 | selection = selectionCent; selection += Form("trigger:%s/%s", triggerName.Data(), selectRuns.Data()); | |
257 | cout<<selection<<endl; | |
258 | histoName = histoNameBase; | |
259 | histoName += "BNoPS"; | |
260 | hBNoPS[centBin][i] = (TH1*) ProcessHisto(eventCounters, "run", selection, histoName, "", "Trigger content w/o Phys. Sel.", colorInd[i],empty); | |
261 | // Histo trigger with Phys. Sel. | |
262 | selection = selectionCent; selection += Form("trigger:%s/%s/selected:yes", triggerName.Data(), selectRuns.Data()); | |
263 | histoName = histoNameBase; | |
264 | histoName += "BWithPS"; | |
265 | hBWithPS[centBin][i] = (TH1*) ProcessHisto(eventCounters, "run", selection, histoName, "", "Trigger content w/ Phys. Sel.", colorInd[i],empty); | |
266 | // Histo trigger : Phys. Sel. is selected or not depending on the macro arguments | |
267 | selection = selectionCent; selection += Form("trigger:%s/%s/%s", triggerName.Data(), selectRuns.Data(), select.Data()); | |
268 | histoName = histoNameBase; | |
269 | histoName += "B"; | |
270 | hB[centBin][i] = (TH1*) ProcessHisto(eventCounters, "run", selection, histoName,empty); | |
005408df | 271 | |
93f182e7 | 272 | TString triggerNameAC = ( (TObjString*) triggersAC->At(i) )->GetString(); |
273 | if(triggerNameAC.EqualTo(" ")) empty = kTRUE; | |
274 | //if(empty == kTRUE) cout<< "test B="<<triggerName<<" AC="<<triggerNameAC<<" empty="<<empty<<endl; | |
275 | // Histo trigger without Phys. Sel. AC | |
276 | histoName = histoNameBase; | |
277 | histoName += "ACNoPS"; | |
278 | selection = selectionCent; selection += Form("trigger:%s/%s", triggerNameAC.Data(), selectRuns.Data()); | |
279 | hACNoPS[centBin][i] = (TH1*) ProcessHisto(eventCounters, "run", selection, histoName,empty); | |
280 | // Histo trigger with Phys. Sel. AC | |
281 | selection = selectionCent; selection += Form("trigger:%s/%s/selected:yes", triggerNameAC.Data(), selectRuns.Data()); | |
282 | histoName = histoNameBase; | |
283 | histoName += "ACWithPS"; | |
284 | hACWithPS[centBin][i] = (TH1*) ProcessHisto(eventCounters, "run", selection, histoName,empty); | |
005408df | 285 | |
93f182e7 | 286 | TString triggerNameE = ( (TObjString*) triggersE->At(i) )->GetString(); |
287 | if(triggerNameE.EqualTo(" ")) empty = kTRUE; | |
288 | //if(empty == kTRUE) cout<< "test B="<<triggerName<<" E="<<triggerNameE<<" "<<empty<<endl; | |
289 | ||
290 | // Histo trigger without Phys. Sel. E | |
291 | selection = selectionCent; selection += Form("trigger:%s/%s", triggerNameE.Data(), selectRuns.Data()); | |
292 | histoName = histoNameBase; | |
293 | histoName += "ENoPS"; | |
294 | hENoPS[centBin][i] = (TH1*) ProcessHisto(eventCounters, "run", selection, histoName,empty); | |
295 | // Histo trigger with Phys. Sel. E | |
296 | selection = selectionCent; selection += Form("trigger:%s/%s/selected:yes", triggerNameE.Data(), selectRuns.Data()); | |
297 | histoName = histoNameBase; | |
298 | histoName += "EWithPS"; | |
299 | hEWithPS[centBin][i] = (TH1*) ProcessHisto(eventCounters, "run", selection, histoName,empty); | |
300 | ||
301 | // Histo tracking : Phys. Sel. is selected or not depending on the macro arguments | |
302 | selection = selectionCent; selection += Form("track:triggeronly/trigger:%s/%s/%s", triggerName.Data(), selectRuns.Data(), select.Data()); | |
303 | hTriggerB[centBin][i] = (TH1*) ProcessHisto(trackCounters, "run", selection, ""); | |
005408df | 304 | |
93f182e7 | 305 | selection = selectionCent; selection += Form("track:trackeronly/trigger:%s/%s/%s", triggerName.Data(), selectRuns.Data(), select.Data()); |
306 | hTrackerB[centBin][i] = (TH1*) ProcessHisto(trackCounters, "run", selection, ""); | |
005408df | 307 | |
93f182e7 | 308 | selection = selectionCent; selection += Form("track:matched/trigger:%s/%s/%s", triggerName.Data(), selectRuns.Data(), select.Data()); |
309 | hMatchedB[centBin][i] = (TH1*) ProcessHisto(trackCounters, "run", selection, ""); | |
005408df | 310 | |
93f182e7 | 311 | selection = selectionCent; selection += Form("trigger:%s/%s/%s", triggerName.Data(), selectRuns.Data(), select.Data()); |
312 | hAllTracksB[centBin][i] = (TH1*) ProcessHisto(trackCounters, "run", selection, ""); | |
005408df | 313 | |
93f182e7 | 314 | selection = selectionCent; selection += Form("track:matched/trigger:%s/%s/%s/pt:low/acc:in", triggerName.Data() ,selectRuns.Data(), select.Data()); |
315 | hMatchedLowPtB[centBin][i] = (TH1*) ProcessHisto(trackCounters, "run", selection, ""); | |
005408df | 316 | |
93f182e7 | 317 | selection = selectionCent; selection += Form("track:matched/trigger:%s/%s/%s/pt:high/acc:in", triggerName.Data() ,selectRuns.Data(), select.Data()); |
318 | hMatchedHighPtB[centBin][i] = (TH1*) ProcessHisto(trackCounters, "run", selection, ""); | |
005408df | 319 | |
93f182e7 | 320 | selection = selectionCent; selection += Form("track:matched/trigger:%s/%s/pt:low/acc:in", triggerName.Data() ,selectRuns.Data()); |
321 | hMatchedLowPtBNoPS[centBin][i] = (TH1*) ProcessHisto(trackCounters, "run", selection, ""); | |
005408df | 322 | |
93f182e7 | 323 | selection = selectionCent; selection += Form("track:matched/trigger:%s/%s/pt:high/acc:in", triggerName.Data() ,selectRuns.Data()); |
324 | hMatchedHighPtBNoPS[centBin][i] = (TH1*) ProcessHisto(trackCounters, "run", selection, ""); | |
005408df | 325 | |
93f182e7 | 326 | selection = selectionCent; selection += Form("track:matched/trigger:%s/%s/charge:pos/%s/acc:in",triggerName.Data(), select.Data(),selectRuns.Data()); |
327 | hPosMatchedB[centBin][i] = (TH1*) ProcessHisto(trackCounters, "run", selection, ""); | |
005408df | 328 | |
93f182e7 | 329 | selection = selectionCent; selection += Form("track:matched/trigger:%s/%s/charge:neg/%s/acc:in",triggerName.Data(), select.Data(),selectRuns.Data()); |
330 | hNegMatchedB[centBin][i] = (TH1*) ProcessHisto(trackCounters, "run", selection, ""); | |
005408df | 331 | |
93f182e7 | 332 | selection = selectionCent; selection += Form("track:matched/trigger:%s/%s/%s/acc:in",triggerName.Data(), select.Data(),selectRuns.Data()); |
333 | hAllMatchedB[centBin][i] = (TH1*) ProcessHisto(trackCounters, "run", selection, ""); | |
334 | } | |
b66f9801 | 335 | } |
336 | ||
005408df | 337 | //if there is not B triggers just stop now |
338 | Int_t count_trigger=0; | |
93f182e7 | 339 | centBin = 0; |
005408df | 340 | for(Int_t i = 0; i < triggersB->GetEntriesFast(); i++){ |
93f182e7 | 341 | count_trigger += hBNoPS[centBin][i]->GetEntries(); |
005408df | 342 | } |
343 | if(count_trigger<=0) return; | |
344 | ||
345 | ||
93f182e7 | 346 | Int_t NumOfBNoPS[centBinMax][10]; |
347 | Int_t NumOfBWithPS[centBinMax][10]; | |
348 | Int_t NumOfACNoPS[centBinMax][10]; | |
349 | Int_t NumOfENoPS[centBinMax][10]; | |
350 | Int_t NumOfACWithPS[centBinMax][10]; | |
351 | Int_t NumOfEWithPS[centBinMax][10]; | |
352 | ||
353 | for(centBin = 0; centBin < centBinMaxLoop; centBin++){ | |
354 | for(Int_t i = 0; i < triggersB->GetEntriesFast(); i++){ | |
355 | NumOfBNoPS[centBin][i] = hBNoPS[centBin][i]->Integral(); | |
356 | NumOfBWithPS[centBin][i] = hBWithPS[centBin][i]->Integral(); | |
357 | NumOfACNoPS[centBin][i] = hACNoPS[centBin][i]->Integral(); | |
358 | NumOfENoPS[centBin][i] = hENoPS[centBin][i]->Integral(); | |
359 | NumOfACWithPS[centBin][i] = hACWithPS[centBin][i]->Integral(); | |
360 | NumOfEWithPS[centBin][i] = hEWithPS[centBin][i]->Integral(); | |
361 | } | |
b66f9801 | 362 | } |
005408df | 363 | |
93f182e7 | 364 | centBin = 0; |
365 | ||
b66f9801 | 366 | cout<<"//==================================================================================="<<endl; |
367 | cout<<"// Put all plots in a ps file, easier to publish (Twiki)"<<endl; | |
368 | cout<<"//==================================================================================="<<endl; | |
369 | ||
93ce3c40 | 370 | c1->Print(OutFileNamePDF_open.Data()); |
93ce3c40 | 371 | TFile *rootFileOut = TFile::Open(OutFileNameROOT.Data(),"RECREATE"); |
005408df | 372 | cAll->Print(OutFileNamePDF.Data()); |
373 | cAll->Write(); | |
374 | ||
375 | ||
b66f9801 | 376 | cout<<"//==================================================================================="<<endl; |
005408df | 377 | cout<<"// new canvas with the total number of trigger with and without Phys. Sel."<<endl; |
b66f9801 | 378 | cout<<"//==================================================================================="<<endl; |
005408df | 379 | |
93f182e7 | 380 | TCanvas *cTriggerContent = ProcessCanvasTriggerContent(triggersB, hBNoPS[centBin], hBWithPS[centBin], "TriggerContent"); |
005408df | 381 | cTriggerContent->Draw(); |
b66f9801 | 382 | cTriggerContent->Print(OutFileNamePDF.Data()); |
383 | cTriggerContent->Write(); | |
384 | ||
385 | cout<<"//==================================================================================="<<endl; | |
005408df | 386 | cout<<"// new canvas with the relative content of each trigger w/o physics selection"<<endl; |
b66f9801 | 387 | cout<<"//==================================================================================="<<endl; |
005408df | 388 | |
93f182e7 | 389 | TCanvas *cRelativeTriggerContent = ProcessCanvasRelativeTriggerContent(triggersB, hBNoPS[centBin], "RelativeTriggerContent", colorInd); |
005408df | 390 | cRelativeTriggerContent->Draw(); |
93ce3c40 | 391 | cRelativeTriggerContent->Print(OutFileNamePDF.Data()); |
392 | cRelativeTriggerContent->Write(); | |
005408df | 393 | |
394 | cout<<"//==================================================================================="<<endl; | |
395 | cout<<"// new canvas with effect from physics selection for each trigger and background trigger "<<endl; | |
396 | cout<<"//==================================================================================="<<endl; | |
397 | ||
93f182e7 | 398 | TCanvas *cPhysSelCut = 0x0; |
399 | cPhysSelCut = ProcessCanvasPhysSelCut(triggersB, triggersAC, triggersE, hBNoPS[centBin], hACNoPS[centBin], hENoPS[centBin], hBWithPS[centBin], "PhysSelCutOnCollTrigger", colorInd,isHeavyIon); | |
005408df | 400 | cPhysSelCut->Draw(); |
401 | cPhysSelCut->Print(OutFileNamePDF.Data()); | |
402 | cPhysSelCut->Write(); | |
93f182e7 | 403 | |
404 | cout<<"//==================================================================================="<<endl; | |
405 | cout<<"// new canvas with effect from physics selection for each trigger and centrality bin (only in PbPb) "<<endl; | |
406 | cout<<"//==================================================================================="<<endl; | |
407 | ||
408 | Int_t k=0; | |
409 | TString canvasName; | |
410 | TString triggerName; | |
411 | TString legendHeader=""; | |
412 | ||
413 | ||
414 | if ( isHeavyIon ){ | |
415 | TCanvas *cPhysSelCutCentrality[10]; | |
416 | ||
417 | //loop over trigger | |
418 | for(k = 0; k < triggersB->GetEntriesFast(); k++){ | |
419 | //skip sum of all triggers | |
420 | if(k == (triggersB->GetEntriesFast()-1)) continue; | |
421 | //skip some triggers | |
422 | if( !IsTrigger(triggersB,k,"CMB")&&!IsTrigger(triggersB, k, "CPBI") ) continue; | |
423 | ||
424 | canvasName = "PhysSel_trigger"; | |
425 | canvasName +=k; | |
426 | ||
427 | TH1* hBNoPSCent[centBinMax-1]={hBNoPS[1][k],hBNoPS[2][k],hBNoPS[3][k]}; | |
428 | TH1* hACNoPSCent[centBinMax-1]={hACNoPS[1][k],hACNoPS[2][k],hACNoPS[3][k]}; | |
429 | TH1* hENoPSCent[centBinMax-1]={hENoPS[1][k],hENoPS[2][k],hENoPS[3][k]}; | |
430 | TH1* hBWithPSCent[centBinMax-1]={hBWithPS[1][k],hBWithPS[2][k],hBWithPS[3][k]}; | |
431 | ||
432 | cPhysSelCutCentrality[k] = ProcessCanvasPhysSelCutCentrality(triggersB, triggersAC, triggersE, hBNoPSCent, hACNoPSCent, hENoPSCent, hBWithPSCent, k, canvasName, colorInd, centLegendNameShort+1, isHeavyIon); | |
433 | cPhysSelCutCentrality[k]->Draw(); | |
434 | cPhysSelCutCentrality[k]->Print(OutFileNamePDF.Data()); | |
435 | cPhysSelCutCentrality[k]->Write(); | |
436 | ||
437 | } | |
438 | } | |
439 | ||
440 | ||
441 | cout<<"//==================================================================================="<<endl; | |
442 | cout<<"// new canvas for centrality percentile check (only in PbPb) "<<endl; | |
443 | cout<<"//==================================================================================="<<endl; | |
444 | ||
445 | if ( isHeavyIon ){ | |
446 | TCanvas *cCentralityCheck[10]; | |
447 | ||
448 | //loop over trigger | |
449 | for(k = 0; k < triggersB->GetEntriesFast(); k++){ | |
450 | //skip sum of all triggers | |
451 | if(k == (triggersB->GetEntriesFast()-1)) continue; | |
452 | //skip some triggers | |
453 | if( !IsTrigger(triggersB,k,"CMB")&&!IsTrigger(triggersB, k, "CPBI") ) continue; | |
454 | ||
455 | canvasName = "CentralityCheck_trigger"; | |
456 | canvasName +=k; | |
457 | ||
458 | TH1* hBNoPSCent[centBinMax-1]={hBNoPS[1][k],hBNoPS[2][k],hBNoPS[3][k]}; | |
459 | TH1* hBWithPSCent[centBinMax-1]={hBWithPS[1][k],hBWithPS[2][k],hBWithPS[3][k]}; | |
460 | ||
461 | cCentralityCheck[k] = ProcessCanvasCentralityPercentile(triggersB,hBNoPSCent,hBWithPSCent,k,canvasName,colorInd,centLegendNameShort+1 ); | |
462 | ||
463 | cCentralityCheck[k]->Draw(); | |
464 | cCentralityCheck[k]->Print(OutFileNamePDF.Data()); | |
465 | cCentralityCheck[k]->Write(); | |
466 | ||
467 | } | |
468 | } | |
469 | ||
470 | ||
93ce3c40 | 471 | |
005408df | 472 | cout<<"//==================================================================================="<<endl; |
473 | cout<<"// Ratio of tracks over trigger type (3 canvases) "<<endl; | |
474 | cout<<"//==================================================================================="<<endl; | |
475 | ||
476 | //Print a canvas per trigger type | |
93f182e7 | 477 | TCanvas *cTracksoverTrigger[centBinMax][10]; |
478 | TCanvas* cTrackMultB[centBinMax][10]; | |
479 | TCanvas* cRatioTrackB[centBinMax][10]; | |
005408df | 480 | |
93f182e7 | 481 | |
482 | ||
483 | //loop on centrality bin | |
484 | for ( centBin = 0; centBin < centBinMaxLoop; centBin++){ | |
485 | if ( isHeavyIon ) legendHeader = centLegendName[centBin]; | |
486 | //loop over trigger | |
487 | for(k = 0; k < triggersB->GetEntriesFast(); k++){ | |
488 | //skip sum of all triggers | |
489 | if(k == (triggersB->GetEntriesFast()-1)) continue; | |
490 | //skip some triggers | |
491 | if( !IsTrigger(triggersB, k, "INT") && !IsTrigger(triggersB, k, "MUS" ) && !IsTrigger(triggersB, k, "ANY") && !IsTrigger(triggersB,k,"CMB")&&!IsTrigger(triggersB, k, "CPBI") ) continue; | |
005408df | 492 | |
93f182e7 | 493 | canvasName = "RatioTrackTypes_cent"; |
494 | canvasName += centBin; | |
495 | canvasName +="trigger"; | |
496 | canvasName +=k; | |
497 | cTracksoverTrigger[centBin][k]= ProcessCanvasTracksoverTrigger(triggersB, hB[centBin], hTrackerB[centBin], hTriggerB[centBin], hMatchedB[centBin], hAllTracksB[centBin], k, canvasName,legendHeader); | |
498 | cTracksoverTrigger[centBin][k]->Draw(); | |
499 | cTracksoverTrigger[centBin][k]->Print(OutFileNamePDF.Data()); | |
500 | cTracksoverTrigger[centBin][k]->Write(); | |
501 | ||
502 | canvasName = "TrackMult_cent"; | |
503 | canvasName += centBin; | |
504 | canvasName +="trigger"; | |
505 | canvasName +=k; | |
506 | cTrackMultB[centBin][k]= ProcessCanvasTrackMultB(triggersB, hB[centBin], hTrackerB[centBin], hTriggerB[centBin], hMatchedB[centBin], hAllTracksB[centBin], k, canvasName, legendHeader); | |
507 | cTrackMultB[centBin][k]->Draw(); | |
508 | cTrackMultB[centBin][k]->Print(OutFileNamePDF.Data()); | |
509 | cTrackMultB[centBin][k]->Write(); | |
510 | ||
511 | canvasName = "RatioTrackB_cent"; | |
512 | canvasName += centBin; | |
513 | canvasName +="trigger"; | |
514 | canvasName +=k; | |
515 | cRatioTrackB[centBin][k]= ProcessCanvasRatioTrackB(triggersB, hB[centBin], hTrackerB[centBin], hTriggerB[centBin], hMatchedB[centBin], hAllTracksB[centBin], k, canvasName, legendHeader); | |
516 | cRatioTrackB[centBin][k]->Draw(); | |
517 | cRatioTrackB[centBin][k]->Print(OutFileNamePDF.Data()); | |
518 | cRatioTrackB[centBin][k]->Write(); | |
519 | } | |
b66f9801 | 520 | } |
005408df | 521 | |
522 | cout<<"//===================================================="<<endl; | |
523 | cout<<"// Draw matched tracks asymmetry for mus type trigger "<<endl; | |
524 | cout<<"//===================================================="<<endl; | |
525 | ||
526 | //Print a canvas per trigger type | |
93f182e7 | 527 | TCanvas *cAsymMatched[centBinMax][10]; |
528 | ||
529 | //Loop on centrality | |
530 | for ( centBin = 0; centBin < centBinMaxLoop; centBin++){ | |
531 | if ( isHeavyIon ) legendHeader = centLegendName[centBin]; | |
532 | //loop over trigger | |
533 | for(k = 0; k < triggersB->GetEntriesFast(); k++){ | |
534 | //skip sum of all triggers | |
535 | if(k == (triggersB->GetEntriesFast()-1)) continue; | |
536 | //skip some triggers | |
537 | if( !(IsTrigger(triggersB, k, "INT") || IsTrigger(triggersB, k, "MUS" ) || IsTrigger(triggersB,k,"CMB")|| IsTrigger(triggersB, k, "CPBI")) ) continue; | |
538 | ||
539 | canvasName = "AsymMatched"; | |
540 | canvasName += centBin; | |
541 | canvasName +="trigger"; | |
542 | canvasName +=k; | |
543 | cAsymMatched[centBin][k]= ProcessCanvasAsymMatched(triggersB, hPosMatchedB[centBin], hNegMatchedB[centBin], hAllMatchedB[centBin], k, canvasName,legendHeader); | |
544 | cAsymMatched[centBin][k]->Draw(); | |
545 | cAsymMatched[centBin][k]->Print(OutFileNamePDF.Data()); | |
546 | cAsymMatched[centBin][k]->Write(); | |
547 | } | |
005408df | 548 | } |
b66f9801 | 549 | cout<<"//=================================================="<<endl; |
550 | cout<<"// Draw high pt tracks per trigger"<<endl; | |
005408df | 551 | cout<<"//=================================================="<<endl; |
552 | ||
553 | //Print a canvas per trigger type | |
93f182e7 | 554 | TCanvas *cHighPtMuons[3][10]; |
555 | ||
556 | //Loop on centrality | |
557 | for ( centBin = 0; centBin < centBinMaxLoop; centBin++){ | |
558 | if ( isHeavyIon ) legendHeader = centLegendName[centBin]; | |
559 | //loop over trigger | |
560 | for(k = 0; k < triggersB->GetEntriesFast(); k++){ | |
561 | //skip sum of all triggers | |
562 | if(k == (triggersB->GetEntriesFast()-1)) continue; | |
563 | //skip some triggers | |
564 | if( !(IsTrigger(triggersB, k, "INT") || IsTrigger(triggersB, k, "MUS" ) || IsTrigger(triggersB,k,"CMB")|| IsTrigger(triggersB, k, "CPBI")) ) continue; | |
005408df | 565 | |
93f182e7 | 566 | canvasName = "HighPtMuons"; |
567 | canvasName += centBin; | |
568 | canvasName +="trigger"; | |
569 | canvasName +=k; | |
570 | ||
571 | cHighPtMuons[centBin][k]= ProcessCanvasHighPtMuons(triggersB, hB[centBin], hMatchedLowPtB[centBin], hMatchedHighPtB[centBin], k, canvasName,legendHeader); | |
572 | cHighPtMuons[centBin][k]->Draw(); | |
573 | cHighPtMuons[centBin][k]->Print(OutFileNamePDF.Data()); | |
574 | cHighPtMuons[centBin][k]->Write(); | |
575 | } | |
b66f9801 | 576 | } |
005408df | 577 | |
b66f9801 | 578 | // close merged file |
93ce3c40 | 579 | globalFile->Close(); |
b66f9801 | 580 | |
b66f9801 | 581 | //=================================================================================== |
582 | //Print out the number of trigger without and with Phys. Sel. | |
583 | //=================================================================================== | |
584 | ||
93f182e7 | 585 | centBin = 0; |
b66f9801 | 586 | cout << endl << endl; |
587 | //==================================================== | |
588 | if (PRINTSTAT){ | |
93f182e7 | 589 | if ( triggersB->At(kCMUS) ) { |
b66f9801 | 590 | |
93f182e7 | 591 | // set the format to print labels |
592 | THashList* labels = hBWithPS[centBin][kCMUS]->GetXaxis()->GetLabels(); | |
593 | TString format(Form("\n%%%ds %%9d",0)); | |
594 | Int_t nRuns=0; | |
b66f9801 | 595 | |
93f182e7 | 596 | // print value for each label |
597 | TObjString* label = 0x0; | |
598 | TIter nextLabel(labels); | |
599 | cout << "-------------------------------------------------" << endl; | |
600 | cout << "Run Number" << "\t Number of "<< ( (TObjString*) triggersB->At(kCMUS) )->GetString()<<" after Phys. Sel. " << endl ; | |
601 | while ((label = static_cast<TObjString*>(nextLabel()))) { | |
602 | nRuns++; | |
603 | Int_t bin = (Int_t) label->GetUniqueID(); | |
604 | printf(format.Data(), label->String().Data(), (Int_t) hBWithPS[centBin][kCMUS]->GetBinContent(bin)); | |
605 | } | |
606 | printf("\n========== Total #runs = %d ==============\n",nRuns); | |
607 | printf("\n\n"); | |
b66f9801 | 608 | |
b66f9801 | 609 | |
93f182e7 | 610 | cout << "-------------------------------------------------" << endl; |
611 | cout << "Total statistic" << endl; | |
612 | cout << " " << endl ; | |
613 | ||
614 | cout << "-------------------------------------------------------------------" << endl; | |
615 | cout<<"Number of triggers w/o Phys. Sel./ w/ Phys. Sel (Phys. Sel. cut in %)"<<endl; | |
616 | for(Int_t i = 0; i < triggersB->GetEntriesFast()-1; i++){ | |
617 | TString triggerNameB = ( (TObjString*) triggersB->At(i) )->GetString(); | |
618 | TString triggerNameAC = ( (TObjString*) triggersAC->At(i) )->GetString(); | |
619 | TString triggerNameE = ( (TObjString*) triggersE->At(i) )->GetString(); | |
005408df | 620 | |
93f182e7 | 621 | Int_t cutinpercent = 0; |
622 | printf("%10s %30s %30s\n",triggerNameB.Data(),triggerNameAC.Data(),triggerNameE.Data()); | |
623 | if(NumOfBNoPS[centBin][i]) cutinpercent = (Int_t) ((Double_t)(NumOfBNoPS[centBin][i]-NumOfBWithPS[centBin][i])/(NumOfBNoPS[centBin][i])*100.); | |
624 | printf("%5.2e / %.2e (%d%%)", (Double_t) NumOfBNoPS[centBin][i],(Double_t) NumOfBWithPS[centBin][i],cutinpercent); | |
625 | cutinpercent = 0; | |
626 | if(NumOfACNoPS[centBin][i]) cutinpercent = (Int_t) ((Double_t)(NumOfACNoPS[centBin][i]-NumOfACWithPS[centBin][i])/(NumOfACNoPS[centBin][i])*100.); | |
627 | printf("%15.2e / %.2e (%d%%)", (Double_t)NumOfACNoPS[centBin][i],(Double_t)NumOfACWithPS[centBin][i],cutinpercent); | |
628 | cutinpercent = 0; | |
629 | if(NumOfENoPS[centBin][i]) cutinpercent = (Int_t) ((Double_t)(NumOfENoPS[centBin][i]-NumOfEWithPS[centBin][i])/(NumOfENoPS[centBin][i])*100.); | |
630 | printf("%15.2e / %.2e (%d%%)\n", (Double_t)NumOfENoPS[centBin][i],(Double_t)NumOfEWithPS[centBin][i],cutinpercent); | |
005408df | 631 | |
93f182e7 | 632 | } |
633 | } | |
b66f9801 | 634 | } |
635 | ||
636 | ||
637 | //return; | |
005408df | 638 | |
b66f9801 | 639 | |
93ce3c40 | 640 | //--------------------------------------------- // |
641 | // monitor quantities run per run // | |
642 | //--------------------------------------------- // | |
b8e17107 | 643 | TH1F* hTriggerCutVsRun[2], *hTriggerCutWidthVsRun[2]; |
644 | for ( Int_t ihisto=0; ihisto<2; ++ihisto ) { | |
645 | TString cutName = ( ihisto == 0 ) ? "Lpt" : "Hpt"; | |
646 | hTriggerCutVsRun[ihisto] = new TH1F(Form("hTriggerCutVsRun%s", cutName.Data()), Form("Trigger %s cut per run", cutName.Data()), 10000,1,10000); | |
647 | hTriggerCutWidthVsRun[ihisto] = (TH1F*)hTriggerCutVsRun[ihisto]->Clone(Form("hTriggerCutWidthVsRun%s", cutName.Data())); | |
648 | } | |
005408df | 649 | TF1* fitMatchTrig = new TF1("fitMatchTrig","[3] + [0] * ( 1. + TMath::Erf((x - [1]) / [2]))", 0.1, 6.); |
93ce3c40 | 650 | TH1F* hNClustersPerTrackVsRun_Mean = new TH1F("hNClustersPerTrackVsRun_Mean", "averaged number of associated clusters per track;run;<n_{clusters}>",10000,1,10000); |
651 | TH1F* hNClustersPerTrackVsRun_Sigma = new TH1F("hNClustersPerTrackVsRun_Sigma", "dispersion of the number of associated clusters per track;run;#sigma_{n_{clusters}}",10000,1,10000); | |
652 | TH1F* hNChamberHitPerTrack_Mean = new TH1F("hNChamberHitPerTrack_Mean", "averaged number of chambers hit per track;run;<n_{chamber hit}>",10000,1,10000); | |
653 | TH1F* hNChamberHitPerTrack_Sigma = new TH1F("hNChamberHitPerTrack_Sigma", "dispersion of the number of chambers hit per track;run;#sigma_{n_{chamber hit}}",10000,1,10000); | |
654 | TH1F* hChi2_Mean = new TH1F("hChi2_Mean", "averaged normalized #chi^{2} distribution;run;<#chi^{2} / ndf>",10000,1,10000); | |
655 | TH1F* hChi2_Sigma = new TH1F("hChi2_Sigma", "dispersion of normalized #chi^{2} distribution;run;#sigma_{#chi^{2} / ndf}",10000,1,10000); | |
656 | TH1F* hNClustersInCh[10]; | |
4916d740 | 657 | for (Int_t ich=0; ich<10; ich++){ |
658 | 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); | |
659 | } | |
93ce3c40 | 660 | TH1F* hClusterHitMapXInCh[10]; |
4916d740 | 661 | for (Int_t ich=0; ich<10; ich++){ |
662 | hClusterHitMapXInCh[ich] = new TH1F(Form("hClusterHitMapXInCh%d",ich+1), Form("averaged cluster position distribution in chamber %d;X (cm)",ich+1),10000,1,10000); | |
663 | } | |
93ce3c40 | 664 | TH1F* hClusterHitMapYInCh[10]; |
4916d740 | 665 | for (Int_t ich=0; ich<10; ich++){ |
666 | hClusterHitMapYInCh[ich] = new TH1F(Form("hClusterHitMapYInCh%d",ich+1), Form("averaged cluster position distribution in chamber %d;Y (cm)",ich+1),10000,1,10000); | |
667 | } | |
93ce3c40 | 668 | Int_t ibin = 1; |
669 | ||
670 | // Are the runs stored locally or in alien? | |
671 | Int_t isAlienFile = 0; | |
672 | if(alienBaseDir.Contains("alien:")){ | |
673 | isAlienFile = 1; | |
674 | alienBaseDir.ReplaceAll("alien://",""); | |
675 | } | |
b66f9801 | 676 | cout<<"============================================================"<<endl; |
005408df | 677 | cout<< "Monitoring quantities run per run: loop over "<<runs->GetEntriesFast()<<" runs."<<endl; |
b66f9801 | 678 | cout<<" directory = "<<alienBaseDir.Data()<<endl; |
679 | cout<<"============================================================"<<endl; | |
93ce3c40 | 680 | // Loop over runs |
005408df | 681 | for ( Int_t irun=0; irun<runs->GetEntriesFast(); irun++ ) { |
93ce3c40 | 682 | |
005408df | 683 | TString run = ((TObjString*)runs->UncheckedAt(irun))->GetString(); |
684 | TString run2 = ((TObjString*)runs2->UncheckedAt(irun))->GetString(); | |
93ce3c40 | 685 | // get the file (or list of files) to be analyzed |
686 | TString command; | |
687 | TGridResult *res = 0; | |
688 | TObjString *objs = 0; | |
689 | ||
690 | if(isAlienFile){ | |
b66f9801 | 691 | command = Form("find %s/ %s/%s", alienBaseDir.Data(), run.Data(), QAFileName); |
93ce3c40 | 692 | res = gGrid->Command(command); |
693 | if (!res) { | |
93f182e7 | 694 | Error("PlotMuonQA","no result for the command: %s",command.Data()); |
93ce3c40 | 695 | return; |
696 | } | |
697 | } | |
698 | else{ | |
699 | res = new TGridResult(); | |
700 | ||
701 | if(runList){ | |
b66f9801 | 702 | objs = new TObjString(Form("%s/%s/%s", alienBaseDir.Data(), run2.Data(), QAFileName)); |
93ce3c40 | 703 | res->Add(objs); |
704 | } | |
705 | else { | |
706 | //loop over the directory to find the root files | |
707 | void *dir = gSystem->OpenDirectory(alienBaseDir.Data()); | |
708 | TString sDirFilename; | |
709 | Int_t iEntry=0, iFile=0; | |
93ce3c40 | 710 | while(kTRUE){ |
711 | iEntry++; | |
712 | const char* dirFilename = gSystem->GetDirEntry(dir); | |
713 | if(!dirFilename) break; | |
714 | sDirFilename = dirFilename; | |
715 | if(!sDirFilename.IsDigit()) continue; | |
716 | iFile++; | |
b66f9801 | 717 | objs = new TObjString(Form("%s/%s/%s", alienBaseDir.Data(), sDirFilename.Data(), QAFileName)); |
93ce3c40 | 718 | res->Add(objs); |
719 | } | |
720 | } | |
721 | } | |
722 | ||
723 | // Loop over 'find' results and get next LFN | |
724 | TIter nextmap(res); | |
725 | TMap *map = 0; | |
726 | ||
727 | //some checks | |
728 | Int_t iLoop=0, iLoopMax=200; | |
729 | while (kTRUE){ | |
730 | ||
731 | // get the current file url | |
732 | if(isAlienFile){ | |
733 | map=(TMap*)nextmap(); | |
734 | if(!map) break; | |
735 | objs = dynamic_cast<TObjString*>(map->GetValue("turl")); | |
736 | } | |
737 | else{ | |
738 | objs=(TObjString*)nextmap(); | |
739 | if(!objs) break; | |
740 | } | |
741 | //in case of infinite loop | |
742 | iLoop++; | |
743 | if(iLoop>iLoopMax) break; | |
744 | ||
745 | if (!objs || !objs->GetString().Length()) { | |
93f182e7 | 746 | Error("PlotMuonQA","turl/obj not found for the run %s... SKIPPING", run.Data()); |
93ce3c40 | 747 | continue; |
748 | } | |
749 | ||
750 | // open the outfile for this run | |
751 | TFile *runFile = TFile::Open(objs->GetString()); | |
752 | if (!runFile || ! runFile->IsOpen()) { | |
93f182e7 | 753 | Error("PlotMuonQA","failed to open file: %s", objs->GetName()); |
93ce3c40 | 754 | continue;//return; |
755 | } | |
756 | runFile->Cd("MUON_QA"); | |
757 | ||
758 | // get interesting histos | |
759 | TObjArray* general1 = static_cast<TObjArray*>(runFile->FindObjectAny("general1")); | |
4916d740 | 760 | TObjArray* general2 = static_cast<TObjArray*>(runFile->FindObjectAny("general2")); |
93ce3c40 | 761 | TObjArray* expert = static_cast<TObjArray*>(runFile->FindObjectAny("expert")); |
b66f9801 | 762 | |
4916d740 | 763 | if (!general1 || !general2 || !expert){ |
93f182e7 | 764 | Error("PlotMuonQA","All objects not here !!! ===> Skipping...for %s",objs->GetName()); |
4916d740 | 765 | continue; |
766 | } | |
b66f9801 | 767 | |
4916d740 | 768 | TH1* hNClustersPerTrack = static_cast<TH1*>(general1->FindObject("hNClustersPerTrack")); |
93ce3c40 | 769 | TH1* hNChamberHitPerTrack = static_cast<TH1*>(general1->FindObject("hNChamberHitPerTrack")); |
770 | TH1* hChi2 = static_cast<TH1*>(general1->FindObject("hChi2")); | |
4916d740 | 771 | TH1* hNClustersPerCh = static_cast<TH1*>(general2->FindObject("hNClustersPerCh")); |
b8e17107 | 772 | TH1* hPtDistrib = static_cast<TH1*>(general1->FindObject("hPt")); |
773 | TH1* hPtDistribLpt = static_cast<TH1*>(general1->FindObject("hPtMatchLpt")); | |
774 | TH1* hPtDistribHpt = static_cast<TH1*>(general1->FindObject("hPtMatchHpt")); | |
775 | if ( hPtDistrib && hPtDistribLpt && hPtDistribHpt ) { | |
776 | if ( hPtDistrib->GetSumw2N() == 0 ) hPtDistrib->Sumw2(); | |
777 | TH1* histoMatch[2] = {hPtDistribLpt, hPtDistribHpt}; | |
778 | for ( Int_t ihisto=0; ihisto<2; ++ihisto ) { | |
779 | if ( histoMatch[ihisto]->GetSumw2N() == 0 ) histoMatch[ihisto]->Sumw2(); | |
780 | if ( histoMatch[ihisto]->GetEntries() == 0 ) continue; | |
781 | histoMatch[ihisto]->Divide(hPtDistrib); | |
782 | Double_t minEff = 99999., maxEff = -1.; | |
783 | Double_t ptMinFit = 0.1; | |
784 | Double_t ptMaxFit = 6.; | |
785 | Int_t ptBinLow = histoMatch[ihisto]->GetXaxis()->FindBin(ptMinFit); | |
786 | Int_t ptBinHigh = histoMatch[ihisto]->GetXaxis()->FindBin(ptMaxFit); | |
787 | for ( Int_t currBin=ptBinLow; currBin<=ptBinHigh; currBin++ ) { | |
788 | Double_t currEff = histoMatch[ihisto]->GetBinContent(currBin); | |
789 | Double_t currPt = histoMatch[ihisto]->GetXaxis()->GetBinCenter(currBin); | |
790 | if ( currPt < 1.5 && minEff > currEff ) { | |
791 | ptMinFit = currPt; | |
792 | minEff = currEff; | |
793 | } | |
794 | if ( currPt > 0.5 && maxEff < currEff ) { | |
795 | ptMaxFit = currPt; | |
796 | maxEff = currEff; | |
797 | } | |
798 | } // loop on histo bins | |
799 | fitMatchTrig->SetParameters(0.5, 0.5, 0.8, 0.2); | |
800 | fitMatchTrig->SetParLimits(0,0.,1.); | |
801 | fitMatchTrig->SetParLimits(1,0.,5.); | |
802 | fitMatchTrig->SetParLimits(2,0.,5.); | |
803 | fitMatchTrig->SetParLimits(3,0.,0.5); | |
804 | histoMatch[ihisto]->Fit(fitMatchTrig,"RQ0","",ptMinFit,ptMaxFit); | |
805 | Double_t ptCut = fitMatchTrig->GetParameter(1); | |
806 | Double_t ptCutErr = fitMatchTrig->GetParError(1); | |
807 | Double_t ptCutWidth = fitMatchTrig->GetParameter(2); | |
808 | if ( ptCut < 0 || ptCut > 10. ) { | |
809 | ptCut = ptCutErr = ptCutWidth = 0.; | |
810 | } | |
811 | hTriggerCutVsRun[ihisto]->SetBinContent(ibin, ptCut); | |
812 | hTriggerCutVsRun[ihisto]->SetBinError(ibin, ptCutErr); | |
813 | hTriggerCutWidthVsRun[ihisto]->SetBinContent(ibin, ptCut); | |
814 | hTriggerCutWidthVsRun[ihisto]->SetBinError(ibin, ptCutWidth); | |
815 | } // loop on match histos | |
005408df | 816 | } |
93ce3c40 | 817 | TH2* hClusterHitMapInCh[10]; |
818 | for(Int_t ich=0; ich<10; ich++) hClusterHitMapInCh[ich] = static_cast<TH2*>(expert->FindObject(Form("hClusterHitMapInCh%d",ich+1))); | |
819 | ||
820 | // skip empty runs... not anymore ! cs ! | |
821 | if (!hNClustersPerCh) { | |
93f182e7 | 822 | Warning("PlotMUONQA","File: %s has empty histograms !", objs->GetName()); |
93ce3c40 | 823 | hNClustersPerTrackVsRun_Mean->SetBinContent(ibin, 0.); |
824 | hNClustersPerTrackVsRun_Mean->SetBinError(ibin, 1.); | |
825 | hNClustersPerTrackVsRun_Sigma->SetBinContent(ibin, 0.); | |
826 | hNClustersPerTrackVsRun_Sigma->SetBinError(ibin, 1.); | |
827 | hNChamberHitPerTrack_Mean->SetBinContent(ibin, 0.); | |
828 | hNChamberHitPerTrack_Mean->SetBinError(ibin, 1.); | |
829 | hNChamberHitPerTrack_Sigma->SetBinContent(ibin, 0.); | |
830 | hNChamberHitPerTrack_Sigma->SetBinError(ibin, 1.); | |
831 | hChi2_Mean->SetBinContent(ibin, 0.); | |
832 | hChi2_Mean->SetBinError(ibin, 1.); | |
833 | hChi2_Sigma->SetBinContent(ibin, 0.); | |
834 | hChi2_Sigma->SetBinError(ibin, 1.); | |
835 | for (Int_t ich=0; ich<10; ich++) { | |
836 | hNClustersInCh[ich]->SetBinContent(ibin,0.); | |
837 | hNClustersInCh[ich]->SetBinError(ibin,1.); | |
838 | hClusterHitMapXInCh[ich]->SetBinContent(ibin,0.); | |
839 | hClusterHitMapXInCh[ich]->SetBinError(ibin,1.); | |
840 | hClusterHitMapYInCh[ich]->SetBinContent(ibin,0.); | |
841 | hClusterHitMapYInCh[ich]->SetBinError(ibin,1.); | |
842 | } | |
843 | //runFile->Close(); | |
844 | //continue; | |
845 | } | |
846 | else { | |
847 | // fill monitoring plots | |
848 | hNClustersPerTrackVsRun_Mean->SetBinContent(ibin, hNClustersPerTrack->GetMean()); | |
849 | hNClustersPerTrackVsRun_Mean->SetBinError(ibin, hNClustersPerTrack->GetMeanError()); | |
850 | hNClustersPerTrackVsRun_Sigma->SetBinContent(ibin, hNClustersPerTrack->GetRMS()); | |
851 | hNClustersPerTrackVsRun_Sigma->SetBinError(ibin, hNClustersPerTrack->GetRMSError()); | |
852 | hNChamberHitPerTrack_Mean->SetBinContent(ibin, hNChamberHitPerTrack->GetMean()); | |
853 | hNChamberHitPerTrack_Mean->SetBinError(ibin, hNChamberHitPerTrack->GetMeanError()); | |
854 | hNChamberHitPerTrack_Sigma->SetBinContent(ibin, hNChamberHitPerTrack->GetRMS()); | |
855 | hNChamberHitPerTrack_Sigma->SetBinError(ibin, hNChamberHitPerTrack->GetRMSError()); | |
856 | hChi2_Mean->SetBinContent(ibin, hChi2->GetMean()); | |
857 | hChi2_Mean->SetBinError(ibin, hChi2->GetMeanError()); | |
858 | hChi2_Sigma->SetBinContent(ibin, hChi2->GetRMS()); | |
859 | hChi2_Sigma->SetBinError(ibin, hChi2->GetRMSError()); | |
860 | for (Int_t ich=0; ich<10; ich++) { | |
861 | hNClustersInCh[ich]->SetBinContent(ibin,hNClustersPerCh->GetBinContent(ich+1)); | |
862 | hNClustersInCh[ich]->SetBinError(ibin,hNClustersPerCh->GetBinError(ich+1)); | |
863 | hClusterHitMapXInCh[ich]->SetBinContent(ibin,hClusterHitMapInCh[ich]->GetMean(1)); | |
864 | hClusterHitMapXInCh[ich]->SetBinError(ibin,hClusterHitMapInCh[ich]->GetMeanError(1)); | |
865 | hClusterHitMapYInCh[ich]->SetBinContent(ibin,hClusterHitMapInCh[ich]->GetMean(2)); | |
4916d740 | 866 | hClusterHitMapYInCh[ich]->SetBinError(ibin,hClusterHitMapInCh[ich]->GetMeanError(2)); |
93ce3c40 | 867 | } |
868 | } | |
869 | ||
870 | // set labels | |
871 | run = objs->GetString(); | |
b66f9801 | 872 | run.ReplaceAll(Form("/%s",QAFileName), ""); |
873 | run.ReplaceAll(alienBaseDir, ""); | |
93ce3c40 | 874 | run.Remove(TString::kLeading, '/'); |
875 | run.Remove(TString::kLeading, '0'); | |
93f182e7 | 876 | for ( Int_t ihisto=0; ihisto<2; ++ihisto ) { |
877 | hTriggerCutVsRun[ihisto]->GetXaxis()->SetBinLabel(ibin,run.Data()); | |
878 | hTriggerCutWidthVsRun[ihisto]->GetXaxis()->SetBinLabel(ibin,run.Data()); | |
879 | } | |
93ce3c40 | 880 | hNClustersPerTrackVsRun_Mean->GetXaxis()->SetBinLabel(ibin, run.Data()); |
881 | hNClustersPerTrackVsRun_Sigma->GetXaxis()->SetBinLabel(ibin, run.Data()); | |
882 | hNChamberHitPerTrack_Mean->GetXaxis()->SetBinLabel(ibin, run.Data()); | |
883 | hNChamberHitPerTrack_Sigma->GetXaxis()->SetBinLabel(ibin, run.Data()); | |
884 | hChi2_Mean->GetXaxis()->SetBinLabel(ibin, run.Data()); | |
885 | hChi2_Sigma->GetXaxis()->SetBinLabel(ibin, run.Data()); | |
886 | for (Int_t ich=0; ich<10; ich++){ | |
887 | hNClustersInCh[ich]->GetXaxis()->SetBinLabel(ibin, run.Data()); | |
888 | hClusterHitMapXInCh[ich]->GetXaxis()->SetBinLabel(ibin, run.Data()); | |
889 | hClusterHitMapYInCh[ich]->GetXaxis()->SetBinLabel(ibin, run.Data()); | |
890 | } | |
005408df | 891 | |
93ce3c40 | 892 | // close outfile for this run |
893 | runFile->Close(); | |
894 | ibin++; | |
895 | } | |
896 | ||
897 | delete res; | |
898 | } | |
899 | ||
4916d740 | 900 | //sort label |
901 | hNClustersPerTrackVsRun_Mean->LabelsOption("a"); | |
902 | hNClustersPerTrackVsRun_Sigma->LabelsOption("a"); | |
903 | hNChamberHitPerTrack_Mean->LabelsOption("a"); | |
904 | hNChamberHitPerTrack_Sigma->LabelsOption("a"); | |
905 | hChi2_Mean->LabelsOption("a"); | |
906 | hChi2_Sigma->LabelsOption("a"); | |
907 | ||
908 | for(Int_t ich=0; ich<10; ich++){ | |
909 | hNClustersInCh[ich]->LabelsOption("a"); | |
910 | hClusterHitMapXInCh[ich]->LabelsOption("a"); | |
911 | hClusterHitMapYInCh[ich]->LabelsOption("a"); | |
005408df | 912 | } |
4916d740 | 913 | |
93ce3c40 | 914 | TString dirToGo = OutFileNameROOT.Data(); dirToGo+=":/"; |
915 | gDirectory->Cd(dirToGo.Data()); | |
916 | //================================================== | |
917 | //Display Mean and Sigma of the number of associated clusters to a track | |
918 | TLegend *lNClusters = new TLegend(0.75,0.85,0.99,0.99); | |
919 | lNClusters->AddEntry(hNClustersPerTrackVsRun_Mean,"clusters","PL"); | |
920 | lNClusters->AddEntry(hNChamberHitPerTrack_Mean,"chamber hit","PL"); | |
921 | ||
922 | TCanvas* cNClusters = new TCanvas("cNClusters","cNClusters",1200,900); | |
923 | cNClusters->Divide(1,2); | |
924 | cNClusters->cd(1); | |
925 | //hNClustersPerTrackVsRun_Mean->SetMaximum(11); | |
926 | hNClustersPerTrackVsRun_Mean->SetMinimum(7); | |
927 | hNClustersPerTrackVsRun_Mean->SetStats(kFALSE); | |
928 | hNClustersPerTrackVsRun_Mean->GetXaxis()->SetRange(1,ibin-1); | |
929 | hNClustersPerTrackVsRun_Mean->GetXaxis()->SetNdivisions(1,kFALSE); | |
930 | //hNClustersPerTrackVsRun_Mean->LabelsOption("u"); | |
4916d740 | 931 | hNClustersPerTrackVsRun_Mean->SetLabelSize(0.04); |
93ce3c40 | 932 | hNClustersPerTrackVsRun_Mean->SetTitle("averaged number of associated clusters or of the number of chamber hit per track"); |
933 | hNClustersPerTrackVsRun_Mean->SetLineWidth(2); | |
934 | hNClustersPerTrackVsRun_Mean->Draw("e"); | |
935 | hNChamberHitPerTrack_Mean->SetLineColor(kRed); | |
936 | hNChamberHitPerTrack_Mean->SetLineWidth(2); | |
937 | hNChamberHitPerTrack_Mean->Draw("esame"); | |
938 | lNClusters->Draw("same"); | |
939 | ||
940 | cNClusters->cd(2); | |
941 | //hNClustersPerTrackVsRun_Sigma->SetMaximum(1.1); | |
942 | hNClustersPerTrackVsRun_Sigma->SetMinimum(0.4); | |
943 | hNClustersPerTrackVsRun_Sigma->SetStats(kFALSE); | |
944 | hNClustersPerTrackVsRun_Sigma->GetXaxis()->SetRange(1,ibin-1); | |
945 | hNClustersPerTrackVsRun_Sigma->GetXaxis()->SetNdivisions(1,kFALSE); | |
946 | //hNClustersPerTrackVsRun_Sigma->LabelsOption("u"); | |
4916d740 | 947 | hNClustersPerTrackVsRun_Sigma->SetLabelSize(0.04); |
93ce3c40 | 948 | hNClustersPerTrackVsRun_Sigma->SetTitle("dispersion of the number of associated clusters or of the number of chamber hit per track"); |
949 | hNClustersPerTrackVsRun_Sigma->SetLineWidth(2); | |
950 | hNClustersPerTrackVsRun_Sigma->Draw("e"); | |
951 | hNChamberHitPerTrack_Sigma->SetLineWidth(2); | |
952 | hNChamberHitPerTrack_Sigma->SetLineColor(kRed); | |
953 | hNChamberHitPerTrack_Sigma->Draw("esame"); | |
954 | lNClusters->Draw("same"); | |
955 | ||
956 | cNClusters->Print(OutFileNamePDF.Data()); | |
957 | cNClusters->Write(); | |
958 | ||
959 | ||
960 | //================================================== | |
961 | // Display average number of cluster per chamber | |
962 | TLegend *lNClustersPerCh = new TLegend(0.92,0.45,0.99,0.99); | |
963 | TCanvas* cNClustersPerCh = new TCanvas("cNClustersPerCh","cNClustersPerCh",1200,900); | |
964 | cNClustersPerCh->cd(); | |
965 | cNClustersPerCh->SetRightMargin(0.1); | |
966 | hNClustersInCh[0]->SetStats(kFALSE); | |
967 | hNClustersInCh[0]->GetXaxis()->SetRange(1,ibin-1); | |
968 | hNClustersInCh[0]->GetXaxis()->SetNdivisions(1,kFALSE); | |
969 | //hNClustersInCh[0]->LabelsOption("u"); | |
b66f9801 | 970 | hNClustersInCh[0]->SetLabelSize(0.02); |
93ce3c40 | 971 | hNClustersInCh[0]->SetTitle("averaged number of clusters in chamber i per track"); |
972 | hNClustersInCh[0]->SetMaximum(1.2); | |
973 | hNClustersInCh[0]->SetMinimum(0.01); | |
974 | for (Int_t ich=0; ich<10; ich++) { | |
975 | hNClustersInCh[ich]->SetLineColor(ich+1+ich/9); | |
976 | hNClustersInCh[ich]->SetLineWidth(2); | |
977 | if (ich == 0) hNClustersInCh[ich]->Draw("e"); | |
978 | else hNClustersInCh[ich]->Draw("esame"); | |
979 | lNClustersPerCh->AddEntry(hNClustersInCh[ich],Form("ch%d",ich+1),"PL"); | |
980 | } | |
981 | lNClustersPerCh->Draw("same"); | |
982 | ||
983 | cNClustersPerCh->Print(OutFileNamePDF.Data()); | |
984 | cNClustersPerCh->Write(); | |
985 | ||
986 | //================================================== | |
987 | // Display average X and Y position of clusters per chamber | |
988 | TLegend *lClusterHitMapPerCh = new TLegend(0.92,0.45,0.99,0.99); | |
989 | TCanvas* cClusterHitMapPerCh = new TCanvas("cClusterHitMapPerCh","cClusterHitMapPerCh",1200,900); | |
990 | cClusterHitMapPerCh->Divide(1,2); | |
991 | cClusterHitMapPerCh->GetPad(1)->SetRightMargin(0.1); | |
992 | cClusterHitMapPerCh->GetPad(2)->SetRightMargin(0.1); | |
993 | ||
994 | cClusterHitMapPerCh->cd(1); | |
995 | hClusterHitMapXInCh[0]->SetStats(kFALSE); | |
996 | hClusterHitMapXInCh[0]->GetXaxis()->SetRange(1,ibin-1); | |
997 | hClusterHitMapXInCh[0]->GetXaxis()->SetNdivisions(1,kFALSE); | |
998 | //hNClustersInCh[0]->LabelsOption("u"); | |
4916d740 | 999 | hClusterHitMapXInCh[0]->SetLabelSize(0.04); |
93ce3c40 | 1000 | hClusterHitMapXInCh[0]->SetTitle("<X> of clusters - associated to a track - in chamber i"); |
1001 | hClusterHitMapXInCh[0]->SetMaximum(30); | |
1002 | hClusterHitMapXInCh[0]->SetMinimum(-30); | |
1003 | for (Int_t ich=0; ich<10; ich++) { | |
1004 | hClusterHitMapXInCh[ich]->SetLineColor(ich+1+ich/9); | |
1005 | hClusterHitMapXInCh[ich]->SetLineWidth(2); | |
1006 | if (ich == 0) hClusterHitMapXInCh[ich]->Draw("e"); | |
1007 | else hClusterHitMapXInCh[ich]->Draw("esame"); | |
1008 | ||
1009 | lClusterHitMapPerCh->AddEntry(hClusterHitMapXInCh[ich],Form("ch%d",ich+1),"PL"); | |
1010 | } | |
1011 | lClusterHitMapPerCh->Draw("same"); | |
1012 | ||
1013 | cClusterHitMapPerCh->cd(2); | |
1014 | hClusterHitMapYInCh[0]->SetStats(kFALSE); | |
1015 | hClusterHitMapYInCh[0]->GetXaxis()->SetRange(1,ibin-1); | |
1016 | hClusterHitMapYInCh[0]->GetXaxis()->SetNdivisions(1,kFALSE); | |
1017 | //hNClustersInCh[0]->LabelsOption("u"); | |
4916d740 | 1018 | hClusterHitMapYInCh[0]->SetLabelSize(0.04); |
93ce3c40 | 1019 | hClusterHitMapYInCh[0]->SetTitle("<Y> of clusters - associated to a track - in chamber i"); |
1020 | hClusterHitMapYInCh[0]->SetMaximum(30); | |
1021 | hClusterHitMapYInCh[0]->SetMinimum(-30); | |
1022 | for (Int_t ich=0; ich<10; ich++) { | |
1023 | hClusterHitMapYInCh[ich]->SetLineColor(ich+1+ich/9); | |
1024 | hClusterHitMapYInCh[ich]->SetLineWidth(2); | |
1025 | if (ich == 0) hClusterHitMapYInCh[ich]->Draw("e"); | |
1026 | else hClusterHitMapYInCh[ich]->Draw("esame"); | |
1027 | } | |
1028 | lClusterHitMapPerCh->Draw("same"); | |
1029 | ||
1030 | cClusterHitMapPerCh->Print(OutFileNamePDF.Data()); | |
1031 | cClusterHitMapPerCh->Write(); | |
1032 | ||
1033 | ||
1034 | //================================================== | |
1035 | // Display tracks ChiSquare | |
1036 | TCanvas* cChi2 = new TCanvas("cChi2","cChi2",1200,900); | |
1037 | cChi2->Divide(1,2); | |
1038 | cChi2->cd(1); | |
1039 | hChi2_Mean->SetStats(kFALSE); | |
1040 | hChi2_Mean->GetXaxis()->SetRange(1,ibin-1); | |
1041 | hChi2_Mean->GetXaxis()->SetNdivisions(1,kFALSE); | |
1042 | //hChi2_Mean->LabelsOption("u"); | |
4916d740 | 1043 | hChi2_Mean->SetLabelSize(0.04); |
93ce3c40 | 1044 | hChi2_Mean->SetLineWidth(2); |
1045 | hChi2_Mean->Draw("e"); | |
1046 | ||
1047 | cChi2->cd(2); | |
1048 | hChi2_Sigma->SetStats(kFALSE); | |
1049 | hChi2_Sigma->GetXaxis()->SetRange(1,ibin-1); | |
1050 | hChi2_Sigma->GetXaxis()->SetNdivisions(1,kFALSE); | |
1051 | //hChi2_Sigma->LabelsOption("u"); | |
4916d740 | 1052 | hChi2_Sigma->SetLabelSize(0.04); |
93ce3c40 | 1053 | hChi2_Sigma->SetLineWidth(2); |
1054 | hChi2_Sigma->Draw("e"); | |
1055 | ||
1056 | cChi2->Print(OutFileNamePDF.Data()); | |
1057 | cChi2->Write(); | |
005408df | 1058 | |
b8e17107 | 1059 | //================================================== |
1060 | // Display track Lpt/Hpt | |
1061 | if ( hTriggerCutVsRun[0] && hTriggerCutVsRun[1] ) { | |
1062 | TCanvas* cLptHpt = new TCanvas("cLptHpt","cLptHpt",1200,900); | |
1063 | cLptHpt->Divide(1,2); | |
1064 | TLegend* legLptHpt = new TLegend(0.72,0.7,0.9,0.85); | |
1065 | legLptHpt->SetBorderSize(1); | |
1066 | for ( Int_t ihisto=0; ihisto<2; ++ihisto) { | |
1067 | cLptHpt->cd(ihisto+1); | |
1068 | TH1* currHistos[2] = {hTriggerCutVsRun[ihisto], hTriggerCutWidthVsRun[ihisto]}; | |
1069 | for ( Int_t jhisto=0; jhisto<2; jhisto++ ) { | |
1070 | currHistos[jhisto]->GetXaxis()->SetRange(1,ibin-1); | |
1071 | currHistos[jhisto]->GetYaxis()->SetRangeUser(0.,5.); | |
1072 | currHistos[jhisto]->LabelsOption("a"); | |
1073 | currHistos[jhisto]->SetStats(kFALSE); | |
1074 | currHistos[jhisto]->GetXaxis()->SetLabelSize(0.04); | |
1075 | currHistos[jhisto]->SetLineWidth(2); | |
1076 | } | |
1077 | hTriggerCutWidthVsRun[ihisto]->SetLineColor(2); | |
1078 | hTriggerCutWidthVsRun[ihisto]->SetMarkerColor(2); | |
1079 | hTriggerCutWidthVsRun[ihisto]->SetFillColor(2); | |
1080 | hTriggerCutWidthVsRun[ihisto]->SetFillStyle(3001); | |
1081 | hTriggerCutWidthVsRun[ihisto]->Draw("e2"); | |
1082 | hTriggerCutVsRun[ihisto]->Draw("esame"); | |
1083 | if ( ihisto == 0 ) { | |
1084 | legLptHpt->AddEntry(hTriggerCutWidthVsRun[ihisto],"Fit width","f"); | |
1085 | legLptHpt->AddEntry(hTriggerCutVsRun[ihisto],"pt cut from fit (stat error)","lp"); | |
1086 | legLptHpt->Draw("same"); | |
1087 | } | |
1088 | } | |
1089 | cLptHpt->Print(OutFileNamePDF.Data()); | |
1090 | cLptHpt->Write(); | |
1091 | } | |
005408df | 1092 | |
1093 | ||
93ce3c40 | 1094 | // close the PDF file |
1095 | c1->Print(OutFileNamePDF_close.Data()); | |
1096 | rootFileOut->Close(); | |
005408df | 1097 | |
1098 | ||
1099 | ||
1100 | delete runs; | |
1101 | delete runs2; | |
1102 | delete triggersB; | |
1103 | delete triggersAC; | |
1104 | delete triggersE; | |
1105 | ||
b66f9801 | 1106 | return; |
93ce3c40 | 1107 | |
93ce3c40 | 1108 | } |
005408df | 1109 | |
1110 | void SetCanvas(TCanvas *canvas, Int_t logy){ | |
1111 | ||
1112 | if(!canvas) return; | |
1113 | canvas->SetTopMargin(0.05); | |
1114 | canvas->SetRightMargin(0.01); | |
1115 | canvas->SetGridy(1); | |
1116 | canvas->SetLogy(logy); | |
1117 | ||
1118 | return; | |
1119 | } | |
1120 | ||
1121 | Bool_t IsTrigger(TObjArray *array, Int_t index, TString name){ | |
1122 | ||
1123 | Bool_t process = kFALSE; | |
1124 | ||
1125 | if( !array) return process; | |
1126 | ||
1127 | TString triggerName = (( (TObjString*) array->At(index) )->GetString()); | |
1128 | ||
1129 | if( triggerName.Contains(name) ) process = kTRUE; | |
1130 | ||
1131 | return process; | |
1132 | } | |
1133 | ||
93f182e7 | 1134 | Bool_t IsHeavyIonCollision(AliCounterCollection *eventCounters){ |
1135 | ||
1136 | if(!eventCounters) return kFALSE; | |
1137 | ||
1138 | Double_t sum = eventCounters->GetSum("v0mult:low,int,high"); | |
1139 | Bool_t result = kTRUE; | |
1140 | if(sum<=0) result = kFALSE; | |
1141 | ||
1142 | cout<<" Collision type is set to "; | |
1143 | if( result == kFALSE) cout<<"p-p"<<endl; | |
1144 | else cout<<"heavy-ion"<<endl; | |
1145 | ||
1146 | return result; | |
1147 | } | |
1148 | ||
005408df | 1149 | TCanvas *ProcessCanvasTriggerContent(TObjArray *array, TH1 **hBNoPS, TH1 **hBWithPS, TString canvasName){ |
1150 | ||
1151 | if(!array || !hBNoPS || !hBWithPS) return 0x0; | |
b66f9801 | 1152 | |
005408df | 1153 | TString cName = "c"; |
1154 | cName += canvasName; | |
1155 | TCanvas *cTriggerContent = new TCanvas(canvasName,cName,1200,900); | |
1156 | SetCanvas(cTriggerContent); | |
1157 | cTriggerContent->cd(); | |
1158 | ||
1159 | TLegend* legcTC = new TLegend(0.2,0.15,0.50,0.40); | |
1160 | legcTC->SetHeader("Physics Selection"); | |
1161 | legcTC->AddEntry(".","applied :",""); | |
b66f9801 | 1162 | |
005408df | 1163 | for(Int_t i = 0; i < array->GetEntriesFast(); i++){ |
1164 | //skip the sum of all triggers | |
93f182e7 | 1165 | if( i == (array->GetEntriesFast()-1) ) continue; |
005408df | 1166 | hBNoPS[i]->SetLineStyle(2); |
1167 | if(i==0){ | |
1168 | hBNoPS[i]->SetMinimum(1e-3); | |
1169 | hBNoPS[i]->Draw(); | |
1170 | hBWithPS[i]->Draw("same"); | |
1171 | } | |
1172 | else{ | |
1173 | hBNoPS[i]->Draw("same"); | |
1174 | hBWithPS[i]->Draw("same"); | |
1175 | } | |
1176 | legcTC->AddEntry(hBWithPS[i],(( (TObjString*) array->At(i) )->GetString()).Data(),"l"); | |
1177 | } | |
1178 | legcTC->AddEntry(".","not applied :",""); | |
1179 | ||
1180 | for(Int_t i = 0; i < array->GetEntriesFast(); i++){ | |
1181 | legcTC->AddEntry(hBNoPS[i],(( (TObjString*) array->At(i) )->GetString()).Data(),"l"); | |
1182 | } | |
1183 | ||
1184 | legcTC->Draw("same"); | |
1185 | ||
1186 | return cTriggerContent; | |
1187 | } | |
1188 | ||
1189 | TCanvas *ProcessCanvasRelativeTriggerContent(TObjArray *triggersB, TH1 **histo, TString canvasName, Int_t *colorInd){ | |
1190 | ||
1191 | if(!triggersB || !histo || !colorInd) return 0x0; | |
1192 | ||
1193 | TString cName = "c" ; | |
1194 | cName += canvasName; | |
1195 | TCanvas *cRelativeTriggerContent = new TCanvas(canvasName,cName,1200,900); | |
1196 | SetCanvas(cRelativeTriggerContent); | |
1197 | cRelativeTriggerContent->cd(); | |
1198 | ||
1199 | TH1* ratio[10]; | |
1200 | TLegend* legcRTC = new TLegend(0.2,0.15,0.50,0.40); | |
1201 | legcRTC->SetHeader("Physics Selection"); | |
1202 | ||
1203 | TString hName, hTriggerName; | |
1204 | Int_t indAllTrig = triggersB->GetEntriesFast()-1; | |
1205 | cout<<indAllTrig<<endl; | |
1206 | for(Int_t i = 0; i < triggersB->GetEntriesFast()-1; i++){ | |
1207 | hName = "ratio"; | |
1208 | hName += ( (TObjString*) triggersB->At(i) )->GetString(); | |
1209 | ratio[i] = static_cast<TH1*> (histo[i]->Clone(hName)); | |
1210 | ratio[i]->Divide(histo[indAllTrig]); | |
1211 | ratio[i]->SetLineWidth(2); | |
1212 | ratio[i]->SetLineColor(colorInd[i]); | |
1213 | if(i==0){ | |
1214 | ratio[i]->SetMaximum(1.5); | |
1215 | ratio[i]->SetMinimum(0.001); | |
1216 | ratio[i]->SetLabelSize(0.02); | |
1217 | ratio[i]->GetYaxis()->SetTitle("Relative trigger content"); | |
1218 | ratio[i]->Draw("E"); | |
1219 | } | |
1220 | else{ | |
1221 | ratio[i]->Draw("ESAME"); | |
1222 | } | |
1223 | } | |
1224 | ||
1225 | legcRTC->AddEntry(".","not applied :",""); | |
1226 | for(Int_t i = 0; i < triggersB->GetEntriesFast()-1; i++){ | |
1227 | legcRTC->AddEntry(ratio[i],(( (TObjString*) triggersB->At(i) )->GetString()).Data(),"l"); | |
1228 | } | |
1229 | legcRTC->Draw("same"); | |
1230 | ||
1231 | return cRelativeTriggerContent; | |
1232 | } | |
1233 | ||
93f182e7 | 1234 | TCanvas *ProcessCanvasPhysSelCut(TObjArray *triggersB, TObjArray *triggersAC, TObjArray *triggersE, TH1 **hBNoPS, TH1 **hACNoPS, TH1 **hENoPS, TH1 **hBWithPS, TString canvasName, Int_t *colorInd, Bool_t isHeavyIon){ |
005408df | 1235 | |
1236 | if(!triggersB || !triggersE || !triggersAC || !hBNoPS || !hACNoPS || !hENoPS || !hBWithPS || !colorInd) return 0x0; | |
1237 | ||
93f182e7 | 1238 | //Multiplicative factor for A,C and E triggers |
1239 | Float_t scale = 3; //3 for pp - 10 for PbPb | |
1240 | if(isHeavyIon) scale = 10; | |
1241 | ||
005408df | 1242 | TString cName = "c"; |
1243 | cName += canvasName; | |
1244 | TCanvas *c1 = new TCanvas(canvasName,cName,1200,900); | |
1245 | SetCanvas(c1); | |
1246 | c1->cd(); | |
1247 | ||
1248 | TH1* ratioB[10], *ratioBNoPS[10]; | |
1249 | TH1* ratioACNoPS[10]; | |
1250 | TH1* ratioENoPS[10]; | |
1251 | TLegend* legcRTC = new TLegend(0.2,0.15,0.50,0.40); | |
1252 | legcRTC->SetHeader("Physics Selection"); | |
1253 | ||
1254 | TString hName; | |
1255 | for(Int_t i = 0; i < triggersB->GetEntriesFast()-1; i++){ | |
93f182e7 | 1256 | |
1257 | //scale A, C and E triggers | |
1258 | hACNoPS[i]->Scale(scale); | |
1259 | hENoPS[i]->Scale(scale); | |
1260 | ||
005408df | 1261 | hName = "ratio"; |
1262 | hName += ( (TObjString*) triggersB->At(i) )->GetString(); | |
1263 | ratioB[i] = static_cast<TH1*> (hBWithPS[i]->Clone(hName)); | |
1264 | ratioB[i]->Divide(hBNoPS[i]); | |
1265 | ratioB[i]->SetLineWidth(2); | |
1266 | ratioB[i]->SetLineColor(colorInd[i]); | |
1267 | hName = "ratioNoPS"; | |
1268 | hName += ( (TObjString*) triggersB->At(i) )->GetString(); | |
1269 | ratioBNoPS[i] = static_cast<TH1*> (hBNoPS[i]->Clone(hName)); | |
1270 | ratioBNoPS[i]->Divide(hBNoPS[i]); | |
1271 | ratioBNoPS[i]->SetLineWidth(0); | |
1272 | ratioBNoPS[i]->SetLineStyle(1); | |
1273 | ratioBNoPS[i]->SetMarkerStyle(24+i); | |
1274 | ratioBNoPS[i]->SetMarkerSize(1); | |
1275 | ratioBNoPS[i]->SetLineColor(colorInd[i]); | |
1276 | ratioBNoPS[i]->SetMarkerColor(colorInd[i]); | |
1277 | ||
1278 | hName = "ratioACNoPS"; | |
1279 | hName += ( (TObjString*) triggersAC->At(i) )->GetString(); | |
1280 | ratioACNoPS[i] = static_cast<TH1*> (hACNoPS[i]->Clone(hName)); | |
1281 | ratioACNoPS[i]->Divide(hBNoPS[i]); | |
1282 | ratioACNoPS[i]->SetLineWidth(0); | |
1283 | ratioACNoPS[i]->SetLineStyle(2); | |
1284 | ratioACNoPS[i]->SetMarkerStyle(24+i); | |
1285 | ratioACNoPS[i]->SetMarkerSize(1); | |
1286 | ratioACNoPS[i]->SetLineColor(colorInd[i]); | |
1287 | ratioACNoPS[i]->SetMarkerColor(colorInd[i]); | |
1288 | ||
1289 | ||
1290 | hName = "ratioENoPS"; | |
1291 | hName += ( (TObjString*) triggersE->At(i) )->GetString(); | |
1292 | ratioENoPS[i] = static_cast<TH1*> (hENoPS[i]->Clone(hName)); | |
1293 | ratioENoPS[i]->Divide(hBNoPS[i]); | |
1294 | ratioENoPS[i]->SetLineWidth(0); | |
1295 | ratioENoPS[i]->SetLineStyle(3); | |
1296 | ratioENoPS[i]->SetMarkerStyle(24+i); | |
1297 | ratioENoPS[i]->SetMarkerSize(1); | |
1298 | ratioENoPS[i]->SetLineColor(colorInd[i]); | |
1299 | ratioENoPS[i]->SetMarkerColor(colorInd[i]); | |
1300 | ||
1301 | ||
1302 | if(i==0){ | |
1303 | ratioB[i]->SetMaximum(1.5); | |
93f182e7 | 1304 | ratioB[i]->SetMinimum(0.05); |
005408df | 1305 | ratioB[i]->SetLabelSize(0.02); |
93f182e7 | 1306 | ratioB[i]->GetYaxis()->SetTitle("Accepted / All from Phys. Sel."); |
1307 | ratioB[i]->SetTitle("Phys. Sel. for all selected triggers"); | |
005408df | 1308 | ratioB[i]->Draw("E"); |
1309 | //ratioBNoPS[i]->Draw("EPSAME"); | |
1310 | ratioACNoPS[i]->Draw("EPSAME"); | |
1311 | ratioENoPS[i]->Draw("EPSAME"); | |
1312 | } | |
1313 | else{ | |
1314 | ratioB[i]->Draw("ESAME"); | |
1315 | //ratioBNoPS[i]->Draw("EPSAME"); | |
1316 | ratioACNoPS[i]->Draw("EPSAME"); | |
1317 | ratioENoPS[i]->Draw("EPSAME"); | |
1318 | } | |
1319 | } | |
1320 | ||
1321 | legcRTC->AddEntry(".","applied :",""); | |
1322 | for(Int_t i = 0; i < triggersB->GetEntriesFast()-1; i++){ | |
1323 | legcRTC->AddEntry(ratioB[i],(( (TObjString*) triggersB->At(i) )->GetString()).Data(),"l"); | |
1324 | } | |
1325 | legcRTC->AddEntry(".","not applied :",""); | |
1326 | for(Int_t i = 0; i < triggersB->GetEntriesFast()-1; i++){ | |
1327 | //legcRTC->AddEntry(ratioBNoPS[i],(( (TObjString*) triggersB->At(i) )->GetString()).Data(),"pl"); | |
93f182e7 | 1328 | TString textLegend = ( (TObjString*) triggersAC->At(i) )->GetString(); |
1329 | if( textLegend.CompareTo(" ") ){ | |
1330 | textLegend += " x"; | |
1331 | textLegend += scale; | |
1332 | legcRTC->AddEntry(ratioACNoPS[i],textLegend.Data(),"pl"); | |
1333 | } | |
1334 | textLegend = ( (TObjString*) triggersE->At(i) )->GetString(); | |
1335 | if( textLegend.CompareTo(" ") ){ | |
1336 | //cout<<"trigger="<<textLegend.Data()<<"-"<<endl; | |
1337 | textLegend += " x"; | |
1338 | textLegend += scale; | |
1339 | legcRTC->AddEntry(ratioENoPS[i],textLegend.Data(),"pl"); | |
1340 | } | |
1341 | } | |
1342 | legcRTC->Draw("same"); | |
1343 | ||
1344 | ||
1345 | return c1; | |
1346 | } | |
1347 | ||
1348 | TCanvas *ProcessCanvasPhysSelCutCentrality(TObjArray *triggersB, TObjArray *triggersAC, TObjArray *triggersE, TH1 **hBNoPSCent, TH1 **hACNoPSCent, TH1 **hENoPSCent, TH1 **hBWithPSCent, Int_t k, TString canvasName, Int_t *colorInd, TString *legendHeader, Bool_t isHeavyIon){ | |
1349 | ||
1350 | if(!triggersB || !triggersE || !triggersAC || !hBNoPSCent || !hACNoPSCent || !hENoPSCent || !hBWithPSCent || !colorInd || !legendHeader) return 0x0; | |
1351 | ||
1352 | //Multiplicative factor for A,C and E triggers | |
1353 | Float_t scale = 3; //3 for pp - 10 for PbPb | |
1354 | if(isHeavyIon) scale = 10; | |
1355 | ||
1356 | TString cName = "c"; | |
1357 | cName += canvasName; | |
1358 | TCanvas *c1 = new TCanvas(canvasName,cName,1200,900); | |
1359 | SetCanvas(c1); | |
1360 | c1->cd(); | |
1361 | ||
1362 | Int_t const centBinMax =3; | |
1363 | TH1* ratioB[centBinMax], *ratioBNoPS[centBinMax]; | |
1364 | TH1* ratioACNoPS[centBinMax]; | |
1365 | TH1* ratioENoPS[centBinMax]; | |
1366 | TLegend* legcRTC = new TLegend(0.2,0.15,0.50,0.40); | |
1367 | legcRTC->SetHeader("Physics Selection"); | |
1368 | ||
1369 | TString hName; | |
1370 | ||
1371 | Float_t yMin = 0.05, yMax = 2; | |
1372 | ||
1373 | for(Int_t centBin = 0; centBin < centBinMax; centBin++){ | |
1374 | //scale A, C and E triggers | |
1375 | hACNoPSCent[centBin]->Scale(scale); | |
1376 | hENoPSCent[centBin]->Scale(scale); | |
1377 | ||
1378 | hName = "ratio"; | |
1379 | hName += ( (TObjString*) triggersB->At(k) )->GetString(); | |
1380 | ratioB[centBin] = static_cast<TH1*> (hBWithPSCent[centBin]->Clone(hName)); | |
1381 | ratioB[centBin]->Divide(hBNoPSCent[centBin]); | |
1382 | ratioB[centBin]->SetLineWidth(2); | |
1383 | ratioB[centBin]->SetLineColor(colorInd[centBin]); | |
1384 | hName = "ratioNoPS"; | |
1385 | hName += ( (TObjString*) triggersB->At(k) )->GetString(); | |
1386 | ratioBNoPS[centBin] = static_cast<TH1*> (hBNoPSCent[centBin]->Clone(hName)); | |
1387 | ratioBNoPS[centBin]->Divide(hBNoPSCent[centBin]); | |
1388 | ratioBNoPS[centBin]->SetLineWidth(0); | |
1389 | ratioBNoPS[centBin]->SetLineStyle(1); | |
1390 | ratioBNoPS[centBin]->SetMarkerStyle(24+centBin); | |
1391 | ratioBNoPS[centBin]->SetMarkerSize(1); | |
1392 | ratioBNoPS[centBin]->SetLineColor(colorInd[centBin]); | |
1393 | ratioBNoPS[centBin]->SetMarkerColor(colorInd[centBin]); | |
1394 | ||
1395 | hName = "ratioACNoPS"; | |
1396 | hName += ( (TObjString*) triggersAC->At(k) )->GetString(); | |
1397 | ratioACNoPS[centBin] = static_cast<TH1*> (hACNoPSCent[centBin]->Clone(hName)); | |
1398 | ratioACNoPS[centBin]->Divide(hBNoPSCent[centBin]); | |
1399 | ratioACNoPS[centBin]->SetLineWidth(0); | |
1400 | ratioACNoPS[centBin]->SetLineStyle(2); | |
1401 | ratioACNoPS[centBin]->SetMarkerStyle(24+centBin); | |
1402 | ratioACNoPS[centBin]->SetMarkerSize(1); | |
1403 | ratioACNoPS[centBin]->SetLineColor(colorInd[centBin]); | |
1404 | ratioACNoPS[centBin]->SetMarkerColor(colorInd[centBin]); | |
1405 | ||
1406 | ||
1407 | hName = "ratioENoPS"; | |
1408 | hName += ( (TObjString*) triggersE->At(k) )->GetString(); | |
1409 | ratioENoPS[centBin] = static_cast<TH1*> (hENoPSCent[centBin]->Clone(hName)); | |
1410 | ratioENoPS[centBin]->Divide(hBNoPSCent[centBin]); | |
1411 | ratioENoPS[centBin]->SetLineWidth(0); | |
1412 | ratioENoPS[centBin]->SetLineStyle(3); | |
1413 | ratioENoPS[centBin]->SetMarkerStyle(24+centBin); | |
1414 | ratioENoPS[centBin]->SetMarkerSize(1); | |
1415 | ratioENoPS[centBin]->SetLineColor(colorInd[centBin]); | |
1416 | ratioENoPS[centBin]->SetMarkerColor(colorInd[centBin]); | |
1417 | ||
1418 | ||
1419 | if(centBin==0){ | |
1420 | ratioB[centBin]->SetMaximum(yMax); | |
1421 | ratioB[centBin]->SetMinimum(yMin); | |
1422 | ratioB[centBin]->SetLabelSize(0.02); | |
1423 | ratioB[centBin]->GetYaxis()->SetTitle("Accepted / All from Phys. Sel."); | |
1424 | ratioB[centBin]->SetTitle(Form("Phys. Sel. for %s - Multiplicity from V0 amplitude",(( (TObjString*) triggersB->At(k) )->GetString()).Data() )); | |
1425 | ratioB[centBin]->Draw("E"); | |
1426 | //ratioBNoPS[centBin]->Draw("EPSAME"); | |
1427 | ratioACNoPS[centBin]->Draw("EPSAME"); | |
1428 | ratioENoPS[centBin]->Draw("EPSAME"); | |
1429 | } | |
1430 | else{ | |
1431 | ratioB[centBin]->Draw("ESAME"); | |
1432 | //ratioBNoPS[centBin]->Draw("EPSAME"); | |
1433 | ratioACNoPS[centBin]->Draw("EPSAME"); | |
1434 | ratioENoPS[centBin]->Draw("EPSAME"); | |
1435 | } | |
1436 | } | |
1437 | ||
1438 | legcRTC->AddEntry(".","applied :",""); | |
1439 | for(Int_t centBin = 0; centBin < centBinMax; centBin++){ | |
1440 | legcRTC->AddEntry(ratioB[centBin],(legendHeader[centBin]).Data(),"l"); | |
1441 | } | |
1442 | legcRTC->AddEntry(".","not applied :",""); | |
1443 | for(Int_t centBin = 0; centBin < centBinMax; centBin++){ | |
1444 | TString textLegend = ( (TObjString*) triggersAC->At(k) )->GetString(); | |
1445 | if( textLegend.CompareTo(" ") && ratioACNoPS[centBin]->GetMaximum() > yMin ){ | |
1446 | textLegend += " x"; | |
1447 | textLegend += scale; | |
1448 | legcRTC->AddEntry(ratioACNoPS[centBin],textLegend.Data(),"pl"); | |
1449 | } | |
1450 | textLegend = ( (TObjString*) triggersE->At(k) )->GetString(); | |
1451 | if( textLegend.CompareTo(" ") && ratioENoPS[centBin]->GetMaximum() > yMin){ | |
1452 | //cout<<"trigger="<<textLegend.Data()<<"-"<<endl; | |
1453 | textLegend += " x"; | |
1454 | textLegend += scale; | |
1455 | legcRTC->AddEntry(ratioENoPS[centBin],textLegend.Data(),"pl"); | |
1456 | } | |
005408df | 1457 | } |
1458 | legcRTC->Draw("same"); | |
1459 | ||
1460 | ||
1461 | return c1; | |
1462 | } | |
1463 | ||
93f182e7 | 1464 | TCanvas *ProcessCanvasCentralityPercentile(TObjArray *triggersB, TH1 **hBNoPSCent, TH1 **hBWithPSCent, Int_t k, TString canvasName, Int_t *colorInd, TString *legendHeader){ |
1465 | ||
1466 | if(!triggersB || !hBNoPSCent || !hBWithPSCent || !colorInd || !legendHeader) return 0x0; | |
1467 | ||
1468 | TString cName = "c"; | |
1469 | cName += canvasName; | |
1470 | TCanvas *c1 = new TCanvas(canvasName,cName,1200,900); | |
1471 | SetCanvas(c1,0); | |
1472 | c1->cd(); | |
1473 | ||
1474 | Int_t const centBinMax =2; | |
1475 | TH1* ratioB[centBinMax], *ratioBNoPS[centBinMax]; | |
1476 | TLegend* legcRTC = new TLegend(0.2,0.15,0.50,0.40); | |
1477 | legcRTC->SetHeader("Physics Selection"); | |
1478 | ||
1479 | TString hName; | |
1480 | ||
1481 | Float_t yMin = 0., yMax = 0.3; | |
1482 | ||
1483 | for(Int_t centBin = 0; centBin < centBinMax; centBin++){ | |
1484 | ||
1485 | hName = "ratio"; | |
1486 | hName += ( (TObjString*) triggersB->At(k) )->GetString(); | |
1487 | ratioB[centBin] = static_cast<TH1*> (hBWithPSCent[centBin+1]->Clone(hName)); | |
1488 | ratioB[centBin]->Divide(hBWithPSCent[0]); | |
1489 | ratioB[centBin]->Scale(0.8); | |
1490 | ratioB[centBin]->SetLineWidth(2); | |
1491 | ratioB[centBin]->SetLineColor(colorInd[centBin+1]); | |
1492 | hName = "ratioNoPS"; | |
1493 | hName += ( (TObjString*) triggersB->At(k) )->GetString(); | |
1494 | ratioBNoPS[centBin] = static_cast<TH1*> (hBNoPSCent[centBin+1]->Clone(hName)); | |
1495 | ratioBNoPS[centBin]->Divide(hBNoPSCent[0]); | |
1496 | ratioBNoPS[centBin]->Scale(0.8); | |
1497 | ratioBNoPS[centBin]->SetLineWidth(0); | |
1498 | ratioBNoPS[centBin]->SetLineStyle(1); | |
1499 | ratioBNoPS[centBin]->SetMarkerStyle(24+centBin+1); | |
1500 | ratioBNoPS[centBin]->SetMarkerSize(1); | |
1501 | ratioBNoPS[centBin]->SetLineColor(colorInd[centBin+1]); | |
1502 | ratioBNoPS[centBin]->SetMarkerColor(colorInd[centBin+1]); | |
1503 | ||
1504 | if(centBin==0){ | |
1505 | ratioB[centBin]->SetMaximum(yMax); | |
1506 | ratioB[centBin]->SetMinimum(yMin); | |
1507 | ratioB[centBin]->SetLabelSize(0.02); | |
1508 | ratioB[centBin]->GetYaxis()->SetTitle("Centrality percentile check"); | |
1509 | ratioB[centBin]->SetTitle(Form("Centrality percentile check for %s - Multiplicity from V0 amplitude",(( (TObjString*) triggersB->At(k) )->GetString()).Data() )); | |
1510 | ratioB[centBin]->Draw("E"); | |
1511 | ratioBNoPS[centBin]->Draw("EPSAME"); | |
1512 | } | |
1513 | else{ | |
1514 | ratioB[centBin]->Draw("ESAME"); | |
1515 | ratioBNoPS[centBin]->Draw("EPSAME"); | |
1516 | } | |
1517 | } | |
1518 | ||
1519 | legcRTC->AddEntry(".","applied :",""); | |
1520 | for(Int_t centBin = 0; centBin < centBinMax; centBin++){ | |
1521 | legcRTC->AddEntry(ratioB[centBin],(legendHeader[centBin+1]).Data(),"l"); | |
1522 | } | |
1523 | legcRTC->AddEntry(".","not applied :",""); | |
1524 | for(Int_t centBin = 0; centBin < centBinMax; centBin++){ | |
1525 | legcRTC->AddEntry(ratioBNoPS[centBin],(legendHeader[centBin+1]).Data(),"l"); | |
1526 | } | |
1527 | legcRTC->Draw("same"); | |
1528 | ||
1529 | ||
1530 | return c1; | |
1531 | } | |
005408df | 1532 | |
93f182e7 | 1533 | TCanvas *ProcessCanvasTracksoverTrigger(TObjArray *triggersB, TH1 **hB, TH1 **hTrackerB, TH1 **hTriggerB, TH1 **hMatchedB, TH1 **hAllTracksB, Int_t indTrigger, TString canvasName, TString legendHeader){ |
005408df | 1534 | |
1535 | if(!triggersB || !hB || !hTrackerB || !hTriggerB || !hMatchedB || !hAllTracksB || indTrigger<0 ) return 0x0; | |
1536 | ||
1537 | TH1 *hTrackerPerB, *hTriggerPerB, *hMatchedPerB, *hAllTracksPerB; | |
1538 | ||
1539 | TString hName, hNameBase; | |
1540 | hNameBase =( (TObjString*) triggersB->At(indTrigger) )->GetString(); | |
1541 | ||
1542 | hName = "hTrackerPer"; | |
1543 | hName += hNameBase; | |
1544 | hTrackerPerB = static_cast<TH1*>(hTrackerB[indTrigger]->Clone(hName)); | |
1545 | hTrackerPerB->Divide(hB[indTrigger]); | |
1546 | hTrackerPerB->SetLineWidth(2); | |
1547 | hTrackerPerB->SetLineColor(kRed); | |
1548 | ||
1549 | hName = "hTriggerPer"; | |
1550 | hName += hNameBase; | |
1551 | hTriggerPerB = static_cast<TH1*>(hTriggerB[indTrigger]->Clone(hName)); | |
1552 | hTriggerPerB->Divide(hB[indTrigger]); | |
1553 | hTriggerPerB->SetLineWidth(2); | |
1554 | hTriggerPerB->SetLineColor(kBlue); | |
1555 | ||
1556 | hName = "hMatchedPer"; | |
1557 | hName += hNameBase; | |
1558 | hMatchedPerB = static_cast<TH1*>(hMatchedB[indTrigger]->Clone(hName)); | |
1559 | hMatchedPerB->Divide(hB[indTrigger]); | |
1560 | hMatchedPerB->SetLineWidth(2); | |
1561 | hMatchedPerB->SetLineColor(kViolet); | |
1562 | ||
1563 | hName = "hAllTracksPer"; | |
1564 | hName += hNameBase; | |
1565 | hAllTracksPerB = static_cast<TH1*>(hAllTracksB[indTrigger]->Clone(hName)); | |
1566 | hAllTracksPerB->Divide(hB[indTrigger]); | |
1567 | hAllTracksPerB->SetLineWidth(3); | |
1568 | hAllTracksPerB->SetLineColor(kBlack); | |
93f182e7 | 1569 | hAllTracksPerB->SetTitle(Form("Number of Tracks /%s for %s",hNameBase.Data(),legendHeader.Data())); |
005408df | 1570 | hAllTracksPerB->SetMinimum(0.0001); |
1571 | hAllTracksPerB->SetLabelSize(0.02); | |
1572 | ||
1573 | ||
1574 | TString cName = "c"; | |
1575 | cName += canvasName; | |
1576 | hNameBase =( (TObjString*) triggersB->At(indTrigger) )->GetString(); | |
1577 | cName += hNameBase; | |
1578 | canvasName += indTrigger; | |
1579 | TCanvas *cRatioTrackTypesB = new TCanvas(canvasName,cName,1200,900); | |
1580 | SetCanvas(cRatioTrackTypesB,0); | |
1581 | cRatioTrackTypesB->cd(); | |
1582 | ||
1583 | TLegend* legcTTCINT1B; | |
1584 | ||
1585 | hAllTracksPerB->Draw("E"); | |
1586 | hTrackerPerB->Draw("Esame"); | |
1587 | hMatchedPerB->Draw("Esame"); | |
1588 | hTriggerPerB->Draw("Esame"); | |
1589 | ||
1590 | legcTTCINT1B = new TLegend(0.70,0.5,0.90,0.70); | |
1591 | legcTTCINT1B->AddEntry(hAllTracksPerB,"All tracks","l"); | |
1592 | legcTTCINT1B->AddEntry(hTrackerPerB,"Tracking (only) tracks","l"); | |
1593 | legcTTCINT1B->AddEntry(hMatchedPerB,"Matched tracks","l"); | |
1594 | legcTTCINT1B->AddEntry(hTriggerPerB,"Trigger (only) tracks","l"); | |
1595 | legcTTCINT1B->Draw("same"); | |
1596 | ||
1597 | ||
1598 | ||
1599 | return cRatioTrackTypesB; | |
1600 | ||
1601 | } | |
1602 | ||
1603 | ||
93f182e7 | 1604 | TCanvas *ProcessCanvasTrackMultB(TObjArray *triggersB, TH1 **hB, TH1 **hTrackerB, TH1 **hTriggerB, TH1 **hMatchedB, TH1 **hAllTracksB, Int_t indTrigger, TString canvasName,TString legendHeader){ |
005408df | 1605 | |
1606 | if(!triggersB || !hB || !hTrackerB || !hTriggerB || !hMatchedB || !hAllTracksB || indTrigger<0 ) return 0x0; | |
1607 | ||
1608 | TString cName = "c"; | |
1609 | cName += canvasName; | |
1610 | TString hNameBase =( (TObjString*) triggersB->At(indTrigger) )->GetString(); | |
1611 | cName += hNameBase; | |
1612 | canvasName += indTrigger; | |
1613 | TCanvas *cTrackMultB = new TCanvas(canvasName,cName,1200,900); | |
1614 | SetCanvas(cTrackMultB,0); | |
1615 | ||
1616 | cTrackMultB->Divide(1,2); | |
1617 | cTrackMultB->cd(1); | |
1618 | ||
1619 | ||
1620 | TH1* hSumTriggerOverB, *hSumTrackerOverB; | |
1621 | ||
1622 | TString hName; | |
1623 | ||
1624 | hName = Form("hSumTriggerOver%s",hNameBase.Data()); | |
1625 | hSumTriggerOverB = static_cast<TH1*>(hTriggerB[indTrigger]->Clone(hName)); | |
1626 | hSumTriggerOverB->Add(hMatchedB[indTrigger]); | |
1627 | hSumTriggerOverB->Divide(hB[indTrigger]); | |
1628 | ||
93f182e7 | 1629 | hName = Form("Sum of trigger tracks (matched+trigger-only) / # events in %s for %s",hNameBase.Data(),legendHeader.Data()); |
005408df | 1630 | hSumTriggerOverB->SetTitle(hName); |
1631 | hSumTriggerOverB->SetLabelSize(0.02); | |
1632 | hSumTriggerOverB->SetLineWidth(2); | |
1633 | hSumTriggerOverB->SetLineColor(kBlue); | |
1634 | hName = Form("hSumTrackerOver%s",hNameBase.Data()); | |
1635 | hSumTrackerOverB = static_cast<TH1*>(hTrackerB[indTrigger]->Clone(hName)); | |
1636 | hSumTrackerOverB->Add(hMatchedB[indTrigger]); | |
1637 | hSumTrackerOverB->Divide(hB[indTrigger]); | |
93f182e7 | 1638 | hName = Form("Sum of tracker tracks (matched+tracker-only) / # events in %s for %s",hNameBase.Data(),legendHeader.Data()); |
005408df | 1639 | hSumTrackerOverB->SetTitle(hName); |
1640 | //hSumTrackerOverCINT1B->LabelsOption("u"); | |
1641 | hSumTrackerOverB->SetLabelSize(0.02); | |
1642 | hSumTrackerOverB->SetLineWidth(2); | |
1643 | hSumTrackerOverB->SetLineColor(kBlue); | |
1644 | ||
1645 | ||
1646 | ||
1647 | hSumTriggerOverB->Draw("e"); | |
1648 | cTrackMultB->cd(2); | |
1649 | hSumTrackerOverB->Draw("e"); | |
1650 | ||
1651 | return cTrackMultB; | |
1652 | ||
1653 | } | |
1654 | ||
93f182e7 | 1655 | TCanvas *ProcessCanvasRatioTrackB(TObjArray *triggersB, TH1 **hB, TH1 **hTrackerB, TH1 **hTriggerB, TH1 **hMatchedB, TH1 **hAllTracksB, Int_t indTrigger, TString canvasName,TString legendHeader){ |
005408df | 1656 | |
1657 | if(!triggersB || !hB || !hTrackerB || !hTriggerB || !hMatchedB || !hAllTracksB || indTrigger<0 ) return 0x0; | |
1658 | ||
1659 | TString cName = "c"; | |
1660 | cName += canvasName; | |
1661 | TString hNameBase =( (TObjString*) triggersB->At(indTrigger) )->GetString(); | |
1662 | cName += hNameBase; | |
1663 | canvasName += indTrigger; | |
1664 | TCanvas *cRatioTrackB = new TCanvas(canvasName,cName,1200,900); | |
1665 | SetCanvas(cRatioTrackB,0); | |
1666 | ||
1667 | TH1* hTrackerOverTriggerB, *hMatchedOverTriggerB, *hMatchedOverTrackerB; | |
1668 | ||
1669 | TString hName = Form("hTrackerOverTrigger%s",hNameBase.Data()); | |
1670 | hTrackerOverTriggerB = static_cast<TH1*>(hTrackerB[indTrigger]->Clone(hName)); | |
1671 | hTrackerOverTriggerB->Divide(hTriggerB[indTrigger]); | |
93f182e7 | 1672 | hName = Form("# tracker tracks / # trigger tracks in %s for %s",hNameBase.Data(),legendHeader.Data()); |
005408df | 1673 | hTrackerOverTriggerB->SetTitle(hName); |
1674 | //hTrackerOverTriggerCINT1B->LabelsOption("u"); | |
1675 | hTrackerOverTriggerB->SetLabelSize(0.02); | |
1676 | hTrackerOverTriggerB->SetLineWidth(2); | |
1677 | hTrackerOverTriggerB->SetLineColor(kBlue); | |
1678 | ||
1679 | hName = Form("hMatchedOverTrigger%s",hNameBase.Data()); | |
1680 | hMatchedOverTriggerB = static_cast<TH1*>(hMatchedB[indTrigger]->Clone(hName)); | |
1681 | hMatchedOverTriggerB->Divide(hTriggerB[indTrigger]); | |
1682 | ||
93f182e7 | 1683 | hName = Form("# matched tracks / # trigger tracks in %s for %s",hNameBase.Data(),legendHeader.Data()); |
005408df | 1684 | hMatchedOverTriggerB->SetTitle(hName); |
1685 | //hMatchedOverTriggerCINT1B->LabelsOption("u"); | |
1686 | hMatchedOverTriggerB->SetLabelSize(0.02); | |
1687 | hMatchedOverTriggerB->SetLineWidth(2); | |
1688 | hMatchedOverTriggerB->SetLineColor(kBlue); | |
1689 | ||
1690 | hName = Form("hMatchedOverTracker%s",hNameBase.Data()); | |
1691 | hMatchedOverTrackerB = static_cast<TH1*>(hMatchedB[indTrigger]->Clone(hName)); | |
1692 | hMatchedOverTrackerB->Divide(hTrackerB[indTrigger]); | |
93f182e7 | 1693 | hName = Form("# matched tracks / # tracker tracks in %s for %s",hNameBase.Data(),legendHeader.Data()); |
005408df | 1694 | hMatchedOverTrackerB->SetTitle(hName); |
1695 | //hMatchedOverTrackerCINT1B->LabelsOption("u"); | |
1696 | hMatchedOverTrackerB->SetLabelSize(0.02); | |
1697 | hMatchedOverTrackerB->SetLineWidth(2); | |
1698 | hMatchedOverTrackerB->SetLineColor(kBlue); | |
1699 | ||
1700 | ||
1701 | cRatioTrackB->Divide(1,3); | |
1702 | cRatioTrackB->cd(1); | |
1703 | hTrackerOverTriggerB->Draw("e"); | |
1704 | cRatioTrackB->cd(2); | |
1705 | hMatchedOverTriggerB->Draw("e"); | |
1706 | cRatioTrackB->cd(3); | |
1707 | hMatchedOverTrackerB->Draw("e"); | |
1708 | ||
1709 | return cRatioTrackB; | |
1710 | ||
1711 | } | |
1712 | ||
93f182e7 | 1713 | TCanvas *ProcessCanvasAsymMatched(TObjArray *triggersB, TH1 **hPosMatchedB, TH1 **hNegMatchedB, TH1 **hAllMatchedB, Int_t indTrigger, TString canvasName,TString legendHeader){ |
005408df | 1714 | |
1715 | if(!triggersB || !hPosMatchedB || !hNegMatchedB || !hAllMatchedB || indTrigger<0 ) return 0x0; | |
1716 | ||
1717 | TString hName, hNameBase = (( (TObjString*) triggersB->At(indTrigger) )->GetString()); | |
1718 | ||
1719 | TString cName = "c"; | |
1720 | cName += canvasName; | |
1721 | cName += hNameBase; | |
1722 | canvasName += indTrigger; | |
1723 | TCanvas *cAsymMatched = new TCanvas(canvasName.Data(),cName,1200,900); | |
1724 | SetCanvas(cAsymMatched,0); | |
1725 | cAsymMatched->cd(); | |
1726 | ||
1727 | ||
1728 | TH1 *hDiffMatchedCMUS1B= static_cast<TH1*>(hPosMatchedB[indTrigger]->Clone("hDiffMatchedCMUS1B")); | |
1729 | hDiffMatchedCMUS1B->Add(hNegMatchedB[indTrigger],-1); | |
1730 | hDiffMatchedCMUS1B->Sumw2(); | |
1731 | ||
1732 | TH1 *hAsymMatchedCMUS1B= static_cast<TH1*>(hDiffMatchedCMUS1B->Clone("hAsymMatchedCMUS1B")); | |
1733 | hAsymMatchedCMUS1B->Divide(hAllMatchedB[indTrigger]); | |
1734 | hAsymMatchedCMUS1B->SetLineColor(kRed); | |
1735 | hAsymMatchedCMUS1B->SetLineWidth(2); | |
1736 | hAsymMatchedCMUS1B->SetMinimum(-0.3); | |
1737 | hAsymMatchedCMUS1B->SetMaximum(0.3); | |
1738 | hAsymMatchedCMUS1B->SetLabelSize(0.02); | |
93f182e7 | 1739 | hName = Form("Matched tracks charge asymmetry for %s with acc. cuts for %s",hNameBase.Data(),legendHeader.Data()); |
005408df | 1740 | hAsymMatchedCMUS1B->SetTitle(hName); |
1741 | ||
1742 | hAsymMatchedCMUS1B->GetYaxis()->SetTitle("Charged tracks asymmetry"); | |
1743 | hAsymMatchedCMUS1B->Draw("EH"); | |
1744 | ||
1745 | return cAsymMatched; | |
1746 | ||
1747 | } | |
1748 | ||
93f182e7 | 1749 | TCanvas *ProcessCanvasHighPtMuons(TObjArray *triggersB, TH1 **hB, TH1 **hMatchedLowPtB, TH1 **hMatchedHighPtB, Int_t indTrigger, TString canvasName, TString legendHeader){ |
005408df | 1750 | |
1751 | if(!triggersB || !hB || !hMatchedLowPtB || !hMatchedHighPtB || indTrigger<0 ) return 0x0; | |
1752 | ||
1753 | TString hName, hNameBase = (( (TObjString*) triggersB->At(indTrigger) )->GetString()); | |
1754 | ||
1755 | TString cName = "c"; | |
1756 | cName += canvasName; | |
1757 | cName += hNameBase; | |
1758 | canvasName += indTrigger; | |
1759 | TCanvas *cHighPtMuons = new TCanvas(canvasName.Data(),cName,1200,900); | |
1760 | SetCanvas(cHighPtMuons,0); | |
1761 | cHighPtMuons->cd(); | |
1762 | ||
1763 | TLegend* legcHPM; | |
1764 | ||
1765 | TH1* hMatchedLowPtPerB, *hMatchedHighPtPerB; | |
1766 | hName = Form("hMatchedLowPtPer%s ",hNameBase.Data()); | |
1767 | hMatchedLowPtPerB = static_cast<TH1*> (hMatchedLowPtB[indTrigger]->Clone(hName)); | |
1768 | hMatchedLowPtPerB->Sumw2(); | |
1769 | hMatchedLowPtPerB->Divide(hB[indTrigger]); | |
1770 | hMatchedLowPtPerB->SetLineWidth(2); | |
1771 | hMatchedLowPtPerB->SetLineColor(kBlue); | |
1772 | hMatchedLowPtPerB->SetTitle(""); | |
1773 | hName = Form("Ratio per %s ",hNameBase.Data()); | |
1774 | hMatchedLowPtPerB->GetYaxis()->SetTitle(hName); | |
1775 | //hMatchedLowPtPerB->SetMaximum(0.15); | |
1776 | hMatchedLowPtPerB->SetMinimum(0.0001); | |
1777 | hMatchedLowPtPerB->SetLabelSize(0.02); | |
1778 | ||
1779 | hName = Form("hMatchedHighPtPer%s ",hNameBase.Data()); | |
1780 | hMatchedHighPtPerB = static_cast<TH1*> (hMatchedHighPtB[indTrigger]->Clone(hName)); | |
1781 | hMatchedHighPtPerB->Sumw2(); | |
1782 | hMatchedHighPtPerB->Divide(hB[indTrigger]); | |
1783 | hMatchedHighPtPerB->SetLineWidth(2); | |
1784 | hMatchedHighPtPerB->SetLineColor(kRed); | |
1785 | ||
93f182e7 | 1786 | hName = Form("Number of matched track per %s (include Vtx and R_{Abs} cuts) for %s",hNameBase.Data(),legendHeader.Data()); |
1787 | hMatchedLowPtPerB->SetTitle(hName); | |
005408df | 1788 | hMatchedLowPtPerB->Draw("E"); |
1789 | hMatchedHighPtPerB->Draw("Esame"); | |
1790 | ||
1791 | legcHPM = new TLegend(0.60,0.45,0.98,0.65); | |
93f182e7 | 1792 | //legcHPM->SetHeader(hName); |
005408df | 1793 | legcHPM->AddEntry(".","Physics selection applied :",""); |
1794 | legcHPM->AddEntry(hMatchedLowPtPerB," p_{T} > 1 GeV/c ","l"); | |
1795 | legcHPM->AddEntry(hMatchedHighPtPerB," p_{T} > 2 GeV/c ","l"); | |
1796 | legcHPM->Draw("same"); | |
1797 | ||
1798 | return cHighPtMuons; | |
1799 | ||
1800 | ||
1801 | } | |
1802 | ||
93f182e7 | 1803 | TH1* ProcessHisto( AliCounterCollection* counter, TString hVariable, TString hSelection, TString hName, TString xName, TString yName, Int_t color, Bool_t empty ){ |
005408df | 1804 | |
1805 | ||
1806 | TH1* h1 = 0x0; | |
1807 | if( !counter ) return h1; | |
93f182e7 | 1808 | |
1809 | if ( empty==kFALSE ) h1 = (TH1*) counter->Draw(hVariable,hSelection); | |
005408df | 1810 | if ( !h1 ) h1 = new TH1D(hName,"",10,0,10); |
1811 | else { | |
1812 | h1->Sumw2(); | |
1813 | h1->LabelsOption("a"); | |
1814 | if(hName.Sizeof()>1) h1->SetName(hName); | |
1815 | if(xName.Sizeof()>1) h1->GetXaxis()->SetTitle(xName); | |
1816 | if(yName.Sizeof()>1) h1->GetYaxis()->SetTitle(yName); | |
1817 | if(color>0) h1->SetLineColor(color); | |
1818 | ||
1819 | } | |
1820 | ||
1821 | return h1; | |
1822 | } | |
1823 | ||
1824 | TH2* ProcessHisto2D( AliCounterCollection* counter, TString hVariable, TString hVariable2, TString hSelection, TString hName){ | |
1825 | ||
1826 | ||
1827 | TH2* h1 = 0x0; | |
1828 | if( !counter ) return h1; | |
1829 | Bool_t setName = kTRUE; | |
1830 | ||
1831 | if(hName.Sizeof()==1) setName = kFALSE; | |
1832 | ||
1833 | h1 = (TH2*) counter->Draw(hVariable,hVariable2,hSelection); | |
1834 | if ( !h1 ) h1 = new TH2D(hName,"",10,0,10,10,0,10); | |
1835 | else { | |
1836 | h1->Sumw2(); | |
1837 | h1->LabelsOption("a"); | |
1838 | if(setName) h1->SetName(hName); | |
1839 | } | |
1840 | ||
1841 | return h1; | |
1842 | } | |
93f182e7 | 1843 | |
005408df | 1844 | Bool_t GetTriggerLists(const char* triggerList, TString listFromContainer, TObjArray *triggersB, TObjArray *triggersAC, TObjArray *triggersE){ |
1845 | ||
1846 | //Get the trigger list from a file | |
1847 | //The file should consist of a line for each trigger with the following layout: | |
93f182e7 | 1848 | // triggernameB triggerNameAC triggerNameE |
1849 | // or triggernameB triggerNameA,triggerNameC triggerNameE | |
1850 | // or triggernameB triggerNameACE notrigger | |
005408df | 1851 | //if filename is 0, then default trigger names (pp 2011) are used |
1852 | ||
1853 | if( !triggersB || !triggersAC || !triggersE) return kFALSE; | |
1854 | TObjArray* triggers[3] = {triggersB, triggersAC, triggersE}; | |
1855 | ||
1856 | TString trigSuffix[3] = {"B", "AC", "E"}; | |
1857 | TString currTrigName = ""; | |
1858 | TObjArray* fullTriggerList[3]; | |
1859 | ||
1860 | for ( Int_t ibeam=0; ibeam<3; ++ibeam ) { | |
1861 | fullTriggerList[ibeam] = new TObjArray; | |
1862 | fullTriggerList[ibeam]->SetOwner(); | |
1863 | } | |
1864 | ||
1865 | // Build trigger list (from file or default) | |
1866 | if ( triggerList ) { | |
1867 | // only the ones in the triggerList | |
1868 | ifstream inFile(triggerList); | |
1869 | if (!inFile.is_open()) { | |
93f182e7 | 1870 | Error("PlotMuonQA","unable to open file %s", triggerList); |
005408df | 1871 | return kFALSE; |
1872 | } | |
1873 | ||
1874 | while ( !inFile.eof() ) { | |
1875 | Bool_t isGoodB = kTRUE; | |
1876 | for ( Int_t ibeam=0; ibeam<3; ++ibeam ) { | |
1877 | currTrigName.ReadToken( inFile ); | |
1878 | if ( ! isGoodB ) continue; | |
1879 | if ( currTrigName.IsNull() || ! currTrigName.IsAscii() ) { | |
1880 | if ( ibeam == 0 ) { | |
1881 | isGoodB = kFALSE; | |
1882 | continue; | |
1883 | } | |
1884 | currTrigName = "notrigger"; | |
1885 | } | |
1886 | fullTriggerList[ibeam]->AddLast(new TObjString(currTrigName)); | |
1887 | } | |
1888 | } | |
1889 | inFile.close(); | |
1890 | } | |
1891 | else { | |
1892 | TString baseTrigName[4] = {"CINT7", "CMUSH7", "CMUL7", "CMUU7"}; | |
1893 | for ( Int_t ibase=0; ibase<4; ++ibase ) { | |
1894 | for ( Int_t ibeam=0; ibeam<3; ++ibeam ) { | |
1895 | // by default all triggers from new period in LHC11c | |
1896 | currTrigName = baseTrigName[ibase] + trigSuffix[ibeam]; | |
1897 | fullTriggerList[ibeam]->AddLast(new TObjString(currTrigName)); | |
1898 | } | |
1899 | } | |
1900 | } | |
1901 | // | |
1902 | // Select only existing triggers in container | |
1903 | // | |
1904 | TObjArray *triggersFromContainer = listFromContainer.Tokenize(","); | |
1905 | TObjString* trigName = 0x0; | |
1906 | ||
1907 | TString selectAllTriggers[3] = {"", "", ""}; | |
1908 | for ( Int_t itrig=0; itrig<fullTriggerList[0]->GetEntries(); ++itrig ) { | |
1909 | Bool_t isBadTrig = kFALSE; | |
1910 | for ( Int_t ibeam=0; ibeam<3; ++ibeam ) { | |
1911 | currTrigName = fullTriggerList[ibeam]->At(itrig)->GetName(); | |
1912 | ||
1913 | //condition on trigger name from trigger list | |
1914 | if ( currTrigName.Contains("notrigger") ){ | |
1915 | isBadTrig = kTRUE; | |
1916 | if ( ibeam == 0 ) break; | |
1917 | currTrigName = " "; | |
1918 | } | |
1919 | //select only the existing triggers in the container | |
1920 | //note that the trigger in the trigger file can be a list of different trigger | |
1921 | if ( triggersFromContainer ) { | |
1922 | TIter nextTrigger( triggersFromContainer ); | |
1923 | isBadTrig = kTRUE; | |
1924 | while ( ( trigName = static_cast<TObjString*>(nextTrigger()) ) ) { | |
1925 | if ( currTrigName.Contains(trigName->GetString()) ){ | |
1926 | isBadTrig = kFALSE; | |
1927 | } | |
1928 | } | |
1929 | if ( isBadTrig == kTRUE ){ | |
1930 | if ( ibeam == 0 ) break; | |
1931 | currTrigName = " "; | |
1932 | } | |
1933 | } | |
1934 | triggers[ibeam]->AddLast(new TObjString(currTrigName)); | |
1935 | if ( isBadTrig ) continue; | |
1936 | if ( ! selectAllTriggers[ibeam].IsNull() ) selectAllTriggers[ibeam] += ","; | |
1937 | selectAllTriggers[ibeam] += currTrigName; | |
1938 | } | |
1939 | } | |
1940 | if(triggersFromContainer) delete triggersFromContainer; | |
1941 | if(trigName) delete trigName; | |
1942 | ||
1943 | ||
1944 | // Complete trigger list and print values | |
1945 | cout<<" Nr of triggers read "<<triggers[0]->GetEntriesFast()<<endl; | |
1946 | for ( Int_t ibeam=0; ibeam<3; ++ibeam ) { | |
1947 | triggers[ibeam]->AddLast(new TObjString(selectAllTriggers[ibeam])); | |
1948 | printf(" %s triggers:\n", trigSuffix[ibeam].Data()); | |
1949 | triggers[ibeam]->Print(); | |
1950 | delete fullTriggerList[ibeam]; | |
1951 | } | |
1952 | ||
1953 | return kTRUE; | |
1954 | } | |
1955 | ||
1956 | TString GetRunList(const char *runList, TObjArray *runs, TObjArray *runs2){ | |
1957 | ||
1958 | // list of runs to be analyzed | |
1959 | TString selectRuns = "run:"; | |
1960 | ||
1961 | if(runList) { | |
1962 | // only the ones in the runList | |
1963 | ifstream inFile(runList); | |
1964 | if (!inFile.is_open()) { | |
93f182e7 | 1965 | Error("PlotMuonQA","unable to open file %s", runList); |
005408df | 1966 | return selectRuns; |
1967 | } | |
1968 | ||
1969 | TString currRun; | |
1970 | while (!inFile.eof()) { | |
1971 | currRun.ReadLine(inFile, kTRUE); | |
1972 | if (currRun.IsNull()) continue; | |
1973 | if (!currRun.IsDigit()) { | |
93f182e7 | 1974 | Error("PlotMuonQA","invalid run number: %s", currRun.Data()); |
005408df | 1975 | return selectRuns; |
1976 | } | |
1977 | if(runs) runs->AddLast(new TObjString(Form("%09d", currRun.Atoi()))); | |
1978 | if(runs2) runs2->AddLast(new TObjString(Form("%d", currRun.Atoi()))); | |
1979 | selectRuns += Form("%s,",currRun.Data()); | |
1980 | } | |
1981 | selectRuns.Remove(TString::kTrailing, ','); | |
1982 | inFile.close(); | |
1983 | ||
1984 | } else { | |
1985 | // all runs | |
1986 | if(runs) runs->AddLast(new TObjString("*")); | |
1987 | if(runs2) runs2->AddLast(new TObjString("*")); | |
1988 | } | |
1989 | ||
93f182e7 | 1990 | printf("selected runs from runlist %s: %s\n",runList, selectRuns.Data()); |
1991 | ||
005408df | 1992 | return selectRuns; |
1993 | } |