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