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