Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:20:34

0001 #include "ZdcMonDraw.h"
0002 
0003 #include <onlmon/OnlMonClient.h>
0004 #include <onlmon/OnlMonDB.h>
0005 
0006 #include <TAxis.h>  // for TAxis
0007 #include <TCanvas.h>
0008 #include <TDatime.h>
0009 #include <TGraphErrors.h>
0010 #include <TH1.h>
0011 #include <TH2.h>
0012 #include <TProfile.h>
0013 #include <TPad.h>
0014 #include <TROOT.h>
0015 #include <TSystem.h>
0016 #include <TStyle.h>
0017 #include <TText.h>
0018 #include <TLatex.h>
0019 #include <TLine.h>
0020 
0021 #include <cstring>  // for memset
0022 #include <ctime>
0023 #include <fstream>
0024 #include <iostream>  // for operator<<, basic_ostream, basic_os...
0025 #include <sstream>
0026 #include <vector>  // for vector
0027 
0028 ZdcMonDraw::ZdcMonDraw(const std::string &name)
0029   : OnlMonDraw(name)
0030 {
0031   return;
0032 }
0033 
0034 int ZdcMonDraw::Init()
0035 {
0036   return 0;
0037 }
0038 
0039 int ZdcMonDraw::MakeCanvas(const std::string &name)
0040 {
0041   OnlMonClient *cl = OnlMonClient::instance();
0042   int xsize = cl->GetDisplaySizeX();
0043   int ysize = cl->GetDisplaySizeY();
0044   if (name == "ZdcMon1")
0045   {
0046     // xpos (-1) negative: do not draw menu bar
0047     TC[0] = new TCanvas(name.c_str(), "ZDC-SMD Monitor", -1, ysize, xsize * 0.9, ysize);
0048     // root is pathetic, whenever a new TCanvas is created root piles up
0049     // 6kb worth of X11 events which need to be cleared with
0050     // gSystem->ProcessEvents(), otherwise your process will grow and
0051     // grow and grow but will not show a definitely lost memory leak
0052     gSystem->ProcessEvents();
0053     Pad[0] = new TPad("zdcpad1", "who needs this?", 0.05, 0.5, 0.5, 0.9, 0);
0054     Pad[1] = new TPad("zdcpad2", "who needs this?", 0.5, 0.5, 0.95, 0.9, 0);
0055     Pad[2] = new TPad("zdcpad3", "who needs this?", 0.05, 0.05, 0.5, 0.45, 0);
0056     Pad[3] = new TPad("zdcpad4", "who needs this?", 0.5, 0.05, 0.95, 0.45, 0);
0057     Pad[0]->Draw();
0058     Pad[1]->Draw();
0059     Pad[2]->Draw();
0060     Pad[3]->Draw();
0061     // this one is used to plot the run number on the canvas
0062     transparent[0] = new TPad("transparent0", "this does not show", 0, 0, 1, 1);
0063     transparent[0]->SetFillStyle(4000);
0064     transparent[0]->Draw();
0065     TC[0]->SetEditable(false);
0066   }
0067   else if (name == "ZdcMon2")
0068   {
0069     // xpos negative: do not draw menu bar
0070     TC[1] = new TCanvas(name.c_str(), "ZDC North and South Channels", -1, -ysize, xsize * 0.9, ysize);
0071     gSystem->ProcessEvents();
0072 
0073     Pad[4] = new TPad("zdcpad5", "who needs this?", 0.05, 0.65, 0.35, 0.95, 0);
0074     Pad[5] = new TPad("zdcpad6", "who needs this?", 0.35, 0.65, 0.65, 0.95, 0);
0075     Pad[6] = new TPad("zdcpad7", "who needs this?", 0.65, 0.65, 0.95, 0.95, 0);
0076     Pad[7] = new TPad("zdcpad8", "who needs this?", 0.05, 0.35, 0.35, 0.65, 0);
0077     Pad[8] = new TPad("zdcpad9", "who needs this?", 0.35, 0.35, 0.65, 0.65, 0);
0078     Pad[9] = new TPad("zdcpad10", "who needs this?", 0.65, 0.35, 0.95, 0.65, 0);
0079 
0080     Pad[4]->Draw();
0081     Pad[5]->Draw();
0082     Pad[6]->Draw();
0083     Pad[7]->Draw();
0084     Pad[8]->Draw();
0085     Pad[9]->Draw();
0086 
0087     // this one is used to plot the run number on the canvas
0088     transparent[1] = new TPad("transparent1", "this does not show", 0, 0, 1, 1);
0089     transparent[1]->SetFillStyle(4000);
0090     transparent[1]->Draw();
0091     TC[1]->SetEditable(false);
0092   }
0093   // DRAW SMD GOOD AND SMALL VALUES
0094   else if (name == "SmdValues")
0095   {
0096     // xpos negative: do not draw menu bar
0097     TC[2] = new TCanvas(name.c_str(), " Smd Values", -1, ysize, xsize*0.9, ysize / 2);
0098 
0099     gSystem->ProcessEvents();
0100     Pad[10] = new TPad("Smd Value", "Smd Value", 0.05, 0.05, 0.35, 0.9, 0);
0101     Pad[11] = new TPad("Smd Value (good)", "Smd Value (good)", 0.35, 0.05, 0.65, 0.9, 0);
0102     Pad[12] = new TPad("Smd Value (small)", "Smd Value (small)", 0.65, 0.05, 0.95, 0.9, 0);
0103 
0104     Pad[10]->Draw();
0105     Pad[11]->Draw();
0106     Pad[12]->Draw();
0107 
0108     // this one is used to plot the run number on the canvas
0109     transparent[2] = new TPad("transparent2", "this does not show", 0, 0, 1, 1);
0110     transparent[2]->SetFillStyle(4000);
0111     transparent[2]->Draw();
0112     TC[2]->SetEditable(false);
0113   }
0114 
0115   // DRAW SMD NORTH AND SOUTH
0116   else if (name == "SmdNorthandSouth")
0117   {
0118     // xpos negative: do not draw menu bar
0119     TC[3] = new TCanvas(name.c_str(), "EXPERT - Smd North and South", -1, ysize, xsize * 0.9, ysize * 0.9);
0120     gSystem->ProcessEvents();
0121 
0122     Pad[13] = new TPad("Smd Ver North (good)", "Smd Ver North (good)", 0.02, 0.05, 0.26, 0.35, 0);
0123     Pad[14] = new TPad("Smd Hor North (good)", "Smd Hor North (good)", 0.26, 0.05, 0.5, 0.35, 0);
0124     Pad[15] = new TPad("Smd Ver North (small)", "Smd Ver North (small)", 0.5, 0.05, 0.74, 0.35, 0);
0125     Pad[16] = new TPad("Smd Hor North (small)", "Smd Hor North (small)", 0.74, 0.05, 0.98, 0.35, 0);
0126 
0127     Pad[17] = new TPad("Smd Ver North", "Smd Ver North", 0.02, 0.35, 0.26, 0.65, 0);
0128     Pad[18] = new TPad("Smd Hor North", "Smd Hor North", 0.26, 0.35, 0.5, 0.65, 0);
0129     Pad[19] = new TPad("Smd Ver South", "Smd Ver South", 0.5, 0.35, 0.74, 0.65, 0);
0130     Pad[20] = new TPad("Smd Hor South", "Smd Hor South", 0.74, 0.35, 0.98, 0.65, 0);
0131 
0132     Pad[21] = new TPad("Smd sum Ver North", "Smd sum Ver North", 0.02, 0.65, 0.26, 0.95, 0);
0133     Pad[22] = new TPad("Smd sum Hor North", "Smd sum Hor North", 0.26, 0.65, 0.5, 0.95, 0);
0134     Pad[23] = new TPad("Smd sum Ver South", "Smd sum Ver South", 0.5, 0.65, 0.74, 0.95, 0);
0135     Pad[24] = new TPad("Smd sum Hor South", "Smd sum Hor South", 0.74, 0.65, 0.98, 0.95, 0);
0136 
0137     Pad[13]->Draw();
0138     Pad[14]->Draw();
0139     Pad[15]->Draw();
0140     Pad[16]->Draw();
0141     Pad[17]->Draw();
0142     Pad[18]->Draw();
0143     Pad[19]->Draw();
0144     Pad[20]->Draw();
0145     Pad[21]->Draw();
0146     Pad[22]->Draw();
0147     Pad[23]->Draw();
0148     Pad[24]->Draw();
0149 
0150     // this one is used to plot the run number on the canvas
0151     transparent[3] = new TPad("transparent3", "this does not show", 0, 0, 1, 1);
0152     transparent[3]->SetFillStyle(4000);
0153     transparent[3]->Draw();
0154     TC[3]->SetEditable(false);
0155   }
0156 
0157   else if (name == "SmdAdcNorthIndividual")
0158   {
0159     // xpos negative: do not draw menu bar
0160     TC[4] = new TCanvas(name.c_str(), "SMD ADC North Individual values", -1, -ysize, xsize * 0.9, ysize * 0.9);
0161     gSystem->ProcessEvents();
0162     //  North Horizontal
0163 
0164     // xmin, ymin, xmax, ymax
0165     // First Line
0166     Pad[21] = new TPad("smd_adc_n_hor0", "smd_adc_n_hor0", 0.02, 0.74, 0.26, 0.98, 0);
0167     Pad[22] = new TPad("smd_adc_n_hor1", "smd_adc_n_hor1", 0.26, 0.74, 0.50, 0.98, 0);
0168     Pad[23] = new TPad("smd_adc_n_hor2", "smd_adc_n_hor2", 0.50, 0.74, 0.74, 0.98, 0);
0169     Pad[24] = new TPad("smd_adc_n_hor3", "smd_adc_n_hor3", 0.74, 0.74, 0.98, 0.98, 0);
0170     // Second Line
0171     Pad[25] = new TPad("smd_adc_n_hor4", "smd_adc_n_hor4", 0.02, 0.50, 0.26, 0.74, 0);
0172     Pad[26] = new TPad("smd_adc_n_hor5", "smd_adc_n_hor5", 0.26, 0.50, 0.50, 0.74, 0);
0173     Pad[27] = new TPad("smd_adc_n_hor6", "smd_adc_n_hor6", 0.50, 0.50, 0.74, 0.74, 0);
0174     Pad[28] = new TPad("smd_adc_n_hor7", "smd_adc_n_hor7", 0.74, 0.50, 0.98, 0.74, 0);
0175     // Third Line
0176     Pad[29] = new TPad("smd_adc_n_ver8", "smd_adc_n_ver8", 0.02, 0.26, 0.26, 0.50, 0);
0177     Pad[30] = new TPad("smd_adc_n_ver9", "smd_adc_n_ver9", 0.26, 0.26, 0.50, 0.50, 0);
0178     Pad[31] = new TPad("smd_adc_n_ver10", "smd_adc_n_ver10", 0.50, 0.26, 0.74, 0.50, 0);
0179     Pad[32] = new TPad("smd_adc_n_ver11", "smd_adc_n_ver11", 0.74, 0.26, 0.98, 0.50, 0);
0180     // Fourth Line
0181     Pad[33] = new TPad("smd_adc_n_ver12", "smd_adc_n_ver12", 0.02, 0.02, 0.26, 0.26, 0);
0182     Pad[34] = new TPad("smd_adc_n_ver13", "smd_adc_n_ver13", 0.26, 0.02, 0.50, 0.26, 0);
0183     Pad[35] = new TPad("smd_adc_n_ver14", "smd_adc_n_ver14", 0.50, 0.02, 0.74, 0.26, 0);
0184 
0185     for (int i = 21; i < 36; i++)
0186     {
0187       Pad[i]->Draw();
0188     }
0189 
0190     // this one is used to plot the run number on the canvas
0191     transparent[4] = new TPad("transparent4", "this does not show", 0, 0, 1, 1);
0192     transparent[4]->SetFillStyle(4000);
0193     transparent[4]->Draw();
0194     TC[4]->SetEditable(false);
0195   }
0196 
0197   else if (name == "SmdAdcSouthIndividual")
0198   {
0199     // xpos negative: do not draw menu bar
0200     TC[5] = new TCanvas(name.c_str(), "SMD ADC South Individual values", -1, ysize, xsize * 0.9, ysize * 0.9);
0201     gSystem->ProcessEvents();
0202     //  North Horizontal
0203 
0204     // xmin, ymin, xmax, ymax
0205     // First Line
0206     Pad[36] = new TPad("smd_adc_s_hor16", "smd_adc_s_hor16", 0.02, 0.74, 0.26, 0.98, 0);
0207     Pad[37] = new TPad("smd_adc_s_hor17", "smd_adc_s_hor17", 0.26, 0.74, 0.50, 0.98, 0);
0208     Pad[38] = new TPad("smd_adc_s_hor18", "smd_adc_s_hor18", 0.50, 0.74, 0.74, 0.98, 0);
0209     Pad[39] = new TPad("smd_adc_s_hor19", "smd_adc_s_hor19", 0.74, 0.74, 0.98, 0.98, 0);
0210     // Second Line
0211     Pad[40] = new TPad("smd_adc_s_hor20", "smd_adc_s_hor20", 0.02, 0.50, 0.26, 0.74, 0);
0212     Pad[41] = new TPad("smd_adc_s_hor21", "smd_adc_s_hor21", 0.26, 0.50, 0.50, 0.74, 0);
0213     Pad[42] = new TPad("smd_adc_s_hor22", "smd_adc_s_hor22", 0.50, 0.50, 0.74, 0.74, 0);
0214     Pad[43] = new TPad("smd_adc_s_hor23", "smd_adc_s_hor23", 0.74, 0.50, 0.98, 0.74, 0);
0215     // Third Line
0216     Pad[44] = new TPad("smd_adc_s_ver24", "smd_adc_s_ver24", 0.02, 0.26, 0.26, 0.50, 0);
0217     Pad[45] = new TPad("smd_adc_s_ver25", "smd_adc_s_ver25", 0.26, 0.26, 0.50, 0.50, 0);
0218     Pad[46] = new TPad("smd_adc_s_ver26", "smd_adc_s_ver26", 0.50, 0.26, 0.74, 0.50, 0);
0219     Pad[47] = new TPad("smd_adc_s_ver27", "smd_adc_s_ver27", 0.74, 0.26, 0.98, 0.50, 0);
0220     // Fourth Line
0221     Pad[48] = new TPad("smd_adc_s_ver28", "smd_adc_s_ver28", 0.02, 0.02, 0.26, 0.26, 0);
0222     Pad[49] = new TPad("smd_adc_s_ver29", "smd_adc_s_ver29", 0.26, 0.02, 0.50, 0.26, 0);
0223     Pad[50] = new TPad("smd_adc_s_ver30", "smd_adc_s_ver30", 0.50, 0.02, 0.74, 0.26, 0);
0224 
0225     for (int i = 36; i < 51; i++)
0226     {
0227       Pad[i]->Draw();
0228     }
0229 
0230     // this one is used to plot the run number on the canvas
0231     transparent[5] = new TPad("transparent5", "this does not show", 0, 0, 1, 1);
0232     transparent[5]->SetFillStyle(4000);
0233     transparent[5]->Draw();
0234     TC[5]->SetEditable(false);
0235   }
0236 
0237   else if (name == "veto")
0238   {
0239     // xpos negative: do not draw menu bar
0240     TC[6] = new TCanvas(name.c_str(), "EXPERT - Veto counter", -1, ysize, xsize / 2, ysize / 2);
0241     gSystem->ProcessEvents();
0242   
0243     Pad[51] = new TPad("Veto_NF", "Veto_NF", 0.05, 0.5, 0.5, 0.98, 0);
0244     Pad[52] = new TPad("Veto_NB", "Veto_NB", 0.5, 0.5, 0.98, 0.98, 0);
0245     Pad[53] = new TPad("Veto_SF", "Veto_SF", 0.05, 0.05, 0.5, 0.5, 0);
0246     Pad[54] = new TPad("Veto_SB", "Veto_SB", 0.5, 0.05, 0.95, 0.5, 0);
0247 
0248 
0249     Pad[51]->Draw();
0250     Pad[52]->Draw();
0251     Pad[53]->Draw();
0252     Pad[54]->Draw();
0253 
0254     // this one is used to plot the run number on the canvas
0255     transparent[6] = new TPad("transparent6", "this does not show", 0, 0, 1, 1);
0256     transparent[6]->SetFillStyle(4000);
0257     transparent[6]->Draw();
0258     TC[6]->SetEditable(false);
0259   }
0260     
0261   else if (name == "SmdMultiplicities")
0262   {
0263     // xpos negative: do not draw menu bar
0264     TC[7] = new TCanvas(name.c_str(), "EXPERT - Smd Multiplicities", -1, ysize, xsize / 2, ysize / 2);
0265     gSystem->ProcessEvents();
0266     Pad[55] = new TPad("smd_north_hor_hits", "smd_north_hor_hits", 0.05, 0.5, 0.5, 0.98, 0);
0267     Pad[56] = new TPad("smd_north_ver_hits", "smd_north_ver_hits", 0.5, 0.5, 0.98, 0.98, 0);
0268     Pad[57] = new TPad("smd_south_hor_hits", "smd_south_hor_hits", 0.05, 0.05, 0.5, 0.5, 0);
0269     Pad[58] = new TPad("smd_south_ver_hits", "smd_south_ver_hits", 0.5, 0.05, 0.95, 0.5, 0);
0270 
0271     Pad[55]->Draw();
0272     Pad[56]->Draw();
0273     Pad[57]->Draw();
0274     Pad[58]->Draw();
0275 
0276     // this one is used to plot the run number on the canvas
0277     transparent[7] = new TPad("transparent7", "this does not show", 0, 0, 1, 1);
0278     transparent[7]->SetFillStyle(4000);
0279     transparent[7]->Draw();
0280     TC[7]->SetEditable(false);
0281   }
0282 
0283   else if (name == "waveform")
0284   {
0285     // xpos (-1) negative: do not draw menu bar
0286     TC[8] = new TCanvas(name.c_str(), "ZDC Wave form", -1, -ysize, xsize * 0.9, ysize * 0.9);
0287     // root is pathetic, whenever a new TCanvas is created root piles up
0288     // 6kb worth of X11 events which need to be cleared with
0289     // gSystem->ProcessEvents(), otherwise your process will grow and
0290     // grow and grow but will not show a definitely lost memory leak
0291     gSystem->ProcessEvents();
0292       
0293     // float xshift = 0.04; 
0294 
0295     Pad[59] = new TPad("zdcpad59", "who needs this?", 0.05, 0.5, 0.2, 0.9, 0);
0296     Pad[60] = new TPad("zdcpad60", "who needs this?", 0.25, 0.5, 0.25+0.15, 0.9, 0);
0297     Pad[61] = new TPad("zdcpad61", "who needs this?", 0.25+0.15+0.05, 0.5, 0.25+0.3+0.05, 0.9, 0);
0298     Pad[62] = new TPad("zdcpad62", "who needs this?", 0.25+0.3+0.05+0.05, 0.5, 0.25+0.45+0.05+0.05, 0.9, 0);
0299     Pad[63] = new TPad("zdcpad63", "who needs this?", 0.25+0.45+0.05+0.05+0.05, 0.5, 1, 0.9, 0);
0300 
0301     
0302     Pad[64] = new TPad("zdcpad64", "who needs this?", 0.05, 0.05, 0.2, 0.4, 0);
0303     Pad[65] = new TPad("zdcpad65", "who needs this?", 0.25, 0.05, 0.25+0.15, 0.4, 0);
0304     Pad[66] = new TPad("zdcpad66", "who needs this?", 0.25+0.15+0.05, 0.05, 0.25+0.3+0.05, 0.4, 0);
0305     Pad[67] = new TPad("zdcpad67", "who needs this?", 0.25+0.3+0.05+0.05, 0.05, 0.25+0.45+0.05+0.05, 0.4, 0);
0306     Pad[68] = new TPad("zdcpad68", "who needs this?", 0.25+0.45+0.05+0.05+0.05, 0.05, 1, 0.4, 0);
0307       
0308   
0309     Pad[59]->Draw();
0310     Pad[60]->Draw();
0311     Pad[61]->Draw();
0312     Pad[62]->Draw();
0313     Pad[63]->Draw();
0314     Pad[64]->Draw();
0315     Pad[65]->Draw();
0316     Pad[66]->Draw();
0317     Pad[67]->Draw();
0318     Pad[68]->Draw();
0319 
0320     // this one is used to plot the run number on the canvas
0321     transparent[8] = new TPad("transparent8", "this does not show", 0, 0, 1, 1);
0322     transparent[8]->SetFillStyle(4000);
0323     transparent[8]->Draw();
0324     TC[8]->SetEditable(false);
0325   }
0326 
0327 
0328 
0329   return 0;
0330 }
0331 
0332 int ZdcMonDraw::Draw(const std::string &what)
0333 {
0334   int iret = 0;
0335   int idraw = 0;
0336   if (what == "ALL" || what == "FIRST")
0337   {
0338     iret += DrawFirst(what);
0339     idraw++;
0340   }
0341   if (what == "ALL" || what == "SECOND")
0342   {
0343     iret += DrawSecond(what);
0344     idraw++;
0345   }
0346 
0347   if (what == "ALL" || what == "SMDVALUES")
0348   {
0349     iret += DrawSmdValues(what);
0350     idraw++;
0351   }
0352 
0353   if (what == "ALL" || what == "SMDN&S")
0354   {
0355     iret += DrawSmdNorthandSouth(what);
0356     idraw++;
0357   }
0358 
0359   if (what == "ALL" || what == "SMD_N_IND")
0360   {
0361     iret += DrawSmdAdcNorthIndividual(what);
0362     idraw++;
0363   }
0364 
0365   if (what == "ALL" || what == "SMD_S_IND")
0366   {
0367     iret += DrawSmdAdcSouthIndividual(what);
0368     idraw++;
0369   }
0370 
0371   if (what == "ALL" || what == "VETO_COUNTER")
0372   {
0373     iret += Drawveto(what);
0374     idraw++;
0375   }
0376 
0377   if (what == "ALL" || what == "SMD_MULTIPLICITIES")
0378   {
0379      iret += DrawSmdMultiplicities(what);
0380      idraw++;
0381   }
0382     
0383   if (what == "ALL" || what == "ZDC_WAVEFORM")
0384   {
0385     iret += DrawWaveForm(what);
0386     idraw++;
0387   }
0388     
0389 
0390 
0391   if (!idraw)
0392   {
0393     std::cout << __PRETTY_FUNCTION__ << " Unimplemented Drawing option: " << what << std::endl;
0394     iret--;
0395     idraw++;
0396   }
0397   if (std::fabs(iret) != idraw) // at least one succeeded
0398   {
0399     return 0;
0400   }
0401   return iret;
0402 }
0403 
0404 int ZdcMonDraw::DrawFirst(const std::string & /* what */)
0405 {
0406   OnlMonClient *cl = OnlMonClient::instance();
0407   TH1 *zdc_adc_south = cl->getHisto("ZDCMON_0", "zdc_adc_south");
0408   TH1 *zdc_adc_north = cl->getHisto("ZDCMON_0", "zdc_adc_north");
0409   TH2 *smd_xy_north = (TH2 *) cl->getHisto("ZDCMON_0", "smd_xy_north");
0410   TH2 *smd_xy_south = (TH2 *) cl->getHisto("ZDCMON_0", "smd_xy_south");
0411 
0412   if (!gROOT->FindObject("ZdcMon1"))
0413   {
0414     MakeCanvas("ZdcMon1");
0415   }
0416   TC[0]->SetEditable(true);
0417   TC[0]->Clear("D");
0418   Pad[0]->cd();
0419   gPad->SetLogy();
0420   //  gPad->SetLogx();
0421   if (zdc_adc_south)
0422   {
0423     //zdc_adc_south->Scale(1 / zdc_adc_south->Integral(), "width");
0424     zdc_adc_south->SetXTitle("ZDC South ADC Distribution");
0425     zdc_adc_south->SetYTitle("Counts");
0426     zdc_adc_south->DrawCopy();
0427   }
0428   else
0429   {
0430     DrawDeadServer(transparent[0]);
0431     TC[0]->SetEditable(false);
0432     if (isHtml())
0433     {
0434       delete TC[0];
0435       TC[0] = nullptr;
0436     }
0437     return -1;
0438   }
0439   Pad[1]->cd();
0440   gPad->SetLogy();
0441   //  gPad->SetLogx();
0442   if (zdc_adc_north)
0443   {
0444     //zdc_adc_north->Scale(1 / zdc_adc_north->Integral(), "width");
0445     zdc_adc_north->SetXTitle("ZDC North ADC Distribution");
0446     zdc_adc_north->SetYTitle("Counts");
0447     zdc_adc_north->DrawCopy();
0448   }
0449 
0450   Pad[2]->cd();
0451   if (smd_xy_south)
0452   {
0453     smd_xy_south->SetXTitle("SMD south hit position in x [cm]");
0454     smd_xy_south->SetYTitle("SMD south hit position in y [cm]");
0455     smd_xy_south->DrawCopy("colz");
0456 
0457   }
0458   Pad[3]->cd();
0459   if (smd_xy_north)
0460   {
0461     smd_xy_north->SetXTitle("SMD north hit position in x [cm]");
0462     smd_xy_north->SetYTitle("SMD north hit position in y [cm]");
0463     smd_xy_north->DrawCopy("colz");
0464   }
0465 
0466   TText PrintRun;
0467   PrintRun.SetTextFont(62);
0468   PrintRun.SetTextSize(0.04);
0469   PrintRun.SetNDC();          // set to normalized coordinates
0470   PrintRun.SetTextAlign(23);  // center/top alignment
0471   std::ostringstream runnostream;
0472   std::string runstring;
0473   std::pair<time_t,int> evttime = cl->EventTime("CURRENT");
0474   // fill run number and event time into string
0475   runnostream << ThisName << "_1 Run " << cl->RunNumber()
0476               << ", Time: " << ctime(&evttime.first);
0477   runstring = runnostream.str();
0478   transparent[0]->cd();
0479   PrintRun.SetTextColor(evttime.second);
0480   PrintRun.DrawText(0.5, 1., runstring.c_str());
0481   TC[0]->Update();
0482   TC[0]->Show();
0483   TC[0]->SetEditable(false);
0484 
0485   return 0;
0486 }
0487 
0488 int ZdcMonDraw::DrawSecond(const std::string & /* what */)
0489 {
0490     
0491   int textsize = 22;
0492   TString zdclabels[6] = {"ZDCS1 ADC","ZDCS2 ADC","ZDCS3 ADC", "ZDCN1 ADC", "ZDCN2 ADC", "ZDCN3 ADC"};
0493   TLatex l[6];
0494 
0495   OnlMonClient *cl = OnlMonClient::instance();
0496   TH1 *zdc_S1 = cl->getHisto("ZDCMON_0", "zdc_S1");
0497   TH1 *zdc_S2 = cl->getHisto("ZDCMON_0", "zdc_S2");
0498   TH1 *zdc_S3 = cl->getHisto("ZDCMON_0", "zdc_S3");
0499   TH1 *zdc_N1 = cl->getHisto("ZDCMON_0", "zdc_N1");
0500   TH1 *zdc_N2 = cl->getHisto("ZDCMON_0", "zdc_N2");
0501   TH1 *zdc_N3 = cl->getHisto("ZDCMON_0", "zdc_N3");
0502 
0503   if (!gROOT->FindObject("ZdcMon2"))
0504   {
0505     MakeCanvas("ZdcMon2");
0506   }
0507 
0508     
0509   TC[1]->SetEditable(true);
0510   TC[1]->Clear("D");
0511   Pad[4]->cd();
0512   gPad->SetLogy();
0513   if (zdc_S1)
0514   {
0515       zdc_S1->SetStats(0);
0516       l[0].SetNDC();
0517       l[0].SetTextFont(43);
0518       l[0].SetTextSize(textsize);
0519       zdc_S1->SetXTitle("ZDC South First Module ADC Distribution");
0520       zdc_S1->SetYTitle("Counts");
0521       zdc_S1->DrawCopy();
0522       l[0].DrawLatex(0.15, 0.75, zdclabels[0]);
0523   }
0524   else
0525   {
0526     DrawDeadServer(transparent[1]);
0527     TC[1]->SetEditable(false);
0528     if (isHtml())
0529     {
0530       delete TC[1];
0531       TC[1] = nullptr;
0532     }
0533     return -1;
0534   }
0535 
0536   Pad[5]->cd();
0537   gPad->SetLogy();
0538   if (zdc_S2)
0539   {
0540       zdc_S2->SetStats(0);
0541       l[1].SetNDC();
0542       l[1].SetTextFont(43);
0543       l[1].SetTextSize(textsize);
0544       zdc_S2->SetXTitle("ZDC South Second Module ADC Distribution");
0545       zdc_S2->SetYTitle("Counts");
0546       zdc_S2->DrawCopy();
0547       l[1].DrawLatex(0.15, 0.75, zdclabels[1]);
0548   }
0549   Pad[6]->cd();
0550   gPad->SetLogy();
0551   if (zdc_S3)
0552   {
0553 
0554       zdc_S3->SetStats(0);
0555       l[2].SetNDC();
0556       l[2].SetTextFont(43);
0557       l[2].SetTextSize(textsize);
0558       zdc_S3->SetXTitle("ZDC South Third Module ADC Distribution");
0559       zdc_S3->SetYTitle("Counts");
0560       zdc_S3->DrawCopy();
0561       l[2].DrawLatex(0.15, 0.75, zdclabels[2]);
0562 
0563   }
0564 
0565   Pad[7]->cd();
0566   gPad->SetLogy();
0567   if (zdc_N1)
0568   {
0569      zdc_N1->SetStats(0);
0570      l[3].SetNDC();
0571      l[3].SetTextFont(43);
0572      l[3].SetTextSize(textsize);
0573      zdc_N1->SetXTitle("ZDC North First Module ADC Distribution");
0574      zdc_N1->SetYTitle("Counts");
0575      zdc_N1->DrawCopy();
0576      l[3].DrawLatex(0.15, 0.75, zdclabels[3]);
0577   }
0578 
0579   Pad[8]->cd();
0580   gPad->SetLogy();
0581   if (zdc_N2)
0582   {
0583      zdc_N2->SetStats(0);
0584      l[4].SetNDC();
0585      l[4].SetTextFont(43);
0586      l[4].SetTextSize(textsize);
0587      zdc_N2->SetXTitle("ZDC North Second Module ADC Distribution");
0588      zdc_N2->SetYTitle("Counts");
0589      zdc_N2->DrawCopy();
0590      l[4].DrawLatex(0.15, 0.75, zdclabels[4]);
0591   }
0592 
0593   Pad[9]->cd();
0594   gPad->SetLogy();
0595   if (zdc_N3)
0596   {
0597      zdc_N3->SetStats(0);
0598      l[5].SetNDC();
0599      l[5].SetTextFont(43);
0600      l[5].SetTextSize(textsize);
0601      zdc_N3->SetXTitle("ZDC North Third Module ADC Distribution");
0602      zdc_N3->SetYTitle("Counts");
0603      zdc_N3->DrawCopy();
0604      l[5].DrawLatex(0.15, 0.75, zdclabels[5]);
0605   }
0606 
0607   TText PrintRun;
0608   PrintRun.SetTextFont(62);
0609   PrintRun.SetTextSize(0.04);
0610   PrintRun.SetNDC();          // set to normalized coordinates
0611   PrintRun.SetTextAlign(23);  // center/top alignment
0612   std::ostringstream runnostream;
0613   std::string runstring;
0614   std::pair<time_t,int> evttime = cl->EventTime("CURRENT");
0615   // fill run number and event time into string
0616   runnostream << ThisName << "_2 Run " << cl->RunNumber()
0617               << ", Time: " << ctime(&evttime.first);
0618   runstring = runnostream.str();
0619   transparent[1]->cd();
0620   PrintRun.SetTextColor(evttime.second);
0621   PrintRun.DrawText(0.5, 1., runstring.c_str());
0622   TC[1]->Update();
0623   TC[1]->Show();
0624   TC[1]->SetEditable(false);
0625 
0626   return 0;
0627 }
0628 
0629 int ZdcMonDraw::DrawSmdValues(const std::string & /* what */)
0630 {
0631   OnlMonClient *cl = OnlMonClient::instance();
0632   TH2 *smd_value = (TH2 *) cl->getHisto("ZDCMON_0", "smd_value");
0633   TH2 *smd_value_good = (TH2 *) cl->getHisto("ZDCMON_0", "smd_value_good");
0634   TH2 *smd_value_small = (TH2 *) cl->getHisto("ZDCMON_0", "smd_value_small");
0635   if (!gROOT->FindObject("SmdValues"))
0636   {
0637     MakeCanvas("SmdValues");
0638   }
0639 
0640   TC[2]->SetEditable(true);
0641   TC[2]->Clear("D");
0642   Pad[10]->cd();
0643   if (smd_value)
0644   {
0645     smd_value->SetXTitle("ADC");
0646     smd_value->SetYTitle("Channels");
0647     smd_value->SetStats(0);
0648     smd_value->DrawCopy("col");
0649   
0650   }
0651   else
0652   {
0653     DrawDeadServer(transparent[2]);
0654     TC[2]->SetEditable(false);
0655     if (isHtml())
0656     {
0657       delete TC[2];
0658       TC[2] = nullptr;
0659     }
0660     return -1;
0661   }
0662 
0663   Pad[11]->cd();
0664   if (smd_value_good)
0665   {
0666     smd_value_good->SetXTitle("ADC");
0667     smd_value_good->SetYTitle("Channels");
0668     smd_value_good->SetStats(0);
0669     smd_value_good->DrawCopy("col");
0670   }
0671   Pad[12]->cd();
0672   if (smd_value_small)
0673   {
0674     smd_value_small->SetXTitle("ADC");
0675     smd_value_small->SetYTitle("Channels");
0676     smd_value_small->SetStats(0);
0677     smd_value_small->DrawCopy("col");
0678   }
0679 
0680   TText PrintRun;
0681   PrintRun.SetTextFont(62);
0682   PrintRun.SetTextSize(0.04);
0683   PrintRun.SetNDC();          // set to normalized coordinates
0684   PrintRun.SetTextAlign(23);  // center/top alignment
0685   std::ostringstream runnostream;
0686   std::string runstring;
0687   std::pair<time_t,int> evttime = cl->EventTime("CURRENT");
0688   // fill run number and event time into string
0689   runnostream << ThisName << "_3 Run " << cl->RunNumber()
0690               << ", Time: " << ctime(&evttime.first);
0691   runstring = runnostream.str();
0692   transparent[2]->cd();
0693   PrintRun.SetTextColor(evttime.second);
0694   PrintRun.DrawText(0.5, 1., runstring.c_str());
0695   TC[2]->Update();
0696   TC[2]->Show();
0697   TC[2]->SetEditable(false);
0698 
0699   return 0;
0700 }
0701 
0702 int ZdcMonDraw::DrawSmdNorthandSouth(const std::string & /* what */)
0703 {
0704   int textsize = 12;
0705   TLatex l[12];
0706   float _low = 0.68;
0707 
0708   OnlMonClient *cl = OnlMonClient::instance();
0709 
0710   // get pointer for each histogram
0711   TH1 *smd_hor_south = cl->getHisto("ZDCMON_0", "smd_hor_south");
0712   TH1 *smd_ver_south = cl->getHisto("ZDCMON_0", "smd_ver_south");
0713   TH1 *smd_hor_north = cl->getHisto("ZDCMON_0", "smd_hor_north");
0714   TH1 *smd_ver_north = cl->getHisto("ZDCMON_0", "smd_ver_north");
0715 
0716   TH1 *smd_hor_north_good = cl->getHisto("ZDCMON_0", "smd_hor_north_good");
0717   TH1 *smd_ver_north_good = cl->getHisto("ZDCMON_0", "smd_ver_north_good");
0718   TH1 *smd_hor_south_good = cl->getHisto("ZDCMON_0", "smd_hor_south_good");
0719   TH1 *smd_ver_south_good = cl->getHisto("ZDCMON_0", "smd_ver_south_good");
0720  
0721     
0722   TH1 *smd_sum_hor_south = cl->getHisto("ZDCMON_0", "smd_sum_hor_south");
0723   TH1 *smd_sum_ver_south = cl->getHisto("ZDCMON_0", "smd_sum_ver_south");
0724   TH1 *smd_sum_hor_north = cl->getHisto("ZDCMON_0", "smd_sum_hor_north");
0725   TH1 *smd_sum_ver_north = cl->getHisto("ZDCMON_0", "smd_sum_ver_north");
0726 
0727   if (!gROOT->FindObject("SmdNorthandSouth"))
0728   {
0729     MakeCanvas("SmdNorthandSouth");
0730   }
0731   TC[3]->SetEditable(true);
0732   TC[3]->Clear("D");
0733   Pad[13]->cd();
0734 
0735   if (smd_ver_north_good)
0736   {
0737     l[8].SetNDC();
0738     l[8].SetTextFont(43);
0739     l[8].SetTextSize(textsize);
0740     smd_ver_north_good->SetXTitle("SMD North ADC weighted hit position x [cm]");
0741     smd_ver_north_good->SetYTitle("Counts");
0742     smd_ver_north_good->DrawCopy();
0743     l[8].DrawLatex(0.15, 0.75, "SMDN position in x[cm]");
0744     l[8].DrawLatex(0.15, _low, "(ZDC1, ZDC2, Veto ADC cut)");
0745   }
0746   else
0747   {
0748     DrawDeadServer(transparent[3]);
0749     TC[3]->SetEditable(false);
0750     if (isHtml())
0751     {
0752       delete TC[3];
0753       TC[3] = nullptr;
0754     }
0755     return -1;
0756   }
0757   Pad[14]->cd();
0758   if (smd_hor_north_good)
0759   {
0760     l[9].SetNDC();
0761     l[9].SetTextFont(43);
0762     l[9].SetTextSize(textsize);
0763     smd_hor_north_good->SetXTitle("SMD North ADC weighted hit position y [cm]");
0764     smd_hor_north_good->SetYTitle("Counts");
0765     smd_hor_north_good->DrawCopy();
0766     l[9].DrawLatex(0.15, 0.75, "SMDN position in y[cm]");
0767     l[9].DrawLatex(0.15, _low, "(ZDC1, ZDC2, Veto ADC cut)");
0768 
0769   }
0770 
0771     Pad[15]->cd();
0772     if (smd_ver_south_good)
0773     {
0774       l[10].SetNDC();
0775       l[10].SetTextFont(43);
0776       l[10].SetTextSize(textsize);
0777       smd_ver_south_good->SetXTitle("SMD South ADC weighted hit position x [cm]");
0778       smd_ver_south_good->SetYTitle("Counts");
0779       smd_ver_south_good->DrawCopy();
0780       l[10].DrawLatex(0.15, 0.75, "SMDS position in x[cm]");
0781       l[10].DrawLatex(0.15, _low, "(ZDC1, ZDC2, Veto ADC cut)");
0782 
0783     }
0784     Pad[16]->cd();
0785     if (smd_hor_south_good)
0786     {
0787       l[11].SetNDC();
0788       l[11].SetTextFont(43);
0789       l[11].SetTextSize(textsize);
0790       smd_hor_south_good->SetXTitle("SMD South ADC weighted hit position y [cm]");
0791       smd_hor_south_good->SetYTitle("Counts");
0792       smd_hor_south_good->DrawCopy();
0793       l[11].DrawLatex(0.15, 0.75, "SMDS position in y[cm] ");
0794       l[11].DrawLatex(0.15, _low, "(ZDC1, ZDC2, Veto ADC cut)");
0795     }
0796 
0797   // VERTICAL AND HORIZONTAL NORTH
0798   Pad[17]->cd();
0799   if (smd_ver_north)
0800   {
0801      l[4].SetNDC();
0802      l[4].SetTextFont(43);
0803      l[4].SetTextSize(textsize);
0804      smd_ver_north->SetXTitle("SMD North ADC weighted hit position x [cm]");
0805      smd_ver_north->SetYTitle("Counts");
0806      smd_ver_north->DrawCopy();
0807      l[4].DrawLatex(0.15, 0.75, "SMDN position in x[cm]");
0808      l[4].DrawLatex(0.15, _low, "(no ZDC ADC selection)");
0809 
0810   }
0811   Pad[18]->cd();
0812   if (smd_hor_north)
0813   {
0814       l[5].SetNDC();
0815       l[5].SetTextFont(43);
0816       l[5].SetTextSize(textsize);
0817       smd_hor_north->SetXTitle("SMD North ADC weighted hit position y [cm]");
0818       smd_hor_north->SetYTitle("Counts");
0819       smd_hor_north->DrawCopy();
0820       l[5].DrawLatex(0.15, 0.75, "SMDN position in y[cm]");
0821       l[5].DrawLatex(0.15, _low, "(no ZDC ADC selection)");
0822 
0823   }
0824 
0825   // VERTICAL AND HORIZONTAL SOUTH (good and small do not exist for south)
0826   Pad[19]->cd();
0827   if (smd_ver_south)
0828   {
0829      l[6].SetNDC();
0830      l[6].SetTextFont(43);
0831      l[6].SetTextSize(textsize);
0832      smd_ver_south->SetXTitle("SMD South ADC weighted hit position x [cm]");
0833      smd_ver_south->SetYTitle("Counts");
0834      smd_ver_south->DrawCopy();
0835      l[6].DrawLatex(0.15, 0.75, "SMDS position in x[cm]");
0836      l[6].DrawLatex(0.15, _low, "(no ZDC ADC selection)");
0837   }
0838   Pad[20]->cd();
0839   if (smd_hor_south)
0840   {
0841       l[7].SetNDC();
0842       l[7].SetTextFont(43);
0843       l[7].SetTextSize(textsize);
0844       smd_hor_south->SetXTitle("SMD South ADC weighted hit position y [cm]");
0845       smd_hor_south->SetYTitle("Counts");
0846       smd_hor_south->DrawCopy();
0847       l[7].DrawLatex(0.15, 0.75, "SMDS position in y[cm]");
0848       l[7].DrawLatex(0.15, _low, "(no ZDC ADC selection)");
0849 
0850 
0851   }
0852 
0853   // SUMS
0854   Pad[21]->cd();
0855   if (smd_sum_ver_north)
0856   {
0857      l[0].SetNDC();
0858      l[0].SetTextFont(43);
0859      l[0].SetTextSize(textsize);
0860      smd_sum_ver_north->GetXaxis()->SetRangeUser(0,800);
0861      smd_sum_ver_north->SetXTitle("SMD x-sum North ADC distribution");
0862      smd_sum_ver_north->SetYTitle("Counts");
0863      smd_sum_ver_north->DrawCopy();
0864      l[0].DrawLatex(0.15, 0.75, "SMD North ADC x-sum");
0865   }
0866   Pad[22]->cd();
0867   if (smd_sum_hor_north)
0868   {
0869      l[1].SetNDC();
0870      l[1].SetTextFont(43);
0871      l[1].SetTextSize(textsize);
0872      smd_sum_hor_north->GetXaxis()->SetRangeUser(0,800);
0873      smd_sum_hor_north->SetXTitle("SMD y-sum North ADC distribution");
0874      smd_sum_hor_north->SetYTitle("Counts");
0875      smd_sum_hor_north->DrawCopy();
0876      l[1].DrawLatex(0.15, 0.75, "SMD North ADC y-sum");
0877   }
0878   Pad[23]->cd();
0879   if (smd_sum_ver_south)
0880   {
0881      l[2].SetNDC();
0882      l[2].SetTextFont(43);
0883      l[2].SetTextSize(textsize);
0884      smd_sum_ver_south->GetXaxis()->SetRangeUser(0,800);
0885      smd_sum_ver_south->SetXTitle("SMD x-sum South ADC distribution");
0886      smd_sum_ver_south->SetYTitle("Counts");
0887      smd_sum_ver_south->DrawCopy();
0888      l[2].DrawLatex(0.15, 0.75, "SMD South ADC x-sum");
0889  }
0890   Pad[24]->cd();
0891   if (smd_sum_hor_south)
0892   {
0893       l[3].SetNDC();
0894       l[3].SetTextFont(43);
0895       l[3].SetTextSize(textsize);
0896       smd_sum_hor_south->GetXaxis()->SetRangeUser(0,800);
0897       smd_sum_hor_south->SetXTitle("SMD y-sum South ADC distribution");
0898       smd_sum_hor_south->SetYTitle("Counts");
0899       smd_sum_hor_south->DrawCopy();
0900       l[3].DrawLatex(0.15, 0.75, "SMD South ADC y-sum");
0901  }
0902 
0903   TText PrintRun;
0904   PrintRun.SetTextFont(62);
0905   PrintRun.SetTextSize(0.04);
0906   PrintRun.SetNDC();          // set to normalized coordinates
0907   PrintRun.SetTextAlign(23);  // center/top alignment
0908   std::ostringstream runnostream;
0909   std::string runstring;
0910   std::pair<time_t,int> evttime = cl->EventTime("CURRENT");
0911   // fill run number and event time into string
0912   runnostream << ThisName << "_4 Run " << cl->RunNumber()
0913               << ", Time: " << ctime(&evttime.first);
0914   runstring = runnostream.str();
0915   transparent[3]->cd();
0916   PrintRun.SetTextColor(evttime.second);
0917   PrintRun.DrawText(0.5, 1., runstring.c_str());
0918   TC[3]->Update();
0919   TC[3]->Show();
0920   TC[3]->SetEditable(false);
0921   return 0;
0922 }
0923 
0924 int ZdcMonDraw::DrawSmdAdcNorthIndividual(const std::string & /* what */)
0925 {
0926     
0927     TString smdnorthlabel[15] = {"SMDNH1 ADC","SMDNH2 ADC","SMDNH3 ADC","SMDNH4 ADC","SMDNH5 ADC","SMDNH6 ADC","SMDNH7 ADC", "SMDNH8 ADC","SMDNV1 ADC","SMDNV2 ADC","SMDNV3 ADC","SMDNV4 ADC","SMDNV5 ADC","SMDNV6 ADC", "SMDNV7 ADC"};
0928     TLatex l[15];
0929     
0930     int textsize = 18;
0931     TString meantrunc[15];
0932 
0933     
0934   OnlMonClient *cl = OnlMonClient::instance();
0935 
0936   // Array that holds pointer to the histogram of each channel
0937   TH1 *smd_adc_n_hor_ind[8];
0938   TH1 *smd_adc_n_ver_ind[7];
0939   // Horizontal
0940   for (int i = 0; i < 8; ++i)
0941   {
0942     smd_adc_n_hor_ind[i] = (TH1 *) cl->getHisto("ZDCMON_0", Form("smd_adc_n_hor_ind%d", i));  // Retrieve histogram pointer using 'histName'
0943   }
0944   // Vertical
0945   for (int i = 0; i < 7; ++i)
0946   {
0947     smd_adc_n_ver_ind[i] = (TH1 *) cl->getHisto("ZDCMON_0", Form("smd_adc_n_ver_ind%d", i));  // Retrieve histogram pointer using 'histName'
0948   }
0949 
0950 
0951   if (!gROOT->FindObject("SmdAdcNorthIndividual"))
0952   {
0953     MakeCanvas("SmdAdcNorthIndividual");
0954   }
0955 
0956   TC[4]->SetEditable(true);
0957   TC[4]->Clear("D");
0958   Pad[21]->cd();
0959   gPad->SetLogy(1);
0960 
0961   if (smd_adc_n_hor_ind[0])
0962   {
0963       float m = smd_adc_n_hor_ind[0]->GetMean();
0964       meantrunc[0].Append(Form("%.2f", m));
0965       smd_adc_n_hor_ind[0]->SetStats(0);
0966       l[0].SetNDC();
0967       l[0].SetTextFont(43);
0968       l[0].SetTextSize(textsize);
0969       smd_adc_n_hor_ind[0]->SetYTitle("Counts");
0970       smd_adc_n_hor_ind[0]->SetXTitle("ADC");
0971       smd_adc_n_hor_ind[0]->DrawCopy();
0972       l[0].DrawLatex(0.15, 0.75, smdnorthlabel[0]);
0973       l[0].DrawLatex(0.15, 0.65, "mean = " + meantrunc[0]);
0974   }
0975   else
0976   {
0977     DrawDeadServer(transparent[4]);
0978     TC[4]->SetEditable(false);
0979     if (isHtml())
0980     {
0981       delete TC[4];
0982       TC[4] = nullptr;
0983     }
0984     return -1;
0985   }
0986     
0987 
0988   for (int i = 1; i < 8; ++i)
0989   {
0990     Pad[21 + i]->cd();
0991     gPad->SetLogy(1);
0992     if (smd_adc_n_hor_ind[i])
0993     {
0994         float m = smd_adc_n_hor_ind[i]->GetMean();
0995         meantrunc[i].Append(Form("%.2f", m));
0996         smd_adc_n_hor_ind[i]->SetStats(0);
0997         l[i].SetNDC();
0998         l[i].SetTextFont(43);
0999         l[i].SetTextSize(textsize);
1000         smd_adc_n_hor_ind[i]->SetYTitle("Counts");
1001         smd_adc_n_hor_ind[i]->SetXTitle("ADC");
1002         smd_adc_n_hor_ind[i]->DrawCopy();
1003         l[i].DrawLatex(0.15, 0.75, smdnorthlabel[i]);
1004         l[i].DrawLatex(0.15, 0.65, "mean = " + meantrunc[i]);
1005 
1006     }
1007   }
1008 
1009 
1010   for (int i = 0; i < 7; ++i)
1011   {
1012     Pad[29 + i]->cd();
1013     gPad->SetLogy(1);
1014     if (smd_adc_n_ver_ind[i])
1015     {
1016         float m = smd_adc_n_ver_ind[i]->GetMean();
1017         meantrunc[i+8].Append(Form("%.2f", m));
1018         smd_adc_n_ver_ind[i]->SetStats(0);
1019         l[i+8].SetNDC();
1020         l[i+8].SetTextFont(43);
1021         l[i+8].SetTextSize(textsize);
1022         smd_adc_n_ver_ind[i]->SetYTitle("Counts");
1023         smd_adc_n_ver_ind[i]->SetXTitle("ADC");
1024         smd_adc_n_ver_ind[i]->DrawCopy();
1025         l[i+8].DrawLatex(0.15, 0.75, smdnorthlabel[i+8]);
1026         l[i].DrawLatex(0.15, 0.65, "mean = " + meantrunc[i+8]);
1027     }
1028   }
1029 
1030   TText PrintRun;
1031   PrintRun.SetTextFont(62);
1032   PrintRun.SetTextSize(0.04);
1033   PrintRun.SetNDC();          // set to normalized coordinates
1034   PrintRun.SetTextAlign(23);  // center/top alignment
1035   std::ostringstream runnostream;
1036   std::string runstring;
1037   std::pair<time_t,int> evttime = cl->EventTime("CURRENT");
1038   // fill run number and event time into string
1039   runnostream << ThisName << "_5 Run " << cl->RunNumber()
1040               << ", Time: " << ctime(&evttime.first);
1041   runstring = runnostream.str();
1042   transparent[4]->cd();
1043   PrintRun.SetTextColor(evttime.second);
1044   PrintRun.DrawText(0.5, 1., runstring.c_str());
1045   TC[4]->Update();
1046   TC[4]->Show();
1047   TC[4]->SetEditable(false);
1048   return 0;
1049 }
1050 
1051 int ZdcMonDraw::DrawSmdAdcSouthIndividual(const std::string & /* what */)
1052 {
1053     
1054   TString smdsouthlabel[15] = {"SMDSH1 ADC","SMDSH2 ADC","SMDSH3 ADC","SMDSH4 ADC","SMDSH5 ADC","SMDSH6 ADC","SMDSH7 ADC", "SMDSH8 ADC","SMDSV1 ADC","SMDSV2 ADC","SMDSV3 ADC","SMDSV4 ADC","SMDSV5 ADC","SMDSV6 ADC", "SMDSV7 ADC"};
1055   TLatex l[15];
1056     
1057   int textsize = 18;
1058   TString meantrunc[15];
1059     
1060   OnlMonClient *cl = OnlMonClient::instance();
1061 
1062   TH1 *smd_adc_s_hor_ind[8];
1063   TH1 *smd_adc_s_ver_ind[7];
1064   // Horizontal
1065   for (int i = 0; i < 8; ++i)
1066   {
1067     smd_adc_s_hor_ind[i] = (TH1 *) cl->getHisto("ZDCMON_0", Form("smd_adc_s_hor_ind%d", i));
1068   }
1069   // Vertical
1070   for (int i = 0; i < 7; ++i)
1071   {
1072     smd_adc_s_ver_ind[i] = (TH1 *) cl->getHisto("ZDCMON_0", Form("smd_adc_s_ver_ind%d", i));
1073   }
1074 
1075   if (!gROOT->FindObject("SmdAdcSouthIndividual"))
1076   {
1077     MakeCanvas("SmdAdcSouthIndividual");
1078   }
1079 
1080   TC[5]->SetEditable(true);
1081   TC[5]->Clear("D");
1082   Pad[36]->cd();
1083   gPad->SetLogy(1);
1084   if (smd_adc_s_hor_ind[0])
1085   {
1086       float m = smd_adc_s_hor_ind[0]->GetMean();
1087       meantrunc[0].Append(Form("%.2f", m));
1088       smd_adc_s_hor_ind[0]->SetStats(0);
1089       l[0].SetNDC();
1090       l[0].SetTextFont(43);
1091       l[0].SetTextSize(textsize);
1092       smd_adc_s_hor_ind[0]->SetYTitle("Counts");
1093       smd_adc_s_hor_ind[0]->SetXTitle("ADC");
1094       smd_adc_s_hor_ind[0]->DrawCopy();
1095       l[0].DrawLatex(0.15, 0.75, smdsouthlabel[0]);
1096       l[0].DrawLatex(0.15, 0.65, "mean = " + meantrunc[0]);
1097   }
1098   else
1099   {
1100     DrawDeadServer(transparent[5]);
1101     TC[5]->SetEditable(false);
1102     if (isHtml())
1103     {
1104       delete TC[5];
1105       TC[5] = nullptr;
1106     }
1107     return -1;
1108   }
1109 
1110   for (int i = 1; i < 8; ++i)
1111   {
1112     Pad[36 + i]->cd();
1113     gPad->SetLogy(1);
1114     if (smd_adc_s_hor_ind[i])
1115     {
1116         float m = smd_adc_s_hor_ind[i]->GetMean();
1117         meantrunc[i].Append(Form("%.2f", m));
1118         smd_adc_s_hor_ind[i]->SetStats(0);
1119         l[i].SetNDC();
1120         l[i].SetTextFont(43);
1121         l[i].SetTextSize(textsize);
1122         smd_adc_s_hor_ind[i]->SetYTitle("Counts");
1123         smd_adc_s_hor_ind[i]->SetXTitle("ADC");
1124         smd_adc_s_hor_ind[i]->DrawCopy();
1125         l[i].DrawLatex(0.15, 0.75, smdsouthlabel[i]);
1126         l[i].DrawLatex(0.15, 0.65, "mean = " + meantrunc[i]);
1127     }
1128   }
1129 
1130   for (int i = 0; i < 7; ++i)
1131   {
1132     Pad[44 + i]->cd();
1133     gPad->SetLogy(1);
1134     if (smd_adc_s_ver_ind[i])
1135     {
1136         float m = smd_adc_s_ver_ind[i]->GetMean();
1137         meantrunc[i+8].Append(Form("%.2f", m));
1138         smd_adc_s_ver_ind[i]->SetStats(0);
1139         l[i+8].SetNDC();
1140         l[i+8].SetTextFont(43);
1141         l[i+8].SetTextSize(textsize);
1142         smd_adc_s_ver_ind[i]->SetYTitle("Counts");
1143         smd_adc_s_ver_ind[i]->SetXTitle("ADC");
1144         smd_adc_s_ver_ind[i]->DrawCopy();
1145         l[i+8].DrawLatex(0.15, 0.75, smdsouthlabel[i+8]);
1146         l[i].DrawLatex(0.15, 0.65, "mean = " + meantrunc[i+8]);
1147 
1148     }
1149   }
1150 
1151   TText PrintRun;
1152   PrintRun.SetTextFont(62);
1153   PrintRun.SetTextSize(0.04);
1154   PrintRun.SetNDC();          // set to normalized coordinates
1155   PrintRun.SetTextAlign(23);  // center/top alignment
1156   std::ostringstream runnostream;
1157   std::string runstring;
1158   std::pair<time_t,int> evttime = cl->EventTime("CURRENT");
1159   // fill run number and event time into string
1160   runnostream << ThisName << "_6 Run " << cl->RunNumber()
1161               << ", Time: " << ctime(&evttime.first);
1162   runstring = runnostream.str();
1163   transparent[5]->cd();
1164   PrintRun.SetTextColor(evttime.second);
1165   PrintRun.DrawText(0.5, 1., runstring.c_str());
1166   TC[5]->Update();
1167   TC[5]->Show();
1168   TC[5]->SetEditable(false);
1169   return 0;
1170 }
1171 
1172 int ZdcMonDraw::Drawveto(const std::string & /* what */)
1173 {
1174     
1175   TString vnmame[4] = {"Veto North Front", "Veto North Back","Veto South Front","Veto South Back"};
1176   TLatex l[4];
1177   int textsize = 15;
1178     
1179   OnlMonClient *cl = OnlMonClient::instance();
1180 
1181   TH1 *veto_NF = (TH1 *) cl->getHisto("ZDCMON_0", "veto_NF");
1182   TH1 *veto_NB = (TH1 *) cl->getHisto("ZDCMON_0", "veto_NB");
1183   TH1 *veto_SF = (TH1 *) cl->getHisto("ZDCMON_0", "veto_SF");
1184   TH1 *veto_SB = (TH1 *) cl->getHisto("ZDCMON_0", "veto_SB");
1185 
1186 
1187   if (!gROOT->FindObject("veto"))
1188   {
1189     MakeCanvas("veto");
1190   }
1191 
1192 
1193   TC[6]->SetEditable(true);
1194   TC[6]->Clear("D");
1195   Pad[51]->cd();
1196   gPad->SetLogy();
1197   if (veto_NF)
1198   {
1199       l[0].SetNDC();
1200       l[0].SetTextFont(43);
1201       l[0].SetTextSize(textsize);
1202        veto_NF->DrawCopy();
1203        l[0].DrawLatex(0.15, 0.75, vnmame[0]);
1204 
1205   }
1206   else
1207   {
1208     DrawDeadServer(transparent[6]);
1209     TC[6]->SetEditable(false);
1210     if (isHtml())
1211     {
1212       delete TC[6];
1213       TC[6] = nullptr;
1214     }
1215     return -1;
1216   }
1217 
1218 
1219   Pad[52]->cd();
1220   gPad->SetLogy();
1221   if (veto_NB)
1222   {
1223     l[1].SetNDC();
1224     l[1].SetTextFont(43);
1225     l[1].SetTextSize(textsize);
1226      veto_NB->DrawCopy();
1227    l[1].DrawLatex(0.15, 0.75, vnmame[1]);
1228 
1229   }
1230   Pad[53]->cd();
1231   gPad->SetLogy();
1232   if (veto_SF)
1233   {
1234     l[2].SetNDC();
1235     l[2].SetTextFont(43);
1236     l[2].SetTextSize(textsize);
1237     veto_SF->DrawCopy();
1238     l[2].DrawLatex(0.15, 0.75, vnmame[2]);
1239 
1240   }
1241   Pad[54]->cd();
1242   gPad->SetLogy();
1243   if (veto_SB)
1244   {
1245     l[3].SetNDC();
1246     l[3].SetTextFont(43);
1247     l[3].SetTextSize(textsize);
1248     veto_SB->DrawCopy();
1249     l[3].DrawLatex(0.15, 0.75, vnmame[3]);
1250 
1251   }
1252 
1253   TText PrintRun;
1254   PrintRun.SetTextFont(62);
1255   PrintRun.SetTextSize(0.04);
1256   PrintRun.SetNDC();          // set to normalized coordinates
1257   PrintRun.SetTextAlign(23);  // center/top alignment
1258   std::ostringstream runnostream;
1259   std::string runstring;
1260   std::pair<time_t,int> evttime = cl->EventTime("CURRENT");
1261   // fill run number and event time into string
1262   runnostream << ThisName << "_7 Run " << cl->RunNumber()
1263               << ", Time: " << ctime(&evttime.first);
1264   runstring = runnostream.str();
1265   transparent[6]->cd();
1266   PrintRun.SetTextColor(evttime.second);
1267   PrintRun.DrawText(0.5, 1., runstring.c_str());
1268   TC[6]->Update();
1269   TC[6]->Show();
1270   TC[6]->SetEditable(false);
1271 
1272   return 0;
1273 }
1274 
1275 int ZdcMonDraw::DrawSmdMultiplicities(const std::string & /* what */)
1276 {
1277     
1278  TString Mult[4] = {"SMD North y mult", "SMD North x mult","SMD South y mult","SMD South x mult"};
1279  TLatex l[4];
1280   int textsize = 15;
1281     
1282   OnlMonClient *cl = OnlMonClient::instance();
1283   TH1 *smd_north_hor_hits = (TH1 *) cl->getHisto("ZDCMON_0", "smd_north_hor_hits");
1284   TH1 *smd_north_ver_hits = (TH1 *) cl->getHisto("ZDCMON_0", "smd_north_ver_hits");
1285   TH1 *smd_south_hor_hits = (TH1 *) cl->getHisto("ZDCMON_0", "smd_south_hor_hits");
1286   TH1 *smd_south_ver_hits = (TH1 *) cl->getHisto("ZDCMON_0", "smd_south_ver_hits");
1287 
1288   if (!gROOT->FindObject("SmdMultiplicities"))
1289   {
1290     MakeCanvas("SmdMultiplicities");
1291   }
1292         
1293     TC[7]->SetEditable(true);
1294     TC[7]->Clear("D");
1295     Pad[55]->cd();
1296     if (smd_north_hor_hits)
1297     {
1298         l[0].SetNDC();
1299         l[0].SetTextFont(43);
1300         l[0].SetTextSize(textsize);
1301         smd_north_hor_hits->SetStats(0);
1302         smd_north_hor_hits->SetXTitle("SMD North Horizontal Multiplicities");
1303         smd_north_hor_hits->SetYTitle("Counts");
1304         smd_north_hor_hits->DrawCopy();
1305         l[0].DrawLatex(0.15, 0.75, Mult[0]);
1306 
1307     }
1308     else
1309     {
1310       DrawDeadServer(transparent[7]);
1311       TC[7]->SetEditable(false);
1312       if (isHtml())
1313       {
1314         delete TC[8];
1315         TC[8] = nullptr;
1316       }
1317       return -1;
1318     }
1319 
1320     Pad[56]->cd();
1321     gPad->SetLogy();
1322     if (smd_north_ver_hits)
1323     {
1324       l[1].SetNDC();
1325       l[1].SetTextFont(43);
1326       l[1].SetTextSize(textsize);
1327       smd_north_ver_hits->SetStats(0);
1328       smd_north_ver_hits->SetXTitle("SMD North Vertical Multiplicities");
1329       smd_north_ver_hits->SetYTitle("Counts");
1330       smd_north_ver_hits->DrawCopy();
1331       l[1].DrawLatex(0.15, 0.75, Mult[1]);
1332     }
1333     
1334     Pad[57]->cd();
1335     gPad->SetLogy();
1336     if (smd_south_hor_hits)
1337     {
1338       l[2].SetNDC();
1339       l[2].SetTextFont(43);
1340       l[2].SetTextSize(textsize);
1341       smd_south_hor_hits->SetStats(0);
1342       smd_south_hor_hits->SetXTitle("SMD South Horizontal Multiplicities");
1343       smd_south_hor_hits->SetYTitle("Counts");
1344       smd_south_hor_hits->DrawCopy();
1345       l[2].DrawLatex(0.15, 0.75, Mult[2]);
1346     }
1347     
1348     Pad[58]->cd();
1349     gPad->SetLogy();
1350     if (smd_south_ver_hits)
1351     {
1352       l[3].SetNDC();
1353       l[3].SetTextFont(43);
1354       l[3].SetTextSize(textsize);
1355       smd_south_ver_hits->SetStats(0);
1356       smd_south_ver_hits->SetXTitle("SMD South Vertical Multiplicities");
1357       smd_south_ver_hits->SetYTitle("Counts");
1358       smd_south_ver_hits->DrawCopy();
1359       l[3].DrawLatex(0.15, 0.75, Mult[3]);
1360 
1361     }
1362 
1363 
1364   TText PrintRun;
1365   PrintRun.SetTextFont(62);
1366   PrintRun.SetTextSize(0.04);
1367   PrintRun.SetNDC();          // set to normalized coordinates
1368   PrintRun.SetTextAlign(23);  // center/top alignment
1369   std::ostringstream runnostream;
1370   std::string runstring;
1371   std::pair<time_t,int> evttime = cl->EventTime("CURRENT");
1372   // fill run number and event time into string
1373   runnostream << ThisName << "_7 Run " << cl->RunNumber()
1374               << ", Time: " << ctime(&evttime.first);
1375   runstring = runnostream.str();
1376   transparent[7]->cd();
1377   PrintRun.SetTextColor(evttime.second);
1378   PrintRun.DrawText(0.5, 1., runstring.c_str());
1379   TC[7]->Update();
1380   TC[7]->Show();
1381   TC[7]->SetEditable(false);
1382 
1383   return 0;
1384 }
1385 
1386 
1387 int ZdcMonDraw::DrawWaveForm(const std::string & /* what */)
1388 {
1389 
1390   float offset = 1.7;
1391   float lf = 0.16;
1392   float  maxwf = 20000.;
1393 
1394  OnlMonClient *cl = OnlMonClient::instance();
1395 
1396  TH2 *h_waveformZDC = (TH2F *) cl->getHisto("ZDCMON_0", "h_waveformZDC");
1397  TH1F* h_waveform_timez = (TH1F*) cl->getHisto("ZDCMON_0", "h_waveform_timez");
1398  TH2 *h_waveformSMD_North = (TH2F *) cl->getHisto("ZDCMON_0", "h_waveformSMD_North");
1399  TH1F* h_waveform_timesn = (TH1F*) cl->getHisto("ZDCMON_0", "h_waveform_timesn");
1400  TH2 *h_waveformSMD_South = (TH2F *) cl->getHisto("ZDCMON_0", "h_waveformSMD_South");
1401  TH2 *h_waveformVeto_North = (TH2F *) cl->getHisto("ZDCMON_0", "h_waveformVeto_North");
1402  TH2 *h_waveformVeto_South = (TH2F *) cl->getHisto("ZDCMON_0", "h_waveformVeto_South");
1403  TH1F* h_waveform_timess = (TH1F*) cl->getHisto("ZDCMON_0", "h_waveform_timess");
1404  TH1F* h_waveform_timevs = (TH1F*) cl->getHisto("ZDCMON_0", "h_waveform_timevs");
1405  TH1F* h_waveform_timevn = (TH1F*) cl->getHisto("ZDCMON_0", "h_waveform_timevn");
1406 
1407   if (!gROOT->FindObject("waveform"))
1408   {
1409     MakeCanvas("waveform");
1410   }
1411   TC[8]->SetEditable(true);
1412   TC[8]->Clear("D");
1413   if (!h_waveformZDC)
1414   {
1415     DrawDeadServer(transparent[8]);
1416     TC[8]->SetEditable(false);
1417     if (isHtml())
1418     {
1419       delete TC[8];
1420       TC[8] = nullptr;
1421     }
1422     return -1;
1423   }
1424     
1425   TLine *t1 = new TLine(5,0.0,5,maxwf);
1426   t1->SetLineWidth(3);
1427   t1->SetLineStyle(1);
1428   t1->SetLineColor(kRed);
1429     
1430   TLine *t2 = new TLine(9,0.0,9,maxwf);
1431   t2->SetLineWidth(3);
1432   t2->SetLineStyle(1);
1433   t2->SetLineColor(kRed);
1434     
1435   Pad[59]->cd();
1436   gPad->SetLogz();
1437   gPad->SetRightMargin(0.15);
1438   gPad->SetLeftMargin(lf);
1439 
1440   gStyle->SetTitleFontSize(0.08);
1441   h_waveformZDC->GetYaxis()->SetRangeUser(0, h_waveformZDC->GetMaximum() * 1.05);
1442   h_waveformZDC->Draw("colz");
1443 
1444   float tsize = 0.05;
1445   h_waveformZDC->SetStats(0);
1446   h_waveformZDC->GetXaxis()->SetNdivisions(510, kTRUE);
1447   h_waveformZDC->GetXaxis()->SetRangeUser(0, 16);
1448   h_waveformZDC->SetTitle("ZDC");
1449   h_waveformZDC->SetYTitle("Waveform [ADC]");
1450   h_waveformZDC->SetXTitle("Sample Number");
1451   h_waveformZDC->GetXaxis()->SetLabelSize(tsize);
1452   h_waveformZDC->GetYaxis()->SetLabelSize(tsize);
1453   h_waveformZDC->GetXaxis()->SetTitleSize(tsize);
1454   h_waveformZDC->GetYaxis()->SetTitleSize(tsize);
1455   h_waveformZDC->GetYaxis()->SetTitleOffset(offset);
1456   t1->Draw("same");
1457   t2->Draw("same");
1458     
1459   Pad[64]->cd();
1460   gPad->SetLeftMargin(lf);
1461 
1462   gStyle->SetTitleFontSize(0.06);
1463   h_waveform_timez->Draw("hist");
1464   h_waveform_timez->SetTitle("");
1465   h_waveform_timez->SetStats(0);
1466   h_waveform_timez->GetXaxis()->SetNdivisions(510, kTRUE);
1467   h_waveform_timez->GetXaxis()->SetRangeUser(0, 16);
1468   h_waveform_timez->SetTitle("ZDC");
1469   h_waveform_timez->GetYaxis()->SetTitle("Fraction of Towers");
1470   h_waveform_timez->GetXaxis()->SetTitle("Sample Number");
1471   h_waveform_timez->GetXaxis()->SetLabelSize(tsize);
1472   h_waveform_timez->GetYaxis()->SetLabelSize(tsize);
1473   h_waveform_timez->GetXaxis()->SetTitleSize(tsize);
1474   h_waveform_timez->GetYaxis()->SetTitleSize(tsize);
1475   h_waveform_timez->GetYaxis()->SetTitleOffset(offset);
1476 
1477   h_waveform_timez->SetFillColorAlpha(kBlue, 0.1);
1478   if(h_waveform_timez->GetEntries()){
1479      h_waveform_timez->Scale(1. / h_waveform_timez->GetEntries());
1480    }
1481        
1482   TLine *t11 = new TLine(5,0.0,5,h_waveform_timez->GetMaximum() * 1.05);
1483   t11->SetLineWidth(3);
1484   t11->SetLineStyle(1);
1485   t11->SetLineColor(kRed);
1486            
1487   TLine *t22 = new TLine(9,0.0,9,h_waveform_timez->GetMaximum() * 1.05);
1488   t22->SetLineWidth(3);
1489   t22->SetLineStyle(1);
1490   t22->SetLineColor(kRed);
1491   t11->Draw("same");
1492   t22->Draw("same");
1493     
1494 
1495     TLine *t3 = new TLine(9,0.0,9,  maxwf);
1496     t3->SetLineWidth(3);
1497     t3->SetLineStyle(1);
1498     t3->SetLineColor(kRed);
1499       
1500     TLine *t4 = new TLine(14,0.0,14, maxwf);
1501     t4->SetLineWidth(3);
1502     t4->SetLineStyle(1);
1503     t4->SetLineColor(kRed);
1504       
1505     Pad[60]->cd();
1506     gPad->SetLogz();
1507     gPad->SetRightMargin(0.15);
1508     gPad->SetLeftMargin(lf);
1509 
1510     gStyle->SetTitleFontSize(0.08);
1511     h_waveformSMD_North->GetYaxis()->SetRangeUser(0, h_waveformSMD_North->GetMaximum() * 1.05);
1512     h_waveformSMD_North->Draw("colz");
1513 
1514     h_waveformSMD_North->SetStats(0);
1515     h_waveformSMD_North->GetXaxis()->SetNdivisions(510, kTRUE);
1516     h_waveformSMD_North->GetXaxis()->SetRangeUser(0, 16);
1517     h_waveformSMD_North->SetTitle("SMD NORTH");
1518     h_waveformSMD_North->SetXTitle("Sample Number");
1519     h_waveformSMD_North->SetYTitle("Waveform [ADC]");
1520     h_waveformSMD_North->GetXaxis()->SetLabelSize(tsize);
1521     h_waveformSMD_North->GetYaxis()->SetLabelSize(tsize);
1522     h_waveformSMD_North->GetXaxis()->SetTitleSize(tsize);
1523     h_waveformSMD_North->GetYaxis()->SetTitleSize(tsize);
1524     h_waveformSMD_North->GetYaxis()->SetTitleOffset(offset);
1525 
1526     t3->Draw("same");
1527     t4->Draw("same");
1528       
1529     Pad[65]->cd();
1530     gPad->SetLeftMargin(lf);
1531 
1532     gStyle->SetTitleFontSize(0.06);
1533     h_waveform_timesn->Draw("hist");
1534     h_waveform_timesn->SetTitle("");
1535     // h_waveform_timesn->GetXaxis()->CenterTitle();
1536     h_waveform_timesn->SetStats(0);
1537     h_waveform_timesn->GetXaxis()->SetNdivisions(510, kTRUE);
1538     h_waveform_timesn->GetXaxis()->SetRangeUser(0, 16);
1539     h_waveform_timesn->SetTitle("SMD NORTH");
1540     h_waveform_timesn->GetXaxis()->SetTitle("Sample Number");
1541     h_waveform_timesn->GetYaxis()->SetTitle("Fraction of towers");
1542     h_waveform_timesn->GetXaxis()->SetLabelSize(tsize);
1543     h_waveform_timesn->GetYaxis()->SetLabelSize(tsize);
1544     h_waveform_timesn->GetXaxis()->SetTitleSize(tsize);
1545     h_waveform_timesn->GetYaxis()->SetTitleSize(tsize);
1546     h_waveform_timesn->GetYaxis()->SetTitleOffset(offset);
1547 
1548 
1549     h_waveform_timesn->SetFillColorAlpha(kBlue, 0.1);
1550     if(h_waveform_timesn->GetEntries()){
1551         h_waveform_timesn->Scale(1. / h_waveform_timesn->GetEntries());
1552      }
1553     
1554     TLine *t33 = new TLine(9,0.0,9, h_waveform_timesn->GetMaximum() * 1.05);
1555     t33->SetLineWidth(3);
1556     t33->SetLineStyle(1);
1557     t33->SetLineColor(kRed);
1558         
1559     TLine *t44 = new TLine(14,0.0,14,h_waveform_timesn->GetMaximum() * 1.05);
1560     t44->SetLineWidth(3);
1561     t44->SetLineStyle(1);
1562     t44->SetLineColor(kRed);
1563     
1564     t33->Draw("same");
1565     t44->Draw("same");   
1566    
1567     
1568   TLine *t5 = new TLine(6,0.0,6, maxwf);
1569   t5->SetLineWidth(3);
1570   t5->SetLineStyle(1);
1571   t5->SetLineColor(kRed);
1572     
1573   TLine *t6 = new TLine(12,0.0,12, maxwf);
1574   t6->SetLineWidth(3);
1575   t6->SetLineStyle(1);
1576   t6->SetLineColor(kRed);
1577       
1578     Pad[61]->cd();
1579     gPad->SetLogz();
1580     gPad->SetRightMargin(0.15);
1581     gPad->SetLeftMargin(lf);
1582 
1583     gStyle->SetTitleFontSize(0.08);
1584     h_waveformSMD_South->GetYaxis()->SetRangeUser(0, h_waveformSMD_South->GetMaximum() * 1.05);
1585     h_waveformSMD_South->Draw("colz");
1586 
1587     h_waveformSMD_South->SetStats(0);
1588     h_waveformSMD_South->GetXaxis()->SetNdivisions(510, kTRUE);
1589     h_waveformSMD_South->GetXaxis()->SetRangeUser(0, 16);
1590     h_waveformSMD_South->SetTitle("SMD SOUTH");
1591     h_waveformSMD_South->SetXTitle("Sample Number");
1592     h_waveformSMD_South->SetYTitle("Waveform [ADC]");
1593     h_waveformSMD_South->GetXaxis()->SetLabelSize(tsize);
1594     h_waveformSMD_South->GetYaxis()->SetLabelSize(tsize);
1595     h_waveformSMD_South->GetXaxis()->SetTitleSize(tsize);
1596     h_waveformSMD_South->GetYaxis()->SetTitleSize(tsize);
1597     h_waveformSMD_South->GetYaxis()->SetTitleOffset(offset);
1598 
1599      t5->Draw("same");
1600     t6->Draw("same");
1601       
1602     Pad[66]->cd();
1603     gPad->SetLeftMargin(lf);
1604 
1605     gStyle->SetTitleFontSize(0.06);
1606     h_waveform_timess->Draw("hist");
1607     h_waveform_timess->SetTitle("");
1608     // h_waveform_timess->GetXaxis()->CenterTitle();
1609     h_waveform_timess->SetStats(0);
1610     h_waveform_timess->GetXaxis()->SetNdivisions(510, kTRUE);
1611     h_waveform_timess->GetXaxis()->SetRangeUser(0, 16);
1612     h_waveform_timess->SetTitle("SMD SOUTH");
1613     h_waveform_timess->GetXaxis()->SetTitle("Sample Number");
1614     h_waveform_timess->GetYaxis()->SetTitle("Fraction of Towers");
1615     h_waveform_timess->GetXaxis()->SetLabelSize(tsize);
1616     h_waveform_timess->GetYaxis()->SetLabelSize(tsize);
1617     h_waveform_timess->GetXaxis()->SetTitleSize(tsize);
1618     h_waveform_timess->GetYaxis()->SetTitleSize(tsize);
1619     h_waveform_timess->GetYaxis()->SetTitleOffset(offset);
1620 
1621 
1622     h_waveform_timess->SetFillColorAlpha(kBlue, 0.1);
1623     if(h_waveform_timess->GetEntries()){
1624         h_waveform_timess->Scale(1. / h_waveform_timess->GetEntries());
1625      }
1626     
1627   TLine *t55 = new TLine(6,0.0,6,h_waveform_timess->GetMaximum() * 1.05);
1628   t55->SetLineWidth(3);
1629   t55->SetLineStyle(1);
1630   t55->SetLineColor(kRed);
1631       
1632   TLine *t66 = new TLine(12,0.0,12,h_waveform_timess->GetMaximum() * 1.05);
1633   t66->SetLineWidth(3);
1634   t66->SetLineStyle(1);
1635   t66->SetLineColor(kRed);
1636   t55->Draw("same");
1637   t66->Draw("same");
1638       
1639 
1640   TLine *t7 = new TLine(5,0.0,5, maxwf);
1641   t7->SetLineWidth(3);
1642   t7->SetLineStyle(1);
1643   t7->SetLineColor(kRed);
1644 
1645   TLine *t8 = new TLine(9,0.0,9, maxwf);
1646   t8->SetLineWidth(3);
1647   t8->SetLineStyle(1);
1648   t8->SetLineColor(kRed);
1649       
1650     Pad[62]->cd();
1651     gPad->SetLogz();
1652     gPad->SetRightMargin(0.15);
1653     gPad->SetLeftMargin(lf);
1654 
1655     gStyle->SetTitleFontSize(0.08);
1656     h_waveformVeto_North->GetYaxis()->SetRangeUser(0, h_waveformVeto_North->GetMaximum() * 1.05);
1657     h_waveformVeto_North->Draw("colz");
1658 
1659     h_waveformVeto_North->SetStats(0);
1660     h_waveformVeto_North->GetXaxis()->SetNdivisions(510, kTRUE);
1661     h_waveformVeto_North->GetXaxis()->SetRangeUser(0, 16);
1662     h_waveformVeto_North->SetTitle("VETO NORTH");
1663     h_waveformVeto_North->SetXTitle("Sample Number");
1664     h_waveformVeto_North->SetYTitle("Waveform [ADC]");
1665     h_waveformVeto_North->GetXaxis()->SetLabelSize(tsize);
1666     h_waveformVeto_North->GetYaxis()->SetLabelSize(tsize);
1667     h_waveformVeto_North->GetXaxis()->SetTitleSize(tsize);
1668     h_waveformVeto_North->GetYaxis()->SetTitleSize(tsize);
1669     h_waveformVeto_North->GetYaxis()->SetTitleOffset(offset);
1670 
1671     t7->Draw("same");
1672     t8->Draw("same");
1673       
1674     Pad[67]->cd();
1675     gPad->SetLeftMargin(lf);
1676     gStyle->SetTitleFontSize(0.06);
1677     h_waveform_timevn->Draw("hist");
1678     h_waveform_timevn->SetTitle("");
1679     // h_waveform_timevn->GetXaxis()->CenterTitle();
1680     h_waveform_timevn->SetStats(0);
1681     h_waveform_timevn->GetXaxis()->SetNdivisions(510, kTRUE);
1682     h_waveform_timevn->GetXaxis()->SetRangeUser(0, 16);
1683     h_waveform_timevn->SetTitle("VETO NORTH");
1684     h_waveform_timevn->GetXaxis()->SetTitle("Sample Number");
1685     h_waveform_timevn->GetYaxis()->SetTitle("Fraction of Towers");
1686     h_waveform_timevn->GetXaxis()->SetLabelSize(tsize);
1687     h_waveform_timevn->GetYaxis()->SetLabelSize(tsize);
1688     h_waveform_timevn->GetXaxis()->SetTitleSize(tsize);
1689     h_waveform_timevn->GetYaxis()->SetTitleSize(tsize);
1690     h_waveform_timevn->GetYaxis()->SetTitleOffset(offset);
1691 
1692 
1693     h_waveform_timevn->SetFillColorAlpha(kBlue, 0.1);
1694     if(h_waveform_timevn->GetEntries()){
1695         h_waveform_timevn->Scale(1. / h_waveform_timevn->GetEntries());
1696      }
1697     
1698 
1699 
1700   TLine *t77 = new TLine(5,0.0,5,h_waveform_timevn->GetMaximum() * 1.05);
1701   t77->SetLineWidth(3);
1702   t77->SetLineStyle(1);
1703   t77->SetLineColor(kRed);
1704 
1705   TLine *t88 = new TLine(9,0.0,9,h_waveform_timevn->GetMaximum() * 1.05);
1706   t88->SetLineWidth(3);
1707   t88->SetLineStyle(1);
1708   t88->SetLineColor(kRed);
1709 
1710   t77->Draw("same");
1711   t88->Draw("same");
1712 
1713 
1714   TLine *t9 = new TLine(6,0.0,6,maxwf);
1715   t9->SetLineWidth(3);
1716   t9->SetLineStyle(1);
1717   t9->SetLineColor(kRed);
1718 
1719   TLine *t10 = new TLine(12,0.0,12,maxwf);
1720   t10->SetLineWidth(3);
1721   t10->SetLineStyle(1);
1722   t10->SetLineColor(kRed);
1723 
1724       
1725     Pad[63]->cd();
1726     gPad->SetLogz();
1727     gPad->SetRightMargin(0.15);
1728     gPad->SetLeftMargin(lf);
1729 
1730     gStyle->SetTitleFontSize(0.08);
1731     h_waveformVeto_South->GetYaxis()->SetRangeUser(0, h_waveformVeto_South->GetMaximum() * 1.05);
1732     h_waveformVeto_South->Draw("colz");
1733 
1734     h_waveformVeto_South->SetStats(0);
1735     h_waveformVeto_South->GetXaxis()->SetNdivisions(510, kTRUE);
1736     h_waveformVeto_South->GetXaxis()->SetRangeUser(0, 16);
1737     h_waveformVeto_South->SetTitle("VETO SOUTH");
1738     h_waveformVeto_South->SetXTitle("Sample Number");
1739     h_waveformVeto_South->SetYTitle("Waveform [ADC]");
1740     h_waveformVeto_South->GetXaxis()->SetLabelSize(tsize);
1741     h_waveformVeto_South->GetYaxis()->SetLabelSize(tsize);
1742     h_waveformVeto_South->GetXaxis()->SetTitleSize(tsize);
1743     h_waveformVeto_South->GetYaxis()->SetTitleSize(tsize);
1744     h_waveformVeto_South->GetYaxis()->SetTitleOffset(offset);
1745     t9->Draw("same");
1746     t10->Draw("same");
1747       
1748     Pad[68]->cd();
1749     gPad->SetLeftMargin(lf);
1750 
1751     gStyle->SetTitleFontSize(0.06);
1752     h_waveform_timevs->Draw("hist");
1753     h_waveform_timevs->SetTitle("");
1754     // h_waveform_timevs->GetXaxis()->CenterTitle();
1755     h_waveform_timevs->SetStats(0);
1756     h_waveform_timevs->GetXaxis()->SetNdivisions(510, kTRUE);
1757     h_waveform_timevs->GetXaxis()->SetRangeUser(0, 16);
1758     h_waveform_timevs->SetTitle("VETO SOUTH");
1759     h_waveform_timevs->GetXaxis()->SetTitle("Sample Number");
1760     h_waveform_timevs->GetYaxis()->SetTitle("Fraction of Towers");
1761     h_waveform_timevs->GetXaxis()->SetLabelSize(tsize);
1762     h_waveform_timevs->GetYaxis()->SetLabelSize(tsize);
1763     h_waveform_timevs->GetXaxis()->SetTitleSize(tsize);
1764     h_waveform_timevs->GetYaxis()->SetTitleSize(tsize);
1765     h_waveform_timevs->GetYaxis()->SetTitleOffset(offset);
1766     h_waveform_timevs->SetFillColorAlpha(kBlue, 0.1);
1767     if(h_waveform_timevs->GetEntries()){
1768         h_waveform_timevs->Scale(1. / h_waveform_timevs->GetEntries());
1769      }
1770     
1771 
1772   TLine *t99 = new TLine(6,0.0,6,h_waveform_timevs->GetMaximum() * 1.05);
1773   t99->SetLineWidth(3);
1774   t99->SetLineStyle(1);
1775   t99->SetLineColor(kRed);
1776 
1777   TLine *t100 = new TLine(12,0.0,12,h_waveform_timevs->GetMaximum() * 1.05);
1778   t100->SetLineWidth(3);
1779   t100->SetLineStyle(1);
1780   t100->SetLineColor(kRed);
1781   t99->Draw("same");
1782   t100->Draw("same");
1783 
1784  
1785   TText PrintRun;
1786   PrintRun.SetTextFont(62);
1787   PrintRun.SetTextSize(0.04);
1788   PrintRun.SetNDC();          // set to normalized coordinates
1789   PrintRun.SetTextAlign(23);  // center/top alignment
1790   std::ostringstream runnostream;
1791   std::string runstring;
1792   std::pair<time_t,int> evttime = cl->EventTime("CURRENT");
1793   // fill run number and event time into string
1794   runnostream << ThisName << "_1 Run " << cl->RunNumber()
1795               << ", Time: " << ctime(&evttime.first);
1796   runstring = runnostream.str();
1797   transparent[8]->cd();
1798   PrintRun.SetTextColor(evttime.second);
1799   PrintRun.DrawText(0.5, 1., runstring.c_str());
1800   TC[8]->Update();
1801   TC[8]->Show();
1802   TC[8]->SetEditable(false);
1803 
1804   return 0;
1805 }
1806 
1807 
1808 
1809 int ZdcMonDraw::SavePlot(const std::string &what, const std::string &type)
1810 {
1811   OnlMonClient *cl = OnlMonClient::instance();
1812   int iret = Draw(what);
1813   if (iret)  // on error no png files please
1814   {
1815     return iret;
1816   }
1817   int icnt = 0;
1818   for (TCanvas *canvas : TC)
1819   {
1820     if (canvas == nullptr)
1821     {
1822       continue;
1823     }
1824     icnt++;
1825     std::string filename = ThisName + "_" + std::to_string(icnt) + "_" +
1826                            std::to_string(cl->RunNumber()) + "." + type;
1827     cl->CanvasToPng(canvas, filename);
1828   }
1829   return 0;
1830 }
1831 
1832 int ZdcMonDraw::MakeHtml(const std::string &what)
1833 {
1834   int iret = Draw(what);
1835   if (iret)  // on error no html output please
1836   {
1837     return iret;
1838   }
1839 
1840   OnlMonClient *cl = OnlMonClient::instance();
1841 
1842   int icnt = 0;
1843   std::set <int> expert_indices; // these canvases end up under expert
1844   expert_indices.insert(2);
1845   // expert_indices.insert(4);
1846   // expert_indices.insert(5);
1847 
1848   for (TCanvas* canvas : TC)
1849   {
1850     if (canvas == nullptr)
1851     {
1852       continue;
1853     }
1854     std::string title = canvas->GetTitle();
1855     if (expert_indices.find(icnt) != expert_indices.end())
1856     {
1857       title = "EXPERT -/" + title;
1858     }
1859     std::string pngfile = cl->htmlRegisterPage(*this, title, std::to_string(icnt), "png");
1860     cl->CanvasToPng(canvas, pngfile);
1861     icnt++;
1862   }
1863   return 0;
1864 }