]>
Commit | Line | Data |
---|---|---|
6c125480 | 1 | /* |
2722289c | 2 | fbellini@cern.ch, last update on 09/01/2015 |
3 | - cleanup and fixes for graphics | |
4 | Previous history: | |
5 | - added average multi vs. run number trending plot | |
6 | - added flag for displaying reduced n. of trending plots | |
7 | - now producing tree run by run | |
8 | - new method to produce trending plots from list of trees | |
6c125480 | 9 | */ |
10 | ||
add3c004 | 11 | Int_t MakeTrendingTOFQA(char * runlist, Int_t year=2012, char *period="LHC12a", char* pass="cpass1", char* nameSuffix ="_barrel",Bool_t isMC=kTRUE, Int_t trainId=0, Bool_t displayAll=kTRUE, Bool_t includeStartTime=kTRUE){ |
2722289c | 12 | Int_t filesCounter=0; |
3d9550f8 | 13 | |
2722289c | 14 | if (!runlist) { |
15 | printf("Invalid list of runs given as input: nothing done\n"); | |
16 | return 1; | |
17 | } | |
18 | Int_t runNumber; | |
19 | char infile[300]; | |
20 | char postFileName[20]; | |
21 | char treePostFileName[20]; | |
3d9550f8 | 22 | |
2722289c | 23 | char trendFileName[100]; |
24 | //Define trending output | |
25 | if (trainId==0){ | |
26 | sprintf(trendFileName,"treeTOFQA_%s_%s.root",period,pass); | |
27 | }else{ | |
28 | sprintf(trendFileName,"treeTOFQA_QA%i_%s_%s.root",trainId,period,pass); | |
29 | } | |
30 | TFile * trendFile=new TFile(trendFileName,"recreate"); | |
31 | FILE * files = fopen(runlist, "r") ; | |
32 | ||
33 | //create chain of treePostQA | |
34 | Long64_t nentries=100000, firstentry=0; | |
35 | TChain *chainTree = 0; | |
36 | chainTree=new TChain("trendTree"); | |
6c125480 | 37 | |
2722289c | 38 | while (fscanf(files,"%d",&runNumber)==1 ){ |
6c125480 | 39 | |
2722289c | 40 | //get QAtrain output |
41 | if (trainId==0){ | |
42 | if (!isMC) sprintf(infile,"alien:///alice/data/%i/%s/000%d/%s/QAresults%s.root",year,period,runNumber,pass,nameSuffix); | |
43 | else sprintf(infile,"alien:///alice/sim/%i/%s/%d/QAresults%s.root",year,period,runNumber,nameSuffix); | |
44 | } else{ | |
45 | if (!isMC) sprintf(infile,"alien:///alice/data/%i/%s/000%d/ESDs/%s/QA%i/QAresults%s.root",year,period,runNumber,pass,trainId,nameSuffix); | |
46 | else sprintf(infile,"alien:///alice/sim/%i/%s/%d/QA%i/QAresults%s.root",year,period,runNumber,trainId,nameSuffix); | |
47 | } | |
48 | ||
49 | Printf("============== Opening QA file(s) for run %i =======================\n",runNumber); | |
6c125480 | 50 | |
2722289c | 51 | //run post-analysis |
52 | if (RunESDQApostAnalysis(infile,runNumber,isMC,kTRUE,displayAll,includeStartTime)==0){ | |
53 | filesCounter++; | |
54 | sprintf(postFileName,"postQA_%i.root",runNumber); | |
55 | sprintf(treePostFileName,"treePostQA_%i.root",runNumber); | |
6c125480 | 56 | |
2722289c | 57 | if (MakePostQAtree(runNumber, isMC, postFileName, treePostFileName, includeStartTime)==0){ |
58 | chainTree->Add(treePostFileName); | |
59 | Printf("Tree chain has now %d entries ",(Int_t)chainTree->GetEntries()); | |
60 | } else { | |
61 | Printf("Could not get tree with trending quantities for run %i: SKIPPING",runNumber); | |
62 | } | |
63 | } else | |
64 | Printf("Post analysis not run on QA output %s", infile); | |
65 | } | |
66 | return MakeTrendingFromTreeWithErrors(chainTree, trendFileName, displayAll, includeStartTime); | |
6c125480 | 67 | } |
68 | //----------------------------------------------------------- | |
add3c004 | 69 | Int_t MakeTrendingHistoFromTreeList(char * fileList, TString treeName = "trendTree", Bool_t displayAll=kFALSE, Bool_t includeStartTime=kTRUE){ |
7cc410ff | 70 | |
2722289c | 71 | Int_t filesCounter=0; |
3d9550f8 | 72 | |
2722289c | 73 | if (!fileList) { |
74 | printf("Invalid list of runs given as input: nothing done\n"); | |
75 | return 1; | |
76 | } | |
77 | char infile[300]; | |
78 | char trendFileName[100]; | |
79 | //Define trending output | |
80 | sprintf(trendFileName,"trendingHistoTOFQA_%s.root",fileList); | |
81 | TFile * trendFile=new TFile(trendFileName,"recreate"); | |
82 | FILE * files = fopen(fileList, "r") ; | |
83 | ||
84 | //create chain of treePostQA | |
85 | Long64_t nentries=100000, firstentry=0; | |
86 | TChain *chainTree =new TChain(treeName.Data()); | |
3d9550f8 | 87 | |
2722289c | 88 | while (fscanf(files,"%s",&infile)==1 ){ |
89 | if (!TFile::Open(infile,"r")) | |
90 | Printf("Error: cannot open file %s", infile); | |
91 | Printf("============== Adding QA tree file %s to the chain",infile); | |
92 | filesCounter++; | |
93 | chainTree->Add(infile); | |
94 | } | |
95 | return MakeTrendingFromTreeWithErrors(chainTree, trendFileName, displayAll, includeStartTime); | |
3d9550f8 | 96 | } |
97 | ||
98 | //______________________________________________________________________________ | |
add3c004 | 99 | Int_t MakeTrendingFromTreeWithErrors(TChain * fin,char* trendFileName=NULL, Bool_t displayAll=kFALSE, Bool_t includeStartTime=kTRUE){ |
3d9550f8 | 100 | |
2722289c | 101 | if (!trendFileName) |
102 | return 3; | |
6c125480 | 103 | |
2722289c | 104 | if (!fin) |
105 | return 4; | |
106 | ||
107 | Int_t runNumber; | |
108 | Double_t avTime=0., peakTime=0., spreadTime=0., peakTimeErr=0., spreadTimeErr=0.,negTimeRatio=0., | |
109 | avRawTime=0., peakRawTime=0., spreadRawTime=0., peakRawTimeErr=0., spreadRawTimeErr=0., | |
110 | avTot=0., peakTot=0.,spreadTot=0., peakTotErr=0.,spreadTotErr=0., | |
111 | orphansRatio=0., avL=0., negLratio=0., | |
112 | effPt1=0., effPt2=0., matchEffLinFit1Gev=0.,matchEffLinFit1GevErr=0.; | |
113 | Double_t avDiffTime=0.,peakDiffTime=0., spreadDiffTime=0.,peakDiffTimeErr=0., spreadDiffTimeErr=0.,avT0fillRes=0.; | |
3d9550f8 | 114 | |
2722289c | 115 | Double_t avT0A=0.,peakT0A=0., spreadT0A=0.,peakT0AErr=0., spreadT0AErr=0.; |
116 | Double_t avT0C=0.,peakT0C=0., spreadT0C=0.,peakT0CErr=0., spreadT0CErr=0.; | |
117 | Double_t avT0AC=0.,peakT0AC=0., spreadT0AC=0.,peakT0ACErr=0., spreadT0ACErr=0.; | |
118 | Double_t avT0res=0.,peakT0res=0., spreadT0res=0.,peakT0resErr=0., spreadT0resErr=0.; | |
119 | Float_t avMulti=0; | |
120 | Float_t fractionEventsWHits=0.0; | |
121 | Double_t goodChannelRatio=0.0; | |
3d9550f8 | 122 | |
2722289c | 123 | TTree * ttree = (TTree*) fin->CloneTree(); |
124 | ttree->SetBranchAddress("run",&runNumber); | |
125 | ttree->SetBranchAddress("avMulti",&avMulti); | |
126 | ttree->SetBranchAddress("goodChannelsRatio",&goodChannelRatio); | |
127 | ttree->SetBranchAddress("avTime",&avTime); //mean time | |
128 | ttree->SetBranchAddress("peakTime",&peakTime); //main peak time after fit | |
129 | ttree->SetBranchAddress("spreadTime",&spreadTime); //spread of main peak of time after fit | |
130 | ttree->SetBranchAddress("peakTimeErr",&peakTimeErr); //main peak time after fit error | |
131 | ttree->SetBranchAddress("spreadTimeErr",&spreadTimeErr); //spread of main peak of time after fit error | |
3d9550f8 | 132 | |
2722289c | 133 | ttree->SetBranchAddress("negTimeRatio",&negTimeRatio); //negative time ratio |
3d9550f8 | 134 | |
2722289c | 135 | ttree->SetBranchAddress("avRawTime",&avRawTime); //mean raw time |
136 | ttree->SetBranchAddress("peakRawTime",&peakRawTime); //mean peak of raw time after fit | |
137 | ttree->SetBranchAddress("spreadRawTime",&spreadRawTime); //spread of main peak of raw time after fit | |
138 | ttree->SetBranchAddress("peakRawTimeErr",&peakRawTimeErr); //main peak raw time after fit error | |
139 | ttree->SetBranchAddress("spreadRawTimeErr",&spreadRawTimeErr); //spread of raw main peak of time after fit error | |
3d9550f8 | 140 | |
2722289c | 141 | ttree->SetBranchAddress("avTot",&avTot); //main peak tot |
142 | ttree->SetBranchAddress("peakTot",&peakTot); // main peak of tot after fit | |
143 | ttree->SetBranchAddress("spreadTot",&spreadTot); //spread of main peak of tot after fit | |
144 | ttree->SetBranchAddress("peakTotErr",&peakTotErr); // main peak of tot after fit | |
145 | ttree->SetBranchAddress("spreadTotErr",&spreadTotErr); //spread of main peak of tot after fit | |
3d9550f8 | 146 | |
2722289c | 147 | ttree->SetBranchAddress("orphansRatio",&orphansRatio); //orphans ratio |
3d9550f8 | 148 | |
2722289c | 149 | ttree->SetBranchAddress("avL",&avL); //mean track length |
150 | ttree->SetBranchAddress("negLratio",&negLratio);//ratio of tracks with track length <350 cm | |
3d9550f8 | 151 | |
2722289c | 152 | ttree->SetBranchAddress("effPt1",&effPt1);//matching eff at 1 GeV/c |
153 | ttree->SetBranchAddress("effPt2",&effPt2); //matching eff at 2 GeV/c | |
154 | ttree->SetBranchAddress("matchEffLinFit1Gev",&matchEffLinFit1Gev);//matching eff fit param | |
155 | ttree->SetBranchAddress("matchEffLinFit1GevErr",&matchEffLinFit1GevErr);////matching eff fit param error | |
3d9550f8 | 156 | |
2722289c | 157 | ttree->SetBranchAddress("avPiDiffTime",&avDiffTime); //mean t-texp |
158 | ttree->SetBranchAddress("peakPiDiffTime",&peakDiffTime); //main peak t-texp after fit | |
159 | ttree->SetBranchAddress("spreadPiDiffTime",&spreadDiffTime); //spread of main peak t-texp after fit | |
160 | ttree->SetBranchAddress("peakPiDiffTimeErr",&peakDiffTimeErr); //main peak t-texp after fit error | |
161 | ttree->SetBranchAddress("spreadPiDiffTimeErr",&spreadDiffTimeErr); //spread of main peak of t-texp after fit error | |
3d9550f8 | 162 | |
2722289c | 163 | ttree->SetBranchAddress("avT0A",&avT0A); //main peak t0A |
164 | ttree->SetBranchAddress("peakT0A",&peakT0A); // main peak of t0A after fit | |
165 | ttree->SetBranchAddress("spreadT0A",&spreadT0A); //spread of main peak of t0A after fit | |
166 | ttree->SetBranchAddress("peakT0AErr",&peakT0AErr); // main peak of t0A after fit | |
167 | ttree->SetBranchAddress("spreadT0AErr",&spreadT0AErr); //spread of main peak of t0A after fit | |
3d9550f8 | 168 | |
2722289c | 169 | ttree->SetBranchAddress("avT0C",&avT0C); //main peak t0C |
170 | ttree->SetBranchAddress("peakT0C",&peakT0C); // main peak of t0C after fit | |
171 | ttree->SetBranchAddress("spreadT0C",&spreadT0C); //spread of main peak of t0C after fit | |
172 | ttree->SetBranchAddress("peakT0CErr",&peakT0CErr); // main peak of t0C after fit | |
173 | ttree->SetBranchAddress("spreadT0CErr",&spreadT0CErr); //spread of main peak of t0C after fit | |
3d9550f8 | 174 | |
2722289c | 175 | ttree->SetBranchAddress("avT0AC",&avT0AC); //main peak t0AC |
176 | ttree->SetBranchAddress("peakT0AC",&peakT0AC); // main peak of t0AC after fit | |
177 | ttree->SetBranchAddress("spreadT0AC",&spreadT0AC); //spread of main peak of t0AC after fit | |
178 | ttree->SetBranchAddress("peakT0ACErr",&peakT0ACErr); // main peak of t0AC after fit | |
179 | ttree->SetBranchAddress("spreadT0ACErr",&spreadT0ACErr); //spread of main peak of t0AC after fit | |
3d9550f8 | 180 | |
2722289c | 181 | ttree->SetBranchAddress("avT0res",&avT0res); //main peak t0AC |
182 | ttree->SetBranchAddress("peakT0res",&peakT0res); // main peak of t0AC after fit | |
183 | ttree->SetBranchAddress("spreadT0res",&spreadT0res); //spread of main peak of t0AC after fit | |
184 | ttree->SetBranchAddress("peakT0resErr",&peakT0resErr); // main peak of t0AC after fit | |
185 | ttree->SetBranchAddress("spreadT0resErr",&spreadT0resErr); //spread of main peak of t0AC after fit | |
186 | ttree->SetBranchAddress("avT0fillRes",&avT0fillRes); //t0 fill res | |
187 | ||
188 | Int_t nRuns=ttree->GetEntries(); | |
189 | TList lista; | |
3d9550f8 | 190 | |
2722289c | 191 | TH1F * hAvMulti=new TH1F("hAvMulti","Average multiplicity of matched tracks <N_{TOF}>;; <N_{TOF}>", nRuns,0., nRuns);//, 600, 0. , 600.); |
192 | hAvMulti->SetDrawOption("E1"); | |
193 | hAvMulti->SetMarkerStyle(20); | |
194 | hAvMulti->SetMarkerColor(kBlue); | |
ce9b04c5 | 195 | |
2722289c | 196 | TH1F * hAvDiffTimeVsRun=new TH1F("hAvDiffTimeVsRun","Mean t-t_{exp} (no fit);run;<t^{TOF}-t_{exp,#pi}> (ps)",nRuns,0., nRuns);//, 600, 0. , 600.); |
197 | hAvDiffTimeVsRun->SetDrawOption("E1"); | |
198 | hAvDiffTimeVsRun->SetMarkerStyle(20); | |
199 | hAvDiffTimeVsRun->SetMarkerColor(kBlue); | |
200 | // hAvTimeVsRun->GetYaxis()->SetRangeUser(0.0, 50.0); | |
201 | ||
202 | TH1F * hPeakDiffTimeVsRun=new TH1F("hPeakDiffTimeVsRun","t-t_{exp} (gaussian fit) ;; <t^{TOF}-t_{exp,#pi}> (ps)",nRuns,0., nRuns);//,600, 0. , 600. ); | |
203 | hPeakDiffTimeVsRun->SetDrawOption("E1"); | |
204 | hPeakDiffTimeVsRun->SetMarkerStyle(20); | |
205 | hPeakDiffTimeVsRun->SetMarkerColor(kBlue); | |
3d9550f8 | 206 | |
2722289c | 207 | TH1F * hSpreadDiffTimeVsRun=new TH1F("hSpreadDiffTimeVsRun","#sigma(t-t_{exp}) (gaussian fit);; #sigma(t^{TOF}-t_{exp,#pi}) (ns)",nRuns,0., nRuns);//, 100, 0. , 100.); |
208 | hSpreadDiffTimeVsRun->SetDrawOption("E1"); | |
209 | hSpreadDiffTimeVsRun->SetMarkerStyle(20); | |
210 | hSpreadDiffTimeVsRun->SetMarkerColor(kBlue); | |
211 | ||
212 | TH1F * hAvTimeVsRun=new TH1F("hAvTimeVsRun","<t^{TOF}>;;<t^{TOF}> (ns)",nRuns,0., nRuns);//, 600, 0. , 600.); | |
213 | hAvTimeVsRun->SetDrawOption("E1"); | |
214 | hAvTimeVsRun->SetMarkerStyle(20); | |
215 | hAvTimeVsRun->SetMarkerColor(kBlue); | |
216 | // hAvTimeVsRun->GetYaxis()->SetRangeUser(0.0, 50.0); | |
217 | ||
218 | TH1F * hPeakTimeVsRun=new TH1F("hPeakTimeVsRun","Peak value of t^{TOF} (landau fit);;t_{peak}^{TOF} (ns)",nRuns,0., nRuns);//,600, 0. , 600. ); | |
219 | hPeakTimeVsRun->SetDrawOption("E1"); | |
220 | hPeakTimeVsRun->SetMarkerStyle(20); | |
221 | hPeakTimeVsRun->SetMarkerColor(kBlue); | |
3d9550f8 | 222 | |
2722289c | 223 | TH1F * hSpreadTimeVsRun=new TH1F("hSpreadTimeVsRun","Spread of t^{TOF} (landau fit);; #sigma(t^{TOF}) (ns)",nRuns,0., nRuns);//, 100, 0. , 100.); |
224 | hSpreadTimeVsRun->SetDrawOption("E1"); | |
225 | hSpreadTimeVsRun->SetMarkerStyle(20); | |
226 | hSpreadTimeVsRun->SetMarkerColor(kBlue); | |
3d9550f8 | 227 | |
2722289c | 228 | TH1F * hAvRawTimeVsRun=new TH1F("hAvRawTimeVsRun","Peak value of raw t^{TOF};;<t_{raw}^{TOF}> (ns)",nRuns,0., nRuns);//, 600, 0. , 600.); |
229 | hAvRawTimeVsRun->SetDrawOption("E1"); | |
230 | hAvRawTimeVsRun->SetMarkerStyle(21); | |
231 | hAvRawTimeVsRun->SetMarkerColor(kGreen); | |
232 | ||
233 | TH1F * hPeakRawTimeVsRun=new TH1F("hPeakRawTimeVsRun","Peak value of raw t^{TOF} (landau fit);;t_{peak,raw}^{TOF} (ns)",nRuns,0., nRuns);//, 600, 0. , 600.); | |
234 | hPeakRawTimeVsRun->SetDrawOption("E1"); | |
235 | hPeakRawTimeVsRun->SetMarkerStyle(21); | |
236 | hPeakRawTimeVsRun->SetMarkerColor(kGreen); | |
237 | ||
238 | TH1F * hSpreadRawTimeVsRun=new TH1F("hSpreadRawTimeVsRun","Spread of raw t^{TOF} (landau fit);;#sigma(t_{raw}^{TOF}) (ns)",nRuns,0., nRuns);//, 100, 0. , 100.); | |
239 | hSpreadRawTimeVsRun->SetDrawOption("E1"); | |
240 | hSpreadRawTimeVsRun->SetMarkerStyle(21); | |
241 | hSpreadRawTimeVsRun->SetMarkerColor(kGreen); | |
3d9550f8 | 242 | |
2722289c | 243 | TH1F * hAvTotVsRun=new TH1F("hAvTotVsRun","<ToT> (no fit);run;<ToT> (ns)",nRuns,0., nRuns);//, 50, 0. , 50.); |
244 | hAvTotVsRun->SetDrawOption("E1"); | |
245 | hAvTotVsRun->SetMarkerStyle(22); | |
3d9550f8 | 246 | |
2722289c | 247 | TH1F * hPeakTotVsRun=new TH1F("hPeakTotVsRun","<ToT> (gaussian fit);;ToT_{peak} (ns)",nRuns,0., nRuns);//, 50, 0. , 50.); |
248 | hPeakTotVsRun->SetDrawOption("E1"); | |
249 | hPeakTotVsRun->SetMarkerStyle(22); | |
3d9550f8 | 250 | |
2722289c | 251 | TH1F * hSpreadTotVsRun=new TH1F("hSpreadTotVsRun","#sigma(ToT) (gaussian fit);#sigma(ToT) (ns)",nRuns,0., nRuns);//, 50, 0. , 50.); |
252 | hSpreadTotVsRun->SetDrawOption("E1"); | |
253 | hSpreadTotVsRun->SetMarkerStyle(22); | |
3d9550f8 | 254 | |
2722289c | 255 | TH1F * hNegTimeRatioVsRun=new TH1F("hNegTimeRatioVsRun","Ratio of tracks with t^{TOF}<12.5 ns; ; ratio of tracks with t^{TOF}<12.5 ns (%)",nRuns, 0., nRuns);//, 100, 0. , 100.); |
256 | hNegTimeRatioVsRun->SetDrawOption("E"); | |
257 | ||
258 | TH1F * hOrphansRatioVsRun=new TH1F("hOrphansRatioVsRun","Ratio of orphans (hits with ToT=0); ; ratio of orphans (%)",nRuns, 0., nRuns);//, 1000, 0. , 100.); | |
259 | hOrphansRatioVsRun->SetDrawOption("E"); | |
260 | ||
261 | TH1F * hMeanLVsRun=new TH1F("hMeanLVsRun","Average track length;; <L> (cm)",nRuns, 0., nRuns);//, 350, 350. , 700.); | |
262 | hMeanLVsRun->SetDrawOption("E"); | |
263 | TH1F * hNegLRatioVsRun=new TH1F("hNegLRatioVsRun","Ratio of tracks with L<350 cm;; ratio of tracks with L<350 cm (%)",nRuns, 0., nRuns);//, 1000, 0. , 100.); | |
264 | hNegLRatioVsRun->SetDrawOption("E"); | |
6ce27f2e | 265 | TH1F * hMatchEffVsRun=new TH1F("hMatchEffVsRun","#epsilon_{match} (linear fit for p_{T}>1.0 GeV/c);;#epsilon_{match} (pT>1.0 GeV/c)",nRuns, 0., nRuns);//, 100, 0. , 1.); |
2722289c | 266 | hMatchEffVsRun->SetDrawOption("E"); |
6ce27f2e | 267 | TH1F * hMatchEffVsRunNormToGoodCh=new TH1F("hMatchEffVsRunNormToGoodCh","#epsilon_{match} normalized to percentage of TOF good channels;;#epsilon_{match} (pT>1.0 GeV/c)",nRuns, 0., nRuns);//, 100, 0. , 1.); |
2722289c | 268 | hMatchEffVsRunNormToGoodCh->SetDrawOption("E"); |
f2717f58 | 269 | |
6ce27f2e | 270 | TH1F * hMatchEffVsRun1=new TH1F("hMatchEffVsRun1","#epsilon_{match} (value for p_{T}=1.0 GeV/c);;#epsilon_{match} (pT=1.0 GeV/c)",nRuns, 0., nRuns); |
2722289c | 271 | hMatchEffVsRun1->SetDrawOption("E"); |
272 | TH1F * hPeakT0AVsRun=new TH1F("hPeakT0AVsRun","Peak value of T0A (gaussian fit);;t0A (ps)",nRuns,0., nRuns); | |
273 | TH1F * hPeakT0CVsRun=new TH1F("hPeakT0CVsRun","Peak value of T0C (gaussian fit);;t0AC (ps)",nRuns,0., nRuns); | |
274 | TH1F * hPeakT0ACVsRun=new TH1F("hPeakT0ACVsRun","Peak value of T0AC (gaussian fit);;t0AC (ps)",nRuns,0., nRuns); | |
275 | TH1F * hT0fillResVsRun=new TH1F("hT0fillResVsRun","t0_fill spread;;t0_spread (ps)",nRuns,0., nRuns); | |
f2717f58 | 276 | |
277 | ||
2722289c | 278 | lista.Add(hAvMulti); |
279 | lista.Add(hAvDiffTimeVsRun); | |
280 | lista.Add(hPeakDiffTimeVsRun); | |
281 | lista.Add(hSpreadDiffTimeVsRun); | |
282 | lista.Add(hAvTimeVsRun); | |
283 | lista.Add(hPeakTimeVsRun); | |
284 | lista.Add(hSpreadTimeVsRun); | |
285 | lista.Add(hAvRawTimeVsRun); | |
286 | lista.Add(hPeakRawTimeVsRun); | |
287 | lista.Add(hSpreadRawTimeVsRun); | |
288 | lista.Add(hAvTotVsRun); | |
289 | lista.Add(hPeakTotVsRun); | |
290 | lista.Add(hSpreadTotVsRun); | |
291 | lista.Add(hNegTimeRatioVsRun); | |
292 | lista.Add(hOrphansRatioVsRun); | |
293 | lista.Add(hMeanLVsRun); | |
294 | lista.Add(hNegLRatioVsRun); | |
295 | lista.Add(hMatchEffVsRun); | |
296 | lista.Add(hMatchEffVsRunNormToGoodCh); | |
297 | lista.Add(hPeakT0AVsRun); | |
298 | lista.Add(hPeakT0CVsRun); | |
299 | lista.Add(hPeakT0ACVsRun); | |
300 | lista.Add(hT0fillResVsRun); | |
301 | char runlabel[6]; | |
3d9550f8 | 302 | |
2722289c | 303 | for (Int_t irun=0;irun<nRuns;irun++){ |
304 | ttree->GetEntry(irun); | |
3d9550f8 | 305 | |
2722289c | 306 | sprintf(runlabel,"%i",runNumber); |
3d9550f8 | 307 | |
2722289c | 308 | hAvMulti->SetBinContent(irun+1, avMulti); |
309 | hAvMulti->GetXaxis()->SetBinLabel(irun+1,runlabel); | |
ce9b04c5 | 310 | |
2722289c | 311 | hAvDiffTimeVsRun->SetBinContent(irun+1, avDiffTime); |
312 | hAvDiffTimeVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); | |
3d9550f8 | 313 | |
2722289c | 314 | hPeakDiffTimeVsRun->SetBinContent(irun+1,peakDiffTime); |
315 | hPeakDiffTimeVsRun->SetBinError(irun+1,peakDiffTimeErr); | |
316 | hPeakDiffTimeVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); | |
3d9550f8 | 317 | |
2722289c | 318 | hSpreadDiffTimeVsRun->SetBinContent(irun+1,spreadDiffTime); |
319 | hSpreadDiffTimeVsRun->SetBinError(irun+1,spreadDiffTimeErr); | |
320 | hSpreadDiffTimeVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); | |
3d9550f8 | 321 | |
2722289c | 322 | hAvTimeVsRun->SetBinContent(irun+1, avTime); |
323 | hAvTimeVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); | |
3d9550f8 | 324 | |
2722289c | 325 | hPeakTimeVsRun->SetBinContent(irun+1,peakTime); |
326 | hPeakTimeVsRun->SetBinError(irun+1,peakTimeErr); | |
327 | hPeakTimeVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); | |
3d9550f8 | 328 | |
2722289c | 329 | hSpreadTimeVsRun->SetBinContent(irun+1,spreadTime); |
330 | hSpreadTimeVsRun->SetBinError(irun+1,spreadTimeErr); | |
331 | hSpreadTimeVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); | |
3d9550f8 | 332 | |
2722289c | 333 | hAvRawTimeVsRun->SetBinContent(irun+1, avRawTime); |
334 | hAvRawTimeVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); | |
3d9550f8 | 335 | |
2722289c | 336 | hPeakRawTimeVsRun->SetBinContent(irun+1,peakRawTime); |
337 | hPeakRawTimeVsRun->SetBinError(irun+1,peakRawTimeErr); | |
338 | hPeakRawTimeVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); | |
3d9550f8 | 339 | |
2722289c | 340 | hSpreadRawTimeVsRun->SetBinContent(irun+1,spreadRawTime); |
341 | hSpreadRawTimeVsRun->SetBinError(irun+1,spreadRawTimeErr); | |
342 | hSpreadRawTimeVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); | |
3d9550f8 | 343 | |
2722289c | 344 | hAvTotVsRun->SetBinContent(irun+1,avTot); |
345 | hAvTotVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); | |
3d9550f8 | 346 | |
2722289c | 347 | hPeakTotVsRun->SetBinContent(irun+1,peakTot); |
348 | hPeakTotVsRun->SetBinError(irun+1,peakTotErr); | |
349 | hPeakTotVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); | |
3d9550f8 | 350 | |
2722289c | 351 | hSpreadTotVsRun->SetBinContent(irun+1,spreadTot); |
352 | hSpreadTotVsRun->SetBinError(irun+1,spreadTotErr); | |
353 | hSpreadTotVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); | |
3d9550f8 | 354 | |
2722289c | 355 | hNegTimeRatioVsRun->SetBinContent(irun+1,negTimeRatio); |
356 | hNegTimeRatioVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); | |
3d9550f8 | 357 | |
2722289c | 358 | hOrphansRatioVsRun->SetBinContent(irun+1,orphansRatio); |
359 | hOrphansRatioVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); | |
3d9550f8 | 360 | |
2722289c | 361 | hMeanLVsRun->SetBinContent(irun+1,avL); |
362 | hMeanLVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); | |
3d9550f8 | 363 | |
2722289c | 364 | hNegLRatioVsRun->SetBinContent(irun+1,negLratio); |
365 | hNegLRatioVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); | |
366 | ||
367 | hMatchEffVsRun->SetBinContent(irun+1,matchEffLinFit1Gev); | |
368 | hMatchEffVsRun->SetBinError(irun+1,matchEffLinFit1GevErr); | |
369 | hMatchEffVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); | |
370 | hMatchEffVsRun->SetLineColor(kRed); | |
371 | hMatchEffVsRun->SetLineWidth(2); | |
372 | ||
373 | if (goodChannelRatio>0) | |
374 | hMatchEffVsRunNormToGoodCh->SetBinContent(irun+1,matchEffLinFit1Gev/goodChannelRatio); | |
375 | else | |
376 | hMatchEffVsRunNormToGoodCh->SetBinContent(irun+1, 0.0); | |
377 | hMatchEffVsRunNormToGoodCh->SetBinError(irun+1,matchEffLinFit1GevErr); | |
378 | hMatchEffVsRunNormToGoodCh->GetXaxis()->SetBinLabel(irun+1,runlabel); | |
379 | hMatchEffVsRunNormToGoodCh->SetLineColor(kBlue); | |
380 | hMatchEffVsRunNormToGoodCh->SetLineWidth(2); | |
f2717f58 | 381 | |
2722289c | 382 | hPeakT0AVsRun->SetBinContent(irun+1,peakT0A); |
383 | hPeakT0AVsRun->SetBinError(irun+1,spreadT0A); | |
384 | hPeakT0AVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); | |
3d9550f8 | 385 | |
2722289c | 386 | hPeakT0CVsRun->SetBinContent(irun+1,peakT0C); |
387 | hPeakT0CVsRun->SetBinError(irun+1,spreadT0C); | |
388 | hPeakT0CVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); | |
3d9550f8 | 389 | |
2722289c | 390 | hPeakT0ACVsRun->SetBinContent(irun+1,peakT0AC); |
391 | hPeakT0ACVsRun->SetBinError(irun+1,spreadT0AC); | |
392 | hPeakT0ACVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); | |
7cc410ff | 393 | |
2722289c | 394 | hT0fillResVsRun->SetBinContent(irun+1,avT0fillRes); |
395 | hT0fillResVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); | |
396 | } | |
3d9550f8 | 397 | |
2722289c | 398 | char outfilename[200]; |
399 | sprintf(outfilename, "trend_%s",trendFileName); | |
400 | TFile * fout=new TFile(outfilename,"recreate"); | |
401 | fout->cd(); | |
402 | lista.Write(); | |
403 | fout->Close(); | |
ce9b04c5 | 404 | |
2722289c | 405 | TString plotDir(Form("PlotsTrending")); |
406 | gSystem->Exec(Form("mkdir %s",plotDir.Data())); | |
ce9b04c5 | 407 | |
2722289c | 408 | TCanvas* cPeakDiffTimeVsRun = new TCanvas("cPeakDiffTimeVsRun","cPeakDiffTimeVsRun", 50,50,750,550); |
409 | hPeakDiffTimeVsRun->GetYaxis()->SetRangeUser(-50.,50.); | |
410 | hPeakDiffTimeVsRun->Draw(); | |
411 | cPeakDiffTimeVsRun->Print(Form("%s/cPeakDiffTimeVsRun.png",plotDir.Data())); | |
ce9b04c5 | 412 | |
2722289c | 413 | TCanvas* cSpreadDiffTimeVsRun = new TCanvas("cSpreadDiffTimeVsRun","cSpreadDiffTimeVsRun", 50,50,750,550); |
414 | hSpreadDiffTimeVsRun->GetYaxis()->SetRangeUser(200.,400.); | |
415 | hSpreadDiffTimeVsRun->Draw(); | |
416 | cSpreadDiffTimeVsRun->Print(Form("%s/cSpreadDiffTimeVsRun.png",plotDir.Data())); | |
417 | ||
418 | TCanvas* cMatchEffVsRun = new TCanvas("cMatchEffVsRun","cMatchEffVsRun",50, 50, 750,550); | |
419 | hMatchEffVsRun->GetYaxis()->SetRangeUser(0.,1.); | |
420 | hMatchEffVsRun->Draw(); | |
421 | cMatchEffVsRun->Print(Form("%s/cMatchEffVsRun.png",plotDir.Data())); | |
422 | ||
423 | TCanvas* cMatchEffNormToGoodCh = new TCanvas("cMatchEffNormToGoodCh","cMatchEffNormToGoodCh",50, 50,750,550); | |
424 | hMatchEffVsRunNormToGoodCh->GetYaxis()->SetRangeUser(0.,1.); | |
425 | hMatchEffVsRunNormToGoodCh->Draw(); | |
426 | cMatchEffNormToGoodCh->Print(Form("%s/cMatchEffNormToGoodCh.png",plotDir.Data())); | |
f2717f58 | 427 | |
2722289c | 428 | TCanvas* cPeakT0AVsRun = new TCanvas("cPeakT0AVsRun","cPeakT0AVsRun", 50,50,750,550); |
429 | hPeakT0AVsRun->Draw(); | |
430 | cPeakT0AVsRun->Print(Form("%s/cPeakT0AVsRun.png",plotDir.Data())); | |
431 | ||
432 | TCanvas* cPeakT0CVsRun = new TCanvas("cPeakT0CVsRun","cPeakT0CVsRun", 50,50,750,550); | |
433 | hPeakT0CVsRun->Draw(); | |
434 | cPeakT0CVsRun->Print(Form("%s/cPeakT0CVsRun.png",plotDir.Data())); | |
435 | ||
436 | TCanvas* cPeakT0ACVsRun = new TCanvas("cPeakT0ACVsRun","cPeakT0ACVsRun", 50,50,750,550); | |
437 | hPeakT0ACVsRun->Draw(); | |
438 | cPeakT0ACVsRun->Print(Form("%s/cPeakT0ACVsRun.png",plotDir.Data())); | |
439 | ||
440 | TCanvas* cT0fillResVsRun = new TCanvas("cT0fillResVsRun","cT0fillResVsRun", 50,50,750,550); | |
441 | hT0fillResVsRun->Draw(); | |
442 | cT0fillResVsRun->Print(Form("%s/cT0fillResVsRun.png",plotDir.Data())); | |
443 | ||
444 | if (displayAll) { | |
445 | TCanvas* cAvDiffTimeVsRun = new TCanvas("cAvDiffTimeVsRun","cAvDiffTimeVsRun",50,50,750,550); | |
446 | gPad->SetGridx(); | |
447 | gPad->SetGridy(); | |
448 | hAvDiffTimeVsRun->Draw(); | |
449 | cAvDiffTimeVsRun->Print(Form("%s/cAvDiffTimeVsRun.png",plotDir.Data())); | |
6c125480 | 450 | |
2722289c | 451 | TCanvas* cAvTimeVsRun = new TCanvas("cAvTimeVsRun","cAvTimeVsRun", 50,50,750,550); |
452 | hAvTimeVsRun->Draw(); | |
453 | cAvTimeVsRun->Print(Form("%s/cAvTimeVsRun.png",plotDir.Data())); | |
6c125480 | 454 | |
2722289c | 455 | TCanvas* cPeakTimeVsRun = new TCanvas("cPeakTimeVsRun","cPeakTimeVsRun", 50,50,750,550); |
456 | hPeakTimeVsRun->Draw(); | |
457 | cPeakTimeVsRun->Print(Form("%s/cPeakTimeVsRun.png",plotDir.Data())); | |
6c125480 | 458 | |
2722289c | 459 | TCanvas* cSpreadTimeVsRun = new TCanvas("cSpreadTimeVsRun","cSpreadTimeVsRun", 50,50,750,550); |
460 | hSpreadTimeVsRun->Draw(); | |
461 | cSpreadTimeVsRun->Print(Form("%s/cSpreadTimeVsRun.png",plotDir.Data())); | |
6c125480 | 462 | |
2722289c | 463 | TCanvas* cAvRawTimeVsRun = new TCanvas("cAvRawTimeVsRun","cAvRawTimeVsRun", 50,50,750,550); |
464 | hAvRawTimeVsRun->Draw(); | |
465 | cAvRawTimeVsRun->Print(Form("%s/cAvRawTimeVsRun.png",plotDir.Data())); | |
6c125480 | 466 | |
2722289c | 467 | TCanvas* cPeakRawTimeVsRun = new TCanvas("cPeakRawTimeVsRun","cPeakRawTimeVsRun", 50,50,750,550); |
468 | hPeakRawTimeVsRun->Draw(); | |
469 | cPeakRawTimeVsRun->Print(Form("%s/cPeakRawTimeVsRun.png",plotDir.Data())); | |
6c125480 | 470 | |
2722289c | 471 | TCanvas* cSpreadRawTimeVsRun = new TCanvas("cSpreadRawTimeVsRun","cSpreadRawTimeVsRun", 50,50,750,550); |
472 | hSpreadRawTimeVsRun->Draw(); | |
473 | cSpreadRawTimeVsRun->Print(Form("%s/cSpreadRawTimeVsRun.png",plotDir.Data())); | |
6c125480 | 474 | |
2722289c | 475 | TCanvas* cAvTotVsRun = new TCanvas("cAvTotVsRun","cAvTotVsRun", 50,50,750,550); |
476 | hAvTotVsRun->Draw(); | |
477 | cAvTotVsRun->Print(Form("%s/cAvTotVsRun.png",plotDir.Data())); | |
6c125480 | 478 | |
2722289c | 479 | TCanvas* cPeakTotVsRun = new TCanvas("cPeakTotVsRun","cPeakTotVsRun", 50,50,750,550); |
480 | hPeakTotVsRun->Draw(); | |
481 | cPeakTotVsRun->Print(Form("%s/cPeakTotVsRun.png",plotDir.Data())); | |
6c125480 | 482 | |
2722289c | 483 | TCanvas* cSpreadTotVsRun = new TCanvas("cSpreadTotVsRun","cSpreadTotVsRun", 50,50,750,550); |
484 | hSpreadTotVsRun->Draw(); | |
485 | cSpreadTotVsRun->Print(Form("%s/cSpreadTotVsRun.png",plotDir.Data())); | |
6c125480 | 486 | |
2722289c | 487 | TCanvas* cNegTimeRatioVsRun = new TCanvas("cNegTimeRatioVsRun","cNegTimeRatioVsRun", 50,50,750,550); |
488 | hNegTimeRatioVsRun->Draw(); | |
489 | cNegTimeRatioVsRun->Print(Form("%s/cNegTimeRatioVsRun.png",plotDir.Data())); | |
6c125480 | 490 | |
2722289c | 491 | TCanvas* cOrphansRatioVsRun = new TCanvas("cOrphansRatioVsRun","cOrphansRatioVsRun", 50,50,750,550); |
492 | hOrphansRatioVsRun->Draw(); | |
493 | cOrphansRatioVsRun->Print(Form("%s/cOrphansRatioVsRun.png",plotDir.Data())); | |
6c125480 | 494 | |
2722289c | 495 | TCanvas* cMeanLVsRun = new TCanvas("cMeanLVsRun","cMeanLVsRun", 50,50,750,550); |
496 | hMeanLVsRun->Draw(); | |
497 | cMeanLVsRun->Print(Form("%s/cMeanLVsRun.png",plotDir.Data())); | |
6c125480 | 498 | |
2722289c | 499 | TCanvas* cNegLRatioVsRun = new TCanvas("cNegLRatioVsRun","cNegLRatioVsRun", 50,50,750,550); |
500 | hNegLRatioVsRun->Draw(); | |
501 | cNegLRatioVsRun->Print(Form("%s/cNegLRatioVsRun.png",plotDir.Data())); | |
502 | } | |
6c125480 | 503 | |
2722289c | 504 | return 0; |
3d9550f8 | 505 | } |
506 | ||
6c125480 | 507 | //------------------------------------------------------------------------- |
add3c004 | 508 | Int_t MakePostQAtree(Int_t runNumber, Bool_t isMC=kFALSE, char * postFileName="postQA.0.root",char * treePostFileName="treePostQA.0.root", Bool_t includeStartTime=kTRUE){ |
6c125480 | 509 | |
2722289c | 510 | TFile *postfile=TFile::Open(postFileName); |
511 | if (!postfile) { | |
512 | printf("Post-analysis output not found - cannot perform trending analysis. Exiting."); | |
513 | return -1; | |
514 | } | |
515 | Printf("============== Getting post-analysis info for run %i ===============\n",runNumber); | |
516 | TFile * trendFile=new TFile(treePostFileName,"recreate"); | |
517 | ||
518 | Double_t avTime=-9999., peakTime=-9999., spreadTime=-9999., peakTimeErr=-9999., spreadTimeErr=-9999., negTimeRatio=-9999., | |
519 | avRawTime=-9999., peakRawTime=-9999., spreadRawTime=-9999., peakRawTimeErr=-9999., spreadRawTimeErr=-9999., | |
520 | avTot=-9999., peakTot=-9999.,spreadTot=-9999., peakTotErr=-9999.,spreadTotErr=-9999., | |
521 | orphansRatio=-9999., avL=-9999., negLratio=-9999., | |
522 | effPt1=-9999., effPt2=-9999., matchEffLinFit1Gev=-9999.,matchEffLinFit1GevErr=-9999.; | |
6c125480 | 523 | |
2722289c | 524 | Double_t avPiDiffTime=-9999.,peakPiDiffTime=-9999., spreadPiDiffTime=-9999.,peakPiDiffTimeErr=-9999., spreadPiDiffTimeErr=-9999.; |
6c125480 | 525 | |
2722289c | 526 | Double_t avT0A=-9999.,peakT0A=-9999., spreadT0A=-9999.,peakT0AErr=-9999., spreadT0AErr=-9999.; |
527 | Double_t avT0C=-9999.,peakT0C=-9999., spreadT0C=-9999.,peakT0CErr=-9999., spreadT0CErr=-9999.; | |
528 | Double_t avT0AC=-9999.,peakT0AC=-9999., spreadT0AC=-9999.,peakT0ACErr=-9999., spreadT0ACErr=-9999.; | |
529 | Double_t avT0res=-9999.,peakT0res=-9999., spreadT0res=-9999.,peakT0resErr=-9999., spreadT0resErr=-9999.; | |
530 | Double_t avT0fillRes=-9999.; | |
531 | ||
532 | Float_t avMulti=0; | |
533 | Float_t fractionEventsWHits=-9999.; | |
534 | /*number of good (HW ok && efficient && !noisy) TOF channels from OCDB*/ | |
535 | Double_t goodChannelRatio=0.0; | |
536 | ||
537 | TTree * ttree=new TTree("trendTree","tree of trending variables"); | |
538 | ttree->Branch("run",&runNumber,"run/I"); | |
539 | ttree->Branch("avMulti",&avMulti,"avMulti/F"); | |
540 | ttree->Branch("fractionEventsWHits",&fractionEventsWHits,"fractionEventsWHits/F"); | |
541 | ttree->Branch("goodChannelsRatio",&goodChannelRatio,"goodChannelRatio/D"); | |
542 | ttree->Branch("avTime",&avTime,"avTime/D"); //mean time | |
543 | ttree->Branch("peakTime",&peakTime,"peakTime/D"); //main peak time after fit | |
544 | ttree->Branch("spreadTime",&spreadTime,"spreadTime/D"); //spread of main peak of time after fit | |
545 | ttree->Branch("peakTimeErr",&peakTimeErr,"peakTimeErr/D"); //main peak time after fit error | |
546 | ttree->Branch("spreadTimeErr",&spreadTimeErr,"spreadTimeErr/D"); //spread of main peak of time after fit error | |
547 | ttree->Branch("negTimeRatio",&negTimeRatio,"negTimeRatio/D"); //negative time ratio | |
6c125480 | 548 | |
2722289c | 549 | ttree->Branch("avRawTime",&avRawTime,"avRawTime/D"); //mean raw time |
550 | ttree->Branch("peakRawTime",&peakRawTime,"peakRawTime/D"); //mean peak of RAW TIME after fit | |
551 | ttree->Branch("spreadRawTime",&spreadRawTime,"spreadRawTime/D"); //spread of main peak of raw time after fit | |
552 | ttree->Branch("peakRawTimeErr",&peakRawTimeErr,"peakRawTimeErr/D"); //main peak raw time after fit error | |
553 | ttree->Branch("spreadRawTimeErr",&spreadRawTimeErr,"spreadRawTimeErr/D"); //spread of raw main peak of time after fit error | |
6c125480 | 554 | |
2722289c | 555 | ttree->Branch("avTot",&avTot,"avTot/D"); //main peak tot |
556 | ttree->Branch("peakTot",&peakTot,"peakTot/D"); // main peak of tot after fit | |
557 | ttree->Branch("spreadTot",&spreadTot,"spreadTot/D"); //spread of main peak of tot after fit | |
558 | ttree->Branch("peakTotErr",&peakTotErr,"peakTotErr/D"); // main peak of tot after fit | |
559 | ttree->Branch("spreadTotErr",&spreadTotErr,"spreadTotErr/D"); //spread of main peak of tot after fit | |
6c125480 | 560 | |
2722289c | 561 | ttree->Branch("orphansRatio",&orphansRatio,"orphansRatio/D"); //orphans ratio |
562 | ||
563 | ttree->Branch("avL",&avL,"avL/D"); //mean track length | |
564 | ttree->Branch("negLratio",&negLratio,"negLratio/D");//ratio of tracks with track length <350 cm | |
565 | ttree->Branch("effPt1",&effPt1,"effPt1/D");//matching eff at 1 GeV/c | |
566 | ttree->Branch("effPt2",&effPt2,"effPt2/D"); //matching eff at 2 GeV/c | |
567 | ttree->Branch("matchEffLinFit1Gev",&matchEffLinFit1Gev,"matchEffLinFit1Gev/D");//matching eff fit param | |
568 | ttree->Branch("matchEffLinFit1GevErr",&matchEffLinFit1GevErr,"matchEffLinFit1GevErr/D");////matching eff fit param error | |
6c125480 | 569 | |
2722289c | 570 | ttree->Branch("avPiDiffTime",&avPiDiffTime,"avPiDiffTime/D"); //mean t-texp |
571 | ttree->Branch("peakPiDiffTime",&peakPiDiffTime,"peakPiDiffTime/D"); //main peak t-texp after fit | |
572 | ttree->Branch("spreadPiDiffTime",&spreadPiDiffTime,"spreadPiDiffTime/D"); //spread of main peak t-texp after fit | |
573 | ttree->Branch("peakPiDiffTimeErr",&peakPiDiffTimeErr,"peakPiDiffTimeErr/D"); //main peak t-texp after fit error | |
574 | ttree->Branch("spreadPiDiffTimeErr",&spreadPiDiffTimeErr,"spreadPiDiffTimeErr/D"); //spread of main peak of t-texp after fit error | |
575 | ||
576 | ttree->Branch("avT0A",&avT0A,"avT0A/D"); //main peak t0A | |
577 | ttree->Branch("peakT0A",&peakT0A,"peakT0A/D"); // main peak of t0A after fit | |
578 | ttree->Branch("spreadT0A",&spreadT0A,"spreadTot/D"); //spread of main peak of t0A after fit | |
579 | ttree->Branch("peakT0AErr",&peakT0AErr,"peakT0AErr/D"); // main peak of t0A after fit | |
580 | ttree->Branch("spreadT0AErr",&spreadT0AErr,"spreadT0AErr/D"); //spread of main peak of t0A after fit | |
581 | ||
582 | ttree->Branch("avT0C",&avT0C,"avT0C/D"); //main peak t0C | |
583 | ttree->Branch("peakT0C",&peakT0C,"peakT0C/D"); // main peak of t0C after fit | |
584 | ttree->Branch("spreadT0C",&spreadT0C,"spreadT0C/D"); //spread of main peak of t0C after fit | |
585 | ttree->Branch("peakT0CErr",&peakT0CErr,"peakT0CErr/D"); // main peak of t0C after fit | |
586 | ttree->Branch("spreadT0CErr",&spreadT0CErr,"spreadT0CErr/D"); //spread of main peak of t0C after fit | |
6c125480 | 587 | |
2722289c | 588 | ttree->Branch("avT0AC",&avT0AC,"avT0AC/D"); //main peak t0AC |
589 | ttree->Branch("peakT0AC",&peakT0AC,"peakT0AC/D"); // main peak of t0AC after fit | |
590 | ttree->Branch("spreadT0AC",&spreadT0AC,"spreadT0AC/D"); //spread of main peak of t0AC after fit | |
591 | ttree->Branch("peakT0ACErr",&peakT0ACErr,"peakT0ACErr/D"); // main peak of t0AC after fit | |
592 | ttree->Branch("spreadT0ACErr",&spreadT0ACErr,"spreadT0ACErr/D"); //spread of main peak of t0AC after fit | |
6c125480 | 593 | |
2722289c | 594 | ttree->Branch("avT0res",&avT0res,"avT0res/D"); //main peak t0AC |
595 | ttree->Branch("peakT0res",&peakT0res,"peakT0res/D"); // main peak of t0AC after fit | |
596 | ttree->Branch("spreadT0res",&spreadT0res,"spreadT0res/D"); //spread of main peak of t0AC after fit | |
597 | ttree->Branch("peakT0resErr",&peakT0resErr,"peakT0resErr/D"); // main peak of t0AC after fit | |
598 | ttree->Branch("spreadT0resErr",&spreadT0resErr,"spreadT0resErr/D"); //spread of main peak of t0AC after fit | |
599 | ttree->Branch("avT0fillRes",&avT0fillRes,"avT0fillRes/D"); //t0 fill res | |
600 | ||
601 | //postfile->ls(); | |
602 | //save quantities for trending | |
603 | goodChannelRatio=(Double_t)GetGoodTOFChannelsRatio(runNumber); | |
6c125480 | 604 | |
2722289c | 605 | //--------------------------------- Multiplicity ----------------------------------// |
606 | TH1F*hMulti=(TH1F*)postfile->Get("hTOFmatchedPerEvt"); | |
607 | if ((hMulti)&&(hMulti->GetEntries()>0)) { | |
608 | avMulti=hMulti->GetMean(); | |
609 | } | |
6c125480 | 610 | |
2722289c | 611 | //--------------------------------- T0F signal ----------------------------------// |
6c125480 | 612 | |
2722289c | 613 | TH1F*hTime=(TH1F*)postfile->Get("hTOFmatchedESDtime"); |
614 | if ((hTime)&&(hTime->GetEntries()>0)) { | |
615 | avTime=hTime->GetMean(); | |
616 | hTime->Fit("landau","","",0.,50.); | |
617 | peakTime=(hTime->GetFunction("landau"))->GetParameter(1); | |
618 | spreadTime=(hTime->GetFunction("landau"))->GetParameter(2); | |
619 | peakTimeErr=(hTime->GetFunction("landau"))->GetParError(1); | |
620 | spreadTimeErr=(hTime->GetFunction("landau"))->GetParError(2); | |
6c125480 | 621 | |
2722289c | 622 | negTimeRatio=((Double_t)hTime->Integral(1,3)*100.)/((Double_t)hTime->Integral()); |
623 | printf("Main peak time (landau): mean = %f +- %f\n",peakTime,peakTimeErr ); | |
624 | printf("Main peak time (landau): spread = %f +- %f\n",spreadTime,spreadTimeErr ); | |
625 | printf("Ratio of tracks with time<12.5 ns / total = %f\n",negTimeRatio ); | |
6c125480 | 626 | |
2722289c | 627 | //add integral of main peak over total |
628 | } | |
629 | printf("---------------------------------------------------------------- \n"); | |
630 | TH1F * hRawTime = (TH1F*)postfile->Get("hTOFmatchedESDrawTime"); | |
631 | if ((hRawTime)&&(hRawTime->GetEntries()>0)){ | |
632 | avRawTime=hRawTime->GetMean(); | |
633 | if (!isMC){ | |
634 | hRawTime->Fit("landau","","",200.,250.); | |
635 | peakRawTime=(hRawTime->GetFunction("landau"))->GetParameter(1); | |
636 | spreadRawTime=(hRawTime->GetFunction("landau"))->GetParameter(2); | |
637 | peakRawTimeErr=(hRawTime->GetFunction("landau"))->GetParError(1); | |
638 | spreadRawTimeErr=(hRawTime->GetFunction("landau"))->GetParError(2); | |
639 | printf("Main peak raw time (landau): mean = %f +- %f\n",peakTime,peakTimeErr ); | |
640 | printf("Main peak raw time (landau): spread = %f +- %f\n",spreadRawTime,spreadRawTimeErr ); | |
641 | } else { | |
642 | printf("Reminder: Raw time not available in MC simulated data."); | |
643 | } | |
644 | } | |
6c125480 | 645 | |
2722289c | 646 | printf("---------------------------------------------------------------- \n"); |
6c125480 | 647 | |
2722289c | 648 | TH1F * hTot = (TH1F*)postfile->Get("hTOFmatchedESDToT"); |
649 | if ((hTot)&&(hTot->GetEntries()>0)){ | |
650 | avTot=hTot->GetMean(); | |
651 | hTot->Fit("gaus","","",0.,50.); | |
652 | peakTot=(hTot->GetFunction("gaus"))->GetParameter(1); | |
653 | spreadTot=(hTot->GetFunction("gaus"))->GetParameter(2); | |
654 | peakTotErr=(hTot->GetFunction("gaus"))->GetParError(1); | |
655 | spreadTotErr=(hTot->GetFunction("gaus"))->GetParError(2); | |
656 | printf("Main peak ToT (gaus): mean = %f +- %f\n",peakTot,peakTotErr ); | |
657 | printf("Main peak ToT (gaus): spread = %f +- %f\n",spreadTot,spreadTotErr ); | |
658 | } | |
659 | printf("---------------------------------------------------------------- \n"); | |
660 | TH1F * hOrphansRatio=(TH1F*)postfile->Get("hOrphansRatio"); | |
661 | if (hOrphansRatio) | |
662 | orphansRatio=hOrphansRatio->GetMean(); | |
6c125480 | 663 | |
2722289c | 664 | TH1F * hL=(TH1F*)postfile->Get("hTOFmatchedESDtrkLength"); |
665 | if (hL) | |
666 | avL=hL->GetMean(); | |
6c125480 | 667 | |
2722289c | 668 | TH1F *hLnegRatio =(TH1F*)postfile->Get("hLnegRatio"); |
669 | if (hLnegRatio) | |
670 | negLratio=hLnegRatio->GetMean(); | |
6c125480 | 671 | |
2722289c | 672 | //--------------------------------- matching eff ----------------------------------// |
6c125480 | 673 | |
2722289c | 674 | //Double_t linFitEff1Param[3]={0.,0.,0.}; |
675 | TH1F *hMatchingVsPt =(TH1F*)postfile->Get("hTOFmatchedESDPt"); | |
676 | if (hMatchingVsPt) { | |
677 | if (hMatchingVsPt->GetEntries()>0){ | |
678 | hMatchingVsPt->Fit("pol0","","",1.0,5.); | |
679 | hMatchingVsPt->Draw(); | |
680 | if (hMatchingVsPt->GetFunction("pol0")){ | |
681 | matchEffLinFit1Gev=(hMatchingVsPt->GetFunction("pol0"))->GetParameter(0); | |
682 | matchEffLinFit1GevErr=(hMatchingVsPt->GetFunction("pol0"))->GetParError(0); | |
683 | printf("Matching efficiency fit param is %f +- %f\n",matchEffLinFit1Gev,matchEffLinFit1GevErr ); | |
684 | } | |
685 | } else { | |
686 | printf("WARNING: matching efficiency plot has 0 entries. Skipped!\n"); | |
687 | } | |
688 | } else { | |
689 | printf("WARNING: cannot retrieve matching efficiency plot\n"); | |
690 | } | |
6c125480 | 691 | |
2722289c | 692 | //--------------------------------- t-texp ----------------------------------// |
6c125480 | 693 | |
2722289c | 694 | TH1F*hPiDiffTime=(TH1F*)postfile->Get("hTOFmatchedExpTimePi"); |
695 | if ((hPiDiffTime)&&(hPiDiffTime->GetEntries()>0)) { | |
696 | avPiDiffTime=hPiDiffTime->GetMean(); | |
697 | hPiDiffTime->Fit("gaus","","",-1000.,500.); | |
698 | if (hPiDiffTime->GetFunction("gaus")){ | |
699 | peakPiDiffTime=(hPiDiffTime->GetFunction("gaus"))->GetParameter(1); | |
700 | spreadPiDiffTime=(hPiDiffTime->GetFunction("gaus"))->GetParameter(2); | |
701 | peakPiDiffTimeErr=(hPiDiffTime->GetFunction("gaus"))->GetParError(1); | |
702 | spreadPiDiffTimeErr=(hPiDiffTime->GetFunction("gaus"))->GetParError(2); | |
703 | printf("Main peak t-t_exp (gaus): mean = %f +- %f\n",peakPiDiffTime,peakPiDiffTimeErr ); | |
704 | printf("Main peak t-t_exp (gaus): spread = %f +- %f\n",spreadPiDiffTime,spreadPiDiffTimeErr ); | |
705 | } | |
706 | } | |
707 | //--------------------------------- T0 detector ----------------------------------// | |
6c125480 | 708 | |
2722289c | 709 | TH1F*hT0A=(TH1F*)postfile->Get("hEventT0DetA"); |
710 | if ((hT0A)&&(hT0A->GetEntries()>0)) { | |
711 | avT0A=hT0A->GetMean(); | |
712 | hT0A->Fit("gaus"); | |
713 | peakT0A=(hT0A->GetFunction("gaus"))->GetParameter(1); | |
714 | spreadT0A=(hT0A->GetFunction("gaus"))->GetParameter(2); | |
715 | peakT0AErr=(hT0A->GetFunction("gaus"))->GetParError(1); | |
716 | spreadT0AErr=(hT0A->GetFunction("gaus"))->GetParError(2); | |
717 | printf("Main peak T0A(gaus): mean = %f +- %f\n",peakT0A,peakT0AErr ); | |
718 | printf("Main peak T0A (gaus): spread = %f +- %f\n",spreadT0A,spreadT0AErr ); | |
719 | //add integral of main peak over total | |
720 | } | |
6c125480 | 721 | |
2722289c | 722 | TH1F*hT0C=(TH1F*)postfile->Get("hEventT0DetC"); |
723 | if ((hT0C)&&(hT0C->GetEntries()>0)) { | |
724 | avT0C=hT0C->GetMean(); | |
725 | hT0C->Fit("gaus"); | |
726 | peakT0C=(hT0C->GetFunction("gaus"))->GetParameter(1); | |
727 | spreadT0C=(hT0C->GetFunction("gaus"))->GetParameter(2); | |
728 | peakT0CErr=(hT0C->GetFunction("gaus"))->GetParError(1); | |
729 | spreadT0CErr=(hT0C->GetFunction("gaus"))->GetParError(2); | |
730 | printf("Main peak T0C(gaus): mean = %f +- %f\n",peakT0C,peakT0CErr ); | |
731 | printf("Main peak T0C (gaus): spread = %f +- %f\n",spreadT0C,spreadT0CErr ); | |
732 | //add integral of main peak over total | |
733 | } | |
6c125480 | 734 | |
2722289c | 735 | TH1F*hT0AC=(TH1F*)postfile->Get("hEventT0DetAND"); |
736 | if ((hT0AC)&&(hT0AC->GetEntries()>0)) { | |
737 | avT0AC=hT0AC->GetMean(); | |
738 | hT0AC->Fit("gaus"); | |
739 | peakT0AC=(hT0AC->GetFunction("gaus"))->GetParameter(1); | |
740 | spreadT0AC=(hT0AC->GetFunction("gaus"))->GetParameter(2); | |
741 | peakT0ACErr=(hT0AC->GetFunction("gaus"))->GetParError(1); | |
742 | spreadT0ACErr=(hT0AC->GetFunction("gaus"))->GetParError(2); | |
743 | printf("Main peak T0AC(gaus): mean = %f +- %f\n",peakT0AC,peakT0ACErr ); | |
744 | printf("Main peak T0AC (gaus): spread = %f +- %f\n",spreadT0AC,spreadT0ACErr ); | |
745 | } | |
6c125480 | 746 | |
2722289c | 747 | TH1F*hT0res=(TH1F*)postfile->Get("hT0DetRes"); |
748 | if ((hT0res)&&(hT0res->GetEntries()>0)) { | |
749 | avT0res=hT0res->GetMean(); | |
750 | hT0res->Fit("gaus"); | |
751 | peakT0res=(hT0res->GetFunction("gaus"))->GetParameter(1); | |
752 | spreadT0res=(hT0res->GetFunction("gaus"))->GetParameter(2); | |
753 | peakT0resErr=(hT0res->GetFunction("gaus"))->GetParError(1); | |
754 | spreadT0resErr=(hT0res->GetFunction("gaus"))->GetParError(2); | |
755 | printf("Main peak T0res(gaus): mean = %f +- %f\n",peakT0res,peakT0resErr ); | |
756 | printf("Main peak T0res (gaus): spread = %f +- %f\n",spreadT0res,spreadT0resErr ); | |
757 | //add integral of main peak over total | |
758 | } | |
6c125480 | 759 | |
2722289c | 760 | TH1F*hT0fillRes=(TH1F*)postfile->Get("hT0fillRes"); |
761 | if ((hT0fillRes)&&(hT0fillRes->GetEntries()>0)) { | |
762 | avT0fillRes=hT0fillRes->GetMean(); | |
763 | } | |
6c125480 | 764 | |
2722289c | 765 | ttree->Fill(); |
766 | printf("============== Saving trending quantities in tree for run %i ===============\n",runNumber); | |
767 | if (postfile->IsOpen()) { | |
768 | printf("Trying to close\n"); | |
769 | postfile->Close(); | |
770 | } | |
771 | ||
772 | trendFile->cd(); | |
773 | ttree->Write(); | |
774 | trendFile->Close(); | |
775 | return 0; | |
6c125480 | 776 | } |
777 | ||
3d9550f8 | 778 | //------------------------------------------------------------------------------------ |
779 | ||
add3c004 | 780 | Int_t RunESDQApostAnalysis(char *qafilename=NULL, Int_t runNumber=-1, Bool_t isMC=kFALSE, Bool_t IsOnGrid=kFALSE, Bool_t displayAll=kFALSE, Bool_t includeStartTime=kTRUE) { |
3d9550f8 | 781 | |
2722289c | 782 | Bool_t debug=kFALSE; |
3d9550f8 | 783 | |
2722289c | 784 | /*access qa PWGPP output files - saved locally or on grid as specified by the second argument */ |
3d9550f8 | 785 | |
2722289c | 786 | char defaultQAoutput[30]="QAresults.root"; |
787 | if (IsOnGrid) TGrid::Connect("alien://"); | |
788 | TFile * fin= TFile::Open(qafilename,"r"); | |
789 | printf("Opening file %s\n",qafilename); | |
790 | if (!fin) { | |
791 | printf("ERROR: QA output not found. Exiting with status -1\n"); | |
792 | return 1; | |
793 | } else { | |
794 | printf("INFO: QA output file %s open. \n",fin->GetName()); | |
795 | } | |
3d9550f8 | 796 | |
797 | ||
2722289c | 798 | //access histograms lists |
799 | char tofQAdirName[15]="TOF_Performance"; | |
800 | char PIDqaListName[6]="PIDqa"; | |
801 | char genListName[15]="cGeneralTOFqa"; | |
802 | char t0ListName[15]="cTimeZeroTOFqa"; | |
803 | char pidListName[15]="cPIDTOFqa"; | |
804 | char posListName[15]="cPositiveTOFqa"; | |
805 | char negListName[15]="cNegativeTOFqa"; | |
add3c004 | 806 | |
2722289c | 807 | TDirectoryFile * tofQAdir=(TDirectoryFile*)fin->Get(tofQAdirName); |
808 | TDirectoryFile * pidQAdir=(TDirectoryFile*)fin->Get(PIDqaListName); | |
809 | ||
810 | if(debug){ | |
811 | printf("------------------------------------------------------------------\n"); | |
812 | tofQAdir->ls(); | |
813 | printf("------------------------------------------------------------------\n"); | |
814 | if(includeStartTime){ | |
815 | pidQAdir->ls(); | |
816 | printf("------------------------------------------------------------------\n"); | |
817 | } | |
818 | } | |
add3c004 | 819 | |
2722289c | 820 | TList * generalList=(TList*)tofQAdir->Get(genListName); |
821 | TList *timeZeroList=(TList*)tofQAdir->Get(t0ListName); | |
822 | TList *pidList=(TList*)tofQAdir->Get(pidListName); | |
823 | TList *posList=(TList*)tofQAdir->Get(posListName); | |
824 | TList *negList=(TList*)tofQAdir->Get(negListName); | |
825 | ||
826 | if(!pidQAdir) | |
827 | printf("WARNING: PIDqa histograms not available\n"); | |
828 | else{ | |
829 | TList *pidListT0=(TList*)pidQAdir->Get(PIDqaListName); | |
830 | TList *tofPidListT0=(TList*)pidListT0->FindObject("TOF"); | |
831 | } | |
832 | if (!generalList) printf("WARNING: general QA histograms absent or not accessible\n"); | |
833 | if (!timeZeroList) printf("WARNING: timeZero QA histograms absent or not accessible\n"); | |
834 | if (!pidList) printf("WARNING: PID QA histograms absent or not accessible\n"); | |
835 | if (!posList) printf("WARNING: general QA histograms for positive tracks absent or not accessible\n"); | |
836 | if (!negList) printf("WARNING: general QA histograms for negative tracks absent or not accessible\n"); | |
837 | ||
838 | if ( (!generalList) && (!timeZeroList) && (!pidList) ){ | |
839 | printf("ERROR: no QA available \n"); | |
840 | return 1; | |
841 | } | |
3d9550f8 | 842 | |
2722289c | 843 | if (debug){ |
844 | generalList->ls(); | |
845 | printf("------------------------------------------------------------------\n"); | |
846 | timeZeroList->ls(); | |
847 | printf("------------------------------------------------------------------\n"); | |
848 | pidList->ls(); | |
849 | printf("------------------------------------------------------------------\n"); | |
850 | } | |
851 | ||
852 | /*set graphic style*/ | |
853 | gStyle->SetCanvasColor(kWhite); | |
854 | gStyle->SetFrameFillColor(kWhite); | |
855 | gStyle->SetFrameBorderMode(0); | |
856 | gStyle->SetCanvasBorderMode(0); | |
857 | gStyle->SetTitleFillColor(kWhite); | |
858 | gStyle->SetTitleBorderSize(0) ; | |
859 | gStyle->SetTitleFont(42); | |
860 | gStyle->SetTextFont(42); | |
861 | //gStyle->SetPalette(1); | |
862 | gStyle->SetStatColor(kWhite); | |
863 | gStyle->SetStatBorderSize(1); | |
864 | gStyle->SetOptStat(0); | |
3d9550f8 | 865 | |
2722289c | 866 | //DEFINE OUTPUT FILE |
867 | char outfilename[60]; | |
868 | sprintf(outfilename,"postQA_%i.root",runNumber); | |
869 | TFile * fout=new TFile(outfilename,"recreate"); | |
870 | ||
871 | TH1I* hRunNumber=new TH1I("hRunNumber","hRunNumber;run",1,runNumber,runNumber+1); | |
872 | hRunNumber->Fill(runNumber); | |
873 | ||
874 | //------------------------------------------------------------- | |
875 | /*GENERAL MONITOR - MULTIPLICITY*/ | |
876 | TH1F*hMulti= (TH1F*) generalList->FindObject("hTOFmatchedPerEvt"); | |
877 | ||
878 | TH1F* hFractionEventsWhits=new TH1F("hFractionEventsWhits","hFractionEventsWhits;fraction of events with hits (%)",200,0.,100.); | |
879 | if (hMulti->GetEntries()<1) return 2; | |
880 | Float_t fraction=0.0; | |
881 | if (hMulti->GetEntries()>0.0) fraction=((Float_t) hMulti->GetBinContent(1))/((Float_t) hMulti->GetEntries()); | |
882 | else fraction=0.0; | |
883 | hFractionEventsWhits->Fill(fraction*100.); | |
884 | //------------------------------------------------------------- | |
885 | /*GENERAL MONITOR - TIMING AND GEOMETRY*/ | |
886 | TH1F * hTime = (TH1F*) generalList->FindObject("hTOFmatchedESDtime"); | |
887 | if (hTime->GetEntries()<1) return 2; | |
888 | hTime->SetMarkerStyle(8); | |
889 | hTime->SetMarkerSize(0.7); | |
890 | hTime->SetMarkerColor(kBlue); | |
891 | hTime->SetLineColor(kBlue); | |
892 | hTime->SetFillColor(kBlue); | |
893 | hTime->SetFillStyle(3001); | |
894 | hTime->Rebin(2); | |
895 | hTime->GetYaxis()->SetTitle("matched tracks"); | |
896 | hTime->GetYaxis()->SetTitleOffset(1.35); | |
f2717f58 | 897 | |
2722289c | 898 | TH1F * hRawTime = (TH1F*) generalList->FindObject("hTOFmatchedESDrawTime"); |
899 | hRawTime->SetMarkerStyle(21); | |
900 | hRawTime->SetMarkerSize(0.7); | |
901 | hRawTime->SetMarkerColor(kGreen); | |
902 | hRawTime->SetLineColor(kGreen); | |
903 | hRawTime->SetFillColor(kGreen); | |
904 | hRawTime->SetFillStyle(3001); | |
905 | hRawTime->Rebin(2); | |
906 | hRawTime->GetYaxis()->SetTitle("matched tracks"); | |
907 | hRawTime->GetYaxis()->SetTitleOffset(1.35); | |
3d9550f8 | 908 | |
2722289c | 909 | TLegend *lTime = new TLegend(0.7125881,0.6052519,0.979435,0.7408306,NULL,"brNDC"); |
910 | lTime->SetTextSize(0.04281433); | |
911 | lTime->AddEntry(hRawTime, "raw","L"); | |
912 | lTime->AddEntry(hTime, "ESD","L"); | |
913 | lTime->SetFillColor(kWhite); | |
914 | lTime->SetShadowColor(0); | |
915 | ||
916 | TH1F * hTot = (TH1F*) generalList->FindObject("hTOFmatchedESDToT"); | |
917 | hTot->SetMarkerStyle(8); | |
918 | hTot->SetMarkerSize(0.7); | |
919 | hTot->SetMarkerColor(kViolet-3); | |
920 | hTot->SetLineColor(kViolet-3); | |
921 | hTot->SetFillColor(kViolet-3); | |
922 | hTot->SetFillStyle(3001); | |
923 | //hTime->SetDrawOption(); | |
924 | hTot->GetYaxis()->SetTitle("matched tracks"); | |
925 | hTot->GetYaxis()->SetTitleOffset(1.35); | |
3d9550f8 | 926 | |
927 | ||
2722289c | 928 | char orphansTxt[200]; |
929 | Float_t orphansRatio=0.0; | |
930 | if (hTot->GetEntries()>1){ | |
931 | orphansRatio=((Float_t) hTot->GetBinContent(1))/((Float_t) hTot->GetEntries()) ; | |
932 | } | |
933 | sprintf(orphansTxt,"orphans/matched tracks = %.4f ",orphansRatio); | |
934 | TH1F * hOrphansRatio=new TH1F("hOrphansRatio","Percentage of signals with only leading edge; percentage (%)",1000,0.,100.); | |
935 | hOrphansRatio->Fill(orphansRatio*100.); | |
936 | ||
937 | ||
938 | TPaveText *tOrphans = new TPaveText(0.38,0.63,0.88,0.7, "NDC"); | |
939 | //NDC sets coords relative to pad | |
940 | tOrphans->SetBorderSize(0); | |
941 | tOrphans->SetTextSize(0.045); | |
942 | tOrphans->SetFillColor(0); //white background | |
943 | tOrphans->SetTextAlign(12); | |
944 | tOrphans->SetTextColor(kViolet-3); | |
945 | tOrphans->AddText(orphansTxt); | |
3d9550f8 | 946 | |
2722289c | 947 | TH1F * hL = (TH1F*) generalList->FindObject("hTOFmatchedESDtrkLength"); |
948 | hL->SetMarkerStyle(8); | |
949 | hL->SetMarkerSize(0.7); | |
950 | hL->SetMarkerColor(kOrange-3); | |
951 | hL->SetLineColor(kOrange-3); | |
952 | hL->SetFillColor(kOrange-3); | |
953 | hL->SetFillStyle(3001); | |
954 | //hTime->SetDrawOption(); | |
955 | hL->GetYaxis()->SetTitle("matched tracks"); | |
956 | hL->GetYaxis()->SetTitleOffset(1.35); | |
957 | ||
958 | char negLengthTxt[200]; | |
959 | Float_t negLengthRatio=0.0; | |
960 | if (hL->GetEntries()>1){ | |
961 | negLengthRatio=(hL->Integral(1,750))/((Float_t) hL->GetEntries()) ; | |
962 | } | |
963 | sprintf(negLengthTxt,"tracks with L<350cm /matched tracks = %.5f ",negLengthRatio); | |
964 | TH1F * hLnegRatio=new TH1F("hLnegRatio","Ratio of TOF-matched tracks with L<350cm; ratio (%)",10000,0.,100.); | |
965 | hLnegRatio->Fill(negLengthRatio*100); | |
3d9550f8 | 966 | |
967 | ||
968 | ||
2722289c | 969 | TPaveText *tLength = new TPaveText(0.15,0.83,0.65,0.87, "NDC"); |
970 | //NDC sets coords relative to pad | |
971 | tLength->SetBorderSize(0); | |
972 | tLength->SetTextSize(0.04); | |
973 | tLength->SetFillColor(0); //white background | |
974 | tLength->SetTextAlign(11); | |
975 | tLength->SetTextColor(kOrange-3); | |
976 | tLength->AddText(negLengthTxt); | |
3d9550f8 | 977 | |
2722289c | 978 | if (displayAll){ |
979 | TCanvas *cTrackProperties= new TCanvas("cTrackProperties","summary of matched tracks properties",900,900); | |
980 | cTrackProperties->Divide(2,2); | |
981 | cTrackProperties->cd(1); | |
982 | gPad->SetLogy(); | |
983 | gPad->SetGridx(); | |
984 | gPad->SetGridy(); | |
985 | hTime->Draw("BAR"); | |
986 | hRawTime ->Draw("BARsame"); | |
987 | lTime->Draw(); | |
988 | cTrackProperties->cd(2); | |
989 | gPad->SetGridx(); | |
990 | gPad->SetGridy(); | |
991 | gPad->SetLogy(); | |
992 | hTot->Draw("BAR"); | |
993 | tOrphans->Draw(); | |
994 | cTrackProperties->cd(3); | |
995 | gPad->SetGridx(); | |
996 | gPad->SetGridy(); | |
997 | gPad->SetLogy(); | |
998 | hL->Draw("BAR"); | |
999 | tLength->Draw(); | |
1000 | } | |
1001 | fout->cd(); | |
1002 | hRunNumber->Write(); | |
1003 | hMulti->Write(); | |
1004 | hFractionEventsWhits->Write(); | |
1005 | hTime->Write(); | |
1006 | hRawTime->Write(); | |
1007 | hTot->Write(); | |
1008 | hOrphansRatio->Write(); | |
1009 | hL->Write(); | |
1010 | hLnegRatio->Write(); | |
3d9550f8 | 1011 | |
2722289c | 1012 | TH2F* hDxPos4profile = (TH2F*) generalList->FindObject("hTOFmatchedDxVsPtPos"); |
1013 | TH2F* hDxNeg4profile = (TH2F*) generalList->FindObject("hTOFmatchedDxVsPtNeg"); | |
3d9550f8 | 1014 | |
2722289c | 1015 | char profilename[30]; |
1016 | const Int_t ybinMin = 0; | |
1017 | const Int_t ybinMax =hDxPos4profile->GetYaxis()->GetNbins() ; | |
1018 | sprintf(profilename,"profDxPos"); | |
1019 | TProfile * profDxPos = (TProfile*)hDxPos4profile->ProfileX(profilename, ybinMin,ybinMax); | |
1020 | sprintf(profilename,"profDxNeg"); | |
1021 | profDxPos->SetLineWidth(2); | |
1022 | TProfile * profDxNeg = (TProfile*)hDxNeg4profile->ProfileX(profilename, ybinMin, ybinMax); | |
1023 | profDxNeg->SetLineWidth(2); | |
3d9550f8 | 1024 | |
2722289c | 1025 | TH1 *profRatioPosOverNegDx = (TH1*) profDxPos->Clone(); |
1026 | profRatioPosOverNegDx->SetName("profRatioPosOverNegDx"); | |
1027 | profRatioPosOverNegDx->Divide((TH1*) profDxNeg); | |
1028 | profRatioPosOverNegDx->GetYaxis()->SetRangeUser(-5.,5.); | |
1029 | profRatioPosOverNegDx->GetXaxis()->SetRangeUser(0.,2.); | |
2722289c | 1030 | |
6ce27f2e | 1031 | TCanvas *cPidPerformance= new TCanvas("cResiduals","residuals",900,450); |
1032 | cResiduals->Divide(2,1); | |
1033 | cResiduals->cd(1); | |
1034 | gPad->SetGridx(); | |
1035 | gPad->SetGridy(); | |
1036 | hDxPos4profile->GetYaxis()->SetRangeUser(-5.,5.); | |
1037 | hDxPos4profile->SetTitle(Form("%i: Dx for positive tracks",runNumber)); | |
1038 | hDxPos4profile->Draw("colz"); | |
1039 | profDxPos->SetLineColor(kRed); | |
1040 | profDxPos ->Draw("same"); | |
1041 | cResiduals->cd(2); | |
1042 | gPad->SetGridx(); | |
1043 | gPad->SetGridy(); | |
1044 | hDxNeg4profile->GetYaxis()->SetRangeUser(-5.,5.); | |
1045 | hDxNeg4profile->SetTitle(Form("%i: Dx for negative tracks",runNumber)); | |
1046 | hDxNeg4profile->Draw("colz"); | |
1047 | profDxNeg->SetLineColor(kBlue); | |
1048 | profDxNeg->Draw("same"); | |
1049 | ||
2722289c | 1050 | fout->cd(); |
1051 | hDxPos4profile->Write(); | |
1052 | hDxNeg4profile->Write(); | |
1053 | profDxPos->Write(); | |
1054 | profDxNeg->Write(); | |
1055 | profRatioPosOverNegDx->Write(); | |
1056 | //------------------------------------------------------------- | |
1057 | /* T0 DETECTOR MONITOR*/ | |
1058 | ||
1059 | TH1F * hT0AC = (TH1F*) timeZeroList->FindObject("hEventT0DetAND"); | |
1060 | hT0AC->SetMarkerStyle(8); | |
1061 | hT0AC->SetMarkerSize(0.7); | |
1062 | hT0AC->SetMarkerColor(kRed); | |
1063 | hT0AC->SetLineColor(kRed); | |
1064 | hT0AC->SetFillColor(kRed); | |
1065 | hT0AC->SetFillStyle(1001); | |
1066 | hT0AC->Rebin(2); | |
1067 | hT0AC->GetYaxis()->SetTitle("events"); | |
1068 | hT0AC->GetYaxis()->SetTitleOffset(1.35); | |
1069 | hT0AC->GetXaxis()->SetLabelSize(0.03); | |
3d9550f8 | 1070 | |
2722289c | 1071 | TH1F * hT0A = (TH1F*) timeZeroList->FindObject("hEventT0DetA"); |
1072 | hT0A->SetMarkerStyle(8); | |
1073 | hT0A->SetMarkerSize(0.7); | |
1074 | hT0A->SetMarkerColor(kBlue); | |
1075 | hT0A->SetLineColor(kBlue); | |
1076 | hT0A->SetFillColor(kBlue); | |
1077 | hT0A->SetFillStyle(1001); | |
1078 | hT0A->Rebin(2); | |
1079 | hT0A->GetYaxis()->SetTitle("events"); | |
1080 | hT0A->GetYaxis()->SetTitleOffset(1.35); | |
1081 | hT0A->GetXaxis()->SetLabelSize(0.03); | |
1082 | ||
1083 | TH1F * hT0C = (TH1F*) timeZeroList->FindObject("hEventT0DetC"); | |
1084 | hT0C->SetMarkerStyle(8); | |
1085 | hT0C->SetMarkerSize(0.7); | |
1086 | hT0C->SetMarkerColor(kGreen); | |
1087 | hT0C->SetLineColor(kGreen); | |
1088 | hT0C->SetFillColor(kGreen); | |
1089 | hT0C->SetFillStyle(1001); | |
1090 | hT0C->Rebin(2); | |
1091 | hT0C->GetYaxis()->SetTitle("events"); | |
1092 | hT0C->GetYaxis()->SetTitleOffset(1.35); | |
1093 | hT0C->GetXaxis()->SetLabelSize(0.03); | |
3d9550f8 | 1094 | |
2722289c | 1095 | TLegend *lT0 = new TLegend(0.7125881,0.6052519,0.979435,0.7408306,NULL,"brNDC"); |
1096 | lT0->SetTextSize(0.041); | |
1097 | lT0->AddEntry(hT0AC, "T0 A&C","L"); | |
1098 | lT0->AddEntry(hT0A, "T0 A","L"); | |
1099 | lT0->AddEntry(hT0C, "T0 C","L"); | |
1100 | lT0->SetFillColor(kWhite); | |
1101 | lT0->SetShadowColor(0); | |
3d9550f8 | 1102 | |
2722289c | 1103 | TH1F * hT0res = (TH1F*) timeZeroList->FindObject("hT0DetRes"); |
1104 | hT0res->GetXaxis()->SetLabelSize(0.03); | |
1105 | if (displayAll){ | |
1106 | TCanvas *cT0detector= new TCanvas("cT0detector","T0 detector",900,450); | |
1107 | cT0detector->Divide(2,1); | |
1108 | cT0detector->cd(1); | |
1109 | gPad->SetGridx(); | |
1110 | gPad->SetGridy(); | |
1111 | hT0AC->Draw("BAR"); | |
1112 | hT0AC->SetTitle("timeZero measured by T0 detector"); | |
1113 | hT0A ->Draw("BARsame"); | |
1114 | hT0C ->Draw("BARsame"); | |
1115 | lT0->Draw(); | |
1116 | cT0detector->cd(2); | |
1117 | gPad->SetGridx(); | |
1118 | gPad->SetGridy(); | |
1119 | // gPad->SetLogy(); | |
1120 | hT0res->Draw(); | |
1121 | // myText1->Draw(); | |
1122 | // cTrackProperties->cd(3); | |
1123 | // gPad->SetLogy(); | |
1124 | // hL->Draw("BAR"); | |
1125 | // myText2->Draw(); | |
1126 | } | |
3d9550f8 | 1127 | |
2722289c | 1128 | TH1F * hT0fillRes = (TH1F*) timeZeroList->FindObject("hT0fillRes"); |
1129 | hT0fillRes->GetXaxis()->SetLabelSize(0.03); | |
3d9550f8 | 1130 | |
2722289c | 1131 | fout->cd(); |
1132 | hT0AC->Write(); | |
1133 | hT0A->Write(); | |
1134 | hT0C->Write(); | |
1135 | hT0res->Write(); | |
1136 | hT0fillRes->Write(); | |
1137 | lT0->Write(); | |
3d9550f8 | 1138 | |
2722289c | 1139 | |
1140 | //------------------------------------------------------------- | |
6ce27f2e | 1141 | /*#epsilon_{match} MONITOR*/ |
2722289c | 1142 | |
1143 | //TH1F * hMatchingVsP =new TH1F("hMatchingVsP","Matching probability vs. P; P(GeV/c); matching probability", 50, 0., 5. ); | |
3d9550f8 | 1144 | |
6ce27f2e | 1145 | TH1F * hMatchingVsPt =new TH1F("hMatchingVsPt","Matching eff. vs p_{T}; p_{T}(GeV/c); #epsilon_{match}", 50, 0., 5. ); |
3d9550f8 | 1146 | |
6ce27f2e | 1147 | TH1F * hMatchingVsEta =new TH1F("hMatchingVsEta","Matching eff. vs #eta; #eta; #epsilon_{match}", 20, -1., 1.); |
3d9550f8 | 1148 | |
6ce27f2e | 1149 | TH1F * hMatchingVsPhi =new TH1F("hMatchingVsPhi","Matching eff. vs #phi; #phi(rad); #epsilon_{match}", 628, 0., 6.28); |
2722289c | 1150 | |
1151 | //matching as function of pT | |
1152 | TH1F * hDenom=(TH1F*)generalList->FindObject("hESDprimaryTrackPt"); | |
1153 | if (hDenom) { | |
1154 | hMatchingVsPt=(TH1F*) generalList->FindObject("hTOFmatchedESDPt"); | |
1155 | hMatchingVsPt->Rebin(5); | |
1156 | hDenom->Rebin(5); | |
1157 | hMatchingVsPt->Divide(hDenom); | |
6ce27f2e | 1158 | hMatchingVsPt->GetYaxis()->SetTitle("#epsilon_{match}"); |
1159 | hMatchingVsPt->SetTitle(Form("%i: TOF #epsilon_{match} vs p_{T}", runNumber)); | |
2722289c | 1160 | hMatchingVsPt->GetYaxis()->SetRangeUser(0,1.2); |
1161 | } | |
3d9550f8 | 1162 | |
2722289c | 1163 | //matching as function of eta |
1164 | hDenom->Clear(); | |
1165 | hDenom=(TH1F*)generalList->FindObject("hTOFprimaryESDeta"); | |
1166 | if (hDenom) { | |
1167 | hMatchingVsEta=(TH1F*) generalList->FindObject("hTOFmatchedESDeta"); | |
1168 | hMatchingVsEta->Rebin(5); | |
1169 | hDenom->Rebin(5); | |
1170 | hMatchingVsEta->Divide(hDenom); | |
1171 | hMatchingVsEta->GetXaxis()->SetRangeUser(-1,1); | |
6ce27f2e | 1172 | hMatchingVsEta->GetYaxis()->SetTitle("#epsilon_{match}"); |
2722289c | 1173 | hMatchingVsEta->GetYaxis()->SetRangeUser(0,1.2); |
6ce27f2e | 1174 | hMatchingVsEta->SetTitle(Form("%i: TOF #epsilon_{match} vs #eta", runNumber)); |
2722289c | 1175 | } |
1176 | //matching as function of phi | |
1177 | hDenom->Clear(); | |
1178 | hDenom=(TH1F*)generalList->FindObject("hTOFprimaryESDphi"); | |
1179 | if (hDenom) { | |
1180 | hMatchingVsPhi=(TH1F*) generalList->FindObject("hTOFmatchedESDphi"); | |
1181 | //hMatchingVsPhi->Rebin(5); | |
1182 | //hDenom->Rebin(5); | |
1183 | hMatchingVsPhi->Divide(hDenom); | |
6ce27f2e | 1184 | hMatchingVsPhi->GetYaxis()->SetTitle("#epsilon_{match}"); |
1185 | hMatchingVsPhi->SetTitle(Form("%i: TOF #epsilon_{match} vs #phi", runNumber)); | |
2722289c | 1186 | hMatchingVsPhi->GetYaxis()->SetRangeUser(0,1.2); |
1187 | } | |
6ce27f2e | 1188 | |
1189 | TCanvas *cMatchingPerformance= new TCanvas("cMatchingPerformance","summary of matching performance",1000,600); | |
1190 | cMatchingPerformance->Divide(2,2); | |
1191 | cMatchingPerformance->cd(1); | |
1192 | gPad->SetGridx(); | |
1193 | gPad->SetGridy(); | |
1194 | hMatchingVsPt->Draw(); | |
1195 | cMatchingPerformance->cd(2); | |
1196 | gPad->SetGridx(); | |
1197 | gPad->SetGridy(); | |
1198 | hMatchingVsEta->Draw(); | |
1199 | cMatchingPerformance->cd(3); | |
1200 | gPad->SetGridx(); | |
1201 | gPad->SetGridy(); | |
1202 | hMatchingVsPhi->Draw(); | |
1203 | ||
2722289c | 1204 | TH2F* hTOFmatchedDzVsStrip = (TH2F*) generalList->FindObject("hTOFmatchedDzVsStrip"); |
3d9550f8 | 1205 | |
2722289c | 1206 | fout->cd(); |
1207 | if (hMatchingVsPt) hMatchingVsPt->Write(); | |
1208 | if (hMatchingVsEta) hMatchingVsEta->Write(); | |
1209 | if (hMatchingVsPhi) hMatchingVsPhi->Write(); | |
1210 | if (hTOFmatchedDzVsStrip)hTOFmatchedDzVsStrip->Write(); | |
1211 | ||
1212 | //---------------------------------------------------- | |
1213 | /* PID PERFORMANCE MONITOR */ | |
1214 | ||
1215 | TH2F * hBetaP=(TH2F*)pidList->FindObject("hTOFmatchedESDpVsBeta"); | |
1216 | if (hBetaP) hBetaP->GetYaxis()->SetRangeUser(0.,1.2); | |
1217 | else Printf("Plot hBetaP not available (old aliroot?)"); | |
1218 | TH1F * hMass=(TH1F*)pidList->FindObject("hTOFmatchedMass"); | |
1219 | if (hMass){ | |
1220 | //hMass->SetMarkerColor(kBlue); | |
1221 | //hMass->SetLineColor(kBlue); | |
1222 | hMass->SetFillColor(kAzure+10); | |
1223 | hMass->SetFillStyle(1001); | |
1224 | hMass->Rebin(2); | |
1225 | hMass->GetYaxis()->SetTitle("tracks"); | |
1226 | hMass->GetYaxis()->SetTitleOffset(1.35); | |
1227 | hMass->GetXaxis()->SetLabelSize(0.03); | |
1228 | } else | |
1229 | Printf("Plot hMass not available (old aliroot?)"); | |
add3c004 | 1230 | |
2722289c | 1231 | TH1F * hPionDiff=(TH1F*)pidList->FindObject("hTOFmatchedExpTimePiVsEta"); |
1232 | ||
1233 | TH2F * hDiffTimePi=(TH2F*)pidList->FindObject("hTOFmatchedExpTimePiVsP"); | |
1234 | if (!hDiffTimePi) { | |
1235 | Printf("Plot hDiffTimePi not available (old aliroot?)"); | |
1236 | } else { | |
6ce27f2e | 1237 | hDiffTimePi->SetTitle(Form("%i: PION t-t_{exp,#pi}",runNumber)); |
2722289c | 1238 | hDiffTimePi->GetYaxis()->SetRangeUser(-2000.,2000.); |
1239 | //hDiffTimePi->GetYaxis()->Rebin(2);//1 bin=10 ps | |
1240 | } | |
add3c004 | 1241 | |
2722289c | 1242 | TH2F * hDiffTimePiTh=(TH2F*)pidList->FindObject("hTOFtheoreticalExpTimePiVsP"); |
1243 | if (!hDiffTimePiTh) { | |
1244 | Printf("Plot hDiffTimePiTh not available (old aliroot?)"); | |
1245 | } else { | |
6ce27f2e | 1246 | hDiffTimePiTh->SetTitle(Form("%i: PION t-t_{exp,#pi} (theoretical)",runNumber)); |
1247 | hDiffTimePiTh->GetYaxis()->SetRangeUser(-2000.,2000.); | |
2722289c | 1248 | //hDiffTimePiTh->GetYaxis()->Rebin(2);//1 bin=10 ps |
1249 | } | |
1250 | ||
1251 | TH2F * hDiffTimeKa=(TH2F*)pidList->FindObject("hTOFmatchedExpTimeKaVsP"); | |
1252 | if (!hDiffTimeKa) { | |
1253 | Printf("Plot hDiffTimeKa not available (old aliroot?)"); | |
1254 | } else { | |
6ce27f2e | 1255 | hDiffTimeKa->SetTitle(Form("%i: KAON t-t_{exp,K}",runNumber)); |
2722289c | 1256 | hDiffTimeKa->GetYaxis()->SetRangeUser(-2000.,2000.); |
1257 | //hDiffTimeKa->GetYaxis()->Rebin(2);//1 bin=10 ps | |
1258 | } | |
1259 | ||
1260 | TH2F * hDiffTimeKaTh=(TH2F*)pidList->FindObject("hTOFtheoreticalExpTimeKaVsP"); | |
1261 | if (!hDiffTimeKaTh) { | |
1262 | Printf("Plot hDiffTimeKaTh not available (old aliroot?)"); | |
1263 | } else { | |
6ce27f2e | 1264 | hDiffTimeKaTh->SetTitle(Form("%i: KAON t-t_{exp,K} (theoretical)",runNumber)); |
2722289c | 1265 | hDiffTimeKaTh->GetYaxis()->SetRangeUser(-2000.,2000.); |
1266 | //hDiffTimeKaTh->GetYaxis()->Rebin(2);//1 bin=10 ps | |
1267 | } | |
1268 | ||
1269 | TH2F * hDiffTimePro=(TH2F*)pidList->FindObject("hTOFmatchedExpTimeProVsP"); | |
1270 | if (!hDiffTimePro) { | |
1271 | Printf("Plot hDiffTimePro not available (old aliroot?)"); | |
1272 | } else { | |
6ce27f2e | 1273 | hDiffTimePro->SetTitle(Form("%i: PROTON t-t_{exp,p}",runNumber)); |
2722289c | 1274 | hDiffTimePro->GetYaxis()->SetRangeUser(-2000.,2000.); |
1275 | //hDiffTime->GetYaxis()->Rebin(2);//1 bin=10 ps | |
1276 | } | |
add3c004 | 1277 | |
2722289c | 1278 | TH2F * hDiffTimeProTh=(TH2F*)pidList->FindObject("hTOFtheoreticalExpTimeProVsP"); |
1279 | if (!hDiffTimeProTh) { | |
1280 | Printf("Plot hDiffTimeProTh not available (old aliroot?)"); | |
1281 | } else { | |
6ce27f2e | 1282 | hDiffTimeProTh->SetTitle(Form("%i: PROTON t-t_{exp,p} (theoretical)",runNumber)); |
2722289c | 1283 | hDiffTimeProTh->GetYaxis()->SetRangeUser(-2000.,2000.); |
1284 | //hDiffTime->GetYaxis()->Rebin(2);//1 bin=10 ps | |
1285 | } | |
1286 | ||
6ce27f2e | 1287 | |
1288 | TCanvas *cPidPerformance =0x0; | |
1289 | TCanvas *cPidPerformance2 = 0x0; | |
1290 | TCanvas *cPidPerformanceTh = 0x0; | |
2722289c | 1291 | if (displayAll){ |
6ce27f2e | 1292 | cPidPerformance = new TCanvas("cPidPerformance","summary of pid performance",800,800); |
2722289c | 1293 | cPidPerformance->Divide(2,1); |
1294 | cPidPerformance->cd(1); | |
1295 | gPad->SetGridy(); | |
1296 | gPad->SetGridx(); | |
1297 | gPad->SetLogz(); | |
1298 | if (hBetaP) hBetaP->Draw("colz"); | |
3d9550f8 | 1299 | |
2722289c | 1300 | cPidPerformance->cd(2); |
1301 | gPad->SetGridx(); | |
1302 | gPad->SetGridy(); | |
1303 | gPad->SetLogy(); | |
1304 | if (hMass) hMass->Draw("HIST BAR"); | |
3d9550f8 | 1305 | |
6ce27f2e | 1306 | cPidPerformance2 = new TCanvas("cPidPerformance2","summary of pid performance - tracking",700,700); |
2722289c | 1307 | gStyle->SetOptStat(10); |
2722289c | 1308 | cPidPerformance2->Divide(2,2); |
1309 | cPidPerformance2->cd(1); | |
1310 | gPad->SetLogz(); | |
1311 | gPad->SetGridx(); | |
1312 | gPad->SetGridy(); | |
1313 | if (hDiffTimePi) hDiffTimePi->Draw("colz"); | |
1314 | cPidPerformance2->cd(2); | |
1315 | gPad->SetLogz(); | |
1316 | gPad->SetGridx(); | |
1317 | gPad->SetGridy(); | |
1318 | if (hDiffTimeKa) hDiffTimeKa->Draw("colz"); | |
1319 | cPidPerformance2->cd(3); | |
1320 | gPad->SetLogz(); | |
1321 | if (hDiffTimePro) hDiffTimePro->Draw("colz"); | |
1322 | ||
6ce27f2e | 1323 | cPidPerformanceTh = new TCanvas("cPidPerformanceTh","summary of pid performance - theoretical times",700,700); |
2722289c | 1324 | cPidPerformanceTh->Divide(2,2); |
1325 | cPidPerformanceTh->cd(1); | |
1326 | gPad->SetLogz(); | |
1327 | gPad->SetGridx(); | |
1328 | gPad->SetGridy(); | |
1329 | if (hDiffTimePiTh) hDiffTimePiTh->Draw("colz"); | |
1330 | cPidPerformanceTh->cd(2); | |
1331 | gPad->SetLogz(); | |
1332 | gPad->SetGridx(); | |
1333 | gPad->SetGridy(); | |
1334 | if (hDiffTimeKaTh) hDiffTimeKaTh->Draw("colz"); | |
1335 | cPidPerformanceTh->cd(3); | |
1336 | gPad->SetLogz(); | |
1337 | gPad->SetGridx(); | |
1338 | gPad->SetGridy(); | |
1339 | if (hDiffTimeProTh) hDiffTimeProTh->Draw("colz"); | |
1340 | } | |
3d9550f8 | 1341 | |
2722289c | 1342 | TH1F * hPionDiff=(TH1F*)pidList->FindObject("hTOFmatchedExpTimePi"); |
1343 | TH1F * hKaonDiff=(TH1F*)pidList->FindObject("hTOFmatchedExpTimeKa"); | |
1344 | TH1F * hProtonDiff=(TH1F*)pidList->FindObject("hTOFmatchedExpTimePro"); | |
1345 | TH2F * hDiffTimeT0TOFPion1GeV=(TH2F*)pidList->FindObject("hTOFmatchedTimePion1GeV"); | |
1346 | ||
1347 | fout->cd(); | |
1348 | if (hPionDiff) hPionDiff->Write(); | |
1349 | if (hKaonDiff) hKaonDiff->Write(); | |
1350 | if (hProtonDiff) hProtonDiff->Write(); | |
1351 | if (hBetaP) hBetaP->Write(); | |
1352 | if (hMass) hMass->Write(); | |
1353 | if (hDiffTimeT0TOFPion1GeV) hDiffTimeT0TOFPion1GeV->Write(); | |
1354 | if (hDiffTimePi) hDiffTimePi->Write(); | |
1355 | if (hDiffTimeKa) hDiffTimeKa->Write(); | |
1356 | if (hDiffTimePro) hDiffTimePro->Write(); | |
1357 | if (hDiffTimePiTh) hDiffTimePiTh->Write(); | |
1358 | if (hDiffTimeKaTh) hDiffTimeKaTh->Write(); | |
1359 | if (hDiffTimeProTh) hDiffTimeProTh->Write(); | |
1360 | ||
1361 | //SIGMAS PID | |
1362 | TH2F * hSigmaPi=(TH2F*)pidList->FindObject("hTOFExpSigmaPi"); | |
6ce27f2e | 1363 | hSigmaPi->SetTitle(Form("%i: n#sigma_{TOF} pion vs p",runNumber)); |
1364 | //TProfile * profSigmaPi = 0x0; | |
2722289c | 1365 | if (!hSigmaPi){ |
1366 | Printf("Plot hSigmaPi not available (old aliroot?)"); | |
1367 | } else { | |
2722289c | 1368 | hSigmaPi->GetYaxis()->SetRangeUser(-5.,5.); |
1369 | hSigmaPi->GetXaxis()->SetRangeUser(0.2,10.); | |
6ce27f2e | 1370 | //sprintf(profilename,"profSigmaPi"); |
1371 | //profSigmaPi = (TProfile*)hSigmaPi->ProfileX(profilename); | |
1372 | //profSigmaPi->SetLineWidth(2); | |
1373 | //profSigmaPi->SetLineColor(kRed+2); | |
1374 | hSigmaPi->FitSlicesY(); | |
1375 | TH1D * hSigmaPi_1 = (TH1D*)gDirectory->Get("hTOFExpSigmaPi_1"); | |
1376 | TH1D * hSigmaPi_2 = (TH1D*)gDirectory->Get("hTOFExpSigmaPi_2"); | |
1377 | hSigmaPi_1->SetLineColor(1); | |
1378 | hSigmaPi_1->SetLineWidth(2); | |
1379 | hSigmaPi_2->SetLineColor(2); | |
1380 | hSigmaPi_2->SetLineWidth(2); | |
2722289c | 1381 | } |
1382 | ||
1383 | TH2F * hSigmaKa=(TH2F*)pidList->FindObject("hTOFExpSigmaKa"); | |
6ce27f2e | 1384 | hSigmaKa->SetTitle(Form("%i: n#sigma_{TOF} kaon vs p",runNumber)); |
1385 | //TProfile * profSigmaKa = 0x0; | |
2722289c | 1386 | if (!hSigmaKa){ |
1387 | Printf("Plot hSigmaKa not available (old aliroot?)"); | |
1388 | } else { | |
2722289c | 1389 | hSigmaKa->GetYaxis()->SetRangeUser(-5.,5.); |
1390 | hSigmaKa->GetXaxis()->SetRangeUser(0.2,10.); | |
6ce27f2e | 1391 | //sprintf(profilename,"profSigmaKa"); |
1392 | //profSigmaKa = (TProfile*)hSigmaKa->ProfileX(profilename); | |
1393 | //profSigmaKa->SetLineWidth(2); | |
1394 | //profSigmaKa->SetLineColor(kBlue); | |
1395 | hSigmaKa->FitSlicesY(); | |
1396 | TH1D * hSigmaKa_1 = (TH1D*)gDirectory->Get("hTOFExpSigmaKa_1"); | |
1397 | TH1D * hSigmaKa_2 = (TH1D*)gDirectory->Get("hTOFExpSigmaKa_2"); | |
1398 | hSigmaKa_1->SetLineColor(1); | |
1399 | hSigmaKa_1->SetLineWidth(2); | |
1400 | hSigmaKa_2->SetLineColor(2); | |
1401 | hSigmaKa_2->SetLineWidth(2); | |
2722289c | 1402 | } |
add3c004 | 1403 | |
2722289c | 1404 | TH2F * hSigmaPro=(TH2F*)pidList->FindObject("hTOFExpSigmaPro"); |
6ce27f2e | 1405 | hSigmaPro->SetTitle(Form("%i: n#sigma_{TOF} proton vs p",runNumber)); |
1406 | //TProfile * profSigmaPro = 0x0; | |
2722289c | 1407 | if (!hSigmaPro){ |
1408 | Printf("Plot hSigmaPro not available (old aliroot?)"); | |
1409 | } else { | |
2722289c | 1410 | hSigmaPro->GetYaxis()->SetRangeUser(-5.,5.); |
1411 | hSigmaPro->GetXaxis()->SetRangeUser(0.2,10.); | |
6ce27f2e | 1412 | // sprintf(profilename,"profSigmaPro"); |
1413 | //profSigmaPro = (TProfile*)hSigmaPro->ProfileX(profilename); | |
1414 | //profSigmaPro->SetLineWidth(2); | |
1415 | //profSigmaPro->SetLineColor(kGreen+2); | |
1416 | hSigmaPro->FitSlicesY(); | |
1417 | TH1D * hSigmaPro_1 = (TH1D*)gDirectory->Get("hTOFExpSigmaPro_1"); | |
1418 | TH1D * hSigmaPro_2 = (TH1D*)gDirectory->Get("hTOFExpSigmaPro_2"); | |
1419 | hSigmaPro_1->SetLineColor(1); | |
1420 | hSigmaPro_1->SetLineWidth(2); | |
1421 | hSigmaPro_2->SetLineColor(2); | |
1422 | hSigmaPro_2->SetLineWidth(2); | |
2722289c | 1423 | } |
1424 | ||
1425 | if(includeStartTime && pidQAdir){ | |
6ce27f2e | 1426 | TH2F * hSigmaPiT0=(TH2F*)tofPidListT0->FindObject("hNsigmaP_TOF_pion"); |
1427 | hSigmaPiT0->SetTitle(Form("%i: n#sigma_{TOF} pion vs p, with start time",runNumber)); | |
2722289c | 1428 | hSigmaPiT0->GetYaxis()->SetRangeUser(-5.,5.); |
1429 | hSigmaPiT0->GetXaxis()->SetRangeUser(0.2,10.); | |
1430 | hSigmaPiT0->FitSlicesY(); | |
1431 | TH1D * hSigmaPiT0_1 = (TH1D*)gDirectory->Get("hNsigmaP_TOF_pion_1"); | |
1432 | TH1D * hSigmaPiT0_2 = (TH1D*)gDirectory->Get("hNsigmaP_TOF_pion_2"); | |
1433 | hSigmaPiT0_1->SetLineColor(1); | |
1434 | hSigmaPiT0_1->SetLineWidth(2); | |
1435 | hSigmaPiT0_2->SetLineColor(2); | |
1436 | hSigmaPiT0_2->SetLineWidth(2); | |
1437 | ||
6ce27f2e | 1438 | TH2F * hSigmaKaT0=(TH2F*)tofPidListT0->FindObject("hNsigmaP_TOF_kaon"); |
1439 | hSigmaKaT0->SetTitle(Form("%i: n#sigma_{TOF} kaon vs p, with start time",runNumber)); | |
2722289c | 1440 | hSigmaKaT0->GetYaxis()->SetRangeUser(-5.,5.); |
1441 | hSigmaKaT0->GetXaxis()->SetRangeUser(0.2,10.); | |
1442 | hSigmaKaT0->FitSlicesY(); | |
1443 | TH1D * hSigmaKaT0_1 = (TH1D*)gDirectory->Get("hNsigmaP_TOF_kaon_1"); | |
1444 | TH1D * hSigmaKaT0_2 = (TH1D*)gDirectory->Get("hNsigmaP_TOF_kaon_2"); | |
1445 | hSigmaKaT0_1->SetLineColor(1); | |
1446 | hSigmaKaT0_1->SetLineWidth(2); | |
1447 | hSigmaKaT0_2->SetLineColor(2); | |
1448 | hSigmaKaT0_2->SetLineWidth(2); | |
add3c004 | 1449 | |
6ce27f2e | 1450 | TH2F * hSigmaProT0=(TH2F*)tofPidListT0->FindObject("hNsigmaP_TOF_proton"); |
1451 | hSigmaProT0->SetTitle(Form("%i: n#sigma_{TOF} proton vs p, with start time",runNumber)); | |
2722289c | 1452 | hSigmaProT0->GetYaxis()->SetRangeUser(-5.,5.); |
1453 | hSigmaProT0->GetXaxis()->SetRangeUser(0.2,10.); | |
1454 | hSigmaProT0->FitSlicesY(); | |
1455 | TH1D * hSigmaProT0_1 = (TH1D*)gDirectory->Get("hNsigmaP_TOF_proton_1"); | |
1456 | TH1D * hSigmaProT0_2 = (TH1D*)gDirectory->Get("hNsigmaP_TOF_proton_2"); | |
1457 | hSigmaProT0_1->SetLineColor(1); | |
1458 | hSigmaProT0_1->SetLineWidth(2); | |
1459 | hSigmaProT0_2->SetLineColor(2); | |
1460 | hSigmaProT0_2->SetLineWidth(2); | |
1461 | } | |
1462 | ||
7cc410ff | 1463 | |
2722289c | 1464 | TCanvas *cPidPerformance3= new TCanvas("cPidPerformance3","summary of pid performance - sigmas",1200,400); |
1465 | cPidPerformance3->Divide(3,1); | |
1466 | cPidPerformance3->cd(1); | |
1467 | gPad->SetLogz(); | |
1468 | gPad->SetLogx(); | |
1469 | gPad->SetGridx(); | |
1470 | gPad->SetGridy(); | |
1471 | if (hSigmaPi){ | |
1472 | hSigmaPi->Draw("colz"); | |
6ce27f2e | 1473 | hSigmaPi_1->Draw("same"); |
1474 | hSigmaPi_2->Draw("same"); | |
1475 | //profSigmaPi->Draw("same"); | |
2722289c | 1476 | } |
1477 | cPidPerformance3->cd(2); | |
1478 | gPad->SetLogz(); | |
1479 | gPad->SetLogx(); | |
1480 | gPad->SetGridx(); | |
1481 | gPad->SetGridy(); | |
1482 | if (hSigmaKa){ | |
1483 | hSigmaKa->Draw("colz"); | |
6ce27f2e | 1484 | hSigmaKa_1->Draw("same"); |
1485 | hSigmaKa_2->Draw("same"); | |
1486 | //profSigmaKa->Draw("same"); | |
2722289c | 1487 | } |
1488 | cPidPerformance3->cd(3); | |
1489 | gPad->SetGridx(); | |
1490 | gPad->SetGridy(); | |
1491 | gPad->SetLogz(); | |
1492 | gPad->SetLogx(); | |
1493 | if (hSigmaPro){ | |
1494 | hSigmaPro->Draw("colz"); | |
6ce27f2e | 1495 | hSigmaPro_1->Draw("same"); |
1496 | hSigmaPro_2->Draw("same"); | |
1497 | //profSigmaPro->Draw("same"); | |
2722289c | 1498 | } |
1499 | ||
1500 | if(includeStartTime && pidQAdir){ | |
1501 | TLine *l1=new TLine(0.,0.,5.,0.); | |
1502 | TLine *l2=new TLine(0.,1.,5.,1.); | |
1503 | TCanvas *cPidPerformance3T0 = new TCanvas("cPidPerformance3T0","summary of pid performance - sigmas - with StartTime",1200,500); | |
1504 | cPidPerformance3T0->Divide(3,1); | |
1505 | cPidPerformance3T0->cd(1); | |
1506 | gPad->SetLogz(); | |
1507 | gPad->SetLogx(); | |
1508 | gPad->SetGridx(); | |
1509 | gPad->SetGridy(); | |
1510 | hSigmaPiT0->Draw("colz"); | |
1511 | hSigmaPiT0_1->Draw("same"); | |
1512 | hSigmaPiT0_2->Draw("same"); | |
1513 | l1->Draw("same"); | |
1514 | l2->Draw("same"); | |
1515 | cPidPerformance3T0->cd(2); | |
1516 | gPad->SetLogz(); | |
1517 | gPad->SetLogx(); | |
1518 | gPad->SetGridx(); | |
1519 | gPad->SetGridy(); | |
1520 | hSigmaKaT0->Draw("colz"); | |
1521 | hSigmaKaT0_1->Draw("same"); | |
1522 | hSigmaKaT0_2->Draw("same"); | |
1523 | l1->Draw("same"); | |
1524 | l2->Draw("same"); | |
1525 | cPidPerformance3T0->cd(3); | |
1526 | gPad->SetLogz(); | |
1527 | gPad->SetLogx(); | |
1528 | gPad->SetGridx(); | |
1529 | gPad->SetGridy(); | |
1530 | hSigmaProT0->Draw("colz"); | |
1531 | hSigmaProT0_1->Draw("same"); | |
1532 | hSigmaProT0_2->Draw("same"); | |
1533 | l1->Draw("same"); | |
1534 | l2->Draw("same"); | |
1535 | } | |
1536 | ||
1537 | if (hSigmaPi){ | |
1538 | hSigmaPi->Write(); | |
6ce27f2e | 1539 | hSigmaPi_1->Write(); |
1540 | hSigmaPi_2->Write(); | |
1541 | // profSigmaPi->Write(); | |
2722289c | 1542 | } |
1543 | if (hSigmaKa){ | |
1544 | hSigmaKa->Write(); | |
6ce27f2e | 1545 | hSigmaKa_1->Write(); |
1546 | hSigmaKa_2->Write(); | |
1547 | // profSigmaKa->Write(); | |
2722289c | 1548 | } |
1549 | if (hSigmaPro){ | |
1550 | hSigmaPro->Write(); | |
6ce27f2e | 1551 | hSigmaPro_1->Write(); |
1552 | hSigmaPro_2->Write(); | |
1553 | // profSigmaPro->Write(); | |
2722289c | 1554 | } |
1555 | if(includeStartTime && pidQAdir){ | |
1556 | hSigmaPiT0->Write(); | |
1557 | hSigmaKaT0->Write(); | |
1558 | hSigmaProT0->Write(); | |
add3c004 | 1559 | |
2722289c | 1560 | hSigmaPiT0_1->Write(); |
1561 | hSigmaKaT0_1->Write(); | |
1562 | hSigmaProT0_1->Write(); | |
1563 | ||
1564 | hSigmaPiT0_2->Write(); | |
1565 | hSigmaKaT0_2->Write(); | |
1566 | hSigmaProT0_2->Write(); | |
1567 | } | |
1568 | ||
6ce27f2e | 1569 | TCanvas* cProfile = new TCanvas("cProfile","cProfile",50,50,750,550); |
1570 | gStyle->SetOptStat(0); | |
1571 | hTOFmatchedDzVsStrip->SetTitle(Form("%i: Dz vs strip (#eta)",runNumber)); | |
1572 | hTOFmatchedDzVsStrip->Draw("colz"); | |
1573 | Int_t binmin = hTOFmatchedDzVsStrip->GetYaxis()->FindBin(-3); | |
1574 | Int_t binmax = hTOFmatchedDzVsStrip->GetYaxis()->FindBin(3); | |
1575 | TProfile* hDzProfile = (TProfile*)hTOFmatchedDzVsStrip->ProfileX("hDzProfile",binmin, binmax); | |
1576 | hDzProfile->SetLineWidth(3); | |
1577 | hDzProfile->Draw("same"); | |
1578 | cProfile->SetGridx(); | |
1579 | cProfile->SetGridy(); | |
1580 | ||
1581 | //Save png files | |
1582 | TString plotDir(Form("Plots_run%d",runNumber)); | |
1583 | gSystem->Exec(Form("mkdir %s",plotDir.Data())); | |
1584 | cMatchingPerformance->Print(Form("%s/Matching.png",plotDir.Data())); | |
1585 | cResiduals->Print(Form("%s/Residuals.png",plotDir.Data())); | |
1586 | cProfile->Print(Form("%s/ProfileDZvsStripNumber.png",plotDir.Data())); | |
1587 | cPidPerformance3->Print(Form("%s/PID_sigmas.png",plotDir.Data())); | |
1588 | if(includeStartTime && pidQAdir) | |
1589 | cPidPerformance3T0->Print(Form("%s/%i_PID_sigmaStartTime.png", plotDir.Data())); | |
1590 | if (displayAll) { | |
2722289c | 1591 | cPidPerformance->Print(Form("%s/PID.png",plotDir.Data())); |
1592 | cPidPerformance2->Print(Form("%s/PID_ExpTimes.png",plotDir.Data())); | |
6ce27f2e | 1593 | cPidPerformanceTh->Print(Form("%s/PID_theoreticalTimes.png",plotDir.Data())); |
1594 | cT0detector->Print(Form("%s/T0Detector.png",plotDir.Data())); | |
1595 | cTrackProperties->Print(Form("%s/TrackProperties.png",plotDir.Data())); | |
2722289c | 1596 | } |
1597 | fout->cd(); | |
1598 | fout->Close(); | |
1599 | fin->Close(); | |
1600 | return 0; | |
3d9550f8 | 1601 | } |
1602 | ||
1603 | //---------------------------------------------------------- | |
1604 | char * SetQAtrainOutputName(Int_t run=0,Int_t year=2011,char *period="LHC11a", char* pass="cpass1",Int_t trainId=76){ | |
1605 | ||
2722289c | 1606 | char infile[200]; |
1607 | sprintf(infile,"alien:///alice/data/%i/%s/000%d/ESDs/%s/QA%i/QAresults.root",year,period,runNumber,pass,trainId); | |
1608 | return infile; | |
3d9550f8 | 1609 | |
1610 | } | |
1611 | ||
f2717f58 | 1612 | //---------------------------------------------------------- |
1613 | Double_t GetGoodTOFChannelsRatio(Int_t run, Bool_t saveMap = kFALSE) | |
1614 | { | |
1615 | /* | |
1616 | It retrieves from OCDB the number of good (= efficient && not noisy && HW ok) TOF channels. | |
1617 | Optionally is saves the channel map | |
1618 | */ | |
1619 | if (run<=0) { | |
1620 | printf("MakeTrendingTOFqa.C - ERROR in CheckCalibStatus(): invalid run number. Please set a run number.\n"); | |
1621 | return 0.0; | |
1622 | } | |
1623 | ||
1624 | AliCDBManager *cdb = AliCDBManager::Instance(); | |
1625 | cdb->SetDefaultStorage("raw://"); | |
1626 | cdb->SetRun(run); | |
1627 | ||
1628 | AliCDBEntry *cdbe = cdb->Get("TOF/Calib/Status"); | |
1629 | if (!cdbe) { | |
1630 | printf("MakeTrendingTOFqa.C - ERROR in CheckCalibStatus(): OCDB entry not available. Please, try again.\n"); | |
1631 | return 0.0; | |
1632 | } | |
1633 | ||
1634 | AliTOFChannelOnlineStatusArray *array = (AliTOFChannelOnlineStatusArray *)cdbe->GetObject(); | |
1635 | TH2F *hOkMap = new TH2F("hOkMap", "Ok map (!noisy & !problematic & efficient);sector;strip", 72, 0., 18., 91, 0., 91.); | |
1636 | ||
1637 | AliTOFcalibHisto calibHisto; | |
1638 | calibHisto.LoadCalibHisto(); | |
1639 | AliTOFcalib calib; | |
1640 | calib.Init(); | |
de02cf58 | 1641 | |
f2717f58 | 1642 | Int_t sector, sectorStrip, padx, fea; |
1643 | Float_t hitmapx, hitmapy; | |
1644 | for (Int_t i = 0; i < array->GetSize(); i++) { | |
1645 | sector = calibHisto.GetCalibMap(AliTOFcalibHisto::kSector, i); | |
1646 | sectorStrip = calibHisto.GetCalibMap(AliTOFcalibHisto::kSectorStrip, i); | |
1647 | padx = calibHisto.GetCalibMap(AliTOFcalibHisto::kPadX, i); | |
1648 | fea = padx / 12; | |
1649 | hitmapx = sector + ((Double_t)(3 - fea) + 0.5) / 4.; | |
1650 | hitmapy = sectorStrip; | |
1651 | if ( !(array->GetNoiseStatus(i) == AliTOFChannelOnlineStatusArray::kTOFNoiseBad) && | |
1652 | (calib.IsChannelEnabled(i,kTRUE,kTRUE))) | |
1653 | hOkMap->Fill(hitmapx,hitmapy); | |
1654 | } | |
1655 | Int_t nOk=(Int_t) hOkMap->GetEntries(); | |
1656 | Double_t ratioOk=nOk/152928.; | |
1657 | if (saveMap) hOkMap->SaveAs(Form("run%i_OKChannelsMap.root",run)); | |
1658 | cout << "### Run " << run << ": TOF channels ok = " << nOk << "/ total 152928 channels = " << ratioOk*100. << "% of whole TOF" << endl; | |
1659 | return ratioOk; | |
1660 | } | |
3d9550f8 | 1661 |