]>
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: | |
4bc96904 | 5 | // - libSTEERBase |
6 | // - libESD | |
7 | // - libAOD | |
8 | // - libANALYSIS | |
9 | // - libANALYSISalice | |
10 | // - libCORRFW | |
11 | // - libPWGmuon | |
93ce3c40 | 12 | // |
13bb4ca7 | 13 | // TString includePath = "-I${ALICE_ROOT}/PWGmuon "; gSystem->SetIncludePath(includePath.Data()); |
93ce3c40 | 14 | // |
15 | // The macro reads results of the QA task and produce monitoring plots. | |
16 | // | |
e31f508d | 17 | // Authors: Cynthia Hadjidakis - IPN Orsay |
18 | // QA histos from counters (event, track) and run per run histos | |
93f182e7 | 19 | // To be done: |
20 | // - reorganize last part (reading and extracting info from run per run histos) | |
e31f508d | 21 | // - remove trigger selection when muon QA task modified (now a selection is done one triggers' name) |
93ce3c40 | 22 | //-------------------------------------------------------------------------- |
23 | ||
24 | #if !defined(__CINT__) || defined(__MAKECINT__) | |
25 | ||
26 | #include <Riostream.h> | |
93ce3c40 | 27 | // ROOT includes |
28 | #include "TEnv.h" | |
29 | #include "TMath.h" | |
30 | #include "TGrid.h" | |
31 | #include "TGridResult.h" | |
32 | #include "THashList.h" | |
33 | #include "TFile.h" | |
34 | #include "TH1.h" | |
35 | #include "TH2.h" | |
005408df | 36 | #include "TF1.h" |
93ce3c40 | 37 | #include "TSystem.h" |
38 | #include "TStyle.h" | |
39 | #include "TCanvas.h" | |
40 | #include "TPad.h" | |
41 | #include "TLegend.h" | |
b66f9801 | 42 | #include "TObjArray.h" |
43 | #include "TObjString.h" | |
056ae2c8 | 44 | #include "TFileMerger.h" |
93ce3c40 | 45 | // ALIROOT includes |
46 | #include "AliCounterCollection.h" | |
93ce3c40 | 47 | #endif |
48 | ||
056ae2c8 | 49 | Int_t GetRunNumber(TString); |
e31f508d | 50 | TString GetRunList(const char *runList, TObjArray *runs); |
056ae2c8 | 51 | Bool_t MergeOutputs(const char*,const char*); |
e31f508d | 52 | Bool_t GetTriggerLists(const char *triggerList, TString listFromContainer, TObjArray *triggersB=0, TObjArray *triggersShortName=0); |
005408df | 53 | void SetCanvas(TCanvas *canvas, Int_t logy=1); |
b69e18be | 54 | TH1* ProcessHisto( AliCounterCollection* counter, TString variable, TString selection, TString hName="", TString xName="", TString yName="", Int_t color=1); |
005408df | 55 | TH2* ProcessHisto2D( AliCounterCollection* counter, TString hVariable, TString hVariable2, TString hSelection, TString hName); |
e31f508d | 56 | Int_t GetIndex(TObjArray *triggersB, Int_t trigNr, Int_t centNr); |
57 | TCanvas *ProcessCanvasAllTrigger(AliCounterCollection *counter, TString canvasName); | |
58 | TCanvas *ProcessCanvasTriggerContent(TObjArray *trigName, TObjArray trigNoPS, TObjArray trigWithPS, TString canvasName); | |
59 | TCanvas *ProcessCanvasRelativeTriggerContent(TObjArray *array, TObjArray trigNoPS, TString canvasName); | |
60 | TCanvas *ProcessCanvasPhysSelCut(TObjArray *triggersB, TObjArray trigNoPS, TObjArray trigWithPS, TString canvasName); | |
61 | TCanvas *ProcessCanvasPhysSelCutCentrality(TObjArray *triggersB, TObjArray trigNoPS, TObjArray trigBWithPS, Int_t trigNr, TString canvasName, TString *legendHeader); | |
62 | TCanvas *ProcessCanvasCentralityPercentile(TObjArray *triggersB, TObjArray trigNoPS, TObjArray trigWithPS, Int_t trigNr, TString canvasName, TString *legendHeader); | |
63 | TCanvas *ProcessCanvasTracksoverTrigger(TObjArray *triggersB, TObjArray trigSel, TObjArray trackTracker, TObjArray trackTrigger, TObjArray trackMatched, TObjArray trackAll, Int_t trigNr, Int_t centNr, TString canvasName,TString legendHeader=""); | |
64 | TCanvas *ProcessCanvasTrackMultB(TObjArray *triggersB, TObjArray trigSel, TObjArray trackTracker, TObjArray trackTrigger, TObjArray trackMatched, Int_t trigNr, Int_t centNr, TString canvasName,TString legendHeader=""); | |
65 | TCanvas *ProcessCanvasRatioTrackB(TObjArray *triggersB, TObjArray trigSel, TObjArray trackTracker, TObjArray trackTrigger, TObjArray trackMatched, Int_t trigNr, Int_t centNr, TString canvasName,TString legendHeader=""); | |
66 | TCanvas *ProcessCanvasAsymMatched(TObjArray *triggersB, TObjArray trackPosMatched, TObjArray trackNegMatched, TObjArray trackhAllMatched, Int_t trigNr, Int_t centNr, TString canvasName,TString legendHeader=""); | |
67 | TCanvas *ProcessCanvasHighPtMuons(TObjArray *triggersB, TObjArray trigSel, TObjArray trackMatchedLowPt, TObjArray trackAllMatchedHightPt, Int_t trigNr, Int_t centNr, TString canvasName,TString legendHeader=""); | |
68 | TCanvas *ProcessCanvasBeamGasMatched(TObjArray *triggersB, TObjArray trackBeamGasMatched, TObjArray trackBeamGasMatchedHighPt, TObjArray trackAllMatched, TObjArray trackMatchedHighPt, Int_t trigNr, Int_t centNr, TString canvasName,TString legendHeader=""); | |
93f182e7 | 69 | Bool_t IsHeavyIonCollision(AliCounterCollection *eventCounters); |
93ce3c40 | 70 | |
e31f508d | 71 | //loop on centrality |
72 | const Int_t kCentBinMax = 4; | |
73 | TString kCentBinName[kCentBinMax] = {"v0mult:any/","v0mult:low,int,high/","v0mult:low/","v0mult:high/"}; | |
74 | TString kCentLegendName[kCentBinMax] ={"all collisions","[0-80%] from V0 amplitude","low mult. [60-80%] from V0 amplitude","high mult. [0-10%] from V0 amplitude"}; | |
75 | TString kCentLegendNameShort[kCentBinMax] ={"all","[0-80%]","[60-80%]","[0-10%]"}; | |
8a0df16c | 76 | |
93ce3c40 | 77 | //-------------------------------------------------------------------------- |
93f182e7 | 78 | void PlotMuonQA(const char* baseDir, const char* runList = 0x0, const char * triggerList = 0x0, Bool_t selectPhysics = kFALSE, const char *LHCPeriod = "LHC11c", const char *QAFileName = "QAresults.root") { |
005408df | 79 | |
93ce3c40 | 80 | /// Macro for QA monitoring. |
81 | /// Example: baseDir = "alien:///alice/cern.ch/user/p/ppillot/pp7TeV/LHC10d/MuonQA/pass1/results/". | |
82 | /// If runList != 0x0: only the given runs will be used. Otherwise use all runs found in baseDir. | |
93f182e7 | 83 | /// If triggerList !=0x0: only the given triggers are displayed. Otherwise use the default list of triggers (see GetTriggerLists) |
84 | ||
93ce3c40 | 85 | #if defined(__CINT__) && !defined(__MAKECINT__) |
86 | gSystem->Load("libTree"); | |
87 | gSystem->Load("libGeom"); | |
88 | gSystem->Load("libVMC"); | |
89 | gSystem->Load("libPhysics"); | |
90 | gSystem->Load("libSTEERBase"); | |
91 | gSystem->Load("libESD"); | |
92 | gSystem->Load("libAOD"); | |
93 | gSystem->Load("libANALYSIS"); | |
94 | gSystem->Load("libANALYSISalice"); | |
95 | gSystem->Load("libCORRFW"); | |
40a0a69c | 96 | gSystem->Load("libPWGHFbase"); |
97 | gSystem->Load("libPWGmuon"); | |
93ce3c40 | 98 | #endif |
99 | ||
100 | // Cosmetics and configuration | |
101 | gStyle->SetFillColor(10); | |
102 | gStyle->SetPadGridX(kTRUE); | |
103 | gStyle->SetPadGridY(kTRUE); | |
104 | gStyle->SetPadRightMargin(0.01); | |
105 | ||
93ce3c40 | 106 | TString OutFileName = "QA_"; OutFileName += LHCPeriod; |
107 | TString OutFileNamePDF= OutFileName.Data(); OutFileNamePDF+= ".pdf"; | |
108 | TString OutFileNamePDF_open = OutFileNamePDF.Data(); OutFileNamePDF_open += "["; | |
109 | TString OutFileNamePDF_close= OutFileNamePDF.Data(); OutFileNamePDF_close += "]"; | |
110 | TString OutFileNameROOT= OutFileName.Data(); OutFileNameROOT+= ".root"; | |
111 | ||
b66f9801 | 112 | Int_t PRINTSTAT = 1; |
e31f508d | 113 | Int_t kCMUS = 1; |
114 | ||
93ce3c40 | 115 | if (0){ // Equivalent to the fast read option |
116 | gEnv->SetValue("XNet.ConnectTimeout",10); | |
117 | gEnv->SetValue("XNet.RequestTimeout",10); | |
118 | gEnv->SetValue("XNet.MaxRedirectCount",2); | |
119 | gEnv->SetValue("XNet.ReconnectTimeout",10); | |
120 | gEnv->SetValue("XNet.FirstConnectMaxCnt",1); | |
121 | } | |
122 | ||
123 | TH1::AddDirectory(kFALSE); | |
124 | ||
125 | TString alienBaseDir = baseDir; | |
126 | ||
93ce3c40 | 127 | if (alienBaseDir.Contains("alien:") && !TGrid::Connect("alien://")) { |
128 | Error("MergeQA","cannot connect to grid"); | |
129 | return; | |
130 | } | |
131 | ||
93f182e7 | 132 | cout<<"//---------------------------------- //"<<endl; |
133 | cout<<"// Run selection //"<<endl; | |
134 | cout<<"//---------------------------------- //"<<endl; | |
93ce3c40 | 135 | |
005408df | 136 | TObjArray *runs = new TObjArray(); |
137 | runs->SetOwner(kTRUE); | |
e31f508d | 138 | TString selectRuns = GetRunList(runList,runs); |
93f182e7 | 139 | |
93ce3c40 | 140 | // physics selection |
141 | TString select = selectPhysics ? "selected:yes" : ""; | |
93f182e7 | 142 | |
b66f9801 | 143 | cout<<"//---------------------------------- //"<<endl; |
005408df | 144 | cout<<"// Get global counter //"<<endl; |
b66f9801 | 145 | cout<<"//---------------------------------- //"<<endl; |
146 | ||
056ae2c8 | 147 | TString mergedFilename = Form("%s/%s", baseDir,QAFileName); |
148 | if (runList) MergeOutputs(runList, mergedFilename); | |
149 | ||
150 | TFile *globalFile = TFile::Open(mergedFilename.Data()); | |
93ce3c40 | 151 | if (!globalFile || ! globalFile->IsOpen()) { |
056ae2c8 | 152 | Error("PlotQA", "failed to open file: %s", mergedFilename.Data()); |
93ce3c40 | 153 | return; |
154 | } | |
155 | globalFile->Cd("MUON_QA"); | |
156 | ||
b66f9801 | 157 | TString selection; |
158 | ||
93ce3c40 | 159 | // get counters |
160 | AliCounterCollection* eventCounters = static_cast<AliCounterCollection*>(globalFile->FindObjectAny("eventCounters")); | |
161 | AliCounterCollection* trackCounters = static_cast<AliCounterCollection*>(globalFile->FindObjectAny("trackCounters")); | |
e31f508d | 162 | |
163 | // run list from counters | |
93ce3c40 | 164 | if (!runList) selectRuns += trackCounters->GetKeyWords("run"); |
005408df | 165 | |
005408df | 166 | cout<<"//---------------------------------- //"<<endl; |
167 | cout<<"// Trigger selection //"<<endl; | |
168 | cout<<"//---------------------------------- //"<<endl; | |
169 | ||
e31f508d | 170 | TObjArray *triggersB, *triggersShortName; |
005408df | 171 | triggersB = new TObjArray(); |
172 | triggersB->SetOwner(); | |
13bb4ca7 | 173 | triggersShortName = new TObjArray(); |
174 | triggersShortName->SetOwner(); | |
175 | ||
005408df | 176 | TString listFromContainer = eventCounters->GetKeyWords("trigger"); |
e31f508d | 177 | Bool_t success = GetTriggerLists(triggerList, listFromContainer, triggersB, triggersShortName); |
005408df | 178 | if(!success) return; |
93f182e7 | 179 | |
180 | cout<<"//---------------------------------- //"<<endl; | |
181 | cout<<"// Set collision type ? //"<<endl; | |
182 | cout<<"//---------------------------------- //"<<endl; | |
005408df | 183 | |
93f182e7 | 184 | Bool_t isHeavyIon = kTRUE; |
185 | isHeavyIon = IsHeavyIonCollision(eventCounters); | |
186 | ||
005408df | 187 | cout<<"//---------------------------------- //"<<endl; |
188 | cout<<"// Trigger plots //"<<endl; | |
189 | cout<<"//---------------------------------- //"<<endl; | |
190 | ||
93f182e7 | 191 | //plot all trigger from event counters without any selection |
e31f508d | 192 | TString CanvasName = "AllTriggers"; |
193 | TCanvas *cAll = ProcessCanvasAllTrigger(eventCounters, CanvasName); | |
194 | ||
195 | cout<<"//---------------------------------- //"<<endl; | |
196 | cout<<"// Processing event counters //"<<endl; | |
197 | cout<<"//---------------------------------- //"<<endl; | |
005408df | 198 | |
93ce3c40 | 199 | //declare a default canvas c1 |
005408df | 200 | CanvasName = "c1"; |
b66f9801 | 201 | TCanvas *c1 = new TCanvas(CanvasName.Data(),CanvasName.Data()); |
93ce3c40 | 202 | c1->cd(); |
e31f508d | 203 | |
2d79afb9 | 204 | Int_t nCentBin = ( isHeavyIon ) ? kCentBinMax : 1; |
93f182e7 | 205 | TString selectionCent; |
8a0df16c | 206 | |
207 | Int_t *colorTab = new Int_t[triggersB->GetEntriesFast()]; | |
bab36da2 | 208 | Int_t const colorNrFirst = 8; |
209 | Int_t colorIndex = 0; | |
e31f508d | 210 | Int_t colorTabFirst[colorNrFirst] = {kGray+2,kRed,kBlue,kGreen,kOrange,kCyan,kMagenta,kYellow}; |
211 | for ( Int_t i = 0; i < triggersB->GetEntriesFast(); i++ ) { | |
bab36da2 | 212 | colorTab[i] = colorTabFirst[i] + colorIndex; |
213 | if ( i%colorNrFirst == 0 ) colorIndex++; | |
8a0df16c | 214 | } |
215 | TArrayI *colorInd = new TArrayI( triggersB->GetEntriesFast() ); | |
e31f508d | 216 | |
217 | for ( Int_t i = 0; i < triggersB->GetEntriesFast(); i++ ) colorInd->AddAt(colorTab[i],i); | |
13bb4ca7 | 218 | |
e31f508d | 219 | Int_t nTrig = triggersB->GetEntriesFast(); |
e31f508d | 220 | |
221 | TObjArray trigNoPS(nTrig*nCentBin); | |
222 | TObjArray trigWithPS(nTrig*nCentBin); | |
223 | TObjArray trigWithPST0Flag(nTrig*nCentBin); | |
224 | TObjArray trigWithPST0SPDFlag(nTrig*nCentBin); | |
225 | ||
226 | TObjArray trigSel; | |
227 | TObjArray trackTrigger(nTrig*nCentBin); | |
228 | TObjArray trackTracker(nTrig*nCentBin); | |
229 | TObjArray trackMatched(nTrig*nCentBin); | |
230 | TObjArray trackAll(nTrig*nCentBin); | |
231 | ||
232 | TObjArray trackAllMatched(nTrig*nCentBin); //matched tracks + additional geometrical cut | |
233 | TObjArray trackMatchedLowPt(nTrig*nCentBin); | |
234 | TObjArray trackMatchedHighPt(nTrig*nCentBin); | |
235 | ||
236 | TObjArray trackPosMatched(nTrig*nCentBin); | |
237 | TObjArray trackNegMatched(nTrig*nCentBin); | |
238 | ||
239 | TObjArray trackBeamGasMatched(nTrig*nCentBin); | |
240 | TObjArray trackBeamGasMatchedHighPt(nTrig*nCentBin); | |
241 | ||
242 | cout<<Form("Processing for %d triggers...",triggersB->GetEntriesFast()-1)<<endl; | |
243 | ||
93f182e7 | 244 | //loop on centrality |
2d79afb9 | 245 | for ( Int_t iCentBin = 0; iCentBin < nCentBin; iCentBin++){ |
e31f508d | 246 | selectionCent = kCentBinName[iCentBin]; |
93f182e7 | 247 | |
e31f508d | 248 | //Loop on trigger (last is all triggers) |
249 | for(Int_t iTrig = 0; iTrig < triggersB->GetEntriesFast(); iTrig++){ | |
b66f9801 | 250 | |
93f182e7 | 251 | TString histoNameBase = "h_trig", histoName; |
e31f508d | 252 | histoNameBase+= iTrig+1; |
b69e18be | 253 | |
e31f508d | 254 | Int_t index = GetIndex(triggersB,iTrig,iCentBin); |
255 | ||
256 | TH1* histo = 0; | |
257 | ||
258 | TString triggerName = ( (TObjString*) triggersB->At(iTrig) )->GetString(); | |
93f182e7 | 259 | if(triggerName.EqualTo(" ")) continue; |
260 | // Histo trigger without Phys. Sel. | |
261 | selection = selectionCent; selection += Form("trigger:%s/%s", triggerName.Data(), selectRuns.Data()); | |
b69e18be | 262 | // cout<<selection<<endl; |
93f182e7 | 263 | histoName = histoNameBase; |
264 | histoName += "BNoPS"; | |
e31f508d | 265 | histo = (TH1*) ProcessHisto(eventCounters, "run", selection, histoName, "", "Trigger content w/o Phys. Sel.", colorInd->At(iTrig)); |
266 | trigNoPS.AddAt(histo,index); | |
93f182e7 | 267 | // Histo trigger with Phys. Sel. |
268 | selection = selectionCent; selection += Form("trigger:%s/%s/selected:yes", triggerName.Data(), selectRuns.Data()); | |
269 | histoName = histoNameBase; | |
270 | histoName += "BWithPS"; | |
e31f508d | 271 | histo = (TH1*) ProcessHisto(eventCounters, "run", selection, histoName, "", "Trigger content w/ Phys. Sel.", colorInd->At(iTrig)); |
272 | trigWithPS.AddAt(histo,index); | |
4ccc39b4 | 273 | // Histo trigger with Phys. Sel. and T0 pile up not flagged |
274 | selection = selectionCent; selection += Form("trigger:%s/%s/selected:yes/t0pileup:no", triggerName.Data(), selectRuns.Data()); | |
275 | histoName = histoNameBase; | |
276 | histoName += "BWithPST0Flag"; | |
e31f508d | 277 | histo = (TH1*) ProcessHisto(eventCounters, "run", selection, histoName, "", "Trigger content w/ Phys. Sel. and no pile up from T0 flag", colorInd->At(iTrig)); |
278 | trigWithPST0Flag.AddAt(histo,index); | |
4ccc39b4 | 279 | // Histo trigger with Phys. Sel. and T0 + SPD pile up not flagged |
280 | selection = selectionCent; selection += Form("trigger:%s/%s/selected:yes/t0pileup:no/spdpileup:no", triggerName.Data(), selectRuns.Data()); | |
281 | histoName = histoNameBase; | |
282 | histoName += "BWithPST0SPDFlag"; | |
e31f508d | 283 | histo = (TH1*) ProcessHisto(eventCounters, "run", selection, histoName, "", "Trigger content w/ Phys. Sel. and no pile up from T0 and SPD flag", colorInd->At(iTrig)); |
284 | trigWithPST0SPDFlag.AddAt(histo,index); | |
005408df | 285 | |
93f182e7 | 286 | // Histo tracking : Phys. Sel. is selected or not depending on the macro arguments |
287 | selection = selectionCent; selection += Form("track:triggeronly/trigger:%s/%s/%s", triggerName.Data(), selectRuns.Data(), select.Data()); | |
e31f508d | 288 | histo = (TH1*) ProcessHisto(trackCounters, "run", selection, ""); |
289 | trackTrigger.AddAt(histo,index); | |
290 | ||
93f182e7 | 291 | selection = selectionCent; selection += Form("track:trackeronly/trigger:%s/%s/%s", triggerName.Data(), selectRuns.Data(), select.Data()); |
e31f508d | 292 | histo = (TH1*) ProcessHisto(trackCounters, "run", selection, ""); |
293 | trackTracker.AddAt(histo,index); | |
294 | ||
93f182e7 | 295 | selection = selectionCent; selection += Form("track:matched/trigger:%s/%s/%s", triggerName.Data(), selectRuns.Data(), select.Data()); |
e31f508d | 296 | histo = (TH1*) ProcessHisto(trackCounters, "run", selection, ""); |
297 | trackMatched.AddAt(histo,index); | |
005408df | 298 | |
53ad2789 | 299 | histo = (TH1*) ( (TH1*) trackTrigger.At(index))->Clone(""); |
300 | histo->Add( (TH1*) trackTracker.At(index) ); | |
301 | histo->Add( (TH1*) trackMatched.At(index) ); | |
e31f508d | 302 | trackAll.AddAt(histo,index); |
303 | ||
304 | //for the following, only integrated over centrality | |
305 | if ( iCentBin > 0 ) continue; | |
306 | ||
93f182e7 | 307 | selection = selectionCent; selection += Form("track:matched/trigger:%s/%s/%s/pt:low/acc:in", triggerName.Data() ,selectRuns.Data(), select.Data()); |
e31f508d | 308 | histo = (TH1*) ProcessHisto(trackCounters, "run", selection, ""); |
309 | trackMatchedLowPt.AddAt(histo,index); | |
310 | ||
93f182e7 | 311 | selection = selectionCent; selection += Form("track:matched/trigger:%s/%s/%s/pt:high/acc:in", triggerName.Data() ,selectRuns.Data(), select.Data()); |
e31f508d | 312 | histo = (TH1*) ProcessHisto(trackCounters, "run", selection, ""); |
313 | trackMatchedHighPt.AddAt(histo,index); | |
314 | ||
93f182e7 | 315 | selection = selectionCent; selection += Form("track:matched/trigger:%s/%s/charge:pos/%s/acc:in",triggerName.Data(), select.Data(),selectRuns.Data()); |
e31f508d | 316 | histo = (TH1*) ProcessHisto(trackCounters, "run", selection, ""); |
317 | trackPosMatched.AddAt(histo,index); | |
005408df | 318 | |
93f182e7 | 319 | selection = selectionCent; selection += Form("track:matched/trigger:%s/%s/charge:neg/%s/acc:in",triggerName.Data(), select.Data(),selectRuns.Data()); |
e31f508d | 320 | histo = (TH1*) ProcessHisto(trackCounters, "run", selection, ""); |
321 | trackNegMatched.AddAt(histo,index); | |
322 | ||
93f182e7 | 323 | selection = selectionCent; selection += Form("track:matched/trigger:%s/%s/%s/acc:in",triggerName.Data(), select.Data(),selectRuns.Data()); |
e31f508d | 324 | histo = (TH1*) ProcessHisto(trackCounters, "run", selection, ""); |
325 | trackAllMatched.AddAt(histo,index); | |
13bb4ca7 | 326 | |
327 | selection = selectionCent; selection += Form("track:matched/trigger:%s/%s/%s/acc:in/tagTrack:beamGas",triggerName.Data(), select.Data(),selectRuns.Data()); | |
e31f508d | 328 | histo = (TH1*) ProcessHisto(trackCounters, "run", selection, ""); |
329 | trackBeamGasMatched.AddAt(histo,index); | |
13bb4ca7 | 330 | |
331 | selection = selectionCent; selection += Form("track:matched/trigger:%s/%s/%s/acc:in/tagTrack:beamGas/pt:high",triggerName.Data(), select.Data(),selectRuns.Data()); | |
e31f508d | 332 | histo = (TH1*) ProcessHisto(trackCounters, "run", selection, ""); |
333 | trackBeamGasMatchedHighPt.AddAt(histo,index); | |
93f182e7 | 334 | } |
b66f9801 | 335 | } |
e31f508d | 336 | |
337 | if ( selectPhysics) trigSel = trigWithPS; | |
338 | else trigSel = trigNoPS; | |
b66f9801 | 339 | |
e31f508d | 340 | //if there is not Beam triggers just stop now |
005408df | 341 | Int_t count_trigger=0; |
e31f508d | 342 | for(Int_t iTrig = 0; iTrig < triggersB->GetEntriesFast(); iTrig++){ |
343 | Int_t centBinNr = 0; | |
344 | Int_t index = GetIndex(triggersB,iTrig,centBinNr); | |
345 | count_trigger += (static_cast<TH1*>(trigNoPS.At(index)))->GetEntries(); | |
005408df | 346 | } |
347 | if(count_trigger<=0) return; | |
348 | ||
e31f508d | 349 | Int_t *NumOfBNoPS = new Int_t[nCentBin*nTrig]; |
350 | Int_t *NumOfBWithPS = new Int_t[nCentBin*nTrig]; | |
005408df | 351 | |
e31f508d | 352 | for ( Int_t iCentBin = 0; iCentBin < nCentBin; iCentBin++){ |
353 | for ( Int_t iTrig = 0; iTrig < nTrig; iTrig++){ | |
354 | Int_t index = GetIndex(triggersB,iTrig,iCentBin); | |
355 | NumOfBNoPS[index] = (static_cast<TH1*>(trigNoPS.At(index)))->Integral(); | |
356 | NumOfBWithPS[index] = (static_cast<TH1*>(trigWithPS.At(index)))->Integral(); | |
93f182e7 | 357 | } |
b66f9801 | 358 | } |
93f182e7 | 359 | |
b66f9801 | 360 | cout<<"//==================================================================================="<<endl; |
361 | cout<<"// Put all plots in a ps file, easier to publish (Twiki)"<<endl; | |
362 | cout<<"//==================================================================================="<<endl; | |
363 | ||
93ce3c40 | 364 | c1->Print(OutFileNamePDF_open.Data()); |
93ce3c40 | 365 | TFile *rootFileOut = TFile::Open(OutFileNameROOT.Data(),"RECREATE"); |
13bb4ca7 | 366 | rootFileOut->cd(); |
367 | TDirectoryFile *dirGlobal = new TDirectoryFile("Global","Global","",(TDirectory*)rootFileOut->GetMotherDir()); | |
368 | cout<<"dirGlobal mother "<<(dirGlobal->GetMotherDir())->GetName()<<endl; | |
369 | //An array of TDirectoryFile | |
e31f508d | 370 | TObjArray *dirTrigger = new TObjArray(); |
13bb4ca7 | 371 | dirTrigger->SetOwner(); |
e31f508d | 372 | TObjArray *dirCent = new TObjArray(); |
13bb4ca7 | 373 | dirCent->SetOwner(); |
374 | for ( Int_t i = 0; i < triggersB->GetEntriesFast()-1 ; i++) { | |
375 | TString currTrigName = ( (TObjString*) triggersShortName->At(i) )->GetString(); | |
376 | TDirectoryFile *dirFile = new TDirectoryFile( currTrigName.Data(),currTrigName.Data(),"",(TDirectory*)rootFileOut->GetMotherDir() ); | |
377 | dirTrigger->AddLast( dirFile ); | |
2d79afb9 | 378 | for( Int_t j = 0; j < nCentBin; j++) { |
e31f508d | 379 | TString centName = kCentLegendNameShort[j]; |
13bb4ca7 | 380 | TDirectoryFile *dirFileCent = new TDirectoryFile( centName.Data(),centName.Data(),"",dirFile ); |
381 | dirCent->AddLast( dirFileCent ); | |
382 | } | |
383 | } | |
384 | ||
005408df | 385 | cAll->Print(OutFileNamePDF.Data()); |
13bb4ca7 | 386 | dirGlobal->cd(); |
005408df | 387 | cAll->Write(); |
13bb4ca7 | 388 | |
b66f9801 | 389 | cout<<"//==================================================================================="<<endl; |
005408df | 390 | cout<<"// new canvas with the total number of trigger with and without Phys. Sel."<<endl; |
b66f9801 | 391 | cout<<"//==================================================================================="<<endl; |
005408df | 392 | |
e31f508d | 393 | TCanvas *cTriggerContent = ProcessCanvasTriggerContent(triggersB, trigNoPS, trigWithPS, "TriggerContent"); |
b66f9801 | 394 | cTriggerContent->Print(OutFileNamePDF.Data()); |
13bb4ca7 | 395 | dirGlobal->cd(); |
b66f9801 | 396 | cTriggerContent->Write(); |
e31f508d | 397 | cTriggerContent->Close(); |
398 | ||
b66f9801 | 399 | cout<<"//==================================================================================="<<endl; |
005408df | 400 | cout<<"// new canvas with the relative content of each trigger w/o physics selection"<<endl; |
b66f9801 | 401 | cout<<"//==================================================================================="<<endl; |
005408df | 402 | |
e31f508d | 403 | TCanvas *cRelativeTriggerContent = ProcessCanvasRelativeTriggerContent(triggersB, trigNoPS, "RelativeTriggerContent"); |
93ce3c40 | 404 | cRelativeTriggerContent->Print(OutFileNamePDF.Data()); |
13bb4ca7 | 405 | dirGlobal->cd(); |
93ce3c40 | 406 | cRelativeTriggerContent->Write(); |
e31f508d | 407 | cRelativeTriggerContent->Close(); |
408 | ||
409 | ||
005408df | 410 | cout<<"//==================================================================================="<<endl; |
e31f508d | 411 | cout<<"// new canvas with effect from physics selection for each trigger "<<endl; |
005408df | 412 | cout<<"//==================================================================================="<<endl; |
413 | ||
93f182e7 | 414 | TCanvas *cPhysSelCut = 0x0; |
e31f508d | 415 | cPhysSelCut = ProcessCanvasPhysSelCut(triggersB, trigNoPS, trigWithPS, "PhysSelCutOnCollTrigger"); |
005408df | 416 | cPhysSelCut->Print(OutFileNamePDF.Data()); |
13bb4ca7 | 417 | dirGlobal->cd(); |
005408df | 418 | cPhysSelCut->Write(); |
e31f508d | 419 | cPhysSelCut->Close(); |
13bb4ca7 | 420 | rootFileOut->cd(); |
93f182e7 | 421 | |
4ccc39b4 | 422 | cout<<"//==================================================================================="<<endl; |
e31f508d | 423 | cout<<"// new canvas with effect from T0 pile-up flag for each trigger "<<endl; |
4ccc39b4 | 424 | cout<<"//==================================================================================="<<endl; |
425 | ||
426 | TCanvas *cPhysSelCutT0Flag = 0x0; | |
e31f508d | 427 | cPhysSelCutT0Flag = ProcessCanvasPhysSelCut(triggersB, trigNoPS, trigWithPST0Flag, "PhysSelCutOnCollTriggerT0Flag"); |
4ccc39b4 | 428 | cPhysSelCutT0Flag->Print(OutFileNamePDF.Data()); |
429 | dirGlobal->cd(); | |
430 | cPhysSelCutT0Flag->Write(); | |
e31f508d | 431 | cPhysSelCutT0Flag->Close(); |
4ccc39b4 | 432 | rootFileOut->cd(); |
433 | ||
434 | ||
435 | cout<<"//==================================================================================="<<endl; | |
e31f508d | 436 | cout<<"// new canvas with effect from T0 + SPD pile-up flag for each trigger "<<endl; |
4ccc39b4 | 437 | cout<<"//==================================================================================="<<endl; |
438 | ||
439 | TCanvas *cPhysSelCutT0SPDFlag = 0x0; | |
e31f508d | 440 | cPhysSelCutT0SPDFlag = ProcessCanvasPhysSelCut(triggersB, trigNoPS, trigWithPST0SPDFlag, "PhysSelCutOnCollTriggerT0SPDFlag"); |
4ccc39b4 | 441 | cPhysSelCutT0SPDFlag->Print(OutFileNamePDF.Data()); |
442 | dirGlobal->cd(); | |
443 | cPhysSelCutT0SPDFlag->Write(); | |
e31f508d | 444 | cPhysSelCutT0SPDFlag->Close(); |
4ccc39b4 | 445 | rootFileOut->cd(); |
446 | ||
93f182e7 | 447 | TString canvasName; |
448 | TString triggerName; | |
449 | TString legendHeader=""; | |
450 | ||
93f182e7 | 451 | if ( isHeavyIon ){ |
e31f508d | 452 | |
453 | cout<<"//==================================================================================="<<endl; | |
454 | cout<<"// new canvas with effect from physics selection for each trigger and centrality bin (only in heavy-ion) "<<endl; | |
455 | cout<<"//==================================================================================="<<endl; | |
456 | ||
13bb4ca7 | 457 | TCanvas *cPhysSelCutCentrality; |
93f182e7 | 458 | |
459 | //loop over trigger | |
e31f508d | 460 | for( Int_t iTrig = 0; iTrig < triggersB->GetEntriesFast(); iTrig++){ |
93f182e7 | 461 | //skip sum of all triggers |
e31f508d | 462 | if(iTrig == (triggersB->GetEntriesFast()-1)) continue; |
93f182e7 | 463 | |
464 | canvasName = "PhysSel_trigger"; | |
e31f508d | 465 | canvasName += ( (TObjString*) triggersShortName->At(iTrig) )->GetString(); |
13bb4ca7 | 466 | |
e31f508d | 467 | cPhysSelCutCentrality = ProcessCanvasPhysSelCutCentrality(triggersB, trigNoPS, trigWithPS, iTrig, canvasName, kCentLegendNameShort+1); |
13bb4ca7 | 468 | cPhysSelCutCentrality->Print(OutFileNamePDF.Data()); |
e31f508d | 469 | ( (TDirectoryFile*) dirTrigger->At(iTrig) )->cd(); |
13bb4ca7 | 470 | cPhysSelCutCentrality->Write(); |
e31f508d | 471 | cPhysSelCutCentrality->Close(); |
93f182e7 | 472 | } |
473 | } | |
13bb4ca7 | 474 | rootFileOut->cd(); |
93f182e7 | 475 | |
93f182e7 | 476 | if ( isHeavyIon ){ |
e31f508d | 477 | cout<<"//==================================================================================="<<endl; |
478 | cout<<"// new canvas for centrality percentile check (only in PbPb) "<<endl; | |
479 | cout<<"//==================================================================================="<<endl; | |
480 | ||
13bb4ca7 | 481 | TCanvas *cCentralityCheck; |
93f182e7 | 482 | |
483 | //loop over trigger | |
e31f508d | 484 | for ( Int_t iTrig = 0; iTrig < triggersB->GetEntriesFast(); iTrig++){ |
93f182e7 | 485 | //skip sum of all triggers |
e31f508d | 486 | if ( iTrig == (triggersB->GetEntriesFast()-1) ) continue; |
2e7189d6 | 487 | |
93f182e7 | 488 | canvasName = "CentralityCheck_trigger"; |
e31f508d | 489 | canvasName += ( (TObjString*) triggersShortName->At(iTrig) )->GetString(); |
93f182e7 | 490 | |
e31f508d | 491 | cCentralityCheck = ProcessCanvasCentralityPercentile(triggersB,trigNoPS,trigWithPS,iTrig,canvasName,kCentLegendNameShort); |
93f182e7 | 492 | |
13bb4ca7 | 493 | cCentralityCheck->Print(OutFileNamePDF.Data()); |
e31f508d | 494 | ( (TDirectoryFile*) dirTrigger->At(iTrig) )->cd(); |
13bb4ca7 | 495 | cCentralityCheck->Write(); |
e31f508d | 496 | cCentralityCheck->Close(); |
93f182e7 | 497 | } |
498 | } | |
13bb4ca7 | 499 | rootFileOut->cd(); |
93f182e7 | 500 | |
93ce3c40 | 501 | |
005408df | 502 | cout<<"//==================================================================================="<<endl; |
e31f508d | 503 | cout<<"// Ratio of tracks over trigger type (2 canvases) "<<endl; |
005408df | 504 | cout<<"//==================================================================================="<<endl; |
505 | ||
506 | //Print a canvas per trigger type | |
13bb4ca7 | 507 | TCanvas *cTracksoverTrigger; |
508 | TCanvas* cTrackMultB; | |
93f182e7 | 509 | |
e31f508d | 510 | //loop over centrality bins |
2d79afb9 | 511 | for ( Int_t iCentBin = 0; iCentBin < nCentBin; iCentBin++){ |
13bb4ca7 | 512 | if ( isHeavyIon ){ |
513 | legendHeader = "for "; | |
e31f508d | 514 | legendHeader += kCentLegendName[iCentBin]; |
13bb4ca7 | 515 | } |
516 | else legendHeader =""; | |
e31f508d | 517 | //loop over triggers |
518 | for(Int_t iTrig = 0; iTrig < triggersB->GetEntriesFast(); iTrig++){ | |
93f182e7 | 519 | //skip sum of all triggers |
e31f508d | 520 | if( iTrig == (triggersB->GetEntriesFast()-1) ) continue; |
13bb4ca7 | 521 | |
2d79afb9 | 522 | ( (TDirectoryFile*) dirCent->At( iTrig*nCentBin+iCentBin ) )->cd(); |
13bb4ca7 | 523 | |
93f182e7 | 524 | canvasName = "RatioTrackTypes_cent"; |
e31f508d | 525 | canvasName += iCentBin; |
93f182e7 | 526 | canvasName +="trigger"; |
e31f508d | 527 | canvasName += ( (TObjString*) triggersShortName->At(iTrig) )->GetString(); |
528 | cTracksoverTrigger = ProcessCanvasTracksoverTrigger(triggersB, trigSel, trackTracker, trackTrigger, trackMatched, trackAll, iTrig, iCentBin, canvasName,legendHeader); | |
13bb4ca7 | 529 | cTracksoverTrigger->Print(OutFileNamePDF.Data()); |
530 | cTracksoverTrigger->Write(); | |
e31f508d | 531 | cTracksoverTrigger->Close(); |
93f182e7 | 532 | |
533 | canvasName = "TrackMult_cent"; | |
e31f508d | 534 | canvasName += iCentBin; |
93f182e7 | 535 | canvasName +="trigger"; |
e31f508d | 536 | canvasName +=( (TObjString*) triggersShortName->At(iTrig) )->GetString(); |
537 | cTrackMultB= ProcessCanvasTrackMultB(triggersB, trigSel, trackTracker, trackTrigger, trackMatched, iTrig, iCentBin, canvasName, legendHeader); | |
13bb4ca7 | 538 | cTrackMultB->Print(OutFileNamePDF.Data()); |
539 | cTrackMultB->Write(); | |
e31f508d | 540 | cTrackMultB->Close(); |
93f182e7 | 541 | } |
b66f9801 | 542 | } |
13bb4ca7 | 543 | rootFileOut->cd(); |
005408df | 544 | |
545 | cout<<"//===================================================="<<endl; | |
e31f508d | 546 | cout<<"// Draw matched tracks asymmetry for each trigger "<<endl; |
005408df | 547 | cout<<"//===================================================="<<endl; |
548 | ||
549 | //Print a canvas per trigger type | |
13bb4ca7 | 550 | TCanvas *cAsymMatched; |
93f182e7 | 551 | |
e31f508d | 552 | legendHeader = "for all collisions"; |
553 | for ( Int_t iTrig = 0; iTrig < triggersB->GetEntriesFast(); iTrig++){ | |
554 | //skip sum of all triggers | |
555 | if ( iTrig == (triggersB->GetEntriesFast()-1) ) continue; | |
556 | ||
557 | ( (TDirectoryFile*) dirTrigger->At( iTrig ) )->cd(); | |
558 | ||
559 | canvasName = "AsymMatched"; | |
560 | canvasName +="trigger"; | |
561 | canvasName +=( (TObjString*) triggersShortName->At(iTrig) )->GetString(); | |
562 | Int_t iCentBin = 0; | |
563 | cAsymMatched = ProcessCanvasAsymMatched(triggersB, trackPosMatched, trackNegMatched, trackAllMatched, iTrig, iCentBin, canvasName,legendHeader); | |
564 | cAsymMatched->Print(OutFileNamePDF.Data()); | |
565 | cAsymMatched->Write(); | |
566 | cAsymMatched->Close(); | |
005408df | 567 | } |
13bb4ca7 | 568 | rootFileOut->cd(); |
8a0df16c | 569 | legendHeader = ""; |
13bb4ca7 | 570 | |
571 | cout<<"//===================================================================="<<endl; | |
e31f508d | 572 | cout<<"// Draw beam gas contribution to matched tracks for each trigger "<<endl; |
13bb4ca7 | 573 | cout<<"//===================================================================="<<endl; |
574 | ||
575 | //Print a canvas per trigger type | |
576 | TCanvas *cBeamGasMatched; | |
577 | ||
578 | //loop over trigger | |
e31f508d | 579 | for ( Int_t iTrig = 0; iTrig < triggersB->GetEntriesFast(); iTrig++){ |
13bb4ca7 | 580 | //skip sum of all triggers |
e31f508d | 581 | if ( iTrig == (triggersB->GetEntriesFast()-1)) continue; |
13bb4ca7 | 582 | |
e31f508d | 583 | ( (TDirectoryFile*) dirTrigger->At(iTrig) )->cd(); |
13bb4ca7 | 584 | canvasName = "BeamGasMatched"; |
585 | canvasName +="trigger"; | |
e31f508d | 586 | canvasName +=( (TObjString*) triggersShortName->At(iTrig) )->GetString(); |
587 | Int_t iCentBin = 0; | |
588 | cBeamGasMatched= ProcessCanvasBeamGasMatched(triggersB, trackBeamGasMatched, trackBeamGasMatchedHighPt, trackAllMatched, trackMatchedHighPt, iTrig, iCentBin, canvasName,legendHeader); | |
13bb4ca7 | 589 | cBeamGasMatched->Print(OutFileNamePDF.Data()); |
590 | cBeamGasMatched->Write(); | |
e31f508d | 591 | cBeamGasMatched->Close(); |
13bb4ca7 | 592 | } |
593 | rootFileOut->cd(); | |
594 | ||
b66f9801 | 595 | cout<<"//=================================================="<<endl; |
596 | cout<<"// Draw high pt tracks per trigger"<<endl; | |
005408df | 597 | cout<<"//=================================================="<<endl; |
598 | ||
599 | //Print a canvas per trigger type | |
13bb4ca7 | 600 | TCanvas *cHighPtMuons; |
e31f508d | 601 | legendHeader = "for all collisions"; |
602 | //loop over trigger | |
603 | for ( Int_t iTrig = 0; iTrig < triggersB->GetEntriesFast(); iTrig++){ | |
604 | //skip sum of all triggers | |
605 | if( iTrig == (triggersB->GetEntriesFast()-1)) continue; | |
606 | ||
607 | ( (TDirectoryFile*) dirTrigger->At( iTrig ) )->cd(); | |
93f182e7 | 608 | |
e31f508d | 609 | canvasName = "HighPtMuons"; |
610 | canvasName +="trigger"; | |
611 | canvasName +=( (TObjString*) triggersShortName->At(iTrig) )->GetString(); | |
13bb4ca7 | 612 | |
e31f508d | 613 | Int_t iCentBin = 0; |
614 | cHighPtMuons = ProcessCanvasHighPtMuons(triggersB, trigSel, trackMatchedLowPt, trackMatchedHighPt, iTrig, iCentBin, canvasName,legendHeader); | |
615 | cHighPtMuons->Print(OutFileNamePDF.Data()); | |
616 | cHighPtMuons->Write(); | |
617 | cHighPtMuons->Close(); | |
b66f9801 | 618 | } |
13bb4ca7 | 619 | rootFileOut->cd(); |
005408df | 620 | |
b66f9801 | 621 | // close merged file |
93ce3c40 | 622 | globalFile->Close(); |
b66f9801 | 623 | |
b66f9801 | 624 | //=================================================================================== |
625 | //Print out the number of trigger without and with Phys. Sel. | |
626 | //=================================================================================== | |
627 | ||
628 | cout << endl << endl; | |
629 | //==================================================== | |
630 | if (PRINTSTAT){ | |
93f182e7 | 631 | if ( triggersB->At(kCMUS) ) { |
b66f9801 | 632 | |
93f182e7 | 633 | // set the format to print labels |
e31f508d | 634 | Int_t centBinNr = 0; |
635 | THashList* labels = (static_cast<TH1*>(trigWithPS.At(triggersB->GetEntriesFast()*centBinNr+kCMUS)))->GetXaxis()->GetLabels(); | |
93f182e7 | 636 | TString format(Form("\n%%%ds %%9d",0)); |
637 | Int_t nRuns=0; | |
b66f9801 | 638 | |
93f182e7 | 639 | // print value for each label |
640 | TObjString* label = 0x0; | |
641 | TIter nextLabel(labels); | |
642 | cout << "-------------------------------------------------" << endl; | |
643 | cout << "Run Number" << "\t Number of "<< ( (TObjString*) triggersB->At(kCMUS) )->GetString()<<" after Phys. Sel. " << endl ; | |
644 | while ((label = static_cast<TObjString*>(nextLabel()))) { | |
645 | nRuns++; | |
646 | Int_t bin = (Int_t) label->GetUniqueID(); | |
e31f508d | 647 | printf(format.Data(), label->String().Data(), (Int_t) (static_cast<TH1*>(trigWithPS.At(triggersB->GetEntriesFast()*centBinNr+kCMUS)))->GetBinContent(bin)); |
93f182e7 | 648 | } |
649 | printf("\n========== Total #runs = %d ==============\n",nRuns); | |
650 | printf("\n\n"); | |
b66f9801 | 651 | |
b66f9801 | 652 | |
93f182e7 | 653 | cout << "-------------------------------------------------" << endl; |
654 | cout << "Total statistic" << endl; | |
655 | cout << " " << endl ; | |
656 | ||
657 | cout << "-------------------------------------------------------------------" << endl; | |
658 | cout<<"Number of triggers w/o Phys. Sel./ w/ Phys. Sel (Phys. Sel. cut in %)"<<endl; | |
e31f508d | 659 | for(Int_t iTrig = 0; iTrig < triggersB->GetEntriesFast()-1; iTrig++){ |
660 | TString triggerNameB = ( (TObjString*) triggersB->At(iTrig) )->GetString(); | |
005408df | 661 | |
93f182e7 | 662 | Int_t cutinpercent = 0; |
e31f508d | 663 | printf("%10s\t",triggerNameB.Data()); |
664 | Int_t index = GetIndex(triggersB,iTrig,centBinNr); | |
665 | if(NumOfBNoPS[index]) cutinpercent = (Int_t) ((Double_t)(NumOfBNoPS[index]-NumOfBWithPS[index])/(NumOfBNoPS[index])*100.); | |
666 | printf("%5.2e / %.2e (%d%%)\n", (Double_t) NumOfBNoPS[index],(Double_t) NumOfBWithPS[index],cutinpercent); | |
93f182e7 | 667 | cutinpercent = 0; |
93f182e7 | 668 | } |
669 | } | |
b66f9801 | 670 | } |
671 | ||
4ccc39b4 | 672 | //temporary |
673 | // return; | |
674 | ||
b66f9801 | 675 | |
93ce3c40 | 676 | //--------------------------------------------- // |
677 | // monitor quantities run per run // | |
678 | //--------------------------------------------- // | |
e31f508d | 679 | |
680 | //output histos | |
681 | //const Int_t kNHistos = 100; | |
682 | //TObjArray outHist(kNHistos); | |
683 | ||
13bb4ca7 | 684 | Int_t const nMuonTriggerCase = 7; |
685 | TH1F *hMuonTrigger[nMuonTriggerCase]; | |
686 | TString muonTriggerName[nMuonTriggerCase] = {"Unlike-only","Like-only","Hpt-only","Unlike&Like","Unlike&Hpt","Like&Hpt","Unlike&Like&Hpt"}; | |
687 | for ( Int_t i = 0; i < nMuonTriggerCase; i++ ) { | |
688 | hMuonTrigger[i] = new TH1F(Form("hMuonTrigger_%s", muonTriggerName[i].Data()),Form("Trigger %s per run",muonTriggerName[i].Data()),10000,1,10000); | |
689 | } | |
690 | ||
b8e17107 | 691 | TH1F* hTriggerCutVsRun[2], *hTriggerCutWidthVsRun[2]; |
692 | for ( Int_t ihisto=0; ihisto<2; ++ihisto ) { | |
693 | TString cutName = ( ihisto == 0 ) ? "Lpt" : "Hpt"; | |
694 | hTriggerCutVsRun[ihisto] = new TH1F(Form("hTriggerCutVsRun%s", cutName.Data()), Form("Trigger %s cut per run", cutName.Data()), 10000,1,10000); | |
695 | hTriggerCutWidthVsRun[ihisto] = (TH1F*)hTriggerCutVsRun[ihisto]->Clone(Form("hTriggerCutWidthVsRun%s", cutName.Data())); | |
696 | } | |
8eabe3bd | 697 | TF1* fitMatchTrig = new TF1("fitMatchTrig","[3] + [0] * ( 1. + TMath::Erf((x - [1]) / [2] / TMath::Sqrt(2.)))", 0.1, 6.); |
93ce3c40 | 698 | TH1F* hNClustersPerTrackVsRun_Mean = new TH1F("hNClustersPerTrackVsRun_Mean", "averaged number of associated clusters per track;run;<n_{clusters}>",10000,1,10000); |
699 | TH1F* hNClustersPerTrackVsRun_Sigma = new TH1F("hNClustersPerTrackVsRun_Sigma", "dispersion of the number of associated clusters per track;run;#sigma_{n_{clusters}}",10000,1,10000); | |
700 | TH1F* hNChamberHitPerTrack_Mean = new TH1F("hNChamberHitPerTrack_Mean", "averaged number of chambers hit per track;run;<n_{chamber hit}>",10000,1,10000); | |
701 | TH1F* hNChamberHitPerTrack_Sigma = new TH1F("hNChamberHitPerTrack_Sigma", "dispersion of the number of chambers hit per track;run;#sigma_{n_{chamber hit}}",10000,1,10000); | |
702 | TH1F* hChi2_Mean = new TH1F("hChi2_Mean", "averaged normalized #chi^{2} distribution;run;<#chi^{2} / ndf>",10000,1,10000); | |
703 | TH1F* hChi2_Sigma = new TH1F("hChi2_Sigma", "dispersion of normalized #chi^{2} distribution;run;#sigma_{#chi^{2} / ndf}",10000,1,10000); | |
704 | TH1F* hNClustersInCh[10]; | |
4916d740 | 705 | for (Int_t ich=0; ich<10; ich++){ |
706 | hNClustersInCh[ich] = new TH1F(Form("hNClustersInCh%d",ich+1), Form("averaged number of clusters in chamber %d per track;run;<n_{clusters}>",ich+1),10000,1,10000); | |
707 | } | |
13bb4ca7 | 708 | TH1F* hClusterChargeMeanInCh[10], *hClusterChargeSigmaInCh[10]; |
709 | for (Int_t ich=0; ich<10; ich++){ | |
710 | hClusterChargeMeanInCh[ich] = new TH1F(Form("hClusterChargeMeanInCh%d",ich+1), Form("averaged cluster charge -mean- per track in chamber %d",ich+1),10000,1,10000); | |
711 | hClusterChargeSigmaInCh[ich] = new TH1F(Form("hClusterChargeSigmaInCh%d",ich+1), Form("averaged cluster charge -sigma- per track in chamber %d",ich+1),10000,1,10000); | |
712 | } | |
713 | TH1F* hClusterSizeMeanInCh[10], *hClusterSizeSigmaInCh[10]; | |
714 | for (Int_t ich=0; ich<10; ich++){ | |
715 | hClusterSizeMeanInCh[ich] = new TH1F(Form("hClusterSizeMeanInCh%d",ich+1), Form("averaged cluster size -mean- per track in chamber %d",ich+1),10000,1,10000); | |
716 | hClusterSizeSigmaInCh[ich] = new TH1F(Form("hClusterSizeSigmaInCh%d",ich+1), Form("averaged cluster size -sigma- per track in chamber %d",ich+1),10000,1,10000); | |
717 | } | |
718 | ||
93ce3c40 | 719 | TH1F* hClusterHitMapXInCh[10]; |
4916d740 | 720 | for (Int_t ich=0; ich<10; ich++){ |
721 | hClusterHitMapXInCh[ich] = new TH1F(Form("hClusterHitMapXInCh%d",ich+1), Form("averaged cluster position distribution in chamber %d;X (cm)",ich+1),10000,1,10000); | |
722 | } | |
93ce3c40 | 723 | TH1F* hClusterHitMapYInCh[10]; |
4916d740 | 724 | for (Int_t ich=0; ich<10; ich++){ |
725 | hClusterHitMapYInCh[ich] = new TH1F(Form("hClusterHitMapYInCh%d",ich+1), Form("averaged cluster position distribution in chamber %d;Y (cm)",ich+1),10000,1,10000); | |
726 | } | |
13bb4ca7 | 727 | |
728 | ||
93ce3c40 | 729 | Int_t ibin = 1; |
730 | ||
731 | // Are the runs stored locally or in alien? | |
732 | Int_t isAlienFile = 0; | |
733 | if(alienBaseDir.Contains("alien:")){ | |
734 | isAlienFile = 1; | |
735 | alienBaseDir.ReplaceAll("alien://",""); | |
736 | } | |
4ccc39b4 | 737 | |
b66f9801 | 738 | cout<<"============================================================"<<endl; |
005408df | 739 | cout<< "Monitoring quantities run per run: loop over "<<runs->GetEntriesFast()<<" runs."<<endl; |
b66f9801 | 740 | cout<<" directory = "<<alienBaseDir.Data()<<endl; |
741 | cout<<"============================================================"<<endl; | |
e31f508d | 742 | |
93ce3c40 | 743 | // Loop over runs |
005408df | 744 | for ( Int_t irun=0; irun<runs->GetEntriesFast(); irun++ ) { |
93ce3c40 | 745 | |
005408df | 746 | TString run = ((TObjString*)runs->UncheckedAt(irun))->GetString(); |
e31f508d | 747 | |
93ce3c40 | 748 | // get the file (or list of files) to be analyzed |
749 | TString command; | |
750 | TGridResult *res = 0; | |
93ce3c40 | 751 | |
752 | if(isAlienFile){ | |
b66f9801 | 753 | command = Form("find %s/ %s/%s", alienBaseDir.Data(), run.Data(), QAFileName); |
93ce3c40 | 754 | res = gGrid->Command(command); |
755 | if (!res) { | |
93f182e7 | 756 | Error("PlotMuonQA","no result for the command: %s",command.Data()); |
93ce3c40 | 757 | return; |
758 | } | |
759 | } | |
760 | else{ | |
761 | res = new TGridResult(); | |
762 | ||
a11ac6ec | 763 | command = Form("find %s/*%s/ -name %s | xargs", alienBaseDir.Data(), run.Data(), QAFileName); |
056ae2c8 | 764 | TString foundFiles = gSystem->GetFromPipe(command.Data()); |
765 | TObjArray* arr = foundFiles.Tokenize(" "); | |
8c9b2836 | 766 | |
056ae2c8 | 767 | for ( Int_t iarr=0; iarr<arr->GetEntries(); iarr++ ) { |
768 | res->Add(new TObjString(arr->At(iarr)->GetName())); | |
93ce3c40 | 769 | } |
056ae2c8 | 770 | delete arr; |
93ce3c40 | 771 | } |
772 | ||
773 | // Loop over 'find' results and get next LFN | |
774 | TIter nextmap(res); | |
056ae2c8 | 775 | TObjString *objs = 0; |
056ae2c8 | 776 | TObject* currObj = 0x0; |
8c9b2836 | 777 | Bool_t searchRunNr = kFALSE; |
778 | if ( !isAlienFile && run.Contains("*") ) searchRunNr = kTRUE; | |
779 | ||
93ce3c40 | 780 | //some checks |
8c9b2836 | 781 | while ( ( currObj = nextmap() ) ){ |
93ce3c40 | 782 | |
783 | // get the current file url | |
784 | if(isAlienFile){ | |
056ae2c8 | 785 | objs = static_cast<TObjString*>(static_cast<TMap*>(currObj)->GetValue("turl")); |
93ce3c40 | 786 | } |
787 | else{ | |
056ae2c8 | 788 | objs=static_cast<TObjString*>(currObj); |
789 | } | |
93ce3c40 | 790 | |
056ae2c8 | 791 | if (objs->GetString().IsNull()) { |
93f182e7 | 792 | Error("PlotMuonQA","turl/obj not found for the run %s... SKIPPING", run.Data()); |
93ce3c40 | 793 | continue; |
794 | } | |
8c9b2836 | 795 | |
796 | if ( searchRunNr ) { | |
bc5caee1 | 797 | Int_t runNr = GetRunNumber(objs->GetString()); |
798 | if (runNr > 0) run = Form("%i",runNr); | |
8c9b2836 | 799 | } |
800 | ||
a11ac6ec | 801 | if ( run.IsDigit() && ! selectRuns.Contains(Form("%i",run.Atoi())) ) continue; |
bc5caee1 | 802 | |
93ce3c40 | 803 | // open the outfile for this run |
804 | TFile *runFile = TFile::Open(objs->GetString()); | |
805 | if (!runFile || ! runFile->IsOpen()) { | |
93f182e7 | 806 | Error("PlotMuonQA","failed to open file: %s", objs->GetName()); |
8c9b2836 | 807 | continue; |
93ce3c40 | 808 | } |
809 | runFile->Cd("MUON_QA"); | |
810 | ||
811 | // get interesting histos | |
812 | TObjArray* general1 = static_cast<TObjArray*>(runFile->FindObjectAny("general1")); | |
4916d740 | 813 | TObjArray* general2 = static_cast<TObjArray*>(runFile->FindObjectAny("general2")); |
93ce3c40 | 814 | TObjArray* expert = static_cast<TObjArray*>(runFile->FindObjectAny("expert")); |
b66f9801 | 815 | |
4916d740 | 816 | if (!general1 || !general2 || !expert){ |
93f182e7 | 817 | Error("PlotMuonQA","All objects not here !!! ===> Skipping...for %s",objs->GetName()); |
4916d740 | 818 | continue; |
819 | } | |
13bb4ca7 | 820 | |
4916d740 | 821 | TH1* hNClustersPerTrack = static_cast<TH1*>(general1->FindObject("hNClustersPerTrack")); |
93ce3c40 | 822 | TH1* hNChamberHitPerTrack = static_cast<TH1*>(general1->FindObject("hNChamberHitPerTrack")); |
823 | TH1* hChi2 = static_cast<TH1*>(general1->FindObject("hChi2")); | |
4916d740 | 824 | TH1* hNClustersPerCh = static_cast<TH1*>(general2->FindObject("hNClustersPerCh")); |
13bb4ca7 | 825 | TH1 *hClusterChargePerChMean =static_cast<TH1*>(general2->FindObject("hClusterChargePerChMean")); |
826 | TH1 *hClusterChargePerChSigma =static_cast<TH1*>(general2->FindObject("hClusterChargePerChSigma")); | |
827 | TH1 *hClusterSizePerChMean =static_cast<TH1*>(general2->FindObject("hClusterSizePerChMean")); | |
828 | TH1 *hClusterSizePerChSigma =static_cast<TH1*>(general2->FindObject("hClusterSizePerChSigma")); | |
829 | TH1* hMuonTriggers = static_cast<TH1*>(general1->FindObject("hMuonTriggers")); | |
830 | for (Int_t ihisto=0; ihisto<nMuonTriggerCase; ihisto++){ | |
831 | Int_t val = 0; | |
832 | if ( hMuonTriggers ) val = hMuonTriggers->GetBinContent(ihisto+2); | |
833 | if ( hMuonTrigger[ihisto]->GetSumw2N() == 0 ) hMuonTrigger[ihisto]->Sumw2(); | |
834 | hMuonTrigger[ihisto]->SetBinContent(ibin,val); | |
835 | hMuonTrigger[ihisto]->SetBinError(ibin,TMath::Sqrt(val)); | |
836 | hMuonTrigger[ihisto]->GetXaxis()->SetBinLabel(ibin,run.Data()); | |
837 | } | |
b8e17107 | 838 | TH1* hPtDistrib = static_cast<TH1*>(general1->FindObject("hPt")); |
839 | TH1* hPtDistribLpt = static_cast<TH1*>(general1->FindObject("hPtMatchLpt")); | |
840 | TH1* hPtDistribHpt = static_cast<TH1*>(general1->FindObject("hPtMatchHpt")); | |
841 | if ( hPtDistrib && hPtDistribLpt && hPtDistribHpt ) { | |
13bb4ca7 | 842 | if ( hPtDistrib->GetSumw2N() == 0 ) hPtDistrib->Sumw2(); |
843 | TH1* histoMatch[2] = {hPtDistribLpt, hPtDistribHpt}; | |
844 | for ( Int_t ihisto=0; ihisto<2; ++ihisto ) { | |
845 | if ( histoMatch[ihisto]->GetSumw2N() == 0 ) histoMatch[ihisto]->Sumw2(); | |
846 | if ( histoMatch[ihisto]->GetEntries() == 0 ) continue; | |
847 | histoMatch[ihisto]->Divide(hPtDistrib); | |
848 | Double_t minEff = 99999., maxEff = -1.; | |
849 | Double_t ptMinFit = 0.1; | |
850 | Double_t ptMaxFit = 6.; | |
851 | Int_t ptBinLow = histoMatch[ihisto]->GetXaxis()->FindBin(ptMinFit); | |
852 | Int_t ptBinHigh = histoMatch[ihisto]->GetXaxis()->FindBin(ptMaxFit); | |
853 | for ( Int_t currBin=ptBinLow; currBin<=ptBinHigh; currBin++ ) { | |
854 | Double_t currEff = histoMatch[ihisto]->GetBinContent(currBin); | |
855 | Double_t currPt = histoMatch[ihisto]->GetXaxis()->GetBinCenter(currBin); | |
856 | if ( currPt < 1.5 && minEff > currEff ) { | |
857 | ptMinFit = currPt; | |
858 | minEff = currEff; | |
859 | } | |
860 | if ( currPt > 0.5 && maxEff < currEff ) { | |
861 | ptMaxFit = currPt; | |
862 | maxEff = currEff; | |
863 | } | |
864 | } // loop on histo bins | |
865 | fitMatchTrig->SetParameters(0.5, 0.5, 0.8, 0.2); | |
866 | fitMatchTrig->SetParLimits(0,0.,1.); | |
867 | fitMatchTrig->SetParLimits(1,0.,5.); | |
868 | fitMatchTrig->SetParLimits(2,0.,5.); | |
869 | fitMatchTrig->SetParLimits(3,0.,0.5); | |
870 | histoMatch[ihisto]->Fit(fitMatchTrig,"RQ0","",ptMinFit,ptMaxFit); | |
871 | Double_t ptCut = fitMatchTrig->GetParameter(1); | |
872 | Double_t ptCutErr = fitMatchTrig->GetParError(1); | |
873 | Double_t ptCutWidth = fitMatchTrig->GetParameter(2); | |
874 | if ( ptCut < 0 || ptCut > 10. ) { | |
875 | ptCut = ptCutErr = ptCutWidth = 0.; | |
876 | } | |
877 | hTriggerCutVsRun[ihisto]->SetBinContent(ibin, ptCut); | |
878 | hTriggerCutVsRun[ihisto]->SetBinError(ibin, ptCutErr); | |
879 | hTriggerCutWidthVsRun[ihisto]->SetBinContent(ibin, ptCut); | |
880 | hTriggerCutWidthVsRun[ihisto]->SetBinError(ibin, ptCutWidth); | |
881 | } // loop on match histos | |
005408df | 882 | } |
93ce3c40 | 883 | TH2* hClusterHitMapInCh[10]; |
884 | for(Int_t ich=0; ich<10; ich++) hClusterHitMapInCh[ich] = static_cast<TH2*>(expert->FindObject(Form("hClusterHitMapInCh%d",ich+1))); | |
885 | ||
93ce3c40 | 886 | if (!hNClustersPerCh) { |
93f182e7 | 887 | Warning("PlotMUONQA","File: %s has empty histograms !", objs->GetName()); |
93ce3c40 | 888 | hNClustersPerTrackVsRun_Mean->SetBinContent(ibin, 0.); |
889 | hNClustersPerTrackVsRun_Mean->SetBinError(ibin, 1.); | |
890 | hNClustersPerTrackVsRun_Sigma->SetBinContent(ibin, 0.); | |
891 | hNClustersPerTrackVsRun_Sigma->SetBinError(ibin, 1.); | |
892 | hNChamberHitPerTrack_Mean->SetBinContent(ibin, 0.); | |
893 | hNChamberHitPerTrack_Mean->SetBinError(ibin, 1.); | |
894 | hNChamberHitPerTrack_Sigma->SetBinContent(ibin, 0.); | |
895 | hNChamberHitPerTrack_Sigma->SetBinError(ibin, 1.); | |
896 | hChi2_Mean->SetBinContent(ibin, 0.); | |
897 | hChi2_Mean->SetBinError(ibin, 1.); | |
898 | hChi2_Sigma->SetBinContent(ibin, 0.); | |
899 | hChi2_Sigma->SetBinError(ibin, 1.); | |
900 | for (Int_t ich=0; ich<10; ich++) { | |
901 | hNClustersInCh[ich]->SetBinContent(ibin,0.); | |
902 | hNClustersInCh[ich]->SetBinError(ibin,1.); | |
903 | hClusterHitMapXInCh[ich]->SetBinContent(ibin,0.); | |
904 | hClusterHitMapXInCh[ich]->SetBinError(ibin,1.); | |
905 | hClusterHitMapYInCh[ich]->SetBinContent(ibin,0.); | |
906 | hClusterHitMapYInCh[ich]->SetBinError(ibin,1.); | |
907 | } | |
908 | //runFile->Close(); | |
909 | //continue; | |
910 | } | |
911 | else { | |
912 | // fill monitoring plots | |
913 | hNClustersPerTrackVsRun_Mean->SetBinContent(ibin, hNClustersPerTrack->GetMean()); | |
914 | hNClustersPerTrackVsRun_Mean->SetBinError(ibin, hNClustersPerTrack->GetMeanError()); | |
915 | hNClustersPerTrackVsRun_Sigma->SetBinContent(ibin, hNClustersPerTrack->GetRMS()); | |
916 | hNClustersPerTrackVsRun_Sigma->SetBinError(ibin, hNClustersPerTrack->GetRMSError()); | |
917 | hNChamberHitPerTrack_Mean->SetBinContent(ibin, hNChamberHitPerTrack->GetMean()); | |
918 | hNChamberHitPerTrack_Mean->SetBinError(ibin, hNChamberHitPerTrack->GetMeanError()); | |
919 | hNChamberHitPerTrack_Sigma->SetBinContent(ibin, hNChamberHitPerTrack->GetRMS()); | |
920 | hNChamberHitPerTrack_Sigma->SetBinError(ibin, hNChamberHitPerTrack->GetRMSError()); | |
921 | hChi2_Mean->SetBinContent(ibin, hChi2->GetMean()); | |
922 | hChi2_Mean->SetBinError(ibin, hChi2->GetMeanError()); | |
923 | hChi2_Sigma->SetBinContent(ibin, hChi2->GetRMS()); | |
924 | hChi2_Sigma->SetBinError(ibin, hChi2->GetRMSError()); | |
925 | for (Int_t ich=0; ich<10; ich++) { | |
926 | hNClustersInCh[ich]->SetBinContent(ibin,hNClustersPerCh->GetBinContent(ich+1)); | |
927 | hNClustersInCh[ich]->SetBinError(ibin,hNClustersPerCh->GetBinError(ich+1)); | |
13bb4ca7 | 928 | hClusterChargeMeanInCh[ich]->SetBinContent(ibin,hClusterChargePerChMean->GetBinContent(ich+1)); |
929 | hClusterChargeMeanInCh[ich]->SetBinError(ibin,hClusterChargePerChMean->GetBinError(ich+1)); | |
930 | hClusterChargeSigmaInCh[ich]->SetBinContent(ibin,hClusterChargePerChSigma->GetBinContent(ich+1)); | |
931 | hClusterChargeSigmaInCh[ich]->SetBinError(ibin,hClusterChargePerChSigma->GetBinError(ich+1)); | |
932 | hClusterSizeMeanInCh[ich]->SetBinContent(ibin,hClusterSizePerChMean->GetBinContent(ich+1)); | |
933 | hClusterSizeMeanInCh[ich]->SetBinError(ibin,hClusterSizePerChMean->GetBinError(ich+1)); | |
934 | hClusterSizeSigmaInCh[ich]->SetBinContent(ibin,hClusterSizePerChSigma->GetBinContent(ich+1)); | |
935 | hClusterSizeSigmaInCh[ich]->SetBinError(ibin,hClusterSizePerChSigma->GetBinError(ich+1)); | |
936 | hNClustersInCh[ich]->SetBinContent(ibin,hNClustersPerCh->GetBinContent(ich+1)); | |
937 | hNClustersInCh[ich]->SetBinError(ibin,hNClustersPerCh->GetBinError(ich+1)); | |
93ce3c40 | 938 | hClusterHitMapXInCh[ich]->SetBinContent(ibin,hClusterHitMapInCh[ich]->GetMean(1)); |
939 | hClusterHitMapXInCh[ich]->SetBinError(ibin,hClusterHitMapInCh[ich]->GetMeanError(1)); | |
940 | hClusterHitMapYInCh[ich]->SetBinContent(ibin,hClusterHitMapInCh[ich]->GetMean(2)); | |
4916d740 | 941 | hClusterHitMapYInCh[ich]->SetBinError(ibin,hClusterHitMapInCh[ich]->GetMeanError(2)); |
93ce3c40 | 942 | } |
943 | } | |
944 | ||
945 | // set labels | |
93f182e7 | 946 | for ( Int_t ihisto=0; ihisto<2; ++ihisto ) { |
947 | hTriggerCutVsRun[ihisto]->GetXaxis()->SetBinLabel(ibin,run.Data()); | |
948 | hTriggerCutWidthVsRun[ihisto]->GetXaxis()->SetBinLabel(ibin,run.Data()); | |
949 | } | |
93ce3c40 | 950 | hNClustersPerTrackVsRun_Mean->GetXaxis()->SetBinLabel(ibin, run.Data()); |
951 | hNClustersPerTrackVsRun_Sigma->GetXaxis()->SetBinLabel(ibin, run.Data()); | |
952 | hNChamberHitPerTrack_Mean->GetXaxis()->SetBinLabel(ibin, run.Data()); | |
953 | hNChamberHitPerTrack_Sigma->GetXaxis()->SetBinLabel(ibin, run.Data()); | |
954 | hChi2_Mean->GetXaxis()->SetBinLabel(ibin, run.Data()); | |
955 | hChi2_Sigma->GetXaxis()->SetBinLabel(ibin, run.Data()); | |
956 | for (Int_t ich=0; ich<10; ich++){ | |
957 | hNClustersInCh[ich]->GetXaxis()->SetBinLabel(ibin, run.Data()); | |
13bb4ca7 | 958 | hClusterChargeMeanInCh[ich]->GetXaxis()->SetBinLabel(ibin, run.Data()); |
959 | hClusterChargeSigmaInCh[ich]->GetXaxis()->SetBinLabel(ibin, run.Data()); | |
960 | hClusterSizeMeanInCh[ich]->GetXaxis()->SetBinLabel(ibin, run.Data()); | |
961 | hClusterSizeSigmaInCh[ich]->GetXaxis()->SetBinLabel(ibin, run.Data()); | |
93ce3c40 | 962 | hClusterHitMapXInCh[ich]->GetXaxis()->SetBinLabel(ibin, run.Data()); |
963 | hClusterHitMapYInCh[ich]->GetXaxis()->SetBinLabel(ibin, run.Data()); | |
964 | } | |
005408df | 965 | |
93ce3c40 | 966 | // close outfile for this run |
967 | runFile->Close(); | |
968 | ibin++; | |
969 | } | |
970 | ||
971 | delete res; | |
e31f508d | 972 | }//end loop over runs |
93ce3c40 | 973 | |
4916d740 | 974 | //sort label |
975 | hNClustersPerTrackVsRun_Mean->LabelsOption("a"); | |
976 | hNClustersPerTrackVsRun_Sigma->LabelsOption("a"); | |
977 | hNChamberHitPerTrack_Mean->LabelsOption("a"); | |
978 | hNChamberHitPerTrack_Sigma->LabelsOption("a"); | |
979 | hChi2_Mean->LabelsOption("a"); | |
980 | hChi2_Sigma->LabelsOption("a"); | |
981 | ||
982 | for(Int_t ich=0; ich<10; ich++){ | |
983 | hNClustersInCh[ich]->LabelsOption("a"); | |
13bb4ca7 | 984 | hClusterChargeMeanInCh[ich]->LabelsOption("a"); |
985 | hClusterChargeSigmaInCh[ich]->LabelsOption("a"); | |
986 | hClusterSizeMeanInCh[ich]->LabelsOption("a"); | |
987 | hClusterSizeSigmaInCh[ich]->LabelsOption("a"); | |
4916d740 | 988 | hClusterHitMapXInCh[ich]->LabelsOption("a"); |
989 | hClusterHitMapYInCh[ich]->LabelsOption("a"); | |
005408df | 990 | } |
13bb4ca7 | 991 | |
93ce3c40 | 992 | TString dirToGo = OutFileNameROOT.Data(); dirToGo+=":/"; |
993 | gDirectory->Cd(dirToGo.Data()); | |
e31f508d | 994 | cout<<"=================================================="<<endl; |
995 | cout<<"Display Mean and Sigma of the number of associated clusters to a track "<<endl; | |
996 | cout<<"=================================================="<<endl; | |
93ce3c40 | 997 | TLegend *lNClusters = new TLegend(0.75,0.85,0.99,0.99); |
998 | lNClusters->AddEntry(hNClustersPerTrackVsRun_Mean,"clusters","PL"); | |
999 | lNClusters->AddEntry(hNChamberHitPerTrack_Mean,"chamber hit","PL"); | |
1000 | ||
1001 | TCanvas* cNClusters = new TCanvas("cNClusters","cNClusters",1200,900); | |
1002 | cNClusters->Divide(1,2); | |
1003 | cNClusters->cd(1); | |
1004 | //hNClustersPerTrackVsRun_Mean->SetMaximum(11); | |
1005 | hNClustersPerTrackVsRun_Mean->SetMinimum(7); | |
1006 | hNClustersPerTrackVsRun_Mean->SetStats(kFALSE); | |
1007 | hNClustersPerTrackVsRun_Mean->GetXaxis()->SetRange(1,ibin-1); | |
1008 | hNClustersPerTrackVsRun_Mean->GetXaxis()->SetNdivisions(1,kFALSE); | |
1009 | //hNClustersPerTrackVsRun_Mean->LabelsOption("u"); | |
4916d740 | 1010 | hNClustersPerTrackVsRun_Mean->SetLabelSize(0.04); |
93ce3c40 | 1011 | hNClustersPerTrackVsRun_Mean->SetTitle("averaged number of associated clusters or of the number of chamber hit per track"); |
1012 | hNClustersPerTrackVsRun_Mean->SetLineWidth(2); | |
1013 | hNClustersPerTrackVsRun_Mean->Draw("e"); | |
1014 | hNChamberHitPerTrack_Mean->SetLineColor(kRed); | |
1015 | hNChamberHitPerTrack_Mean->SetLineWidth(2); | |
1016 | hNChamberHitPerTrack_Mean->Draw("esame"); | |
1017 | lNClusters->Draw("same"); | |
1018 | ||
1019 | cNClusters->cd(2); | |
1020 | //hNClustersPerTrackVsRun_Sigma->SetMaximum(1.1); | |
1021 | hNClustersPerTrackVsRun_Sigma->SetMinimum(0.4); | |
1022 | hNClustersPerTrackVsRun_Sigma->SetStats(kFALSE); | |
1023 | hNClustersPerTrackVsRun_Sigma->GetXaxis()->SetRange(1,ibin-1); | |
1024 | hNClustersPerTrackVsRun_Sigma->GetXaxis()->SetNdivisions(1,kFALSE); | |
1025 | //hNClustersPerTrackVsRun_Sigma->LabelsOption("u"); | |
4916d740 | 1026 | hNClustersPerTrackVsRun_Sigma->SetLabelSize(0.04); |
93ce3c40 | 1027 | hNClustersPerTrackVsRun_Sigma->SetTitle("dispersion of the number of associated clusters or of the number of chamber hit per track"); |
1028 | hNClustersPerTrackVsRun_Sigma->SetLineWidth(2); | |
1029 | hNClustersPerTrackVsRun_Sigma->Draw("e"); | |
1030 | hNChamberHitPerTrack_Sigma->SetLineWidth(2); | |
1031 | hNChamberHitPerTrack_Sigma->SetLineColor(kRed); | |
1032 | hNChamberHitPerTrack_Sigma->Draw("esame"); | |
1033 | lNClusters->Draw("same"); | |
13bb4ca7 | 1034 | |
93ce3c40 | 1035 | cNClusters->Print(OutFileNamePDF.Data()); |
13bb4ca7 | 1036 | dirGlobal->cd(); |
93ce3c40 | 1037 | cNClusters->Write(); |
13bb4ca7 | 1038 | |
e31f508d | 1039 | cout<<"=================================================="<<endl; |
1040 | cout<<" Display average number of cluster per chamber "<<endl; | |
1041 | cout<<"=================================================="<<endl; | |
93ce3c40 | 1042 | |
93ce3c40 | 1043 | TLegend *lNClustersPerCh = new TLegend(0.92,0.45,0.99,0.99); |
1044 | TCanvas* cNClustersPerCh = new TCanvas("cNClustersPerCh","cNClustersPerCh",1200,900); | |
1045 | cNClustersPerCh->cd(); | |
1046 | cNClustersPerCh->SetRightMargin(0.1); | |
1047 | hNClustersInCh[0]->SetStats(kFALSE); | |
1048 | hNClustersInCh[0]->GetXaxis()->SetRange(1,ibin-1); | |
1049 | hNClustersInCh[0]->GetXaxis()->SetNdivisions(1,kFALSE); | |
1050 | //hNClustersInCh[0]->LabelsOption("u"); | |
b66f9801 | 1051 | hNClustersInCh[0]->SetLabelSize(0.02); |
93ce3c40 | 1052 | hNClustersInCh[0]->SetTitle("averaged number of clusters in chamber i per track"); |
1053 | hNClustersInCh[0]->SetMaximum(1.2); | |
1054 | hNClustersInCh[0]->SetMinimum(0.01); | |
1055 | for (Int_t ich=0; ich<10; ich++) { | |
1056 | hNClustersInCh[ich]->SetLineColor(ich+1+ich/9); | |
1057 | hNClustersInCh[ich]->SetLineWidth(2); | |
1058 | if (ich == 0) hNClustersInCh[ich]->Draw("e"); | |
1059 | else hNClustersInCh[ich]->Draw("esame"); | |
1060 | lNClustersPerCh->AddEntry(hNClustersInCh[ich],Form("ch%d",ich+1),"PL"); | |
1061 | } | |
1062 | lNClustersPerCh->Draw("same"); | |
1063 | ||
1064 | cNClustersPerCh->Print(OutFileNamePDF.Data()); | |
13bb4ca7 | 1065 | dirGlobal->cd(); |
93ce3c40 | 1066 | cNClustersPerCh->Write(); |
1067 | ||
e31f508d | 1068 | cout<<"=================================================="<<endl; |
1069 | cout<<" Display average cluster charge per chamber "<<endl; | |
1070 | cout<<"=================================================="<<endl; | |
1071 | ||
13bb4ca7 | 1072 | TLegend *lClusterChargePerCh = new TLegend(0.92,0.45,0.99,0.99); |
1073 | TCanvas* cClusterChargePerCh = new TCanvas("cClustersChargePerCh","cClustersChargePerCh",1200,900); | |
1074 | cClusterChargePerCh->SetRightMargin(0.1); | |
1075 | cClusterChargePerCh->Divide(1,2); | |
1076 | ||
1077 | cClusterChargePerCh->cd(1); | |
1078 | hClusterChargeMeanInCh[0]->SetStats(kFALSE); | |
1079 | hClusterChargeMeanInCh[0]->GetXaxis()->SetRange(1,ibin-1); | |
1080 | hClusterChargeMeanInCh[0]->GetXaxis()->SetNdivisions(1,kFALSE); | |
1081 | //hClusterChargeInCh[0]->LabelsOption("u"); | |
293bed3d | 1082 | hClusterChargeMeanInCh[0]->SetLabelSize(0.04); |
13bb4ca7 | 1083 | hClusterChargeMeanInCh[0]->SetTitle("Cluster charge mean (fC) per track in chamber i"); |
1084 | hClusterChargeMeanInCh[0]->SetMaximum(150); | |
bab36da2 | 1085 | hClusterChargeMeanInCh[0]->SetMinimum(30); |
13bb4ca7 | 1086 | for (Int_t ich=0; ich<10; ich++) { |
1087 | hClusterChargeMeanInCh[ich]->SetLineColor(ich+1+ich/9); | |
1088 | hClusterChargeMeanInCh[ich]->SetLineWidth(2); | |
1089 | if (ich == 0) hClusterChargeMeanInCh[ich]->Draw("e"); | |
1090 | else hClusterChargeMeanInCh[ich]->Draw("esame"); | |
1091 | lClusterChargePerCh->AddEntry(hClusterChargeMeanInCh[ich],Form("ch%d",ich+1),"PL"); | |
1092 | } | |
1093 | lClusterChargePerCh->Draw("same"); | |
1094 | ||
1095 | cClusterChargePerCh->cd(2); | |
1096 | hClusterChargeSigmaInCh[0]->SetStats(kFALSE); | |
1097 | hClusterChargeSigmaInCh[0]->GetXaxis()->SetRange(1,ibin-1); | |
1098 | hClusterChargeSigmaInCh[0]->GetXaxis()->SetNdivisions(1,kFALSE); | |
1099 | //hClusterChargeInCh[0]->LabelsOption("u"); | |
293bed3d | 1100 | hClusterChargeSigmaInCh[0]->SetLabelSize(0.04); |
13bb4ca7 | 1101 | hClusterChargeSigmaInCh[0]->SetTitle("Cluster charge sigma per track in chamber i"); |
bab36da2 | 1102 | hClusterChargeSigmaInCh[0]->SetMaximum(250); |
13bb4ca7 | 1103 | hClusterChargeSigmaInCh[0]->SetMinimum(50); |
1104 | for (Int_t ich=0; ich<10; ich++) { | |
1105 | hClusterChargeSigmaInCh[ich]->SetLineColor(ich+1+ich/9); | |
1106 | hClusterChargeSigmaInCh[ich]->SetLineWidth(2); | |
1107 | if (ich == 0) hClusterChargeSigmaInCh[ich]->Draw("e"); | |
1108 | else hClusterChargeSigmaInCh[ich]->Draw("esame"); | |
1109 | } | |
1110 | lClusterChargePerCh->Draw("same"); | |
1111 | ||
1112 | cClusterChargePerCh->Print(OutFileNamePDF.Data()); | |
1113 | dirGlobal->cd(); | |
1114 | cClusterChargePerCh->Write(); | |
1115 | ||
e31f508d | 1116 | cout<<"=================================================="<<endl; |
1117 | cout<<" Display average cluster size per chamber "<<endl; | |
1118 | cout<<"=================================================="<<endl; | |
13bb4ca7 | 1119 | |
1120 | TLegend *lClusterSizePerCh = new TLegend(0.92,0.45,0.99,0.99); | |
1121 | TCanvas* cClusterSizePerCh = new TCanvas("cClustersSizePerCh","cClustersSizePerCh",1200,900); | |
1122 | cClusterSizePerCh->SetRightMargin(0.1); | |
1123 | cClusterSizePerCh->Divide(1,2); | |
1124 | ||
1125 | cClusterSizePerCh->cd(1); | |
1126 | hClusterSizeMeanInCh[0]->SetStats(kFALSE); | |
1127 | hClusterSizeMeanInCh[0]->GetXaxis()->SetRange(1,ibin-1); | |
1128 | hClusterSizeMeanInCh[0]->GetXaxis()->SetNdivisions(1,kFALSE); | |
1129 | ||
293bed3d | 1130 | hClusterSizeMeanInCh[0]->SetLabelSize(0.04); |
13bb4ca7 | 1131 | hClusterSizeMeanInCh[0]->SetTitle("Cluster size mean (npads) per track in chamber i"); |
1132 | hClusterSizeMeanInCh[0]->SetMaximum(18); | |
1133 | hClusterSizeMeanInCh[0]->SetMinimum(0); | |
1134 | for (Int_t ich=0; ich<10; ich++) { | |
1135 | hClusterSizeMeanInCh[ich]->SetLineColor(ich+1+ich/9); | |
1136 | hClusterSizeMeanInCh[ich]->SetLineWidth(2); | |
1137 | if (ich == 0) hClusterSizeMeanInCh[ich]->Draw("e"); | |
1138 | else hClusterSizeMeanInCh[ich]->Draw("esame"); | |
1139 | lClusterSizePerCh->AddEntry(hClusterSizeMeanInCh[ich],Form("ch%d",ich+1),"PL"); | |
1140 | } | |
1141 | lClusterSizePerCh->Draw("same"); | |
1142 | ||
1143 | cClusterSizePerCh->cd(2); | |
1144 | hClusterSizeSigmaInCh[0]->SetStats(kFALSE); | |
1145 | hClusterSizeSigmaInCh[0]->GetXaxis()->SetRange(1,ibin-1); | |
1146 | hClusterSizeSigmaInCh[0]->GetXaxis()->SetNdivisions(1,kFALSE); | |
1147 | ||
293bed3d | 1148 | hClusterSizeSigmaInCh[0]->SetLabelSize(0.04); |
13bb4ca7 | 1149 | hClusterSizeSigmaInCh[0]->SetTitle("Cluster size sigma (npads) per track in chamber i"); |
1150 | hClusterSizeSigmaInCh[0]->SetMaximum(7); | |
1151 | hClusterSizeSigmaInCh[0]->SetMinimum(0); | |
1152 | for (Int_t ich=0; ich<10; ich++) { | |
1153 | hClusterSizeSigmaInCh[ich]->SetLineColor(ich+1+ich/9); | |
1154 | hClusterSizeSigmaInCh[ich]->SetLineWidth(2); | |
1155 | if (ich == 0) hClusterSizeSigmaInCh[ich]->Draw("e"); | |
1156 | else hClusterSizeSigmaInCh[ich]->Draw("esame"); | |
1157 | } | |
1158 | lClusterSizePerCh->Draw("same"); | |
1159 | ||
1160 | cClusterSizePerCh->Print(OutFileNamePDF.Data()); | |
1161 | dirGlobal->cd(); | |
1162 | cClusterSizePerCh->Write(); | |
1163 | ||
1164 | ||
e31f508d | 1165 | cout<<"=================================================="<<endl; |
1166 | cout<<"Display average X and Y position of clusters per chamber"<<endl; | |
1167 | cout<<"=================================================="<<endl; | |
93ce3c40 | 1168 | TLegend *lClusterHitMapPerCh = new TLegend(0.92,0.45,0.99,0.99); |
1169 | TCanvas* cClusterHitMapPerCh = new TCanvas("cClusterHitMapPerCh","cClusterHitMapPerCh",1200,900); | |
1170 | cClusterHitMapPerCh->Divide(1,2); | |
1171 | cClusterHitMapPerCh->GetPad(1)->SetRightMargin(0.1); | |
1172 | cClusterHitMapPerCh->GetPad(2)->SetRightMargin(0.1); | |
1173 | ||
1174 | cClusterHitMapPerCh->cd(1); | |
1175 | hClusterHitMapXInCh[0]->SetStats(kFALSE); | |
1176 | hClusterHitMapXInCh[0]->GetXaxis()->SetRange(1,ibin-1); | |
1177 | hClusterHitMapXInCh[0]->GetXaxis()->SetNdivisions(1,kFALSE); | |
1178 | //hNClustersInCh[0]->LabelsOption("u"); | |
4916d740 | 1179 | hClusterHitMapXInCh[0]->SetLabelSize(0.04); |
93ce3c40 | 1180 | hClusterHitMapXInCh[0]->SetTitle("<X> of clusters - associated to a track - in chamber i"); |
1181 | hClusterHitMapXInCh[0]->SetMaximum(30); | |
1182 | hClusterHitMapXInCh[0]->SetMinimum(-30); | |
1183 | for (Int_t ich=0; ich<10; ich++) { | |
1184 | hClusterHitMapXInCh[ich]->SetLineColor(ich+1+ich/9); | |
1185 | hClusterHitMapXInCh[ich]->SetLineWidth(2); | |
1186 | if (ich == 0) hClusterHitMapXInCh[ich]->Draw("e"); | |
1187 | else hClusterHitMapXInCh[ich]->Draw("esame"); | |
1188 | ||
1189 | lClusterHitMapPerCh->AddEntry(hClusterHitMapXInCh[ich],Form("ch%d",ich+1),"PL"); | |
1190 | } | |
1191 | lClusterHitMapPerCh->Draw("same"); | |
1192 | ||
1193 | cClusterHitMapPerCh->cd(2); | |
1194 | hClusterHitMapYInCh[0]->SetStats(kFALSE); | |
1195 | hClusterHitMapYInCh[0]->GetXaxis()->SetRange(1,ibin-1); | |
1196 | hClusterHitMapYInCh[0]->GetXaxis()->SetNdivisions(1,kFALSE); | |
1197 | //hNClustersInCh[0]->LabelsOption("u"); | |
4916d740 | 1198 | hClusterHitMapYInCh[0]->SetLabelSize(0.04); |
93ce3c40 | 1199 | hClusterHitMapYInCh[0]->SetTitle("<Y> of clusters - associated to a track - in chamber i"); |
1200 | hClusterHitMapYInCh[0]->SetMaximum(30); | |
1201 | hClusterHitMapYInCh[0]->SetMinimum(-30); | |
1202 | for (Int_t ich=0; ich<10; ich++) { | |
1203 | hClusterHitMapYInCh[ich]->SetLineColor(ich+1+ich/9); | |
1204 | hClusterHitMapYInCh[ich]->SetLineWidth(2); | |
1205 | if (ich == 0) hClusterHitMapYInCh[ich]->Draw("e"); | |
1206 | else hClusterHitMapYInCh[ich]->Draw("esame"); | |
1207 | } | |
1208 | lClusterHitMapPerCh->Draw("same"); | |
1209 | ||
1210 | cClusterHitMapPerCh->Print(OutFileNamePDF.Data()); | |
13bb4ca7 | 1211 | dirGlobal->cd(); |
93ce3c40 | 1212 | cClusterHitMapPerCh->Write(); |
1213 | ||
1214 | ||
e31f508d | 1215 | cout<<"=================================================="<<endl; |
1216 | cout<<" Display tracks ChiSquare "<<endl; | |
1217 | cout<<"=================================================="<<endl; | |
93ce3c40 | 1218 | TCanvas* cChi2 = new TCanvas("cChi2","cChi2",1200,900); |
1219 | cChi2->Divide(1,2); | |
1220 | cChi2->cd(1); | |
1221 | hChi2_Mean->SetStats(kFALSE); | |
1222 | hChi2_Mean->GetXaxis()->SetRange(1,ibin-1); | |
1223 | hChi2_Mean->GetXaxis()->SetNdivisions(1,kFALSE); | |
1224 | //hChi2_Mean->LabelsOption("u"); | |
4916d740 | 1225 | hChi2_Mean->SetLabelSize(0.04); |
93ce3c40 | 1226 | hChi2_Mean->SetLineWidth(2); |
1227 | hChi2_Mean->Draw("e"); | |
1228 | ||
1229 | cChi2->cd(2); | |
1230 | hChi2_Sigma->SetStats(kFALSE); | |
1231 | hChi2_Sigma->GetXaxis()->SetRange(1,ibin-1); | |
1232 | hChi2_Sigma->GetXaxis()->SetNdivisions(1,kFALSE); | |
1233 | //hChi2_Sigma->LabelsOption("u"); | |
4916d740 | 1234 | hChi2_Sigma->SetLabelSize(0.04); |
93ce3c40 | 1235 | hChi2_Sigma->SetLineWidth(2); |
1236 | hChi2_Sigma->Draw("e"); | |
1237 | ||
1238 | cChi2->Print(OutFileNamePDF.Data()); | |
13bb4ca7 | 1239 | dirGlobal->cd(); |
93ce3c40 | 1240 | cChi2->Write(); |
005408df | 1241 | |
e31f508d | 1242 | cout<<"=================================================="<<endl; |
1243 | cout<<" Display track Lpt/Hpt "<<endl; | |
1244 | cout<<"=================================================="<<endl; | |
1245 | ||
b8e17107 | 1246 | if ( hTriggerCutVsRun[0] && hTriggerCutVsRun[1] ) { |
1247 | TCanvas* cLptHpt = new TCanvas("cLptHpt","cLptHpt",1200,900); | |
1248 | cLptHpt->Divide(1,2); | |
1249 | TLegend* legLptHpt = new TLegend(0.72,0.7,0.9,0.85); | |
1250 | legLptHpt->SetBorderSize(1); | |
1251 | for ( Int_t ihisto=0; ihisto<2; ++ihisto) { | |
1252 | cLptHpt->cd(ihisto+1); | |
1253 | TH1* currHistos[2] = {hTriggerCutVsRun[ihisto], hTriggerCutWidthVsRun[ihisto]}; | |
1254 | for ( Int_t jhisto=0; jhisto<2; jhisto++ ) { | |
1255 | currHistos[jhisto]->GetXaxis()->SetRange(1,ibin-1); | |
1256 | currHistos[jhisto]->GetYaxis()->SetRangeUser(0.,5.); | |
1257 | currHistos[jhisto]->LabelsOption("a"); | |
1258 | currHistos[jhisto]->SetStats(kFALSE); | |
1259 | currHistos[jhisto]->GetXaxis()->SetLabelSize(0.04); | |
1260 | currHistos[jhisto]->SetLineWidth(2); | |
1261 | } | |
1262 | hTriggerCutWidthVsRun[ihisto]->SetLineColor(2); | |
1263 | hTriggerCutWidthVsRun[ihisto]->SetMarkerColor(2); | |
1264 | hTriggerCutWidthVsRun[ihisto]->SetFillColor(2); | |
1265 | hTriggerCutWidthVsRun[ihisto]->SetFillStyle(3001); | |
1266 | hTriggerCutWidthVsRun[ihisto]->Draw("e2"); | |
1267 | hTriggerCutVsRun[ihisto]->Draw("esame"); | |
1268 | if ( ihisto == 0 ) { | |
1269 | legLptHpt->AddEntry(hTriggerCutWidthVsRun[ihisto],"Fit width","f"); | |
1270 | legLptHpt->AddEntry(hTriggerCutVsRun[ihisto],"pt cut from fit (stat error)","lp"); | |
1271 | legLptHpt->Draw("same"); | |
1272 | } | |
1273 | } | |
1274 | cLptHpt->Print(OutFileNamePDF.Data()); | |
13bb4ca7 | 1275 | dirGlobal->cd(); |
b8e17107 | 1276 | cLptHpt->Write(); |
13bb4ca7 | 1277 | } |
1278 | ||
1279 | ||
e31f508d | 1280 | cout<<"=================================================="<<endl; |
1281 | cout<<" Display muon trigger "<<endl; | |
1282 | cout<<"=================================================="<<endl; | |
13bb4ca7 | 1283 | |
1284 | TCanvas* cMuonTriggerUnlikeLike = new TCanvas("cMuonTriggerUnlikeLike","cMuonTriggerUnlikeLike",1200,900); | |
1285 | TCanvas* cMuonTriggerHpt = new TCanvas("cMuonTriggerHpt","cMuonTriggerHpt",1200,900); | |
1286 | cMuonTriggerHpt->Divide(1,2); | |
1287 | ||
1288 | Int_t const ntrig = 3; | |
1289 | Int_t const nhist = 3; | |
1290 | TH1F *hRelMuonTrigger[ntrig], *hTot; | |
1291 | ||
1292 | //3 configurations (3x3 histos for 3 canvases) | |
1293 | Int_t conf[ntrig][nhist]={{0,1,3},{0,2,4},{1,2,5}}; | |
1294 | TString sconf[ntrig][nhist]={{"hTriggerUnlikeOnly","hTriggerLikeOnly","hTriggerUnlikeAndLike"},{"hTriggerUnlikeOnly","hTriggerHptOnly","hTriggerUnlikeAndHpt"},{"hTriggerLikeOnly","hTriggerHptOnly","hTriggerLikeAndHpt"}}; | |
1295 | TString sname; | |
1296 | ||
1297 | for ( Int_t i=0; i < ntrig; i++ ) { | |
1298 | for ( Int_t j=0; j < nhist; j++ ) { | |
1299 | sname = sconf[i][j]; sname +=(i+1); | |
1300 | hMuonTrigger[conf[i][j]]->GetXaxis()->SetRange(1,ibin-1); | |
1301 | hRelMuonTrigger[j] = (TH1F*)hMuonTrigger[conf[i][j]]->Clone(sname); | |
1302 | hRelMuonTrigger[j]->SetLineColor(j+1); | |
1303 | hRelMuonTrigger[j]->SetStats(kFALSE); | |
1304 | hRelMuonTrigger[j]->GetXaxis()->SetNdivisions(1,kFALSE); | |
1305 | hRelMuonTrigger[j]->LabelsOption("a"); | |
293bed3d | 1306 | hRelMuonTrigger[j]->SetLabelSize(0.02); |
13bb4ca7 | 1307 | //hRelMuonTrigger[j]->GetXaxis()->SetLabelSize(0.04); |
1308 | hRelMuonTrigger[j]->SetLineWidth(2); | |
1309 | hRelMuonTrigger[j]->SetTitle(""); | |
1310 | ||
1311 | } | |
1312 | sname = "hTot"; | |
1313 | sname += (i+1); | |
1314 | hTot = (TH1F*) hRelMuonTrigger[0]->Clone(sname); | |
1315 | hTot->Add(hRelMuonTrigger[1]); | |
1316 | hTot->Add(hRelMuonTrigger[2],-1); | |
1317 | hRelMuonTrigger[0]->Add(hRelMuonTrigger[2],-1); | |
1318 | hRelMuonTrigger[1]->Add(hRelMuonTrigger[2],-1); | |
1319 | ||
1320 | for(Int_t j=0; j < nhist; j++) hRelMuonTrigger[j]->Divide(hTot); | |
1321 | ||
1322 | if(i==0) cMuonTriggerUnlikeLike->cd(); | |
1323 | else cMuonTriggerHpt->cd(i); | |
1324 | ||
1325 | if (i==0) hRelMuonTrigger[i]->SetTitle("Relative muon triggers content"); | |
1326 | TLegend *leg = new TLegend(0.72,0.7,0.9,0.85); | |
1327 | leg->SetBorderSize(1); | |
1328 | ||
1329 | for(Int_t j=0; j<nhist; j++){ | |
1330 | if(j==0){ | |
1331 | hRelMuonTrigger[j]->SetMaximum(1); | |
1332 | hRelMuonTrigger[j]->SetMinimum(0); | |
1333 | hRelMuonTrigger[j]->Draw("e"); | |
1334 | } | |
1335 | else hRelMuonTrigger[j]->Draw("esame"); | |
1336 | sname = sconf[i][j]; | |
1337 | leg->AddEntry(hRelMuonTrigger[j],sname,"l"); | |
1338 | } | |
1339 | leg->Draw("same"); | |
b8e17107 | 1340 | } |
13bb4ca7 | 1341 | cMuonTriggerUnlikeLike->Print(OutFileNamePDF.Data()); |
1342 | dirGlobal->cd(); | |
1343 | cMuonTriggerUnlikeLike->Write(); | |
1344 | cMuonTriggerHpt->Print(OutFileNamePDF.Data()); | |
1345 | cMuonTriggerHpt->Write(); | |
1346 | ||
93ce3c40 | 1347 | // close the PDF file |
13bb4ca7 | 1348 | c1->Print(OutFileNamePDF_close.Data()); |
e31f508d | 1349 | c1->Close(); |
1350 | //Note: closing the file delete all related TDirectoryFile (dirCent and dirTrigger) | |
1351 | rootFileOut->Close(); | |
13bb4ca7 | 1352 | |
e31f508d | 1353 | |
13bb4ca7 | 1354 | delete runs; |
13bb4ca7 | 1355 | delete triggersB; |
13bb4ca7 | 1356 | delete colorInd; |
1357 | ||
1358 | return; | |
1359 | ||
93ce3c40 | 1360 | } |
005408df | 1361 | |
1362 | void SetCanvas(TCanvas *canvas, Int_t logy){ | |
13bb4ca7 | 1363 | |
005408df | 1364 | if(!canvas) return; |
1365 | canvas->SetTopMargin(0.05); | |
1366 | canvas->SetRightMargin(0.01); | |
1367 | canvas->SetGridy(1); | |
1368 | canvas->SetLogy(logy); | |
1369 | ||
1370 | return; | |
1371 | } | |
1372 | ||
93f182e7 | 1373 | Bool_t IsHeavyIonCollision(AliCounterCollection *eventCounters){ |
1374 | ||
1375 | if(!eventCounters) return kFALSE; | |
1376 | ||
1377 | Double_t sum = eventCounters->GetSum("v0mult:low,int,high"); | |
e31f508d | 1378 | Bool_t result = kTRUE; |
93f182e7 | 1379 | if(sum<=0) result = kFALSE; |
1380 | ||
1381 | cout<<" Collision type is set to "; | |
1382 | if( result == kFALSE) cout<<"p-p"<<endl; | |
1383 | else cout<<"heavy-ion"<<endl; | |
1384 | ||
1385 | return result; | |
1386 | } | |
1387 | ||
e31f508d | 1388 | TCanvas *ProcessCanvasAllTrigger( AliCounterCollection *eventCounters, TString canvasName) { |
1389 | ||
1390 | if ( !eventCounters ) return 0; | |
1391 | ||
1392 | TString cName = Form("c%s",canvasName.Data()); | |
1393 | TCanvas *cAll = new TCanvas(canvasName.Data(),canvasName.Data()); | |
1394 | cAll->SetLeftMargin(0.18); | |
1395 | cAll->SetRightMargin(0.18); | |
1396 | cAll->SetLogz(1); | |
1397 | cAll->cd(); | |
1398 | ||
1399 | TH2* hAll = (TH2*) ProcessHisto2D(eventCounters, "trigger", "run", "run:any" , ""); | |
1400 | for ( Int_t ibin=1; ibin <= hAll->GetYaxis()->GetNbins(); ++ibin ) { | |
1401 | TString currLabel = hAll->GetYaxis()->GetBinLabel(ibin); | |
1402 | TObjArray* labelArray = currLabel.Tokenize("-"); | |
1403 | labelArray->SetOwner(); | |
1404 | //cout<<currLabel<<endl; | |
1405 | TString newLabel = labelArray->At(0)->GetName(); | |
1406 | if ( labelArray->GetEntries() >= 2 ) newLabel = Form("%s-%s", newLabel.Data(), labelArray->At(1)->GetName()); | |
1407 | hAll->GetYaxis()->SetBinLabel(ibin, newLabel.Data()); | |
1408 | delete labelArray; | |
1409 | } | |
1410 | hAll->Draw("COLZ"); | |
1411 | ||
1412 | return cAll; | |
1413 | } | |
1414 | ||
1415 | TCanvas *ProcessCanvasTriggerContent(TObjArray *array, TObjArray trigNoPS, TObjArray trigWithPS, TString canvasName){ | |
005408df | 1416 | |
e31f508d | 1417 | if(!array) return 0x0; |
b66f9801 | 1418 | |
005408df | 1419 | TString cName = "c"; |
1420 | cName += canvasName; | |
1421 | TCanvas *cTriggerContent = new TCanvas(canvasName,cName,1200,900); | |
1422 | SetCanvas(cTriggerContent); | |
1423 | cTriggerContent->cd(); | |
1424 | ||
1425 | TLegend* legcTC = new TLegend(0.2,0.15,0.50,0.40); | |
1426 | legcTC->SetHeader("Physics Selection"); | |
1427 | legcTC->AddEntry(".","applied :",""); | |
b66f9801 | 1428 | |
e31f508d | 1429 | for(Int_t iTrig = 0; iTrig < array->GetEntriesFast(); iTrig++){ |
005408df | 1430 | //skip the sum of all triggers |
e31f508d | 1431 | if( iTrig == (array->GetEntriesFast()-1) ) continue; |
1432 | TH1* hNoPS = static_cast<TH1*>(trigNoPS.At(iTrig)); | |
1433 | TH1* hWithPS = static_cast<TH1*>(trigWithPS.At(iTrig)); | |
1434 | if (!hNoPS ||!hWithPS) continue; | |
1435 | hNoPS->SetLineStyle(2); | |
1436 | if(iTrig==0){ | |
1437 | hNoPS->SetMinimum(1e-3); | |
1438 | hNoPS->Draw(); | |
1439 | hWithPS->Draw("same"); | |
005408df | 1440 | } |
1441 | else{ | |
e31f508d | 1442 | hNoPS->Draw("same"); |
1443 | hWithPS->Draw("same"); | |
005408df | 1444 | } |
e31f508d | 1445 | legcTC->AddEntry(hWithPS,(( (TObjString*) array->At(iTrig) )->GetString()).Data(),"l"); |
005408df | 1446 | } |
1447 | legcTC->AddEntry(".","not applied :",""); | |
1448 | ||
e31f508d | 1449 | for(Int_t iTrig = 0; iTrig < array->GetEntriesFast(); iTrig++){ |
1450 | if( iTrig == (array->GetEntriesFast()-1) ) continue; | |
1451 | TH1* hNoPS = static_cast<TH1*>(trigNoPS.At(iTrig)); | |
1452 | if(hNoPS) legcTC->AddEntry(hNoPS,(( (TObjString*) array->At(iTrig) )->GetString()).Data(),"l"); | |
005408df | 1453 | } |
1454 | ||
1455 | legcTC->Draw("same"); | |
1456 | ||
1457 | return cTriggerContent; | |
1458 | } | |
1459 | ||
e31f508d | 1460 | TCanvas *ProcessCanvasRelativeTriggerContent(TObjArray *triggersB, TObjArray trigNoPS, TString canvasName){ |
005408df | 1461 | |
e31f508d | 1462 | if(!triggersB) return 0x0; |
005408df | 1463 | |
1464 | TString cName = "c" ; | |
1465 | cName += canvasName; | |
1466 | TCanvas *cRelativeTriggerContent = new TCanvas(canvasName,cName,1200,900); | |
1467 | SetCanvas(cRelativeTriggerContent); | |
1468 | cRelativeTriggerContent->cd(); | |
1469 | ||
e31f508d | 1470 | TObjArray relTrigNoPS(triggersB->GetEntriesFast()); |
005408df | 1471 | TLegend* legcRTC = new TLegend(0.2,0.15,0.50,0.40); |
005408df | 1472 | |
1473 | TString hName, hTriggerName; | |
1474 | Int_t indAllTrig = triggersB->GetEntriesFast()-1; | |
e31f508d | 1475 | TH1* hAllTrig = static_cast<TH1*> (trigNoPS.At(indAllTrig)); |
1476 | if(!hAllTrig) return 0; | |
2e7189d6 | 1477 | |
e31f508d | 1478 | for(Int_t iTrig = 0; iTrig < triggersB->GetEntriesFast()-1; iTrig++){ |
005408df | 1479 | hName = "ratio"; |
e31f508d | 1480 | hName += ( (TObjString*) triggersB->At(iTrig) )->GetString(); |
1481 | TH1* histo = static_cast<TH1*> (trigNoPS.At(iTrig)); | |
1482 | if(!histo) continue; | |
1483 | TH1* hRatio = (TH1*) histo->Clone(hName); | |
1484 | hRatio->Divide(hAllTrig); | |
1485 | hRatio->SetLineStyle(1); | |
1486 | if(iTrig==0){ | |
1487 | hRatio->SetMaximum(1.5); | |
1488 | hRatio->SetMinimum(0.001); | |
1489 | hRatio->SetLabelSize(0.04); | |
1490 | hRatio->GetYaxis()->SetTitle("Relative trigger content"); | |
1491 | hRatio->Draw("E"); | |
005408df | 1492 | } |
1493 | else{ | |
e31f508d | 1494 | hRatio->Draw("ESAME"); |
005408df | 1495 | } |
e31f508d | 1496 | relTrigNoPS.AddAt(hRatio,iTrig); |
005408df | 1497 | } |
e31f508d | 1498 | |
1499 | legcRTC->SetHeader("Physics Selection not applied"); | |
1500 | for(Int_t iTrig = 0; iTrig < triggersB->GetEntriesFast()-1; iTrig++){ | |
1501 | TH1* hRatio = static_cast<TH1*>(relTrigNoPS.At(iTrig)); | |
1502 | if (!hRatio) continue; | |
1503 | legcRTC->AddEntry(hRatio,(( (TObjString*) triggersB->At(iTrig) )->GetString()).Data(),"l"); | |
005408df | 1504 | } |
1505 | legcRTC->Draw("same"); | |
1506 | ||
1507 | return cRelativeTriggerContent; | |
1508 | } | |
1509 | ||
e31f508d | 1510 | TCanvas *ProcessCanvasPhysSelCut(TObjArray *triggersB, TObjArray trigNoPS, TObjArray trigWithPS, TString canvasName){ |
93f182e7 | 1511 | |
e31f508d | 1512 | if(!triggersB) return 0x0; |
1513 | ||
005408df | 1514 | TString cName = "c"; |
1515 | cName += canvasName; | |
1516 | TCanvas *c1 = new TCanvas(canvasName,cName,1200,900); | |
1517 | SetCanvas(c1); | |
1518 | c1->cd(); | |
1519 | ||
e31f508d | 1520 | TObjArray trigRatio(triggersB->GetEntriesFast()); |
005408df | 1521 | TLegend* legcRTC = new TLegend(0.2,0.15,0.50,0.40); |
e31f508d | 1522 | TString header = "Physics Selection Cut on selected triggers:"; |
1523 | if (canvasName.Contains("T0Flag")) header += " and T0 pile-up event selection"; | |
1524 | if (canvasName.Contains("T0SPDFlag")) header += " and T0, SPD pile-up event selection"; | |
1525 | legcRTC->SetHeader(header.Data()); | |
8a0df16c | 1526 | |
005408df | 1527 | TString hName; |
e31f508d | 1528 | for(Int_t iTrig = 0; iTrig < triggersB->GetEntriesFast()-1; iTrig++){ |
93f182e7 | 1529 | |
005408df | 1530 | hName = "ratio"; |
e31f508d | 1531 | hName += ( (TObjString*) triggersB->At(iTrig) )->GetString(); |
1532 | TH1 * hWithPS = (TH1*) (static_cast<TH1*> (trigWithPS.At(iTrig))); | |
1533 | TH1 * hNoPS = (TH1*) (static_cast<TH1*> (trigNoPS.At(iTrig))); | |
1534 | if (!hNoPS || !hWithPS) continue; | |
1535 | TH1 *hRatio = (TH1*) hWithPS->Clone(hName); | |
1536 | hRatio->Divide(hNoPS); | |
005408df | 1537 | hName = "ratioNoPS"; |
e31f508d | 1538 | hName += ( (TObjString*) triggersB->At(iTrig) )->GetString(); |
1539 | ||
1540 | if(iTrig==0){ | |
1541 | hRatio->SetMaximum(1.5); | |
1542 | hRatio->SetMinimum(0.05); | |
1543 | hRatio->SetLabelSize(0.02); | |
1544 | hRatio->GetYaxis()->SetTitle("Accepted / All from Phys. Sel."); | |
1545 | hRatio->SetTitle("Physics Selection Cut"); | |
1546 | hRatio->Draw("E"); | |
005408df | 1547 | } |
1548 | else{ | |
e31f508d | 1549 | hRatio->Draw("ESAME"); |
005408df | 1550 | } |
e31f508d | 1551 | trigRatio.AddAt(hRatio,iTrig); |
005408df | 1552 | } |
1553 | ||
e31f508d | 1554 | for(Int_t iTrig = 0; iTrig < triggersB->GetEntriesFast()-1; iTrig++){ |
1555 | TH1 * histo = static_cast<TH1*> (trigRatio.At(iTrig)); | |
1556 | if (!histo) continue; | |
1557 | legcRTC->AddEntry(histo,(( (TObjString*) triggersB->At(iTrig) )->GetString()).Data(),"l"); | |
93f182e7 | 1558 | } |
1559 | legcRTC->Draw("same"); | |
e31f508d | 1560 | |
93f182e7 | 1561 | return c1; |
1562 | } | |
1563 | ||
e31f508d | 1564 | TCanvas *ProcessCanvasPhysSelCutCentrality(TObjArray *triggersB, TObjArray trigNoPS, TObjArray trigWithPS, Int_t trigNr, TString canvasName, TString *legendHeader){ |
93f182e7 | 1565 | |
e31f508d | 1566 | if(!triggersB || !legendHeader) return 0x0; |
1567 | ||
93f182e7 | 1568 | TString cName = "c"; |
1569 | cName += canvasName; | |
1570 | TCanvas *c1 = new TCanvas(canvasName,cName,1200,900); | |
1571 | SetCanvas(c1); | |
1572 | c1->cd(); | |
1573 | ||
e31f508d | 1574 | Int_t const centBinMaxi = kCentBinMax - 1; |
1575 | TObjArray trigWithPSRatio(centBinMaxi); | |
93f182e7 | 1576 | TLegend* legcRTC = new TLegend(0.2,0.15,0.50,0.40); |
e31f508d | 1577 | legcRTC->SetHeader("V0 amplitude bins:"); |
1578 | Int_t colorTab[3] = {kBlack,kRed,kBlue}; | |
1579 | TArrayI colorInd(centBinMaxi); | |
1580 | for (Int_t i = 0; i < centBinMaxi; i++ ) { | |
1581 | if(i<3) colorInd.AddAt(colorTab[i],i); | |
1582 | else colorInd.AddAt(colorTab[2]+i-2,i); | |
1583 | } | |
1584 | ||
93f182e7 | 1585 | TString hName; |
1586 | ||
1587 | Float_t yMin = 0.05, yMax = 2; | |
1588 | ||
e31f508d | 1589 | for(Int_t iCentBin = 0; iCentBin < centBinMaxi; iCentBin++){ |
1590 | ||
1591 | Int_t index = GetIndex(triggersB,trigNr,iCentBin); | |
1592 | TH1 *hWithPS = static_cast<TH1*> (trigWithPS.At(index)); | |
1593 | TH1 *hNoPS = static_cast<TH1*> (trigNoPS.At(index)); | |
1594 | if (!hNoPS || !hWithPS) continue; | |
93f182e7 | 1595 | |
1596 | hName = "ratio"; | |
e31f508d | 1597 | hName += ( (TObjString*) triggersB->At(trigNr) )->GetString(); |
1598 | TH1 *hRatio = (TH1*) hWithPS->Clone(hName); | |
1599 | hRatio->Divide(hNoPS); | |
1600 | hRatio->SetLineColor(colorInd.At(iCentBin)); | |
1601 | if ( iCentBin == 0 ) { | |
1602 | hRatio->SetMaximum(yMax); | |
1603 | hRatio->SetMinimum(yMin); | |
1604 | hRatio->SetLabelSize(0.02); | |
1605 | hRatio->GetYaxis()->SetTitle("Accepted / All from Phys. Sel."); | |
1606 | TString sTitle = "for ", sTitle2 = (( (TObjString*) triggersB->At(trigNr) )->GetString()).Data(); | |
13bb4ca7 | 1607 | if ( !sTitle2.IsNull() ) sTitle += sTitle2; |
1608 | else sTitle = ""; | |
e31f508d | 1609 | hRatio->SetTitle(Form("Phys. Sel. %s - Multiplicity from V0 amplitude",sTitle.Data())); |
1610 | hRatio->Draw("E"); | |
93f182e7 | 1611 | } |
1612 | else{ | |
e31f508d | 1613 | hRatio->Draw("ESAME"); |
93f182e7 | 1614 | } |
e31f508d | 1615 | trigWithPSRatio.AddAt(hRatio,iCentBin); |
93f182e7 | 1616 | } |
1617 | ||
e31f508d | 1618 | for ( Int_t centBin = 0; centBin < centBinMaxi; centBin++ ){ |
1619 | TH1 *hRatio = static_cast<TH1*> (trigWithPSRatio.At(centBin)); | |
1620 | if ( !hRatio ) continue; | |
1621 | legcRTC->AddEntry(hRatio,(legendHeader[centBin]).Data(),"l"); | |
005408df | 1622 | } |
1623 | legcRTC->Draw("same"); | |
1624 | ||
1625 | ||
1626 | return c1; | |
1627 | } | |
1628 | ||
e31f508d | 1629 | TCanvas *ProcessCanvasCentralityPercentile(TObjArray *triggersB, TObjArray trigNoPS, TObjArray trigWithPS, Int_t trigNr, TString canvasName, TString *legendHeader){ |
93f182e7 | 1630 | |
e31f508d | 1631 | if(!triggersB || !legendHeader) return 0x0; |
93f182e7 | 1632 | |
1633 | TString cName = "c"; | |
1634 | cName += canvasName; | |
1635 | TCanvas *c1 = new TCanvas(canvasName,cName,1200,900); | |
1636 | SetCanvas(c1,0); | |
1637 | c1->cd(); | |
1638 | ||
e31f508d | 1639 | Int_t const centBinMaxi = 2; |
1640 | TObjArray trigRatio(centBinMaxi), trigRatioNoPS(centBinMaxi); | |
93f182e7 | 1641 | TLegend* legcRTC = new TLegend(0.2,0.15,0.50,0.40); |
1642 | legcRTC->SetHeader("Physics Selection"); | |
1643 | ||
e31f508d | 1644 | Int_t colorTab[2] = {kRed,kBlue}; |
1645 | TArrayI colorInd(centBinMaxi); | |
1646 | for (Int_t i = 0; i < centBinMaxi; i++ ) { | |
1647 | if(i<2) colorInd.AddAt(colorTab[i],i); | |
1648 | else colorInd.AddAt(colorTab[1]+i-1,i); | |
1649 | } | |
1650 | ||
1651 | TString hName; | |
1652 | ||
1653 | Float_t yMin = 0., yMax = 0.3; | |
1654 | ||
1655 | //process centrality bin 0-10% (centBin=3) and 60-80% (centBin=3) and compare it to 0-80% (centBin=1) | |
1656 | Int_t centBinMin = 2; | |
1657 | TH1 *hWithPSAll = static_cast<TH1*> (trigWithPS.At(1*triggersB->GetEntriesFast()+trigNr)); | |
1658 | TH1 *hNoPSAll = static_cast<TH1*> (trigNoPS.At(1*triggersB->GetEntriesFast()+trigNr)); | |
1659 | if (!hNoPSAll || !hWithPSAll) return 0; | |
1660 | ||
1661 | for ( Int_t centBin = centBinMin; centBin < centBinMaxi+centBinMin; centBin++){ | |
1662 | ||
1663 | if ( centBin > kCentBinMax ) continue; | |
1664 | ||
1665 | Int_t index = GetIndex(triggersB,trigNr,centBin); | |
1666 | TH1 *hWithPS = static_cast<TH1*> (trigWithPS.At(index)); | |
1667 | TH1 *hNoPS = static_cast<TH1*> (trigNoPS.At(index)); | |
1668 | if (!hNoPS || !hWithPS) continue; | |
1669 | ||
1670 | hName = "ratio"; | |
1671 | hName += ( (TObjString*) triggersB->At(trigNr) )->GetString(); | |
1672 | TH1 *hRatio = (TH1*) hWithPS->Clone(hName); | |
1673 | hRatio->Divide(hWithPSAll); | |
1674 | hRatio->Scale(0.8); | |
1675 | hRatio->SetLineColor(colorInd.At(centBin-centBinMin)); | |
1676 | hName = "ratioNoPS"; | |
1677 | hName += ( (TObjString*) triggersB->At(trigNr) )->GetString(); | |
1678 | TH1 *hRatioNoPS = (TH1*) (hNoPS->Clone(hName)); | |
1679 | hRatioNoPS->Divide(hNoPSAll); | |
1680 | hRatioNoPS->Scale(0.8); | |
1681 | hRatioNoPS->SetLineStyle(2); | |
1682 | hRatioNoPS->SetLineColor(colorInd.At(centBin-centBinMin)); | |
1683 | ||
1684 | if ( centBin == centBinMin ){ | |
1685 | hRatio->SetMaximum(yMax); | |
1686 | hRatio->SetMinimum(yMin); | |
1687 | hRatio->SetLabelSize(0.02); | |
1688 | hRatio->GetYaxis()->SetTitle("Centrality percentile check"); | |
1689 | TString sTitle = "for ", sTitle2 = (( (TObjString*) triggersB->At(trigNr) )->GetString()).Data(); | |
1690 | if ( !sTitle2.IsNull() ) sTitle += sTitle2; | |
1691 | else sTitle = ""; | |
1692 | hRatio->SetTitle(Form("Centrality percentile check %s - Multiplicity from V0 amplitude",sTitle.Data())); | |
1693 | hRatio->Draw("E"); | |
1694 | hRatioNoPS->Draw("EPSAME"); | |
1695 | } | |
1696 | else{ | |
1697 | hRatio->Draw("ESAME"); | |
1698 | hRatioNoPS->Draw("EPSAME"); | |
1699 | } | |
1700 | trigRatio.AddAt(hRatio,centBin-centBinMin); | |
1701 | trigRatioNoPS.AddAt(hRatioNoPS,centBin-centBinMin); | |
1702 | } | |
93f182e7 | 1703 | |
1704 | legcRTC->AddEntry(".","applied :",""); | |
e31f508d | 1705 | for(Int_t centBin = centBinMin; centBin < centBinMaxi+centBinMin; centBin++){ |
1706 | TH1 *hRatio = static_cast<TH1*> (trigRatio.At(centBin-centBinMin)); | |
1707 | if (!hRatio) continue; | |
1708 | legcRTC->AddEntry(hRatio,(legendHeader[centBin]).Data(),"l"); | |
93f182e7 | 1709 | } |
1710 | legcRTC->AddEntry(".","not applied :",""); | |
e31f508d | 1711 | for(Int_t centBin = centBinMin; centBin < centBinMaxi+centBinMin; centBin++){ |
1712 | TH1 *hRatioNoPS = static_cast<TH1*> (trigRatioNoPS.At(centBin-centBinMin)); | |
1713 | if (!hRatioNoPS) continue; | |
1714 | legcRTC->AddEntry(hRatioNoPS,(legendHeader[centBin]).Data(),"l"); | |
93f182e7 | 1715 | } |
1716 | legcRTC->Draw("same"); | |
1717 | ||
1718 | ||
1719 | return c1; | |
1720 | } | |
005408df | 1721 | |
e31f508d | 1722 | TCanvas *ProcessCanvasTracksoverTrigger(TObjArray *triggersB, TObjArray trigSel, TObjArray trackTracker, TObjArray trackTrigger, TObjArray trackMatched, TObjArray trackAll, Int_t trigNr, Int_t centNr, TString canvasName,TString legendHeader){ |
005408df | 1723 | |
e31f508d | 1724 | if(!triggersB || trigNr<0 || centNr<0 ) return 0x0; |
005408df | 1725 | |
e31f508d | 1726 | Int_t index = GetIndex(triggersB,trigNr,centNr); |
1727 | ||
1728 | TH1 *hTrackerPerB, *hTriggerPerB, *hMatchedPerB, *hAllTracksPerB, *hTrigSel, *histo; | |
005408df | 1729 | |
1730 | TString hName, hNameBase; | |
e31f508d | 1731 | hNameBase =( (TObjString*) triggersB->At(trigNr) )->GetString(); |
005408df | 1732 | |
e31f508d | 1733 | hTrigSel = static_cast<TH1*> (trigSel.At(index)); |
1734 | if (!hTrigSel) return 0; | |
1735 | ||
1736 | hName = Form("hTrackerPer%s",hNameBase.Data()); | |
1737 | histo = static_cast<TH1*> (trackTracker.At(index)); | |
1738 | if (!histo) return 0; | |
1739 | hTrackerPerB = (TH1*) histo->Clone(hName); | |
1740 | if ( hTrackerPerB->GetEntries() ) hTrackerPerB->Divide(hTrigSel); | |
005408df | 1741 | hTrackerPerB->SetLineColor(kRed); |
1742 | ||
e31f508d | 1743 | hName = Form("hTriggerPer%s",hNameBase.Data()); |
1744 | histo = static_cast<TH1*> (trackTrigger.At(index)); | |
1745 | if (!histo) return 0; | |
1746 | hTriggerPerB = (TH1*) histo->Clone(hName); | |
1747 | if ( hTriggerPerB->GetEntries() > 0 ) hTriggerPerB->Divide(hTrigSel); | |
005408df | 1748 | hTriggerPerB->SetLineColor(kBlue); |
1749 | ||
e31f508d | 1750 | hName = Form("hMatchedPer%s",hNameBase.Data()); |
1751 | histo = static_cast<TH1*> (trackMatched.At(index)); | |
1752 | if (!histo) return 0; | |
1753 | hMatchedPerB = (TH1*) histo->Clone(hName); | |
1754 | if ( hMatchedPerB->GetEntries() > 0 ) hMatchedPerB->Divide(hTrigSel); | |
005408df | 1755 | hMatchedPerB->SetLineColor(kViolet); |
1756 | ||
e31f508d | 1757 | hName = Form("hAllTracksPer%s",hNameBase.Data()); |
1758 | histo = static_cast<TH1*> (trackAll.At(index)); | |
1759 | if (!histo) return 0; | |
1760 | hAllTracksPerB = (TH1*) histo->Clone(hName); | |
1761 | if ( hAllTracksPerB->GetEntries() > 0 ) hAllTracksPerB->Divide(hTrigSel); | |
53ad2789 | 1762 | |
005408df | 1763 | hAllTracksPerB->SetLineWidth(3); |
1764 | hAllTracksPerB->SetLineColor(kBlack); | |
13bb4ca7 | 1765 | hAllTracksPerB->SetTitle(Form("Number of Tracks /%s %s",hNameBase.Data(),legendHeader.Data())); |
005408df | 1766 | hAllTracksPerB->SetMinimum(0.0001); |
53ad2789 | 1767 | if ( hAllTracksPerB->GetEntries() == 0 ) hAllTracksPerB->SetMaximum(0.1); |
005408df | 1768 | hAllTracksPerB->SetLabelSize(0.02); |
1769 | ||
005408df | 1770 | TString cName = "c"; |
1771 | cName += canvasName; | |
e31f508d | 1772 | hNameBase = ( (TObjString*) triggersB->At(trigNr) )->GetString(); |
005408df | 1773 | cName += hNameBase; |
005408df | 1774 | TCanvas *cRatioTrackTypesB = new TCanvas(canvasName,cName,1200,900); |
1775 | SetCanvas(cRatioTrackTypesB,0); | |
1776 | cRatioTrackTypesB->cd(); | |
1777 | ||
1778 | TLegend* legcTTCINT1B; | |
1779 | ||
1780 | hAllTracksPerB->Draw("E"); | |
1781 | hTrackerPerB->Draw("Esame"); | |
1782 | hMatchedPerB->Draw("Esame"); | |
1783 | hTriggerPerB->Draw("Esame"); | |
1784 | ||
1785 | legcTTCINT1B = new TLegend(0.70,0.5,0.90,0.70); | |
1786 | legcTTCINT1B->AddEntry(hAllTracksPerB,"All tracks","l"); | |
1787 | legcTTCINT1B->AddEntry(hTrackerPerB,"Tracking (only) tracks","l"); | |
1788 | legcTTCINT1B->AddEntry(hMatchedPerB,"Matched tracks","l"); | |
1789 | legcTTCINT1B->AddEntry(hTriggerPerB,"Trigger (only) tracks","l"); | |
1790 | legcTTCINT1B->Draw("same"); | |
005408df | 1791 | |
1792 | return cRatioTrackTypesB; | |
1793 | ||
1794 | } | |
1795 | ||
e31f508d | 1796 | TCanvas *ProcessCanvasTrackMultB(TObjArray *triggersB, TObjArray trigSel, TObjArray trackTracker, TObjArray trackTrigger, TObjArray trackMatched, Int_t trigNr, Int_t centNr, TString canvasName,TString legendHeader){ |
005408df | 1797 | |
e31f508d | 1798 | if( !triggersB || centNr < 0 || trigNr < 0 ) return 0x0; |
005408df | 1799 | |
e31f508d | 1800 | Int_t index = GetIndex(triggersB,trigNr,centNr); |
1801 | TString hNameBase = ( (TObjString*) triggersB->At(trigNr) )->GetString(); | |
1802 | ||
1803 | TString cName = Form("c%s%s",canvasName.Data(),hNameBase.Data()); | |
005408df | 1804 | TCanvas *cTrackMultB = new TCanvas(canvasName,cName,1200,900); |
1805 | SetCanvas(cTrackMultB,0); | |
005408df | 1806 | cTrackMultB->Divide(1,2); |
1807 | cTrackMultB->cd(1); | |
1808 | ||
e31f508d | 1809 | TH1* hSumTriggerOverB, *hSumTrackerOverB, *hTrigSel, *hTracker, *hTrigger, *hMatched; |
005408df | 1810 | TString hName; |
1811 | ||
e31f508d | 1812 | hTrigSel = static_cast<TH1*> (trigSel.At(index)); |
1813 | if (!hTrigSel) return 0; | |
1814 | hTracker = static_cast<TH1*> (trackTracker.At(index)); | |
1815 | if (!hTracker) return 0; | |
1816 | hTrigger = static_cast<TH1*> (trackTrigger.At(index)); | |
1817 | if (!hTrigger) return 0; | |
1818 | hMatched = static_cast<TH1*> (trackMatched.At(index)); | |
1819 | if (!hMatched) return 0; | |
1820 | ||
005408df | 1821 | hName = Form("hSumTriggerOver%s",hNameBase.Data()); |
e31f508d | 1822 | hSumTriggerOverB = (TH1*) hTrigger->Clone(hName); |
1823 | hSumTriggerOverB->Add(hMatched); | |
1824 | hSumTriggerOverB->Divide(hTrigSel); | |
1825 | hName = Form("Sum of trigger tracks (matched + trigger-only) / # events in %s %s",hNameBase.Data(),legendHeader.Data()); | |
005408df | 1826 | hSumTriggerOverB->SetTitle(hName); |
293bed3d | 1827 | hSumTriggerOverB->SetLabelSize(0.04); |
005408df | 1828 | hSumTriggerOverB->SetLineColor(kBlue); |
e31f508d | 1829 | |
005408df | 1830 | hName = Form("hSumTrackerOver%s",hNameBase.Data()); |
e31f508d | 1831 | hSumTrackerOverB = (TH1*) hTracker->Clone(hName); |
1832 | hSumTrackerOverB->Add(hMatched); | |
1833 | hSumTrackerOverB->Divide(hTrigSel); | |
1834 | hName = Form("Sum of tracker tracks (matched + tracker-only) / # events in %s %s",hNameBase.Data(),legendHeader.Data()); | |
005408df | 1835 | hSumTrackerOverB->SetTitle(hName); |
1836 | //hSumTrackerOverCINT1B->LabelsOption("u"); | |
293bed3d | 1837 | hSumTrackerOverB->SetLabelSize(0.04); |
005408df | 1838 | hSumTrackerOverB->SetLineColor(kBlue); |
e31f508d | 1839 | |
005408df | 1840 | hSumTriggerOverB->Draw("e"); |
1841 | cTrackMultB->cd(2); | |
1842 | hSumTrackerOverB->Draw("e"); | |
1843 | ||
1844 | return cTrackMultB; | |
1845 | ||
1846 | } | |
1847 | ||
e31f508d | 1848 | TCanvas *ProcessCanvasRatioTrackB(TObjArray *triggersB, TObjArray trigSel, TObjArray trackTracker, TObjArray trackTrigger, TObjArray trackMatched, Int_t trigNr, Int_t centNr, TString canvasName,TString legendHeader) { |
1849 | ||
1850 | if(!triggersB || trigNr < 0 || centNr < 0 ) return 0x0; | |
1851 | ||
1852 | Int_t index = GetIndex(triggersB,trigNr,centNr); | |
1853 | TString hNameBase =( (TObjString*) triggersB->At(trigNr) )->GetString(); | |
1854 | ||
1855 | TString cName = Form("c%s%s",canvasName.Data(),hNameBase.Data()); | |
005408df | 1856 | TCanvas *cRatioTrackB = new TCanvas(canvasName,cName,1200,900); |
1857 | SetCanvas(cRatioTrackB,0); | |
e31f508d | 1858 | |
1859 | TH1* hTrackerOverTriggerB, *hMatchedOverTriggerB, *hMatchedOverTrackerB, *hTrigSel, *hTracker, *hTrigger, *hMatched; | |
1860 | hTrigSel = static_cast<TH1*> (trigSel.At(index)); | |
1861 | if (!hTrigSel) return 0; | |
1862 | hTracker = static_cast<TH1*> (trackTracker.At(index)); | |
1863 | if (!hTracker) return 0; | |
1864 | hTrigger = static_cast<TH1*> (trackTrigger.At(index)); | |
1865 | if (!hTrigger) return 0; | |
1866 | hMatched = static_cast<TH1*> (trackMatched.At(index)); | |
1867 | if (!hMatched) return 0; | |
005408df | 1868 | |
1869 | TString hName = Form("hTrackerOverTrigger%s",hNameBase.Data()); | |
e31f508d | 1870 | hTrackerOverTriggerB = (TH1*) hTracker->Clone(hName); |
1871 | hTrackerOverTriggerB->Divide(hTrigger); | |
13bb4ca7 | 1872 | hName = Form("# tracker tracks / # trigger tracks in %s %s",hNameBase.Data(),legendHeader.Data()); |
005408df | 1873 | hTrackerOverTriggerB->SetTitle(hName); |
1874 | //hTrackerOverTriggerCINT1B->LabelsOption("u"); | |
1875 | hTrackerOverTriggerB->SetLabelSize(0.02); | |
005408df | 1876 | hTrackerOverTriggerB->SetLineColor(kBlue); |
1877 | ||
1878 | hName = Form("hMatchedOverTrigger%s",hNameBase.Data()); | |
e31f508d | 1879 | hMatchedOverTriggerB = (TH1*) hMatched->Clone(hName); |
1880 | hMatchedOverTriggerB->Divide(hTrigger); | |
13bb4ca7 | 1881 | hName = Form("# matched tracks / # trigger tracks in %s %s",hNameBase.Data(),legendHeader.Data()); |
005408df | 1882 | hMatchedOverTriggerB->SetTitle(hName); |
1883 | //hMatchedOverTriggerCINT1B->LabelsOption("u"); | |
1884 | hMatchedOverTriggerB->SetLabelSize(0.02); | |
005408df | 1885 | hMatchedOverTriggerB->SetLineColor(kBlue); |
1886 | ||
1887 | hName = Form("hMatchedOverTracker%s",hNameBase.Data()); | |
e31f508d | 1888 | hMatchedOverTrackerB = (TH1*) hMatched->Clone(hName); |
1889 | hMatchedOverTrackerB->Divide(hTracker); | |
13bb4ca7 | 1890 | hName = Form("# matched tracks / # tracker tracks in %s %s",hNameBase.Data(),legendHeader.Data()); |
005408df | 1891 | hMatchedOverTrackerB->SetTitle(hName); |
1892 | //hMatchedOverTrackerCINT1B->LabelsOption("u"); | |
1893 | hMatchedOverTrackerB->SetLabelSize(0.02); | |
005408df | 1894 | hMatchedOverTrackerB->SetLineColor(kBlue); |
1895 | ||
005408df | 1896 | cRatioTrackB->Divide(1,3); |
1897 | cRatioTrackB->cd(1); | |
1898 | hTrackerOverTriggerB->Draw("e"); | |
1899 | cRatioTrackB->cd(2); | |
1900 | hMatchedOverTriggerB->Draw("e"); | |
1901 | cRatioTrackB->cd(3); | |
1902 | hMatchedOverTrackerB->Draw("e"); | |
1903 | ||
e31f508d | 1904 | return cRatioTrackB; |
005408df | 1905 | } |
1906 | ||
e31f508d | 1907 | TCanvas *ProcessCanvasAsymMatched(TObjArray *triggersB, TObjArray trackPosMatched, TObjArray trackNegMatched, TObjArray trackAllMatched, Int_t trigNr, Int_t centNr, TString canvasName,TString legendHeader) { |
005408df | 1908 | |
e31f508d | 1909 | if(!triggersB || trigNr < 0 || centNr < 0 ) return 0x0; |
1910 | ||
1911 | Int_t index = GetIndex(triggersB,trigNr,centNr); | |
1912 | TString hName, hNameBase = (( (TObjString*) triggersB->At(trigNr) )->GetString()); | |
1913 | ||
1914 | TString cName = Form("c%s%s",canvasName.Data(),hNameBase.Data()); | |
005408df | 1915 | TCanvas *cAsymMatched = new TCanvas(canvasName.Data(),cName,1200,900); |
1916 | SetCanvas(cAsymMatched,0); | |
1917 | cAsymMatched->cd(); | |
1918 | ||
e31f508d | 1919 | TH1* hPosMatched, *hNegMatched, *hAllMatched; |
1920 | ||
1921 | hPosMatched = static_cast<TH1*> (trackPosMatched.At(index)); | |
1922 | if (!hPosMatched) return 0; | |
1923 | hNegMatched = static_cast<TH1*> (trackNegMatched.At(index)); | |
1924 | if (!hNegMatched) return 0; | |
1925 | hAllMatched = static_cast<TH1*> (trackAllMatched.At(index)); | |
1926 | if (!hAllMatched) return 0; | |
1927 | ||
1928 | hName = Form("hAsyMatchedFor%s",hNameBase.Data()); | |
1929 | TH1 *hAsymMatched = (TH1*) hPosMatched->Clone(hName); | |
1930 | hAsymMatched->Add(hNegMatched,-1); | |
1931 | hAsymMatched->Divide(hAllMatched); | |
1932 | hAsymMatched->SetLineColor(kRed); | |
1933 | hAsymMatched->SetMinimum(-0.3); | |
1934 | hAsymMatched->SetMaximum(0.3); | |
1935 | hAsymMatched->SetLabelSize(0.02); | |
13bb4ca7 | 1936 | hName = Form("Matched tracks charge asymmetry for %s with acc. cuts %s",hNameBase.Data(),legendHeader.Data()); |
e31f508d | 1937 | hAsymMatched->SetTitle(hName); |
1938 | hAsymMatched->GetYaxis()->SetTitle("Charged tracks asymmetry"); | |
1939 | hAsymMatched->Draw("EH"); | |
005408df | 1940 | |
1941 | return cAsymMatched; | |
e31f508d | 1942 | |
005408df | 1943 | } |
1944 | ||
e31f508d | 1945 | TCanvas *ProcessCanvasHighPtMuons(TObjArray *triggersB, TObjArray trigSel, TObjArray trackMatchedLowPt, TObjArray trackAllMatchedHighPt, Int_t trigNr, Int_t centNr, TString canvasName,TString legendHeader) { |
1946 | ||
1947 | if ( !triggersB || trigNr < 0 || centNr < 0 ) return 0x0; | |
1948 | ||
1949 | Int_t index = GetIndex(triggersB,trigNr,centNr); | |
1950 | TString hName, hNameBase = (( (TObjString*) triggersB->At(trigNr) )->GetString()); | |
1951 | ||
1952 | TString cName = Form("c%s%s",canvasName.Data(),hNameBase.Data()); | |
005408df | 1953 | TCanvas *cHighPtMuons = new TCanvas(canvasName.Data(),cName,1200,900); |
1954 | SetCanvas(cHighPtMuons,0); | |
1955 | cHighPtMuons->cd(); | |
005408df | 1956 | TLegend* legcHPM; |
e31f508d | 1957 | |
1958 | TH1* hRelMatchedLowPt, *hRelMatchedHighPt, *hTrigSel, *hMatchedLowPt, *hAllMatchedHighPt; | |
1959 | hTrigSel = static_cast<TH1*> (trigSel.At(index)); | |
1960 | if (!hTrigSel) return 0; | |
1961 | hMatchedLowPt = static_cast<TH1*> (trackMatchedLowPt.At(index)); | |
1962 | if (!hMatchedLowPt) return 0; | |
1963 | hAllMatchedHighPt = static_cast<TH1*> (trackAllMatchedHighPt.At(index)); | |
1964 | if (!hAllMatchedHighPt) return 0; | |
1965 | ||
005408df | 1966 | hName = Form("hMatchedLowPtPer%s ",hNameBase.Data()); |
e31f508d | 1967 | hRelMatchedLowPt = (TH1*) hMatchedLowPt->Clone(hName); |
1968 | hRelMatchedLowPt->Divide(hTrigSel); | |
1969 | hRelMatchedLowPt->SetLineColor(kBlue); | |
1970 | hRelMatchedLowPt->SetTitle(""); | |
005408df | 1971 | hName = Form("Ratio per %s ",hNameBase.Data()); |
e31f508d | 1972 | hRelMatchedLowPt->GetYaxis()->SetTitle(hName); |
1973 | hRelMatchedLowPt->SetMinimum(0.0001); | |
1974 | hRelMatchedLowPt->SetLabelSize(0.02); | |
005408df | 1975 | |
1976 | hName = Form("hMatchedHighPtPer%s ",hNameBase.Data()); | |
e31f508d | 1977 | hRelMatchedHighPt = (TH1*) hAllMatchedHighPt->Clone(hName); |
1978 | hRelMatchedHighPt->Divide(hTrigSel); | |
1979 | hRelMatchedHighPt->SetLineColor(kRed); | |
005408df | 1980 | |
13bb4ca7 | 1981 | hName = Form("Number of matched track per %s (include Vtx and R_{Abs} cuts) %s",hNameBase.Data(),legendHeader.Data()); |
e31f508d | 1982 | hRelMatchedLowPt->SetTitle(hName); |
1983 | hRelMatchedLowPt->Draw("E"); | |
1984 | hRelMatchedHighPt->Draw("Esame"); | |
005408df | 1985 | |
1986 | legcHPM = new TLegend(0.60,0.45,0.98,0.65); | |
93f182e7 | 1987 | //legcHPM->SetHeader(hName); |
005408df | 1988 | legcHPM->AddEntry(".","Physics selection applied :",""); |
e31f508d | 1989 | legcHPM->AddEntry(hRelMatchedLowPt," p_{T} > 1 GeV/c ","l"); |
1990 | legcHPM->AddEntry(hRelMatchedHighPt," p_{T} > 2 GeV/c ","l"); | |
005408df | 1991 | legcHPM->Draw("same"); |
1992 | ||
1993 | return cHighPtMuons; | |
13bb4ca7 | 1994 | } |
1995 | ||
e31f508d | 1996 | TCanvas *ProcessCanvasBeamGasMatched ( TObjArray *triggersB, TObjArray trackBeamGasMatched, TObjArray trackBeamGasMatchedHighPt, TObjArray trackAllMatched, TObjArray trackMatchedHighPt, Int_t trigNr, Int_t centNr, TString canvasName,TString legendHeader) { |
1997 | ||
1998 | if(!triggersB || trigNr < 0 || centNr < 0 ) return 0x0; | |
13bb4ca7 | 1999 | |
e31f508d | 2000 | Int_t index = GetIndex(triggersB,trigNr,centNr); |
2001 | TString hName, hNameBase = (( (TObjString*) triggersB->At(trigNr) )->GetString()); | |
13bb4ca7 | 2002 | |
e31f508d | 2003 | TString cName = Form("c%s%s",canvasName.Data(),hNameBase.Data()); |
13bb4ca7 | 2004 | TCanvas *cBeamGasMatched = new TCanvas(canvasName.Data(),cName,1200,900); |
2005 | SetCanvas(cBeamGasMatched,0); | |
2006 | cBeamGasMatched->cd(); | |
2007 | ||
e31f508d | 2008 | TH1* hBeamGasMatched, *hBeamGasMatchedHighPt, *hAllMatched, *hMatchedHighPt; |
2009 | ||
2010 | hBeamGasMatched = static_cast<TH1*> (trackBeamGasMatched.At(index)); | |
2011 | if (!hBeamGasMatched) return 0; | |
2012 | hBeamGasMatchedHighPt = static_cast<TH1*> (trackBeamGasMatchedHighPt.At(index)); | |
2013 | if (!hBeamGasMatchedHighPt) return 0; | |
2014 | hAllMatched = static_cast<TH1*> (trackAllMatched.At(index)); | |
2015 | if (!hAllMatched) return 0; | |
2016 | hMatchedHighPt = static_cast<TH1*> (trackMatchedHighPt.At(index)); | |
2017 | if (!hMatchedHighPt) return 0; | |
2018 | ||
13bb4ca7 | 2019 | hName = Form("hBeamGasMatchedPer%s ",hNameBase.Data()); |
e31f508d | 2020 | TH1 *hRelBeamGasMatched = (TH1*) hBeamGasMatched->Clone(hName); |
2021 | hRelBeamGasMatched->Divide(hAllMatched); | |
2022 | hRelBeamGasMatched->SetLineColor(kBlack); | |
2023 | hRelBeamGasMatched->SetMinimum(0.0); | |
2024 | hRelBeamGasMatched->SetMaximum(1.1); | |
2025 | hRelBeamGasMatched->SetLabelSize(0.02); | |
13bb4ca7 | 2026 | |
2027 | hName = Form("hBeamGasMatchedHightPtPer%s ",hNameBase.Data()); | |
e31f508d | 2028 | TH1 *hRelBeamGasMatchedHighPt = (TH1*) hBeamGasMatchedHighPt->Clone(hName); |
2029 | hRelBeamGasMatchedHighPt->Divide(hMatchedHighPt); | |
2030 | hRelBeamGasMatchedHighPt->SetLineColor(kRed); | |
13bb4ca7 | 2031 | |
2032 | hName = Form("Identified beam-gas tracks (pxDCA cuts) in matched tracks for %s",hNameBase.Data()); | |
2033 | if(!legendHeader.IsNull()) hName += Form(" %s",legendHeader.Data()); | |
e31f508d | 2034 | hRelBeamGasMatched->SetTitle(hName); |
2035 | hRelBeamGasMatched->GetYaxis()->SetTitle("Relative beam-gas tracks"); | |
2036 | hRelBeamGasMatched->Draw("EH"); | |
2037 | hRelBeamGasMatchedHighPt->Draw("EHsame"); | |
13bb4ca7 | 2038 | |
2039 | TLegend *leg = new TLegend(0.60,0.45,0.98,0.65); | |
2040 | leg->AddEntry(".","Physics selection applied :",""); | |
e31f508d | 2041 | leg->AddEntry(hRelBeamGasMatched," All p_{T}","l"); |
2042 | leg->AddEntry(hRelBeamGasMatchedHighPt," p_{T} > 2 GeV/c ","l"); | |
13bb4ca7 | 2043 | leg->Draw("same"); |
2044 | ||
2045 | return cBeamGasMatched; | |
e31f508d | 2046 | } |
2047 | ||
2048 | Int_t GetIndex( TObjArray *triggers, Int_t trigNr, Int_t centNr ) { | |
2049 | ||
2050 | return ( centNr * triggers->GetEntriesFast() + trigNr ); | |
005408df | 2051 | } |
2052 | ||
b69e18be | 2053 | TH1* ProcessHisto( AliCounterCollection* counter, TString hVariable, TString hSelection, TString hName, TString xName, TString yName, Int_t color){ |
005408df | 2054 | |
2055 | ||
2056 | TH1* h1 = 0x0; | |
2057 | if( !counter ) return h1; | |
93f182e7 | 2058 | |
2e7189d6 | 2059 | //cout<<"ProcessHisto selection "<<hSelection<<endl; |
b69e18be | 2060 | |
2061 | if ( !hSelection.Contains("trigger: /") && !hSelection.Contains("trigger:/") ) h1 = (TH1*) counter->Draw(hVariable,hSelection); | |
13bb4ca7 | 2062 | //cout<<"ProcessHisto selection2 "<<h1<<endl; |
005408df | 2063 | if ( !h1 ) h1 = new TH1D(hName,"",10,0,10); |
2064 | else { | |
13bb4ca7 | 2065 | if ( h1->GetSumw2N() == 0 ) h1->Sumw2(); |
005408df | 2066 | h1->LabelsOption("a"); |
2067 | if(hName.Sizeof()>1) h1->SetName(hName); | |
2068 | if(xName.Sizeof()>1) h1->GetXaxis()->SetTitle(xName); | |
2069 | if(yName.Sizeof()>1) h1->GetYaxis()->SetTitle(yName); | |
2070 | if(color>0) h1->SetLineColor(color); | |
e31f508d | 2071 | h1->SetLineWidth(2); |
005408df | 2072 | |
2073 | } | |
2074 | ||
2075 | return h1; | |
2076 | } | |
2077 | ||
2078 | TH2* ProcessHisto2D( AliCounterCollection* counter, TString hVariable, TString hVariable2, TString hSelection, TString hName){ | |
2079 | ||
2080 | ||
2081 | TH2* h1 = 0x0; | |
2082 | if( !counter ) return h1; | |
2083 | Bool_t setName = kTRUE; | |
2084 | ||
2085 | if(hName.Sizeof()==1) setName = kFALSE; | |
2086 | ||
2087 | h1 = (TH2*) counter->Draw(hVariable,hVariable2,hSelection); | |
2088 | if ( !h1 ) h1 = new TH2D(hName,"",10,0,10,10,0,10); | |
2089 | else { | |
13bb4ca7 | 2090 | if ( h1->GetSumw2N() == 0 ) h1->Sumw2(); |
005408df | 2091 | h1->LabelsOption("a"); |
2092 | if(setName) h1->SetName(hName); | |
2093 | } | |
2094 | ||
2095 | return h1; | |
2096 | } | |
93f182e7 | 2097 | |
e31f508d | 2098 | Bool_t GetTriggerLists(const char* triggerList, TString listFromContainer, TObjArray *triggersB, TObjArray *triggersShortName){ |
005408df | 2099 | |
2100 | //Get the trigger list from a file | |
2101 | //The file should consist of a line for each trigger with the following layout: | |
e31f508d | 2102 | // MB triggernameB |
2103 | // or MUONUNLIKE triggernameB | |
2104 | // or NOSHOW triggernameB | |
2105 | //if filename is 0, then all the triggers stored are used | |
2106 | if( !triggersB || !triggersShortName) return kFALSE; | |
2107 | Int_t const nColumn = 2; | |
2108 | TObjArray* triggers[nColumn] = {triggersShortName, triggersB}; | |
005408df | 2109 | |
e31f508d | 2110 | TString trigSuffix[nColumn] = {"","B"}; |
005408df | 2111 | TString currTrigName = ""; |
13bb4ca7 | 2112 | TObjArray* fullTriggerList[nColumn]; |
005408df | 2113 | |
13bb4ca7 | 2114 | for ( Int_t ibeam=0; ibeam<nColumn; ++ibeam ) { |
e31f508d | 2115 | fullTriggerList[ibeam] = new TObjArray(); |
005408df | 2116 | fullTriggerList[ibeam]->SetOwner(); |
2117 | } | |
2118 | ||
e31f508d | 2119 | // Build trigger list (from file or use all trigger stored) |
005408df | 2120 | if ( triggerList ) { |
2121 | // only the ones in the triggerList | |
2122 | ifstream inFile(triggerList); | |
2123 | if (!inFile.is_open()) { | |
93f182e7 | 2124 | Error("PlotMuonQA","unable to open file %s", triggerList); |
005408df | 2125 | return kFALSE; |
2126 | } | |
2127 | ||
2128 | while ( !inFile.eof() ) { | |
2129 | Bool_t isGoodB = kTRUE; | |
13bb4ca7 | 2130 | for ( Int_t ibeam=0; ibeam<nColumn; ++ibeam ) { |
005408df | 2131 | currTrigName.ReadToken( inFile ); |
2132 | if ( ! isGoodB ) continue; | |
2133 | if ( currTrigName.IsNull() || ! currTrigName.IsAscii() ) { | |
13bb4ca7 | 2134 | if ( ibeam==0 || ibeam == 1 ) { |
005408df | 2135 | isGoodB = kFALSE; |
2136 | continue; | |
2137 | } | |
2138 | currTrigName = "notrigger"; | |
2139 | } | |
2140 | fullTriggerList[ibeam]->AddLast(new TObjString(currTrigName)); | |
2141 | } | |
2142 | } | |
2143 | inFile.close(); | |
2144 | } | |
2145 | else { | |
e31f508d | 2146 | TObjArray *triggersInContainer = listFromContainer.Tokenize(","); |
53ad2789 | 2147 | Int_t nTrig = 0; |
e31f508d | 2148 | for ( Int_t iTrig = 0; iTrig < triggersInContainer->GetEntriesFast(); iTrig++ ) { |
2149 | currTrigName = triggersInContainer->At(iTrig)->GetName(); | |
2150 | Bool_t keep = kFALSE; | |
53ad2789 | 2151 | if ( ( currTrigName.Contains("-B-") || currTrigName.Contains("-ABCE-") ) && |
2152 | ( ! ((TString) currTrigName(0)).CompareTo("C") ) && !currTrigName.Contains("WU") && | |
2153 | !currTrigName.Contains("UP") && !currTrigName.Contains("SPI") && !currTrigName.Contains("PHI") && | |
2154 | !currTrigName.Contains("EMC") && !currTrigName.Contains("ZED") && !currTrigName.Contains("TRUE") && | |
2155 | !currTrigName.Contains("SHM") && !currTrigName.Contains("TPC") && !currTrigName.Contains("BEAM") && | |
2156 | !currTrigName.Contains("1A") && !currTrigName.Contains("1C")) | |
2157 | keep = kTRUE;//cyn: to be removed once the trigger filtering is carried out in the analysis task | |
e31f508d | 2158 | if (!keep) continue; |
53ad2789 | 2159 | nTrig++; |
e31f508d | 2160 | for (Int_t ibeam = 0; ibeam < nColumn; ibeam++) { |
2161 | fullTriggerList[ibeam]->AddLast( new TObjString(currTrigName) ); | |
005408df | 2162 | } |
2163 | } | |
53ad2789 | 2164 | //if no triggers are kept, then keep all of them |
2165 | if (nTrig == 0) { | |
2166 | printf("INFO: no trigger selected over %d triggers: all triggers kept!!\n", | |
2167 | triggersInContainer->GetEntriesFast()); | |
2168 | for ( Int_t iTrig = 0; iTrig < triggersInContainer->GetEntriesFast(); iTrig++ ) { | |
2169 | currTrigName = triggersInContainer->At(iTrig)->GetName(); | |
2170 | for (Int_t ibeam = 0; ibeam < nColumn; ibeam++) { | |
2171 | fullTriggerList[ibeam]->AddLast( new TObjString(currTrigName) ); | |
2172 | } | |
2173 | } | |
2174 | } | |
e31f508d | 2175 | if ( triggersInContainer ) delete triggersInContainer; |
005408df | 2176 | } |
e31f508d | 2177 | |
005408df | 2178 | // |
2179 | // Select only existing triggers in container | |
2180 | // | |
2181 | TObjArray *triggersFromContainer = listFromContainer.Tokenize(","); | |
2182 | TObjString* trigName = 0x0; | |
2183 | ||
e31f508d | 2184 | TString selectAllTriggers[nColumn]; |
2185 | for ( Int_t ibeam=0; ibeam<nColumn; ++ibeam ) selectAllTriggers[ibeam]= ""; | |
2186 | ||
005408df | 2187 | for ( Int_t itrig=0; itrig<fullTriggerList[0]->GetEntries(); ++itrig ) { |
2188 | Bool_t isBadTrig = kFALSE; | |
13bb4ca7 | 2189 | for ( Int_t ibeam=0; ibeam<nColumn; ++ibeam ) { |
005408df | 2190 | currTrigName = fullTriggerList[ibeam]->At(itrig)->GetName(); |
005408df | 2191 | //condition on trigger name from trigger list |
13bb4ca7 | 2192 | if ( ibeam == 0 && currTrigName.Contains("NOSHOW") ) { |
2193 | break; | |
2194 | } | |
005408df | 2195 | //select only the existing triggers in the container |
2196 | //note that the trigger in the trigger file can be a list of different trigger | |
13bb4ca7 | 2197 | if ( ibeam > 0 && triggersFromContainer ) { |
005408df | 2198 | TIter nextTrigger( triggersFromContainer ); |
2199 | isBadTrig = kTRUE; | |
2200 | while ( ( trigName = static_cast<TObjString*>(nextTrigger()) ) ) { | |
2201 | if ( currTrigName.Contains(trigName->GetString()) ){ | |
2e7189d6 | 2202 | isBadTrig = kFALSE; |
005408df | 2203 | } |
2204 | } | |
2205 | if ( isBadTrig == kTRUE ){ | |
13bb4ca7 | 2206 | if ( ibeam == 1){ |
2207 | if ( triggers[0]->GetLast() != (triggers[0]->LowerBound()-1) ) triggers[0]->RemoveAt(triggers[0]->GetLast()); | |
2208 | break; | |
2209 | } | |
005408df | 2210 | currTrigName = " "; |
2211 | } | |
2212 | } | |
2213 | triggers[ibeam]->AddLast(new TObjString(currTrigName)); | |
2214 | if ( isBadTrig ) continue; | |
2215 | if ( ! selectAllTriggers[ibeam].IsNull() ) selectAllTriggers[ibeam] += ","; | |
2216 | selectAllTriggers[ibeam] += currTrigName; | |
2217 | } | |
2218 | } | |
2219 | if(triggersFromContainer) delete triggersFromContainer; | |
2220 | if(trigName) delete trigName; | |
2221 | ||
2222 | ||
2223 | // Complete trigger list and print values | |
2224 | cout<<" Nr of triggers read "<<triggers[0]->GetEntriesFast()<<endl; | |
13bb4ca7 | 2225 | for ( Int_t ibeam=0; ibeam<nColumn; ++ibeam ) { |
005408df | 2226 | triggers[ibeam]->AddLast(new TObjString(selectAllTriggers[ibeam])); |
2227 | printf(" %s triggers:\n", trigSuffix[ibeam].Data()); | |
2228 | triggers[ibeam]->Print(); | |
2229 | delete fullTriggerList[ibeam]; | |
2230 | } | |
2231 | ||
2232 | return kTRUE; | |
2233 | } | |
2234 | ||
056ae2c8 | 2235 | Int_t GetRunNumber(TString filePath) |
2236 | { | |
2237 | /// Get run number from file path | |
2238 | TObjArray* array = filePath.Tokenize("/"); | |
2239 | array->SetOwner(); | |
2240 | TString auxString = ""; | |
2241 | Int_t runNum = -1; | |
2242 | for ( Int_t ientry=0; ientry<array->GetEntries(); ientry++ ) { | |
2243 | auxString = array->At(ientry)->GetName(); | |
2244 | if ( auxString.IsDigit() && auxString.Length()>=6 && auxString.Length()<=9 ) { | |
2245 | runNum = auxString.Atoi(); | |
2246 | break; | |
2247 | } | |
2248 | } | |
2249 | delete array; | |
2250 | ||
2251 | if ( runNum < 0 ) { | |
2252 | array = auxString.Tokenize("_"); | |
2253 | array->SetOwner(); | |
2254 | auxString = array->Last()->GetName(); | |
2255 | auxString.ReplaceAll(".root",""); | |
2256 | if ( auxString.IsDigit() ) runNum = auxString.Atoi(); | |
2257 | delete array; | |
2258 | } | |
2259 | ||
2260 | return runNum; | |
2261 | } | |
2262 | ||
e31f508d | 2263 | TString GetRunList(const char *runList, TObjArray *runs){ |
005408df | 2264 | |
2265 | // list of runs to be analyzed | |
2266 | TString selectRuns = "run:"; | |
2267 | ||
2268 | if(runList) { | |
2269 | // only the ones in the runList | |
2270 | ifstream inFile(runList); | |
2271 | if (!inFile.is_open()) { | |
93f182e7 | 2272 | Error("PlotMuonQA","unable to open file %s", runList); |
005408df | 2273 | return selectRuns; |
2274 | } | |
2275 | ||
056ae2c8 | 2276 | TString currLine; |
005408df | 2277 | while (!inFile.eof()) { |
056ae2c8 | 2278 | currLine.ReadLine(inFile); |
2279 | if ( currLine.IsNull() ) continue; | |
2280 | Int_t currRun = GetRunNumber(currLine); | |
2281 | if (currRun<0) { | |
2282 | Warning("PlotMuonQA","invalid run number: %s", currLine.Data()); | |
2283 | continue; | |
005408df | 2284 | } |
056ae2c8 | 2285 | if(runs) runs->AddLast(new TObjString(Form("%d", currRun))); |
2286 | selectRuns += Form("%i,",currRun); | |
005408df | 2287 | } |
2288 | selectRuns.Remove(TString::kTrailing, ','); | |
2289 | inFile.close(); | |
2290 | ||
2291 | } else { | |
2292 | // all runs | |
13bb4ca7 | 2293 | cout<<"runList is not set"<<endl; |
005408df | 2294 | if(runs) runs->AddLast(new TObjString("*")); |
005408df | 2295 | } |
2296 | ||
2e7189d6 | 2297 | printf("selected runs from runlist %s: %s\n",runList, selectRuns.Data()); |
93f182e7 | 2298 | |
005408df | 2299 | return selectRuns; |
2300 | } | |
056ae2c8 | 2301 | |
2302 | Bool_t MergeOutputs(const char* inputList,const char* outFilename) | |
2303 | { | |
2304 | ifstream inFile(inputList); | |
2305 | if ( ! inFile.is_open()) { | |
2306 | printf("Error: cannot find inputList %s\n", inputList); | |
2307 | return kFALSE; | |
2308 | } | |
2309 | TString currLine = ""; | |
2310 | TFileMerger fileMerger; | |
2311 | Int_t mergeType = ( TFileMerger::kRegular | TFileMerger::kAll | TFileMerger::kOnlyListed ); | |
2312 | fileMerger.AddObjectNames("MUON_QA"); | |
2313 | while ( ! inFile.eof() ) { | |
2314 | currLine.ReadLine(inFile); | |
2315 | if ( ! currLine.EndsWith(".root") ) continue; | |
2316 | fileMerger.AddFile(currLine.Data()); | |
2317 | } | |
2318 | inFile.close(); | |
2319 | if ( fileMerger.GetMergeList()->GetEntries() == 0 ) return kFALSE; | |
2320 | fileMerger.OutputFile(outFilename,kTRUE,1); // needed when merging single files for specific directories | |
2321 | fileMerger.PartialMerge(mergeType); | |
2322 | ||
2323 | return kTRUE; | |
2324 | } |