]>
Commit | Line | Data |
---|---|---|
0c6992be | 1 | /* |
2 | fbellini@cern.ch - last update on 09/09/2014 | |
3 | Macro to run the TOF QA trending by accessing the std QA output, | |
4 | to be mainly used with the automatic scripts to fill the QA repository. | |
5 | Launch with | |
6 | aliroot -l -b -q "MakeTrendingTOFQA.C(\"${fullpath}/QAresults.root\", ${run}, ...) | |
7 | The macro produces a file containing the tree of trending variables and the main plots. | |
8 | A feature that displays the plots in canvases must be enable when needed. | |
9 | */ | |
10 | ||
11 | ||
c2d1e53e | 12 | Int_t MakeTrendingTOFQA(char * runlist, |
0c6992be | 13 | Int_t year=2010, |
14 | char *period="LHC10c", | |
15 | char* pass="cpass1_pass4", | |
16 | char* nameSuffix ="_barrel", | |
17 | Bool_t isMC=kFALSE, | |
18 | Int_t trainId=0, | |
c2d1e53e | 19 | Bool_t saveHisto=kTRUE, |
20 | Bool_t includeStartTime=kTRUE, | |
21 | Bool_t drawAll=kTRUE) | |
0c6992be | 22 | { |
23 | Int_t filesCounter=0; | |
24 | if (!runlist) { | |
25 | printf("Invalid list of runs given as input: nothing done\n"); | |
26 | return 1; | |
27 | } | |
28 | Int_t runNumber; | |
29 | char infile[300]; | |
30 | ||
31 | char trendFileName[100]; | |
32 | //Define trending output | |
33 | if (trainId==0){ | |
34 | sprintf(trendFileName,"treeTOFQA_%s_%s.root",period,pass); | |
35 | } else { | |
36 | sprintf(trendFileName,"treeTOFQA_QA%i_%s_%s.root",trainId,period,pass); | |
37 | } | |
38 | TFile * trendFile=new TFile(trendFileName,"recreate"); | |
39 | FILE * files = fopen(runlist, "r") ; | |
40 | ||
41 | //create chain of treePostQA | |
42 | Long64_t nentries=100000, firstentry=0; | |
43 | TChain *chainTree = 0; | |
44 | chainTree=new TChain("trendTree"); | |
45 | ||
46 | while (fscanf(files,"%d",&runNumber)==1 ){ | |
47 | ||
48 | //get QAtrain output | |
49 | if (trainId==0){ | |
50 | if (!isMC) sprintf(infile,"alien:///alice/data/%i/%s/000%d/%s/QAresults%s.root",year,period,runNumber,pass,nameSuffix); | |
51 | else sprintf(infile,"alien:///alice/sim/%i/%s/%d/QAresults%s.root",year,period,runNumber,nameSuffix); | |
52 | } else{ | |
53 | if (!isMC) sprintf(infile,"alien:///alice/data/%i/%s/000%d/ESDs/%s/QA%i/QAresults%s.root",year,period,runNumber,pass,trainId,nameSuffix); | |
54 | else sprintf(infile,"alien:///alice/sim/%i/%s/%d/QA%i/QAresults%s.root",year,period,runNumber,trainId,nameSuffix); | |
55 | } | |
56 | Printf("============== Opening QA file(s) for run %i =======================\n",runNumber); | |
57 | ||
58 | //run post-analysis | |
c2d1e53e | 59 | if (MakeTrendingTOFQAv2(infile,runNumber,isMC,drawAll,kTRUE,"raw://", saveHisto, includeStartTime)==0){ |
0c6992be | 60 | filesCounter++; |
61 | } else Printf("Post analysis not run on QA output %s", infile); | |
62 | } | |
63 | Printf(":::: Processed %i runs", filesCounter); | |
64 | return; | |
65 | } | |
66 | ||
67 | //--------------------------------------------------------------------------------- | |
68 | Int_t MakeTrendingTOFQAv2(TString qafilename, //full path of the QA output; set IsOnGrid to prepend "alien://" | |
69 | Int_t runNumber, // run number | |
70 | Bool_t isMC=kFALSE, //MC flag, to disable meaningless checks | |
c2d1e53e | 71 | Bool_t drawAll = kFALSE, //enable display plots on canvas and save png |
0c6992be | 72 | Bool_t IsOnGrid = kFALSE, //set to kTRUE to access files on the grid |
73 | TString ocdbStorage = "raw://", | |
c2d1e53e | 74 | Bool_t saveHisto=kTRUE, //set the default ocdb storage |
75 | Bool_t includeStartTime=kTRUE ) | |
76 | { | |
0c6992be | 77 | // macro to generate tree with TOF QA trending variables |
78 | // access qa PWGPP output files | |
79 | if (!qafilename) { | |
80 | Printf("Error - Invalid input file"); | |
81 | return 1; | |
82 | } | |
83 | ||
84 | /*set graphic style*/ | |
85 | gStyle->SetCanvasColor(kWhite); | |
86 | gStyle->SetFrameFillColor(kWhite); | |
87 | gStyle->SetFrameBorderMode(0); | |
88 | gStyle->SetCanvasBorderMode(0); | |
89 | gStyle->SetTitleFillColor(kWhite); | |
90 | gStyle->SetTitleBorderSize(0) ; | |
91 | gStyle->SetTitleFont(42); | |
92 | gStyle->SetTextFont(42); | |
93 | gStyle->SetStatColor(kWhite); | |
94 | gStyle->SetStatBorderSize(1); | |
95 | TGaxis::SetMaxDigits(3); | |
96 | gStyle->SetOptStat(10); | |
97 | ||
98 | char defaultQAoutput[30]="QAresults.root"; | |
99 | TString treePostFileName=Form("trending_%i.root",runNumber); | |
100 | ||
101 | if (IsOnGrid) TGrid::Connect("alien://"); | |
102 | TFile * fin = TFile::Open(qafilename,"r"); | |
103 | if (!fin) { | |
104 | Printf("ERROR: QA output not found. Exiting...\n"); | |
105 | return -1; | |
106 | } else { | |
107 | Printf("INFO: QA output file %s open. \n",fin->GetName()); | |
108 | } | |
109 | ||
110 | //access histograms lists | |
111 | char tofQAdirName[15]="TOF"; | |
112 | char genListName[15]="base_noPID"; | |
113 | char t0ListName[15]="timeZero_noPID"; | |
114 | char pidListName[15]="pid_noPID"; | |
115 | char trdListName[15]="trd_noPID"; | |
116 | char trgListName[15]="trigger_noPID"; | |
c2d1e53e | 117 | char PIDqaListName[6]="PIDqa"; |
0c6992be | 118 | TDirectoryFile * tofQAdir=(TDirectoryFile*)fin->Get(tofQAdirName); |
c2d1e53e | 119 | TDirectoryFile * pidQAdir=(TDirectoryFile*)fin->Get(PIDqaListName); |
0c6992be | 120 | if (!tofQAdir) { |
121 | Printf("ERROR: TOF QA directory not present in input file.\n"); | |
122 | return -1; | |
123 | } | |
124 | TList * generalList=(TList*)tofQAdir->Get(genListName); | |
125 | TList *timeZeroList=(TList*)tofQAdir->Get(t0ListName); | |
126 | TList *pidList=(TList*)tofQAdir->Get(pidListName); | |
c2d1e53e | 127 | |
128 | if (!pidQAdir) { | |
129 | printf("WARNING: PIDqa histograms not available\n"); | |
130 | } else { | |
131 | TList *pidListT0=(TList*)pidQAdir->Get(PIDqaListName); | |
132 | TList *tofPidListT0=(TList*)pidListT0->FindObject("TOF"); | |
133 | } | |
0c6992be | 134 | TList *trdList=(TList*)tofQAdir->Get(trdListName); |
135 | TList *trgList=(TList*)tofQAdir->Get(trgListName); | |
136 | ||
137 | if (!generalList) Printf("WARNING: general QA histograms absent or not accessible\n"); | |
138 | if (!timeZeroList) Printf("WARNING: timeZero QA histograms absent or not accessible\n"); | |
139 | if (!pidList) Printf("WARNING: PID QA histograms absent or not accessible\n"); | |
140 | if (!trdList) Printf("WARNING: QA histograms for TRD checks absent or not accessible\n"); | |
141 | if (!trgList) Printf("WARNING: QA histograms for trigger absent or not accessible\n"); | |
142 | ||
143 | if ( (!generalList) && (!timeZeroList) && (!pidList) ){ | |
144 | printf("ERROR: no QA available \n"); | |
145 | return -1; | |
146 | } | |
147 | ||
148 | Printf(":::: Getting post-analysis info for run %i",runNumber); | |
149 | TFile * trendFile = new TFile(treePostFileName.Data(),"recreate"); | |
150 | ||
151 | Double_t avTime=-9999., peakTime=-9999., spreadTime=-9999., peakTimeErr=-9999., spreadTimeErr=-9999., negTimeRatio=-9999., | |
152 | avRawTime=-9999., peakRawTime=-9999., spreadRawTime=-9999., peakRawTimeErr=-9999., spreadRawTimeErr=-9999., avTot=-9999., peakTot=-9999.,spreadTot=-9999., peakTotErr=-9999.,spreadTotErr=-9999., | |
153 | orphansRatio=-9999., avL=-9999., negLratio=-9999., | |
154 | effPt1=-9999., effPt2=-9999., matchEffLinFit1Gev=-9999.,matchEffLinFit1GevErr=-9999.; | |
155 | ||
156 | Double_t avPiDiffTime=-9999.,peakPiDiffTime=-9999., spreadPiDiffTime=-9999.,peakPiDiffTimeErr=-9999., spreadPiDiffTimeErr=-9999.; | |
157 | ||
158 | Double_t avT0A=-9999.,peakT0A=-9999., spreadT0A=-9999.,peakT0AErr=-9999., spreadT0AErr=-9999.; | |
159 | Double_t avT0C=-9999.,peakT0C=-9999., spreadT0C=-9999.,peakT0CErr=-9999., spreadT0CErr=-9999.; | |
160 | Double_t avT0AC=-9999.,peakT0AC=-9999., spreadT0AC=-9999.,peakT0ACErr=-9999., spreadT0ACErr=-9999.; | |
161 | Double_t avT0res=-9999.,peakT0res=-9999., spreadT0res=-9999.,peakT0resErr=-9999., spreadT0resErr=-9999.; | |
162 | Double_t avT0fillRes=-9999.; | |
163 | ||
164 | Float_t avMulti=0; | |
165 | Float_t fractionEventsWHits=-9999.; | |
166 | /*number of good (HW ok && efficient && !noisy) TOF channels from OCDB*/ | |
167 | Double_t goodChannelRatio=0.0; | |
65ae12f9 | 168 | Double_t goodChannelRatioInAcc=0.0; |
0c6992be | 169 | |
170 | TTree * ttree=new TTree("trending","tree of trending variables"); | |
171 | ttree->Branch("run",&runNumber,"run/I"); | |
172 | ttree->Branch("avMulti",&avMulti,"avMulti/F"); | |
173 | ttree->Branch("fractionEventsWHits",&fractionEventsWHits,"fractionEventsWHits/F"); | |
174 | ttree->Branch("goodChannelsRatio",&goodChannelRatio,"goodChannelRatio/D"); | |
65ae12f9 | 175 | ttree->Branch("goodChannelsRatioInAcc",&goodChannelRatioInAcc,"goodChannelRatioInAcc/D"); |
0c6992be | 176 | ttree->Branch("avTime",&avTime,"avTime/D"); //mean time |
177 | ttree->Branch("peakTime",&peakTime,"peakTime/D"); //main peak time after fit | |
178 | ttree->Branch("spreadTime",&spreadTime,"spreadTime/D"); //spread of main peak of time after fit | |
179 | ttree->Branch("peakTimeErr",&peakTimeErr,"peakTimeErr/D"); //main peak time after fit error | |
180 | ttree->Branch("spreadTimeErr",&spreadTimeErr,"spreadTimeErr/D"); //spread of main peak of time after fit error | |
181 | ttree->Branch("negTimeRatio",&negTimeRatio,"negTimeRatio/D"); //negative time ratio | |
182 | ||
183 | ttree->Branch("avRawTime",&avRawTime,"avRawTime/D"); //mean raw time | |
184 | ttree->Branch("peakRawTime",&peakRawTime,"peakRawTime/D"); //mean peak of RAW TIME after fit | |
185 | ttree->Branch("spreadRawTime",&spreadRawTime,"spreadRawTime/D"); //spread of main peak of raw time after fit | |
186 | ttree->Branch("peakRawTimeErr",&peakRawTimeErr,"peakRawTimeErr/D"); //main peak raw time after fit error | |
187 | ttree->Branch("spreadRawTimeErr",&spreadRawTimeErr,"spreadRawTimeErr/D"); //spread of raw main peak of time after fit error | |
188 | ||
189 | ttree->Branch("avTot",&avTot,"avTot/D"); //main peak tot | |
190 | ttree->Branch("peakTot",&peakTot,"peakTot/D"); // main peak of tot after fit | |
191 | ttree->Branch("spreadTot",&spreadTot,"spreadTot/D"); //spread of main peak of tot after fit | |
192 | ttree->Branch("peakTotErr",&peakTotErr,"peakTotErr/D"); // main peak of tot after fit | |
193 | ttree->Branch("spreadTotErr",&spreadTotErr,"spreadTotErr/D"); //spread of main peak of tot after fit | |
194 | ||
195 | ttree->Branch("orphansRatio",&orphansRatio,"orphansRatio/D"); //orphans ratio | |
196 | ||
197 | ttree->Branch("avL",&avL,"avL/D"); //mean track length | |
198 | ttree->Branch("negLratio",&negLratio,"negLratio/D");//ratio of tracks with track length <350 cm | |
199 | ttree->Branch("effPt1",&effPt1,"effPt1/D");//matching eff at 1 GeV/c | |
200 | ttree->Branch("effPt2",&effPt2,"effPt2/D"); //matching eff at 2 GeV/c | |
201 | ttree->Branch("matchEffLinFit1Gev",&matchEffLinFit1Gev,"matchEffLinFit1Gev/D");//matching eff fit param | |
202 | ttree->Branch("matchEffLinFit1GevErr",&matchEffLinFit1GevErr,"matchEffLinFit1GevErr/D");////matching eff fit param error | |
203 | ||
204 | ttree->Branch("avPiDiffTime",&avPiDiffTime,"avPiDiffTime/D"); //mean t-texp | |
205 | ttree->Branch("peakPiDiffTime",&peakPiDiffTime,"peakPiDiffTime/D"); //main peak t-texp after fit | |
206 | ttree->Branch("spreadPiDiffTime",&spreadPiDiffTime,"spreadPiDiffTime/D"); //spread of main peak t-texp after fit | |
207 | ttree->Branch("peakPiDiffTimeErr",&peakPiDiffTimeErr,"peakPiDiffTimeErr/D"); //main peak t-texp after fit error | |
208 | ttree->Branch("spreadPiDiffTimeErr",&spreadPiDiffTimeErr,"spreadPiDiffTimeErr/D"); //spread of main peak of t-texp after fit error | |
209 | ||
210 | ttree->Branch("avT0A",&avT0A,"avT0A/D"); //main peak t0A | |
211 | ttree->Branch("peakT0A",&peakT0A,"peakT0A/D"); // main peak of t0A after fit | |
212 | ttree->Branch("spreadT0A",&spreadT0A,"spreadTot/D"); //spread of main peak of t0A after fit | |
213 | ttree->Branch("peakT0AErr",&peakT0AErr,"peakT0AErr/D"); // main peak of t0A after fit | |
214 | ttree->Branch("spreadT0AErr",&spreadT0AErr,"spreadT0AErr/D"); //spread of main peak of t0A after fit | |
215 | ||
216 | ttree->Branch("avT0C",&avT0C,"avT0C/D"); //main peak t0C | |
217 | ttree->Branch("peakT0C",&peakT0C,"peakT0C/D"); // main peak of t0C after fit | |
218 | ttree->Branch("spreadT0C",&spreadT0C,"spreadT0C/D"); //spread of main peak of t0C after fit | |
219 | ttree->Branch("peakT0CErr",&peakT0CErr,"peakT0CErr/D"); // main peak of t0C after fit | |
220 | ttree->Branch("spreadT0CErr",&spreadT0CErr,"spreadT0CErr/D"); //spread of main peak of t0C after fit | |
221 | ||
222 | ttree->Branch("avT0AC",&avT0AC,"avT0AC/D"); //main peak t0AC | |
223 | ttree->Branch("peakT0AC",&peakT0AC,"peakT0AC/D"); // main peak of t0AC after fit | |
224 | ttree->Branch("spreadT0AC",&spreadT0AC,"spreadT0AC/D"); //spread of main peak of t0AC after fit | |
225 | ttree->Branch("peakT0ACErr",&peakT0ACErr,"peakT0ACErr/D"); // main peak of t0AC after fit | |
226 | ttree->Branch("spreadT0ACErr",&spreadT0ACErr,"spreadT0ACErr/D"); //spread of main peak of t0AC after fit | |
227 | ||
228 | ttree->Branch("avT0res",&avT0res,"avT0res/D"); //main peak t0AC | |
229 | ttree->Branch("peakT0res",&peakT0res,"peakT0res/D"); // main peak of t0AC after fit | |
230 | ttree->Branch("spreadT0res",&spreadT0res,"spreadT0res/D"); //spread of main peak of t0AC after fit | |
231 | ttree->Branch("peakT0resErr",&peakT0resErr,"peakT0resErr/D"); // main peak of t0AC after fit | |
232 | ttree->Branch("spreadT0resErr",&spreadT0resErr,"spreadT0resErr/D"); //spread of main peak of t0AC after fit | |
233 | ttree->Branch("avT0fillRes",&avT0fillRes,"avT0fillRes/D"); //t0 fill res | |
234 | ||
235 | //save quantities for trending | |
65ae12f9 | 236 | goodChannelRatio=(Double_t)GetGoodTOFChannelsRatio(runNumber, kFALSE, ocdbStorage, kFALSE); |
237 | goodChannelRatioInAcc=(Double_t)GetGoodTOFChannelsRatio(runNumber, kFALSE, ocdbStorage, kTRUE); | |
0c6992be | 238 | |
239 | //--------------------------------- Multiplicity ----------------------------------// | |
240 | ||
241 | TH1F * hMulti = (TH1F*) generalList->FindObject("hTOFmulti_all"); | |
242 | TH1F* hFractionEventsWhits = new TH1F("hFractionEventsWhits","hFractionEventsWhits;fraction of events with hits (%)",200,0.,100.); | |
243 | Float_t fraction=0.0; | |
244 | if (hMulti->GetEntries()>0.0) { | |
245 | fraction = ((Float_t) hMulti->GetBinContent(1))/((Float_t) hMulti->GetEntries()); | |
246 | avMulti = hMulti->GetMean(); | |
247 | } else { fraction=0.0; } | |
248 | hFractionEventsWhits->Fill(fraction*100.); | |
249 | ||
250 | //--------------------------------- T0F signal ----------------------------------// | |
251 | TH1F * hRawTime = (TH1F*)generalList->FindObject("hRawTime_all"); | |
252 | if ((hRawTime)&&(hRawTime->GetEntries()>0)){ | |
253 | avRawTime=hRawTime->GetMean(); | |
254 | if (!isMC){ | |
255 | hRawTime->Fit("landau","RQ0","",200.,250.); | |
256 | if (hRawTime->GetFunction("landau")) { | |
257 | peakRawTime=(hRawTime->GetFunction("landau"))->GetParameter(1); | |
258 | spreadRawTime=(hRawTime->GetFunction("landau"))->GetParameter(2); | |
259 | peakRawTimeErr=(hRawTime->GetFunction("landau"))->GetParError(1); | |
260 | spreadRawTimeErr=(hRawTime->GetFunction("landau"))->GetParError(2); | |
261 | } | |
262 | } else { | |
263 | printf("Reminder: Raw time not available in MC simulated data."); | |
264 | } | |
265 | } | |
266 | MakeUpHisto(hRawTime, "matched tracks", 21, kGreen+2); | |
267 | ||
268 | TH1F * hTime = (TH1F*)generalList->FindObject("hTime_all"); | |
269 | if ((hTime)&&(hTime->GetEntries()>0)) { | |
270 | avTime=hTime->GetMean(); | |
271 | hTime->Fit("landau","RQ0","",0.,50.); | |
272 | if (hTime->GetFunction("landau")) { | |
273 | peakTime=(hTime->GetFunction("landau"))->GetParameter(1); | |
274 | spreadTime=(hTime->GetFunction("landau"))->GetParameter(2); | |
275 | peakTimeErr=(hTime->GetFunction("landau"))->GetParError(1); | |
276 | spreadTimeErr=(hTime->GetFunction("landau"))->GetParError(2); | |
277 | negTimeRatio=((Double_t)hTime->Integral(1,3)*100.)/((Double_t)hTime->Integral()); | |
278 | } | |
279 | MakeUpHisto(hTime, "matched tracks", 20, kBlue+2); | |
280 | ||
281 | TLegend *lTime = new TLegend(0.7125881,0.6052519,0.979435,0.7408306,NULL,"brNDC"); | |
282 | lTime->SetTextSize(0.04281433); | |
283 | lTime->AddEntry(hRawTime, "raw","L"); | |
284 | lTime->AddEntry(hTime, "ESD","L"); | |
285 | lTime->SetFillColor(kWhite); | |
286 | lTime->SetShadowColor(0); | |
287 | } | |
288 | ||
289 | TH1F * hTot = (TH1F*)generalList->FindObject("hTot_all"); | |
290 | if ((hTot)&&(hTot->GetEntries()>0)){ | |
291 | avTot=hTot->GetMean(); | |
292 | hTot->Fit("gaus","","",0.,50.); | |
293 | if (hTot->GetFunction("gaus")) { | |
294 | peakTot=(hTot->GetFunction("gaus"))->GetParameter(1); | |
295 | spreadTot=(hTot->GetFunction("gaus"))->GetParameter(2); | |
296 | peakTotErr=(hTot->GetFunction("gaus"))->GetParError(1); | |
297 | spreadTotErr=(hTot->GetFunction("gaus"))->GetParError(2); | |
298 | } | |
299 | } | |
300 | MakeUpHisto(hTot, "matched tracks", 8, kViolet-3); | |
301 | ||
302 | char orphansTxt[200]; | |
303 | if (hTot->GetEntries()>1){ | |
304 | orphansRatio=((Float_t) hTot->GetBinContent(1))/((Float_t) hTot->GetEntries()) ; | |
305 | } | |
306 | sprintf(orphansTxt,"orphans/matched = %4.2f%%",orphansRatio*100.); | |
307 | TPaveText *tOrphans = new TPaveText(0.38,0.63,0.88,0.7, "NDC"); | |
308 | tOrphans->SetBorderSize(0); | |
309 | tOrphans->SetTextSize(0.045); | |
310 | tOrphans->SetFillColor(0); //white background | |
311 | tOrphans->SetTextAlign(12); | |
312 | tOrphans->SetTextColor(kViolet-3); | |
313 | tOrphans->AddText(orphansTxt); | |
314 | ||
315 | TH1F * hL=(TH1F*)generalList->FindObject("hMatchedL_all"); | |
316 | char negLengthTxt[200]; | |
317 | if (hL->GetEntries()>0){ | |
318 | avL=hL->GetMean(); | |
319 | negLratio=(hL->Integral(1,750))/((Float_t) hL->GetEntries()) ; | |
320 | } | |
321 | MakeUpHisto(hL, "matched tracks", 1, kBlue+2); | |
322 | sprintf(negLengthTxt,"trk with L<350cm /matched = %4.2f%%", negLratio*100.); | |
323 | TPaveText *tLength = new TPaveText(0.15,0.83,0.65,0.87, "NDC"); | |
324 | tLength->SetBorderSize(0); | |
325 | tLength->SetTextSize(0.04); | |
326 | tLength->SetFillColor(0); //white background | |
327 | tLength->SetTextAlign(11); | |
328 | tLength->SetTextColor(kOrange-3); | |
329 | tLength->AddText(negLengthTxt); | |
330 | ||
331 | //--------------------------------- residuals -------------------------------------// | |
332 | TH2F* hDxPos4profile = (TH2F*) generalList->FindObject("hMatchedDxVsPt_all"); | |
333 | TH2F* hTOFmatchedDzVsStrip = (TH2F*)generalList->FindObject("hMatchedDzVsStrip_all"); | |
334 | ||
335 | //--------------------------------- matching eff ----------------------------------// | |
336 | //matching as function of pT | |
337 | TH1F * hMatchingVsPt = new TH1F("hMatchingVsPt","Matching probability vs. Pt; Pt(GeV/c); matching probability", 50, 0., 5. ); | |
338 | TH1F * hDenom = (TH1F*)generalList->FindObject("hPrimaryPt_all"); | |
339 | if (hDenom) { | |
340 | hDenom->Sumw2(); | |
341 | hMatchingVsPt=(TH1F*) generalList->FindObject("hMatchedPt_all")->Clone(); | |
342 | hMatchingVsPt->Sumw2(); | |
343 | // hMatchingVsPt->Rebin(5); | |
344 | // hDenom->Rebin(5); | |
345 | hMatchingVsPt->Divide(hDenom); | |
346 | hMatchingVsPt->GetYaxis()->SetTitle("matching efficiency"); | |
347 | hMatchingVsPt->SetTitle("TOF matching efficiency as function of transverse momentum"); | |
348 | hMatchingVsPt->GetYaxis()->SetRangeUser(0,1.2); | |
349 | } | |
350 | ||
351 | if (hMatchingVsPt->GetEntries()>0){ | |
352 | hMatchingVsPt->Fit("pol0","","",1.0,10.); | |
353 | hMatchingVsPt->Draw(); | |
354 | if (hMatchingVsPt->GetFunction("pol0")){ | |
355 | matchEffLinFit1Gev=(hMatchingVsPt->GetFunction("pol0"))->GetParameter(0); | |
356 | matchEffLinFit1GevErr=(hMatchingVsPt->GetFunction("pol0"))->GetParError(0); | |
357 | //printf("Matching efficiency fit param is %f +- %f\n",matchEffLinFit1Gev,matchEffLinFit1GevErr ); | |
358 | } | |
359 | } else { | |
360 | printf("WARNING: matching efficiency plot has 0 entries. Skipped!\n"); | |
361 | } | |
362 | MakeUpHisto(hMatchingVsPt, "efficiency", 1, kBlue+2); | |
363 | ||
364 | //matching as function of eta | |
365 | TH1F * hMatchingVsEta = new TH1F("hMatchingVsEta","Matching probability vs. #\Eta; #\Eta; matching probability", 20, -1., 1.); | |
366 | hDenom->Clear(); | |
367 | hDenom=(TH1F*)generalList->FindObject("hPrimaryEta_all"); | |
368 | if (hDenom) { | |
369 | hDenom->Sumw2(); | |
370 | hMatchingVsEta=(TH1F*) generalList->FindObject("hMatchedEta_all")->Clone(); | |
371 | hMatchingVsEta->Sumw2(); | |
372 | // hMatchingVsEta->Rebin(5); | |
373 | // hDenom->Rebin(5); | |
374 | hMatchingVsEta->Divide(hDenom); | |
375 | hMatchingVsEta->GetXaxis()->SetRangeUser(-1,1); | |
376 | hMatchingVsEta->GetYaxis()->SetTitle("matching efficiency"); | |
377 | hMatchingVsEta->GetYaxis()->SetRangeUser(0,1.2); | |
378 | hMatchingVsEta->SetTitle("TOF matching efficiency as function of pseudorapidity"); | |
379 | } | |
380 | MakeUpHisto(hMatchingVsEta, "efficiency", 1, kBlue+2); | |
381 | ||
382 | //matching as function of phi | |
383 | TH1F * hMatchingVsPhi = new TH1F("hMatchingVsPhi","Matching probability vs. Phi; Phi(rad); matching probability", 628, 0., 6.28); | |
384 | hDenom->Clear(); | |
385 | hDenom=(TH1F*)generalList->FindObject("hPrimaryPhi_all"); | |
386 | if (hDenom) { | |
387 | hDenom->Sumw2(); | |
388 | hMatchingVsPhi=(TH1F*) generalList->FindObject("hMatchedPhi_all")->Clone(); | |
389 | // hMatchingVsPhi->Rebin(2); | |
390 | // hDenom->Rebin(2); | |
391 | hMatchingVsPhi->Sumw2(); | |
392 | hMatchingVsPhi->Divide(hDenom); | |
393 | hMatchingVsPhi->GetYaxis()->SetTitle("matching efficiency"); | |
394 | hMatchingVsPhi->SetTitle("TOF matching efficiency as function of phi"); | |
395 | hMatchingVsPhi->GetYaxis()->SetRangeUser(0,1.2); | |
396 | } | |
397 | MakeUpHisto(hMatchingVsPhi, "efficiency", 1, kBlue+2); | |
398 | ||
399 | if (saveHisto) { | |
400 | trendFile->cd(); | |
401 | hMulti->Write(); | |
402 | hTime->Write(); | |
403 | hRawTime->Write(); | |
404 | hTot->Write(); | |
405 | hL->Write(); | |
406 | hDxPos4profile->Write(); | |
407 | hTOFmatchedDzVsStrip->Write(); | |
408 | hMatchingVsPt->Write(); | |
409 | hMatchingVsEta->Write(); | |
410 | hMatchingVsPhi->Write(); | |
411 | } | |
412 | ||
413 | ||
414 | ||
415 | //--------------------------------- t-texp ----------------------------------// | |
416 | TH2F * hBetaP=(TH2F*)pidList->FindObject("hMatchedBetaVsP_all"); | |
417 | if (hBetaP) hBetaP->GetYaxis()->SetRangeUser(0.,1.2); | |
418 | ||
419 | TH1F * hMass=(TH1F*)pidList->FindObject("hMatchedMass_all"); | |
420 | MakeUpHisto(hMass, "tracks", 1, kBlue+2); | |
421 | // hMass->SetFillColor(kAzure+10); | |
422 | // hMass->SetFillStyle(1001); | |
423 | hMass->Rebin(2); | |
424 | ||
425 | //pions | |
426 | TH1F * hPionDiff=(TH1F*)pidList->FindObject("hExpTimePi_all"); | |
427 | if ((hPionDiff)&&(hPionDiff->GetEntries()>0)) { | |
428 | avPiDiffTime=hPionDiff->GetMean(); | |
429 | hPionDiff->Fit("gaus","","",-1000.,500.); | |
430 | if (hPionDiff->GetFunction("gaus")){ | |
431 | peakPiDiffTime=(hPionDiff->GetFunction("gaus"))->GetParameter(1); | |
432 | spreadPiDiffTime=(hPionDiff->GetFunction("gaus"))->GetParameter(2); | |
433 | peakPiDiffTimeErr=(hPionDiff->GetFunction("gaus"))->GetParError(1); | |
434 | spreadPiDiffTimeErr=(hPionDiff->GetFunction("gaus"))->GetParError(2); | |
435 | // printf("Main peak t-t_exp (gaus): mean = %f +- %f\n",peakPiDiffTime,peakPiDiffTimeErr ); | |
436 | // printf("Main peak t-t_exp (gaus): spread = %f +- %f\n",spreadPiDiffTime,spreadPiDiffTimeErr ); | |
437 | } | |
438 | } | |
439 | ||
440 | TH1F * hDiffTimeT0fillPion=(TH1F*)pidList->FindObject("hExpTimePiFillSub_all"); | |
441 | TH1F * hDiffTimeT0TOFPion1GeV=(TH1F*)pidList->FindObject("hExpTimePiT0Sub1GeV_all"); | |
442 | TH2F * hDiffTimePi=(TH2F*)pidList->FindObject("hExpTimePiVsP_all"); | |
0c6992be | 443 | hDiffTimePi->SetTitle("PIONS t-t_{exp,#pi} (from tracking) vs. P"); |
c2d1e53e | 444 | hDiffTimePi->GetYaxis()->SetRangeUser(-5000.,5000.); |
0c6992be | 445 | |
446 | //Kaon | |
447 | TH2F * hDiffTimeKa=(TH2F*)pidList->FindObject("hExpTimeKaVsP_all"); | |
448 | hDiffTimeKa->SetTitle("KAONS t-t_{exp,K} (from tracking) vs. P"); | |
449 | hDiffTimeKa->GetYaxis()->SetRangeUser(-5000.,5000.); | |
450 | ||
451 | //Protons | |
452 | TH2F * hDiffTimePro=(TH2F*)pidList->FindObject("hExpTimeProVsP_all"); | |
453 | hDiffTimePro->SetTitle("PROTONS t-t_{exp,p} (from tracking) vs. P"); | |
454 | hDiffTimePro->GetYaxis()->SetRangeUser(-5000.,5000.); | |
455 | ||
c2d1e53e | 456 | if (saveHisto) { |
0c6992be | 457 | trendFile->cd(); |
458 | hBetaP->Write(); | |
459 | hMass->Write(); | |
460 | hPionDiff->Write(); | |
461 | hDiffTimeT0fillPion->Write(); | |
462 | hDiffTimeT0TOFPion1GeV->Write(); | |
463 | hDiffTimePi->Write(); | |
464 | hDiffTimeKa->Write(); | |
465 | hDiffTimePro->Write(); | |
c2d1e53e | 466 | } |
467 | ||
468 | //--------------------------------- NSigma PID from TOF QA ----------------------------------// | |
469 | TH2F * hSigmaPi=(TH2F*)pidList->FindObject("hTOFpidSigmaPi_all"); | |
470 | hSigmaPi->GetYaxis()->SetRangeUser(-5.,5.); | |
471 | hSigmaPi->GetXaxis()->SetRangeUser(0.2,10.); | |
472 | hSigmaPi->FitSlicesY(); | |
473 | TH1D * hSigmaPi_1 = (TH1D*)gDirectory->Get("hTOFpidSigmaPi_all_1"); | |
474 | TH1D * hSigmaPi_2 = (TH1D*)gDirectory->Get("hTOFpidSigmaPi_all_2"); | |
475 | //hSigmaPiT0->SetName("hSigmaPiT0"); | |
476 | hSigmaPi_1->SetLineColor(1); | |
477 | hSigmaPi_1->SetLineWidth(2); | |
478 | hSigmaPi_2->SetLineColor(2); | |
479 | hSigmaPi_2->SetLineWidth(2); | |
480 | ||
481 | TH2F * hSigmaKa=(TH2F*)pidList->FindObject("hTOFpidSigmaKa_all"); | |
482 | hSigmaKa->GetYaxis()->SetRangeUser(-5.,5.); | |
483 | hSigmaKa->GetXaxis()->SetRangeUser(0.2,10.); | |
484 | hSigmaKa->FitSlicesY(); | |
485 | TH1D * hSigmaKa_1 = (TH1D*)gDirectory->Get("hTOFpidSigmaKa_all_1"); | |
486 | TH1D * hSigmaKa_2 = (TH1D*)gDirectory->Get("hTOFpidSigmaKa_all_2"); | |
487 | //hSigmaKaT0->SetName("hSigmaKaT0"); | |
488 | hSigmaKa_1->SetLineColor(1); | |
489 | hSigmaKa_1->SetLineWidth(2); | |
490 | hSigmaKa_2->SetLineColor(2); | |
491 | hSigmaKa_2->SetLineWidth(2); | |
492 | ||
493 | TH2F * hSigmaPro=(TH2F*)pidList->FindObject("hTOFpidSigmaPro_all"); | |
494 | hSigmaPro->GetYaxis()->SetRangeUser(-5.,5.); | |
495 | hSigmaPro->GetXaxis()->SetRangeUser(0.2,10.); | |
496 | hSigmaPro->FitSlicesY(); | |
497 | TH1D * hSigmaPro_1 = (TH1D*)gDirectory->Get("hTOFpidSigmaPro_all_1"); | |
498 | TH1D * hSigmaPro_2 = (TH1D*)gDirectory->Get("hTOFpidSigmaPro_all_2"); | |
499 | //hSigmaProT0->SetName("hSigmaProT0"); | |
500 | hSigmaPro_1->SetLineColor(1); | |
501 | hSigmaPro_1->SetLineWidth(2); | |
502 | hSigmaPro_2->SetLineColor(2); | |
503 | hSigmaPro_2->SetLineWidth(2); | |
504 | ||
505 | TString plotDir("."); | |
506 | if (drawAll){ | |
507 | TCanvas *cPidPerformance3= new TCanvas("cPidPerformance3","summary of pid performance - sigmas",1200,500); | |
508 | cPidPerformance3->Divide(3,1); | |
509 | cPidPerformance3->cd(1); | |
510 | gPad->SetLogz(); | |
511 | gPad->SetLogx(); | |
512 | gPad->SetGridx(); | |
513 | gPad->SetGridy(); | |
514 | hSigmaPi->Draw("colz"); | |
515 | hSigmaPi_1->Draw("same"); | |
516 | hSigmaPi_2->Draw("same"); | |
517 | cPidPerformance3->cd(2); | |
518 | gPad->SetLogz(); | |
519 | gPad->SetLogx(); | |
520 | hSigmaKa->Draw("colz"); | |
521 | hSigmaKa_1->Draw("same"); | |
522 | hSigmaKa_2->Draw("same"); | |
523 | cPidPerformance3->cd(3); | |
524 | gPad->SetLogz(); | |
525 | gPad->SetLogx(); | |
526 | hSigmaPro->Draw("colz"); | |
527 | hSigmaPro_1->Draw("same"); | |
528 | hSigmaPro_2->Draw("same"); | |
529 | ||
530 | cPidPerformance3->Print(Form("%s/%i_PID_sigmas.png", plotDir.Data(), runNumber)); | |
531 | ||
532 | if (saveHisto){ | |
533 | hSigmaPi->Write(); | |
534 | hSigmaKa->Write(); | |
535 | hSigmaPro->Write(); | |
536 | } | |
537 | } | |
538 | //--------------------------------- NSigma PID from PIDqa ----------------------------------// | |
539 | TH2F * hSigmaPiT0 = 0x0; | |
540 | TH2F * hSigmaKaT0 = 0x0; | |
541 | TH2F * hSigmaProT0 = 0x0; | |
542 | if(includeStartTime && pidQAdir){ | |
543 | //Pions pid | |
544 | hSigmaPiT0=(TH2F*)tofPidListT0->FindObject("hNsigmaP_TOF_pion"); | |
545 | hSigmaPiT0->GetYaxis()->SetRangeUser(-5.,5.); | |
546 | hSigmaPiT0->GetXaxis()->SetRangeUser(0.2,10.); | |
547 | hSigmaPiT0->FitSlicesY(); | |
548 | ||
549 | TH1D * hSigmaPiT0_1 = (TH1D*)gDirectory->Get("hNsigmaP_TOF_pion_1"); | |
550 | TH1D * hSigmaPiT0_2 = (TH1D*)gDirectory->Get("hNsigmaP_TOF_pion_2"); | |
551 | //hSigmaPiT0->SetName("hSigmaPiT0"); | |
552 | hSigmaPiT0_1->SetLineColor(1); | |
553 | hSigmaPiT0_1->SetLineWidth(2); | |
554 | hSigmaPiT0_2->SetLineColor(2); | |
555 | hSigmaPiT0_2->SetLineWidth(2); | |
556 | ||
557 | //Kaons pid | |
558 | hSigmaKaT0=(TH2F*)tofPidListT0->FindObject("hNsigmaP_TOF_kaon"); | |
559 | hSigmaKaT0->GetYaxis()->SetRangeUser(-5.,5.); | |
560 | hSigmaKaT0->GetXaxis()->SetRangeUser(0.2,10.); | |
561 | hSigmaKaT0->FitSlicesY(); | |
562 | TH1D * hSigmaKaT0_1 = (TH1D*)gDirectory->Get("hNsigmaP_TOF_kaon_1"); | |
563 | TH1D * hSigmaKaT0_2 = (TH1D*)gDirectory->Get("hNsigmaP_TOF_kaon_2"); | |
564 | hSigmaKaT0_1->SetLineColor(1); | |
565 | hSigmaKaT0_1->SetLineWidth(2); | |
566 | hSigmaKaT0_2->SetLineColor(2); | |
567 | hSigmaKaT0_2->SetLineWidth(2); | |
568 | ||
569 | //protons pid | |
570 | hSigmaProT0 = (TH2F*)tofPidListT0->FindObject("hNsigmaP_TOF_proton"); | |
571 | hSigmaProT0->GetYaxis()->SetRangeUser(-5.,5.); | |
572 | hSigmaProT0->GetXaxis()->SetRangeUser(0.2,10.); | |
573 | hSigmaProT0->FitSlicesY(); | |
574 | TH1D * hSigmaProT0_1 = (TH1D*)gDirectory->Get("hNsigmaP_TOF_proton_1"); | |
575 | TH1D * hSigmaProT0_2 = (TH1D*)gDirectory->Get("hNsigmaP_TOF_proton_2"); | |
576 | hSigmaProT0_1->SetLineColor(1); | |
577 | hSigmaProT0_1->SetLineWidth(2); | |
578 | hSigmaProT0_2->SetLineColor(2); | |
579 | hSigmaProT0_2->SetLineWidth(2); | |
580 | ||
581 | if (drawAll){ | |
582 | TLine *l1=new TLine(0.,0.,5.,0.); | |
583 | TLine *l2=new TLine(0.,1.,5.,1.); | |
584 | TCanvas *cPidPerformance3T0 = new TCanvas("cPidPerformance3T0","PID performance from PIDqa - sigmas - with StartTime",1200,500); | |
585 | cPidPerformance3T0->Divide(3,1); | |
586 | cPidPerformance3T0->cd(1); | |
587 | gPad->SetLogz(); | |
588 | gPad->SetLogx(); | |
589 | gPad->SetGridx(); | |
590 | gPad->SetGridy(); | |
591 | hSigmaPiT0->Draw("colz"); | |
592 | hSigmaPiT0_1->Draw("same"); | |
593 | hSigmaPiT0_2->Draw("same"); | |
594 | l1->Draw("same"); | |
595 | l2->Draw("same"); | |
596 | cPidPerformance3T0->cd(2); | |
597 | gPad->SetLogz(); | |
598 | gPad->SetLogx(); | |
599 | gPad->SetGridx(); | |
600 | gPad->SetGridy(); | |
601 | hSigmaKaT0->Draw("colz"); | |
602 | hSigmaKaT0_1->Draw("same"); | |
603 | hSigmaKaT0_2->Draw("same"); | |
604 | l1->Draw("same"); | |
605 | l2->Draw("same"); | |
606 | cPidPerformance3T0->cd(3); | |
607 | gPad->SetLogz(); | |
608 | gPad->SetLogx(); | |
609 | gPad->SetGridx(); | |
610 | gPad->SetGridy(); | |
611 | hSigmaProT0->Draw("colz"); | |
612 | hSigmaProT0_1->Draw("same"); | |
613 | hSigmaProT0_2->Draw("same"); | |
614 | l1->Draw("same"); | |
615 | l2->Draw("same"); | |
616 | cPidPerformance3T0->Print(Form("%s/%i_PID_sigmasStartTime.png", plotDir.Data(), runNumber)); | |
617 | } | |
618 | if (saveHisto) { | |
619 | trendFile->cd(); | |
620 | hSigmaPiT0->Write(); | |
621 | hSigmaKaT0->Write(); | |
622 | hSigmaProT0->Write(); | |
623 | hSigmaPiT0_1->Write(); | |
624 | hSigmaKaT0_1->Write(); | |
625 | hSigmaProT0_1->Write(); | |
626 | hSigmaPiT0_2->Write(); | |
627 | hSigmaKaT0_2->Write(); | |
628 | hSigmaProT0_2->Write(); | |
629 | } | |
630 | } | |
631 | ||
0c6992be | 632 | //--------------------------------- T0 detector ----------------------------------// |
633 | ||
634 | TH1F*hT0A=(TH1F*)timeZeroList->FindObject("hT0A"); | |
635 | if ((hT0A)&&(hT0A->GetEntries()>0)) { | |
636 | avT0A = hT0A->GetMean(); | |
637 | hT0A->Fit("gaus","RQ0", "", -1000., 1000.); | |
638 | if (hT0A->GetFunction("gaus")) { | |
639 | peakT0A=(hT0A->GetFunction("gaus"))->GetParameter(1); | |
640 | spreadT0A=(hT0A->GetFunction("gaus"))->GetParameter(2); | |
641 | peakT0AErr=(hT0A->GetFunction("gaus"))->GetParError(1); | |
642 | spreadT0AErr=(hT0A->GetFunction("gaus"))->GetParError(2); | |
643 | // printf("Main peak T0A(gaus): mean = %f +- %f\n",peakT0A,peakT0AErr ); | |
644 | // printf("Main peak T0A (gaus): spread = %f +- %f\n",spreadT0A,spreadT0AErr ); | |
645 | //add integral of main peak over total | |
646 | } | |
647 | } | |
648 | MakeUpHisto(hT0A, "events", 8, kBlue); | |
649 | hT0A->Rebin(2); | |
650 | ||
651 | TH1F*hT0C=(TH1F*)timeZeroList->FindObject("hT0C"); | |
652 | if ((hT0C)&&(hT0C->GetEntries()>0)) { | |
653 | avT0C=hT0C->GetMean(); | |
654 | hT0C->Fit("gaus","RQ0","", -1000., 1000.); | |
655 | if (hT0C->GetFunction("gaus")) { | |
656 | peakT0C=(hT0C->GetFunction("gaus"))->GetParameter(1); | |
657 | spreadT0C=(hT0C->GetFunction("gaus"))->GetParameter(2); | |
658 | peakT0CErr=(hT0C->GetFunction("gaus"))->GetParError(1); | |
659 | spreadT0CErr=(hT0C->GetFunction("gaus"))->GetParError(2); | |
660 | // printf("Main peak T0C(gaus): mean = %f +- %f\n",peakT0C,peakT0CErr ); | |
661 | // printf("Main peak T0C (gaus): spread = %f +- %f\n",spreadT0C,spreadT0CErr ); | |
662 | //add integral of main peak over total | |
663 | } | |
664 | } | |
665 | MakeUpHisto(hT0C, "events", 8, kGreen+1); | |
666 | hT0C->Rebin(2); | |
667 | ||
668 | TH1F*hT0AC=(TH1F*)timeZeroList->FindObject("hT0AC"); | |
669 | if ((hT0AC)&&(hT0AC->GetEntries()>0)) { | |
670 | avT0AC=hT0AC->GetMean(); | |
671 | hT0AC->Fit("gaus","RQ0", "",-1000., 1000.); | |
672 | if (hT0AC->GetFunction("gaus")) { | |
673 | peakT0AC=(hT0AC->GetFunction("gaus"))->GetParameter(1); | |
674 | spreadT0AC=(hT0AC->GetFunction("gaus"))->GetParameter(2); | |
675 | peakT0ACErr=(hT0AC->GetFunction("gaus"))->GetParError(1); | |
676 | spreadT0ACErr=(hT0AC->GetFunction("gaus"))->GetParError(2); | |
677 | // printf("Main peak T0AC(gaus): mean = %f +- %f\n",peakT0AC,peakT0ACErr ); | |
678 | // printf("Main peak T0AC (gaus): spread = %f +- %f\n",spreadT0AC,spreadT0ACErr ); | |
679 | } | |
680 | } | |
681 | MakeUpHisto(hT0AC, "events", 8, kRed+1); | |
682 | hT0AC->Rebin(2); | |
683 | ||
684 | TLegend *lT0 = new TLegend(0.7125881,0.6052519,0.979435,0.7408306,NULL,"brNDC"); | |
685 | lT0->SetTextSize(0.041); | |
686 | lT0->AddEntry(hT0AC, "T0 A&C","L"); | |
687 | lT0->AddEntry(hT0A, "T0 A","L"); | |
688 | lT0->AddEntry(hT0C, "T0 C","L"); | |
689 | lT0->SetFillColor(kWhite); | |
690 | lT0->SetShadowColor(0); | |
691 | ||
692 | TH1F*hT0res=(TH1F*)timeZeroList->FindObject("hT0DetRes"); | |
693 | if ((hT0res)&&(hT0res->GetEntries()>0)) { | |
694 | avT0res=hT0res->GetMean(); | |
695 | hT0res->Fit("gaus"); | |
696 | if (hT0res->GetFunction("gaus")) { | |
697 | peakT0res=(hT0res->GetFunction("gaus"))->GetParameter(1); | |
698 | spreadT0res=(hT0res->GetFunction("gaus"))->GetParameter(2); | |
699 | peakT0resErr=(hT0res->GetFunction("gaus"))->GetParError(1); | |
700 | spreadT0resErr=(hT0res->GetFunction("gaus"))->GetParError(2); | |
701 | // printf("Main peak T0res(gaus): mean = %f +- %f\n",peakT0res,peakT0resErr ); | |
702 | // printf("Main peak T0res (gaus): spread = %f +- %f\n",spreadT0res,spreadT0resErr ); | |
703 | //add integral of main peak over total | |
704 | } | |
705 | } | |
706 | TH1F*hT0fillRes=(TH1F*)timeZeroList->FindObject("hT0fillRes"); | |
707 | if ((hT0fillRes)&&(hT0fillRes->GetEntries()>0)) { | |
708 | avT0fillRes=hT0fillRes->GetMean(); | |
709 | } | |
710 | ||
711 | if (saveHisto) { | |
712 | trendFile->cd(); | |
713 | hT0AC->Write(); | |
714 | hT0A->Write(); | |
715 | hT0C->Write(); | |
716 | hT0res->Write(); | |
717 | hT0fillRes->Write(); | |
718 | } | |
719 | //Fill tree and save to file | |
720 | ttree->Fill(); | |
721 | printf("============== Saving trending quantities in tree for run %i ===============\n",runNumber); | |
722 | trendFile->cd(); | |
723 | ttree->Write(); | |
724 | trendFile->Close(); | |
725 | ||
c2d1e53e | 726 | if (drawAll){ |
0c6992be | 727 | TCanvas *cTrackProperties= new TCanvas("cTrackProperties","summary of matched tracks properties", 1200, 500); |
728 | cTrackProperties->Divide(3,1); | |
729 | cTrackProperties->cd(1); | |
730 | gPad->SetLogy(); | |
731 | hTime->Draw(""); | |
732 | hRawTime ->Draw("same"); | |
0c6992be | 733 | cTrackProperties->cd(2); |
734 | gPad->SetLogy(); | |
735 | hTot->Draw(""); | |
736 | tOrphans->Draw(); | |
737 | cTrackProperties->cd(3); | |
738 | gPad->SetLogy(); | |
739 | hL->Draw(""); | |
740 | tLength->Draw(); | |
c2d1e53e | 741 | |
742 | // TCanvas *cResiduals= new TCanvas("residuals","residuals", 900,500); | |
743 | // cResiduals->Divide(2,1); | |
744 | // cResiduals->cd(1); | |
745 | // gPad->SetLogz(); | |
746 | // hDxPos4profile->GetYaxis()->SetRangeUser(-5.,5.); | |
747 | // hDxPos4profile->Draw("colz"); | |
748 | // // profDxPos->SetLineColor(kRed); | |
749 | // // profDxPos->Draw("same"); | |
750 | // cResiduals->cd(2); | |
751 | // gPad->SetLogz(); | |
752 | // hDxNeg4profile->GetYaxis()->SetRangeUser(-5.,5.); | |
753 | // hDxNeg4profile->Draw("colz"); | |
754 | // // profDxNeg->SetLineColor(kBlue); | |
755 | // // profDxNeg->Draw("same"); | |
756 | ||
0c6992be | 757 | TCanvas* cProfile = new TCanvas("cProfile","cProfile",50,50, 750,550); |
758 | cProfile->cd(); | |
759 | gPad->SetLogz(); | |
760 | hTOFmatchedDzVsStrip->Draw("colz"); | |
761 | Int_t binmin = hTOFmatchedDzVsStrip->GetYaxis()->FindBin(-3); | |
762 | Int_t binmax = hTOFmatchedDzVsStrip->GetYaxis()->FindBin(3); | |
763 | TProfile* hDzProfile = (TProfile*)hTOFmatchedDzVsStrip->ProfileX("hDzProfile",binmin, binmax); | |
764 | hDzProfile->SetLineWidth(3); | |
765 | hDzProfile->Draw("same"); | |
766 | ||
767 | TCanvas *cMatchingPerformance= new TCanvas("cMatchingPerformance","summary of matching performance",1200,500); | |
768 | cMatchingPerformance->Divide(3,1); | |
769 | cMatchingPerformance->cd(1); | |
770 | hMatchingVsPt->Draw(); | |
771 | cMatchingPerformance->cd(2); | |
772 | hMatchingVsEta->Draw(); | |
773 | cMatchingPerformance->cd(3); | |
774 | hMatchingVsPhi->Draw(); | |
775 | ||
776 | TCanvas *cPidPerformance= new TCanvas("cPidPerformance","summary of pid performance", 900,500); | |
777 | cPidPerformance->Divide(2,1); | |
778 | cPidPerformance->cd(1); | |
779 | gPad->SetLogz(); | |
780 | hBetaP->Draw("colz"); | |
781 | cPidPerformance->cd(2); | |
782 | gPad->SetLogy(); | |
c2d1e53e | 783 | hMass->Draw("HIST"); |
0c6992be | 784 | |
785 | TCanvas *cPidPerformance2= new TCanvas("cPidPerformance2","summary of pid performance - expected times", 1200, 500); | |
786 | cPidPerformance2->Divide(3,1); | |
787 | cPidPerformance2->cd(1); | |
788 | gPad->SetLogz(); | |
789 | hDiffTimePi->Draw("colz"); | |
0c6992be | 790 | cPidPerformance2->cd(2); |
791 | gPad->SetLogz(); | |
792 | hDiffTimeKa->Draw("colz"); | |
0c6992be | 793 | cPidPerformance2->cd(3); |
794 | gPad->SetLogz(); | |
795 | hDiffTimePro->Draw("colz"); | |
c2d1e53e | 796 | |
0c6992be | 797 | TCanvas *cT0detector= new TCanvas("cT0detector","T0 detector",800,600); |
798 | cT0detector->Divide(2,1); | |
799 | cT0detector->cd(1); | |
800 | gPad->SetGridx(); | |
801 | hT0AC->Draw(""); | |
802 | hT0AC->SetTitle("timeZero measured by T0 detector"); | |
803 | hT0A ->Draw("same"); | |
804 | hT0C ->Draw("same"); | |
805 | lT0->Draw(); | |
806 | cT0detector->cd(2); | |
807 | hT0res->Draw(); | |
808 | ||
0c6992be | 809 | cTrackProperties->Print(Form("%s/%i_TrackProperties.png",plotDir.Data(), runNumber)); |
0c6992be | 810 | cProfile->Print(Form("%s/%i_ProfileDZvsStripNumber.png",plotDir.Data(), runNumber)); |
c2d1e53e | 811 | cMatchingPerformance->Print(Form("%s/%i_Matching.png",plotDir.Data(), runNumber)); |
812 | cPidPerformance->Print(Form("%s/%i_PID.png",plotDir.Data(), runNumber)); | |
813 | cPidPerformance2->Print(Form("%s/%i_PID_ExpTimes.png",plotDir.Data(), runNumber)); | |
0c6992be | 814 | cT0detector->Print(Form("%s/%i_T0Detector.png",plotDir.Data(), runNumber)); |
c2d1e53e | 815 | //cPidPerformanceTh->Print(Form("%s/PID_theoreticalTimes.png",plotDir.Data())); |
816 | //cResiduals->Print(Form("%s/%i_Residuals.png",plotDir.Data(), runNumber)); | |
0c6992be | 817 | } |
c2d1e53e | 818 | |
0c6992be | 819 | return 0; |
820 | } | |
821 | ||
822 | ||
823 | //---------------------------------------------------------- | |
65ae12f9 | 824 | Double_t GetGoodTOFChannelsRatio(Int_t run = -1, Bool_t saveMap = kFALSE, TString OCDBstorage = "raw://", Bool_t inEta08 = kFALSE) |
0c6992be | 825 | { |
826 | /* | |
827 | It retrieves from OCDB the number of good (= efficient && not noisy && HW ok) TOF channels. | |
828 | Optionally is saves the channel map | |
829 | */ | |
830 | if (run<=0) { | |
831 | printf("MakeTrendingTOFqa.C - ERROR in CheckCalibStatus(): invalid run number. Please set a run number.\n"); | |
832 | return 0.0; | |
833 | } | |
834 | ||
835 | AliCDBManager *cdb = AliCDBManager::Instance(); | |
836 | cdb->SetDefaultStorage(OCDBstorage.Data()); | |
837 | cdb->SetRun(run); | |
838 | ||
839 | AliCDBEntry *cdbe = cdb->Get("TOF/Calib/Status"); | |
840 | if (!cdbe) { | |
841 | printf("MakeTrendingTOFqa.C - ERROR in CheckCalibStatus(): OCDB entry not available. Please, try again.\n"); | |
842 | return 0.0; | |
843 | } | |
844 | ||
845 | AliTOFChannelOnlineStatusArray *array = (AliTOFChannelOnlineStatusArray *)cdbe->GetObject(); | |
846 | TH2F *hOkMap = new TH2F("hOkMap", "Ok map (!noisy & !problematic & efficient);sector;strip", 72, 0., 18., 91, 0., 91.); | |
65ae12f9 | 847 | TH2F *hOkMapInAcceptance = new TH2F("hOkMapInAcceptance",Form( "Good channels in |#eta|<0.8 - run %i;sector;strip",run), 72, 0., 18., 91, 0., 91.); |
0c6992be | 848 | AliTOFcalibHisto calibHisto; |
849 | calibHisto.LoadCalibHisto(); | |
850 | AliTOFcalib calib; | |
851 | calib.Init(); | |
852 | Int_t sector, sectorStrip, padx, fea; | |
853 | Float_t hitmapx, hitmapy; | |
854 | for (Int_t i = 0; i < array->GetSize(); i++) { | |
855 | sector = calibHisto.GetCalibMap(AliTOFcalibHisto::kSector, i); | |
856 | sectorStrip = calibHisto.GetCalibMap(AliTOFcalibHisto::kSectorStrip, i); | |
857 | padx = calibHisto.GetCalibMap(AliTOFcalibHisto::kPadX, i); | |
858 | fea = padx / 12; | |
859 | hitmapx = sector + ((Double_t)(3 - fea) + 0.5) / 4.; | |
860 | hitmapy = sectorStrip; | |
861 | if ( !(array->GetNoiseStatus(i) == AliTOFChannelOnlineStatusArray::kTOFNoiseBad) && | |
65ae12f9 | 862 | (calib.IsChannelEnabled(i,kTRUE,kTRUE))) { |
0c6992be | 863 | hOkMap->Fill(hitmapx,hitmapy); |
65ae12f9 | 864 | /* 3 strips / side excluded from norm. factor to consider |eta|<0.8 */ |
865 | if (sectorStrip>2 && sectorStrip<89) hOkMapInAcceptance->Fill(hitmapx,hitmapy); | |
866 | } | |
867 | } | |
868 | Int_t nOk = (Int_t) hOkMap->GetEntries(); | |
869 | Int_t nOkInAcc = (Int_t) hOkMapInAcceptance->GetEntries(); | |
870 | Double_t ratioOk = nOk/152928.; | |
c2d1e53e | 871 | /* 96 channels * 6 strips * 18 modules excluded from norm. factor to consider |eta|<0.8 */ |
65ae12f9 | 872 | Double_t ratioOkInAcc = nOkInAcc/(152928.-6.*18.*96.); |
873 | if (saveMap) { | |
874 | hOkMap->SaveAs(Form("run%i_OKChannelsMap.root",run)); | |
875 | hOkMapInAcceptance->SaveAs(Form("run%i_OKChannelsInAccMap.root",run)); | |
0c6992be | 876 | } |
0c6992be | 877 | cout << "### Run " << run << ": TOF channels ok = " << nOk << "/ total 152928 channels = " << ratioOk*100. << "% of whole TOF" << endl; |
65ae12f9 | 878 | cout << "### Run " << run << ": TOF channels in acc. ok = " << nOkInAcc << "/ total 142560 channels = " << ratioOkInAcc*100. << "% of whole TOF" << endl; |
879 | if (inEta08) | |
880 | return ratioOkInAcc; | |
881 | else | |
882 | return ratioOk; | |
c2d1e53e | 883 | |
0c6992be | 884 | } |
885 | ||
886 | //---------------------------------------------------------- | |
887 | void MakeUpHisto(TH1* histo, TString titleY, Int_t marker=20, Color_t color=kBlue+2) | |
888 | { | |
889 | if (!histo) return; | |
890 | histo->SetMarkerStyle(marker); | |
891 | histo->SetMarkerSize(0.7); | |
892 | histo->SetMarkerColor(color); | |
893 | histo->SetLineColor(color); | |
894 | histo->SetFillColor(kWhite); | |
895 | histo->SetFillStyle(0); | |
896 | histo->GetYaxis()->SetTitle(titleY.Data()); | |
897 | histo->GetYaxis()->SetTitleOffset(1.35); | |
898 | histo->GetXaxis()->SetLabelSize(0.03); | |
899 | ||
900 | return; | |
901 | } |