Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TpcMonDraw.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file TpcMonDraw.cc
1 #include "TpcMonDraw.h"
2 
3 #include <onlmon/OnlMonClient.h>
4 
5 #include <TAxis.h> // for TAxis
6 #include <TCanvas.h>
7 #include <TDatime.h>
8 #include <TGraphErrors.h>
9 #include <TH1.h>
10 #include <TH2.h>
11 #include <TPad.h>
12 #include <TROOT.h>
13 #include <TSystem.h>
14 #include <TText.h>
15 #include <TMath.h>
16 #include <TPaveLabel.h>
17 #include <TStyle.h>
18 #include <TString.h>
19 #include <TLegend.h>
20 #include <TLatex.h>
21 #include <TLine.h>
22 #include <TEllipse.h>
23 
24 #include <cstring> // for memset
25 #include <ctime>
26 #include <fstream>
27 #include <iostream> // for operator<<, basic_ostream, basic_os...
28 #include <sstream>
29 #include <vector> // for vector
30 
31 #include <cmath>
32 #include <cstdio> // for printf
33 #include <string> // for allocator, string, char_traits
34 
36  : OnlMonDraw(name)
37 {
38  return;
39 }
40 
42 {
43  return 0;
44 }
45 
47 {
49  int xsize = cl->GetDisplaySizeX();
50  int ysize = cl->GetDisplaySizeY();
51  if (name == "TpcMon1")
52  {
53  // xpos (-1) negative: do not draw menu bar
54  TC[0] = new TCanvas(name.c_str(), "TpcMon Example Monitor", -1, 0, xsize / 2, ysize);
55  // root is pathetic, whenever a new TCanvas is created root piles up
56  // 6kb worth of X11 events which need to be cleared with
57  // gSystem->ProcessEvents(), otherwise your process will grow and
58  // grow and grow but will not show a definitely lost memory leak
59  gSystem->ProcessEvents();
60  Pad[0] = new TPad("tpcpad1", "who needs this?", 0.1, 0.5, 0.9, 0.9, 0);
61  Pad[1] = new TPad("tpcpad2", "who needs this?", 0.1, 0.05, 0.9, 0.45, 0);
62  Pad[0]->Draw();
63  Pad[1]->Draw();
64  // this one is used to plot the run number on the canvas
65  transparent[0] = new TPad("transparent0", "this does not show", 0, 0, 1, 1);
66  transparent[0]->SetFillStyle(4000);
67  transparent[0]->Draw();
68  TC[0]->SetEditable(false);
69  }
70  else if (name == "TpcMon2")
71  {
72  // xpos negative: do not draw menu bar
73  TC[1] = new TCanvas(name.c_str(), "TpcMon2 Example Monitor", -xsize / 2, 0, xsize / 2, ysize);
74  gSystem->ProcessEvents();
75  Pad[2] = new TPad("tpcpad3", "who needs this?", 0.1, 0.5, 0.9, 0.9, 0);
76  Pad[3] = new TPad("tpcpad4", "who needs this?", 0.1, 0.05, 0.9, 0.45, 0);
77  Pad[2]->Draw();
78  Pad[3]->Draw();
79  // this one is used to plot the run number on the canvas
80  transparent[1] = new TPad("transparent1", "this does not show", 0, 0, 1, 1);
81  transparent[1]->SetFillStyle(4000);
82  transparent[1]->Draw();
83  TC[1]->SetEditable(false);
84  }
85  else if (name == "TpcMon3")
86  {
87  TC[2] = new TCanvas(name.c_str(), "TpcMon3 Example Monitor", xsize / 2, 0, xsize / 2, ysize);
88  gSystem->ProcessEvents();
89  Pad[4] = new TPad("tpcpad5", "who needs this?", 0.1, 0.5, 0.9, 0.9, 0);
90  Pad[5] = new TPad("tpcpad6", "who needs this?", 0.1, 0.05, 0.9, 0.45, 0);
91  Pad[4]->Draw();
92  Pad[5]->Draw();
93  // this one is used to plot the run number on the canvas
94  // transparent[2] = new TPad("transparent2", "this does not show", 0, 0, 1, 1);
95  // transparent[2]->SetFillStyle(4000);
96  // transparent[2]->Draw();
97  // TC[2]->SetEditable(0);
98  }
99  else if (name == "TPCModules")
100  {
101  TC[3] = new TCanvas(name.c_str(), "ADC Count by GEM Example", 1350, 700);
102  gSystem->ProcessEvents();
103  TC[3]->Divide(2,1);
104  //gStyle->SetPalette(57); //kBird CVD friendly
105  // this one is used to plot the run number on the canvas
106  transparent[2] = new TPad("transparent2", "this does not show", 0, 0, 1, 1);
107  transparent[2]->SetFillStyle(4000);
108  transparent[2]->Draw();
109  TC[3]->SetEditable(false);
110  }
111  else if (name == "TPCSampleSize")
112  {
113  TC[4] = new TCanvas(name.c_str(), "TPC Sample Size Distribution in Events", -1, 0, xsize , ysize );
114  gSystem->ProcessEvents();
115  TC[4]->Divide(4,7);
116  transparent[3] = new TPad("transparent3", "this does not show", 0, 0, 1, 1);
117  transparent[3]->SetFillStyle(4000);
118  transparent[3]->Draw();
119  TC[4]->SetEditable(false);
120  }
121  else if (name == "TPCCheckSumError")
122  {
123  TC[5] = new TCanvas(name.c_str(), "TPC CheckSumError Probability in Events",-1, 0, xsize , ysize );
124  gSystem->ProcessEvents();
125  TC[5]->Divide(4,7);
126  transparent[4] = new TPad("transparent4", "this does not show", 0, 0, 1, 1);
127  transparent[4]->SetFillStyle(4000);
128  transparent[4]->Draw();
129  TC[5]->SetEditable(false);
130  }
131  else if (name == "TPCADCSample")
132  {
133  TC[6] = new TCanvas(name.c_str(), "TPC ADC vs Sample in Whole Sector",-1, 0, xsize , ysize);
134  gSystem->ProcessEvents();
135  //gStyle->SetPalette(57); //kBird CVD friendly
136  TC[6]->Divide(4,7);
137  transparent[5] = new TPad("transparent5", "this does not show", 0, 0, 1, 1);
138  transparent[5]->SetFillStyle(4000);
139  transparent[5]->Draw();
140  TC[6]->SetEditable(false);
141  }
142  else if (name == "TPCMaxADCModule")
143  {
144  TC[7] = new TCanvas(name.c_str(), "(MAX ADC - pedestal) in SLIDING WINDOW for each Module in Sector", -1, 0, xsize , ysize);
145  gSystem->ProcessEvents();
146  //gStyle->SetPalette(57); //kBird CVD friendly
147  TC[7]->Divide(4,7);
148  transparent[6] = new TPad("transparent6", "this does not show", 0, 0, 1, 1);
149  transparent[6]->SetFillStyle(4000);
150  transparent[6]->Draw();
151  TC[7]->SetEditable(false);
152  }
153  else if (name == "TPCRawADC1D")
154  {
155  TC[8] = new TCanvas(name.c_str(), "TPC RAW ADC 1D distribution", -1, 0, xsize , ysize);
156  gSystem->ProcessEvents();
157  //gStyle->SetPalette(57); //kBird CVD friendly
158  TC[8]->Divide(4,7);
159  transparent[7] = new TPad("transparent7", "this does not show", 0, 0, 1, 1);
160  transparent[7]->SetFillStyle(4000);
161  transparent[7]->Draw();
162  TC[8]->SetEditable(false);
163  }
164  else if (name == "TPCMaxADC1D")
165  {
166  TC[9] = new TCanvas(name.c_str(), "(MAX ADC - pedestal) in SLIDING WINDOW 1D distribution",-1, 0, xsize , ysize);
167  gSystem->ProcessEvents();
168  //gStyle->SetPalette(57); //kBird CVD friendly
169  TC[9]->Divide(4,7);
170  transparent[8] = new TPad("transparent8", "this does not show", 0, 0, 1, 1);
171  transparent[8]->SetFillStyle(4000);
172  transparent[8]->Draw();
173  TC[9]->SetEditable(false);
174  }
175  else if (name == "TPCClusterXY")
176  {
177  TC[10] = new TCanvas(name.c_str(), "(MAX ADC - pedestal)> 20 ADC for NS and SS, WEIGHTED", 1350, 700);
178  gSystem->ProcessEvents();
179  //gStyle->SetPalette(57); //kBird CVD friendly
180  TC[10]->Divide(2,1);
181  // this one is used to plot the run number on the canvas
182  transparent[9] = new TPad("transparent9", "this does not show", 0, 0, 1, 1);
183  transparent[9]->SetFillStyle(4000);
184  transparent[9]->Draw();
185  TC[10]->SetEditable(false);
186  }
187  else if (name == "TPCClusterXY_unw")
188  {
189  TC[11] = new TCanvas(name.c_str(), "(MAX ADC - pedestal)> 20 ADC for NS and SS, UNWEIGHTED", 1350, 700);
190  gSystem->ProcessEvents();
191  //gStyle->SetPalette(57); //kBird CVD friendly
192  TC[11]->Divide(2,1);
193  // this one is used to plot the run number on the canvas
194  transparent[10] = new TPad("transparent10", "this does not show", 0, 0, 1, 1);
195  transparent[10]->SetFillStyle(4000);
196  transparent[10]->Draw();
197  TC[11]->SetEditable(false);
198  }
199  else if (name == "TPCADCSamplelarge")
200  {
201  TC[12] = new TCanvas(name.c_str(), "TPC ADC vs Large Sample in Whole Sector",-1, 0, xsize , ysize);
202  gSystem->ProcessEvents();
203  //gStyle->SetPalette(57); //kBird CVD friendly
204  TC[12]->Divide(4,7);
205  transparent[11] = new TPad("transparent11", "this does not show", 0, 0, 1, 1);
206  transparent[11]->SetFillStyle(4000);
207  transparent[11]->Draw();
208  TC[12]->SetEditable(false);
209  }
210 
211  else if (name == "TPCClusterZY")
212  {
213  TC[13] = new TCanvas(name.c_str(), "(MAX ADC - pedestal)> 5#sigma for NS and SS, WEIGHTED", 1350, 700);
214  gSystem->ProcessEvents();
215  //gStyle->SetPalette(57); //kBird CVD friendly
216  TC[13]->Divide(1,1);
217  // this one is used to plot the run number on the canvas
218  transparent[12] = new TPad("transparent12", "this does not show", 0, 0, 1, 1);
219  transparent[12]->SetFillStyle(4000);
220  transparent[12]->Draw();
221  TC[13]->SetEditable(false);
222  }
223 
224  else if (name == "TPCClusterZY_unw")
225  {
226  TC[14] = new TCanvas(name.c_str(), "(MAX ADC - pedestal)> 5#sigma for NS and SS, UNWEIGHTED", 1350, 700);
227  gSystem->ProcessEvents();
228  //gStyle->SetPalette(57); //kBird CVD friendly
229  TC[14]->Divide(1,1);
230  // this one is used to plot the run number on the canvas
231  transparent[13] = new TPad("transparent13", "this does not show", 0, 0, 1, 1);
232  transparent[13]->SetFillStyle(4000);
233  transparent[13]->Draw();
234  TC[14]->SetEditable(false);
235  }
236 
237  else if (name == "TPCLayerPhi")
238  {
239  TC[15] = new TCanvas(name.c_str(), "Layer vs Channel Phi for NS and SS, WEIGHTED by Sum(ADC-pedestal)",1350,700);
240  gSystem->ProcessEvents();
241  //gStyle->SetPalette(57); //kBird CVD friendly
242  TC[15]->Divide(1,1);
243  // this one is used to plot the run number on the canvas
244  transparent[14] = new TPad("transparent14", "this does not show", 0, 0, 1, 1);
245  transparent[14]->SetFillStyle(4000);
246  transparent[14]->Draw();
247  TC[15]->SetEditable(false);
248  }
249  else if (name == "TPCPedestSubADC1D")
250  {
251  TC[16] = new TCanvas(name.c_str(), "TPC PEDEST SUB ADC 1D distribution", -1, 0, xsize , ysize);
252  gSystem->ProcessEvents();
253  //gStyle->SetPalette(57); //kBird CVD friendly
254  TC[16]->Divide(4,7);
255  transparent[15] = new TPad("transparent15", "this does not show", 0, 0, 1, 1);
256  transparent[15]->SetFillStyle(4000);
257  transparent[15]->Draw();
258  TC[16]->SetEditable(false);
259  }
260 
261  return 0;
262 }
263 
265 {
266  int iret = 0;
267  int idraw = 0;
268  if (what == "ALL" || what == "FIRST")
269  {
270  iret += DrawFirst(what);
271  idraw++;
272  }
273  if (what == "ALL" || what == "SECOND")
274  {
275  iret += DrawSecond(what);
276  idraw++;
277  }
278  if (what == "ALL" || what == "TPCMODULE")
279  {
280  iret += DrawTPCModules(what);
281  idraw++;
282  }
283  if (what == "ALL" || what == "TPCSAMPLESIZE")
284  {
285  iret += DrawTPCSampleSize(what);
286  idraw++;
287  }
288  if (what == "ALL" || what == "TPCCHECKSUMERROR")
289  {
290  iret += DrawTPCCheckSum(what);
291  idraw++;
292  }
293  if (what == "ALL" || what == "TPCADCVSSAMPLE")
294  {
295  iret += DrawTPCADCSample(what);
296  idraw++;
297  }
298  if (what == "ALL" || what == "TPCMAXADCMODULE")
299  {
300  iret += DrawTPCMaxADCModule(what);
301  idraw++;
302  }
303  if (what == "ALL" || what == "TPCRAWADC1D")
304  {
305  iret += DrawTPCRawADC1D(what);
306  idraw++;
307  }
308  if (what == "ALL" || what == "TPCMAXADC1D")
309  {
310  iret += DrawTPCMaxADC1D(what);
311  idraw++;
312  }
313  if (what == "ALL" || what == "TPCCLUSTERSXYWEIGTHED")
314  {
315  iret += DrawTPCXYclusters(what);
316  idraw++;
317  }
318  if (what == "ALL" || what == "TPCCLUSTERSXYUNWEIGTHED")
319  {
320  iret += DrawTPCXYclusters_unweighted(what);
321  idraw++;
322  }
323  if (what == "ALL" || what == "TPCADCVSSAMPLELARGE")
324  {
325  iret += DrawTPCADCSampleLarge(what);
326  idraw++;
327  }
328  if (what == "ALL" || what == "TPCCLUSTERSZYWEIGTHED")
329  {
330  iret += DrawTPCZYclusters(what);
331  idraw++;
332  }
333  if (what == "ALL" || what == "TPCCLUSTERSZYUNWEIGTHED")
334  {
335  iret += DrawTPCZYclusters_unweighted(what);
336  idraw++;
337  }
338  if (what == "ALL" || what == "TPCCHANNELPHI_LAYER_WEIGHTED")
339  {
340  iret += DrawTPCchannelphi_layer_weighted(what);
341  idraw++;
342  }
343  if (what == "ALL" || what == "TPCPEDESTSUBADC1D")
344  {
345  iret += DrawTPCPedestSubADC1D(what);
346  idraw++;
347  }
348 
349  if (!idraw)
350  {
351  std::cout << __PRETTY_FUNCTION__ << " Unimplemented Drawing option: " << what << std::endl;
352  iret = -1;
353  }
354  return iret;
355 }
356 
357 int TpcMonDraw::DrawFirst(const std::string & /* what */)
358 {
360  TH1 *tpcmon_hist1 = cl->getHisto("TPCMON_0","tpcmon_hist1");
361  TH1 *tpcmon_hist2 = cl->getHisto("TPCMON_0","tpcmon_hist1");
362 
363  if (!gROOT->FindObject("TpcMon1"))
364  {
365  MakeCanvas("TpcMon1");
366  }
367  TC[0]->SetEditable(true);
368  TC[0]->Clear("D");
369  Pad[0]->cd();
370  if (tpcmon_hist1)
371  {
372  tpcmon_hist1->DrawCopy();
373  }
374  else
375  {
377  TC[0]->SetEditable(false);
378  return -1;
379  }
380  Pad[1]->cd();
381  if (tpcmon_hist2)
382  {
383  tpcmon_hist2->DrawCopy();
384  }
385  TText PrintRun;
386  PrintRun.SetTextFont(62);
387  PrintRun.SetTextSize(0.04);
388  PrintRun.SetNDC(); // set to normalized coordinates
389  PrintRun.SetTextAlign(23); // center/top alignment
390  std::ostringstream runnostream;
391  std::string runstring;
392  time_t evttime = cl->EventTime("CURRENT");
393  // fill run number and event time into string
394  runnostream << ThisName << "_1 Run " << cl->RunNumber()
395  << ", Time: " << ctime(&evttime);
396  runstring = runnostream.str();
397  transparent[0]->cd();
398  PrintRun.DrawText(0.5, 1., runstring.c_str());
399  TC[0]->Update();
400  TC[0]->Show();
401  TC[0]->SetEditable(false);
402  return 0;
403 }
404 
405 int TpcMonDraw::DrawSecond(const std::string & /* what */)
406 {
408  TH1 *tpcmon_hist1 = cl->getHisto("TPCMON_0","tpcmon_hist2");
409  TH1 *tpcmon_hist2 = cl->getHisto("TPCMON_0","tpcmon_hist2");
410  if (!gROOT->FindObject("TpcMon2"))
411  {
412  MakeCanvas("TpcMon2");
413  }
414  TC[1]->SetEditable(true);
415  TC[1]->Clear("D");
416  Pad[2]->cd();
417  if (tpcmon_hist1)
418  {
419  tpcmon_hist1->DrawCopy();
420  }
421  else
422  {
424  TC[1]->SetEditable(false);
425  return -1;
426  }
427  Pad[3]->cd();
428  if (tpcmon_hist2)
429  {
430  tpcmon_hist2->DrawCopy();
431  }
432  TText PrintRun;
433  PrintRun.SetTextFont(62);
434  PrintRun.SetTextSize(0.04);
435  PrintRun.SetNDC(); // set to normalized coordinates
436  PrintRun.SetTextAlign(23); // center/top alignment
437  std::ostringstream runnostream;
438  std::string runstring;
439  time_t evttime = cl->EventTime("CURRENT");
440  // fill run number and event time into string
441  runnostream << ThisName << "_2 Run " << cl->RunNumber()
442  << ", Time: " << ctime(&evttime);
443  runstring = runnostream.str();
444  transparent[1]->cd();
445  PrintRun.DrawText(0.5, 1., runstring.c_str());
446  TC[1]->Update();
447  TC[1]->Show();
448  TC[1]->SetEditable(false);
449  return 0;
450 }
451 
453 {
455 
456  TH2 *tpcmon_NSIDEADC[24] = {nullptr};
457  TH2 *tpcmon_SSIDEADC[24] = {nullptr};
458 
459  char TPCMON_STR[100];
460  // TPC ADC pie chart
461  for( int i=0; i<24; i++ )
462  {
463  //const TString TPCMON_STR( Form( "TPCMON_%i", i ) );
464  sprintf(TPCMON_STR,"TPCMON_%i",i);
465  tpcmon_NSIDEADC[i] = (TH2*) cl->getHisto(TPCMON_STR,"NorthSideADC");
466  tpcmon_SSIDEADC[i] = (TH2*) cl->getHisto(TPCMON_STR,"SouthSideADC");
467  }
468 
469 
470  //TH2 *tpcmon_NSIDEADC1 = (TH2*) cl->getHisto("TPCMON_0","NorthSideADC");
471  //TH2 *tpcmon_SSIDEADC1 = (TH2*) cl->getHisto("TPCMON_0","SouthSideADC");
472 
473  if (!gROOT->FindObject("TPCModules"))
474  {
475  MakeCanvas("TPCModules");
476  }
477 
478  dummy_his1 = new TH2F("dummy_his1", "ADC Counts North Side", 100, -1.5, 1.5, 100, -1.5, 1.5); //dummy histos for titles
479  dummy_his2 = new TH2F("dummy_his2", "ADC Counts South Side", 100, -1.5, 1.5, 100, -1.5, 1.5);
480 
481  //labels
482  NS18 = new TPaveLabel( 1.046586,-0.1938999,1.407997,0.2144871, "18" );
483  NS17 = new TPaveLabel( 0.962076,0.4382608,1.323487,0.8466479 , "17" );
484  NS16 = new TPaveLabel( 0.4801947,0.8802139,0.8416056,1.288601 , "16" );
485  NS15 = new TPaveLabel( -0.1823921,1.011681,0.1790189,1.425662, "15" );
486  NS14 = new TPaveLabel( -0.8449788,0.8690253,-0.4835679,1.288601 , "14" );
487  NS13 = new TPaveLabel( -1.30879,0.441058,-0.9473786,0.8550394 , "13" );
488  NS12 = new TPaveLabel( -1.411009,-0.2050886,-1.049598,0.2144871, "12" );
489  NS23 = new TPaveLabel( -1.302585,-0.7757116,-0.9471979,-0.3561359 , "23" );
490  NS22 = new TPaveLabel( -0.8449788,-1.309971,-0.4835679,-0.8848013 , "22" );
491  NS21 = new TPaveLabel( -0.1823921,-1.426557,0.1790189,-1.006982 , "21" );
492  NS20 = new TPaveLabel( 0.4801947,-1.309076,0.8416056,-0.8839062 , "20" );
493  NS19 = new TPaveLabel( 0.9622567,-0.7785088,1.323668,-0.3533387 , "19" );
494 
495  SS00 = new TPaveLabel( 1.046586,-0.1938999,1.407997,0.2144871, "00" );
496  SS01 = new TPaveLabel( 0.962076,0.4382608,1.323487,0.8466479 , "01" );
497  SS02 = new TPaveLabel( 0.4801947,0.8802139,0.8416056,1.288601 , "02" );
498  SS03 = new TPaveLabel( -0.1823921,1.011681,0.1790189,1.425662, "03" );
499  SS04 = new TPaveLabel( -0.8449788,0.8690253,-0.4835679,1.288601 , "04" );
500  SS05 = new TPaveLabel( -1.30879,0.441058,-0.9473786,0.8550394 , "05" );
501  SS06 = new TPaveLabel( -1.411009,-0.2050886,-1.049598,0.2144871, "06" );
502  SS07 = new TPaveLabel( -1.302585,-0.7757116,-0.9471979,-0.3561359 , "07" );
503  SS08 = new TPaveLabel( -0.8449788,-1.309971,-0.4835679,-0.8848013 , "08" );
504  SS09 = new TPaveLabel( -0.1823921,-1.426557,0.1790189,-1.006982 , "09" );
505  SS10 = new TPaveLabel( 0.4801947,-1.309076,0.8416056,-0.8839062 , "10" );
506  SS11 = new TPaveLabel( 0.9622567,-0.7785088,1.323668,-0.3533387 , "11" );
507 
508  NS18->SetFillColor(0);
509  NS17->SetFillColor(0);
510  NS16->SetFillColor(0);
511  NS15->SetFillColor(0);
512  NS14->SetFillColor(0);
513  NS13->SetFillColor(0);
514  NS12->SetFillColor(0);
515  NS23->SetFillColor(0);
516  NS22->SetFillColor(0);
517  NS21->SetFillColor(0);
518  NS20->SetFillColor(0);
519  NS19->SetFillColor(0);
520 
521  SS00->SetFillColor(0);
522  SS01->SetFillColor(0);
523  SS02->SetFillColor(0);
524  SS03->SetFillColor(0);
525  SS04->SetFillColor(0);
526  SS05->SetFillColor(0);
527  SS06->SetFillColor(0);
528  SS07->SetFillColor(0);
529  SS08->SetFillColor(0);
530  SS09->SetFillColor(0);
531  SS10->SetFillColor(0);
532  SS11->SetFillColor(0);
533 
534  TC[3]->SetEditable(true);
535  TC[3]->Clear("D");
536  TC[3]->cd(1);
537  gPad->SetTopMargin(0.15);
538  gStyle->SetOptStat(0);
539  dummy_his1->Draw("colpolzsame");
540 
541  float NS_max = 0;
542  for( int i=0; i<12; i++ )
543  {
544  if( tpcmon_NSIDEADC[i] ){
545  TC[3]->cd(1);
546  tpcmon_NSIDEADC[i] -> DrawCopy("colpolzsame");
547  if( tpcmon_NSIDEADC[i]->GetBinContent(tpcmon_NSIDEADC[i]->GetMaximumBin()) > NS_max)
548  {
549  NS_max = tpcmon_NSIDEADC[i]->GetBinContent(tpcmon_NSIDEADC[i]->GetMaximumBin());
550  dummy_his1->SetMaximum( NS_max );
551  }
552  gStyle->SetPalette(57); //kBird CVD friendly
553  }
554 
555  }
556  TC[3]->Update();
557  TC[3]->cd(1);
558  SS00->Draw("same");
559  SS01->Draw("same");
560  SS02->Draw("same");
561  SS03->Draw("same");
562  SS04->Draw("same");
563  SS05->Draw("same");
564  SS06->Draw("same");
565  SS07->Draw("same");
566  SS08->Draw("same");
567  SS09->Draw("same");
568  SS10->Draw("same");
569  SS11->Draw("same");
570 
571  TC[3]->cd(2);
572  gPad->SetTopMargin(0.15);
573  gStyle->SetOptStat(0);
574  dummy_his2->Draw("colpolzsame");
575 
576  float SS_max = 0;
577  for( int i=0; i<12; i++ )
578  {
579  if( tpcmon_SSIDEADC[i+12] ){
580  //std::cout<<"tpcmon_SSIDEADC i: "<< i+12 <<std::endl;
581  TC[3]->cd(2);
582  tpcmon_SSIDEADC[i+12] -> DrawCopy("colpolzsame");
583 
584  if ( tpcmon_SSIDEADC[i+12]->GetBinContent(tpcmon_SSIDEADC[i+12]->GetMaximumBin()) > SS_max)
585  {
586  SS_max = tpcmon_SSIDEADC[i+12]->GetBinContent(tpcmon_SSIDEADC[i+12]->GetMaximumBin());
587  dummy_his2->SetMaximum( SS_max );
588  }
589 
590  gStyle->SetPalette(57); //kBird CVD friendly
591  }
592  }
593  TC[3]->Update();
594 
595  TC[3]->cd(2);
596  NS18->Draw("same");
597  NS17->Draw("same");
598  NS16->Draw("same");
599  NS15->Draw("same");
600  NS14->Draw("same");
601  NS13->Draw("same");
602  NS12->Draw("same");
603  NS23->Draw("same");
604  NS22->Draw("same");
605  NS21->Draw("same");
606  NS20->Draw("same");
607  NS19->Draw("same");
608 
609 
610  TText PrintRun;
611  PrintRun.SetTextFont(62);
612  PrintRun.SetTextSize(0.04);
613  PrintRun.SetNDC(); // set to normalized coordinates
614  PrintRun.SetTextAlign(23); // center/top alignment
615  std::ostringstream runnostream;
616  std::string runstring;
617  time_t evttime = cl->EventTime("CURRENT");
618  // fill run number and event time into string
619  runnostream << ThisName << "_SUMADC Run " << cl->RunNumber()
620  << ", Time: " << ctime(&evttime);
621  runstring = runnostream.str();
622  transparent[2]->cd();
623  PrintRun.DrawText(0.5, 0.91, runstring.c_str());
624 
625  //turn off stats box
626  //dummy_his1->SetStats(0);
627  //dummy_his2->SetStats(0);
628 
629  TC[3]->Update();
630 
631 
632 
633  TC[3]->Show();
634  TC[3]->SetEditable(false);
635 
636  return 0;
637 }
638 
640 {
642 
643  TH1 *tpcmon_samplesizedist[24] = {nullptr};
644 
645  char TPCMON_STR[100];
646  for( int i=0; i<24; i++ )
647  {
648  //const TString TPCMON_STR( Form( "TPCMON_%i", i ) );
649  sprintf(TPCMON_STR,"TPCMON_%i",i);
650  tpcmon_samplesizedist[i] = (TH1*) cl->getHisto(TPCMON_STR,"sample_size_hist");
651  }
652 
653  if (!gROOT->FindObject("TPCSampleSize"))
654  {
655  MakeCanvas("TPCSampleSize");
656  }
657 
658  TC[4]->SetEditable(true);
659  TC[4]->Clear("D");
660  for( int i=0; i<24; i++ )
661  {
662  if( tpcmon_samplesizedist[i] )
663  {
664  TC[4]->cd(i+5);
665  tpcmon_samplesizedist[i]->DrawCopy("");
666  gPad->SetLogx(kTRUE);
667  gPad->SetLogy(kTRUE);
668  }
669  }
670 
671  TText PrintRun;
672  PrintRun.SetTextFont(62);
673  PrintRun.SetTextSize(0.04);
674  PrintRun.SetNDC(); // set to normalized coordinates
675  PrintRun.SetTextAlign(23); // center/top alignment
676  std::ostringstream runnostream;
677  std::string runstring;
678  time_t evttime = cl->EventTime("CURRENT");
679  // fill run number and event time into string
680  runnostream << ThisName << "_SampleSize Run " << cl->RunNumber()
681  << ", Time: " << ctime(&evttime);
682  runstring = runnostream.str();
683  transparent[3]->cd();
684  PrintRun.DrawText(0.5, 0.91, runstring.c_str());
685 
686  TC[4]->Update();
687  TC[4]->SetLogx();
688  TC[4]->Show();
689  TC[4]->SetEditable(false);
690 
691  return 0;
692 }
693 
695 {
697 
698  TH1 *tpcmon_checksumerror[24] = {nullptr};
699  TH1 *tpcmon_checksums[24] = {nullptr};
700 
701  char TPCMON_STR[100];
702  for( int i=0; i<24; i++ )
703  {
704  //const TString TPCMON_STR( Form( "TPCMON_%i", i ) );
705  sprintf(TPCMON_STR,"TPCMON_%i",i);
706  tpcmon_checksumerror[i] = (TH1*) cl->getHisto(TPCMON_STR,"Check_Sum_Error");
707  tpcmon_checksums[i] = (TH1*) cl->getHisto(TPCMON_STR,"Check_Sums");
708  }
709 
710  if (!gROOT->FindObject("TPCCheckSumError"))
711  {
712  MakeCanvas("TPCCheckSumError");
713  }
714 
715  TC[5]->SetEditable(true);
716  TC[5]->Clear("D");
717  TC[5]->cd(1);
718 
719  for( int i=0; i<24; i++ )
720  {
721  if( tpcmon_checksumerror[i] && tpcmon_checksums[i] )
722  {
723  TC[5]->cd(i+5);
724 
725  tpcmon_checksumerror[i]->Divide(tpcmon_checksums[i]);
726  tpcmon_checksumerror[i]->GetYaxis()->SetRangeUser(0.0001,1);
727  tpcmon_checksumerror[i]->DrawCopy("HIST");
728  }
729  }
730 
731  TText PrintRun;
732  PrintRun.SetTextFont(62);
733  PrintRun.SetTextSize(0.04);
734  PrintRun.SetNDC(); // set to normalized coordinates
735  PrintRun.SetTextAlign(23); // center/top alignment
736  std::ostringstream runnostream;
737  std::string runstring;
738  time_t evttime = cl->EventTime("CURRENT");
739  // fill run number and event time into string
740  runnostream << ThisName << "_CheckSumError Run " << cl->RunNumber()
741  << ", Time: " << ctime(&evttime);
742  runstring = runnostream.str();
743  transparent[4]->cd();
744  PrintRun.DrawText(0.5, 0.91, runstring.c_str());
745 
746  TC[5]->Update();
747  //TC[5]->SetLogy();
748  TC[5]->Show();
749  TC[5]->SetEditable(false);
750 
751 
752  return 0;
753 }
754 
756 {
758 
759  TH2 *tpcmon_ADCSAMPLE[24] = {nullptr};
760 
761  char TPCMON_STR[100];
762  for( int i=0; i<24; i++ )
763  {
764  //const TString TPCMON_STR( Form( "TPCMON_%i", i ) );
765  sprintf(TPCMON_STR,"TPCMON_%i",i);
766  tpcmon_ADCSAMPLE[i] = (TH2*) cl->getHisto(TPCMON_STR,"ADC_vs_SAMPLE");
767  }
768 
769 
770  if (!gROOT->FindObject("TPCADCSample"))
771  {
772  MakeCanvas("TPCADCSample");
773  }
774 
775  TC[6]->SetEditable(true);
776  TC[6]->Clear("D");
777 
778  for( int i=0; i<24; i++ )
779  {
780  if( tpcmon_ADCSAMPLE[i] )
781  {
782  TC[6]->cd(i+5);
783  gStyle->SetPalette(57); //kBird CVD friendly
784  gPad->SetLogz(kTRUE);
785  tpcmon_ADCSAMPLE[i] -> DrawCopy("colz");
786  }
787  }
788 
789  TText PrintRun;
790  PrintRun.SetTextFont(62);
791  PrintRun.SetTextSize(0.04);
792  PrintRun.SetNDC(); // set to normalized coordinates
793  PrintRun.SetTextAlign(23); // center/top alignment
794  std::ostringstream runnostream;
795  std::string runstring;
796  time_t evttime = cl->EventTime("CURRENT");
797  // fill run number and event time into string
798  runnostream << ThisName << "_ADC_vs_SAMPLE Run " << cl->RunNumber()
799  << ", Time: " << ctime(&evttime);
800  runstring = runnostream.str();
801  transparent[5]->cd();
802  PrintRun.DrawText(0.5, 0.91, runstring.c_str());
803 
804 
805  TC[6]->Update();
806  TC[6]->Show();
807  TC[6]->SetEditable(false);
808 
809  return 0;
810 }
811 
813 {
815 
816  TH2 *tpcmon_MAXADC_MODULE[24] = {nullptr};
817 
818  char TPCMON_STR[100];
819  for( int i=0; i<24; i++ )
820  {
821  //const TString TPCMON_STR( Form( "TPCMON_%i", i ) );
822  sprintf(TPCMON_STR,"TPCMON_%i",i);
823  tpcmon_MAXADC_MODULE[i] = (TH2*) cl->getHisto(TPCMON_STR,"MAXADC");
824  }
825 
826 
827  if (!gROOT->FindObject("TPCMaxADCModule"))
828  {
829  MakeCanvas("TPCMaxADCModule");
830  }
831 
832  TC[7]->SetEditable(true);
833  TC[7]->Clear("D");
834 
835  for( int i=0; i<24; i++ )
836  {
837  if( tpcmon_MAXADC_MODULE[i] )
838  {
839  TC[7]->cd(i+5);
840  gStyle->SetPalette(57); //kBird CVD friendly
841  gPad->SetLogz(kTRUE);
842  tpcmon_MAXADC_MODULE[i] -> DrawCopy("colz");
843  }
844  }
845 
846  TText PrintRun;
847  PrintRun.SetTextFont(62);
848  PrintRun.SetTextSize(0.04);
849  PrintRun.SetNDC(); // set to normalized coordinates
850  PrintRun.SetTextAlign(23); // center/top alignment
851  std::ostringstream runnostream;
852  std::string runstring;
853  time_t evttime = cl->EventTime("CURRENT");
854  // fill run number and event time into string
855  runnostream << ThisName << "_MAXADC2D Run " << cl->RunNumber()
856  << ", Time: " << ctime(&evttime);
857  runstring = runnostream.str();
858  transparent[6]->cd();
859  PrintRun.DrawText(0.5, 0.91, runstring.c_str());
860 
861 
862 
863  TC[7]->Update();
864  TC[7]->Show();
865  TC[7]->SetEditable(false);
866 
867  return 0;
868 }
869 
871 {
872  //std::cout<<"Made it inside DrawTPCRawADC1D"<<std::endl;
874 
875  TH1 *tpcmon_RAWADC1D[24][3] = {nullptr};
876 
877  char TPCMON_STR[100];
878  for( int i=0; i<24; i++ )
879  {
880  //const TString TPCMON_STR( Form( "TPCMON_%i", i ) );
881  sprintf(TPCMON_STR,"TPCMON_%i",i);
882  tpcmon_RAWADC1D[i][0] = (TH1*) cl->getHisto(TPCMON_STR,"RAWADC_1D_R1");
883  tpcmon_RAWADC1D[i][1] = (TH1*) cl->getHisto(TPCMON_STR,"RAWADC_1D_R2");
884  tpcmon_RAWADC1D[i][2] = (TH1*) cl->getHisto(TPCMON_STR,"RAWADC_1D_R3");
885  }
886 
887 
888  if (!gROOT->FindObject("TPCRawADC1D"))
889  {
890  MakeCanvas("TPCRawADC1D");
891  }
892 
893  TC[8]->SetEditable(true);
894  TC[8]->Clear("D");
895 
896  auto legend = new TLegend(0.7,0.65,0.98,0.95);
897  bool draw_leg = 0;
898 
899  for( int i=0; i<24; i++ )
900  {
901  TC[8]->cd(i+5);
902  for( int j = 2; j>-1; j-- )
903  {
904  if( tpcmon_RAWADC1D[i][j] )
905  {
906  if(j == 2){tpcmon_RAWADC1D[i][j] -> DrawCopy("HIST");}
907  else {tpcmon_RAWADC1D[i][j] -> DrawCopy("HISTsame");} //assumes that R3 will always exist and is most entries
908  }
909  }
910  gPad->Update();
911  gPad->SetLogy(kTRUE);
912 
913  if(draw_leg == 0 && tpcmon_RAWADC1D[i][0] && tpcmon_RAWADC1D[i][1] && tpcmon_RAWADC1D[i][2]) //if you have not drawn the legend yet, draw it BUT ONLY ONCE
914  {
915  legend->AddEntry(tpcmon_RAWADC1D[i][0], "R1");
916  legend->AddEntry(tpcmon_RAWADC1D[i][1], "R2");
917  legend->AddEntry(tpcmon_RAWADC1D[i][2], "R3");
918  TC[8]->cd(i+5);
919  legend->Draw();
920  draw_leg = 1; //don't draw it again
921  }
922  }
923 
924  TText PrintRun;
925  PrintRun.SetTextFont(62);
926  PrintRun.SetTextSize(0.04);
927  PrintRun.SetNDC(); // set to normalized coordinates
928  PrintRun.SetTextAlign(23); // center/top alignment
929  std::ostringstream runnostream;
930  std::string runstring;
931  time_t evttime = cl->EventTime("CURRENT");
932  // fill run number and event time into string
933  runnostream << ThisName << "_RAWADC Run " << cl->RunNumber()
934  << ", Time: " << ctime(&evttime);
935  runstring = runnostream.str();
936  transparent[7]->cd();
937  PrintRun.DrawText(0.5, 0.91, runstring.c_str());
938 
939  TC[8]->Update();
940  TC[8]->Show();
941  TC[8]->SetEditable(false);
942 
943  return 0;
944 }
945 
947 {
948  //std::cout<<"Made it inside DrawTPCMaxADC1D"<<std::endl;
950 
951  TH1 *tpcmon_MAXADC1D[24][3] = {nullptr};
952 
953  char TPCMON_STR[100];
954  for( int i=0; i<24; i++ )
955  {
956  //const TString TPCMON_STR( Form( "TPCMON_%i", i ) );
957  sprintf(TPCMON_STR,"TPCMON_%i",i);
958  tpcmon_MAXADC1D[i][0] = (TH1*) cl->getHisto(TPCMON_STR,"MAXADC_1D_R1");
959  tpcmon_MAXADC1D[i][1] = (TH1*) cl->getHisto(TPCMON_STR,"MAXADC_1D_R2");
960  tpcmon_MAXADC1D[i][2] = (TH1*) cl->getHisto(TPCMON_STR,"MAXADC_1D_R3");
961  }
962 
963 
964  if (!gROOT->FindObject("TPCMaxADC1D"))
965  {
966  MakeCanvas("TPCMaxADC1D");
967  }
968 
969  TC[9]->SetEditable(true);
970  TC[9]->Clear("D");
971 
972  auto legend = new TLegend(0.7,0.65,0.98,0.95);
973  bool draw_leg = 0;
974 
975  for( int i=0; i<24; i++ )
976  {
977  TC[9]->cd(i+5);
978  for( int j = 2; j>-1; j-- )
979  {
980  if( tpcmon_MAXADC1D[i][j] )
981  {
982  if(j == 2){tpcmon_MAXADC1D[i][j] -> DrawCopy("HIST");}
983  else {tpcmon_MAXADC1D[i][j] -> DrawCopy("HISTsame");} //assumes that R3 will always exist and is max
984  }
985  }
986  gPad->Update();
987  gPad->SetLogy(kTRUE);
988 
989  if(draw_leg == 0 && tpcmon_MAXADC1D[i][0] && tpcmon_MAXADC1D[i][1] && tpcmon_MAXADC1D[i][2]) //if you have not drawn the legend yet, draw it BUT ONLY ONCE
990  {
991  TC[9]->cd(i+5);
992  legend->AddEntry(tpcmon_MAXADC1D[i][0], "R1");
993  legend->AddEntry(tpcmon_MAXADC1D[i][1], "R2");
994  legend->AddEntry(tpcmon_MAXADC1D[i][2], "R3");
995  legend->Draw();
996  draw_leg = 1; //don't draw it again
997  }
998  }
999 
1000  TText PrintRun;
1001  PrintRun.SetTextFont(62);
1002  PrintRun.SetTextSize(0.04);
1003  PrintRun.SetNDC(); // set to normalized coordinates
1004  PrintRun.SetTextAlign(23); // center/top alignment
1005  std::ostringstream runnostream;
1006  std::string runstring;
1007  time_t evttime = cl->EventTime("CURRENT");
1008  // fill run number and event time into string
1009  runnostream << ThisName << "_LOCALMAXADC-PEDESTAL Run " << cl->RunNumber()
1010  << ", Time: " << ctime(&evttime);
1011  runstring = runnostream.str();
1012  transparent[8]->cd();
1013  PrintRun.DrawText(0.5, 0.91, runstring.c_str());
1014 
1015 
1016  TC[9]->Update();
1017  TC[9]->Show();
1018  TC[9]->SetEditable(false);
1019 
1020  return 0;
1021 }
1023 {
1025 
1026  TH2 *tpcmon_NSTPC_clusXY[24][3] = {nullptr};
1027  TH2 *tpcmon_SSTPC_clusXY[24][3] = {nullptr};
1028 
1029  dummy_his1_XY = new TH2F("dummy_his1_XY", "(ADC-Pedestal) > 20 ADC North Side, WEIGHTED", 400, -800, 800, 400, -800, 800); //dummy histos for titles
1030  dummy_his2_XY = new TH2F("dummy_his2_XY", "(ADC-Pedestal) > 20 ADC South Side, WEIGHTED", 400, -800, 800, 400, -800, 800);
1031 
1032  dummy_his1_XY->SetXTitle("X [mm]");
1033  dummy_his1_XY->SetYTitle("Y [mm]");
1034  dummy_his1_XY->GetYaxis()->SetTitleSize(0.02);
1035 
1036  dummy_his2_XY->SetXTitle("-X [mm]"); //SS x is flipped from global coordinates
1037  dummy_his2_XY->SetYTitle("Y [mm]");
1038  dummy_his2_XY->GetYaxis()->SetTitleSize(0.02);
1039 
1040  //the lines are for the sector boundaries
1041  Double_t sec_gap_inner = (2*M_PI - 0.5024*12.0)/12.0;
1042 
1043  Double_t sec_gap_outer = (2*M_PI - 0.5097*12.0)/12.0;
1044 
1045  Double_t sec_gap = (sec_gap_inner + sec_gap_outer)/2.0;
1046 
1047  Double_t sec_phi = (0.5024 + 0.5097)/2.0;
1048 
1049  TLine *lines[12];
1050 
1051  for(int ln=0;ln<12;ln++)
1052  {
1053  lines[ln] = new TLine(311.05*cos((sec_phi+sec_gap)/2.0+ln*(sec_phi+sec_gap)),311.05*sin((sec_phi+sec_gap)/2.0+ln*(sec_phi+sec_gap)),759.11*cos((sec_phi+sec_gap)/2.0+ln*(sec_phi+sec_gap)),759.11*sin((sec_phi+sec_gap)/2.0+ln*(sec_phi+sec_gap)));
1054  }
1055 
1056  TEllipse *e1 = new TEllipse(0.0,0.0,311.05,311.05);
1057  TEllipse *e2 = new TEllipse(0.0,0.0,(402.49+411.53)/2.0,(402.49+411.53)/2.0);
1058  TEllipse *e3 = new TEllipse(0.0,0.0,(583.67+574.75)/2.0,(583.67+574.75)/2.0);
1059  TEllipse *e4 = new TEllipse(0.0,0.0,759.11,759.11);
1060  //__________________
1061 
1062  char TPCMON_STR[100];
1063  for( int i=0; i<24; i++ )
1064  {
1065  //const TString TPCMON_STR( Form( "TPCMON_%i", i ) );
1066  sprintf(TPCMON_STR,"TPCMON_%i",i);
1067  tpcmon_NSTPC_clusXY[i][0] = (TH2*) cl->getHisto(TPCMON_STR,"NorthSideADC_clusterXY_R1");
1068  tpcmon_NSTPC_clusXY[i][1] = (TH2*) cl->getHisto(TPCMON_STR,"NorthSideADC_clusterXY_R2");
1069  tpcmon_NSTPC_clusXY[i][2] = (TH2*) cl->getHisto(TPCMON_STR,"NorthSideADC_clusterXY_R3");
1070 
1071  tpcmon_SSTPC_clusXY[i][0] = (TH2*) cl->getHisto(TPCMON_STR,"SouthSideADC_clusterXY_R1");
1072  tpcmon_SSTPC_clusXY[i][1] = (TH2*) cl->getHisto(TPCMON_STR,"SouthSideADC_clusterXY_R2");
1073  tpcmon_SSTPC_clusXY[i][2] = (TH2*) cl->getHisto(TPCMON_STR,"SouthSideADC_clusterXY_R3");
1074  }
1075 
1076  if (!gROOT->FindObject("TPCClusterXY"))
1077  {
1078  MakeCanvas("TPCClusterXY");
1079  }
1080 
1081  TC[10]->SetEditable(true);
1082  TC[10]->Clear("D");
1083 
1084  TText PrintRun;
1085  PrintRun.SetTextFont(62);
1086  PrintRun.SetTextSize(0.04);
1087  PrintRun.SetNDC(); // set to normalized coordinates
1088  PrintRun.SetTextAlign(23); // center/top alignment
1089  std::ostringstream runnostream;
1090  std::string runstring;
1091  time_t evttime = cl->EventTime("CURRENT");
1092  // fill run number and event time into string
1093  runnostream << ThisName << "_ADC-Pedestal>20 ADC WEIGHTED, Run" << cl->RunNumber()
1094  << ", Time: " << ctime(&evttime);
1095  runstring = runnostream.str();
1096  transparent[9]->cd();
1097  PrintRun.DrawText(0.5, 0.91, runstring.c_str());
1098 
1099  TC[10]->cd(1);
1100  gStyle->SetOptStat(kFALSE);
1101  gPad->SetTopMargin(0.15);
1102  gPad->SetLogz(kTRUE);
1103  dummy_his1_XY->Draw("colzsame");
1104 
1105  float NS_max = 0;
1106  for( int i=0; i<12; i++ )
1107  {
1108  for( int j=0; j<3; j++ )
1109  {
1110  if( tpcmon_NSTPC_clusXY[i][j] )
1111  {
1112  TC[10]->cd(1);
1113  tpcmon_NSTPC_clusXY[i][j] -> Draw("colzsame");
1114  //gStyle->SetLogz(kTRUE);
1115  if ( tpcmon_NSTPC_clusXY[i][j]->GetBinContent(tpcmon_NSTPC_clusXY[i][j]->GetMaximumBin()) > NS_max)
1116  {
1117  NS_max = tpcmon_NSTPC_clusXY[i][j]->GetBinContent(tpcmon_NSTPC_clusXY[i][j]->GetMaximumBin());
1118  dummy_his1_XY->SetMaximum( NS_max );
1119  }
1120  gStyle->SetPalette(57); //kBird CVD friendly
1121  }
1122 
1123  }
1124  }
1125  TC[10]->cd(1);
1126  e1->SetFillStyle(0);
1127  e2->SetFillStyle(0);
1128  e3->SetFillStyle(0);
1129  e4->SetFillStyle(0);
1130 
1131  e1->Draw("same");
1132  e2->Draw("same");
1133  e3->Draw("same");
1134  e4->Draw("same");
1135  for(int ln2=0;ln2<12;ln2++)
1136  {
1137  lines[ln2]->Draw("same");
1138  }
1139  TC[10]->Update();
1140 
1141  TC[10]->cd(2);
1142  gStyle->SetOptStat(kFALSE);
1143  gPad->SetTopMargin(0.15);
1144  gPad->SetLogz(kTRUE);
1145  dummy_his2_XY->Draw("colzsame");
1146 
1147  float SS_max = 0;
1148  for( int i=0; i<12; i++ )
1149  {
1150  for( int j=0; j<3; j++ )
1151  {
1152  if( tpcmon_SSTPC_clusXY[i+12][j] )
1153  {
1154  //std::cout<<"South Side Custer XY i: "<< i+12 <<", j: "<<j<<std::endl;
1155  TC[10]->cd(2);
1156  tpcmon_SSTPC_clusXY[i+12][j] -> Draw("colzsame");
1157  //gStyle->SetLogz(kTRUE);
1158  if ( tpcmon_SSTPC_clusXY[i+12][j]->GetBinContent(tpcmon_SSTPC_clusXY[i+12][j]->GetMaximumBin()) > SS_max)
1159  {
1160  SS_max = tpcmon_SSTPC_clusXY[i+12][j]->GetBinContent(tpcmon_SSTPC_clusXY[i+12][j]->GetMaximumBin());
1161  dummy_his2_XY->SetMaximum( SS_max );
1162  }
1163  gStyle->SetPalette(57); //kBird CVD friendly
1164  }
1165  }
1166 
1167  }
1168  TC[10]->cd(2);
1169  e1->SetFillStyle(0);
1170  e2->SetFillStyle(0);
1171  e3->SetFillStyle(0);
1172  e4->SetFillStyle(0);
1173 
1174  e1->Draw("same");
1175  e2->Draw("same");
1176  e3->Draw("same");
1177  e4->Draw("same");
1178  for(int ln2=0;ln2<12;ln2++)
1179  {
1180  lines[ln2]->Draw("same");
1181  }
1182 
1183  TC[10]->Update();
1184  TC[10]->Show();
1185  TC[10]->SetEditable(false);
1186 
1187  return 0;
1188 }
1189 
1191 {
1193 
1194  TH2 *tpcmon_NSTPC_clusXY[24][3] = {nullptr};
1195  TH2 *tpcmon_SSTPC_clusXY[24][3] = {nullptr};
1196 
1197  dummy_his1_XY_unw = new TH2F("dummy_his1_XY_unw", "(ADC-Pedestal) > 20 ADC North Side, UNWEIGHTED", 400, -800, 800, 400, -800, 800); //dummy histos for titles
1198  dummy_his2_XY_unw = new TH2F("dummy_his2_XY_unw", "(ADC-Pedestal) > 20 ADC South Side, UNWEIGHTED", 400, -800, 800, 400, -800, 800);
1199 
1200  dummy_his1_XY_unw->SetXTitle("X [mm]");
1201  dummy_his1_XY_unw->SetYTitle("Y [mm]");
1202  dummy_his1_XY_unw->GetYaxis()->SetTitleSize(0.02);
1203 
1204  dummy_his2_XY_unw->SetXTitle("-X [mm]"); //SS x is flipped from global coordinates
1205  dummy_his2_XY_unw->SetYTitle("Y [mm]");
1206  dummy_his2_XY_unw->GetYaxis()->SetTitleSize(0.02);
1207 
1208  //the lines are for the sector boundaries
1209  Double_t sec_gap_inner = (2*M_PI - 0.5024*12.0)/12.0;
1210 
1211  Double_t sec_gap_outer = (2*M_PI - 0.5097*12.0)/12.0;
1212 
1213  Double_t sec_gap = (sec_gap_inner + sec_gap_outer)/2.0;
1214 
1215  Double_t sec_phi = (0.5024 + 0.5097)/2.0;
1216 
1217  TLine *lines[12];
1218 
1219  for(int ln=0;ln<12;ln++)
1220  {
1221  lines[ln] = new TLine(311.05*cos((sec_phi+sec_gap)/2.0+ln*(sec_phi+sec_gap)),311.05*sin((sec_phi+sec_gap)/2.0+ln*(sec_phi+sec_gap)),759.11*cos((sec_phi+sec_gap)/2.0+ln*(sec_phi+sec_gap)),759.11*sin((sec_phi+sec_gap)/2.0+ln*(sec_phi+sec_gap)));
1222  }
1223 
1224  TEllipse *e1 = new TEllipse(0.0,0.0,311.05,311.05);
1225  TEllipse *e2 = new TEllipse(0.0,0.0,(402.49+411.53)/2.0,(402.49+411.53)/2.0);
1226  TEllipse *e3 = new TEllipse(0.0,0.0,(583.67+574.75)/2.0,(583.67+574.75)/2.0);
1227  TEllipse *e4 = new TEllipse(0.0,0.0,759.11,759.11);
1228  //__________________
1229 
1230  char TPCMON_STR[100];
1231  for( int i=0; i<24; i++ )
1232  {
1233  //const TString TPCMON_STR( Form( "TPCMON_%i", i ) );
1234  sprintf(TPCMON_STR,"TPCMON_%i",i);
1235  tpcmon_NSTPC_clusXY[i][0] = (TH2*) cl->getHisto(TPCMON_STR,"NorthSideADC_clusterXY_R1_unw");
1236  tpcmon_NSTPC_clusXY[i][1] = (TH2*) cl->getHisto(TPCMON_STR,"NorthSideADC_clusterXY_R2_unw");
1237  tpcmon_NSTPC_clusXY[i][2] = (TH2*) cl->getHisto(TPCMON_STR,"NorthSideADC_clusterXY_R3_unw");
1238 
1239  tpcmon_SSTPC_clusXY[i][0] = (TH2*) cl->getHisto(TPCMON_STR,"SouthSideADC_clusterXY_R1_unw");
1240  tpcmon_SSTPC_clusXY[i][1] = (TH2*) cl->getHisto(TPCMON_STR,"SouthSideADC_clusterXY_R2_unw");
1241  tpcmon_SSTPC_clusXY[i][2] = (TH2*) cl->getHisto(TPCMON_STR,"SouthSideADC_clusterXY_R3_unw");
1242  }
1243 
1244  if (!gROOT->FindObject("TPCClusterXY_unw"))
1245  {
1246  MakeCanvas("TPCClusterXY_unw");
1247  }
1248 
1249  TC[11]->SetEditable(true);
1250  TC[11]->Clear("D");
1251 
1252  TText PrintRun;
1253  PrintRun.SetTextFont(62);
1254  PrintRun.SetTextSize(0.04);
1255  PrintRun.SetNDC(); // set to normalized coordinates
1256  PrintRun.SetTextAlign(23); // center/top alignment
1257  std::ostringstream runnostream;
1258  std::string runstring;
1259  time_t evttime = cl->EventTime("CURRENT");
1260  // fill run number and event time into string
1261  runnostream << ThisName << "_ADC-Pedestal>20, UNWEIGHTED, Run " << cl->RunNumber()
1262  << ", Time: " << ctime(&evttime);
1263  runstring = runnostream.str();
1264  transparent[10]->cd();
1265  PrintRun.DrawText(0.5, 0.91, runstring.c_str());
1266 
1267  TC[11]->cd(1);
1268  gStyle->SetOptStat(kFALSE);
1269  gPad->SetTopMargin(0.15);
1270  //gPad->SetLogz(kTRUE);
1271  dummy_his1_XY_unw->Draw("colzsame");
1272 
1273  float NS_max = 0;
1274  for( int i=0; i<12; i++ )
1275  {
1276  for( int j=0; j<3; j++ )
1277  {
1278  if( tpcmon_NSTPC_clusXY[i][j] )
1279  {
1280  TC[11]->cd(1);
1281  tpcmon_NSTPC_clusXY[i][j] -> Draw("colzsame");
1282  //gStyle->SetLogz(kTRUE);
1283  if ( tpcmon_NSTPC_clusXY[i][j]->GetBinContent(tpcmon_NSTPC_clusXY[i][j]->GetMaximumBin()) > NS_max)
1284  {
1285  NS_max = tpcmon_NSTPC_clusXY[i][j]->GetBinContent(tpcmon_NSTPC_clusXY[i][j]->GetMaximumBin());
1286  dummy_his1_XY_unw->SetMaximum( NS_max );
1287  }
1288  gStyle->SetPalette(57); //kBird CVD friendly
1289  }
1290  }
1291 
1292  }
1293  TC[11]->cd(1);
1294  e1->SetFillStyle(0);
1295  e2->SetFillStyle(0);
1296  e3->SetFillStyle(0);
1297  e4->SetFillStyle(0);
1298 
1299  e1->Draw("same");
1300  e2->Draw("same");
1301  e3->Draw("same");
1302  e4->Draw("same");
1303  for(int ln2=0;ln2<12;ln2++)
1304  {
1305  lines[ln2]->Draw("same");
1306  }
1307  TC[11]->Update();
1308 
1309  TC[11]->cd(2);
1310  gStyle->SetOptStat(kFALSE);
1311  gPad->SetTopMargin(0.15);
1312  dummy_his2_XY_unw->Draw("colzsame");
1313  //gPad->SetLogz(kTRUE);
1314 
1315  float SS_max = 0;
1316  for( int i=0; i<12; i++ )
1317  {
1318  for( int j=0; j<3; j++ )
1319  {
1320  if( tpcmon_SSTPC_clusXY[i+12][j] )
1321  {
1322  //std::cout<<"South Side Custer XY i: "<< i+12 <<", j: "<<j<<std::endl;
1323  TC[11]->cd(2);
1324  tpcmon_SSTPC_clusXY[i+12][j] -> Draw("colzsame");
1325  //gStyle->SetLogz(kTRUE);
1326  if ( tpcmon_SSTPC_clusXY[i+12][j]->GetBinContent(tpcmon_SSTPC_clusXY[i+12][j]->GetMaximumBin()) > SS_max)
1327  {
1328  SS_max = tpcmon_SSTPC_clusXY[i+12][j]->GetBinContent(tpcmon_SSTPC_clusXY[i+12][j]->GetMaximumBin());
1329  dummy_his2_XY_unw->SetMaximum( SS_max );
1330  }
1331  gStyle->SetPalette(57); //kBird CVD friendly
1332  }
1333  }
1334 
1335  }
1336  TC[11]->cd(2);
1337  e1->SetFillStyle(0);
1338  e2->SetFillStyle(0);
1339  e3->SetFillStyle(0);
1340  e4->SetFillStyle(0);
1341 
1342  e1->Draw("same");
1343  e2->Draw("same");
1344  e3->Draw("same");
1345  e4->Draw("same");
1346  for(int ln2=0;ln2<12;ln2++)
1347  {
1348  lines[ln2]->Draw("same");
1349  }
1350  TC[11]->Update();
1351 
1352  TC[11]->Show();
1353  TC[11]->SetEditable(false);
1354 
1355  return 0;
1356 }
1357 
1359 {
1361 
1362  TH2 *tpcmon_ADCSAMPLE_large[24] = {nullptr};
1363 
1364  char TPCMON_STR[100];
1365  for( int i=0; i<24; i++ )
1366  {
1367  //const TString TPCMON_STR( Form( "TPCMON_%i", i ) );
1368  sprintf(TPCMON_STR,"TPCMON_%i",i);
1369  tpcmon_ADCSAMPLE_large[i] = (TH2*) cl->getHisto(TPCMON_STR,"ADC_vs_SAMPLE_large");
1370  }
1371 
1372 
1373  if (!gROOT->FindObject("TPCADCSamplelarge"))
1374  {
1375  MakeCanvas("TPCADCSamplelarge");
1376  }
1377 
1378  TC[12]->SetEditable(true);
1379  TC[12]->Clear("D");
1380 
1381  for( int i=0; i<24; i++ )
1382  {
1383  if( tpcmon_ADCSAMPLE_large[i] )
1384  {
1385  TC[12]->cd(i+5);
1386  gStyle->SetPalette(57); //kBird CVD friendly
1387  gPad->SetLogz(kTRUE);
1388  tpcmon_ADCSAMPLE_large[i] -> DrawCopy("colz");
1389  }
1390  }
1391 
1392  TText PrintRun;
1393  PrintRun.SetTextFont(62);
1394  PrintRun.SetTextSize(0.04);
1395  PrintRun.SetNDC(); // set to normalized coordinates
1396  PrintRun.SetTextAlign(23); // center/top alignment
1397  std::ostringstream runnostream;
1398  std::string runstring;
1399  time_t evttime = cl->EventTime("CURRENT");
1400  // fill run number and event time into string
1401  runnostream << ThisName << "_ADC_vs_SAMPLE_large Run " << cl->RunNumber()
1402  << ", Time: " << ctime(&evttime);
1403  runstring = runnostream.str();
1404  transparent[11]->cd();
1405  PrintRun.DrawText(0.5, 0.91, runstring.c_str());
1406 
1407 
1408  TC[12]->Update();
1409  TC[12]->Show();
1410  TC[12]->SetEditable(false);
1411 
1412  return 0;
1413 }
1414 
1415 
1416 
1418 {
1419 
1421 
1422  TH2 *tpcmon_NSTPC_clusZY[24] = {nullptr};
1423  TH2 *tpcmon_SSTPC_clusZY[24] = {nullptr};
1424 
1425  dummy_his1_ZY = new TH2F("dummy_his1_ZY", "(ADC-Pedestal) > 20 ADC, WEIGHTED", 515, -1030, 1030, 400, -800, 800); //dummy histos for titles
1426  dummy_his1_ZY->SetXTitle("Z [mm]");
1427  dummy_his1_ZY->SetYTitle("Y [mm]");
1428 
1429  char TPCMON_STR[100];
1430  for( int i=0; i<24; i++ )
1431  {
1432  //const TString TPCMON_STR( Form( "TPCMON_%i", i ) );
1433  sprintf(TPCMON_STR,"TPCMON_%i",i);
1434  tpcmon_NSTPC_clusZY[i] = (TH2*) cl->getHisto(TPCMON_STR,"NorthSideADC_clusterZY");
1435 
1436  tpcmon_SSTPC_clusZY[i] = (TH2*) cl->getHisto(TPCMON_STR,"SouthSideADC_clusterZY");
1437  }
1438 
1439  if (!gROOT->FindObject("TPCClusterZY"))
1440  {
1441  MakeCanvas("TPCClusterZY");
1442  }
1443 
1444  TC[13]->SetEditable(true);
1445  TC[13]->Clear("D");
1446 
1447  TText PrintRun;
1448  PrintRun.SetTextFont(62);
1449  PrintRun.SetTextSize(0.04);
1450  PrintRun.SetNDC(); // set to normalized coordinates
1451  PrintRun.SetTextAlign(23); // center/top alignment
1452  std::ostringstream runnostream;
1453  std::string runstring;
1454  time_t evttime = cl->EventTime("CURRENT");
1455  // fill run number and event time into string
1456  runnostream << ThisName << "_ADC-Pedestal>20 ADC, WEIGHTED, Run " << cl->RunNumber()
1457  << ", Time: " << ctime(&evttime);
1458  runstring = runnostream.str();
1459  transparent[12]->cd();
1460  PrintRun.DrawText(0.5, 0.91, runstring.c_str());
1461 
1462  TC[13]->cd(1);
1463  gStyle->SetOptStat(kFALSE);
1464  gPad->SetTopMargin(0.15);
1465  gPad->SetLogz(kTRUE);
1466  dummy_his1_ZY->Draw("colzsame");
1467 
1468 
1469  float max = 0;
1470  for( int i=0; i<12; i++ )
1471  {
1472  if( tpcmon_NSTPC_clusZY[i] )
1473  {
1474  TC[13]->cd(1);
1475  tpcmon_NSTPC_clusZY[i] -> Draw("colzsame");
1476  if ( tpcmon_NSTPC_clusZY[i]->GetBinContent(tpcmon_NSTPC_clusZY[i]->GetMaximumBin()) > max )
1477  {
1478  max = tpcmon_NSTPC_clusZY[i]->GetBinContent(tpcmon_NSTPC_clusZY[i]->GetMaximumBin());
1479  dummy_his1_ZY->SetMaximum( max );
1480  }
1481  gStyle->SetPalette(57); //kBird CVD friendly
1482  }
1483 
1484  }
1485  TC[13]->Update();
1486 
1487  for( int i=0; i<12; i++ )
1488  {
1489  if( tpcmon_SSTPC_clusZY[i+12] )
1490  {
1491  TC[13]->cd(1);
1492  tpcmon_SSTPC_clusZY[i+12] -> Draw("colzsame");
1493  if ( tpcmon_SSTPC_clusZY[i+12]->GetBinContent(tpcmon_SSTPC_clusZY[i+12]->GetMaximumBin()) > max )
1494  {
1495  max = tpcmon_SSTPC_clusZY[i+12]->GetBinContent(tpcmon_SSTPC_clusZY[i+12]->GetMaximumBin());
1496  dummy_his1_ZY->SetMaximum( max );
1497  }
1498  //gStyle->SetLogz(kTRUE);
1499  gStyle->SetPalette(57); //kBird CVD friendly
1500  }
1501 
1502  }
1503 
1504  TC[13]->Update();
1505  TC[13]->Show();
1506  TC[13]->SetEditable(false);
1507 
1508 
1509 
1510  return 0;
1511 }
1512 
1513 
1515 {
1516 
1517 
1519 
1520  TH2 *tpcmon_NSTPC_clusZY_unw[24] = {nullptr};
1521  TH2 *tpcmon_SSTPC_clusZY_unw[24] = {nullptr};
1522 
1523  dummy_his1_ZY_unw = new TH2F("dummy_his1_ZY_unw", "(ADC-Pedestal) > 20 ADC, UNWEIGHTED", 515, -1030, 1030, 400, -800, 800); //dummy histos for titles
1524  dummy_his1_ZY_unw->SetXTitle("Z [mm]");
1525  dummy_his1_ZY_unw->SetYTitle("Y [mm]");
1526 
1527  char TPCMON_STR[100];
1528  for( int i=0; i<24; i++ )
1529  {
1530  //const TString TPCMON_STR( Form( "TPCMON_%i", i ) );
1531  sprintf(TPCMON_STR,"TPCMON_%i",i);
1532  tpcmon_NSTPC_clusZY_unw[i] = (TH2*) cl->getHisto(TPCMON_STR,"NorthSideADC_clusterZY_unw");
1533 
1534  tpcmon_SSTPC_clusZY_unw[i] = (TH2*) cl->getHisto(TPCMON_STR,"SouthSideADC_clusterZY_unw");
1535  }
1536 
1537  if (!gROOT->FindObject("TPCClusterZY_unw"))
1538  {
1539  MakeCanvas("TPCClusterZY_unw");
1540  }
1541 
1542  TC[14]->SetEditable(true);
1543  TC[14]->Clear("D");
1544 
1545  TText PrintRun;
1546  PrintRun.SetTextFont(62);
1547  PrintRun.SetTextSize(0.04);
1548  PrintRun.SetNDC(); // set to normalized coordinates
1549  PrintRun.SetTextAlign(23); // center/top alignment
1550  std::ostringstream runnostream;
1551  std::string runstring;
1552  time_t evttime = cl->EventTime("CURRENT");
1553  // fill run number and event time into string
1554  runnostream << ThisName << "_ADC-Pedestal>20 ADC, UNWEIGHTED, Run " << cl->RunNumber()
1555  << ", Time: " << ctime(&evttime);
1556  runstring = runnostream.str();
1557  transparent[13]->cd();
1558  PrintRun.DrawText(0.5, 0.91, runstring.c_str());
1559 
1560  TC[14]->cd(1);
1561  gStyle->SetOptStat(kFALSE);
1562  gPad->SetTopMargin(0.15);
1563  gPad->SetLogz(kTRUE);
1564  dummy_his1_ZY_unw->Draw("colzsame");
1565 
1566  float max = 0;
1567  for( int i=0; i<12; i++ )
1568  {
1569  if( tpcmon_NSTPC_clusZY_unw[i] )
1570  {
1571  TC[14]->cd(1);
1572  tpcmon_NSTPC_clusZY_unw[i] -> Draw("colzsame");
1573  if ( tpcmon_NSTPC_clusZY_unw[i]->GetBinContent(tpcmon_NSTPC_clusZY_unw[i]->GetMaximumBin()) > max )
1574  {
1575  max = tpcmon_NSTPC_clusZY_unw[i]->GetBinContent(tpcmon_NSTPC_clusZY_unw[i]->GetMaximumBin());
1576  dummy_his1_ZY->SetMaximum( max );
1577  }
1578  //gStyle->SetLogz(kTRUE);
1579  gStyle->SetPalette(57); //kBird CVD friendly
1580  }
1581 
1582  }
1583  TC[14]->Update();
1584 
1585  for( int i=0; i<12; i++ )
1586  {
1587  if( tpcmon_SSTPC_clusZY_unw[i+12] )
1588  {
1589  TC[14]->cd(1);
1590  tpcmon_SSTPC_clusZY_unw[i+12] -> Draw("colzsame");
1591  if ( tpcmon_SSTPC_clusZY_unw[i+12]->GetBinContent(tpcmon_SSTPC_clusZY_unw[i+12]->GetMaximumBin()) > max )
1592  {
1593  max = tpcmon_SSTPC_clusZY_unw[i+12]->GetBinContent(tpcmon_SSTPC_clusZY_unw[i+12]->GetMaximumBin());
1594  dummy_his1_ZY->SetMaximum( max );
1595  }
1596  //gStyle->SetLogz(kTRUE);
1597  gStyle->SetPalette(57); //kBird CVD friendly
1598  }
1599 
1600  }
1601  TC[14]->Update();
1602 
1603  TC[14]->Show();
1604  TC[14]->SetEditable(false);
1605 
1606 
1607 
1608  return 0;
1609 }
1611 {
1613 
1614  TH2 *tpcmonth2channelphi_layer[24] = {nullptr};
1615 
1616  char TPCMON_STR[100];
1617 
1618  dummy_his1_channelphi_layer_w = new TH2F("dummy_his1_channelphi_layer_", "(ADC-Pedestal) > 20 ADC, UNWEIGHTED", 515, -1030, 1030, 400, -800, 800); //dummy histos for titles
1619  dummy_his1_channelphi_layer_w->SetXTitle("#phi chan. #");
1620  dummy_his1_channelphi_layer_w->SetYTitle("layer ");
1621  dummy_his1_channelphi_layer_w->SetZTitle("#Sigma(ADC-ped.)");
1622 
1623  for( int i=0; i<24; i++ )
1624  {
1625  //const TString TPCMON_STR( Form( "TPCMON_%i", i ) );
1626  sprintf(TPCMON_STR,"TPCMON_%i",i);
1627  tpcmonth2channelphi_layer[i] = (TH2*) cl->getHisto(TPCMON_STR,"Layer_ChannelPhi_ADC_weighted");
1628  }
1629 
1630  if (!gROOT->FindObject("TPCLayerPhi"))
1631  {
1632  MakeCanvas("TPCLayerPhi");
1633  }
1634 
1635  TC[15]->SetEditable(true);
1636  TC[15]->Clear("D");
1637 
1638  TText PrintRun;
1639  PrintRun.SetTextFont(62);
1640  PrintRun.SetTextSize(0.04);
1641  PrintRun.SetNDC(); // set to normalized coordinates
1642  PrintRun.SetTextAlign(23); // center/top alignment
1643  std::ostringstream runnostream;
1644  std::string runstring;
1645  time_t evttime = cl->EventTime("CURRENT");
1646  // fill run number and event time into string
1647  runnostream << ThisName << "_ChannelPhi_vs_Layer_ADC_weighted " << cl->RunNumber()
1648  << ", Time: " << ctime(&evttime);
1649  runstring = runnostream.str();
1650  transparent[14]->cd();
1651  PrintRun.DrawText(0.5, 0.91, runstring.c_str());
1652 
1653  TC[15]->cd(1);
1654  gStyle->SetOptStat(kFALSE);
1655  gPad->SetTopMargin(0.15);
1656  gPad->SetLogz(kTRUE);
1657  dummy_his1_channelphi_layer_w->Draw("lego2zsame");
1658 
1659  float max = 0;
1660  for( int i=0; i<24; i++ )
1661  {
1662  if( tpcmonth2channelphi_layer[i] )
1663  {
1664  TC[15]->cd(1);
1665  tpcmonth2channelphi_layer[i] -> Draw("lego2zsame");
1666  if ( tpcmonth2channelphi_layer[i]->GetBinContent( tpcmonth2channelphi_layer[i]->GetMaximumBin()) > max )
1667  {
1668  max = tpcmonth2channelphi_layer[i]->GetBinContent( tpcmonth2channelphi_layer[i]->GetMaximumBin());
1669  dummy_his1_channelphi_layer_w->SetMaximum( max );
1670  }
1671  //gStyle->SetLogz(kTRUE);
1672  gStyle->SetPalette(57); //kBird CVD friendly
1673  }
1674 
1675  }
1676  TC[15]->Update();
1677 
1678  TC[15]->Show();
1679  TC[15]->SetEditable(false);
1680 
1681  return 0;
1682 }
1683 
1685 {
1686  //std::cout<<"Made it inside DrawTPCRawADC1D"<<std::endl;
1688 
1689  TH1 *tpcmon_PEDESTSUBADC1D[24][3] = {nullptr};
1690 
1691  char TPCMON_STR[100];
1692  for( int i=0; i<24; i++ )
1693  {
1694  //const TString TPCMON_STR( Form( "TPCMON_%i", i ) );
1695  sprintf(TPCMON_STR,"TPCMON_%i",i);
1696  tpcmon_PEDESTSUBADC1D[i][0] = (TH1*) cl->getHisto(TPCMON_STR,"PEDEST_SUB_1D_R1");
1697  tpcmon_PEDESTSUBADC1D[i][1] = (TH1*) cl->getHisto(TPCMON_STR,"PEDEST_SUB_1D_R2");
1698  tpcmon_PEDESTSUBADC1D[i][2] = (TH1*) cl->getHisto(TPCMON_STR,"PEDEST_SUB_1D_R3");
1699  }
1700 
1701 
1702  if (!gROOT->FindObject("TPCPedestSubADC1D"))
1703  {
1704  MakeCanvas("TPCPedestSubADC1D");
1705  }
1706 
1707  TC[16]->SetEditable(true);
1708  TC[16]->Clear("D");
1709 
1710  auto legend = new TLegend(0.7,0.65,0.98,0.95);
1711  bool draw_leg = 0;
1712 
1713  for( int i=0; i<24; i++ )
1714  {
1715  TC[16]->cd(i+5);
1716  for( int j = 2; j>-1; j-- )
1717  {
1718  if( tpcmon_PEDESTSUBADC1D[i][j] )
1719  {
1720  if(j == 2){tpcmon_PEDESTSUBADC1D[i][j] -> DrawCopy("HIST");}
1721  else {tpcmon_PEDESTSUBADC1D[i][j] -> DrawCopy("HISTsame");} //assumes that R3 will always exist and is most entries
1722  }
1723  }
1724  gPad->Update();
1725  gPad->SetLogy(kTRUE);
1726 
1727  if(draw_leg == 0 && tpcmon_PEDESTSUBADC1D[i][0] && tpcmon_PEDESTSUBADC1D[i][1] && tpcmon_PEDESTSUBADC1D[i][2]) //if you have not drawn the legend yet, draw it BUT ONLY ONCE
1728  {
1729  legend->AddEntry(tpcmon_PEDESTSUBADC1D[i][0], "R1");
1730  legend->AddEntry(tpcmon_PEDESTSUBADC1D[i][1], "R2");
1731  legend->AddEntry(tpcmon_PEDESTSUBADC1D[i][2], "R3");
1732  TC[16]->cd(i+5);
1733  legend->Draw();
1734  draw_leg = 1; //don't draw it again
1735  }
1736  }
1737 
1738  TText PrintRun;
1739  PrintRun.SetTextFont(62);
1740  PrintRun.SetTextSize(0.04);
1741  PrintRun.SetNDC(); // set to normalized coordinates
1742  PrintRun.SetTextAlign(23); // center/top alignment
1743  std::ostringstream runnostream;
1744  std::string runstring;
1745  time_t evttime = cl->EventTime("CURRENT");
1746  // fill run number and event time into string
1747  runnostream << ThisName << "_PEDESTSUBADC Run " << cl->RunNumber()
1748  << ", Time: " << ctime(&evttime);
1749  runstring = runnostream.str();
1750  transparent[15]->cd();
1751  PrintRun.DrawText(0.5, 0.91, runstring.c_str());
1752 
1753  TC[16]->Update();
1754  TC[16]->Show();
1755  TC[16]->SetEditable(false);
1756 
1757  return 0;
1758 }
1759 
1760 
1762 {
1763 
1765  int iret = Draw(what);
1766  if (iret) // on error no png files please
1767  {
1768  return iret;
1769  }
1770  int icnt = 0;
1771  for (TCanvas *canvas : TC)
1772  {
1773  if (canvas == nullptr)
1774  {
1775  continue;
1776  }
1777  icnt++;
1778  std::string filename = ThisName + "_" + std::to_string(icnt) + "_" +
1779  std::to_string(cl->RunNumber()) + "." + type;
1780  cl->CanvasToPng(canvas, filename);
1781  }
1782  return 0;
1783 }
1784 
1786 {
1787  int iret = Draw(what);
1788  if (iret) // on error no html output please
1789  {
1790  return iret;
1791  }
1792 
1794 
1795  int icnt = 0;
1796  for (TCanvas *canvas : TC)
1797  {
1798  if (canvas == nullptr)
1799  {
1800  continue;
1801  }
1802  icnt++;
1803  // Register the canvas png file to the menu and produces the png file.
1804  std::string pngfile = cl->htmlRegisterPage(*this, canvas->GetTitle(), std::to_string(icnt), "png");
1805  cl->CanvasToPng(canvas, pngfile);
1806  }
1807  // Now register also EXPERTS html pages, under the EXPERTS subfolder.
1808 
1809  // std::string logfile = cl->htmlRegisterPage(*this, "EXPERTS/Log", "log", "html");
1810  // std::ofstream out(logfile.c_str());
1811  // out << "<HTML><HEAD><TITLE>Log file for run " << cl->RunNumber()
1812  // << "</TITLE></HEAD>" << std::endl;
1813  // out << "<P>Some log file output would go here." << std::endl;
1814  // out.close();
1815 
1816  // std::string status = cl->htmlRegisterPage(*this, "EXPERTS/Status", "status", "html");
1817  // std::ofstream out2(status.c_str());
1818  // out2 << "<HTML><HEAD><TITLE>Status file for run " << cl->RunNumber()
1819  // << "</TITLE></HEAD>" << std::endl;
1820  // out2 << "<P>Some status output would go here." << std::endl;
1821  // out2.close();
1822  // cl->SaveLogFile(*this);
1823  return 0;
1824 }
1825 
1827 {
1829  time_t currtime = 0;
1830  int i = 0;
1831  while (currtime == 0 && i <= 23)
1832  {
1833  std::string servername = "TPCMON_" + std::to_string(i);
1834  currtime = cl->EventTime(servername,"CURRENT");
1835  i++;
1836  }
1837  return currtime;
1838 }