]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGPP/ITS/AliITSQAtrend_pp.C
Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[u/mrichter/AliRoot.git] / PWGPP / ITS / AliITSQAtrend_pp.C
CommitLineData
579b5046 1#if !defined(__CINT__) || defined(__MAKECINT__)
2#include <TH1F.h>
3#include <TH2F.h>
4#include <TF1.h>
5#include <TPad.h>
6#include <TGraphErrors.h>
7#include <TROOT.h>
8#include <TFile.h>
9#include <TTree.h>
10#include <TGrid.h>
11#include <TGridResult.h>
12#include <TMath.h>
13#include <TSystem.h>
14#include <TNtuple.h>
15#include <TCanvas.h>
16#include <TStyle.h>
17#include <TLatex.h>
18#include <TLegend.h>
19#include <TLegendEntry.h>
20#include <Riostream.h>
21//#include <AliITSgeomTGeo.h>
22#endif
23
24TString pdfFileNames="";
25void MakePlot(Int_t run1=-1,Int_t run2=999999,TString ntupleFileName="TrendingITS.root");
28d5818f 26void PlotITSSA(TFile *fil,Int_t run1, Int_t run2);
579b5046 27void FillITSSAntuple(TFile* f,TNtuple* nt, Int_t nrun);
28d5818f 28void FillSDDntuple(TFile* f,TNtuple* nt, Int_t iRun, Float_t *xnt);
29void FillSSDntuple(TFile* f,TNtuple* ntssd, Int_t iRun, Float_t *xntSSD);
30void FillMatchntuple(TFile* f,TNtuple* ntmatching, Int_t iRun, Float_t *xntMatching);
31void FillVTXntuple(TFile* f,TNtuple* ntvertex, Int_t iRun, Float_t *xntVertex);
32void AliITSQAtrend(TString runListFile="LHC12d.txt",TString ntupleFileName="TrendingITS.root");
579b5046 33Double_t LangausFun(Double_t *x, Double_t *par);
34Bool_t WriteInputTextFileFromMonalisaListOfRuns(TString outtxtfilename,Int_t* listofrunsfromMonalisa,Int_t nruns,TString pathbeforRunN="alice/data/2012/LHC12a/",TString pathafterRunN="cpass1/QAresults_barrel.root");
28d5818f 35Int_t RunsToPlot(Int_t run1, Int_t run2,Int_t nr,Int_t *noRuns, Int_t *myIndex);
579b5046 36
37////////////////////////////////////////////////////////////////
38// THIS VERSION OPTIMIZED FOR PP
39// TO BE MODIFIED WHEN PASSING FROM cpass1 to pass1
40//
41// Please, read this comment before using this macro
42//
43// INPUT FILE: a text file (by default LHC12a.txt) which contains
44// a list of the complete path+file name of the QAresults root files
45// (without the alien:// prefix).
46// One file per line. The order is irrelevant.
47//
48// USAGE:
49//
50// Function AliITSQAtrend():
51// it looks for a local root file named TrendingITS.root,
52// where the ntuples used to build the trending plots are
53// stored. This file is used to generate incrementally the ntuple contents:
54// when you add a new entry in the LHC12a.txt file (see below) and you have a
55// local copy of the TrendingITS.root file, only the additional run will
56// be processed. The whole list is processed only the first time you use the
57// macro. Please, bear in mind that this macro is RAM-intensive: all the
58// ntuples are kept in memory. It is better to add few runs to the list at
59// each time, according to the RAM of your computer.
60// The function AliITSQAtrend does not produce any plot.
61//
62// The LHC12a.txt file contains the QA input file name, with its path and
63// the number of the LHC fill.
64// Example of LHC12a.txt (input file complete path + FILL number):
65/*
66/alice/data/2012/LHC12a/000176661/cpass1/QAresults_barrel.root 2469
67/alice/data/2012/LHC12a/000176701/cpass1/QAresults_barrel.root 2470
28d5818f 68/alice/data/2012/LHC12d/000184780/ESDs/high_lumi/QAresults.root 2848
579b5046 69*/
70//
71// Function MakePlot(run1,run2):
72// it produces the plots. For each canvas a PDF file is created.
73// A PDF file with all the canvases merged is also produced
74// The first two argument define a range for the runs to be displayed
75// These two arguments are optional: by default, all the runs
76// found in the ntuples are displayed
77////////////////////////////////////////////////////////////////
78
79/* $Id$ */
80
81void MakePlot(Int_t run1,Int_t run2,TString ntupleFileName){
82 // Check run range
83 if(run1>=run2){
84 printf("****** ERROR: invalid run range %d - %d\n",run1,run2);
85 return;
86 }
87
88 TFile* fil=new TFile(ntupleFileName.Data(),"read");
89 if(!fil){
90 printf("File with ntuple does not exist\n");
91 return;
92 }
93 TNtuple* ntsdd=(TNtuple*)fil->Get("ntsdd");
94
95 Float_t nrun;
96 Float_t meanTrPts3,errmeanTrPts3,meanTrPts4,errmeanTrPts4;
97 Float_t minDrTime,errminDrTime,meanDrTime,errmeanDrTime;
98 Float_t fracTrackWithClu1,fracTrackWithClu2,errfracTrackWithClu1,errfracTrackWithClu2;
99 Float_t fracTrackWithClu3,fracTrackWithClu4,errfracTrackWithClu3,errfracTrackWithClu4;
100 Float_t fracTrackWithClu5,fracTrackWithClu6,errfracTrackWithClu5,errfracTrackWithClu6;
101 Float_t fracExtra,errfracExtra;
102 Float_t meandEdxLay3,errmeandEdxLay3,meandEdxLay4,errmeandEdxLay4;
103 Float_t meandEdxTB0,errmeandEdxTB0,meandEdxTB5,errmeandEdxTB5;
104 Float_t MPVdEdxLay3,errMPVdEdxLay3,MPVdEdxLay4,errMPVdEdxLay4;
105 Float_t MPVdEdxTB0,errMPVdEdxTB0,MPVdEdxTB5,errMPVdEdxTB5;
106 Float_t nMod95,nMod80,nMod60,nModEmpty;
107
108 ntsdd->SetBranchAddress("nrun",&nrun);
109 ntsdd->SetBranchAddress("fracTrackWithClu1",&fracTrackWithClu1);
110 ntsdd->SetBranchAddress("errfracTrackWithClu1",&errfracTrackWithClu1);
111 ntsdd->SetBranchAddress("fracTrackWithClu2",&fracTrackWithClu2);
112 ntsdd->SetBranchAddress("errfracTrackWithClu2",&errfracTrackWithClu2);
113 ntsdd->SetBranchAddress("fracTrackWithClu3",&fracTrackWithClu3);
114 ntsdd->SetBranchAddress("errfracTrackWithClu3",&errfracTrackWithClu3);
115 ntsdd->SetBranchAddress("fracTrackWithClu4",&fracTrackWithClu4);
116 ntsdd->SetBranchAddress("errfracTrackWithClu4",&errfracTrackWithClu4);
117 ntsdd->SetBranchAddress("fracTrackWithClu5",&fracTrackWithClu5);
118 ntsdd->SetBranchAddress("errfracTrackWithClu5",&errfracTrackWithClu5);
119 ntsdd->SetBranchAddress("fracTrackWithClu6",&fracTrackWithClu6);
120 ntsdd->SetBranchAddress("errfracTrackWithClu6",&errfracTrackWithClu6);
121 ntsdd->SetBranchAddress("nMod95",&nMod95);
122 ntsdd->SetBranchAddress("nMod80",&nMod80);
123 ntsdd->SetBranchAddress("nMod60",&nMod60);
124 ntsdd->SetBranchAddress("nModEmpty",&nModEmpty);
125
126 ntsdd->SetBranchAddress("meanTrPts3",&meanTrPts3);
127 ntsdd->SetBranchAddress("errmeanTrPts3",&errmeanTrPts3);
128 ntsdd->SetBranchAddress("meanTrPts4",&meanTrPts4);
129 ntsdd->SetBranchAddress("errmeanTrPts4",&errmeanTrPts4);
130 ntsdd->SetBranchAddress("minDrTime",&minDrTime);
131 ntsdd->SetBranchAddress("errminDrTime",&errminDrTime);
132 ntsdd->SetBranchAddress("meanDrTime",&meanDrTime);
133 ntsdd->SetBranchAddress("errmeanDrTime",&errmeanDrTime);
134 ntsdd->SetBranchAddress("fracExtra",&fracExtra);
135 ntsdd->SetBranchAddress("errfracExtra",&errfracExtra);
136 ntsdd->SetBranchAddress("meandEdxTB0",&meandEdxTB0);
137 ntsdd->SetBranchAddress("errmeandEdxTB0",&errmeandEdxTB0);
138 ntsdd->SetBranchAddress("meandEdxTB5",&meandEdxTB5);
139 ntsdd->SetBranchAddress("errmeandEdxTB5",&errmeandEdxTB5);
140 ntsdd->SetBranchAddress("meandEdxLay3",&meandEdxLay3);
141 ntsdd->SetBranchAddress("errmeandEdxLay3",&errmeandEdxLay3);
142 ntsdd->SetBranchAddress("meandEdxLay4",&meandEdxLay4);
143 ntsdd->SetBranchAddress("errmeandEdxLay4",&errmeandEdxLay4);
144 ntsdd->SetBranchAddress("MPVdEdxTB0",&MPVdEdxTB0);
145 ntsdd->SetBranchAddress("errMPVdEdxTB0",&errMPVdEdxTB0);
146 ntsdd->SetBranchAddress("MPVdEdxTB5",&MPVdEdxTB5);
147 ntsdd->SetBranchAddress("errMPVdEdxTB5",&errMPVdEdxTB5);
148 ntsdd->SetBranchAddress("MPVdEdxLay3",&MPVdEdxLay3);
149 ntsdd->SetBranchAddress("errMPVdEdxLay3",&errMPVdEdxLay3);
150 ntsdd->SetBranchAddress("MPVdEdxLay4",&MPVdEdxLay4);
151 ntsdd->SetBranchAddress("errMPVdEdxLay4",&errMPVdEdxLay4);
152
153 // Sort entries according to run number in the chosen range
579b5046 154 Int_t nr=ntsdd->GetEntries();
155 Int_t *myIndex = new Int_t [nr];
156 Int_t *noRuns = new Int_t [nr];
579b5046 157 for(Int_t i=0; i<nr;i++){
579b5046 158 ntsdd->GetEvent(i);
159 Int_t intrun = static_cast<Int_t>(nrun+0.01);
28d5818f 160 noRuns[i]=intrun;
579b5046 161 }
28d5818f 162 printf("\n ======== PROCESSING SDD NTUPLE \n");
163 Int_t kRunsToPlot = RunsToPlot(run1,run2,nr,noRuns,myIndex);
579b5046 164
165 TH1F* histotrp3=new TH1F("histotrp3","",kRunsToPlot,0.,kRunsToPlot);
166 TH1F* histotrp4=new TH1F("histotrp4","",kRunsToPlot,0.,kRunsToPlot);
167 TH1F* histominTime=new TH1F("histominTime","",kRunsToPlot,0.,kRunsToPlot);
168 TH1F* histomeanTime=new TH1F("histomeanTime","",kRunsToPlot,0.,kRunsToPlot);
169 TH1F* histofracExtra=new TH1F("histofracExtra","",kRunsToPlot,0.,kRunsToPlot);
170 TH1F* histodEdxTB0=new TH1F("histodEdxTB0","",kRunsToPlot,0.,kRunsToPlot);
171 TH1F* histodEdxTB5=new TH1F("histodEdxTB5","",kRunsToPlot,0.,kRunsToPlot);
172 TH1F* histodEdxLay3=new TH1F("histodEdxLay3","",kRunsToPlot,0.,kRunsToPlot);
173 TH1F* histodEdxLay4=new TH1F("histodEdxLay4","",kRunsToPlot,0.,kRunsToPlot);
174 TH1F* histoTrackClu1=new TH1F("histoTrackClu1","",kRunsToPlot,0.,kRunsToPlot);
175 TH1F* histoTrackClu2=new TH1F("histoTrackClu2","",kRunsToPlot,0.,kRunsToPlot);
176 TH1F* histoTrackClu3=new TH1F("histoTrackClu3","",kRunsToPlot,0.,kRunsToPlot);
177 TH1F* histoTrackClu4=new TH1F("histoTrackClu4","",kRunsToPlot,0.,kRunsToPlot);
178 TH1F* histoTrackClu5=new TH1F("histoTrackClu5","",kRunsToPlot,0.,kRunsToPlot);
179 TH1F* histoTrackClu6=new TH1F("histoTrackClu6","",kRunsToPlot,0.,kRunsToPlot);
180
181 TH1F* histoNmodEffBelow95=new TH1F("histoNmodEffBelow95","",kRunsToPlot,0.,kRunsToPlot);
182 TH1F* histoNmodEffBelow80=new TH1F("histoNmodEffBelow80","",kRunsToPlot,0.,kRunsToPlot);
183 TH1F* histoNmodEffBelow60=new TH1F("histoNmodEffBelow60","",kRunsToPlot,0.,kRunsToPlot);
184 TH1F* histoNmodEmpty=new TH1F("histoNmodEmpty","",kRunsToPlot,0.,kRunsToPlot);
185
186 for(Int_t i=0; i<kRunsToPlot;i++){
187 ntsdd->GetEvent(myIndex[i]);
188 histoTrackClu1->SetBinContent(i+1,fracTrackWithClu1);
189 histoTrackClu1->SetBinError(i+1,errfracTrackWithClu1);
190 histoTrackClu1->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrun));
191 histoTrackClu2->SetBinContent(i+1,fracTrackWithClu2);
192 histoTrackClu2->SetBinError(i+1,errfracTrackWithClu2);
193 histoTrackClu2->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrun));
194 histoTrackClu3->SetBinContent(i+1,fracTrackWithClu3);
195 histoTrackClu3->SetBinError(i+1,errfracTrackWithClu3);
196 histoTrackClu3->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrun));
197 histoTrackClu4->SetBinContent(i+1,fracTrackWithClu4);
198 histoTrackClu4->SetBinError(i+1,errfracTrackWithClu4);
199 histoTrackClu4->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrun));
200 histoTrackClu5->SetBinContent(i+1,fracTrackWithClu5);
201 histoTrackClu5->SetBinError(i+1,errfracTrackWithClu5);
202 histoTrackClu5->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrun));
203 histoTrackClu6->SetBinContent(i+1,fracTrackWithClu6);
204 histoTrackClu6->SetBinError(i+1,errfracTrackWithClu6);
205 histoTrackClu6->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrun));
206 histominTime->SetBinContent(i+1,minDrTime);
207 histominTime->SetBinError(i+1,errminDrTime);
208 histominTime->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrun));
209 histomeanTime->SetBinContent(i+1,meanDrTime);
210 histomeanTime->SetBinError(i+1,errmeanDrTime);
211 histomeanTime->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrun));
212 histotrp3->SetBinContent(i+1,meanTrPts3);
213 histotrp3->SetBinError(i+1,errmeanTrPts3);
214 histotrp3->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrun));
215 histotrp4->SetBinContent(i+1,meanTrPts4);
216 histotrp4->SetBinError(i+1,errmeanTrPts3);
217 histotrp4->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrun));
218 histofracExtra->SetBinContent(i+1,fracExtra);
219 histofracExtra->SetBinError(i+1,errfracExtra);
220 histofracExtra->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrun));
221 histodEdxTB0->SetBinContent(i+1,MPVdEdxTB0);
222 histodEdxTB0->SetBinError(i+1,errMPVdEdxTB0);
223 histodEdxTB0->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrun));
224 histodEdxTB5->SetBinContent(i+1,MPVdEdxTB5);
225 histodEdxTB5->SetBinError(i+1,errMPVdEdxTB5);
226 histodEdxTB5->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrun));
227 histodEdxLay3->SetBinContent(i+1,MPVdEdxLay3);
228 histodEdxLay3->SetBinError(i+1,errMPVdEdxLay3);
229 histodEdxLay3->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrun));
230 histodEdxLay4->SetBinContent(i+1,MPVdEdxLay4);
231 histodEdxLay4->SetBinError(i+1,errMPVdEdxLay4);
232 histodEdxLay4->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrun));
233
234 histoNmodEffBelow95->SetBinContent(i+1,nMod95);
235 histoNmodEffBelow95->SetBinError(i+1,0.0000001);
236 histoNmodEffBelow95->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrun));
237 histoNmodEffBelow80->SetBinContent(i+1,nMod80);
238 histoNmodEffBelow80->SetBinError(i+1,0.0000001);
239 histoNmodEffBelow80->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrun));
240 histoNmodEffBelow60->SetBinContent(i+1,nMod60);
241 histoNmodEffBelow60->SetBinError(i+1,0.0000001);
242 histoNmodEffBelow60->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrun));
243 histoNmodEmpty->SetBinContent(i+1,nModEmpty);
244 histoNmodEmpty->SetBinError(i+1,0.000001);
245 histoNmodEmpty->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrun));
246 }
247
248
249 //---SSD
250
251 TNtuple* ntssd=(TNtuple*)fil->Get("ntssd");
252
253 Float_t nrunSSD, meandEdxLay5,errmeandEdxLay5,meandEdxLay6,errmeandEdxLay6;
254 Float_t MPVdEdxLay5,errMPVdEdxLay5,MPVdEdxLay6,errMPVdEdxLay6;
255 Float_t ChargeRatioL5,errChargeratioL5,ChargeRatioL6, errChargeratioL6, moduleOff;
256
257 ntssd->SetBranchAddress("nrun",&nrunSSD);
258 ntssd->SetBranchAddress("meandEdxLay5",&meandEdxLay5);
259 ntssd->SetBranchAddress("errmeandEdxLay5",&errmeandEdxLay5);
260 ntssd->SetBranchAddress("meandEdxLay6",&meandEdxLay6);
261 ntssd->SetBranchAddress("errmeandEdxLay6",&errmeandEdxLay6);
262 ntssd->SetBranchAddress("MPVdEdxLay5",&MPVdEdxLay5);
263 ntssd->SetBranchAddress("errMPVdEdxLay5",&errMPVdEdxLay5);
264 ntssd->SetBranchAddress("MPVdEdxLay6",&MPVdEdxLay6);
265 ntssd->SetBranchAddress("errMPVdEdxLay6",&errMPVdEdxLay6);
266 ntssd->SetBranchAddress("ChargeRatioL5",&ChargeRatioL5);
267 ntssd->SetBranchAddress("errChargeratioL5",&errChargeratioL5);
268 ntssd->SetBranchAddress("ChargeRatioL6",&ChargeRatioL6);
269 ntssd->SetBranchAddress("errChargeratioL6",&errChargeratioL6);
270 ntssd->SetBranchAddress("moduleOff",&moduleOff);
271
28d5818f 272 nr=ntssd->GetEntries();
273 delete []myIndex;
274 delete []noRuns;
275 myIndex = new Int_t [nr];
276 noRuns = new Int_t [nr];
277 for(Int_t i=0; i<nr;i++){
278 ntssd->GetEvent(i);
279 Int_t intrun = static_cast<Int_t>(nrunSSD+0.01);
280 noRuns[i]=intrun;
281 }
282 printf("\n ======== PROCESSING SSD NTUPLE \n");
283 kRunsToPlot = RunsToPlot(run1,run2,nr,noRuns,myIndex);
284
579b5046 285 TH1F* histodEdxLay5=new TH1F("histodEdxLay5","",kRunsToPlot,0.,kRunsToPlot);
286 TH1F* histodEdxLay6=new TH1F("histodEdxLay6","",kRunsToPlot,0.,kRunsToPlot);
287
288 TH1F* histoChargeRatioLay5=new TH1F("histoChargeRatioLay5","",kRunsToPlot,0.,kRunsToPlot);
289 TH1F* histoChargeRatioLay6=new TH1F("histoChargeRatioLay6","",kRunsToPlot,0.,kRunsToPlot);
290
291 TH1F* histoEmpty=new TH1F("histoEmpty","",kRunsToPlot,0.,kRunsToPlot);
292
293 for(Int_t i=0; i<kRunsToPlot;i++){
294
295 ntssd->GetEvent(myIndex[i]);
296
297 histodEdxLay5->SetBinContent(i+1,MPVdEdxLay5);
298 histodEdxLay5->SetBinError(i+1,errMPVdEdxLay5);
299 histodEdxLay5->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrunSSD));
300
301 histodEdxLay6->SetBinContent(i+1,MPVdEdxLay6);
302 histodEdxLay6->SetBinError(i+1,errMPVdEdxLay6);
303 histodEdxLay6->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrunSSD));
304
305 histoChargeRatioLay5->SetBinContent(i+1,ChargeRatioL5);
306 histoChargeRatioLay5->SetBinError(i+1,errChargeratioL5);
307 histoChargeRatioLay5->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrunSSD));
308
309 histoChargeRatioLay6->SetBinContent(i+1,ChargeRatioL6);
310 histoChargeRatioLay6->SetBinError(i+1,errChargeratioL6);
311 histoChargeRatioLay6->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrunSSD));
312
313 histoEmpty->SetBinContent(i+1,moduleOff);
314 histoEmpty->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrunSSD));
315
316 }
317
318 //Matching
319
320 TNtuple* ntmatching=(TNtuple*)fil->Get("ntmatching");
321
322 Float_t nrunMatch;
323 Float_t FracSPD1;
324 Float_t errFracSPD1;
325 Float_t FracSPD2;
326 Float_t errFracSPD2;
327 Float_t Eff6Pt02;
328 Float_t errEff6Pt02;
329 Float_t Eff6Pt1;
330 Float_t errEff6Pt1;
331 Float_t Eff6Pt10;
332 Float_t errEff6Pt10;
333 Float_t Eff5Pt02;
334 Float_t errEff5Pt02;
335 Float_t Eff5Pt1;
336 Float_t errEff5Pt1;
337 Float_t Eff5Pt10;
338 Float_t errEff5Pt10;
339 Float_t Eff4Pt02;
340 Float_t errEff4Pt02;
341 Float_t Eff4Pt1;
342 Float_t errEff4Pt1;
343 Float_t Eff4Pt10;
344 Float_t errEff4Pt10;
345 Float_t Eff3Pt02;
346 Float_t errEff3Pt02;
347 Float_t Eff3Pt1;
348 Float_t errEff3Pt1;
349 Float_t Eff3Pt10;
350 Float_t errEff3Pt10;
351 Float_t Eff2Pt02;
352 Float_t errEff2Pt02;
353 Float_t Eff2Pt1;
354 Float_t errEff2Pt1;
355 Float_t Eff2Pt10;
356 Float_t errEff2Pt10;
357 Float_t EffSPDPt02;
358 Float_t errEffSPDPt02;
359 Float_t EffSPDPt1;
360 Float_t errEffSPDPt1;
361 Float_t EffSPDPt10;
362 Float_t errEffSPDPt10;
363 Float_t EffoneSPDPt02;
364 Float_t errEffoneSPDPt02;
365 Float_t EffoneSPDPt1;
366 Float_t errEffoneSPDPt1;
367 Float_t EffoneSPDPt10;
368 Float_t errEffoneSPDPt10;
369 Float_t EffTOTPt02;
370 Float_t errEffTOTPt02;
371 Float_t EffTOTPt1;
372 Float_t errEffTOTPt1;
373 Float_t EffTOTPt10;
374 Float_t errEffTOTPt10;
375
376 ntmatching->SetBranchAddress("nrun",&nrunMatch);
377 // ntmatching->SetBranchAddress("nrunMatch",&nrunMatch);
378 ntmatching->SetBranchAddress("FracSPD1",&FracSPD1);
379 ntmatching->SetBranchAddress("errFracSPD1",&errFracSPD1);
380 ntmatching->SetBranchAddress("FracSPD2",&FracSPD2);
381 ntmatching->SetBranchAddress("errFracSPD2",&errFracSPD2);
382 ntmatching->SetBranchAddress("Eff6Pt02",&Eff6Pt02);
383 ntmatching->SetBranchAddress("errEff6Pt02",&errEff6Pt02);
384 ntmatching->SetBranchAddress("Eff6Pt1",&Eff6Pt1);
385 ntmatching->SetBranchAddress("errEff6Pt1",&errEff6Pt1);
386 ntmatching->SetBranchAddress("Eff6Pt10",&Eff6Pt10);
387 ntmatching->SetBranchAddress("errEff6Pt10",&errEff6Pt10);
388 ntmatching->SetBranchAddress("Eff5Pt02",&Eff5Pt02);
389 ntmatching->SetBranchAddress("errEff5Pt02",&errEff5Pt02);
390 ntmatching->SetBranchAddress("Eff5Pt1",&Eff5Pt1);
391 ntmatching->SetBranchAddress("errEff5Pt1",&errEff5Pt1);
392 ntmatching->SetBranchAddress("Eff5Pt10",&Eff5Pt10);
393 ntmatching->SetBranchAddress("errEff5Pt10",&errEff5Pt10);
394 ntmatching->SetBranchAddress("Eff4Pt02",&Eff4Pt02);
395 ntmatching->SetBranchAddress("errEff4Pt02",&errEff4Pt02);
396 ntmatching->SetBranchAddress("Eff4Pt1",&Eff4Pt1);
397 ntmatching->SetBranchAddress("errEff4Pt1",&errEff4Pt1);
398 ntmatching->SetBranchAddress("Eff4Pt10",&Eff4Pt10);
399 ntmatching->SetBranchAddress("errEff4Pt10",&errEff4Pt10);
400 ntmatching->SetBranchAddress("Eff3Pt02",&Eff3Pt02);
401 ntmatching->SetBranchAddress("errEff3Pt02",&errEff3Pt02);
402 ntmatching->SetBranchAddress("Eff3Pt1",&Eff3Pt1);
403 ntmatching->SetBranchAddress("errEff3Pt1",&errEff3Pt1);
404 ntmatching->SetBranchAddress("Eff3Pt10",&Eff3Pt10);
405 ntmatching->SetBranchAddress("errEff3Pt10",&errEff3Pt10);
406 ntmatching->SetBranchAddress("Eff2Pt02",&Eff2Pt02);
407 ntmatching->SetBranchAddress("errEff2Pt02",&errEff2Pt02);
408 ntmatching->SetBranchAddress("Eff2Pt1",&Eff2Pt1);
409 ntmatching->SetBranchAddress("errEff2Pt1",&errEff2Pt1);
410 ntmatching->SetBranchAddress("Eff2Pt10",&Eff2Pt10);
411 ntmatching->SetBranchAddress("errEff2Pt10",&errEff2Pt10);
412 ntmatching->SetBranchAddress("EffSPDPt02",&EffSPDPt02);
413 ntmatching->SetBranchAddress("errEffSPDPt02",&errEffSPDPt02);
414 ntmatching->SetBranchAddress("EffSPDPt1",&EffSPDPt1);
415 ntmatching->SetBranchAddress("errEffSPDPt1",&errEffSPDPt1);
416 ntmatching->SetBranchAddress("EffSPDPt10",&EffSPDPt10);
417 ntmatching->SetBranchAddress("errEffSPDPt10",&errEffSPDPt10);
418 ntmatching->SetBranchAddress("EffoneSPDPt02",&EffoneSPDPt02);
419 ntmatching->SetBranchAddress("errEffoneSPDPt02",&errEffoneSPDPt02);
420 ntmatching->SetBranchAddress("EffoneSPDPt1",&EffoneSPDPt1);
421 ntmatching->SetBranchAddress("errEffoneSPDPt1",&errEffoneSPDPt1);
422 ntmatching->SetBranchAddress("EffoneSPDPt10",&EffoneSPDPt10);
423 ntmatching->SetBranchAddress("errEffoneSPDPt10",&errEffoneSPDPt10);
424 ntmatching->SetBranchAddress("EffTOTPt02",&EffTOTPt02);
425 ntmatching->SetBranchAddress("errEffTOTPt02",&errEffTOTPt02);
426 ntmatching->SetBranchAddress("EffTOTPt1",&EffTOTPt1);
427 ntmatching->SetBranchAddress("errEffTOTPt1",&errEffTOTPt1);
428 ntmatching->SetBranchAddress("EffTOTPt10",&EffTOTPt10);
429 ntmatching->SetBranchAddress("errEffTOTPt10",&errEffTOTPt10);
430
28d5818f 431 nr=ntmatching->GetEntries();
432 delete []myIndex;
433 delete []noRuns;
434 myIndex = new Int_t [nr];
435 noRuns = new Int_t [nr];
436 for(Int_t i=0; i<nr;i++){
437 ntmatching->GetEvent(i);
438 Int_t intrun = static_cast<Int_t>(nrunMatch+0.01);
439 noRuns[i]=intrun;
440 }
441 printf("\n ======== PROCESSING NTMATCHING NTUPLE \n");
442 kRunsToPlot = RunsToPlot(run1,run2,nr,noRuns,myIndex);
579b5046 443
444 TH1F *hFracSPD1 = new TH1F("hFracSPD1","SPD inner; run number; Fraction of HSs",kRunsToPlot,0.,kRunsToPlot);
445 hFracSPD1->SetLineColor(kGreen+2);
446 hFracSPD1->SetMarkerColor(kGreen+2);
447 hFracSPD1->SetMarkerStyle(20);
448
449 TH1F *hFracSPD2 = new TH1F("hFracSPD2","SPD outer; run number; Fraction of HSs",kRunsToPlot,0.,kRunsToPlot);
450 hFracSPD2->SetLineColor(kYellow+2);
451 hFracSPD2->SetMarkerColor(kYellow+2);
452 hFracSPD2->SetMarkerStyle(20);
453
454 TH1F *hEffSPDPt02 = new TH1F("hEffSPDPt02","Efficiency - P_{T} = 0.2; run number; TPC+ITS / TPC",kRunsToPlot,0.,kRunsToPlot);
455 hEffSPDPt02->SetLineWidth(2);
456 hEffSPDPt02->SetLineColor(kAzure+1);
457 hEffSPDPt02->SetMarkerColor(kAzure+1);
458 hEffSPDPt02->SetMarkerStyle(20);
459
460 TH1F *hEffSPDPt1 = new TH1F("hEffSPDPt1","Efficiency; run number; TPC+ITS / TPC",kRunsToPlot,0.,kRunsToPlot);
461 hEffSPDPt1->SetLineWidth(2);
462 hEffSPDPt1->SetLineColor(kAzure+1);
463 hEffSPDPt1->SetMarkerColor(kAzure+1);
464 hEffSPDPt1->SetMarkerStyle(20);
465
466 TH1F *hEffSPDPt10 = new TH1F("hEffSPDPt10","Efficiency; run number; TPC+ITS / TPC",kRunsToPlot,0.,kRunsToPlot);
467 hEffSPDPt10->SetLineWidth(2);
468 hEffSPDPt10->SetLineColor(kAzure+1);
469 hEffSPDPt10->SetMarkerColor(kAzure+1);
470 hEffSPDPt10->SetMarkerStyle(20);
471
472 TH1F *hEffoneSPDPt02 = new TH1F("hEffoneSPDPt02","Efficiency; run number; TPC+ITS / TPC",kRunsToPlot,0.,kRunsToPlot);
473 hEffoneSPDPt02->SetLineWidth(2);
474 hEffoneSPDPt02->SetLineColor(kGray);
475 hEffoneSPDPt02->SetMarkerColor(kGray);
476 hEffoneSPDPt02->SetMarkerStyle(20);
477 TH1F *hEffoneSPDPt1 = new TH1F("hEffoneSPDPt1","Efficiency; run number; TPC+ITS / TPC",kRunsToPlot,0.,kRunsToPlot);
478 hEffoneSPDPt1->SetLineWidth(2);
479 hEffoneSPDPt1->SetLineColor(kGray);
480 hEffoneSPDPt1->SetMarkerColor(kGray);
481 hEffoneSPDPt1->SetMarkerStyle(20);
482 TH1F *hEffoneSPDPt10 = new TH1F("hEffoneSPDPt10","Efficiency; run number; TPC+ITS / TPC",kRunsToPlot,0.,kRunsToPlot);
483 hEffoneSPDPt10->SetLineWidth(2);
484 hEffoneSPDPt10->SetLineColor(kGray);
485 hEffoneSPDPt10->SetMarkerColor(kGray);
486 hEffoneSPDPt10->SetMarkerStyle(20);
487
488 TH1F *hEff2Pt02 = new TH1F("hEff2Pt02","Efficiency; run number; TPC+ITS / TPC",kRunsToPlot,0.,kRunsToPlot);
489 hEff2Pt02->SetLineWidth(2);
490 hEff2Pt02->SetLineColor(kViolet);
491 hEff2Pt02->SetMarkerColor(kViolet);
492 hEff2Pt02->SetMarkerStyle(20);
493 TH1F *hEff2Pt1 = new TH1F("hEff2Pt1","Efficiency; run number; TPC+ITS / TPC",kRunsToPlot,0.,kRunsToPlot);
494 hEff2Pt1->SetLineWidth(2);
495 hEff2Pt1->SetLineColor(kViolet);
496 hEff2Pt1->SetMarkerColor(kViolet);
497 hEff2Pt1->SetMarkerStyle(20);
498 TH1F *hEff2Pt10 = new TH1F("hEff2Pt10","Efficiency; run number; TPC+ITS / TPC",kRunsToPlot,0.,kRunsToPlot);
499 hEff2Pt10->SetLineWidth(2);
500 hEff2Pt10->SetLineColor(kViolet);
501 hEff2Pt10->SetMarkerColor(kViolet);
502 hEff2Pt10->SetMarkerStyle(20);
503
504 TH1F *hEff3Pt02 = new TH1F("hEff3Pt02","Efficiency; run number; TPC+ITS / TPC",kRunsToPlot,0.,kRunsToPlot);
505 hEff3Pt02->SetLineWidth(2);
506 hEff3Pt02->SetLineColor(6);
507 hEff3Pt02->SetMarkerColor(6);
508 hEff3Pt02->SetMarkerStyle(20);
509 TH1F *hEff3Pt1 = new TH1F("hEff3Pt1","Efficiency; run number; TPC+ITS / TPC",kRunsToPlot,0.,kRunsToPlot);
510 hEff3Pt1->SetLineWidth(2);
511 hEff3Pt1->SetLineColor(6);
512 hEff3Pt1->SetMarkerColor(6);
513 hEff3Pt1->SetMarkerStyle(20);
514 TH1F *hEff3Pt10 = new TH1F("hEff3Pt10","Efficiency; run number; TPC+ITS / TPC",kRunsToPlot,0.,kRunsToPlot);
515 hEff3Pt10->SetLineWidth(2);
516 hEff3Pt10->SetLineColor(6);
517 hEff3Pt10->SetMarkerColor(6);
518 hEff3Pt10->SetMarkerStyle(20);
519
520 TH1F *hEff4Pt02 = new TH1F("hEff4Pt02","Efficiency; run number; TPC+ITS / TPC",kRunsToPlot,0.,kRunsToPlot);
521 hEff4Pt02->SetLineWidth(2);
522 hEff4Pt02->SetLineColor(4);
523 hEff4Pt02->SetMarkerColor(4);
524 hEff4Pt02->SetMarkerStyle(20);
525 TH1F *hEff4Pt1 = new TH1F("hEff4Pt1","Efficiency; run number; TPC+ITS / TPC",kRunsToPlot,0.,kRunsToPlot);
526 hEff4Pt1->SetLineWidth(2);
527 hEff4Pt1->SetLineColor(4);
528 hEff4Pt1->SetMarkerColor(4);
529 hEff4Pt1->SetMarkerStyle(20);
530 TH1F *hEff4Pt10 = new TH1F("hEff4Pt10","Efficiency; run number; TPC+ITS / TPC",kRunsToPlot,0.,kRunsToPlot);
531 hEff4Pt10->SetLineWidth(2);
532 hEff4Pt10->SetLineColor(4);
533 hEff4Pt10->SetMarkerColor(4);
534 hEff4Pt10->SetMarkerStyle(20);
535
536 TH1F *hEff5Pt02 = new TH1F("hEff5Pt02","Efficiency; run number; TPC+ITS / TPC",kRunsToPlot,0.,kRunsToPlot);
537 hEff5Pt02->SetLineWidth(2);
538 hEff5Pt02->SetLineColor(3);
539 hEff5Pt02->SetMarkerColor(3);
540 hEff5Pt02->SetMarkerStyle(20);
541 TH1F *hEff5Pt1 = new TH1F("hEff5Pt1","Efficiency; run number; TPC+ITS / TPC",kRunsToPlot,0.,kRunsToPlot);
542 hEff5Pt1->SetLineWidth(2);
543 hEff5Pt1->SetLineColor(3);
544 hEff5Pt1->SetMarkerColor(3);
545 hEff5Pt1->SetMarkerStyle(20);
546 TH1F *hEff5Pt10 = new TH1F("hEff5Pt10","Efficiency; run number; TPC+ITS / TPC",kRunsToPlot,0.,kRunsToPlot);
547 hEff5Pt10->SetLineWidth(3);
548 hEff5Pt10->SetLineColor(3);
549 hEff5Pt10->SetMarkerColor(3);
550 hEff5Pt10->SetMarkerStyle(20);
551
552 TH1F *hEff6Pt02 = new TH1F("hEff6Pt02","Efficiency; run number; TPC+ITS / TPC",kRunsToPlot,0.,kRunsToPlot);
553 hEff6Pt02->SetLineWidth(2);
554 hEff6Pt02->SetLineColor(2);
555 hEff6Pt02->SetMarkerColor(2);
556 hEff6Pt02->SetMarkerStyle(20);
557 TH1F *hEff6Pt1 = new TH1F("hEff6Pt1","Efficiency; run number; TPC+ITS / TPC",kRunsToPlot,0.,kRunsToPlot);
558 hEff6Pt1->SetLineWidth(2);
559 hEff6Pt1->SetLineColor(2);
560 hEff6Pt1->SetMarkerColor(2);
561 hEff6Pt1->SetMarkerStyle(20);
562 TH1F *hEff6Pt10 = new TH1F("hEff6Pt10","Efficiency; run number; TPC+ITS / TPC",kRunsToPlot,0.,kRunsToPlot);
563 hEff6Pt10->SetLineWidth(2);
564 hEff6Pt10->SetLineColor(2);
565 hEff6Pt10->SetMarkerColor(2);
566 hEff6Pt10->SetMarkerStyle(20);
567
568
569 TH1F *hEffTOTPt02 = new TH1F("hEffTOTPt02","Efficiency; run number; TPC+ITS / TPC",kRunsToPlot,0.,kRunsToPlot);
570 hEffTOTPt02->SetLineWidth(2);
571 hEffTOTPt02->SetLineColor(kBlue+2);
572 hEffTOTPt02->SetMarkerColor(kBlue+2);
573 hEffTOTPt02->SetMarkerStyle(20);
574 TH1F *hEffTOTPt1 = new TH1F("hEffTOTPt1","Efficiency; run number; TPC+ITS / TPC",kRunsToPlot,0.,kRunsToPlot);
575 hEffTOTPt1->SetLineWidth(2);
576 hEffTOTPt1->SetLineColor(kBlue+2);
577 hEffTOTPt1->SetMarkerColor(kBlue+2);
578 hEffTOTPt1->SetMarkerStyle(20);
579 TH1F *hEffTOTPt10 = new TH1F("hEffTOTPt10","Efficiency; run number; TPC+ITS / TPC",kRunsToPlot,0.,kRunsToPlot);
580 hEffTOTPt10->SetLineWidth(2);
581 hEffTOTPt10->SetLineColor(kBlue+2);
582 hEffTOTPt10->SetMarkerColor(kBlue+2);
583 hEffTOTPt10->SetMarkerStyle(20);
584
585 // Int_t nEntriesMatch=ntmatching->GetEntries();
586
587 for(Int_t i=0;i<kRunsToPlot;i++){
588
589 ntmatching->GetEvent(myIndex[i]);
590 // Int_t bin=nrunMatch;
591
592 // fill histos
593 // cout<<i<<") "<<"Index= "<<myIndex[i]<<" nrun= "<<nrunMatch<<", FracSPD1= "<<FracSPD1<<", FracSPD2"<<FracSPD2<<endl;
594 hFracSPD1->SetBinContent(i+1,FracSPD1);
595 hFracSPD1->SetBinError(i+1,.01);
596 hFracSPD1->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrunMatch));
597
598 // cout<<FracSPD1<<endl;
599
600 hFracSPD2->SetBinContent(i+1,FracSPD2);
601 hFracSPD2->SetBinError(i+1,.01);
602 hFracSPD2->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrunMatch));
603
604 // cout<<FracSPD2<<endl;
605
606 //-------------------------
607
608 hEff6Pt02->SetBinContent(i+1,Eff6Pt02);
609 hEff6Pt02->SetBinError(i+1,errEff6Pt02);
610 hEff6Pt02->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrunMatch));
611
612 hEff6Pt1->SetBinContent(i+1,Eff6Pt1);
613 hEff6Pt1->SetBinError(i+1,errEff6Pt1);
614 hEff6Pt1->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrunMatch));
615
616 hEff6Pt10->SetBinContent(i+1,Eff6Pt10);
617 hEff6Pt10->SetBinError(i+1,errEff6Pt10);
618 hEff6Pt10->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrunMatch));
619
620 hEff5Pt02->SetBinContent(i+1,Eff5Pt02);
621 hEff5Pt02->SetBinError(i+1,errEff5Pt02);
622 hEff5Pt02->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrunMatch));
623
624 hEff5Pt1->SetBinContent(i+1,Eff5Pt1);
625 hEff5Pt1->SetBinError(i+1,errEff5Pt1);
626 hEff5Pt1->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrunMatch));
627
628 hEff5Pt10->SetBinContent(i+1,Eff5Pt10);
629 hEff5Pt10->SetBinError(i+1,errEff5Pt10);
630 hEff5Pt10->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrunMatch));
631
632 hEff4Pt02->SetBinContent(i+1,Eff4Pt02);
633 hEff4Pt02->SetBinError(i+1,errEff4Pt1);
634 hEff4Pt02->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrunMatch));
635
636 hEff4Pt1->SetBinContent(i+1,Eff4Pt1);
637 hEff4Pt1->SetBinError(i+1,errEff4Pt1);
638 hEff4Pt1->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrunMatch));
639
640 hEff4Pt10->SetBinContent(i+1,Eff4Pt10);
641 hEff4Pt10->SetBinError(i+1,errEff4Pt10);
642 hEff4Pt10->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrunMatch));
643
644 hEff3Pt02->SetBinContent(i+1,Eff3Pt02);
645 hEff3Pt02->SetBinError(i+1,errEff3Pt02);
646 hEff3Pt02->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrunMatch));
647
648 hEff3Pt1->SetBinContent(i+1,Eff3Pt1);
649 hEff3Pt1->SetBinError(i+1,errEff3Pt1);
650 hEff3Pt1->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrunMatch));
651
652 hEff3Pt10->SetBinContent(i+1,Eff3Pt10);
653 hEff3Pt10->SetBinError(i+1,errEff3Pt10);
654 hEff3Pt10->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrunMatch));
655
656 hEff2Pt02->SetBinContent(i+1,Eff2Pt02);
657 hEff2Pt02->SetBinError(i+1,errEff2Pt02);
658 hEff2Pt02->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrunMatch));
659
660 hEff2Pt1->SetBinContent(i+1,Eff2Pt1);
661 hEff2Pt1->SetBinError(i+1,errEff2Pt1);
662 hEff2Pt1->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrunMatch));
663
664 hEff2Pt10->SetBinContent(i+1,Eff2Pt10);
665 hEff2Pt10->SetBinError(i+1,errEff2Pt10);
666 hEff2Pt10->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrunMatch));
667
668
669 hEffSPDPt02->SetBinContent(i+1,EffSPDPt02);
670 hEffSPDPt02->SetBinError(i+1,errEffSPDPt02);
671 hEffSPDPt02->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrunMatch));
672
673 hEffSPDPt1->SetBinContent(i+1,EffSPDPt1);
674 hEffSPDPt1->SetBinError(i+1,errEffSPDPt1);
675 hEffSPDPt1->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrunMatch));
676
677 hEffSPDPt10->SetBinContent(i+1,EffSPDPt10);
678 hEffSPDPt10->SetBinError(i+1,errEffSPDPt10);
679 hEffSPDPt10->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrunMatch));
680
681 hEffoneSPDPt02->SetBinContent(i+1,EffoneSPDPt02);
682 hEffoneSPDPt02->SetBinError(i+1,errEffoneSPDPt02);
683 hEffoneSPDPt02->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrunMatch));
684
685 hEffoneSPDPt1->SetBinContent(i+1,EffoneSPDPt1);
686 hEffoneSPDPt1->SetBinError(i+1,errEffoneSPDPt1);
687 hEffoneSPDPt1->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrunMatch));
688
689 hEffoneSPDPt10->SetBinContent(i+1,EffoneSPDPt10);
690 hEffoneSPDPt10->SetBinError(i+1,errEffoneSPDPt10);
691 hEffoneSPDPt10->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrunMatch));
692
693 hEffTOTPt02->SetBinContent(i+1,EffTOTPt02);
694 hEffTOTPt02->SetBinError(i+1,errEffTOTPt02);
695 hEffTOTPt02->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrunMatch));
696
697 hEffTOTPt1->SetBinContent(i+1,EffTOTPt1);
698 hEffTOTPt1->SetBinError(i+1,errEffTOTPt1);
699 hEffTOTPt1->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrunMatch));
700
701 hEffTOTPt10->SetBinContent(i+1,EffTOTPt10);
702 hEffTOTPt10->SetBinError(i+1,errEffTOTPt10);
703 hEffTOTPt10->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrunMatch));
704
705 }
706
707 //-----------------------------------
708
709 //---vertex
710
711 TNtuple* ntvertex=(TNtuple*)fil->Get("ntvertex");
712
713 Float_t nrunVertex,Vx,errVx,sigmaVx,errsigmaVx,Vy,errVy,sigmaVy,errsigmaVy,Vz,errVz,sigmaVz,errsigmaVz,VxSPD,errVxSPD,sigmaVxSPD,errsigmaVxSPD,VySPD,errVySPD,sigmaVySPD,errsigmaVySPD,VzSPD,errVzSPD,sigmaVzSPD,errsigmaVzSPD;
714
715 ntvertex->SetBranchAddress("nrun",&nrunVertex);
716 ntvertex->SetBranchAddress("VxTRK",&Vx);
717 ntvertex->SetBranchAddress("errVxTRK",&errVx);
718 ntvertex->SetBranchAddress("sigmaVxTRK",&sigmaVx);
719 ntvertex->SetBranchAddress("errsigmaVxTRK",&errsigmaVx);
720 ntvertex->SetBranchAddress("VyTRK",&Vy);
721 ntvertex->SetBranchAddress("errVyTRK",&errVy);
722 ntvertex->SetBranchAddress("sigmaVyTRK",&sigmaVy);
723 ntvertex->SetBranchAddress("errsigmaVyTRK",&errsigmaVy);
724 ntvertex->SetBranchAddress("VzTRK",&Vz);
725 ntvertex->SetBranchAddress("errVzTRK",&errVz);
726 ntvertex->SetBranchAddress("sigmaVzTRK",&sigmaVz);
727 ntvertex->SetBranchAddress("errsigmaVzTRK",&errsigmaVz);
728 ntvertex->SetBranchAddress("VxSPD",&VxSPD);
729 ntvertex->SetBranchAddress("errVxSPD",&errVxSPD);
730 ntvertex->SetBranchAddress("sigmaVxSPD",&sigmaVxSPD);
731 ntvertex->SetBranchAddress("errsigmaVxSPD",&errsigmaVxSPD);
732 ntvertex->SetBranchAddress("VySPD",&VySPD);
733 ntvertex->SetBranchAddress("errVySPD",&errVySPD);
734 ntvertex->SetBranchAddress("sigmaVySPD",&sigmaVySPD);
735 ntvertex->SetBranchAddress("errsigmaVySPD",&errsigmaVySPD);
736 ntvertex->SetBranchAddress("VzSPD",&VzSPD);
737 ntvertex->SetBranchAddress("errVzSPD",&errVzSPD);
738 ntvertex->SetBranchAddress("sigmaVzSPD",&sigmaVzSPD);
739 ntvertex->SetBranchAddress("errsigmaVzSPD",&errsigmaVzSPD);
740
28d5818f 741 nr=ntvertex->GetEntries();
742 delete []myIndex;
743 delete []noRuns;
744 myIndex = new Int_t [nr];
745 noRuns = new Int_t [nr];
746 for(Int_t i=0; i<nr;i++){
747 ntvertex->GetEvent(i);
748 Int_t intrun = static_cast<Int_t>(nrunVertex+0.01);
749 noRuns[i]=intrun;
750 }
751 printf("\n ======== PROCESSING VERTEX NTUPLE \n");
752 kRunsToPlot = RunsToPlot(run1,run2,nr,noRuns,myIndex);
753
579b5046 754
755 TH1F *hVx = new TH1F("hVx","Track Vertex Vx Distribution",kRunsToPlot,0.,kRunsToPlot);
756 hVx->SetLineWidth(2);
757 hVx->SetLineColor(kBlue+2);
758 hVx->SetMarkerColor(kBlue+2);
759 hVx->SetMarkerStyle(20);
760
761 TH1F *hVy = new TH1F("hVy","Track Vertex Vy Distribution",kRunsToPlot,0.,kRunsToPlot);
762 hVy->SetLineWidth(2);
763 hVy->SetLineColor(kBlue+2);
764 hVy->SetMarkerColor(kBlue+2);
765 hVy->SetMarkerStyle(20);
766
767 TH1F *hVz = new TH1F("hVz","Track Vertex Vz Distribution",kRunsToPlot,0.,kRunsToPlot);
768 hVz->SetLineWidth(2);
769 hVz->SetLineColor(kBlue+2);
770 hVz->SetMarkerColor(kBlue+2);
771 hVz->SetMarkerStyle(20);
772
773 TH1F *hSigmaVx = new TH1F("hSigmaVx","Track Vertex SigmaVx Distribution",kRunsToPlot,0.,kRunsToPlot);
774 hSigmaVx->SetLineWidth(2);
775 hSigmaVx->SetLineColor(kBlue+2);
776 hSigmaVx->SetMarkerColor(kBlue+2);
777 hSigmaVx->SetMarkerStyle(20);
778
779 TH1F *hSigmaVy = new TH1F("hSigmaVy","Track Vertex SigmaVy Distribution",kRunsToPlot,0.,kRunsToPlot);
780 hSigmaVy->SetLineWidth(2);
781 hSigmaVy->SetLineColor(kBlue+2);
782 hSigmaVy->SetMarkerColor(kBlue+2);
783 hSigmaVy->SetMarkerStyle(20);
784
785 TH1F *hSigmaVz = new TH1F("hSigmaVz","Track Vertex SigmaVz Distribution",kRunsToPlot,0.,kRunsToPlot);
786 hSigmaVz->SetLineWidth(2);
787 hSigmaVz->SetLineColor(kBlue+2);
788 hSigmaVz->SetMarkerColor(kBlue+2);
789 hSigmaVz->SetMarkerStyle(20);
790
791 TH1F *hVxSPD = new TH1F("hVxSPD","Track Vertex Vx Distribution",kRunsToPlot,0.,kRunsToPlot);
792 hVxSPD->SetLineWidth(2);
793 hVxSPD->SetLineColor(2);
794 hVxSPD->SetMarkerColor(2);
795 hVxSPD->SetMarkerStyle(20);
796
797 TH1F *hVySPD = new TH1F("hVySPD","Track Vertex Vy Distribution",kRunsToPlot,0.,kRunsToPlot);
798 hVySPD->SetLineWidth(2);
799 hVySPD->SetLineColor(2);
800 hVySPD->SetMarkerColor(2);
801 hVySPD->SetMarkerStyle(20);
802
803 TH1F *hVzSPD = new TH1F("hVzSPD","Track Vertex Vz Distribution",kRunsToPlot,0.,kRunsToPlot);
804 hVzSPD->SetLineWidth(2);
805 hVzSPD->SetLineColor(2);
806 hVzSPD->SetMarkerColor(2);
807 hVzSPD->SetMarkerStyle(20);
808
809 TH1F *hSigmaVxSPD = new TH1F("hSigmaVxSPD","Track Vertex SigmaVx Distribution",kRunsToPlot,0.,kRunsToPlot);
810 hSigmaVxSPD->SetLineWidth(2);
811 hSigmaVxSPD->SetLineColor(2);
812 hSigmaVxSPD->SetMarkerColor(2);
813 hSigmaVxSPD->SetMarkerStyle(20);
814
815 TH1F *hSigmaVySPD = new TH1F("hSigmaVySPD","Track Vertex SigmaVy Distribution",kRunsToPlot,0.,kRunsToPlot);
816 hSigmaVySPD->SetLineWidth(2);
817 hSigmaVySPD->SetLineColor(2);
818 hSigmaVySPD->SetMarkerColor(2);
819 hSigmaVySPD->SetMarkerStyle(20);
820
821 TH1F *hSigmaVzSPD = new TH1F("hSigmaVzSPD","Track Vertex SigmaVz Distribution",kRunsToPlot,0.,kRunsToPlot);
822 hSigmaVzSPD->SetLineWidth(2);
823 hSigmaVzSPD->SetLineColor(2);
824 hSigmaVzSPD->SetMarkerColor(2);
825 hSigmaVzSPD->SetMarkerStyle(20);
826
827
828 // Int_t nEntriesVertex=ntvertex->GetEntries();
829
830 for(Int_t i=0;i<kRunsToPlot;i++){
831
832 ntvertex->GetEvent(myIndex[i]);
833
834 // cout<<Vx<<endl;
835
836 hVx->SetBinContent(i+1,Vx);
837 hVx->SetBinError(i+1,errVx);
838 hVx->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrunVertex));
839
840 hVy->SetBinContent(i+1,Vy);
841 hVy->SetBinError(i+1,errVy);
842 hVy->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrunVertex));
843
844 hVz->SetBinContent(i+1,Vz);
845 hVz->SetBinError(i+1,errVz);
846 hVz->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrunVertex));
847
848
849 hSigmaVx->SetBinContent(i+1,sigmaVx);
850 hSigmaVx->SetBinError(i+1,errsigmaVx);
851 hSigmaVx->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrunVertex));
852
853 hSigmaVy->SetBinContent(i+1,sigmaVy);
854 hSigmaVy->SetBinError(i+1,errsigmaVy);
855 hSigmaVy->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrunVertex));
856
857 hSigmaVz->SetBinContent(i+1,sigmaVz);
858 hSigmaVz->SetBinError(i+1,errsigmaVz);
859 hSigmaVz->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrunVertex));
860
861 hVxSPD->SetBinContent(i+1,VxSPD);
862 hVxSPD->SetBinError(i+1,errVxSPD);
863 hVxSPD->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrunVertex));
864
865 hVySPD->SetBinContent(i+1,VySPD);
866 hVySPD->SetBinError(i+1,errVySPD);
867 hVySPD->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrunVertex));
868
869 hVzSPD->SetBinContent(i+1,VzSPD);
870 hVzSPD->SetBinError(i+1,errVzSPD);
871 hVzSPD->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrunVertex));
872
873
874 hSigmaVxSPD->SetBinContent(i+1,sigmaVxSPD);
875 hSigmaVxSPD->SetBinError(i+1,errsigmaVxSPD);
876 hSigmaVxSPD->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrunVertex));
877
878 hSigmaVySPD->SetBinContent(i+1,sigmaVySPD);
879 hSigmaVySPD->SetBinError(i+1,errsigmaVySPD);
880 hSigmaVySPD->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrunVertex));
881
882 hSigmaVzSPD->SetBinContent(i+1,sigmaVzSPD);
883 hSigmaVzSPD->SetBinError(i+1,errsigmaVzSPD);
884 hSigmaVzSPD->GetXaxis()->SetBinLabel(i+1,Form("%d",(Int_t)nrunVertex));
885
886 }
887 //-------- Draw Vertex histograms ---------
888 TCanvas *cVertexDisto=new TCanvas("cVertexDisto","cVertexDisto",1200,800);
889 cVertexDisto->Divide(3,2);
890 cVertexDisto->cd(1);
891 // hVx->SetMinimum(0.03);
892// hVx->SetMaximum(0.08);
893 hVx->GetYaxis()->SetTitle("Vertex X coordinate");
894 hVx->Draw();
895 hVxSPD->Draw("same");
896 cVertexDisto->cd(2);
897// hVy->SetMinimum(0.25);
898// hVy->SetMaximum(0.30);
899 hVy->GetYaxis()->SetTitle("Vertex Y coordinate");
900 hVy->Draw();
901 hVySPD->Draw("same");
902 cVertexDisto->cd(3);
903// hVz->SetMinimum(-1.);
904// hVz->SetMaximum(1.);
905 hVz->GetYaxis()->SetTitle("Vertex Z coordinate");
906 hVz->Draw();
907 hVzSPD->Draw("same");
908 cVertexDisto->cd(4);
909// hSigmaVx->SetMinimum(0.);
910// hSigmaVx->SetMaximum(0.01);
911 hSigmaVx->GetYaxis()->SetTitle("sigma on x coordinate");
912 hSigmaVx->Draw();
913 hSigmaVxSPD->Draw("same");
914 cVertexDisto->cd(5);
915// hSigmaVy->SetMinimum(0.);
916// hSigmaVy->SetMaximum(0.01);
917 hSigmaVy->GetYaxis()->SetTitle("sigma on y coordinate");
918 hSigmaVy->Draw();
919 hSigmaVySPD->Draw("same");
920 cVertexDisto->cd(6);
921// hSigmaVz->SetMinimum(6.);
922// hSigmaVz->SetMaximum(10.);
923 hSigmaVz->GetYaxis()->SetTitle("sigma on z coordinate");
924 hSigmaVz->Draw();
925 hSigmaVzSPD->Draw("same");
926 cVertexDisto->SaveAs("Vertex_trend.pdf");
927 pdfFileNames+=" Vertex_trend.pdf";
928 //-----------------------------------
929
930 gStyle->SetOptStat(0);
931
932 TCanvas* c5=new TCanvas("c5","Track With points in ITS");
933 histoTrackClu3->Draw();
934 histoTrackClu3->SetLineColor(1);
935 histoTrackClu3->SetMarkerStyle(20);
936 histoTrackClu3->Draw();
937 histoTrackClu3->SetMinimum(0.);
938 histoTrackClu3->SetMaximum(1.05);
939 histoTrackClu4->SetLineColor(2);
940 histoTrackClu4->SetMarkerColor(2);
941 histoTrackClu4->SetMarkerStyle(22);
942 histoTrackClu4->Draw("same");
943 histoTrackClu1->SetLineColor(kGray+1);
944 histoTrackClu1->SetMarkerColor(kGray+1);
945 histoTrackClu1->SetMarkerStyle(24);
946 histoTrackClu1->Draw("same");
947 histoTrackClu2->SetLineColor(kGray+2);
948 histoTrackClu2->SetMarkerColor(kGray+2);
949 histoTrackClu2->SetMarkerStyle(26);
950 histoTrackClu2->Draw("same");
951 histoTrackClu5->SetLineColor(4);
952 histoTrackClu5->SetMarkerColor(4);
953 histoTrackClu5->SetMarkerStyle(29);
954 histoTrackClu5->Draw("same");
955 histoTrackClu6->SetLineColor(kBlue+1);
956 histoTrackClu6->SetMarkerColor(kBlue+1);
957 histoTrackClu6->SetMarkerStyle(30);
958 histoTrackClu6->SetTitle("Fraction of tracks with points in ITS");
959 histoTrackClu6->Draw("same");
960 histoTrackClu3->GetYaxis()->SetTitle("Fraction of Tracks with Points in ITS Layers");
961 TLegend* leg3=new TLegend(0.7,0.15,0.88,0.35);
962 TLegendEntry* ent;
963 ent=leg3->AddEntry(histoTrackClu1,"Layer1","PL");
964 ent->SetTextColor(histoTrackClu1->GetMarkerColor());
965 ent=leg3->AddEntry(histoTrackClu2,"Layer2","PL");
966 ent->SetTextColor(histoTrackClu2->GetMarkerColor());
967 ent=leg3->AddEntry(histoTrackClu3,"Layer3","PL");
968 ent->SetTextColor(histoTrackClu3->GetMarkerColor());
969 ent=leg3->AddEntry(histoTrackClu4,"Layer4","PL");
970 ent->SetTextColor(histoTrackClu4->GetMarkerColor());
971 ent=leg3->AddEntry(histoTrackClu5,"Layer5","PL");
972 ent->SetTextColor(histoTrackClu5->GetMarkerColor());
973 ent=leg3->AddEntry(histoTrackClu6,"Layer6","PL");
974 ent->SetTextColor(histoTrackClu6->GetMarkerColor());
975
976 leg3->SetFillStyle(0);
977 leg3->Draw();
978 c5->SaveAs("TrackPoints_trend.pdf");
979 pdfFileNames+=" TrackPoints_trend.pdf";
980 c5->Update();
981
982
983
984 TCanvas* c2=new TCanvas("c2","SDD DriftTime & Charge",1200,800);
985 c2->Divide(2,2);
986 c2->cd(1);
987 histominTime->Draw();
988 histominTime->SetMinimum(450);
989 histominTime->SetMaximum(550);
990 histominTime->GetYaxis()->SetTitle("Minimum Drift Time (ns)");
991 TLatex* td1=new TLatex(0.2,0.85,"SDD minimum drift time (ref=505ns)");
992 td1->SetNDC();
993 td1->SetTextColor(1);
994 td1->Draw();
995 c2->cd(2);
996 histomeanTime->Draw();
997 histomeanTime->SetMinimum(3200);
998 histomeanTime->SetMaximum(3300);
999 histomeanTime->GetYaxis()->SetTitle("Average Drift Time (ns)");
1000 TLatex* td2=new TLatex(0.2,0.85,"SDD average drift time");
1001 td2->SetNDC();
1002 // td2>SetTextColor(1);
1003 td2->Draw();
1004
1005 // TCanvas* c4=new TCanvas("c4","Charge");
1006 c2->cd(3);
1007 gPad->SetGridy();
1008 histodEdxTB0->SetLineColor(1);
1009 histodEdxTB0->SetMarkerStyle(20);
1010 histodEdxTB0->Draw();
1011 histodEdxTB0->SetMinimum(70.);
1012 histodEdxTB0->SetMaximum(100.);
1013 histodEdxTB5->SetLineColor(4);
1014 histodEdxTB5->SetMarkerColor(4);
1015 histodEdxTB5->SetMarkerStyle(23);
1016 // histodEdxTB5->SetMinimum(90);
1017 // histodEdxTB5->SetMaximum(120);
1018 histodEdxTB5->Draw("same");
1019 histodEdxTB0->GetYaxis()->SetTitle("MPV of dE/dx (keV/300 #mum)");
1020 TLegend* leg2=new TLegend(0.6,0.15,0.88,0.35);
1021 ent=leg2->AddEntry(histodEdxTB0,"Small drift time","PL");
1022 ent=leg2->AddEntry(histodEdxTB5,"Large drift time","PL");
1023 ent->SetTextColor(histodEdxTB5->GetMarkerColor());
1024 leg2->SetFillStyle(0);
1025 leg2->Draw();
1026 TLatex* tc1=new TLatex(0.2,0.85,"SDD charge in different drift regions");
1027 tc1->SetNDC();
1028 tc1->SetTextColor(1);
1029 tc1->Draw();
1030 // TCanvas* c4b=new TCanvas("c4b","Charge per Layer");
1031 c2->cd(4);
1032 gPad->SetGridy();
1033 histodEdxLay3->SetLineColor(1);
1034 histodEdxLay3->SetMarkerStyle(20);
1035 histodEdxLay3->Draw();
1036 histodEdxLay3->SetMinimum(70.);
1037 histodEdxLay3->SetMaximum(100.);
1038 histodEdxLay4->SetLineColor(4);
1039 histodEdxLay4->SetMarkerColor(4);
1040 histodEdxLay4->SetMarkerStyle(23);
1041 histodEdxLay4->Draw("same");
1042
1043 histodEdxLay5->SetLineColor(6);
1044 histodEdxLay5->SetMarkerColor(6);
1045 histodEdxLay5->SetMarkerStyle(22);
1046 histodEdxLay5->Draw("same");
1047 histodEdxLay5->SetMinimum(0.);
1048 histodEdxLay6->SetLineColor(7);
1049 histodEdxLay6->SetMarkerColor(7);
1050 histodEdxLay6->SetMarkerStyle(24);
1051 histodEdxLay6->Draw("same");
1052
1053 histodEdxLay3->GetYaxis()->SetTitle("MPV of dE/dx (keV/300 #mum)");
1054
1055 TLegend* leg2b=new TLegend(0.6,0.15,0.88,0.35);
1056 ent=leg2b->AddEntry(histodEdxLay3,"Layer 3","PL");
1057 ent=leg2b->AddEntry(histodEdxLay4,"Layer 4","PL");
1058 ent=leg2b->AddEntry(histodEdxLay5,"Layer 5","PL");
1059 ent=leg2b->AddEntry(histodEdxLay6,"Layer 6","PL");
1060 ent->SetTextColor(histodEdxLay4->GetMarkerColor());
1061 leg2b->SetFillStyle(0);
1062 leg2b->Draw();
1063 // c4b->Update();
1064 TLatex* tc2=new TLatex(0.2,0.85,"SDD and SSD charge in different layers");
1065 tc2->SetNDC();
1066 tc2->SetTextColor(1);
1067 tc2->Draw();
1068 c2->SaveAs("SDD_SSD_drift_charge_trend.pdf");
1069 pdfFileNames+=" SDD_SSD_drift_charge_trend.pdf";
1070 c2->Update();
1071
1072 TCanvas *c7=new TCanvas("c7","Charge ratio");
1073 c7->cd();
1074 histoChargeRatioLay5->SetLineColor(6);
1075 histoChargeRatioLay5->SetMarkerColor(6);
1076 histoChargeRatioLay5->SetMarkerStyle(20);
1077 histoChargeRatioLay5->SetMinimum(-0.01);
1078 histoChargeRatioLay5->SetMaximum(+0.01);
1079 histoChargeRatioLay5->Draw();
1080 histoChargeRatioLay6->SetLineColor(7);
1081 histoChargeRatioLay6->SetMarkerColor(7);
1082 histoChargeRatioLay6->SetMarkerStyle(22);
1083 histoChargeRatioLay6->GetYaxis()->SetTitle("SSD charge ratio");
1084 histoChargeRatioLay6->Draw("same");
1085 TLegend* legCR=new TLegend(0.7,0.65,0.88,0.75);
1086 ent=legCR->AddEntry(histoChargeRatioLay5,"Layer5","PL");
1087 ent->SetTextColor(histoChargeRatioLay5->GetMarkerColor());
1088 ent=legCR->AddEntry(histoChargeRatioLay6,"Layer6","PL");
1089 ent->SetTextColor(histoChargeRatioLay6->GetMarkerColor());
1090 legCR->SetFillStyle(0);
1091 legCR->Draw();
1092 TLatex* tc3=new TLatex(0.2,0.85,"SSD charge ratio in different layers");
1093 tc3->SetNDC();
1094 tc3->SetTextColor(1);
1095 tc3->Draw();
1096 c7->SaveAs("SSD_chargeratio_trend.pdf");
1097 pdfFileNames+=" SSD_chargeratio_trend.pdf";
1098 // TCanvas *c8=new TCanvas("c8","Masked modules");
1099 // c8->cd();
1100 // histoEmpty->Draw();
1101
1102 TCanvas *cpt02=new TCanvas("cpt02","TPC-ITS matching efficiency",1200,1000);
1103 cpt02->Divide(2,2);
1104 cpt02->cd(1);
1105 hEff6Pt02->SetMinimum(0);
1106 hEff6Pt02->Draw();
1107 hEff5Pt02->Draw("same");
1108 hEff4Pt02->Draw("same");
1109 hEff3Pt02->Draw("same");
1110 hEff2Pt02->Draw("same");
1111 hEffSPDPt02->Draw("same");
1112 hEffoneSPDPt02->Draw("same");
1113 hEffTOTPt02->Draw("same");
1114 hEff6Pt02->GetYaxis()->SetRangeUser(0,1);
1115 TLegend* lpt02=new TLegend(0.9,0.8,1,1);
1116 lpt02->AddEntry(hEff6Pt02,"6 cls","l");
1117 lpt02->AddEntry(hEff5Pt02,"5 cls","l");
1118 lpt02->AddEntry(hEff4Pt02,"4 cls","l");
1119 lpt02->AddEntry(hEff3Pt02,"3 cls","l");
1120 lpt02->AddEntry(hEff2Pt02,"2 cls","l");
1121 lpt02->AddEntry(hEffSPDPt02,"2SPD + any","l");
1122 lpt02->AddEntry(hEffoneSPDPt02,">=1SPD + any","l");
1123 lpt02->AddEntry(hEffTOTPt02,">=2","l");
1124 lpt02->Draw("same");
1125 TLatex* tpc1=new TLatex(0.2,0.85,"TPCITS match eff Pt=0.2");
1126 tpc1->SetNDC();
1127 tpc1->SetTextColor(1);
1128 tpc1->Draw();
1129
1130 // TCanvas *cpt1=new TCanvas("cpt1","cpt1");
1131 // cpt1->cd(1);
1132 cpt02->cd(2);
1133
1134 hEff6Pt1->Draw();
1135 hEff5Pt1->Draw("same");
1136 hEff4Pt1->Draw("same");
1137 hEff3Pt1->Draw("same");
1138 hEff2Pt1->Draw("same");
1139 hEffSPDPt1->Draw("same");
1140 hEffoneSPDPt1->Draw("same");
1141 hEffTOTPt1->Draw("same");
1142 hEff6Pt1->GetYaxis()->SetRangeUser(0,1);
1143
1144 TLegend* lpt1=new TLegend(0.9,0.8,1,1);
1145 lpt1->AddEntry(hEff6Pt1,"6 cls","l");
1146 lpt1->AddEntry(hEff5Pt1,"5 cls","l");
1147 lpt1->AddEntry(hEff4Pt1,"4 cls","l");
1148 lpt1->AddEntry(hEff3Pt1,"3 cls","l");
1149 lpt1->AddEntry(hEff2Pt1,"2 cls","l");
1150 lpt1->AddEntry(hEffSPDPt1,"2SPD + any","l");
1151 lpt1->AddEntry(hEffoneSPDPt1,">=1SPD + any","l");
1152 lpt1->AddEntry(hEffTOTPt02,">=2","l");
1153 lpt1->Draw("same");
1154 TLatex* tpc2=new TLatex(0.2,0.75,"TPCITS match eff Pt=1");
1155 tpc2->SetNDC();
1156 tpc2->SetTextColor(1);
1157 tpc2->Draw();
1158
1159
1160 // TCanvas *cpt10=new TCanvas("cpt10","cpt10");
1161 cpt02->cd(3);
1162
1163 hEff6Pt10->Draw();
1164 hEff5Pt10->Draw("same");
1165 hEff4Pt10->Draw("same");
1166 hEff3Pt10->Draw("same");
1167 hEff2Pt10->Draw("same");
1168 hEffSPDPt10->Draw("same");
1169 hEffoneSPDPt10->Draw("same");
1170 hEffTOTPt10->Draw("same");
1171 hEff6Pt10->GetYaxis()->SetRangeUser(0,1);
1172
1173 TLegend* lpt10=new TLegend(0.9,0.8,1,1);
1174 lpt10->AddEntry(hEff6Pt10,"6 cls","l");
1175 lpt10->AddEntry(hEff5Pt10,"5 cls","l");
1176 lpt10->AddEntry(hEff4Pt10,"4 cls","l");
1177 lpt10->AddEntry(hEff3Pt10,"3 cls","l");
1178 lpt10->AddEntry(hEff2Pt10,"2 cls","l");
1179 lpt10->AddEntry(hEffSPDPt10,"2SPD + any","l");
1180 lpt10->AddEntry(hEffoneSPDPt10,">=1SPD + any","l");
1181 lpt10->AddEntry(hEffTOTPt02,">=2","l");
1182 lpt10->Draw("same");
1183
1184 TLatex* tpc3=new TLatex(0.2,0.75,"TPCITS match eff Pt=10");
1185 tpc3->SetNDC();
1186 tpc3->SetTextColor(1);
1187 tpc3->Draw();
1188
1189 cpt02->cd(4);
1190
1191
1192 // TCanvas *cSPD = new TCanvas("cSPD","cSPD",0,0,1000,300);
1193 // cSPD->SetGridy();
1194 hFracSPD1->SetMaximum(1.2);
1195 hFracSPD1->SetMinimum(0);
1196 hFracSPD1->Draw("p");
1197 hFracSPD2->Draw("same,p");
1198
1199 TLegend* lSPD=new TLegend(0.9,0.8,1,1);
1200 lSPD->AddEntry(hFracSPD1,"Frac. SPD1 ON","l");
1201 lSPD->AddEntry(hFracSPD2,"Frac. SPD2 ON","l");
1202 lSPD->Draw();
1203 TLatex* tSPD=new TLatex(0.2,0.85,"Fraction of SPD half staves ON");
1204 tSPD->SetNDC();
1205 tSPD->SetTextColor(1);
1206 tSPD->Draw();
1207 cpt02->SaveAs("TPCITS_trend.pdf");
1208 pdfFileNames+=" TPCITS_trend.pdf";
1209 cpt02->Update();
1210
1211 //----------- ITS SA -----------
28d5818f 1212 PlotITSSA(fil,run1,run2);
579b5046 1213 // merge the pdf files
1214 TString command("gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=merged");
1215 command=command+"ITS_trend.pdf "+pdfFileNames;
1216 gSystem->Exec(command.Data());
1217 printf(" Merging the pdf file: %s \n",command.Data());
1218 delete [] myIndex;
1219 delete [] noRuns;
1220}
1221
1222//____________________________________________________________________________
28d5818f 1223void PlotITSSA(TFile *fil, Int_t run1, Int_t run2){
579b5046 1224 Double_t Lowbin[3]={0.1,0.5,0.9};
1225 Double_t Upbin[3]={0.2,0.6,1};
1226 gROOT->SetStyle("Plain");
1227 gStyle->SetOptTitle(0);
1228 gStyle->SetOptStat(0);
1229 gStyle->SetFillColor(0);
1230 gStyle->SetTextFont(32);
1231
1232 TNtuple* nt = (TNtuple*)fil->Get("ntITSsa");
28d5818f 1233
579b5046 1234 Float_t ITSA[3];
1235 Float_t TPIT[3];
1236 Float_t RAT[3];
1237 Float_t run;
1238 nt->SetBranchAddress("run",&run);
1239 // nt->SetBranchAddress("NITSsaPtBin0",&ITSA[0]); //Pb-Pb
1240 // nt->SetBranchAddress("NITSsaPtBin1",&ITSA[1]); //Pb-Pb
1241 // nt->SetBranchAddress("NITSsaPtBin2",&ITSA[2]); //Pb-Pb
1242 nt->SetBranchAddress("NITSpureSAPtBin0",&ITSA[0]);
1243 nt->SetBranchAddress("NITSpureSAPtBin1",&ITSA[1]);
1244 nt->SetBranchAddress("NITSpureSAPtBin2",&ITSA[2]);
1245 nt->SetBranchAddress("NITSTPCPtBin0",&TPIT[0]);
1246 nt->SetBranchAddress("NITSTPCPtBin1",&TPIT[1]);
1247 nt->SetBranchAddress("NITSTPCPtBin2",&TPIT[2]);
1248 nt->SetBranchAddress("ratioPtBin0",&RAT[0]);
1249 nt->SetBranchAddress("ratioPtBin1",&RAT[1]);
1250 nt->SetBranchAddress("ratioPtBin2",&RAT[2]);
28d5818f 1251
1252 Int_t nr=nt->GetEntries();
1253 Int_t *myIndex = new Int_t [nr];
1254 Int_t *noRuns = new Int_t [nr];
1255 for(Int_t i=0; i<nr;i++){
1256 nt->GetEvent(i);
1257 Int_t intrun = static_cast<Int_t>(run+0.01);
1258 noRuns[i]=intrun;
1259 }
1260 printf("\n ======== PROCESSING ITS SA NTUPLE \n");
1261 Int_t kRunsToPlot = RunsToPlot(run1,run2,nr,noRuns,myIndex);
579b5046 1262 TH1F *h0=new TH1F("h0","h0",kRunsToPlot,-0.5,kRunsToPlot-0.5);
1263 TH1F *h1=new TH1F("h1","h1",kRunsToPlot,-0.5,kRunsToPlot-0.5);
1264 TH1F *h2=new TH1F("h2","h2",kRunsToPlot,-0.5,kRunsToPlot-0.5);
1265 TH1F *h3=new TH1F("h3","h4",kRunsToPlot,-0.5,kRunsToPlot-0.5);
1266 TH1F *h4=new TH1F("h4","h5",kRunsToPlot,-0.5,kRunsToPlot-0.5);
1267 TH1F *h5=new TH1F("h5","h5",kRunsToPlot,-0.5,kRunsToPlot-0.5);
1268 TH1F *h6=new TH1F("h6","h6",kRunsToPlot,-0.5,kRunsToPlot-0.5);
1269 TH1F *h7=new TH1F("h7","h7",kRunsToPlot,-0.5,kRunsToPlot-0.5);
1270 TH1F *h8=new TH1F("h8","h8",kRunsToPlot,-0.5,kRunsToPlot-0.5);
1271 for(Int_t iev=0;iev<kRunsToPlot;iev++){
1272 nt->GetEvent(myIndex[iev]);
1273 //cout<<"Numeri TPCITS "<<TPIT[0]<<" "<<TPIT[1]<<" "<<TPIT[2]<<endl;
1274 h0->Fill(iev,ITSA[0]);
1275 h1->Fill(iev,ITSA[1]);
1276 h2->Fill(iev,ITSA[2]);
1277 h3->Fill(iev,TPIT[0]);
1278 h4->Fill(iev,TPIT[1]);
1279 h5->Fill(iev,TPIT[2]);
1280 h6->Fill(iev,RAT[0]);
1281 h7->Fill(iev,RAT[1]);
1282 h8->Fill(iev,RAT[2]);
1283 h0->GetXaxis()->SetBinLabel(iev+1,Form("%.0f",run));
1284 h1->GetXaxis()->SetBinLabel(iev+1,Form("%.0f",run));
1285 h2->GetXaxis()->SetBinLabel(iev+1,Form("%.0f",run));
1286 h3->GetXaxis()->SetBinLabel(iev+1,Form("%.0f",run));
1287 h4->GetXaxis()->SetBinLabel(iev+1,Form("%.0f",run));
1288 h5->GetXaxis()->SetBinLabel(iev+1,Form("%.0f",run));
1289 h6->GetXaxis()->SetBinLabel(iev+1,Form("%.0f",run));
1290 h7->GetXaxis()->SetBinLabel(iev+1,Form("%.0f",run));
1291 h8->GetXaxis()->SetBinLabel(iev+1,Form("%.0f",run));
1292 // Printf("%f %f %f",ITSA[0],ITSA[1],ITSA[2]);
1293 }
1294 h0->Print("all");
1295 // h0->GetYaxis()->SetTitle("ITSsa tracks");
1296 // h0->GetXaxis()->SetTitle("run");
1297 // h1->GetYaxis()->SetTitle("ITSsa tracks");
1298 // h1->GetXaxis()->SetTitle("run");
1299 // h2->GetYaxis()->SetTitle("ITSsa tracks");
1300 // h2->GetXaxis()->SetTitle("run");
1301 h0->GetYaxis()->SetTitle("ITSpureSA tracks");
1302 h0->GetXaxis()->SetTitle("run");
1303 h1->GetYaxis()->SetTitle("ITSpureSA tracks");
1304 h1->GetXaxis()->SetTitle("run");
1305 h2->GetYaxis()->SetTitle("ITSpureSA tracks");
1306 h2->GetXaxis()->SetTitle("run");
1307 h3->GetYaxis()->SetTitle("ITS+TPC tracks");
1308 h3->GetXaxis()->SetTitle("run");
1309 h4->GetYaxis()->SetTitle("ITS+TPC tracks");
1310 h4->GetXaxis()->SetTitle("run");
1311 h5->GetYaxis()->SetTitle("ITS+TPC tracks");
1312 h5->GetXaxis()->SetTitle("run");
1313 // h6->GetYaxis()->SetTitle("(TPC+ITS)/ITS");
1314 // h6->GetXaxis()->SetTitle("run");
1315 // h7->GetYaxis()->SetTitle("(TPC+ITS)/ITS");
1316 // h7->GetXaxis()->SetTitle("run");
1317 // h8->GetYaxis()->SetTitle("(TPC+ITS)/ITS");
1318 // h8->GetXaxis()->SetTitle("run");
1319 h6->GetYaxis()->SetTitle("(TPC+ITS)+ITSsa/ITSpureSA");
1320 h6->GetXaxis()->SetTitle("run");
1321 h7->GetYaxis()->SetTitle("(TPC+ITS)+ITSsa/ITSpureSA");
1322 h7->GetXaxis()->SetTitle("run");
1323 h8->GetYaxis()->SetTitle("(TPC+ITS)+ITSsa/ITSpureSA");
1324 h8->GetXaxis()->SetTitle("run");
1325 h0->SetTitle(Form("%.1f GeV/c < pt < %.1f GeV/c",Lowbin[0],Upbin[0]));
1326 h1->SetTitle(Form("%.1f GeV/c < pt < %.1f GeV/c",Lowbin[1],Upbin[1]));
1327 h2->SetTitle(Form("%.1f GeV/c < pt < %.1f GeV/c",Lowbin[2],Upbin[2]));
1328 h3->SetTitle(Form("%.1f GeV/c < pt < %.1f GeV/c",Lowbin[0],Upbin[0]));
1329 h4->SetTitle(Form("%.1f GeV/c < pt < %.1f GeV/c",Lowbin[1],Upbin[1]));
1330 h5->SetTitle(Form("%.1f GeV/c < pt < %.1f GeV/c",Lowbin[2],Upbin[2]));
1331 h6->SetTitle(Form("%.1f GeV/c < pt < %.1f GeV/c",Lowbin[0],Upbin[0]));
1332 h7->SetTitle(Form("%.1f GeV/c < pt < %.1f GeV/c",Lowbin[1],Upbin[1]));
1333 h8->SetTitle(Form("%.1f GeV/c < pt < %.1f GeV/c",Lowbin[2],Upbin[2]));
1334 h0->SetMinimum(100);
1335// h0->SetMaximum(2);
1336 h1->SetMinimum(100);
1337// h1->SetMaximum(2);
1338 h2->SetMinimum(100);
1339// h2->SetMaximum(2);
1340 h3->SetMinimum(100);
1341 h4->SetMinimum(100);
1342 h5->SetMinimum(100);
1343
1344 h8->SetMinimum(0.);
1345 h8->SetMaximum(2.5);
1346
1347 h0->SetMarkerStyle(22);
1348 h1->SetMarkerStyle(23);
1349 h2->SetMarkerStyle(24);
1350 h0->SetMarkerColor(2);
1351 h1->SetMarkerColor(1);
1352 h2->SetMarkerColor(4);
1353 h0->SetLineColor(2);
1354 h1->SetLineColor(1);
1355 h2->SetLineColor(4);
1356
1357 h3->SetMarkerStyle(22);
1358 h4->SetMarkerStyle(23);
1359 h5->SetMarkerStyle(24);
1360 h3->SetMarkerColor(2);
1361 h4->SetMarkerColor(1);
1362 h5->SetMarkerColor(4);
1363 h3->SetLineColor(2);
1364 h4->SetLineColor(1);
1365 h5->SetLineColor(4);
1366
1367 h6->SetMarkerStyle(22);
1368 h7->SetMarkerStyle(23);
1369 h8->SetMarkerStyle(24);
1370 h6->SetMarkerColor(2);
1371 h7->SetMarkerColor(1);
1372 h8->SetMarkerColor(4);
1373 h6->SetLineColor(2);
1374 h7->SetLineColor(1);
1375 h8->SetLineColor(4);
1376
1377 TCanvas *c=new TCanvas();
1378 c->SetLogy();
1379 c->SetGridy();
1380 h0->Draw("p");
1381 h1->Draw("psame");
1382 h2->Draw("psame");
1383c->BuildLegend(0.11,0.15,0.45,0.30);
1384 TLatex* ti1=new TLatex(0.11,0.40,"ITS pure SA tracks (normalized to number of events)");
1385 ti1->SetNDC();
1386 ti1->SetTextColor(1);
1387 ti1->Draw();
1388 c->SaveAs("ITSsa_trend.pdf");
1389 pdfFileNames+=" ITSsa_trend.pdf";
1390 TCanvas *c2=new TCanvas();
1391 c2->SetLogy();
1392 c2->SetGridy();
1393 h3->Draw("p");
1394 h4->Draw("psame");
1395 h5->Draw("psame");
1396 c2->BuildLegend(0.11,0.15,0.45,0.30);
1397 TLatex* ti2=new TLatex(0.11,0.40,"ITS+TPC tracks (normalized to number of events)");
1398 ti2->SetNDC();
1399 ti2->SetTextColor(1);
1400 ti2->Draw();
1401 c2->SaveAs("ITSTPC_trend.pdf");
1402 pdfFileNames+=" ITSTPC_trend.pdf";
1403
1404 TCanvas *c3=new TCanvas();
1405 c3->SetGridy();
1406 h8->Draw("p");
1407 h7->Draw("psame");
1408 h6->Draw("psame");
1409 c3->BuildLegend();
1410 TLatex* ti3=new TLatex(0.10,0.8,"(ITSTPC+ITSsa)/ITSpureSA ");
1411 ti3->SetNDC();
1412 ti3->Draw();
1413 c3->SaveAs("tracks_ratio_trend.pdf");
1414 pdfFileNames+=" tracks_ratio_trend.pdf";
1415
1416}
1417
1418
1419
1420//____________________________________________________________________________
1421void AliITSQAtrend(TString runListFile,TString ntupleFileName){
1422
1423 TGrid::Connect("alien://");
1424
1425
1426
1427 //-----------SDD
1428
1429 const Int_t nVariables=43;
1430 TNtuple* ntsdd=new TNtuple("ntsdd","SDD trending","nrun:fracTrackWithClu1:errfracTrackWithClu1:fracTrackWithClu2:errfracTrackWithClu2:fracTrackWithClu3:errfracTrackWithClu3:fracTrackWithClu4:errfracTrackWithClu4:fracTrackWithClu5:errfracTrackWithClu5:fracTrackWithClu6:errfracTrackWithClu6:meanTrPts3:errmeanTrPts3:meanTrPts4:errmeanTrPts4:minDrTime:errminDrTime:meanDrTime:errmeanDrTime:fracExtra:errfracExtra:meandEdxLay3:errmeandEdxLay3:meandEdxLay4:errmeandEdxLay4:meandEdxTB0:errmeandEdxTB0:meandEdxTB5:errmeandEdxTB5:MPVdEdxLay3:errMPVdEdxLay3:MPVdEdxLay4:errMPVdEdxLay4:MPVdEdxTB0:errMPVdEdxTB0:MPVdEdxTB5:errMPVdEdxTB5:nMod95:nMod80:nMod60:nModEmpty");
1431 Float_t xnt[nVariables];
1432
1433 //--------------SSD
1434
1435 const Int_t nVariablesSSD=14;
1436 TNtuple* ntssd=new TNtuple("ntssd","SSD trending","nrun:meandEdxLay5:errmeandEdxLay5:meandEdxLay6:errmeandEdxLay6:MPVdEdxLay5:errMPVdEdxLay5:MPVdEdxLay6:errMPVdEdxLay6:ChargeRatioL5:errChargeratioL5:ChargeRatioL6:errChargeratioL6:moduleOff");
1437 Float_t xntSSD[nVariablesSSD];
1438
1439 //----Matching
1440
1441 const Int_t nVariablesMatching=60;
1442 TNtuple* ntmatching=new TNtuple("ntmatching","Matching Efficiency","nrun:FracSPD1:errFracSPD1:FracSPD2:errFracSPD2:Eff6Pt02:errEff6Pt02:Eff6Pt1:errEff6Pt1:Eff6Pt10:errEff6Pt10:Eff5Pt02:errEff5Pt02:Eff5Pt1:errEff5Pt1:Eff5Pt10:errEff5Pt10:Eff4Pt02:errEff4Pt02:Eff4Pt1:errEff4Pt1:Eff4Pt10:errEff4Pt10:Eff3Pt02:errEff3Pt02:Eff3Pt1:errEff3Pt1:Eff3Pt10:errEff3Pt10:Eff2Pt02:errEff2Pt02:Eff2Pt1:errEff2Pt1:Eff2Pt10:errEff2Pt10:EffSPDPt02:errEffSPDPt02:EffSPDPt1:errEffSPDPt1:EffSPDPt10:errEffSPDPt10:EffoneSPDPt02:errEffoneSPDPt02:EffoneSPDPt1:errEffoneSPDPt1:EffoneSPDPt10:errEffoneSPDPt10:EffTOTPt02:errEffTOTPt02:EffTOTPt1:errEffTOTPt1:EffTOTPt10:errEffTOTPt10");
1443
1444 Float_t xntMatching[nVariablesMatching];
1445
1446 //--------------------------------
1447
1448 //----QA Vertex
1449
1450 const Int_t nVariablesVertex=27;
1451 TNtuple* ntvertex=new TNtuple("ntvertex","QA Vertex","nrun:VxTRK:errVxTRK:sigmaVxTRK:errsigmaVxTRK:VyTRK:errVyTRK:sigmaVyTRK:errsigmaVyTRK:VzTRK:errVzTRK:sigmaVzTRK:errsigmaVzTRK:VxSPD:errVxSPD:sigmaVxSPD:errsigmaVxSPD:VySPD:errVySPD:sigmaVySPD:errsigmaVySPD:VzSPD:errVzSPD:sigmaVzSPD:errsigmaVzSPD");
1452
1453 Float_t xntVertex[nVariablesVertex];
1454
1455 //--------------------------------
1456
1457 //----- Tracking ITS SA
1458 const Int_t nVariablesSA=13;
1459 Float_t xntSA[nVariablesSA];
1460 TNtuple *ntSA=new TNtuple("ntITSsa","ntITSsa","run:NITSTPCPtBin0:NITSTPCPtBin1:NITSTPCPtBin2:NITSsaPtBin0:NITSsaPtBin1:NITSsaPtBin2:NITSpureSAPtBin0:NITSpureSAPtBin1:NITSpureSAPtBin2:ratioPtBin0:ratioPtBin1:ratioPtBin2");
1461
1462 //---------------------------------
1463
1464
1465
1466 TBits* readRun=new TBits(999999);
1467 readRun->ResetAllBits();
1468 // if(!useExternalList){
1469 if(!gSystem->Exec(Form("ls -l %s > /dev/null 2>&1",ntupleFileName.Data()))){
1470 TFile* oldfil=new TFile(ntupleFileName.Data());
1471
1472 TNtuple* ntmp=(TNtuple*)oldfil->Get("ntsdd");
1473
1474 TNtuple* ntmpSSD=(TNtuple*)oldfil->Get("ntssd");
1475
1476 TNtuple* ntmpMatching=(TNtuple*)oldfil->Get("ntmatching");
1477
1478 TNtuple* ntmpVertex=(TNtuple*)oldfil->Get("ntvertex");
1479
1480 TNtuple* ntmpSA=(TNtuple*)oldfil->Get("ntITSsa");
1481
1482
1483 //-------SDD
1484
1485 Bool_t isOK=kFALSE;
1486 if(ntmp){
1487 if(ntmp->GetNvar()==ntsdd->GetNvar()){
1488 isOK=kTRUE;
1489 TObjArray* arr1=(TObjArray*)ntsdd->GetListOfBranches();
1490 TObjArray* arr2=(TObjArray*)ntmp->GetListOfBranches();
1491 for(Int_t iV=0; iV<ntmp->GetNvar(); iV++){
1492 TString vnam1=arr1->At(iV)->GetName();
1493 TString vnam2=arr2->At(iV)->GetName();
1494 if(vnam1!=vnam2) isOK=kFALSE;
1495 ntmp->SetBranchAddress(vnam2.Data(),&xnt[iV]);
1496 }
1497 if(isOK){
1498 for(Int_t nE=0; nE<ntmp->GetEntries(); nE++){
1499 ntmp->GetEvent(nE);
1500 Int_t theRun=(Int_t)(xnt[0]+0.0001);
1501 readRun->SetBitNumber(theRun);
1502 ntsdd->Fill(xnt);
1503 }
1504 }
1505 }
1506 }
1507 if(!isOK){
1508 printf("Ntuple in local file not OK -> will be recreated\n");
1509 }
1510
1511 //----------SSD----------
1512
1513 Bool_t isOKSSD=kFALSE;
1514 if(ntmpSSD){
1515 if(ntmpSSD->GetNvar()==ntssd->GetNvar()){
1516 isOKSSD=kTRUE;
1517 TObjArray* arr1ssd=(TObjArray*)ntssd->GetListOfBranches();
1518 TObjArray* arr2ssd=(TObjArray*)ntmpSSD->GetListOfBranches();
1519 for(Int_t iV=0; iV<ntmpSSD->GetNvar(); iV++){
1520 TString vnam1=arr1ssd->At(iV)->GetName();
1521 TString vnam2=arr2ssd->At(iV)->GetName();
1522 if(vnam1!=vnam2) isOKSSD=kFALSE;
1523 ntmpSSD->SetBranchAddress(vnam2.Data(),&xntSSD[iV]);
1524 }
1525 if(isOKSSD){
1526 for(Int_t nE=0; nE<ntmpSSD->GetEntries(); nE++){
1527 ntmpSSD->GetEvent(nE);
1528 Int_t theRun=(Int_t)(xntSSD[0]+0.0001);
1529 readRun->SetBitNumber(theRun);
1530 ntssd->Fill(xntSSD);
1531 }
1532 }
1533 }
1534 }
1535 if(!isOKSSD){
1536 printf("\n\nNtuple SSD in local file not OK -> will be recreated\n\n");
1537 }
1538
1539 //---------Matching---------
1540
1541 Bool_t isOKMatching=kFALSE;
1542 if(ntmpMatching){
1543 if(ntmpMatching->GetNvar()==ntmatching->GetNvar()){
1544 isOKMatching=kTRUE;
1545 TObjArray* arr1matching=(TObjArray*)ntmatching->GetListOfBranches();
1546 TObjArray* arr2matching=(TObjArray*)ntmpMatching->GetListOfBranches();
1547 for(Int_t iV=0; iV<ntmpMatching->GetNvar(); iV++){
1548 TString vnam1=arr1matching->At(iV)->GetName();
1549 TString vnam2=arr2matching->At(iV)->GetName();
1550 if(vnam1!=vnam2) isOKMatching=kFALSE;
1551 ntmpMatching->SetBranchAddress(vnam2.Data(),&xntMatching[iV]);
1552 }
1553 if(isOKMatching){
1554 for(Int_t nE=0; nE<ntmpMatching->GetEntries(); nE++){
1555 ntmpMatching->GetEvent(nE);
1556 Int_t theRun=(Int_t)(xntMatching[0]+0.0001);
1557 readRun->SetBitNumber(theRun);
1558 ntmatching->Fill(xntMatching);
1559 }
1560 }
1561 }
1562 }
1563 if(!isOKMatching){
1564 printf("\n\nNtuple Matching in local file not OK -> will be recreated\n\n");
1565 }
1566 //-----------------------
1567
1568 //---------Vertex QA---------
1569
1570 Bool_t isOKVertex=kFALSE;
1571 if(ntmpVertex){
1572 if(ntmpVertex->GetNvar()==ntvertex->GetNvar()){
1573 isOKVertex=kTRUE;
1574 TObjArray* arr1vertex=(TObjArray*)ntvertex->GetListOfBranches();
1575 TObjArray* arr2vertex=(TObjArray*)ntmpVertex->GetListOfBranches();
1576 for(Int_t iV=0; iV<ntmpVertex->GetNvar(); iV++){
1577 TString vnam1=arr1vertex->At(iV)->GetName();
1578 TString vnam2=arr2vertex->At(iV)->GetName();
1579 if(vnam1!=vnam2) isOKVertex=kFALSE;
1580 ntmpVertex->SetBranchAddress(vnam2.Data(),&xntVertex[iV]);
1581 }
1582 if(isOKVertex){
1583 for(Int_t nE=0; nE<ntmpVertex->GetEntries(); nE++){
1584 ntmpVertex->GetEvent(nE);
1585 Int_t theRun=(Int_t)(xntVertex[0]+0.0001);
1586 readRun->SetBitNumber(theRun);
1587 ntvertex->Fill(xntVertex);
1588 }
1589 }
1590 }
1591 }
1592 if(!isOKVertex){
1593 printf("\n\nNtuple Vertex in local file not OK -> will be recreated\n\n");
1594 }
1595 //-----------------------
1596
1597 //-----------Tracking SA ----------------
1598 Bool_t isOKSA = kFALSE;
1599 if(ntmpSA){
1600 if(ntmpSA->GetNvar()==ntSA->GetNvar()){
1601 isOKSA = kTRUE;
1602 TObjArray* arr1SA=(TObjArray*)ntSA->GetListOfBranches();
1603 TObjArray* arr2SA=(TObjArray*)ntmpSA->GetListOfBranches();
1604 for(Int_t iV=0; iV<ntmpSA->GetNvar(); iV++){
1605 TString vnam1=arr1SA->At(iV)->GetName();
1606 TString vnam2=arr2SA->At(iV)->GetName();
1607 if(vnam1!=vnam2) isOKSA=kFALSE;
1608 ntmpSA->SetBranchAddress(vnam2.Data(),&xntSA[iV]);
1609 }
1610 if(isOKSA){
1611 for(Int_t nE=0; nE<ntmpSA->GetEntries(); nE++){
1612 ntmpSA->GetEvent(nE);
1613 Int_t theRun=(Int_t)(xntSA[0]+0.0001);
1614 readRun->SetBitNumber(theRun);
1615 ntSA->Fill(xntSA);
1616 }
1617 }
1618 }
1619 }
1620
1621 oldfil->Close();
1622 delete oldfil;
1623 }
1624
1625#define MAX_LINES 200
1626#define MAX_LINE_LEN 255
1627
1628 char strings[MAX_LINES][MAX_LINE_LEN];
1629 ifstream in(runListFile.Data());
1630 int j = 0;
1631 Int_t nrun=0;
1632 Int_t runNumb[MAX_LINES];
1633 Int_t fillNumb[MAX_LINES];
1634 Bool_t goout = kFALSE;
1635 while ( in ) {
1636 in.getline(strings[j], MAX_LINE_LEN);
1637 TString aux(strings[j]);
1638 TString auxrun(strings[j]);
1639 TString auxfill(strings[j]);
28d5818f 1640 TString aux2(strings[j]);
579b5046 1641 Int_t lentrail=0;
1642 Int_t lenfill=0;
1643 if(aux.Contains("LHC11h/")){
1644 lentrail = 27;
1645 }
1646 else if(aux.Contains("LHC11h_2/")){
1647 lentrail = 29;
1648 }
1649 else if(aux.Contains("LHC12a17b/")){
1650 lentrail = 26;
1651 }
1652 else if(aux.Contains("LHC12b/")){
1653 lentrail = 27;
28d5818f 1654 lenfill=36;
579b5046 1655 }
28d5818f 1656 else if(aux.Contains("LHC12c/") || aux.Contains("LHC12d/") ){
579b5046 1657 lentrail = 27;
28d5818f 1658 lenfill=36;
579b5046 1659 }
1660 else if(aux.Contains("LHC12a/")){
1661 lentrail = 27;
28d5818f 1662 lenfill=36;
579b5046 1663 }
1664
1665
1666 else {
1667 if(!aux.IsNull())printf("Unrecognised path name %s \n",aux.Data());
1668 goout = kTRUE;
1669 }
1670 if(goout)break;
1671 if(aux.Length()<lentrail)continue;
1672 auxrun=aux.Remove(0,lentrail);
28d5818f 1673 auxfill=aux.Remove(0,lenfill);
579b5046 1674 runNumb[j]=atoi(auxrun.Data());
1675 fillNumb[j]=atoi(auxfill.Data());
28d5818f 1676 aux2.Remove(aux2.Length()-5);
1677 printf("%d ) - fill %d - path %s \n",runNumb[j],fillNumb[j],aux2.Data());
579b5046 1678 j++;
1679 nrun++;
1680 }
1681
1682 printf("\n ******************* Loop on runs *********** \n");
1683 Int_t filenotfound=0;
1684 for(Int_t jru=0;jru<nrun;jru++) {
1685 printf("jru=%d - run number= %d \n",jru,runNumb[jru]);
1686 Int_t iRun=runNumb[jru];
1687 if(readRun->TestBitNumber(iRun))printf("Run %d - already processed\n",iRun);
1688 if(readRun->TestBitNumber(iRun))continue;
28d5818f 1689
579b5046 1690 if(!gGrid||!gGrid->IsConnected()) {
1691 printf("gGrid not found! exit macro\n");
1692 return;
1693 }
28d5818f 1694 TString aux(strings[jru]);
1695 aux.Remove(aux.Length()-5);
1696 TFile *f=TFile::Open(Form("alien://%s",aux.Data()));
579b5046 1697 if(!f) {
1698 printf("File not found, continue with next one\n");
1699 filenotfound++;
1700 continue;
1701 }
1702
28d5818f 1703 //-------SDD
1704 FillSDDntuple(f,ntsdd,iRun,xnt);
1705
1706
1707 //-------SSD
1708
1709 FillSSDntuple(f,ntssd,iRun,xntSSD);
1710
1711
1712 //--------------matching
1713
1714 FillMatchntuple(f,ntmatching,iRun,xntMatching);
1715
1716 //------------- Vertex
1717 FillVTXntuple(f,ntvertex,iRun,xntVertex);
1718
1719
1720 //---------------------------
1721
1722 //-------------- ITS SA ---------------
1723 cout<<"ITS - SA"<<endl;
1724 // cout<<f<<" "<<ntSA<<" "<<iRun<<endl;
1725 FillITSSAntuple(f,ntSA,iRun);
1726
1727 } // loop on runs
1728
1729 printf("%d runs skipped because QA file not found\n",filenotfound);
1730 TFile* outfil=new TFile(ntupleFileName.Data(),"recreate");
1731 outfil->cd();
1732 ntsdd->Write();
1733 ntssd->Write();
1734 ntmatching->Write();
1735 ntvertex->Write();
1736 ntSA->Write();
1737 outfil->Close();
1738 delete outfil;
1739 delete ntsdd;
1740 delete ntssd;
1741 delete ntmatching;
1742 delete ntvertex;
1743 delete ntSA;
1744
1745}
1746
1747//____________________________________________________________________________
1748void FillITSSAntuple(TFile* f,TNtuple* nt, Int_t nrun){
1749 static const Int_t nVariables=13;
1750 static Float_t xnt[nVariables];
1751 TH1F *hPtTPCITS=0x0;
1752 TH1F *hPtITSsa=0x0;
1753 TH1F *hPtITSpureSA=0x0;
1754 Double_t Lowbin[3]={0.1,0.5,0.9};
1755 Double_t Upbin[3]={0.2,0.6,1};
1756 Double_t NTPCITS[3];
1757 Double_t NITSsa[3];
1758 Double_t NITSpureSA[3];
1759 Double_t Ratio[3];
1760 TDirectory *dirFile=(TDirectory*)f->Get("ITSsaTracks");
1761 TList *cOutput = (TList*)dirFile->Get("clistITSsaTracks");
1762 // histogram with number of events: in the first cell there is the number of the events
1763 // in the second, the number of events with SPD vertex.
1764 // normalization will be done to the second number
1765 TH1F *hnev =(TH1F*)cOutput->FindObject("hNEvents");
1766 Double_t noEvents = hnev->GetBinContent(1);
1767 if(noEvents<1.)noEvents=1.; // protection to avoid division by zero
1768 hPtTPCITS=(TH1F*)cOutput->FindObject("hPtTPCITS");
1769 hPtITSsa=(TH1F*)cOutput->FindObject("hPtITSsa");
1770 hPtITSpureSA=(TH1F*)cOutput->FindObject("hPtITSpureSA");
1771
1772 for(Int_t ibin=0;ibin<=2;ibin++){
1773 NTPCITS[ibin]=hPtTPCITS->Integral(hPtTPCITS->FindBin(Lowbin[ibin]),hPtTPCITS->FindBin(Upbin[ibin]))/noEvents;
1774 NITSsa[ibin]=hPtITSsa->Integral(hPtITSsa->FindBin(Lowbin[ibin]),hPtITSsa->FindBin(Upbin[ibin]))/noEvents;
1775 NITSpureSA[ibin]=hPtITSpureSA->Integral(hPtITSpureSA->FindBin(Lowbin[ibin]),hPtITSpureSA->FindBin(Upbin[ibin]))/noEvents;
1776 // if(NTPCITS[ibin]!=0 && NITSsa[ibin]!=0)Ratio[ibin]=NTPCITS[ibin]/NITSsa[ibin];
1777 Double_t totaltrks=NTPCITS[ibin]+NITSsa[ibin];
1778 if(totaltrks!=0 && NITSpureSA[ibin]!=0 )Ratio[ibin]=totaltrks/NITSpureSA[ibin];
1779 else Ratio[ibin]=0;
1780 }
1781
1782 Int_t index=0;
1783 xnt[index++]=(Float_t)nrun;
1784 xnt[index++]=NTPCITS[0];
1785 xnt[index++]=NTPCITS[1];
1786 xnt[index++]=NTPCITS[2];
1787 xnt[index++]=NITSsa[0];
1788 xnt[index++]=NITSsa[1];
1789 xnt[index++]=NITSsa[2];
1790 xnt[index++]=NITSpureSA[0];
1791 xnt[index++]=NITSpureSA[1];
1792 xnt[index++]=NITSpureSA[2];
1793 xnt[index++]=Ratio[0];
1794 xnt[index++]=Ratio[1];
1795 xnt[index++]=Ratio[2];
1796 nt->Fill(xnt);
1797}
1798
1799//_____________________________________________________________________________
1800void FillSDDntuple(TFile* f,TNtuple* nt, Int_t iRun, Float_t *xnt){
1801 TDirectoryFile* df=(TDirectoryFile*)f->Get("SDD_Performance");
1802 if(!df){
1803 printf("Run %d SDD_Performance MISSING -> Exit\n",iRun);
1804 return;
1805 }
1806
579b5046 1807
28d5818f 1808 TList* l=(TList*)df->Get("coutputRP");
1809 if(!l){
1810 printf("Run %d coutputRP TList MISSING -> Exit\n",iRun);
1811 return;
1812 }
579b5046 1813
579b5046 1814
579b5046 1815
28d5818f 1816 cout<<"SDD - QA"<<endl;
579b5046 1817
28d5818f 1818 TH1F* hcllay=(TH1F*)l->FindObject("hCluInLay");
579b5046 1819
28d5818f 1820 if(hcllay->GetEntries()==0){
579b5046 1821
28d5818f 1822 printf("Run %d hcllay EMPTY -> Return\n",iRun);
1823 return;
579b5046 1824
28d5818f 1825 }
579b5046 1826
28d5818f 1827 Float_t fracT[6]={0.,0.,0.,0.,0.,0.};
1828 Float_t efracT[6]={0.,0.,0.,0.,0.,0.};
1829 if(hcllay->GetBinContent(1)>0){
1830 for(Int_t iLay=0; iLay<6; iLay++){
1831 fracT[iLay]=hcllay->GetBinContent(iLay+2)/hcllay->GetBinContent(1);
1832 efracT[iLay]=TMath::Sqrt(fracT[iLay]*(1-fracT[iLay])/hcllay->GetBinContent(1));
579b5046 1833 }
28d5818f 1834 }
579b5046 1835
28d5818f 1836 TH1F* hmodT=(TH1F*)l->FindObject("hTPMod");
579b5046 1837
28d5818f 1838 if(hmodT->GetEntries()==0){
1839 printf("Run %d hmodT EMPTY -> Continue\n",iRun);
1840 return;
1841 }
579b5046 1842
28d5818f 1843 TH1F* hgamod=(TH1F*)l->FindObject("hGAMod");
579b5046 1844
28d5818f 1845 if(hgamod->GetEntries()==0){
1846 printf("Run %d hgamod EMPTY -> Continue\n",iRun);
1847 return;
1848 }
579b5046 1849
28d5818f 1850 Int_t bestMod=0;
1851 for(Int_t iMod=0; iMod<260;iMod++){
1852 Int_t gda=(Int_t)hgamod->GetBinContent(iMod+1);
1853 if(gda>bestMod) bestMod=gda;
1854 }
1855 Int_t nChunks=1;
1856 if(bestMod>512){
1857 nChunks=(Int_t)(bestMod/512.+0.5);
1858 }
1859 hgamod->Scale(1./nChunks);
579b5046 1860
28d5818f 1861 TH1F* hev=(TH1F*)l->FindObject("hNEvents");
579b5046 1862
28d5818f 1863 if(hev->GetEntries()==0){
1864 printf("Run %d hev EMPTY -> Continue\n",iRun);
1865 return;
1866 }
579b5046 1867
28d5818f 1868 Int_t nTotEvents=hev->GetBinContent(2);
1869 Int_t nTrigEvents=hev->GetBinContent(3);
1870 Int_t nEvents=nTotEvents;
1871 printf("Run %d Number of Events = %d Triggered=%d\n",iRun,nTotEvents,nTrigEvents);
1872 if(nTrigEvents>0){
1873 nEvents=nTrigEvents;
1874 }
1875 if(nTotEvents==0) return;
1876 Int_t nModGood3=0;
1877 Int_t nModGood4=0;
1878 Int_t nModBadAn=0;
1879 Float_t sumtp3=0;
1880 Float_t sumtp4=0;
1881 Float_t sumEtp3=0;
1882 Float_t sumEtp4=0;
1883 for(Int_t iMod=0; iMod<260; iMod++){
1884 Float_t tps=hmodT->GetBinContent(iMod+1);
1885 Float_t ga=hgamod->GetBinContent(iMod+1);
1886 if(ga<500) nModBadAn++;
1887 Float_t tpsN=0.;
1888 Float_t etpsN=0.;
1889 if(ga>0){
1890 tpsN=tps/ga/(Float_t)nEvents;
1891 etpsN=TMath::Sqrt(tps)/ga/(Float_t)nEvents;
1892 if(iMod<84){
1893 sumtp3+=tpsN;
1894 sumEtp3+=(etpsN*etpsN);
1895 nModGood3++;
1896 }
1897 else{
1898 sumtp4+=tpsN;
1899 sumEtp4+=(etpsN*etpsN);
1900 nModGood4++;
579b5046 1901 }
1902 }
28d5818f 1903 }
579b5046 1904
28d5818f 1905 TH1F* hapmod=(TH1F*)l->FindObject("hAllPmod");
579b5046 1906
28d5818f 1907 if(hapmod->GetEntries()==0){
1908 printf("Run %d hapmod EMPTY -> Continue\n",iRun);
1909 return;
1910 }
579b5046 1911
1912
28d5818f 1913 TH1F* hgpmod=(TH1F*)l->FindObject("hGoodPmod");
1914 if(hgpmod->GetEntries()==0){
1915 printf("Run %d hgpmod EMPTY -> Continue\n",iRun);
1916 return;
1917 }
579b5046 1918
28d5818f 1919 // TH1F* hmpmod=(TH1F*)l->FindObject("hMissPmod");
1920 TH1F* hbrmod=(TH1F*)l->FindObject("hBadRegmod");
1921 if(hbrmod->GetEntries()==0){
1922 printf("Run %d hbrmod EMPTY -> Continue\n",iRun);
1923 return;
1924 }
579b5046 1925
28d5818f 1926 TH1F* hskmod=(TH1F*)l->FindObject("hSkippedmod");
1927 TH1F* hoamod=(TH1F*)l->FindObject("hOutAccmod");
1928 TH1F* hnrmod=(TH1F*)l->FindObject("hNoRefitmod");
1929
1930 Int_t nBelow95=0;
1931 Int_t nBelow80=0;
1932 Int_t nBelow60=0;
1933 Int_t nZeroP=0;
1934 for(Int_t imod=0; imod<260;imod++){
1935 Float_t numer=hgpmod->GetBinContent(imod+1)+hbrmod->GetBinContent(imod+1)+hoamod->GetBinContent(imod+1)+hnrmod->GetBinContent(imod+1)+hskmod->GetBinContent(imod+1);
1936 Float_t denom=hapmod->GetBinContent(imod+1);
1937 if(denom>0){
1938 Float_t eff=numer/denom;
1939 if(eff<0.95) nBelow95++;
1940 if(eff<0.80) nBelow80++;
1941 if(eff<0.60) nBelow60++;
1942 }
1943 if(hmodT->GetBinContent(imod+1)<1.){
1944 nZeroP++;
1945 }
1946 }
579b5046 1947
28d5818f 1948 TH1F* htimT=(TH1F*)l->FindObject("hDrTimTPAll");
579b5046 1949
28d5818f 1950 if(htimT->GetEntries()==0){
1951 printf("Run %d htimT EMPTY -> Continue\n",iRun);
1952 return;
1953 }
579b5046 1954
28d5818f 1955 TH1F* htimTe=(TH1F*)l->FindObject("hDrTimTPExtra");
579b5046 1956
28d5818f 1957 if(htimTe->GetEntries()==0){
1958 printf("Run %d htimTe EMPTY -> Continue\n",iRun);
1959 return;
1960 }
579b5046 1961
28d5818f 1962 Double_t fracExtra=0.;
1963 Double_t errFracExtra=0.;
1964 if(htimT->GetEntries()>0){
1965 fracExtra=htimTe->GetEntries()/htimT->GetEntries();
1966 errFracExtra=TMath::Sqrt(htimTe->GetEntries())/htimT->GetEntries();
1967 }
1968 Double_t averPoints=0.;
1969 Double_t cntBins=0.;
1970 for(Int_t iBin=1; iBin<=htimT->GetNbinsX(); iBin++){
1971 Float_t tim=htimT->GetBinCenter(iBin);
1972 if(tim>2000. && tim<4000.){
1973 averPoints+=htimT->GetBinContent(iBin);
1974 cntBins+=1;
579b5046 1975 }
28d5818f 1976 }
1977 Double_t minTime=-999.;
1978 Double_t errMinTime=0.;
1979 if(cntBins>0){
1980 averPoints/=cntBins;
579b5046 1981 for(Int_t iBin=1; iBin<=htimT->GetNbinsX(); iBin++){
28d5818f 1982 if(htimT->GetBinContent(iBin)>0.5*averPoints){
1983 minTime=htimT->GetBinCenter(iBin);
1984 errMinTime=0.5*htimT->GetBinWidth(iBin);
1985 break;
579b5046 1986 }
1987 }
28d5818f 1988 }
579b5046 1989
28d5818f 1990 TH2F* hdedxmod=(TH2F*)l->FindObject("hdEdxVsMod");
579b5046 1991
28d5818f 1992 if(hdedxmod->GetEntries()==0){
1993 printf("Run %d hdedxmod EMPTY -> Continue\n",iRun);
1994 return;
1995 }
579b5046 1996
28d5818f 1997 TH1D* hdedxLay3=hdedxmod->ProjectionY("hdedxLay3",1,84);
1998 TH1D* hdedxLay4=hdedxmod->ProjectionY("hdedxLay4",85,260);
579b5046 1999
28d5818f 2000 TH1F* hSigTim0=(TH1F*)l->FindObject("hSigTimeInt0");
2001 if(hSigTim0->GetEntries()==0){
2002 printf("Run %d hSigTim0 EMPTY -> Continue\n",iRun);
2003 return;
2004 }
579b5046 2005
28d5818f 2006 TH1F* hSigTim5=(TH1F*)l->FindObject("hSigTimeInt5");
2007 if(hSigTim5->GetEntries()==0){
2008 printf("Run %d hSigTim5 EMPTY -> Continue\n",iRun);
2009 return;
2010 }
2011 //Fitting the same distributions in order to have the MPV
2012 TF1 *lfunLay3 = new TF1("LangausFunLay3",LangausFun,50.,300.,4);
2013 lfunLay3->SetParameter(0,5.);
2014 lfunLay3->SetParameter(1,80.);
2015 lfunLay3->SetParameter(2,hdedxLay3->GetEntries()/10.);
2016 lfunLay3->SetParameter(3,10.);
2017 lfunLay3->SetParLimits(3,0.,20);
2018 hdedxLay3->Fit(lfunLay3,"NQLR");
2019 TF1 *lfunLay4 = new TF1("LangausFunLay4",LangausFun,50.,300.,4);
2020 lfunLay4->SetParameter(0,5.);
2021 lfunLay4->SetParameter(1,80.);
2022 lfunLay4->SetParameter(2,hdedxLay4->GetEntries()/10.);
2023 lfunLay4->SetParameter(3,10.);
2024 lfunLay4->SetParLimits(3,0.,20);
2025 hdedxLay4->Fit(lfunLay4,"NQLR");
2026 TF1 *lfunTim0 = new TF1("LangausFunTim0",LangausFun,50.,300.,4);
2027 lfunTim0->SetParameter(0,5.);
2028 lfunTim0->SetParameter(1,80.);
2029 lfunTim0->SetParameter(2,hSigTim0->GetEntries()/10.);
2030 lfunTim0->SetParameter(3,10.);
2031 lfunTim0->SetParLimits(3,0.,20);
2032 hSigTim0->Fit(lfunTim0,"NQLR");
2033 TF1 *lfunTim5 = new TF1("LangausFunTim5",LangausFun,50.,300.,4);
2034 lfunTim5->SetParameter(0,5.);
2035 lfunTim5->SetParameter(1,80.);
2036 lfunTim5->SetParameter(2,hSigTim5->GetEntries()/10.);
2037 lfunTim5->SetParameter(3,10.);
2038 lfunTim5->SetParLimits(3,0.,20);
2039 hSigTim5->Fit(lfunTim5,"NQLR");
579b5046 2040
28d5818f 2041 Int_t index=0;
2042 xnt[index++]=iRun;
2043 xnt[index++]=fracT[0];
2044 xnt[index++]=efracT[0];
2045 xnt[index++]=fracT[1];
2046 xnt[index++]=efracT[1];
2047 xnt[index++]=fracT[2];
2048 xnt[index++]=efracT[2];
2049 xnt[index++]=fracT[3];
2050 xnt[index++]=efracT[3];
2051 xnt[index++]=fracT[4];
2052 xnt[index++]=efracT[4];
2053 xnt[index++]=fracT[5];
2054 xnt[index++]=efracT[5];
2055 xnt[index++]=sumtp3/nModGood3;
2056 xnt[index++]=TMath::Sqrt(sumEtp3)/nModGood3;
2057 xnt[index++]=sumtp4/nModGood4;
2058 xnt[index++]=TMath::Sqrt(sumEtp4)/nModGood4;
2059 xnt[index++]=minTime;
2060 xnt[index++]=errMinTime;
2061 xnt[index++]=htimT->GetMean();
2062 xnt[index++]=htimT->GetMeanError();
2063 xnt[index++]=fracExtra;
2064 xnt[index++]=errFracExtra;
2065 xnt[index++]=hdedxLay3->GetMean();
2066 xnt[index++]=hdedxLay3->GetMeanError();
2067 xnt[index++]=hdedxLay4->GetMean();
2068 xnt[index++]=hdedxLay4->GetMeanError();
2069 xnt[index++]=hSigTim0->GetMean();
2070 xnt[index++]=hSigTim0->GetMeanError();
2071 xnt[index++]=hSigTim5->GetMean();
2072 xnt[index++]=hSigTim5->GetMeanError();
2073 xnt[index++]=lfunLay3->GetParameter(1);
2074 xnt[index++]=lfunLay3->GetParError(1);
2075 xnt[index++]=lfunLay4->GetParameter(1);
2076 xnt[index++]=lfunLay4->GetParError(1);
2077 xnt[index++]=lfunTim0->GetParameter(1);
2078 xnt[index++]=lfunTim0->GetParError(1);
2079 xnt[index++]=lfunTim5->GetParameter(1);
2080 xnt[index++]=lfunTim5->GetParError(1);
2081 xnt[index++]=(Float_t)nBelow95;
2082 xnt[index++]=(Float_t)nBelow80;
2083 xnt[index++]=(Float_t)nBelow60;
2084 xnt[index++]=(Float_t)nZeroP;
2085 nt->Fill(xnt);
2086
579b5046 2087
28d5818f 2088}
579b5046 2089
28d5818f 2090//_____________________________________________________________________________
2091void FillSSDntuple(TFile* f,TNtuple* ntssd, Int_t iRun, Float_t *xntSSD){
579b5046 2092
28d5818f 2093 cout<<"SSD - QA"<<endl;
2094
2095 TDirectoryFile* dfSSD=(TDirectoryFile*)f->Get("PWGPPdEdxSSDQA");
2096 if(!dfSSD){
2097 printf("Run %d SSD_Performance MISSING -> Exit\n",iRun);
2098 return;
2099 }
579b5046 2100
28d5818f 2101 TList* lSSD=(TList*)dfSSD->Get("SSDdEdxQA");
2102 if(!dfSSD){
2103 printf("Run %d coutputRP TList MISSING -> Exit\n",iRun);
2104 return;
2105 }
2106 //
579b5046 2107
28d5818f 2108 TH2F* QAchargeRatio=(TH2F*)lSSD->FindObject("QAChargeRatio");
579b5046 2109
28d5818f 2110 if(QAchargeRatio->GetEntries()==0){
2111 printf("Run %d QAchargeRatio EMPTY -> Return\n",iRun);
2112 return;
2113 }
579b5046 2114
28d5818f 2115 TH2F* QAcharge=(TH2F*)lSSD->FindObject("QACharge");
579b5046 2116
28d5818f 2117 if(QAcharge->GetEntries()==0){
2118 printf("Run %d QAcharge EMPTY -> Return\n",iRun);
2119 return;
2120 }
579b5046 2121
28d5818f 2122 Int_t biny = QAcharge->GetXaxis()->FindBin(747);
2123 Int_t maxy = QAcharge->GetXaxis()->GetXmax();
2124 // Int_t miny = QAcharge->GetXaxis()->GetXmin();
579b5046 2125
28d5818f 2126 Int_t contEmpty=0;
2127 Int_t contFull=0;
579b5046 2128
28d5818f 2129 TH1D *hChargeL5=QAcharge->ProjectionY("hChargeL5",0,biny);
2130 TH1D *hChargeL6=QAcharge->ProjectionY("hChargeL6",biny,maxy);
579b5046 2131
28d5818f 2132 // cout<< hChargeL5->GetMean()<< " " << hChargeL5->GetRMS()<<endl;
2133 // cout<< hChargeL6->GetMean()<< " " << hChargeL6->GetRMS()<<endl;
579b5046 2134
28d5818f 2135 TH1D *hChargeRatioL5=QAchargeRatio->ProjectionY("hChargeRatioL5",0,biny);
2136 TH1D *hChargeRatioL6=QAchargeRatio->ProjectionY("hChargeRatioL6",biny,maxy);
579b5046 2137
28d5818f 2138 // cout<< hChargeRatioL5->GetMean()<< " " << hChargeRatioL5->GetRMS()<<endl;
2139 // cout<< hChargeRatioL6->GetMean()<< " " << hChargeRatioL6->GetRMS()<<endl;
579b5046 2140
28d5818f 2141 if(QAcharge->GetEntries()< 45000)
2142 contEmpty=1;
579b5046 2143
28d5818f 2144 else{
2145 for(Int_t i =0;i<1698;i++){
579b5046 2146
28d5818f 2147 TString tmpQ("Q");
2148 tmpQ+=i;
579b5046 2149
28d5818f 2150 TH1D* fHist1DQ= QAcharge->ProjectionY(tmpQ,i+1,i+1);
2151 Double_t mean=fHist1DQ->GetMean();
579b5046 2152
28d5818f 2153 if(TMath::Abs(mean)<1.0 ||fHist1DQ->GetEntries()<10)
2154 contEmpty++;
579b5046 2155
28d5818f 2156 else
2157 contFull++;
579b5046 2158
579b5046 2159 }
28d5818f 2160 }
579b5046 2161
28d5818f 2162 // cout<<"contFull: " <<contFull<<" contEmpty: "<<contEmpty<<endl;
2163 // cout<<hChargeL5->GetMean()<<endl;
2164
2165 //Fitting dE/dx Distr in order to have the MPV
2166 TF1 *lfunLay5 = new TF1("LangausFunLay5",LangausFun,50.,300.,4);
2167 lfunLay5->SetParameter(0,5.);
2168 lfunLay5->SetParameter(1,80.);
2169 lfunLay5->SetParameter(2,hChargeL5->GetEntries()/10.);
2170 lfunLay5->SetParameter(3,10.);
2171 lfunLay5->SetParLimits(3,0.,20);
2172 hChargeL5->Fit(lfunLay5,"NQLR");
2173 TF1 *lfunLay6 = new TF1("LangausFunLay6",LangausFun,50.,300.,4);
2174 lfunLay6->SetParameter(0,5.);
2175 lfunLay6->SetParameter(1,80.);
2176 lfunLay6->SetParameter(2,hChargeL6->GetEntries()/10.);
2177 lfunLay6->SetParameter(3,10.);
2178 lfunLay6->SetParLimits(3,0.,20);
2179 hChargeL6->Fit(lfunLay6,"NQLR");
579b5046 2180
28d5818f 2181 Int_t indexSSD=0;
2182 xntSSD[indexSSD++]=iRun;
2183 xntSSD[indexSSD++]=(Float_t)hChargeL5->GetMean();
2184 xntSSD[indexSSD++]=(Float_t)hChargeL5->GetMeanError();
2185 xntSSD[indexSSD++]=(Float_t)hChargeL6->GetMean();
2186 xntSSD[indexSSD++]=(Float_t)hChargeL6->GetMeanError();
2187 xntSSD[indexSSD++]=(Float_t)lfunLay5->GetParameter(1);
2188 xntSSD[indexSSD++]=(Float_t)lfunLay5->GetParError(1);
2189 xntSSD[indexSSD++]=(Float_t)lfunLay6->GetParameter(1);
2190 xntSSD[indexSSD++]=(Float_t)lfunLay6->GetParError(1);
2191 xntSSD[indexSSD++]=(Float_t)hChargeRatioL5->GetMean();
2192 xntSSD[indexSSD++]=(Float_t)hChargeRatioL5->GetMeanError();
2193 xntSSD[indexSSD++]=(Float_t)hChargeRatioL6->GetMean();
2194 xntSSD[indexSSD++]=(Float_t)hChargeRatioL6->GetMeanError();
2195 xntSSD[indexSSD++]=(Float_t)contEmpty;
2196 ntssd->Fill(xntSSD);
2197}
579b5046 2198
28d5818f 2199//_____________________________________________________________________________
2200void FillMatchntuple(TFile* f,TNtuple* ntmatching, Int_t iRun, Float_t *xntMatching){
579b5046 2201 cout<<"Tracking"<<endl;
2202
2203 TDirectoryFile *dirMatch=(TDirectoryFile*)f->GetDirectory("ITS_Performance");
2204 TList *list=NULL;
2205 TList *listSPD=NULL;
2206
2207 if(dirMatch) {
2208 // list = (TList*)dirMatch->Get("cOutputITS_3500_10000"); //LHC11h
2209 // if(!list)list = (TList*)dirMatch->Get("cOutputITS"); // LHC11e
2210 list = (TList*)dirMatch->Get("cOutputITS"); // LHC12e
2211 }
2212 dirMatch=(TDirectoryFile*)f->GetDirectory("SPD_Performance");
2213 if(dirMatch) listSPD = (TList*)dirMatch->Get("coutput1");
2214
2215 // if(!list) return kFALSE;
2216
2217 Float_t ioValues[30];
2218 Float_t ioErrors[30];
2219 for(Int_t jj=0;jj<30;jj++){
2220 ioValues[jj]=0.;
2221 ioErrors[jj]=0.;
2222 }
2223
2224 Float_t ptbin=0;
2225
2226 TH1F *hFiredChip = (TH1F*)listSPD->FindObject("hFiredChip");
2227
2228 if(hFiredChip->GetEntries()==0){
28d5818f 2229 printf("Run %d hFiredChip EMPTY -> Return\n",iRun);
2230 return;
579b5046 2231 }
2232
2233 Int_t nHSsInner=0,nHSsOuter=0;
2234 for(Int_t i=0;i<400;i++) if(hFiredChip->GetBinContent(i)>0) nHSsInner++;
2235 for(Int_t i=400;i<1200;i++) if(hFiredChip->GetBinContent(i)>0) nHSsOuter++;
2236 nHSsInner = (Int_t)(nHSsInner/10);
2237 nHSsOuter = (Int_t)(nHSsOuter/10);
2238 // hnHSsSPD->SetBinContent(1,nHSsInner);
2239 // hnHSsSPD->SetBinContent(2,nHSsOuter);
2240
2241 ioValues[0]=(Float_t)nHSsInner/40.;
2242 ioValues[1]=(Float_t)nHSsOuter/80.;
2243
2244 TH1F *fHistPtTPCInAcc = (TH1F*)list->FindObject("fHistPtTPCInAcc");
2245
2246 if(fHistPtTPCInAcc->GetEntries()==0){
28d5818f 2247 printf("Run %dfHistPtTPCInAcc EMPTY -> Return\n",iRun);
2248 return;
579b5046 2249 }
2250
2251 TH1F *fHistPtITSMI6InAcc = (TH1F*)list->FindObject("fHistPtITSMI6InAcc");
2252
2253 if(fHistPtITSMI6InAcc->GetEntries()==0){
28d5818f 2254 printf("Run %d fHistPtITSMI6InAcc EMPTY -> Return\n",iRun);
2255 return;
579b5046 2256 }
2257
2258 TH1F *fHistPtITSMI5InAcc = (TH1F*)list->FindObject("fHistPtITSMI5InAcc");
2259 if(fHistPtITSMI5InAcc->GetEntries()==0){
28d5818f 2260 printf("Run %d fHistPtITSMI5InAcc EMPTY -> Return\n",iRun);
2261 return;
579b5046 2262 }
2263
2264 TH1F *fHistPtITSMI4InAcc = (TH1F*)list->FindObject("fHistPtITSMI4InAcc");
2265 if(fHistPtITSMI5InAcc->GetEntries()==0){
28d5818f 2266 printf("Run %d fHistPtITSMI5InAcc EMPTY -> Return\n",iRun);
2267 return;
579b5046 2268 }
2269
2270 TH1F *fHistPtITSMI3InAcc = (TH1F*)list->FindObject("fHistPtITSMI3InAcc");
2271 if(fHistPtITSMI3InAcc->GetEntries()==0){
28d5818f 2272 printf("Run %d fHistPtITSMI3InAcc EMPTY -> Return\n",iRun);
2273 return;
579b5046 2274 }
2275 TH1F *fHistPtITSMI2InAcc = (TH1F*)list->FindObject("fHistPtITSMI2InAcc");
2276
2277 if(fHistPtITSMI2InAcc->GetEntries()==0){
28d5818f 2278 printf("Run %d fHistPtITSMI2InAcc EMPTY -> Return\n",iRun);
2279 return;
579b5046 2280 }
2281 TH1F *fHistPtITSMISPDInAcc = (TH1F*)list->FindObject("fHistPtITSMISPDInAcc");
2282 if(fHistPtITSMISPDInAcc->GetEntries()==0){
28d5818f 2283 printf("Run %d fHistPtITSMISPDInAcc EMPTY -> Return\n",iRun);
2284 return;
579b5046 2285 }
2286
2287 TH1F *fHistPtITSMIoneSPDInAcc = (TH1F*)list->FindObject("fHistPtITSMIoneSPDInAcc");
2288
2289 if(fHistPtITSMIoneSPDInAcc->GetEntries()==0){
28d5818f 2290 printf("Run %d fHistPtITSMIoneSPDInAcc EMPTY -> Return\n",iRun);
2291 return;
579b5046 2292 }
2293
2294 TH1F *fHistPtITSMIge2InAcc = (TH1F*)fHistPtITSMI6InAcc->Clone("fHistPtITSMIge2InAcc");
2295 fHistPtITSMIge2InAcc->Add(fHistPtITSMI5InAcc);
2296 fHistPtITSMIge2InAcc->Add(fHistPtITSMI4InAcc);
2297 fHistPtITSMIge2InAcc->Add(fHistPtITSMI3InAcc);
2298 fHistPtITSMIge2InAcc->Add(fHistPtITSMI2InAcc);
2299
2300
2301
2302 fHistPtITSMI6InAcc->Divide(fHistPtITSMI6InAcc,fHistPtTPCInAcc,1,1,"B");
2303 ptbin=fHistPtITSMI6InAcc->FindBin(0.201);
2304 ioValues[2]=fHistPtITSMI6InAcc->GetBinContent(ptbin);
2305 ioErrors[2]=fHistPtITSMI6InAcc->GetBinError(ptbin);
2306 ptbin=fHistPtITSMI6InAcc->FindBin(1.001);
2307 ioValues[3]=fHistPtITSMI6InAcc->GetBinContent(ptbin);
2308 ioErrors[3]=fHistPtITSMI6InAcc->GetBinError(ptbin);
2309 ptbin=fHistPtITSMI6InAcc->FindBin(10.001);
2310 ioValues[4]=fHistPtITSMI6InAcc->GetBinContent(ptbin);
2311 ioErrors[4]=fHistPtITSMI6InAcc->GetBinError(ptbin);
2312
2313 fHistPtITSMI5InAcc->Divide(fHistPtITSMI5InAcc,fHistPtTPCInAcc,1,1,"B");
2314
2315 ptbin=fHistPtITSMI5InAcc->FindBin(0.201);
2316 ioValues[5]=fHistPtITSMI5InAcc->GetBinContent(ptbin);
2317 ioErrors[5]=fHistPtITSMI5InAcc->GetBinError(ptbin);
2318 ptbin=fHistPtITSMI5InAcc->FindBin(1.001);
2319 ioValues[6]=fHistPtITSMI5InAcc->GetBinContent(ptbin);
2320 ioErrors[6]=fHistPtITSMI5InAcc->GetBinError(ptbin);
2321 ptbin=fHistPtITSMI5InAcc->FindBin(10.001);
2322 ioValues[7]=fHistPtITSMI5InAcc->GetBinContent(ptbin);
2323 ioErrors[7]=fHistPtITSMI5InAcc->GetBinError(ptbin);
2324
2325 fHistPtITSMI4InAcc->Divide(fHistPtITSMI4InAcc,fHistPtTPCInAcc,1,1,"B");
2326
2327 ptbin=fHistPtITSMI4InAcc->FindBin(0.201);
2328 ioValues[9]=fHistPtITSMI4InAcc->GetBinContent(ptbin);
2329 ioErrors[9]=fHistPtITSMI4InAcc->GetBinError(ptbin);
2330 ptbin=fHistPtITSMI4InAcc->FindBin(1.001);
2331 ioValues[10]=fHistPtITSMI4InAcc->GetBinContent(ptbin);
2332 ioErrors[10]=fHistPtITSMI4InAcc->GetBinError(ptbin);
2333 ptbin=fHistPtITSMI4InAcc->FindBin(10.001);
2334 ioValues[11]=fHistPtITSMI4InAcc->GetBinContent(ptbin);
2335 ioErrors[11]=fHistPtITSMI4InAcc->GetBinError(ptbin);
2336
2337 fHistPtITSMI3InAcc->Divide(fHistPtITSMI3InAcc,fHistPtTPCInAcc,1,1,"B");
2338
2339 ptbin=fHistPtITSMI3InAcc->FindBin(0.201);
2340 ioValues[12]=fHistPtITSMI3InAcc->GetBinContent(ptbin);
2341 ioErrors[12]=fHistPtITSMI3InAcc->GetBinError(ptbin);
2342 ptbin=fHistPtITSMI3InAcc->FindBin(1.001);
2343 ioValues[13]=fHistPtITSMI3InAcc->GetBinContent(ptbin);
2344 ioErrors[13]=fHistPtITSMI3InAcc->GetBinError(ptbin);
2345 ptbin=fHistPtITSMI3InAcc->FindBin(10.001);
2346 ioValues[14]=fHistPtITSMI3InAcc->GetBinContent(ptbin);
2347 ioErrors[14]=fHistPtITSMI3InAcc->GetBinError(ptbin);
2348
2349 fHistPtITSMI2InAcc->Divide(fHistPtITSMI2InAcc,fHistPtTPCInAcc,1,1,"B");
2350
2351 ptbin=fHistPtITSMI2InAcc->FindBin(0.201);
2352 ioValues[15]=fHistPtITSMI2InAcc->GetBinContent(ptbin);
2353 ioErrors[15]=fHistPtITSMI2InAcc->GetBinError(ptbin);
2354 ptbin=fHistPtITSMI2InAcc->FindBin(1.001);
2355 ioValues[16]=fHistPtITSMI2InAcc->GetBinContent(ptbin);
2356 ioErrors[16]=fHistPtITSMI2InAcc->GetBinError(ptbin);
2357 ptbin=fHistPtITSMI2InAcc->FindBin(10.001);
2358 ioValues[17]=fHistPtITSMI2InAcc->GetBinContent(ptbin);
2359 ioErrors[17]=fHistPtITSMI2InAcc->GetBinError(ptbin);
2360
2361 fHistPtITSMISPDInAcc->Divide(fHistPtITSMISPDInAcc,fHistPtTPCInAcc,1,1,"B");
2362 ptbin=fHistPtITSMISPDInAcc->FindBin(0.201);
2363 ioValues[18]=fHistPtITSMISPDInAcc->GetBinContent(ptbin);
2364 ioErrors[18]=fHistPtITSMISPDInAcc->GetBinError(ptbin);
2365 ptbin=fHistPtITSMISPDInAcc->FindBin(1.001);
2366 ioValues[19]=fHistPtITSMISPDInAcc->GetBinContent(ptbin);
2367 ioErrors[19]=fHistPtITSMISPDInAcc->GetBinError(ptbin);
2368 ptbin=fHistPtITSMISPDInAcc->FindBin(10.001);
2369 ioValues[20]=fHistPtITSMISPDInAcc->GetBinContent(ptbin);
2370 ioErrors[20]=fHistPtITSMISPDInAcc->GetBinError(ptbin);
2371
2372 fHistPtITSMIoneSPDInAcc->Divide(fHistPtITSMIoneSPDInAcc,fHistPtTPCInAcc,1,1,"B");
2373
2374 ptbin=fHistPtITSMIoneSPDInAcc->FindBin(0.201);
2375 ioValues[21]=fHistPtITSMIoneSPDInAcc->GetBinContent(ptbin);
2376 ioErrors[21]=fHistPtITSMIoneSPDInAcc->GetBinError(ptbin);
2377 ptbin=fHistPtITSMIoneSPDInAcc->FindBin(1.001);
2378 ioValues[22]=fHistPtITSMIoneSPDInAcc->GetBinContent(ptbin);
2379 ioErrors[22]=fHistPtITSMIoneSPDInAcc->GetBinError(ptbin);
2380 ptbin=fHistPtITSMIoneSPDInAcc->FindBin(10.001);
2381 ioValues[23]=fHistPtITSMIoneSPDInAcc->GetBinContent(ptbin);
2382 ioErrors[23]=fHistPtITSMIoneSPDInAcc->GetBinError(ptbin);
2383
2384
2385 fHistPtITSMIge2InAcc->Divide(fHistPtITSMIge2InAcc,fHistPtTPCInAcc,1,1,"B");
2386 ptbin=fHistPtITSMIge2InAcc->FindBin(0.201);
2387 ioValues[24]=fHistPtITSMIge2InAcc->GetBinContent(ptbin);
2388 ioErrors[24]=fHistPtITSMIge2InAcc->GetBinError(ptbin);
2389 ptbin=fHistPtITSMIge2InAcc->FindBin(1.001);
2390 ioValues[25]=fHistPtITSMIge2InAcc->GetBinContent(ptbin);
2391 ioErrors[25]=fHistPtITSMIge2InAcc->GetBinError(ptbin);
2392 ptbin=fHistPtITSMIge2InAcc->FindBin(10.001);
2393 ioValues[26]=fHistPtITSMIge2InAcc->GetBinContent(ptbin);
2394 ioErrors[26]=fHistPtITSMIge2InAcc->GetBinError(ptbin);
2395
2396 Int_t indexMatching=0;
2397 xntMatching[indexMatching++]=iRun;
2398 xntMatching[indexMatching++]=ioValues[0];
2399 xntMatching[indexMatching++]=ioErrors[0];
2400 xntMatching[indexMatching++]=ioValues[1];
2401 xntMatching[indexMatching++]=ioErrors[1];
2402 xntMatching[indexMatching++]=ioValues[2];
2403 xntMatching[indexMatching++]=ioErrors[2];
2404 xntMatching[indexMatching++]=ioValues[3];
2405 xntMatching[indexMatching++]=ioErrors[3];
2406 xntMatching[indexMatching++]=ioValues[4];
2407 xntMatching[indexMatching++]=ioErrors[4];
2408 xntMatching[indexMatching++]=ioValues[5];
2409 xntMatching[indexMatching++]=ioErrors[5];
2410 xntMatching[indexMatching++]=ioValues[6];
2411 xntMatching[indexMatching++]=ioErrors[6];
2412 xntMatching[indexMatching++]=ioValues[7];
2413 xntMatching[indexMatching++]=ioErrors[7];
2414 xntMatching[indexMatching++]=ioValues[8];
2415 xntMatching[indexMatching++]=ioErrors[8];
2416 xntMatching[indexMatching++]=ioValues[9];
2417 xntMatching[indexMatching++]=ioErrors[9];
2418 xntMatching[indexMatching++]=ioValues[10];
2419 xntMatching[indexMatching++]=ioErrors[10];
2420 xntMatching[indexMatching++]=ioValues[11];
2421 xntMatching[indexMatching++]=ioErrors[11];
2422 xntMatching[indexMatching++]=ioValues[12];
2423 xntMatching[indexMatching++]=ioErrors[12];
2424 xntMatching[indexMatching++]=ioValues[13];
2425 xntMatching[indexMatching++]=ioErrors[13];
2426 xntMatching[indexMatching++]=ioValues[14];
2427 xntMatching[indexMatching++]=ioErrors[14];
2428 xntMatching[indexMatching++]=ioValues[15];
2429 xntMatching[indexMatching++]=ioErrors[15];
2430 xntMatching[indexMatching++]=ioValues[16];
2431 xntMatching[indexMatching++]=ioErrors[16];
2432 xntMatching[indexMatching++]=ioValues[17];
2433 xntMatching[indexMatching++]=ioErrors[17];
2434 xntMatching[indexMatching++]=ioValues[18];
2435 xntMatching[indexMatching++]=ioErrors[18];
2436 xntMatching[indexMatching++]=ioValues[19];
2437 xntMatching[indexMatching++]=ioErrors[19];
2438 xntMatching[indexMatching++]=ioValues[20];
2439 xntMatching[indexMatching++]=ioErrors[20];
2440 xntMatching[indexMatching++]=ioValues[21];
2441 xntMatching[indexMatching++]=ioErrors[21];
2442 xntMatching[indexMatching++]=ioValues[22];
2443 xntMatching[indexMatching++]=ioErrors[22];
2444 xntMatching[indexMatching++]=ioValues[23];
2445 xntMatching[indexMatching++]=ioErrors[23];
2446 xntMatching[indexMatching++]=ioValues[24];
2447 xntMatching[indexMatching++]=ioErrors[24];
2448 xntMatching[indexMatching++]=ioValues[25];
2449 xntMatching[indexMatching++]=ioErrors[25];
2450 xntMatching[indexMatching++]=ioValues[26];
2451 xntMatching[indexMatching++]=ioErrors[26];
2452
2453 ntmatching->Fill(xntMatching);
28d5818f 2454}
579b5046 2455
28d5818f 2456//_____________________________________________________________________________
2457void FillVTXntuple(TFile* f,TNtuple* ntvertex, Int_t iRun, Float_t *xntVertex){
2458 cout<<"Primary Vertex"<<endl;
579b5046 2459
2460 TDirectoryFile *dirVertex = (TDirectoryFile*)f->Get("Vertex_Performance");
2461 if(!dirVertex){
2462 Printf("Vertex directory not found... check!");
2463 }
2464
2465 TList *lt = (TList*)dirVertex->Get("cOutputVtxESD");
2466
2467 TH1F *xVtxTRK = (TH1F*)lt->FindObject("fhTRKVertexX");
2468
2469 if(xVtxTRK->GetEntries()==0){
28d5818f 2470 printf("Run %d xVtxTRK EMPTY -> Return\n",iRun);
2471 return;
579b5046 2472 }
2473
2474 TH1F *yVtxTRK = (TH1F*)lt->FindObject("fhTRKVertexY");
2475
2476 if(yVtxTRK->GetEntries()==0){
28d5818f 2477 printf("Run %d yVtxTRK EMPTY -> Return\n",iRun);
2478 return;
579b5046 2479 }
2480
2481 TH1F *zVtxTRK = (TH1F*)lt->FindObject("fhTRKVertexZ");
2482
2483 if(zVtxTRK->GetEntries()==0){
28d5818f 2484 printf("Run %d zVtxTRK EMPTY -> Return\n",iRun);
2485 return;
579b5046 2486 }
2487
2488 TH1F *xVtxSPD = (TH1F*)lt->FindObject("fhSPDVertexX");
2489
2490 if(xVtxSPD->GetEntries()==0){
28d5818f 2491 printf("Run %d xVtxSOD EMPTY -> Return\n",iRun);
2492 return;
579b5046 2493 }
2494
2495 TH1F *yVtxSPD = (TH1F*)lt->FindObject("fhSPDVertexY");
2496
2497 if(yVtxSPD->GetEntries()==0){
28d5818f 2498 printf("Run %d yVtxSPD EMPTY -> Return\n",iRun);
2499 return;
579b5046 2500 }
2501
2502 TH1F *zVtxSPD = (TH1F*)lt->FindObject("fhSPDVertexZ");
2503
2504 if(zVtxSPD->GetEntries()==0){
28d5818f 2505 printf("Run %d zVtxSPD EMPTY -> Return\n",iRun);
2506 return;
579b5046 2507 }
2508
2509 TF1 *fxTRK = new TF1("gausx", "gaus", -1, 1);
2510 xVtxTRK->Fit("gausx", "NQRL");
2511
2512 TF1 *fyTRK = new TF1("gausy", "gaus", -1, 1);
2513 yVtxTRK->Fit("gausy","NQLR");
2514// cout<<fyTRK->GetParameter(1)<<endl;
2515// cout<<fyTRK->GetParError(1)<<endl;
2516// cout<<fyTRK->GetParameter(2)<<endl;
2517// cout<<fyTRK->GetParError(2)<<endl;
2518
2519 TF1 *fzTRK = new TF1("gausz", "gaus", -1, 1);
2520 zVtxTRK->Fit("gausz","NQRL");
2521 TF1 *fxSPD = new TF1("gausxSPD", "gaus", -1, 1);
2522 xVtxSPD->Fit("gausxSPD", "NQRL");
2523
2524 TF1 *fySPD = new TF1("gausySPD", "gaus", -1, 1);
2525 yVtxSPD->Fit("gausySPD","NQLR");
2526// cout<<fyTRK->GetParameter(1)<<endl;
2527// cout<<fyTRK->GetParError(1)<<endl;
2528// cout<<fyTRK->GetParameter(2)<<endl;
2529// cout<<fyTRK->GetParError(2)<<endl;
2530
2531 TF1 *fzSPD = new TF1("gauszSPD", "gaus", -1, 1);
2532 zVtxSPD->Fit("gauszSPD","NQRL");
2533// cout<<fzTRK->GetParameter(1)<<endl;
2534// cout<<fzTRK->GetParError(1)<<endl;
2535// cout<<fzTRK->GetParameter(2)<<endl;
2536// cout<<fzTRK->GetParError(2)<<endl;
2537
2538
2539 Int_t indexVertex=0;
2540 xntVertex[indexVertex++]=iRun;
2541 xntVertex[indexVertex++]=(Float_t)fxTRK->GetParameter(1);
2542 xntVertex[indexVertex++]=(Float_t)fxTRK->GetParError(1);
2543 xntVertex[indexVertex++]=(Float_t)fxTRK->GetParameter(2);
2544 xntVertex[indexVertex++]=(Float_t)fxTRK->GetParError(2);
2545 xntVertex[indexVertex++]=(Float_t)fyTRK->GetParameter(1);
2546 xntVertex[indexVertex++]=(Float_t)fyTRK->GetParError(1);
2547 xntVertex[indexVertex++]=(Float_t)fyTRK->GetParameter(2);
2548 xntVertex[indexVertex++]=(Float_t)fyTRK->GetParError(2);
2549 xntVertex[indexVertex++]=(Float_t)fzTRK->GetParameter(1);
2550 xntVertex[indexVertex++]=(Float_t)fzTRK->GetParError(1);
2551 xntVertex[indexVertex++]=(Float_t)fzTRK->GetParameter(2);
2552 xntVertex[indexVertex++]=(Float_t)fzTRK->GetParError(2);
28d5818f 2553 xntVertex[indexVertex++]=(Float_t)fxSPD->GetParameter(1);
579b5046 2554 xntVertex[indexVertex++]=(Float_t)fxSPD->GetParError(1);
2555 xntVertex[indexVertex++]=(Float_t)fxSPD->GetParameter(2);
2556 xntVertex[indexVertex++]=(Float_t)fxSPD->GetParError(2);
2557 xntVertex[indexVertex++]=(Float_t)fySPD->GetParameter(1);
2558 xntVertex[indexVertex++]=(Float_t)fySPD->GetParError(1);
2559 xntVertex[indexVertex++]=(Float_t)fySPD->GetParameter(2);
2560 xntVertex[indexVertex++]=(Float_t)fySPD->GetParError(2);
2561 xntVertex[indexVertex++]=(Float_t)fzSPD->GetParameter(1);
2562 xntVertex[indexVertex++]=(Float_t)fzSPD->GetParError(1);
2563 xntVertex[indexVertex++]=(Float_t)fzSPD->GetParameter(2);
2564 xntVertex[indexVertex++]=(Float_t)fzSPD->GetParError(2);
2565 ntvertex->Fill(xntVertex);
2566
579b5046 2567}
2568
28d5818f 2569//_____________________________________________________________________________
579b5046 2570Double_t LangausFun(Double_t *x, Double_t *par) {
2571
2572 //Fit parameters:
2573 //par[0]=Width (scale) parameter of Landau density
2574 //par[1]=Most Probable (MP, location) parameter of Landau density
2575 //par[2]=Total area (integral -inf to inf, normalization constant)
2576 //par[3]=Width (sigma) of convoluted Gaussian function
2577 //
2578 //In the Landau distribution (represented by the CERNLIB approximation),
2579 //the maximum is located at x=-0.22278298 with the location parameter=0.
2580 //This shift is corrected within this function, so that the actual
2581 //maximum is identical to the MP parameter.
2582
2583 // Numeric constants
2584 Double_t invsq2pi = 0.3989422804014; // (2 pi)^(-1/2)
2585 Double_t mpshift = -0.22278298; // Landau maximum location
2586
2587 // Control constants
2588 Double_t np = 100.0; // number of convolution steps
2589 Double_t sc = 5.0; // convolution extends to +-sc Gaussian sigmas
2590
2591 // Variables
2592 Double_t xx;
2593 Double_t mpc;
2594 Double_t fland;
2595 Double_t sum = 0.0;
2596 Double_t xlow,xupp;
2597 Double_t step;
2598 Double_t i;
2599
2600
2601 // MP shift correction
2602 mpc = par[1] - mpshift * par[0];
2603
2604 // Range of convolution integral
2605 xlow = x[0] - sc * par[3];
2606 xupp = x[0] + sc * par[3];
2607
2608 step = (xupp-xlow) / np;
2609
2610 // Convolution integral of Landau and Gaussian by sum
2611 for(i=1.0; i<=np/2; i++) {
2612 xx = xlow + (i-.5) * step;
2613 fland = TMath::Landau(xx,mpc,par[0]) / par[0];
2614 sum += fland * TMath::Gaus(x[0],xx,par[3]);
2615
2616 xx = xupp - (i-.5) * step;
2617 fland = TMath::Landau(xx,mpc,par[0]) / par[0];
2618 sum += fland * TMath::Gaus(x[0],xx,par[3]);
2619 }
2620
2621 return (par[2] * step * sum * invsq2pi / par[3]);
2622}
2623
2624Bool_t WriteInputTextFileFromMonalisaListOfRuns(TString outtxtfilename,Int_t* listofrunsfromMonalisa,Int_t nruns,TString pathbeforRunN,TString pathafterRunN){
2625
2626 // e.g. Int_t listofrunsfromMonalisa[3]={1111,2222,3333,4444}. Copy&paste the list of run given in Monalisa! http://alimonitor.cern.ch/raw/raw_details.jsp?timesel=0&filter_jobtype=LHC+period+LHC12c+-+CPass1+%28reconstruction%29#
2627
2628 ofstream outfile;
2629 outfile.open(outtxtfilename.Data());
2630 cout<<"Writing..."<<endl;
2631 for(Int_t i=0;i<nruns;i++){
2632 outfile<<pathbeforRunN.Data()<<"000"<<listofrunsfromMonalisa[i]<<"/"<<pathafterRunN.Data()<<endl;
2633 cout<<pathbeforRunN.Data()<<"000"<<listofrunsfromMonalisa[i]<<"/"<<pathafterRunN.Data()<<endl;
2634 }
2635
2636 cout<<"Done"<<endl;
2637 outfile.close();
2638 return kTRUE;
2639}
2640
28d5818f 2641//______________________________________________________________________
2642Int_t RunsToPlot(Int_t run1, Int_t run2,Int_t nr,Int_t *noRuns, Int_t *myIndex){
2643 // Sort entries according to run number in the chosen range
2644 Int_t kRunsToPlot=0;
2645 printf("Processing runs from %d up to %d\n",run1,run2);
2646 for(Int_t i=0; i<nr;i++){
2647 printf("Run %d\n",noRuns[i]);
2648 if(noRuns[i]>=run1 && noRuns[i]<=run2){
2649 printf("Accepting run number %d in position %d\n",noRuns[i],kRunsToPlot);
2650 kRunsToPlot++;
2651 }
2652 else {
2653 printf("Rejecting run number %d - out of range\n",noRuns[i]);
2654 noRuns[i]=run2+10;
2655 }
2656 }
2657 TMath::Sort(nr,noRuns,myIndex,kFALSE);
2658 printf("Total number of runs accepted fot display %d\n",kRunsToPlot);
2659 if(kRunsToPlot==0)return 0;
2660 for(Int_t i=0;i<kRunsToPlot;i++)printf("Position %d ) Run: %d\n",i,noRuns[myIndex[i]]);
2661 return kRunsToPlot;
2662}
2663