ATO-91 Update in TPC-QA trending: MIPattach now part of dEdx descision in status...
[u/mrichter/AliRoot.git] / PWGPP / TPC / macros / drawPerformanceTPCQAMatchTrends.C
CommitLineData
f7707400 1
2// 05.2013 new functionality: Status Bar
972a253a 3// 07.2014 updated to steer most of this from the qaConfig.C
4// 09.2014 new functions to produce status lines from aliases and to write status infos to a tree for later use (see TStatToolkit).
92f227d3 5// To create the Status Bar, the following is done in principle. more info & examples in the TStatToolkit and qaConfig.C.
f7707400 6/*{
972a253a 7 TStatToolkit::SetStatusAlias(tree, "meanTPCncl", "", "varname_Out:(abs(varname-MeanEF)>6.*RMSEF):0.8");
8 TStatToolkit::SetStatusAlias(tree, "tpcItsMatchA", "", "varname_Out:(abs(varname-MeanEF)>6.*RMSEF):0.8");
9 TStatToolkit::SetStatusAlias(tree, "meanTPCncl", "", "varname_Warning:(abs(varname-MeanEF)>3.*RMSEF):0.8");
10 TStatToolkit::SetStatusAlias(tree, "tpcItsMatchA", "", "varname_Warning:(abs(varname-MeanEF)>3.*RMSEF):0.8");
11 TObjArray* oaMultGr = new TObjArray(); int igr=0;
12 oaMultGr->Add( TStatToolkit::MakeStatusMultGr(tree, "tpcItsMatchA:run", "", "(1):(meanTPCncl>0):(varname_Warning):(varname_Outlier):", igr) ); igr++;
13 oaMultGr->Add( TStatToolkit::MakeStatusMultGr(tree, "meanTPCncl:run", "", "(1):(meanTPCncl>0):(varname_Warning):(varname_Outlier):", igr) ); igr++;
92f227d3 14 TCanvas *c1 = new TCanvas("c1","c1");
15 TStatToolkit::AddStatusPad(c1, 0.30, 0.40);
972a253a 16 TStatToolkit::DrawStatusGraphs(oaMultGr);
17 }*/
18
19
20TTree *tree;
21TTree *statusTree;
22
23drawPerformanceTPCQAMatchTrends(const char* inFile = "trending.root", const char* runType="pp") {
f7707400 24 //
25 if (gSystem->Exec("ls qaConfig.C")==0)
972a253a 26 gROOT->LoadMacro( "qaConfig.C");
f7707400 27 else {
972a253a 28 printf("now loading $ALICE_ROOT/PWGPP/TPC/macros/qaConfig.C\n");
29 gROOT->LoadMacro( "$ALICE_ROOT/PWGPP/TPC/macros/qaConfig.C");
f7707400 30 }
972a253a 31
f7707400 32 //
33 // colors & markers:
34 Int_t colPosA=kGreen+2; //kRed;
35 Int_t colPosC=kMagenta+1; //kAzure-4;
36 Int_t colNegA=kGreen+2; //kRed;//kOrange;
37 Int_t colNegC=kMagenta+1; //kAzure-4;//kGreen;
38 Int_t colSum=kBlack;
39 Int_t marA1=20;
40 Int_t marA2=24;
41 Int_t marC1=20;
42 Int_t marC2=24;
43 Int_t marSum=34;//full cross
44 Int_t marCorr=31;//snowflake
972a253a 45 // shifting of graphs within one run for better visibility:
f7707400 46 Float_t sh_gr0=-0.3;
47 Float_t sh_gr1=-0.1;
48 Float_t sh_gr2=+0.1;
49 Float_t sh_gr3=+0.3;
972a253a 50 // properties of status lines:
51 // currently set in 'MakeStatusLines()'
52
f7707400 53 gROOT->Reset();
54 gROOT->SetStyle("Plain");
55 gStyle->SetPalette(1);
56 gStyle->SetLabelSize(0.04,"x");
57 gStyle->SetPadTickX(1);
58 gStyle->SetPadTickY(1);
972a253a 59
f7707400 60 float ncl_min = 80, ncl_max = 140;
61 float ratio_min = 0.6, ratio_max = 1.2;
62 float mip_min = 30, mip_max = 60;
63 float mipr_min = 0, mipr_max = 0.3;
64 float vx_min = -0.3, vx_max = 0.3;
65 float vy_min = -0.45, vy_max = 0.45;
66 float vz_min = -3, vz_max = 3;
67 float dca_min = -1.2, dca_max = 1.2;
68 float mult_min = 1, mult_max = 35;
69 float pt_min = 0, pt_max = 1.6;
70
71 if( strcmp(runType,"PbPb") == 0){
72 ncl_min = 90; ncl_max = 140;
73 ratio_min = 0.5; ratio_max = 1.1;
74 mip_min = 35; mip_max = 70;
75 mipr_min = 0; mipr_max = 0.15;
76 vx_min = -0.3; vx_max = 0.3;
77 vy_min = -0.45; vy_max = 0.45;
78 vz_min = -3; vz_max = 3;
79 dca_min = -1; dca_max = 1;
80 mult_min = 5; mult_max = 700;
81 }
82 if ( strcmp(runType,"PbPbCentr0") == 0){
83 ncl_min = 95; ncl_max = 125;
84 ratio_min = 0.5; ratio_max = 1.1;
85 mip_min = 45; mip_max = 60;
86 mipr_min = 0; mipr_max = 0.15;
87 vx_min = -0.3; vx_max = 0.3;
88 vy_min = -0.45; vy_max = 0.45;
89 vz_min = -3; vz_max = 3;
90 dca_min = -0.6; dca_max = 0.6;
91 mult_min = 5; mult_max = 2000;
92 }
93 if ( strcmp(runType,"PbPbCentr30") == 0){
94 ncl_min = 95; ncl_max = 125;
95 ratio_min = 0.5; ratio_max = 1.1;
96 mip_min = 45; mip_max = 60;
97 mipr_min = 0; mipr_max = 0.15;
98 vx_min = -0.3; vx_max = 0.3;
99 vy_min = -0.45; vy_max = 0.45;
100 vz_min = -3; vz_max = 3;
101 dca_min = -0.6; dca_max = 0.6;
102 mult_min = 5; mult_max = 500;
103 }
104 if ( strcmp(runType,"PbPbCentr70") == 0){
105 ncl_min = 95; ncl_max = 125;
106 ratio_min = 0.5; ratio_max = 1.1;
107 mip_min = 45; mip_max = 60;
108 mipr_min = 0; mipr_max = 0.15;
109 vx_min = -0.3; vx_max = 0.3;
110 vy_min = -0.45; vy_max = 0.45;
111 vz_min = -3; vz_max = 3;
112 dca_min = -0.6; dca_max = 0.6;
113 mult_min = 5; mult_max = 50;
114 }
115
92f227d3 116 // make backup of rootfile
117 //
118 TString sBackupfile(inFile);
119 sBackupfile.ReplaceAll(".root",".backup.root");
120 gSystem->Exec(Form("cp %s %s", inFile, sBackupfile.Data()));
121
f7707400 122 // open input file
123 //
92f227d3 124 TFile *_file0 = TFile::Open(inFile, "UPDATE");
972a253a 125 if(!_file0) return;
126 _file0->cd();
f7707400 127
128 //
972a253a 129 tree = (TTree*)_file0->Get("tpcQA");
f7707400 130 //TTree *tree = ch->GetTree();
131 if(!tree) return;
132 int const entries_tree = tree->GetEntries();
133 cout<<"number of tree entries: "<<entries_tree<<endl;
972a253a 134
f7707400 135 TGraphErrors *gr = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"meanTPCncl:run","");
136 int const entries = gr->GetN();
137 cout<<"number of graph entries: "<<entries<<endl;
138 cout<<"(multiple occurences of runs removed)"<<endl;
972a253a 139
f7707400 140 if(entries<3)
141 const float norm_runs = 8.0;
142 else if(entries<20)
143 const float norm_runs = 20.0;
144 else if(entries<35)
145 const float norm_runs = 35.0;
146 else
147 const float norm_runs = 50.0;
148 // 50 is the max number of runs that shall be viewed on a 1700-wide canvas
149 // only when there are more runs, the canvas shall become wider than that.
972a253a 150
f7707400 151 int const canvas_width = int(((entries*1.0)/norm_runs)*1700.0);
152 int const canvas_height = 600;
92f227d3 153 gStyle->SetPadLeftMargin(0.12*900/canvas_width);
f7707400 154 gStyle->SetPadRightMargin(0.01);
155
156 if(entries>50){
157 gStyle->SetTickLength(0.03*norm_runs/(entries*1.0),"Y");
158 gStyle->SetTitleYOffset((norm_runs/(entries*1.0))*0.8);
92f227d3 159 gStyle->SetPadLeftMargin(0.12*norm_runs/(entries*1.0));
f7707400 160 gStyle->SetPadRightMargin(0.01*norm_runs/(entries*1.0));
161 }
972a253a 162
f7707400 163 TCanvas *c1 = new TCanvas("can","can",canvas_width,canvas_height);
164 c1->SetGrid(3);
165 c1->cd();
972a253a 166
f7707400 167 //
972a253a 168 // process config file qaConfig.C to initialize status aliases (outliers etc.), status bar criteria, status lines, ...
169 //
170 TString returnStrings[3];
171 qaConfig(tree, returnStrings);
172 // configures outlier criteria and descriptions for the needed TPC variables, as specified in the qaConfig.C.
173 // defines aliases according to these criteria.
174
175 TString sStatusbarVars = returnStrings[0];
176 TString sStatusbarNames = returnStrings[1];
177 TString sCriteria = returnStrings[2];
178 cout << "sStatusbarVars = " << sStatusbarVars.Data() << endl;
179 cout << "sCriteria = " << sCriteria.Data() << endl;
180
181 //
182 // compute TPC status graphs
183 //
184 TObjArray* oaStatusbarVars = sStatusbarVars.Tokenize(";");
185 TObjArray* oaStatusbarNames = sStatusbarNames.Tokenize(";");
f7707400 186 TObjArray* oaMultGr = new TObjArray();
187 int igr=0;
972a253a 188
189 for (Int_t vari=oaStatusbarVars->GetEntriesFast()-1; vari>=0; vari--) // invert the order of the status graphs
190 {
191 TString sVar = Form("%s:run", oaStatusbarVars->At(vari)->GetName()); //e.g. -> dcar:run
192 oaMultGr->Add( TStatToolkit::MakeStatusMultGr(tree, sVar.Data(), "", sCriteria.Data(), igr) );
193 TString sYtitle = oaStatusbarNames->At(vari)->GetName(); // set better name for y axis of statuspad
194 ((TMultiGraph*) oaMultGr->At(igr))->SetTitle(sYtitle.Data());
195 igr++;
196 }
197
198 //
199 // save status into Tree and write to rootfile
92f227d3 200 // we update the original rootfile trending.root, as it is complicated to 'copy-paste' a TTree...
972a253a 201 //
202 statusTree = TStatToolkit::WriteStatusToTree(oaMultGr);
92f227d3 203 statusTree->BuildIndex("run");
204 tree->AddFriend(statusTree,"Tstatus");
205// tree->Write("", TObject::kOverwrite);
206// statusTree->Write();
207 // if we save statusTree to file here, then the run number in the plots will be always the same run. no idea why.
208 // so we do it at the end...
209 //
210 // alternative: write statusTree to different rootfile: (same problem)
211// TFile* file_out = new TFile("trendingStatusTree.root","RECREATE");
212// file_out->cd();
213// statusTree->Write();
214// file_out->Close();
215// Printf("Status tree written to file '%s'", file_out->GetName());
216
217 //afterwards one can open the rootfile and correlate the trees:
218 /*
219 // read the trees and draw tests:
220 // [terminal]$ aliroot -l trending.root
221 TTree* tree = (TTree*)_file0->Get("tpcQA");
222 tree->Draw("meanMIP:run","run>0","*");
223 TTree* statusTree = (TTree*)_file0->Get("statusTree");
224 statusTree->Draw("MIPquality_Warning:run","run>0","*");
225
226 // correlate:
227 tree->Draw("meanMIP:Tstatus.MIPquality_Warning","run>0","*");
228
229 TGraphErrors *gr = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"Tstatus.MIPquality_Warning:run","",20,kRed,1.0);
230 gr->Draw("AP");
231 */
232
233
234 cout << "Start plotting of trending graphs... " << endl;
972a253a 235 // configure the pad in which the status graphs are plotted ('status bar')
236 Float_t statPadHeight=0.30; //fraction of canvas height (was 0.25 until Aug 2014)
f7707400 237 Float_t statPadBotMar=0.40; //bottom margin of pad for run numbers
238 //
92f227d3 239 // automatic plot ranges based on outlier bands, computed for each variable later.
240 Float_t plotmean;
241 Float_t plotoutlier;
242 //
972a253a 243 c1->cd();
244
f7707400 245 /****** Number of TPC Clusters vs run number ******/
246 TGraphErrors *gr = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"meanTPCncl:run","",marA1,colPosA,1.0);
247 gr->SetName("meanTPCncl:run");
248 gr->GetHistogram()->SetYTitle("Number of TPC Clusters");
249 gr->GetHistogram()->SetTitle("p_{T} > 0.25GeV/c, |DCA_{R}| < 3cm, |DCA_{Z}| < 3cm, |#eta| < 1.0");
92f227d3 250 ComputeRange(tree, "meanTPCncl", plotmean, plotoutlier);
251 gr->GetHistogram()->SetMinimum(plotmean-3*plotoutlier);
252 gr->GetHistogram()->SetMaximum(plotmean+3*plotoutlier);
253// gr->GetHistogram()->SetMinimum(ncl_min);
254// gr->GetHistogram()->SetMaximum(ncl_max);
f7707400 255 gr->GetXaxis()->LabelsOption("v");
256 gr->Draw("AP");
972a253a 257
258 PlotStatusLines(tree,"meanTPCncl:run","");
92f227d3 259 PlotTimestamp(entries,entries_tree);
f7707400 260 TStatToolkit::AddStatusPad(c1, statPadHeight, statPadBotMar);
261 TStatToolkit::DrawStatusGraphs(oaMultGr);
262 c1->SaveAs("meanTPCncl_vs_run.png");
263 c1->Clear();
972a253a 264
f7707400 265 /****** Ratio of findable TPC clusters vs run number ******/
266 TGraphErrors *gr = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"meanTPCnclF:run","",marA1,colPosA,1.0);
267 gr->SetName("meanTPCnclF:run");
268 gr->GetHistogram()->SetYTitle("# of Found Clusters/ # of Findable Clusters");
269 gr->GetHistogram()->SetTitle("p_{T} > 0.25GeV/c, |DCA_{R}| < 3cm, |DCA_{Z}| < 3cm, |#eta| < 1.0");
92f227d3 270 ComputeRange(tree, "meanTPCnclF", plotmean, plotoutlier);
271 gr->GetHistogram()->SetMinimum(plotmean-3*plotoutlier);
272 gr->GetHistogram()->SetMaximum(plotmean+3*plotoutlier);
273// gr->GetHistogram()->SetMinimum(ratio_min);
274// gr->GetHistogram()->SetMaximum(ratio_max);
f7707400 275 gr->GetXaxis()->LabelsOption("v");
276 gr->Draw("AP");
277
972a253a 278 PlotStatusLines(tree,"meanTPCnclF:run","");
92f227d3 279 PlotTimestamp(entries,entries_tree);
f7707400 280 TStatToolkit::AddStatusPad(c1, statPadHeight, statPadBotMar);
281 TStatToolkit::DrawStatusGraphs(oaMultGr);
282 c1->SaveAs("meanTPCnclF_vs_run.png");
283 c1->Clear();
972a253a 284
f7707400 285 /****** Mean MIPs ******/
286 TGraphErrors *gr = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"meanMIP:run","",marA1,colPosA,1.0);
287 gr->SetName("meanMIP:run");
288 gr->GetHistogram()->SetYTitle("Mean of MIPs");
289 gr->GetHistogram()->SetTitle("0,4<p<0.55GeV/c, |DCA_{R}| < 3cm, |DCA_{Z}| < 3cm, |#eta| < 1.0, 80<#Cluster<160, 35<dE/dx<60");
92f227d3 290 ComputeRange(tree, "meanMIP", plotmean, plotoutlier);
291 gr->GetHistogram()->SetMinimum(plotmean-3*plotoutlier);
292 gr->GetHistogram()->SetMaximum(plotmean+3*plotoutlier);
293// gr->GetHistogram()->SetMinimum(mip_min);
294// gr->GetHistogram()->SetMaximum(mip_max);
f7707400 295 gr->GetXaxis()->LabelsOption("v");
296 gr->Draw("AP");
297
972a253a 298 PlotStatusLines(tree,"meanMIP:run","");
92f227d3 299 PlotTimestamp(entries,entries_tree);
f7707400 300 TStatToolkit::AddStatusPad(c1, statPadHeight, statPadBotMar);
301 TStatToolkit::DrawStatusGraphs(oaMultGr);
302 c1->SaveAs("meanMIP_vs_run.png");
303 c1->Clear();
972a253a 304
f7707400 305 /****** Mean MIP Resolution ******/
306 TGraphErrors *gr = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"resolutionMIP:run","",marA1,colPosA,1.0);
307 gr->SetName("resolutionMIP:run");
308 gr->GetHistogram()->SetYTitle("Resolution of MIPs");
309 gr->GetHistogram()->SetTitle("0,4<p<0.55GeV/c, |DCA_{R}| < 3cm, |DCA_{Z}| < 3cm, |#eta| < 1.0, 80<#Cluster<160, 35<dE/dx<60");
92f227d3 310 ComputeRange(tree, "resolutionMIP", plotmean, plotoutlier);
311 gr->GetHistogram()->SetMinimum(plotmean-3*plotoutlier);
312 gr->GetHistogram()->SetMaximum(plotmean+3*plotoutlier);
313// gr->GetHistogram()->SetMinimum(mipr_min);
314// gr->GetHistogram()->SetMaximum(mipr_max);
f7707400 315 gr->GetXaxis()->LabelsOption("v");
316 gr->Draw("AP");
317
972a253a 318 PlotStatusLines(tree,"resolutionMIP:run","");
92f227d3 319 PlotTimestamp(entries,entries_tree);
f7707400 320 TStatToolkit::AddStatusPad(c1, statPadHeight, statPadBotMar);
321 TStatToolkit::DrawStatusGraphs(oaMultGr);
322 c1->SaveAs("resolutionMIP_vs_run.png");
323 c1->Clear();
324
325 /****** Mean energy loss for electrons ******/
326 TGraphErrors *gr = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"meanMIPele:run","",marA1,colPosA,1.0);
327 gr->SetName("meanMIPele:run");
328 gr->GetHistogram()->SetYTitle("Mean of electron dEdx");
329 gr->GetHistogram()->SetTitle("0,32<p<0.38GeV/c, |DCA_{R}| < 3cm, |DCA_{Z}| < 3cm, |#eta| < 1.0, 80<#Cluster<160, 70<dE/dx<100");
92f227d3 330 ComputeRange(tree, "meanMIPele", plotmean, plotoutlier);
331 gr->GetHistogram()->SetMinimum(plotmean-3*plotoutlier);
332 gr->GetHistogram()->SetMaximum(plotmean+3*plotoutlier);
333// gr->GetHistogram()->SetMinimum(40);
334// gr->GetHistogram()->SetMaximum(110);
f7707400 335 gr->GetXaxis()->LabelsOption("v");
336 gr->Draw("AP");
972a253a 337
92f227d3 338 PlotStatusLines(tree,"meanMIPele:run","");
339 PlotTimestamp(entries,entries_tree);
f7707400 340 TStatToolkit::AddStatusPad(c1, statPadHeight, statPadBotMar);
341 TStatToolkit::DrawStatusGraphs(oaMultGr);
342 c1->SaveAs("meandEdxele_vs_run.png");
343 c1->Clear();
972a253a 344
345 /****** Mean Energy loss electron Resolution ******/
346
f7707400 347 TGraphErrors *gr = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"resolutionMIPele:run","",marA1,colPosA,1.0);
348 gr->SetName("resolutionMIPele:run");
349 gr->GetHistogram()->SetYTitle("Resolution of electrons dEdx");
350 //gr->GetHistogram()->SetTitle("0,4<p<0.55GeV/c, |DCA_{R}| < 3cm, |DCA_{Z}| < 3cm, |#eta| < 1.0, 80<#Cluster<160, 35<dE/dx<60");
351 gr->GetHistogram()->SetTitle("0,32<p<0.38GeV/c, |DCA_{R}| < 3cm, |DCA_{Z}| < 3cm, |#eta| < 1.0, 80<#Cluster<160, 70<dE/dx<100");
92f227d3 352 ComputeRange(tree, "resolutionMIPele", plotmean, plotoutlier);
353 gr->GetHistogram()->SetMinimum(plotmean-3*plotoutlier);
354 gr->GetHistogram()->SetMaximum(plotmean+3*plotoutlier);
355// gr->GetHistogram()->SetMinimum(mipr_min);
356// gr->GetHistogram()->SetMaximum(mipr_max);
f7707400 357 gr->GetXaxis()->LabelsOption("v");
358 gr->Draw("AP");
972a253a 359
92f227d3 360 PlotStatusLines(tree,"resolutionMIPele:run","");
361 PlotTimestamp(entries,entries_tree);
f7707400 362 TStatToolkit::AddStatusPad(c1, statPadHeight, statPadBotMar);
363 TStatToolkit::DrawStatusGraphs(oaMultGr);
364 c1->SaveAs("resolutionMeandEdxEle_vs_run.png");
365 c1->Clear();
366
972a253a 367 ////////////////////////////////////////////////////////////////////////////////////////////////
368
f7707400 369
370
f7707400 371 /****** Mean VertX ******/
372 TGraphErrors *gr = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"meanVertX:run","",marA1,colPosA,1.0);
373 gr->SetName("meanVertX:run");
374 gr->GetHistogram()->SetYTitle("Mean of Vert_{X} / [cm]");
375 gr->GetHistogram()->SetTitle("");
92f227d3 376// ComputeRange(tree, "meanVertX", plotmean, plotoutlier);
377// gr->GetHistogram()->SetMinimum(plotmean-3*plotoutlier);
378// gr->GetHistogram()->SetMaximum(plotmean+3*plotoutlier);
f7707400 379 gr->GetHistogram()->SetMinimum(vx_min);
380 gr->GetHistogram()->SetMaximum(vx_max);
381 gr->GetXaxis()->LabelsOption("v");
382 gr->Draw("AP");
383
972a253a 384 PlotStatusLines(tree,"meanVertX:run","");
92f227d3 385 PlotTimestamp(entries,entries_tree);
f7707400 386 TStatToolkit::AddStatusPad(c1, statPadHeight, statPadBotMar);
387 TStatToolkit::DrawStatusGraphs(oaMultGr);
388 c1->SaveAs("meanVertX_vs_run.png");
389 c1->Clear();
972a253a 390
f7707400 391 /****** Mean VertY ******/
392 TGraphErrors *gr = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"meanVertY:run","",marA1,colPosA,1.0);
393 gr->SetName("meanVertY:run");
394 gr->GetHistogram()->SetYTitle("Mean of Vert_{Y} / [cm]");
395 gr->GetHistogram()->SetTitle("");
92f227d3 396// ComputeRange(tree, "meanVertY", plotmean, plotoutlier);
397// gr->GetHistogram()->SetMinimum(plotmean-3*plotoutlier);
398// gr->GetHistogram()->SetMaximum(plotmean+3*plotoutlier);
f7707400 399 gr->GetHistogram()->SetMinimum(vy_min);
400 gr->GetHistogram()->SetMaximum(vy_max);
401 gr->GetXaxis()->LabelsOption("v");
402 gr->Draw("AP");
403
972a253a 404 PlotStatusLines(tree,"meanVertY:run","");
92f227d3 405 PlotTimestamp(entries,entries_tree);
f7707400 406 TStatToolkit::AddStatusPad(c1, statPadHeight, statPadBotMar);
407 TStatToolkit::DrawStatusGraphs(oaMultGr);
408 c1->SaveAs("meanVertY_vs_run.png");
409 c1->Clear();
972a253a 410
f7707400 411 /****** Mean VertZ ******/
412 TGraphErrors *gr = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"meanVertZ:run","",marA1,colPosA,1.0);
413 gr->SetName("meanVertZ:run");
414 gr->GetHistogram()->SetYTitle("Mean of Vert_{Z} / [cm]");
415 gr->GetHistogram()->SetTitle("");
92f227d3 416// ComputeRange(tree, "meanVertZ", plotmean, plotoutlier);
417// gr->GetHistogram()->SetMinimum(plotmean-3*plotoutlier);
418// gr->GetHistogram()->SetMaximum(plotmean+3*plotoutlier);
f7707400 419 gr->GetHistogram()->SetMinimum(vz_min);
420 gr->GetHistogram()->SetMaximum(vz_max);
421 gr->GetXaxis()->LabelsOption("v");
422 gr->Draw("AP");
423
972a253a 424 PlotStatusLines(tree,"meanVertZ:run","");
92f227d3 425 PlotTimestamp(entries,entries_tree);
f7707400 426 TStatToolkit::AddStatusPad(c1, statPadHeight, statPadBotMar);
427 TStatToolkit::DrawStatusGraphs(oaMultGr);
428 c1->SaveAs("meanVertZ_vs_run.png");
429 c1->Clear();
430
972a253a 431
f7707400 432 /****** Offset DCA ******/
433 TGraphErrors *gr = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"offsetdRA:run:offsetdRAErr","",marA1,colPosA,1.0,sh_gr0);
434 gr->SetName("offsetdRA:run");
435 TGraphErrors *gr1 = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"offsetdZA:run:offsetdZAErr","",marA2,colNegA,1.0,sh_gr1);
436 gr1->SetName("gr1");
437 TGraphErrors *gr2 = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"offsetdRC:run:offsetdRCErr","",marC1,colPosC,1.0,sh_gr2);
438 gr2->SetName("gr2");
439 TGraphErrors *gr3 = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"offsetdZC:run:offsetdZCErr","",marC2,colNegC,1.0,sh_gr3);
440 gr3->SetName("gr3");
972a253a 441 TGraphErrors *grComb = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"offsetd_comb4:run","",marSum,colSum,1.2);
442 grComb->SetName("grComb");
443
f7707400 444 gr->GetHistogram()->SetYTitle("DCAs / [cm]");
445 gr->GetHistogram()->SetTitle("p_{T} > 0.25GeV/c, |DCA_{R}| < 3cm, |DCA_{Z}| < 3cm, |#eta| < 0.8");
92f227d3 446 ComputeRange(tree, "offsetd_comb4", plotmean, plotoutlier);
447 gr->GetHistogram()->SetMinimum(-plotmean-2*plotoutlier);
448 gr->GetHistogram()->SetMaximum(+plotmean+2*plotoutlier);
449// gr->GetHistogram()->SetMinimum(dca_min);
450// gr->GetHistogram()->SetMaximum(dca_max);
f7707400 451 gr->GetXaxis()->LabelsOption("v");
452 gr->Draw("AP");
453 gr1->Draw("P");
454 gr2->Draw("P");
455 gr3->Draw("P");
972a253a 456 grComb->Draw("P");
f7707400 457
458 TLegend *leg = new TLegend(0.6,0.75,0.62*sqrt(norm_runs/entries),0.95,"","brNDC");
459 leg->SetTextSize(0.03);
460 leg->SetFillColor(10);
461 leg->SetBorderSize(0);
462 leg->AddEntry("offsetdRA:run","DCA_{R}, A Side","p");
463 leg->AddEntry("gr1","DCA_{Z}, A Side","p");
464 leg->AddEntry("gr2","DCA_{R}, C Side","p");
465 leg->AddEntry("gr3","DCA_{Z}, C Side","p");
972a253a 466 leg->AddEntry("grComb","combined = #sqrt{#Sigma x_{i}^{2}}","p");
f7707400 467 leg->Draw();
972a253a 468
469 PlotStatusLines(tree,"offsetd_comb4:run","");
92f227d3 470 PlotTimestamp(entries,entries_tree);
f7707400 471 TStatToolkit::AddStatusPad(c1, statPadHeight, statPadBotMar);
472 TStatToolkit::DrawStatusGraphs(oaMultGr);
473 c1->SaveAs("DCAOffset_vs_run.png");
474 c1->Clear();
972a253a 475
476
f7707400 477 /****** Mean Mult ******/
478 TGraphErrors *gr = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"meanMultPos:run:rmsMultPos","",marA1,colPosA,1.0,sh_gr1);
479 gr->SetName("meanMultPos:run");
480 TGraphErrors *gr1 = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"meanMultNeg:run:rmsMultPos","",marA2,colNegA,1.0,sh_gr2);
481 gr1->SetName("gr1");
972a253a 482 TGraphErrors *grComb = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"meanMult_comb2:run","",marSum,colSum,1.2);
483 grComb->SetName("grComb");
484
f7707400 485 gr->GetHistogram()->SetYTitle("Multiplicites of Primary Tracks");
486 gr->GetHistogram()->SetTitle("|DCA_{R}| < 3cm, |DCA_{Z}| < 3cm, #Cluster > 70");
92f227d3 487 ComputeRange(tree, "meanMult_comb2", plotmean, plotoutlier);
488 gr->GetHistogram()->SetMinimum(plotmean-3*plotoutlier);
489 gr->GetHistogram()->SetMaximum(plotmean+3*plotoutlier);
490// gr->GetHistogram()->SetMinimum(0); //gr->GetHistogram()->SetMinimum(mult_min);
491// gr->GetHistogram()->SetMaximum(100); //gr->GetHistogram()->SetMaximum(mult_max);
f7707400 492 gr->GetXaxis()->LabelsOption("v");
493 gr->Draw("AP");
494 gr1->Draw("P");
972a253a 495 grComb->Draw("P");
496
497 TLegend *leg = new TLegend(0.6,0.80,0.62*sqrt(norm_runs/entries),0.95,"","brNDC");
f7707400 498 leg->SetTextSize(0.03);
499 leg->SetFillColor(10);
500 leg->SetBorderSize(0);
501 leg->AddEntry("meanMultPos:run","Positive Charged Tracks","p");
502 leg->AddEntry("gr1","Negative Charged Tracks","p");
972a253a 503 leg->AddEntry("grComb","combined = (#Sigma x_{i})/N","p");
f7707400 504 leg->Draw();
972a253a 505
506 PlotStatusLines(tree,"meanMult_comb2:run","");
92f227d3 507 PlotTimestamp(entries,entries_tree);
f7707400 508 TStatToolkit::AddStatusPad(c1, statPadHeight, statPadBotMar);
509 TStatToolkit::DrawStatusGraphs(oaMultGr);
510 c1->SaveAs("meanMult_vs_run.png");
511 c1->Clear();
512
513 /****** TPC-ITS matching Efficiency ******/
514 TGraphErrors *gr = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"tpcItsMatchA:run","",marA1,colPosA,1.0,sh_gr0);
515 gr->SetName("tpcItsMatchA:run");
516 TGraphErrors *gr1 = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"tpcItsMatchHighPtA:run","",marA2,colNegA,1.0,sh_gr1);
517 gr1->SetName("gr1");
518 TGraphErrors *gr2 = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"tpcItsMatchC:run","",marC1,colPosC,1.0,sh_gr2);
519 gr2->SetName("gr2");
520 TGraphErrors *gr3 = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"tpcItsMatchHighPtC:run","",marC2,colNegC,1.0,sh_gr3);
521 gr3->SetName("gr3");
972a253a 522 TGraphErrors *grComb = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"tpcItsMatch_comb4:run","",marSum,colSum,1.2);
523 grComb->SetName("grComb");
524
f7707400 525 gr->GetHistogram()->SetYTitle("Matching Efficiencies");
92f227d3 526 gr->GetHistogram()->SetTitle("TPC-ITS Matching Efficiency");
527 ComputeRange(tree, "tpcItsMatch_comb4", plotmean, plotoutlier);
528 gr->GetHistogram()->SetMinimum(plotmean-3*plotoutlier);
f7707400 529 gr->GetHistogram()->SetMaximum(1.2);
530 gr->GetXaxis()->LabelsOption("v");
531 gr->Draw("AP");
532 gr1->Draw("P");
533 gr2->Draw("P");
534 gr3->Draw("P");
972a253a 535 grComb->Draw("P");
f7707400 536
537 TLegend *leg = new TLegend(0.6,0.75,0.62*sqrt(norm_runs/entries),0.95,"","brNDC");
538 leg->SetTextSize(0.03);
539 leg->SetFillColor(10);
540 leg->SetBorderSize(0);
541 leg->AddEntry("tpcItsMatchA:run","TPC-ITS matching, A Side","p");
972a253a 542 leg->AddEntry("gr1","TPC-ITS matching ( p_{T}>4GeV/c ), A Side","p");
f7707400 543 leg->AddEntry("gr2","TPC-ITS matching, C Side","p");
972a253a 544 leg->AddEntry("gr3","TPC-ITS matching ( p_{T}>4GeV/c ), C Side","p");
545 leg->AddEntry("grComb","combined = (#Sigma x_{i})/N","p");
f7707400 546 leg->Draw();
547
972a253a 548 PlotStatusLines(tree,"tpcItsMatch_comb4:run","");
92f227d3 549 PlotTimestamp(entries,entries_tree);
f7707400 550 TStatToolkit::AddStatusPad(c1, statPadHeight, statPadBotMar);
551 TStatToolkit::DrawStatusGraphs(oaMultGr);
92f227d3 552 c1->SaveAs("TPC-ITS-matching-efficiency_vs_run.png");
f7707400 553 c1->Clear();
972a253a 554
555 /****** ITS-TPC matching quality ******/
f7707400 556 TGraphErrors *gr = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"lambdaPull:run","",marA1,colPosA,1.0,sh_gr0);
557 gr->SetName("lambdaPull:run");
558 TGraphErrors *gr1 = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"ptPull:run","",marA2,colNegA,1.0,sh_gr1);
559 gr1->SetName("gr1");
560 TGraphErrors *gr2 = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"yPull:run","",marC1,colPosC,1.0,sh_gr2);
561 gr2->SetName("gr2");
562 TGraphErrors *gr3 = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"zPull:run","",marC2,colNegC,1.0,sh_gr3);
563 gr3->SetName("gr3");
972a253a 564 TGraphErrors *grComb = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"itsTpcPulls_comb4:run","",marSum,colSum,1.2);
565 grComb->SetName("grComb");
f7707400 566
567 gr->GetHistogram()->SetYTitle("Pulls");
92f227d3 568 gr->GetHistogram()->SetTitle("ITS-TPC Matching Quality");
569// ComputeRange(tree, "itsTpcPulls_comb4", plotmean, plotoutlier);
570// gr->GetHistogram()->SetMinimum(plotmean-3*plotoutlier);
571// gr->GetHistogram()->SetMaximum(plotmean+3*plotoutlier);
f7707400 572 gr->GetHistogram()->SetMinimum(-3);
573 gr->GetHistogram()->SetMaximum(3);
574 gr->GetXaxis()->LabelsOption("v");
575 gr->Draw("AP");
576 gr1->Draw("P");
577 gr2->Draw("P");
578 gr3->Draw("P");
972a253a 579 grComb->Draw("P");
f7707400 580
581 TLegend *leg = new TLegend(0.6,0.75,0.62*sqrt(norm_runs/entries),0.95,"","brNDC");
582 leg->SetTextSize(0.03);
583 leg->SetFillColor(10);
584 leg->SetBorderSize(0);
972a253a 585 leg->AddEntry("lambdaPull:run","Tan#lambda pull bias","p");
586 leg->AddEntry("gr1","q/p_{T} pull bias","p");
587 leg->AddEntry("gr2","y pull bias","p");
588 leg->AddEntry("gr3","z pull bias","p");
589 leg->AddEntry("grComb","combined = #sqrt{#Sigma x_{i}^{2}}","p");
f7707400 590 leg->Draw();
972a253a 591
592 PlotStatusLines(tree,"itsTpcPulls_comb4:run","");
92f227d3 593 PlotTimestamp(entries,entries_tree);
f7707400 594 TStatToolkit::AddStatusPad(c1, statPadHeight, statPadBotMar);
595 TStatToolkit::DrawStatusGraphs(oaMultGr);
972a253a 596 c1->SaveAs("ITS-TPC-matching-quality_vs_run.png");
f7707400 597 c1->Clear();
972a253a 598
f7707400 599 /****** pullPhi for TPC Constrain ******/
600 TGraphErrors *gr = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"tpcConstrainPhiA:run","",marA1,colPosA,1.0,sh_gr1);
601 gr->SetName("tpcConstrainPhiA:run");
602 TGraphErrors *gr1 = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"tpcConstrainPhiC:run","",marC1,colPosC,1.0,sh_gr2);
603 gr1->SetName("gr1");
972a253a 604 TGraphErrors *grComb = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"tpcConstrainPhi_comb2:run","",marSum,colSum,1.2);
605 grComb->SetName("grComb");
606
f7707400 607 gr->GetHistogram()->SetYTitle("(sin#phi_{TPC} - sin#phi_{Global})/#sigma");
608 gr->GetHistogram()->SetTitle("");
92f227d3 609 ComputeRange(tree, "tpcConstrainPhi_comb2", plotmean, plotoutlier);
610 gr->GetHistogram()->SetMinimum(-plotmean-2*plotoutlier);
611 gr->GetHistogram()->SetMaximum(+plotmean+2*plotoutlier);
612// gr->GetHistogram()->SetMinimum(-1);
613// gr->GetHistogram()->SetMaximum(1);
f7707400 614 gr->GetXaxis()->LabelsOption("v");
615 gr->Draw("AP");
616 gr1->Draw("P");
972a253a 617 grComb->Draw("P");
f7707400 618
972a253a 619 TLegend *leg = new TLegend(0.6,0.75,0.62*sqrt(norm_runs/entries),0.95,"","brNDC");
f7707400 620 leg->SetTextSize(0.03);
621 leg->SetFillColor(10);
622 leg->SetBorderSize(0);
623 leg->AddEntry("tpcConstrainPhiA:run","A Side","p");
624 leg->AddEntry("gr1","C Side","p");
972a253a 625 leg->AddEntry("grComb","combined = #sqrt{#Sigma x_{i}^{2}}","p");
f7707400 626 leg->Draw();
627
972a253a 628 PlotStatusLines(tree,"tpcConstrainPhi_comb2:run","");
92f227d3 629 PlotTimestamp(entries,entries_tree);
f7707400 630 TStatToolkit::AddStatusPad(c1, statPadHeight, statPadBotMar);
631 TStatToolkit::DrawStatusGraphs(oaMultGr);
632 c1->SaveAs("pullPhiConstrain_vs_run.png");
633 c1->Clear();
972a253a 634
f7707400 635
636 /****** 1/Pt ******/
637 // TGraphErrors *gr0 = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"deltaPt:run","");
638 TGraphErrors *gr0 = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"deltaPt:run:deltaPt_Err","",1,1,1);
639 DrawPlot(gr0, "deltaPt:run", marSum, 1.2, colSum, "AP");
640 TGraphErrors *gr2 = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"deltaPtA:run:deltaPtA_Err","",1,1,1, +sh_gr1);
641 DrawPlot(gr2, "deltaPtA:run", marA1, 1.0, colPosA, "P");
642 TGraphErrors *gr4 = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"deltaPtC:run:deltaPtC_Err","",1,1,1, -sh_gr1);
643 DrawPlot(gr4, "deltaPtC:run", marC1, 1.0, colPosC, "P");
972a253a 644
f7707400 645 gr0->GetHistogram()->SetYTitle("delta (q/pt) ");
646 gr0->GetHistogram()->SetTitle("delta (q/pt)");
92f227d3 647 ComputeRange(tree, "deltaPt", plotmean, plotoutlier);
648 gr0->GetHistogram()->SetMinimum(plotmean-3*plotoutlier);
649 gr0->GetHistogram()->SetMaximum(plotmean+3*plotoutlier);
650// gr0->GetHistogram()->SetMinimum(-0.008);
651// gr0->GetHistogram()->SetMaximum(0.008);
f7707400 652 gr0->GetXaxis()->LabelsOption("v");
653
972a253a 654 TLegend *leg = new TLegend(0.6,0.75,0.62*sqrt(norm_runs/entries),0.95,"","brNDC");
f7707400 655 leg->SetTextSize(0.03);
656 leg->SetFillColor(10);
657 leg->SetBorderSize(0);
658 leg->AddEntry("deltaPt:run","deltaPt: both sides","ap");
659 leg->AddEntry("deltaPtA:run","deltaPtA: A side only","p");
660 leg->AddEntry("deltaPtC:run","deltaPtC: C side only","p");
661 leg->Draw();
972a253a 662
663 PlotStatusLines(tree,"deltaPt:run","");
92f227d3 664 PlotTimestamp(entries,entries_tree);
f7707400 665 TStatToolkit::AddStatusPad(c1, statPadHeight, statPadBotMar);
666 TStatToolkit::DrawStatusGraphs(oaMultGr);
667 c1->SaveAs("1overPt_vs_run.png");
668 c1->Clear();
972a253a 669
670
f7707400 671 /****** DCAr fitting parameters ******/
672 TGraphErrors *gr = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"dcarAP0:run","",marA1,colPosA,1.0,sh_gr0);
673 gr->SetName("dcarAP0:run");
674 TGraphErrors *gr1 = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"dcarAP1:run","",marA2,colNegA,1.0,sh_gr1);
675 gr1->SetName("gr1");
676 TGraphErrors *gr2 = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"dcarCP0:run","",marC1,colPosC,1.0,sh_gr2);
677 gr2->SetName("gr2");
678 TGraphErrors *gr3 = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"dcarCP1:run","",marC2,colNegC,1.0,sh_gr3);
679 gr3->SetName("gr3");
972a253a 680 TGraphErrors *grComb = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"dcarFitpar_comb4:run","",marSum,colSum,1.2);
681 grComb->SetName("grComb");
682
f7707400 683 gr->GetHistogram()->SetYTitle("DCAR Fitting Parameters");
684 gr->GetHistogram()->SetTitle("sqrt(P0^{2} + P1^{2}/(pT^{2}))");
92f227d3 685 ComputeRange(tree, "dcarFitpar_comb4", plotmean, plotoutlier);
686 gr->GetHistogram()->SetMinimum(-plotmean-3*plotoutlier);
687 gr->GetHistogram()->SetMaximum(+plotmean+3*plotoutlier);
f7707400 688 gr->GetHistogram()->SetMinimum(-1);
689 gr->GetHistogram()->SetMaximum(1);
690 gr->GetXaxis()->LabelsOption("v");
691 gr->Draw("AP");
692 gr1->Draw("P");
693 gr2->Draw("P");
694 gr3->Draw("P");
972a253a 695 grComb->Draw("P");
f7707400 696
697 TLegend *leg = new TLegend(0.6,0.75,0.62*sqrt(norm_runs/entries),0.95,"","brNDC");
698 leg->SetTextSize(0.03);
699 leg->SetFillColor(10);
700 leg->SetBorderSize(0);
701 leg->AddEntry("dcarAP0:run","P0, A Side","p");
702 leg->AddEntry("gr1","P1, A Side","p");
703 leg->AddEntry("gr2","P0, C Side","p");
704 leg->AddEntry("gr3","P1, C Side","p");
972a253a 705 leg->AddEntry("grComb","combined = (#Sigma x_{i})/N","p");
f7707400 706 leg->Draw();
972a253a 707
708 PlotStatusLines(tree,"dcarFitpar_comb4:run","");
92f227d3 709 PlotTimestamp(entries,entries_tree);
f7707400 710 TStatToolkit::AddStatusPad(c1, statPadHeight, statPadBotMar);
711 TStatToolkit::DrawStatusGraphs(oaMultGr);
712 c1->SaveAs("dcar_fitting_run.png");
713 c1->Clear();
972a253a 714
f7707400 715 ////////////////////////////////////////////////////////////////////////
716 //test DCAR plots
717 //DCAr first parameter _0
972a253a 718
f7707400 719 TCanvas *c2 = new TCanvas("can2","can2",canvas_width,canvas_height);
720 c2->cd();
721 c2->Update();
722 c2->SetGrid(3);
972a253a 723
f7707400 724 //TGraphErrors *gr0 = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"dcar_posA_0:run","",1,1,1,sh_gr0);
725 TGraphErrors *gr0 = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"dcar_posA_0:run:dcar_posA_0_Err","",1,1,1,sh_gr0);
726 DrawPlot(gr0, "dcar_posA_0:run", marA1, 1.0, colPosA, "AP");
727 TGraphErrors *gr1 = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"dcar_negA_0:run:dcar_negA_0_Err","",1,1,1,sh_gr1);
728 DrawPlot(gr1, "dcar_negA_0:run", marA2, 1.0, colNegA, "P");
729 TGraphErrors *gr2 = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"dcar_posC_0:run:dcar_posC_0_Err","",1,1,1,sh_gr2);
730 DrawPlot(gr2, "dcar_posC_0:run", marC1, 1.0, colPosC, "P");
731 TGraphErrors *gr3 = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"dcar_negC_0:run:dcar_negC_0_Err","",1,1,1,sh_gr3);
732 DrawPlot(gr3, "dcar_negC_0:run", marC2, 1.0, colNegC, "P");
972a253a 733 TGraphErrors *grComb = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"dcar0_comb4:run","",1,1,1);
734 DrawPlot(grComb, "grComb", marSum, 1.4, colSum, "P");
735
f7707400 736 gr0->GetHistogram()->SetYTitle("DCARs");
92f227d3 737 ComputeRange(tree, "dcar0_comb4", plotmean, plotoutlier);
738 gr0->GetHistogram()->SetMinimum(-plotmean-2*plotoutlier);
739 gr0->GetHistogram()->SetMaximum(+plotmean+2*plotoutlier);
740// gr0->GetHistogram()->SetMinimum(-0.2);
741// gr0->GetHistogram()->SetMaximum(0.2);
f7707400 742 gr0->GetHistogram()->SetTitleOffset(10);
743 gr0->GetXaxis()->LabelsOption("v");
972a253a 744 gr0->SetName("dcar_posA_0:run");
f7707400 745
972a253a 746 TLegend *leg = new TLegend(0.6,0.75,0.62*sqrt(norm_runs/entries),0.95,"","brNDC");
f7707400 747 leg->SetTextSize(0.03);
748 leg->SetFillColor(10);
749 leg->SetBorderSize(0);
972a253a 750 leg->AddEntry("dcar_posA_0:run","dcar_posA_0","p");
f7707400 751 leg->AddEntry("dcar_negA_0:run","dcar_negA_0","p");
752 leg->AddEntry("dcar_posC_0:run","dcar_posC_0","p");
753 leg->AddEntry("dcar_negC_0:run","dcar_negC_0","p");
972a253a 754 leg->AddEntry("grComb","combined = #sqrt{#Sigma x_{i}^{2}}","p");
f7707400 755 leg->Draw();
756
972a253a 757 PlotStatusLines(tree,"dcar0_comb4:run","");
92f227d3 758 PlotTimestamp(entries,entries_tree);
f7707400 759 TStatToolkit::AddStatusPad(c2, statPadHeight, statPadBotMar);
760 TStatToolkit::DrawStatusGraphs(oaMultGr);
761 c2->SaveAs("dcar_0_vs_run.png");//for C,A side and pos/neg particle
762 c2->Update();
972a253a 763
f7707400 764 ////////////////////////////////////////////////////////////////////////
765 //DCAr second parameter _1
766
767 TCanvas *c3 = new TCanvas("can3","can3",canvas_width,canvas_height);
768 c3->cd();
769 c3->Update();
770 c3->SetGrid(3);
771
772 TGraphErrors *gr0 = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"dcar_posA_1:run:dcar_posA_1_Err","",1,1,1,sh_gr0);
773 DrawPlot(gr0, "dcar_posA_1:run", marA1, 1.0, colPosA, "AP");
774 TGraphErrors *gr1 = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"dcar_negA_1:run:dcar_negA_1_Err","",1,1,1,sh_gr1);
775 DrawPlot(gr1, "dcar_negA_1:run", marA2, 1.0, colNegA, "P");
776 TGraphErrors *gr2 = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"dcar_posC_1:run:dcar_posC_1_Err","",1,1,1,sh_gr2);
777 DrawPlot(gr2, "dcar_posC_1:run", marC1, 1.0, colPosC, "P");
778 TGraphErrors *gr3 = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"dcar_negC_1:run:dcar_negC_1_Err","",1,1,1,sh_gr3);
779 DrawPlot(gr3, "dcar_negC_1:run", marC2, 1.0, colNegC, "P");
972a253a 780 TGraphErrors *grComb = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"dcar1_comb4:run","",1,1,1);
781 DrawPlot(grComb, "grComb", marSum, 1.4, colSum, "P");
f7707400 782
783 gr0->GetHistogram()->SetYTitle("DCARs");
92f227d3 784 ComputeRange(tree, "dcar1_comb4", plotmean, plotoutlier);
785 gr0->GetHistogram()->SetMinimum(-plotmean-2*plotoutlier);
786 gr0->GetHistogram()->SetMaximum(+plotmean+2*plotoutlier);
787// gr0->GetHistogram()->SetMinimum(-0.1);
788// gr0->GetHistogram()->SetMaximum(0.1);
f7707400 789 gr0->GetHistogram()->SetTitleOffset(10);
790 gr0->GetXaxis()->LabelsOption("v");
972a253a 791 gr0->SetName("dcar_posA_1:run");
f7707400 792
972a253a 793 TLegend *leg = new TLegend(0.6,0.75,0.62*sqrt(norm_runs/entries),0.95,"","brNDC");
f7707400 794 leg->SetTextSize(0.03);
795 leg->SetFillColor(10);
796 leg->SetBorderSize(0);
972a253a 797 leg->AddEntry("dcar_posA_1:run","dcar_posA_1","p");
f7707400 798 leg->AddEntry("dcar_negA_1:run","dcar_negA_1","p");
799 leg->AddEntry("dcar_posC_1:run","dcar_posC_1","p");
800 leg->AddEntry("dcar_negC_1:run","dcar_negC_1","p");
972a253a 801 leg->AddEntry("grComb","combined = #sqrt{#Sigma x_{i}^{2}}","p");
f7707400 802 leg->Draw();
803
972a253a 804 PlotStatusLines(tree,"dcar1_comb4:run","");
92f227d3 805 PlotTimestamp(entries,entries_tree);
f7707400 806 TStatToolkit::AddStatusPad(c3, statPadHeight, statPadBotMar);
807 TStatToolkit::DrawStatusGraphs(oaMultGr);
808 c3->SaveAs("dcar_1_vs_run.png");//for C,A side and pos/neg particle
809 c3->Update();
810
811 ////////////////////////////////////////////////////////////////////////
812 //DCAr third parameter _2
813
814 TCanvas *c5 = new TCanvas("can5","can5",canvas_width,canvas_height);
815 c5->cd();
816 c5->Update();
817 c5->SetGrid(3);
972a253a 818
f7707400 819 TGraphErrors *gr0 = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"dcar_posA_2:run:dcar_posA_2_Err","",1,1,1,sh_gr0);
820 DrawPlot(gr0, "dcar_posA_2:run", marA1, 1.0, colPosA, "AP");
821 TGraphErrors *gr1 = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"dcar_negA_2:run:dcar_negA_2_Err","",1,1,1,sh_gr1);
822 DrawPlot(gr1, "dcar_negA_2:run", marA2, 1.0, colNegA, "P");
823 TGraphErrors *gr2 = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"dcar_posC_2:run:dcar_posC_2_Err","",1,1,1,sh_gr2);
824 DrawPlot(gr2, "dcar_posC_2:run", marC1, 1.0, colPosC, "P");
825 TGraphErrors *gr3 = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"dcar_negC_2:run:dcar_negC_2_Err","",1,1,1,sh_gr3);
826 DrawPlot(gr3, "dcar_negC_2:run", marC2, 1.0, colNegC, "P");
972a253a 827 TGraphErrors *grComb = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"dcar2_comb4:run","",1,1,1);
828 DrawPlot(grComb, "grComb", marSum, 1.4, colSum, "P");
829
f7707400 830 gr0->GetHistogram()->SetYTitle("DCARs");
92f227d3 831 ComputeRange(tree, "dcar2_comb4", plotmean, plotoutlier);
832 gr0->GetHistogram()->SetMinimum(-plotmean-2*plotoutlier);
833 gr0->GetHistogram()->SetMaximum(+plotmean+2*plotoutlier);
834// gr0->GetHistogram()->SetMinimum(-0.1);
835// gr0->GetHistogram()->SetMaximum(0.1);
f7707400 836 gr0->GetHistogram()->SetTitleOffset(10);
837 gr0->GetXaxis()->LabelsOption("v");
972a253a 838 gr0->SetName("dcar_posA_2:run");
f7707400 839
972a253a 840 TLegend *leg = new TLegend(0.6,0.75,0.62*sqrt(norm_runs/entries),0.95,"","brNDC");
f7707400 841 leg->SetTextSize(0.03);
842 leg->SetFillColor(10);
843 leg->SetBorderSize(0);
972a253a 844 leg->AddEntry("dcar_posA_2:run","dcar_posA_2","p");
f7707400 845 leg->AddEntry("dcar_negA_2:run","dcar_negA_2","p");
846 leg->AddEntry("dcar_posC_2:run","dcar_posC_2","p");
847 leg->AddEntry("dcar_negC_2:run","dcar_negC_2","p");
972a253a 848 leg->AddEntry("grComb","combined = #sqrt{#Sigma x_{i}^{2}}","p");
f7707400 849 leg->Draw();
850
972a253a 851 PlotStatusLines(tree,"dcar2_comb4:run","");
92f227d3 852 PlotTimestamp(entries,entries_tree);
f7707400 853 TStatToolkit::AddStatusPad(c5, statPadHeight, statPadBotMar);
854 TStatToolkit::DrawStatusGraphs(oaMultGr);
855 c5->SaveAs("dcar_2_vs_run.png");//for C,A side and pos/neg particle
856 c5->Update();
972a253a 857
f7707400 858 ////////////////////////////////////////////////////////////////////////
859 //DCAz parameters
860 //Dcaz first parameter _0
972a253a 861
f7707400 862 TCanvas *c6 = new TCanvas("can6","can6",canvas_width,canvas_height);
863 c6->cd();
864 c6->Update();
865 c6->SetGrid(3);
972a253a 866
f7707400 867 TGraphErrors *gr0 = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"dcaz_posA_0:run:dcaz_posA_0_Err","",1,1,1,sh_gr0);
868 DrawPlot(gr0, "dcaz_posA_0:run", marA1, 1.0, colPosA, "AP");
869 TGraphErrors *gr1 = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"dcaz_negA_0:run:dcaz_negA_0_Err","",1,1,1,sh_gr1);
870 DrawPlot(gr1, "dcaz_negA_0:run", marA2, 1.0, colNegA, "P");
871 TGraphErrors *gr2 = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"dcaz_posC_0:run:dcaz_posC_0_Err","",1,1,1,sh_gr2);
872 DrawPlot(gr2, "dcaz_posC_0:run", marC1, 1.0, colPosC, "P");
873 TGraphErrors *gr3 = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"dcaz_negC_0:run:dcaz_negC_0_Err","",1,1,1,sh_gr3);
874 DrawPlot(gr3, "dcaz_negC_0:run", marC2, 1.0, colNegC, "P");
972a253a 875 TGraphErrors *grComb = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"dcaz0_comb4:run","",1,1,1);
876 DrawPlot(grComb, "grComb", marSum, 1.4, colSum, "P");
877
f7707400 878 gr0->GetHistogram()->SetYTitle("DCAZs");
92f227d3 879 ComputeRange(tree, "dcaz0_comb4", plotmean, plotoutlier);
880 gr0->GetHistogram()->SetMinimum(-plotmean-2*plotoutlier);
881 gr0->GetHistogram()->SetMaximum(+plotmean+2*plotoutlier);
882// gr0->GetHistogram()->SetMinimum(-2.);
883// gr0->GetHistogram()->SetMaximum(2.);
f7707400 884 gr0->GetHistogram()->SetTitleOffset(10);
885 gr0->GetXaxis()->LabelsOption("v");
972a253a 886 gr0->SetName("dcaz_posA_0:run");
f7707400 887
972a253a 888 TLegend *leg = new TLegend(0.6,0.75,0.62*sqrt(norm_runs/entries),0.95,"","brNDC");
f7707400 889 leg->SetTextSize(0.03);
890 leg->SetFillColor(10);
891 leg->SetBorderSize(0);
972a253a 892 leg->AddEntry("dcaz_posA_0:run","dcaz_posA_0","p");
f7707400 893 leg->AddEntry("dcaz_negA_0:run","dcaz_negA_0","p");
894 leg->AddEntry("dcaz_posC_0:run","dcaz_posC_0","p");
895 leg->AddEntry("dcaz_negC_0:run","dcaz_negC_0","p");
972a253a 896 leg->AddEntry("grComb","combined = #sqrt{#Sigma x_{i}^{2}}","p");
f7707400 897 leg->Draw();
898
972a253a 899 PlotStatusLines(tree,"dcaz0_comb4:run","");
92f227d3 900 PlotTimestamp(entries,entries_tree);
f7707400 901 TStatToolkit::AddStatusPad(c6, statPadHeight, statPadBotMar);
902 TStatToolkit::DrawStatusGraphs(oaMultGr);
903 c6->SaveAs("dcaz_0_vs_run.png");//for C,A side and pos/neg particle
904 c6->Update();
972a253a 905
f7707400 906 ////////////////////////////////////////////////////////////////////////
907 //Dcaz second parameter _1
908
909 TCanvas *c7 = new TCanvas("can7","can7",canvas_width,canvas_height);
910 c7->cd();
911 c7->Update();
912 c7->SetGrid(3);
972a253a 913
f7707400 914 TGraphErrors *gr0 = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"dcaz_posA_1:run:dcaz_posA_1_Err","",1,1,1,sh_gr0);
915 DrawPlot(gr0, "dcaz_posA_1:run", marA1, 1.0, colPosA, "AP");
916 TGraphErrors *gr1 = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"dcaz_negA_1:run:dcaz_negA_1_Err","",1,1,1,sh_gr1);
917 DrawPlot(gr1, "dcaz_negA_1:run", marA2, 1.0, colNegA, "P");
918 TGraphErrors *gr2 = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"dcaz_posC_1:run:dcaz_posC_1_Err","",1,1,1,sh_gr2);
919 DrawPlot(gr2, "dcaz_posC_1:run", marC1, 1.0, colPosC, "P");
920 TGraphErrors *gr3 = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"dcaz_negC_1:run:dcaz_negC_1_Err","",1,1,1,sh_gr3);
921 DrawPlot(gr3, "dcaz_negC_1:run", marC2, 1.0, colNegC, "P");
972a253a 922 TGraphErrors *grComb = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"dcaz1_comb4:run","",1,1,1);
923 DrawPlot(grComb, "grComb", marSum, 1.4, colSum, "P");
924
f7707400 925 gr0->GetHistogram()->SetYTitle("DCAZs");
92f227d3 926 ComputeRange(tree, "dcaz1_comb4", plotmean, plotoutlier);
927 gr0->GetHistogram()->SetMinimum(-plotmean-2*plotoutlier);
928 gr0->GetHistogram()->SetMaximum(+plotmean+2*plotoutlier);
929// gr0->GetHistogram()->SetMinimum(-0.2);
930// gr0->GetHistogram()->SetMaximum(0.2);
f7707400 931 gr0->GetHistogram()->SetTitleOffset(10);
932 gr0->GetXaxis()->LabelsOption("v");
972a253a 933 gr0->SetName("dcaz_posA_1:run");
f7707400 934
972a253a 935 TLegend *leg = new TLegend(0.6,0.75,0.62*sqrt(norm_runs/entries),0.95,"","brNDC");
f7707400 936 leg->SetTextSize(0.03);
937 leg->SetFillColor(10);
938 leg->SetBorderSize(0);
972a253a 939 leg->AddEntry("dcaz_posA_1:run","dcaz_posA_1","p");
f7707400 940 leg->AddEntry("dcaz_negA_1:run","dcaz_negA_1","p");
941 leg->AddEntry("dcaz_posC_1:run","dcaz_posC_1","p");
942 leg->AddEntry("dcaz_negC_1:run","dcaz_negC_1","p");
972a253a 943 leg->AddEntry("grComb","combined = #sqrt{#Sigma x_{i}^{2}}","p");
f7707400 944 leg->Draw();
945
972a253a 946 PlotStatusLines(tree,"dcaz1_comb4:run","");
92f227d3 947 PlotTimestamp(entries,entries_tree);
f7707400 948 TStatToolkit::AddStatusPad(c7, statPadHeight, statPadBotMar);
949 TStatToolkit::DrawStatusGraphs(oaMultGr);
950 c7->SaveAs("dcaz_1_vs_run.png");//for C,A side and pos/neg particle
951 c7->Update();
952
953 ////////////////////////////////////////////////////////////////////////
954 //Dcaz third parameter _2
955
956 TCanvas *c8 = new TCanvas("can8","can8",canvas_width,canvas_height);
957 c8->cd();
958 c8->Update();
959 c8->SetGrid(3);
972a253a 960
f7707400 961 TGraphErrors *gr0 = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"dcaz_posA_2:run:dcaz_posA_2_Err","",1,1,1,sh_gr0);
962 DrawPlot(gr0, "dcaz_posA_2:run", marA1, 1.0, colPosA, "AP");
963 TGraphErrors *gr1 = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"dcaz_negA_2:run:dcaz_negA_2_Err","",1,1,1,sh_gr1);
964 DrawPlot(gr1, "dcaz_negA_2:run", marA2, 1.0, colNegA, "P");
965 TGraphErrors *gr2 = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"dcaz_posC_2:run:dcaz_posC_2_Err","",1,1,1,sh_gr2);
966 DrawPlot(gr2, "dcaz_posC_2:run", marC1, 1.0, colPosC, "P");
967 TGraphErrors *gr3 = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"dcaz_negC_2:run:dcaz_negC_2_Err","",1,1,1,sh_gr3);
968 DrawPlot(gr3, "dcaz_negC_2:run", marC2, 1.0, colNegC, "P");
972a253a 969 TGraphErrors *grComb = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"dcaz2_comb4:run","",1,1,1);
970 DrawPlot(grComb, "grComb", marSum, 1.4, colSum, "P");
f7707400 971
972 gr0->GetHistogram()->SetYTitle("DCAZs");
92f227d3 973 ComputeRange(tree, "dcaz2_comb4", plotmean, plotoutlier);
974 gr0->GetHistogram()->SetMinimum(-plotmean-2*plotoutlier);
975 gr0->GetHistogram()->SetMaximum(+plotmean+2*plotoutlier);
976// gr0->GetHistogram()->SetMinimum(-0.1);
977// gr0->GetHistogram()->SetMaximum(0.1);
f7707400 978 gr0->GetHistogram()->SetTitleOffset(10);
979 gr0->GetXaxis()->LabelsOption("v");
972a253a 980 gr0->SetName("dcaz_posA_2:run");
f7707400 981
972a253a 982 TLegend *leg = new TLegend(0.6,0.75,0.62*sqrt(norm_runs/entries),0.95,"","brNDC");
f7707400 983 leg->SetTextSize(0.03);
984 leg->SetFillColor(10);
985 leg->SetBorderSize(0);
972a253a 986 leg->AddEntry("dcaz_posA_2:run","dcaz_posA_2","p");
f7707400 987 leg->AddEntry("dcaz_negA_2:run","dcaz_negA_2","p");
988 leg->AddEntry("dcaz_posC_2:run","dcaz_posC_2","p");
989 leg->AddEntry("dcaz_negC_2:run","dcaz_negC_2","p");
972a253a 990 leg->AddEntry("grComb","combined = #sqrt{#Sigma x_{i}^{2}}","p");
f7707400 991 leg->Draw();
992
972a253a 993 PlotStatusLines(tree,"dcaz2_comb4:run","");
92f227d3 994 PlotTimestamp(entries,entries_tree);
f7707400 995 TStatToolkit::AddStatusPad(c8, statPadHeight, statPadBotMar);
996 TStatToolkit::DrawStatusGraphs(oaMultGr);
997 c8->SaveAs("dcaz_2_vs_run.png");//for C,A side and pos/neg particle
998 c8->Update();
972a253a 999
f7707400 1000 ///////////////////////////////////////////////////////////////////////////////////////////////
1001 // Plot Occupancy IROC, OROC, A,C side
1002
1003 TCanvas *c9 = new TCanvas("can9","can9",canvas_width,canvas_height);
1004 c9->cd();
1005 c9->Update();
1006 c9->SetGrid(3);
972a253a 1007
f7707400 1008 TGraphErrors *gr0 = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"iroc_A_side:run","",marA1,colPosA,1.0,sh_gr0);
1009 gr0->SetName("iroc_A_side:run");
f7707400 1010 TGraphErrors *gr1 = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"oroc_A_side:run","",marA2,colNegA,1.0,sh_gr1);
1011 gr1->SetName("gr1");
f7707400 1012 TGraphErrors *gr2 = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"iroc_C_side:run","",marC1,colPosC,1.0,sh_gr2);
1013 gr2->SetName("gr2");
f7707400 1014 TGraphErrors *gr3 = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"oroc_C_side:run","",marC2,colNegC,1.0,sh_gr3);
1015 gr3->SetName("gr3");
972a253a 1016
f7707400 1017 gr0->GetHistogram()->SetYTitle("(nr_Chamber) - (nr_Chamber_lowOcc)");
1018 gr0->GetHistogram()->SetMinimum(14.0);
1019 gr0->GetHistogram()->SetMaximum(20.0);
1020 gr0->GetHistogram()->SetTitleOffset(10);
1021 gr0->GetXaxis()->LabelsOption("v");
1022 gr0->SetName("occ_AC_Side_IROC_OROC:run");
1023
1024 gr0->Draw("AP");
1025 gr1->Draw("P");
1026 gr2->Draw("P");
1027 gr3->Draw("P");
972a253a 1028
1029 TLegend *leg = new TLegend(0.6,0.75,0.62*sqrt(norm_runs/entries),0.95,"","brNDC");
f7707400 1030 leg->SetTextSize(0.03);
1031 leg->SetFillColor(10);
1032 leg->SetBorderSize(0);
1033 leg->AddEntry("occ_AC_Side_IROC_OROC:run","iroc_A_side","p");
1034 leg->AddEntry("gr1","oroc_A_side","p");
1035 leg->AddEntry("gr2","iroc_C_side","p");
1036 leg->AddEntry("gr3","oroc_C_side","p");
1037 leg->Draw();
972a253a 1038
92f227d3 1039 PlotTimestamp(entries,entries_tree);
f7707400 1040 TStatToolkit::AddStatusPad(c9, statPadHeight, statPadBotMar);
1041 TStatToolkit::DrawStatusGraphs(oaMultGr);
1042 c9->SaveAs("occ_AC_Side_IROC_OROC_vs_run.png");//for C,A side and IROC,OROC
1043 c9->Update();
972a253a 1044
1045 /****** attachment parameters for A and C side ******/
f7707400 1046
1047 TCanvas *c10 = new TCanvas("can10","can10",canvas_width,canvas_height);
1048 c10->cd();
1049 c10->Update();
1050 c10->SetGrid(3);
1051
92f227d3 1052 TGraphErrors *gr = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"MIPattachSlopeA:run","",marA1,colPosA,1.0,sh_gr1);
f7707400 1053 gr->SetName("MIPattachSlopeA:run");
92f227d3 1054 TGraphErrors *gr1 = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"MIPattachSlopeC*(-1):run","",marC1,colPosC,1.0,sh_gr2);
1055 gr1->SetName("gr1");
1056 TGraphErrors *grComb = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"MIPattachSlope_comb2:run","",marSum,colSum,1.2);
1057 grComb->SetName("grComb");
1058
f7707400 1059 gr->GetHistogram()->SetYTitle("Attachment parameter p1");
92f227d3 1060 gr->GetHistogram()->SetTitle("showing p1 of fit: p0 + p1 * tan(#theta)"); // info from Marian, 19.11.2014. to be checked in code that produces the tree.
1061 ComputeRange(tree, "MIPattachSlope_comb2", plotmean, plotoutlier);
1062 gr->GetHistogram()->SetMinimum(plotmean-3*plotoutlier);
1063 gr->GetHistogram()->SetMaximum(plotmean+3*plotoutlier);
f7707400 1064 gr->GetXaxis()->LabelsOption("v");
1065 gr->Draw("AP");
92f227d3 1066 gr1->Draw("P");
1067 grComb->Draw("P");
1068
1069 TLegend *leg = new TLegend(0.6,0.75,0.62*sqrt(norm_runs/entries),0.95,"","brNDC");
1070 leg->SetTextSize(0.03);
1071 leg->SetFillColor(10);
1072 leg->SetBorderSize(0);
1073 leg->AddEntry("MIPattachSlopeA:run","A Side","p");
1074 leg->AddEntry("gr1","C Side *(-1)","p");
1075 leg->AddEntry("grComb","combined = (#Sigma x_{i})/N","p");
1076 leg->Draw();
972a253a 1077
92f227d3 1078 PlotStatusLines(tree,"MIPattachSlope_comb2:run","");
1079 PlotTimestamp(entries,entries_tree);
f7707400 1080 TStatToolkit::AddStatusPad(c10, statPadHeight, statPadBotMar);
1081 TStatToolkit::DrawStatusGraphs(oaMultGr);
92f227d3 1082 c10->SaveAs("MIPattachSlopes_vs_run.png");
f7707400 1083 c10->Clear();
972a253a 1084
92f227d3 1085// //C side
1086// TCanvas *c11 = new TCanvas("can11","can11",canvas_width,canvas_height);
1087// c11->cd();
1088// c11->Update();
1089// c11->SetGrid(3);
1090//
1091// TGraphErrors *gr = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"MIPattachSlopeC*(-1):run","",marA1,colPosA,1.0);
1092// gr->SetName("MIPattachSlopeC:run");
1093// gr->GetHistogram()->SetYTitle("Attachment parameter p1");
1094// gr->GetHistogram()->SetMinimum(-10);
1095// gr->GetHistogram()->SetMaximum(+10);
1096// gr->GetXaxis()->LabelsOption("v");
1097// gr->Draw("AP");
1098//
1099// PlotStatusLines(tree,"MIPattachSlopeC:run","");
1100// PlotTimestamp(entries,entries_tree);
1101// TStatToolkit::AddStatusPad(c11, statPadHeight, statPadBotMar);
1102// TStatToolkit::DrawStatusGraphs(oaMultGr);
1103// c11->SaveAs("MIPattachSlopeC_vs_run.png");
1104// c11->Clear();
972a253a 1105
f7707400 1106 /****** electron and MIPs separation ******/
972a253a 1107
f7707400 1108 TCanvas *c12 = new TCanvas("can12","can12",canvas_width,canvas_height);
1109 c12->cd();
1110 c12->Update();
1111 c12->SetGrid(3);
972a253a 1112
f7707400 1113 TGraphErrors *gr = (TGraphErrors*) TStatToolkit::MakeGraphSparse(tree,"electroMIPSeparation:run","",marA1,colPosA,1.0);
1114 gr->SetName("electroMIPSeparation:run");
1115 gr->GetHistogram()->SetYTitle("Electron - MIP");
92f227d3 1116 ComputeRange(tree, "electroMIPSeparation", plotmean, plotoutlier);
1117 gr->GetHistogram()->SetMinimum(plotmean-3*plotoutlier);
1118 gr->GetHistogram()->SetMaximum(plotmean+3*plotoutlier);
f7707400 1119 gr->GetXaxis()->LabelsOption("v");
1120 gr->Draw("AP");
972a253a 1121
92f227d3 1122 PlotStatusLines(tree,"electroMIPSeparation:run","");
1123 PlotTimestamp(entries,entries_tree);
f7707400 1124 TStatToolkit::AddStatusPad(c12, statPadHeight, statPadBotMar);
1125 TStatToolkit::DrawStatusGraphs(oaMultGr);
1126 c12->SaveAs("ElectroMIPSeparation_vs_run.png");
1127 c12->Clear();
1128
92f227d3 1129 //
1130 // save status into Tree and write to rootfile
1131 //
1132 if (statusTree) {
1133 cout << "updating trending rootfile with status tree... ";
1134 //tree->AddFriend(statusTree,"Tstatus");
1135 tree->Write("", TObject::kOverwrite);
1136 statusTree->Write();
1137 cout << " successful." << endl;
1138 }
1139
1140 cout << "...done with trending." << endl;
1141 return 1;
f7707400 1142}
1143
972a253a 1144
972a253a 1145Int_t PlotStatusLines(TTree * tree, const char * expr, const char * cut)
f7707400 1146{
92f227d3 1147 //the function plots status lines
972a253a 1148 char* alias = "varname_OutlierMin:varname_OutlierMax:varname_WarningMin:varname_WarningMax:varname_PhysAccMin:varname_PhysAccMax:varname_RobustMean";
1149 TMultiGraph* mgStatusLines = TStatToolkit::MakeStatusLines(tree,expr,cut,alias);
1150
1151 if (mgStatusLines) mgStatusLines->Draw("l");
1152 else { cout << " no mgStatusLines available!" << endl; return 0; }
1153
1154 return 1;
1155}
f7707400 1156
92f227d3 1157Int_t PlotTimestamp(const int nruns=0, const int nentries=0)
972a253a 1158{
92f227d3 1159 //the function plots a timestamp, the used Aliroot version, and the number of runs
972a253a 1160 TString sTimestamp = gSystem->GetFromPipe("date");
1161 TString sAlirootVer = "AliRoot " + gSystem->GetFromPipe("wdir=`pwd`; cd $ALICE_ROOT; git describe; cd $wdir;");
1162 TLatex* latTime = new TLatex(0.99,0.95,sTimestamp.Data());
1163 latTime->SetTextSize(0.03);
1164 latTime->SetTextAlign(31);
1165 latTime->SetNDC();
1166 latTime->Draw("same");
1167 TLatex* latAliroot = new TLatex(0.99,0.91,sAlirootVer.Data());
1168 latAliroot->SetTextSize(0.03);
1169 latAliroot->SetTextAlign(31);
1170 latAliroot->SetNDC();
1171 latAliroot->Draw("same");
92f227d3 1172 TLatex* latNruns = new TLatex(0.99,0.87,Form("N shown runs: %i (tree entries: %i)",nruns,nentries));
1173 latNruns->SetTextSize(0.03);
1174 latNruns->SetTextAlign(31);
1175 latNruns->SetNDC();
1176 if (nruns>0) latNruns->Draw("same");
f7707400 1177 return 1;
1178}
1179
92f227d3 1180Int_t ComputeRange(TTree* tree, const char* varname, Float_t &plotmean, Float_t &plotoutlier)
1181{
1182 //the function computes useful numbers for plot ranges from the outlier criteria
1183 plotmean = (Float_t) TFormula("fcn", tree->GetAlias(Form("%s_RobustMean",varname))).Eval(0);
1184 plotoutlier = (Float_t) TFormula("fcn", tree->GetAlias(Form("%s_OutlierMax",varname))).Eval(0) - plotmean;
1185 return 1;
1186}
972a253a 1187
f7707400 1188Int_t DrawPlot(TGraphErrors* gr, TString nameHisto, Int_t markerStyle, Int_t markerSize, Int_t markerColor, TString drawMode)
1189{
92f227d3 1190 //the function draws the plots
f7707400 1191 gr->SetName(nameHisto);
1192 gr->SetMarkerStyle(markerStyle);
1193 gr->SetMarkerSize(markerSize);
1194 gr->SetMarkerColor(markerColor);
1195 gr->Draw(drawMode);
1196 return 1;
1197}