File indexing completed on 2025-07-01 07:56:41
0001 #ifndef PLOTTHELPER_H
0002 #define PLOTTHELPER_H
0003
0004 #include "TLegend.h"
0005 #include "TAxis.h"
0006 #include "TColor.h"
0007 #include "TCanvas.h"
0008 #include "TLine.h"
0009 #include "TBox.h"
0010 #include "TPad.h"
0011 #include "TFrame.h"
0012 #include "TLatex.h"
0013 #include "TGraph.h"
0014 #include "TGraphErrors.h"
0015 #include "TGraphAsymmErrors.h"
0016 #include "TGaxis.h"
0017 #include "TSystem.h"
0018 #include "TStyle.h"
0019 #include <TH3.h>
0020 #include "TileSpectra.h"
0021 #include "TileTrend.h"
0022 #include "CalibSummary.h"
0023 #include "CommonHelperFunctions.h"
0024
0025
0026
0027 TString ReturnDateStr(){
0028 TDatime today;
0029 int iDate = today.GetDate();
0030 int iYear = iDate/10000;
0031 int iMonth = (iDate%10000)/100;
0032 int iDay = iDate%100;
0033 return Form("%i_%02d_%02d",iYear, iMonth, iDay);
0034 }
0035
0036
0037
0038
0039
0040 Double_t FindLargestBin1DHist(TH1* hist, Double_t minX = -10000, Double_t maxX = -10000 ){
0041 Double_t largestContent = 0;
0042 if (!hist){
0043 std::cout << "histogram pointer was empty, skipping!" << std::endl;
0044 return 0.;
0045 }
0046 Int_t minBin = 1;
0047 Int_t maxBin = hist->GetNbinsX()+1;
0048 if (minX != -10000) minBin = hist->GetXaxis()->FindBin(minX);
0049 if (maxX != -10000) maxBin = hist->GetXaxis()->FindBin(maxX)+0.0001;
0050 for (Int_t i= minBin; i < maxBin; i++){
0051 if (largestContent < hist->GetBinContent(i)){
0052 largestContent = hist->GetBinContent(i);
0053 }
0054 }
0055 return largestContent;
0056 }
0057
0058
0059
0060 Double_t FindSmallestBin1DHist(TH1* hist, Double_t maxStart = 1e6 ){
0061 Double_t smallesContent = maxStart;
0062 for (Int_t i= 0; i < hist->GetNbinsX(); i++){
0063 if (hist->GetBinContent(i) != 0 && smallesContent > hist->GetBinContent(i)){
0064 smallesContent = hist->GetBinContent(i);
0065 }
0066 }
0067 return smallesContent;
0068 }
0069
0070
0071
0072
0073 Double_t FindLastBinXAboveMin(TH1* hist, Double_t min = 1 ){
0074 int i = hist->GetNbinsX();
0075 while (i > 0 && hist->GetBinContent(i) < min) i--;
0076 if (i != 1)
0077 return hist->GetBinCenter(i+1);
0078 else
0079 return hist->GetBinCenter(hist->GetNbinsX()-1);
0080 }
0081
0082
0083
0084
0085 Double_t FindFirstBinXAboveMin(TH1* hist, Double_t min = 1 ){
0086 int i = 1;
0087 while (i < hist->GetNbinsX() && hist->GetBinContent(i) < min) i++;
0088 if (i != hist->GetNbinsX()-1)
0089 return hist->GetBinCenter(i+1);
0090 else
0091 return hist->GetBinCenter(1);
0092 }
0093
0094
0095
0096
0097
0098
0099 void StyleSettingsBasics( TString format = ""){
0100
0101 gStyle->SetOptDate(0);
0102 gStyle->SetOptStat(0);
0103 gStyle->SetPalette(1,0);
0104 gStyle->SetFrameBorderMode(0);
0105 gStyle->SetFrameFillColor(0);
0106 gStyle->SetTitleFillColor(0);
0107 gStyle->SetTextSize(0.5);
0108 gStyle->SetLabelSize(0.03,"xyz");
0109 gStyle->SetLabelOffset(0.006,"xyz");
0110 gStyle->SetTitleFontSize(0.04);
0111 gStyle->SetTitleOffset(1,"y");
0112 gStyle->SetTitleOffset(0.7,"x");
0113 gStyle->SetCanvasColor(0);
0114 gStyle->SetPadTickX(1);
0115 gStyle->SetPadTickY(1);
0116
0117 gStyle->SetLineWidth(1);
0118 gStyle->SetPaintTextFormat(".3f");
0119
0120 gStyle->SetPadTopMargin(0.03);
0121 gStyle->SetPadBottomMargin(0.09);
0122 gStyle->SetPadRightMargin(0.03);
0123 gStyle->SetPadLeftMargin(0.13);
0124
0125
0126 TGaxis::SetMaxDigits(4);
0127 gErrorIgnoreLevel=kError;
0128
0129 if (format.CompareTo("eps") == 0 ||format.CompareTo("pdf") == 0 ) gStyle->SetLineScalePS(1);
0130 }
0131
0132
0133 void SetPlotStyle() {
0134
0135 const Int_t nRGBs = 5;
0136 const Int_t nCont = 255;
0137
0138 Double_t stops[nRGBs] = { 0.00, 0.34, 0.61, 0.84, 1.00 };
0139 Double_t red[nRGBs] = { 0.00, 0.00, 0.87, 1.00, 0.51 };
0140 Double_t green[nRGBs] = { 0.31, 0.81, 1.00, 0.20, 0.00 };
0141 Double_t blue[nRGBs] = { 0.51, 1., 0.12, 0.00, 0.00};
0142
0143 TColor::CreateGradientColorTable(nRGBs, stops, red, green, blue, nCont);
0144 gStyle->SetNumberContours(nCont);
0145 }
0146
0147
0148 void SetPlotStyleNConts( Int_t nCont = 255) {
0149 const Int_t nRGBs = 5;
0150 Double_t stops[nRGBs] = { 0.00, 0.34, 0.61, 0.84, 1.00 };
0151 Double_t red[nRGBs] = { 0.00, 0.00, 0.87, 1.00, 0.51 };
0152 Double_t green[nRGBs] = { 0.00, 0.81, 1.00, 0.20, 0.00 };
0153 Double_t blue[nRGBs] = { 0.51, 1.00, 0.12, 0.00, 0.00 };
0154 TColor::CreateGradientColorTable(nRGBs, stops, red, green, blue, nCont);
0155 gStyle->SetNumberContours(nCont);
0156 }
0157
0158
0159 Color_t GetColorLayer(int l){
0160 Color_t colors[10] = {kBlack, kViolet+4, kBlue-3, kCyan+1, kGreen+1, kYellow-4, kOrange, kRed-4, kPink-5, kMagenta+2 };
0161 return colors[l%10];
0162 }
0163
0164
0165 Style_t GetLineStyleLayer(int l){
0166 Style_t styles[7] = {1, 3, 4, 6, 7, 10, 9};
0167 int bin = l/10;
0168 return styles[bin];
0169 }
0170
0171
0172 void DrawCanvasSettings( TCanvas* c1,
0173 Double_t leftMargin,
0174 Double_t rightMargin,
0175 Double_t topMargin,
0176 Double_t bottomMargin){
0177
0178 c1->SetTickx();
0179 c1->SetTicky();
0180 c1->SetGridx(0);
0181 c1->SetGridy(0);
0182 c1->SetLogy(0);
0183 c1->SetLeftMargin(leftMargin);
0184 c1->SetRightMargin(rightMargin);
0185 c1->SetTopMargin(topMargin);
0186 c1->SetBottomMargin(bottomMargin);
0187 c1->SetFillColor(0);
0188 }
0189
0190
0191 TCanvas *GetAndSetCanvas( TString name,
0192 Double_t leftmargin = 0.11,
0193 Double_t bottommargin = 0.1,
0194 Double_t x = 1400,
0195 Double_t y = 1000){
0196
0197 TCanvas *canvas = new TCanvas(name,name,x,y);
0198 canvas->SetLeftMargin(leftmargin);
0199 canvas->SetRightMargin(0.015);
0200 canvas->SetTopMargin(0.03);
0201 canvas->SetBottomMargin(bottommargin);
0202 canvas->SetFillColor(0);
0203
0204 return canvas;
0205
0206 }
0207
0208
0209 TLegend *GetAndSetLegend( Double_t positionX,
0210 Double_t positionY,
0211 Double_t entries,
0212 Int_t Columns = 1,
0213 TString header =""){
0214
0215 if(header.CompareTo("") != 0) entries++;
0216 Double_t positionYPlus = 0.04*1.1*(Double_t)entries;
0217 TLegend *legend = new TLegend(positionX,positionY,positionX+(0.25*Columns),positionY+positionYPlus);
0218 legend->SetNColumns(Columns);
0219 legend->SetLineColor(0);
0220 legend->SetLineWidth(0);
0221 legend->SetFillColor(0);
0222 legend->SetFillStyle(0);
0223 legend->SetLineStyle(0);
0224 legend->SetTextSize(0.04);
0225 legend->SetTextFont(42);
0226 if(header.CompareTo("") != 0)legend->SetHeader(header);
0227 return legend;
0228 }
0229
0230
0231 TLegend *GetAndSetLegend2( Double_t positionX,
0232 Double_t positionY,
0233 Double_t positionXRight,
0234 Double_t positionYUp,
0235 Size_t textSize,
0236 Int_t columns = 1,
0237 TString header = "",
0238 Font_t textFont = 43,
0239 Double_t margin = 0
0240 ){
0241
0242 TLegend *legend = new TLegend(positionX,positionY,positionXRight,positionYUp);
0243 legend->SetNColumns(columns);
0244 legend->SetLineColor(0);
0245 legend->SetLineWidth(0);
0246 legend->SetFillColor(0);
0247 legend->SetFillStyle(0);
0248 legend->SetLineStyle(0);
0249 legend->SetBorderSize(0);
0250 legend->SetTextFont(textFont);
0251 legend->SetTextSize(textSize);
0252 if (margin != 0) legend->SetMargin(margin);
0253 if (header.CompareTo("")!= 0) legend->SetHeader(header);
0254 return legend;
0255 }
0256
0257
0258 void SetHistogramm( TH1 *hist,
0259 TString xLabel,
0260 TString yLabel,
0261 Double_t rangeYlow = -99.,
0262 Double_t rangeYhigh = -99.,
0263 Double_t xOffset = 1.0,
0264 Double_t yOffset = 1.15,
0265 Font_t font = 42
0266 ){
0267
0268 Double_t scale = 1./gPad->GetAbsHNDC();
0269
0270 if(rangeYlow != -99.) hist->GetYaxis()->SetRangeUser(rangeYlow,rangeYhigh);
0271 hist->SetTitle("");
0272 hist->SetXTitle(xLabel);
0273 hist->SetYTitle(yLabel);
0274 hist->GetYaxis()->SetDecimals();
0275 hist->GetYaxis()->SetTitleOffset(yOffset/scale);
0276 hist->GetXaxis()->SetTitleOffset(xOffset);
0277 hist->GetXaxis()->SetTitleSize(0.04*scale);
0278 hist->GetYaxis()->SetTitleSize(0.04*scale);
0279 hist->GetXaxis()->SetLabelSize(0.035*scale);
0280 hist->GetYaxis()->SetLabelSize(0.035*scale);
0281 hist->GetXaxis()->SetLabelFont(font);
0282 hist->GetYaxis()->SetLabelFont(font);
0283 hist->SetMarkerSize(1.);
0284 hist->SetMarkerStyle(20);
0285 }
0286
0287
0288 void SetGraph( TGraph *graph,
0289 TString xLabel,
0290 TString yLabel,
0291 Double_t rangeYlow = -99.,
0292 Double_t rangeYhigh = -99.,
0293 Double_t xOffset = 1.0,
0294 Double_t yOffset = 1.15){
0295
0296 Double_t scale = 1./gPad->GetAbsHNDC();
0297
0298 if(rangeYlow != -99.) graph->GetYaxis()->SetRangeUser(rangeYlow,rangeYhigh);
0299 graph->GetXaxis()->SetTitle(xLabel);
0300 graph->GetYaxis()->SetTitle(yLabel);
0301 graph->GetYaxis()->SetDecimals();
0302 graph->GetYaxis()->SetTitleOffset(yOffset/scale);
0303 graph->GetXaxis()->SetTitleOffset(xOffset);
0304 graph->GetXaxis()->SetTitleSize(0.04*scale);
0305 graph->GetYaxis()->SetTitleSize(0.04*scale);
0306 graph->GetXaxis()->SetLabelSize(0.035*scale);
0307 graph->GetYaxis()->SetLabelSize(0.035*scale);
0308 graph->GetXaxis()->SetLabelFont(42);
0309 graph->GetYaxis()->SetLabelFont(42);
0310 graph->SetMarkerSize(1.);
0311 graph->SetMarkerStyle(20);
0312 }
0313
0314
0315 void SetMarkerDefaults( TH1* histo1,
0316 Style_t markerStyle,
0317 Size_t markerSize,
0318 Color_t markerColor,
0319 Color_t lineColor,
0320 Bool_t setFont = kTRUE) {
0321 histo1->SetMarkerStyle(markerStyle);
0322 histo1->SetMarkerSize(markerSize);
0323 histo1->SetMarkerColor(markerColor);
0324 histo1->SetLineColor(lineColor);
0325 if (setFont){
0326 histo1->GetYaxis()->SetLabelFont(42);
0327 histo1->GetXaxis()->SetLabelFont(42);
0328 histo1->GetYaxis()->SetTitleFont(62);
0329 histo1->GetXaxis()->SetTitleFont(62);
0330 }
0331 }
0332
0333 void SetMarkerDefaults( TH1* histo1,
0334 TString xtitle = "",
0335 TString ytitle = "",
0336 Style_t markerStyle = 20,
0337 Size_t markerSize = 1,
0338 Color_t markerColor = kBlack,
0339 Color_t lineColor = kBlack,
0340 double textsize = 0.045,
0341 double labelsize = 0.045,
0342 double xoffset = 1.,
0343 double yoffset = 1. ) {
0344 histo1->SetTitle("");
0345 histo1->SetStats(0);
0346 histo1->SetMarkerStyle(markerStyle);
0347 histo1->SetMarkerSize(markerSize);
0348 histo1->SetMarkerColor(markerColor);
0349 histo1->SetLineColor(lineColor);
0350 histo1->GetYaxis()->SetLabelFont(42);
0351 histo1->GetXaxis()->SetLabelFont(42);
0352 histo1->GetYaxis()->SetLabelSize(labelsize);
0353 histo1->GetXaxis()->SetLabelSize(labelsize);
0354 histo1->GetYaxis()->SetTitleFont(62);
0355 histo1->GetXaxis()->SetTitleFont(62);
0356 histo1->GetYaxis()->SetTitleSize(textsize);
0357 histo1->GetXaxis()->SetTitleSize(textsize);
0358 if(!xtitle.EqualTo("")) histo1->GetXaxis()->SetTitle(xtitle);
0359 if(!ytitle.EqualTo("")) histo1->GetYaxis()->SetTitle(ytitle);
0360 histo1->GetXaxis()->SetTitleOffset(xoffset);
0361 histo1->GetYaxis()->SetTitleOffset(yoffset);
0362 }
0363
0364 void SetMarkerDefaultsProfile( TProfile* prof,
0365 Style_t markerStyle,
0366 Size_t markerSize,
0367 Color_t markerColor,
0368 Color_t lineColor ) {
0369 prof->SetMarkerStyle(markerStyle);
0370 prof->SetMarkerSize(markerSize);
0371 prof->SetMarkerColor(markerColor);
0372 prof->SetLineColor(lineColor);
0373 prof->GetYaxis()->SetLabelFont(42);
0374 prof->GetXaxis()->SetLabelFont(42);
0375 prof->GetYaxis()->SetTitleFont(62);
0376 prof->GetXaxis()->SetTitleFont(62);
0377 }
0378
0379
0380 void SetLineDefaults( TH1* histo1,
0381 Int_t LineColor,
0382 Int_t LineWidth,
0383 Int_t LineStyle ) {
0384 histo1->SetLineColor(LineColor);
0385 histo1->SetMarkerColor(LineColor);
0386 histo1->SetLineWidth(LineWidth);
0387 histo1->SetLineStyle(LineStyle);
0388 }
0389
0390
0391 void SetLineDefaultsTF1( TF1* Fit1,
0392 Int_t LineColor,
0393 Int_t LineWidth,
0394 Int_t LineStyle ) {
0395 Fit1->SetLineColor(LineColor);
0396 Fit1->SetLineWidth(LineWidth);
0397 Fit1->SetLineStyle(LineStyle);
0398 }
0399
0400
0401
0402 void DefaultCancasSettings( TCanvas* c1,
0403 Double_t leftMargin,
0404 Double_t rightMargin,
0405 Double_t topMargin,
0406 Double_t bottomMargin){
0407 c1->SetTickx();
0408 c1->SetTicky();
0409 c1->SetGridx(0);
0410 c1->SetGridy(0);
0411 c1->SetLogy(0);
0412 c1->SetLeftMargin(leftMargin);
0413 c1->SetRightMargin(rightMargin);
0414 c1->SetTopMargin(topMargin);
0415 c1->SetBottomMargin(bottomMargin);
0416 c1->SetFillColor(0);
0417 }
0418
0419
0420 void DefaultPadSettings( TPad* pad1,
0421 Double_t leftMargin,
0422 Double_t rightMargin,
0423 Double_t topMargin,
0424 Double_t bottomMargin){
0425 pad1->SetFillColor(0);
0426 pad1->GetFrame()->SetFillColor(0);
0427 pad1->SetBorderMode(0);
0428 pad1->SetLeftMargin(leftMargin);
0429 pad1->SetBottomMargin(bottomMargin);
0430 pad1->SetRightMargin(rightMargin);
0431 pad1->SetTopMargin(topMargin);
0432 pad1->SetTickx();
0433 pad1->SetTicky();
0434 }
0435
0436
0437 void SetMarkerDefaultsTGraph( TGraph* graph,
0438 Style_t markerStyle,
0439 Size_t markerSize,
0440 Color_t markerColor,
0441 Color_t lineColor,
0442 Width_t lineWidth = 1,
0443 Style_t lineStyle = 1,
0444 Bool_t boxes = kFALSE,
0445 Color_t fillColor = 0,
0446 Bool_t isHollow = kFALSE
0447 ) {
0448 graph->SetMarkerStyle(markerStyle);
0449 graph->SetMarkerSize(markerSize);
0450 graph->SetMarkerColor(markerColor);
0451 graph->SetLineColor(lineColor);
0452 graph->SetLineWidth(lineWidth);
0453 graph->SetLineWidth(lineStyle);
0454 if (boxes){
0455 graph->SetFillColor(fillColor);
0456 if (fillColor!=0){
0457 if (!isHollow){
0458 graph->SetFillStyle(1001);
0459 } else {
0460 graph->SetFillStyle(0);
0461 }
0462 } else {
0463 graph->SetFillStyle(0);
0464 }
0465 }
0466 }
0467
0468
0469 void SetMarkerDefaultsTGraphErr( TGraphErrors* graph,
0470 Style_t markerStyle,
0471 Size_t markerSize,
0472 Color_t markerColor,
0473 Color_t lineColor,
0474 Width_t lineWidth = 1,
0475 Bool_t boxes = kFALSE,
0476 Color_t fillColor = 0,
0477 Bool_t isHollow = kFALSE) {
0478 graph->SetMarkerStyle(markerStyle);
0479 graph->SetMarkerSize(markerSize);
0480 graph->SetMarkerColor(markerColor);
0481 graph->SetLineColor(lineColor);
0482 graph->SetLineWidth(lineWidth);
0483 if (boxes){
0484 graph->SetFillColor(fillColor);
0485 if (fillColor!=0){
0486 if (!isHollow){
0487 graph->SetFillStyle(1001);
0488 } else {
0489 graph->SetFillStyle(0);
0490 }
0491 } else {
0492 graph->SetFillStyle(0);
0493 }
0494 }
0495 }
0496
0497
0498 void SetMarkerDefaultsTGraphAsym( TGraphAsymmErrors* graph,
0499 Style_t markerStyle,
0500 Size_t markerSize,
0501 Color_t markerColor,
0502 Color_t lineColor,
0503 Width_t lineWidth =1,
0504 Bool_t boxes = kFALSE,
0505 Color_t fillColor = 0,
0506 Bool_t isHollow = kFALSE
0507 ) {
0508 if (!graph) return;
0509 graph->SetMarkerStyle(markerStyle);
0510 graph->SetMarkerSize(markerSize);
0511 graph->SetMarkerColor(markerColor);
0512 graph->SetLineColor(lineColor);
0513 graph->SetLineWidth(lineWidth);
0514 if (boxes){
0515 graph->SetFillColor(fillColor);
0516 if (fillColor!=0){
0517 if (!isHollow){
0518 graph->SetFillStyle(1001);
0519 } else {
0520 graph->SetFillStyle(0);
0521 }
0522 } else {
0523 graph->SetFillStyle(0);
0524 }
0525 }
0526 }
0527
0528
0529 void SetMarkerDefaultsTF1( TF1* fit1,
0530 Style_t lineStyle,
0531 Size_t lineWidth,
0532 Color_t lineColor ) {
0533 if (!fit1) return;
0534 fit1->SetLineColor(lineColor);
0535 fit1->SetLineStyle(lineStyle);
0536 fit1->SetLineWidth(lineWidth);
0537 }
0538
0539
0540 void SetStyleTLatex( TLatex* text,
0541 Size_t textSize,
0542 Width_t lineWidth,
0543 Color_t textColor = 1,
0544 Font_t textFont = 42,
0545 Bool_t kNDC = kTRUE,
0546 Short_t align = 11
0547 ){
0548 if (kNDC) {text->SetNDC();}
0549 text->SetTextFont(textFont);
0550 text->SetTextColor(textColor);
0551 text->SetTextSize(textSize);
0552 text->SetLineWidth(lineWidth);
0553 text->SetTextAlign(align);
0554 }
0555
0556
0557 void DrawLatex(const double PosX = 0.5, const double PosY = 0.5, TString text = "", const bool alignRight = false, const double TextSize = 0.044, const int font = 42, const double dDist = 0.05, const int color = 1){
0558
0559 std::vector<TString> Latex;
0560
0561 TObjArray *textStr = text.Tokenize(";");
0562 for(Int_t i = 0; i<textStr->GetEntries() ; i++){
0563 TObjString* tempObj = (TObjString*) textStr->At(i);
0564 Latex.push_back( tempObj->GetString());
0565 }
0566 for(unsigned int i = 0; i < Latex.size(); ++i){
0567 TLatex l(PosX, PosY - i*dDist, Latex[i]);
0568 l.SetNDC();
0569 l.SetTextFont(font);
0570 l.SetTextColor(color);
0571 l.SetTextSize(TextSize);
0572 if(alignRight) l.SetTextAlign(31);
0573 l.DrawClone("same");
0574 }
0575 }
0576
0577
0578 void SetStyleHisto( TH1* histo,
0579 Width_t lineWidth,
0580 Style_t lineStyle,
0581 Color_t lineColor) {
0582 if (!histo) return;
0583 histo->SetLineWidth(lineWidth);
0584 histo->SetLineStyle(lineStyle);
0585 histo->SetLineColor(lineColor);
0586 }
0587
0588
0589 void SetStyleFit( TF1* fit,
0590 Double_t xRangeStart,
0591 Double_t xRangeEnd,
0592 Width_t lineWidth,
0593 Style_t lineStyle,
0594 Color_t lineColor) {
0595 if (!fit) return;
0596 fit->SetRange(xRangeStart,xRangeEnd);
0597 fit->SetLineWidth(lineWidth);
0598 fit->SetLineStyle(lineStyle);
0599 fit->SetLineColor(lineColor);
0600 }
0601
0602
0603 void SetStyleHistoTH2ForGraphs( TH2* histo,
0604 TString XTitle,
0605 TString YTitle,
0606 Size_t xLableSize,
0607 Size_t xTitleSize,
0608 Size_t yLableSize,
0609 Size_t yTitleSize,
0610 Float_t xTitleOffset = 1,
0611 Float_t yTitleOffset = 1,
0612 Int_t xNDivisions = 510,
0613 Int_t yNDivisions = 510,
0614 Font_t textFontLabel = 42,
0615 Font_t textFontTitle = 62
0616 ){
0617 histo->SetXTitle(XTitle);
0618 histo->SetYTitle(YTitle);
0619 histo->SetTitle("");
0620 histo->SetStats(0);
0621
0622 histo->GetXaxis()->SetLabelFont(textFontLabel);
0623 histo->GetYaxis()->SetLabelFont(textFontLabel);
0624 histo->GetXaxis()->SetTitleFont(textFontTitle);
0625 histo->GetYaxis()->SetTitleFont(textFontTitle);
0626
0627 histo->GetXaxis()->SetLabelSize(xLableSize);
0628 histo->GetXaxis()->SetTitleSize(xTitleSize);
0629 histo->GetXaxis()->SetTitleOffset(xTitleOffset);
0630 histo->GetXaxis()->SetNdivisions(xNDivisions,kTRUE);
0631
0632 histo->GetYaxis()->SetDecimals();
0633 histo->GetYaxis()->SetLabelSize(yLableSize);
0634 histo->GetYaxis()->SetTitleSize(yTitleSize);
0635 histo->GetYaxis()->SetTitleOffset(yTitleOffset);
0636 histo->GetYaxis()->SetNdivisions(yNDivisions,kTRUE);
0637 }
0638
0639
0640 void SetStyleHistoTH1ForGraphs( TH1* histo,
0641 TString XTitle,
0642 TString YTitle,
0643 Size_t xLableSize,
0644 Size_t xTitleSize,
0645 Size_t yLableSize,
0646 Size_t yTitleSize,
0647 Float_t xTitleOffset = 1,
0648 Float_t yTitleOffset = 1,
0649 Int_t xNDivisions = 510,
0650 Int_t yNDivisions = 510,
0651 Font_t textFontLabel = 42,
0652 Font_t textFontTitle = 62
0653 ){
0654 histo->SetXTitle(XTitle);
0655 histo->SetYTitle(YTitle);
0656 histo->SetTitle("");
0657
0658 histo->GetYaxis()->SetLabelFont(textFontLabel);
0659 histo->GetXaxis()->SetLabelFont(textFontLabel);
0660 histo->GetYaxis()->SetTitleFont(textFontTitle);
0661 histo->GetXaxis()->SetTitleFont(textFontTitle);
0662
0663 histo->GetXaxis()->SetLabelSize(xLableSize);
0664 histo->GetXaxis()->SetTitleSize(xTitleSize);
0665 histo->GetXaxis()->SetTitleOffset(xTitleOffset);
0666 histo->GetXaxis()->SetNdivisions(xNDivisions,kTRUE);
0667
0668 histo->GetYaxis()->SetDecimals();
0669 histo->GetYaxis()->SetLabelSize(yLableSize);
0670 histo->GetYaxis()->SetTitleSize(yTitleSize);
0671 histo->GetYaxis()->SetTitleOffset(yTitleOffset);
0672 histo->GetYaxis()->SetNdivisions(yNDivisions,kTRUE);
0673 }
0674
0675
0676 void SetStyleHistoTH3ForGraphs( TH3* histo,
0677 TString XTitle,
0678 TString YTitle,
0679 TString ZTitle,
0680 Size_t xLableSize,
0681 Size_t xTitleSize,
0682 Size_t yLableSize,
0683 Size_t yTitleSize,
0684 Size_t zLableSize,
0685 Size_t zTitleSize,
0686 Float_t xTitleOffset = 1,
0687 Float_t yTitleOffset = 1,
0688 Float_t zTitleOffset = 1,
0689 Int_t xNDivisions = 510,
0690 Int_t yNDivisions = 510,
0691 Int_t zNDivisions = 510,
0692 Font_t textFontLabel = 42,
0693 Font_t textFontTitle = 62
0694 ){
0695 histo->SetXTitle(XTitle);
0696 histo->SetYTitle(YTitle);
0697 histo->SetZTitle(ZTitle);
0698 histo->SetTitle("");
0699
0700 histo->GetXaxis()->SetLabelFont(textFontLabel);
0701 histo->GetYaxis()->SetLabelFont(textFontLabel);
0702 histo->GetZaxis()->SetLabelFont(textFontLabel);
0703 histo->GetXaxis()->SetTitleFont(textFontTitle);
0704 histo->GetYaxis()->SetTitleFont(textFontTitle);
0705 histo->GetZaxis()->SetTitleFont(textFontTitle);
0706
0707 histo->GetXaxis()->SetDecimals();
0708 histo->GetXaxis()->SetLabelSize(xLableSize);
0709 histo->GetXaxis()->SetTitleSize(xTitleSize);
0710 histo->GetXaxis()->SetTitleOffset(xTitleOffset);
0711 histo->GetXaxis()->SetNdivisions(xNDivisions,kTRUE);
0712
0713 histo->GetYaxis()->SetDecimals();
0714 histo->GetYaxis()->SetLabelSize(yLableSize);
0715 histo->GetYaxis()->SetTitleSize(yTitleSize);
0716 histo->GetYaxis()->SetTitleOffset(yTitleOffset);
0717 histo->GetYaxis()->SetNdivisions(yNDivisions,kTRUE);
0718
0719 histo->GetZaxis()->SetDecimals();
0720 histo->GetZaxis()->SetLabelSize(zLableSize);
0721 histo->GetZaxis()->SetTitleSize(zTitleSize);
0722 histo->GetZaxis()->SetTitleOffset(zTitleOffset);
0723 histo->GetZaxis()->SetNdivisions(zNDivisions,kTRUE);
0724 }
0725
0726
0727 void SetStyleTProfile( TH1* histo,
0728 TString XTitle,
0729 TString YTitle,
0730 Size_t xLableSize,
0731 Size_t xTitleSize,
0732 Size_t yLableSize,
0733 Size_t yTitleSize,
0734 Float_t xTitleOffset = 1,
0735 Float_t yTitleOffset = 1,
0736 Int_t xNDivisions = 510,
0737 Int_t yNDivisions = 510,
0738 Font_t textFontLabel = 42,
0739 Font_t textFontTitle = 62
0740 ){
0741 histo->SetXTitle(XTitle);
0742 histo->SetYTitle(YTitle);
0743 histo->SetTitle("");
0744
0745 histo->GetYaxis()->SetLabelFont(textFontLabel);
0746 histo->GetXaxis()->SetLabelFont(textFontLabel);
0747 histo->GetYaxis()->SetTitleFont(textFontTitle);
0748 histo->GetXaxis()->SetTitleFont(textFontTitle);
0749
0750 histo->GetXaxis()->SetLabelSize(xLableSize);
0751 histo->GetXaxis()->SetTitleSize(xTitleSize);
0752 histo->GetXaxis()->SetTitleOffset(xTitleOffset);
0753 histo->GetXaxis()->SetNdivisions(xNDivisions,kTRUE);
0754
0755 histo->GetYaxis()->SetDecimals();
0756 histo->GetYaxis()->SetLabelSize(yLableSize);
0757 histo->GetYaxis()->SetTitleSize(yTitleSize);
0758 histo->GetYaxis()->SetTitleOffset(yTitleOffset);
0759 histo->GetYaxis()->SetNdivisions(yNDivisions,kTRUE);
0760 }
0761
0762
0763
0764
0765
0766
0767
0768
0769 void DrawLines(Float_t startX, Float_t endX,
0770 Float_t startY, Float_t endY,
0771 Float_t linew, Float_t lineColor = 4, Style_t lineStyle = 1, Float_t opacity = 1.){
0772 TLine * l1 = new TLine (startX,startY,endX,endY);
0773 l1->SetLineColor(lineColor);
0774 l1->SetLineWidth(linew);
0775 l1->SetLineStyle(lineStyle);
0776 if (opacity != 1.)
0777 l1->SetLineColorAlpha(lineColor,opacity);
0778
0779 l1->Draw("same");
0780 }
0781
0782
0783
0784
0785 TBox* CreateBox(Color_t colorBox, Double_t xStart, Double_t yStart, Double_t xEnd, Double_t yEnd, Style_t fillStyle = 1001 ) {
0786 TBox* box = new TBox(xStart ,yStart , xEnd, yEnd);
0787 box->SetLineColor(colorBox);
0788 box->SetFillColor(colorBox);
0789 box->SetFillStyle(fillStyle);
0790 return box;
0791 }
0792
0793
0794
0795
0796 TString GetStringFromRunInfo(RunInfo currRunInfo, Int_t option = 1){
0797 if (option == 1){
0798 if (currRunInfo.species.Contains("cosmics")){
0799 return Form("cosmics, Run %d, #it{V}_{#it{op}} = %1.1f V", currRunInfo.runNr, currRunInfo.vop );
0800 } else if (currRunInfo.species.CompareTo("g") == 0){
0801 return Form("LED, Run %d, #it{V}_{#it{op}} = %1.1f V", currRunInfo.runNr, currRunInfo.vop );
0802 } else {
0803 TString beam = currRunInfo.species.Data();
0804 if (beam.CompareTo("Muon +") == 0) beam = "#mu^{+}";
0805 if (beam.CompareTo("Electron") == 0) beam = "e^{-}";
0806 if (beam.CompareTo("Pion -") == 0) beam = "#pi^{-}";
0807 if (beam.CompareTo("Hadron +") == 0) beam = "h^{+}";
0808 return Form("%s-beam, #it{E}_{#it{b}}= %.0f GeV, Run %d, #it{V}_{#it{op}} = %1.1f V", beam.Data(), currRunInfo.energy, currRunInfo.runNr, currRunInfo.vop );
0809 }
0810 } else if (option == 2){
0811 if (currRunInfo.species.CompareTo("cosmics") == 0){
0812 return "cosmics";
0813 } else if (currRunInfo.species.CompareTo("g") == 0){
0814 return "LED";
0815 } else {
0816 TString beam = currRunInfo.species.Data();
0817 if (beam.CompareTo("Muon +") == 0) beam = "#mu^{+}";
0818 if (beam.CompareTo("Electron") == 0) beam = "e^{-}";
0819 if (beam.CompareTo("Pion -") == 0) beam = "#pi^{-}";
0820 if (beam.CompareTo("Hadron +") == 0) beam = "h^{+}";
0821 return Form("%s-beam, #it{E}_{#it{b}}= %.0f GeV", beam.Data(), currRunInfo.energy);
0822 }
0823 } else if (option == 3){
0824 return Form("Run %d, #it{V}_{#it{op}} = %1.1f V", currRunInfo.runNr, currRunInfo.vop ) ;
0825 } else if (option == 4){
0826 if (currRunInfo.species.CompareTo("cosmics") == 0){
0827 return Form("cosmics, Run %d, #it{V}_{#it{op}} = %1.1f V, HG = %1d, LG = %1d", currRunInfo.runNr, currRunInfo.vop, currRunInfo.hgSet, currRunInfo.lgSet);
0828 } else if (currRunInfo.species.CompareTo("g") == 0){
0829 return Form("LED, Run %d, #it{V}_{#it{op}} = %1.1f V, HG = %1d, LG = %1d", currRunInfo.runNr, currRunInfo.vop, currRunInfo.hgSet, currRunInfo.lgSet);
0830 } else{
0831 TString beam = currRunInfo.species.Data();
0832 if (beam.CompareTo("Muon +") == 0) beam = "#mu^{+}";
0833 if (beam.CompareTo("Electron") == 0) beam = "e^{-}";
0834 if (beam.CompareTo("Pion -") == 0) beam = "#pi^{-}";
0835 if (beam.CompareTo("Hadron +") == 0) beam = "h^{+}";
0836 return Form("%s-beam, #it{E}_{#it{b}}= %.0f GeV, Run %d, #it{V}_{#it{op}} = %1.1f V, HG = %1d, LG = %1d", beam.Data(), currRunInfo.energy, currRunInfo.runNr, currRunInfo.vop, currRunInfo.hgSet, currRunInfo.lgSet);
0837 }
0838 } else if (option == 5){
0839 return Form("pedestal, Run %d, #it{V}_{#it{op}} = %1.1f V", currRunInfo.runNr, currRunInfo.vop ) ;
0840 } else if (option == 6){
0841 if (currRunInfo.facility.CompareTo("")!=0 && currRunInfo.beamline.CompareTo("")!=0 && currRunInfo.year != -1 && currRunInfo.month != -1 && currRunInfo.readout.CompareTo("")!=0)
0842 return Form("%s-%s, %02d-%d, %s read-out", currRunInfo.facility.Data(), currRunInfo.beamline.Data(), currRunInfo.month, currRunInfo.year, currRunInfo.readout.Data());
0843 else if (currRunInfo.facility.CompareTo("")!=0 && currRunInfo.beamline.CompareTo("")!=0 && currRunInfo.year != -1 && currRunInfo.month != -1 )
0844 return Form("%s-%s, %02d-%d", currRunInfo.facility.Data(), currRunInfo.beamline.Data(), currRunInfo.month, currRunInfo.year);
0845 } else if (option == 7){
0846 if (currRunInfo.facility.CompareTo("")!=0 && currRunInfo.beamline.CompareTo("")!=0 && currRunInfo.year != -1 && currRunInfo.month != -1 )
0847 return Form("%s-%s, %02d-%d", currRunInfo.facility.Data(), currRunInfo.beamline.Data(), currRunInfo.month, currRunInfo.year);
0848 } else if (option == 8){
0849 if ( currRunInfo.readout.CompareTo("")!=0)
0850 return Form("%s read-out", currRunInfo.readout.Data());
0851 } else if (option == 9){
0852 if (currRunInfo.facility.CompareTo("")!=0 && currRunInfo.beamline.CompareTo("")!=0 )
0853 return Form("%s-%s", currRunInfo.facility.Data(), currRunInfo.beamline.Data());
0854 } else if (option == 10){
0855 if ( currRunInfo.year != -1 && currRunInfo.month != -1 )
0856 return Form("%02d-%d", currRunInfo.month, currRunInfo.year);
0857 }
0858
0859 return "";
0860 }
0861
0862
0863
0864
0865
0866
0867 void PlotSimple2D( TCanvas* canvas2D,
0868 TH2* hist, double maxy, double maxx,
0869 Float_t textSizeRel, TString nameOutput, RunInfo currRunInfo,
0870 int labelOpt = 1, Bool_t hasNeg = kFALSE, TString drwOpt ="colz",
0871 bool blegAbove = false, TString additionalLabel = ""
0872 ){
0873 canvas2D->cd();
0874 SetStyleHistoTH2ForGraphs( hist, hist->GetXaxis()->GetTitle(), hist->GetYaxis()->GetTitle(), 0.85*textSizeRel, textSizeRel, 0.85*textSizeRel, textSizeRel,0.9, 1.05);
0875 hist->GetZaxis()->SetLabelSize(0.85*textSizeRel);
0876 hist->GetZaxis()->SetTitleOffset(1.06);
0877 hist->GetZaxis()->SetTitleSize(textSizeRel);
0878
0879
0880 if (maxy > -10000)hist->GetYaxis()->SetRangeUser(hist->GetYaxis()->GetBinCenter(1)-0.1,maxy+0.1);
0881 if (maxx > -10000)hist->GetXaxis()->SetRangeUser(hist->GetXaxis()->GetBinCenter(1)-0.1,maxx+0.1);
0882 if (!hasNeg)
0883 hist->GetZaxis()->SetRangeUser(hist->GetMinimum(0),hist->GetMaximum());
0884 else
0885 hist->GetZaxis()->SetRangeUser(hist->GetMinimum(),hist->GetMaximum());
0886
0887 if (((TString)hist->GetZaxis()->GetTitle()).Contains("counts")){
0888 gStyle->SetPaintTextFormat(".0f");
0889 std::cout << "entered counts case" << std::endl;
0890 } else {
0891 gStyle->SetPaintTextFormat(".3f");
0892 }
0893 hist->DrawCopy(drwOpt.Data());
0894
0895 if (!blegAbove)
0896 DrawLatex(0.85, 0.92, GetStringFromRunInfo(currRunInfo,labelOpt), true, 0.85*textSizeRel, 42);
0897 else
0898 DrawLatex(0.92, 0.97, GetStringFromRunInfo(currRunInfo,labelOpt), true, 0.85*textSizeRel, 42);
0899
0900 if (additionalLabel.CompareTo("") != 0){
0901 if (!blegAbove)
0902 DrawLatex(0.11, 0.92, additionalLabel, false, 0.85*textSizeRel, 42);
0903 else
0904 DrawLatex(0.08, 0.97, additionalLabel, false, 0.85*textSizeRel, 42);
0905 }
0906 if (((TString)hist->GetXaxis()->GetTitle()).Contains("cell ID")){
0907 std::cout << "entered cell ID" << std::endl;
0908 if (maxx > -10000)
0909 DrawLines(hist->GetXaxis()->GetBinCenter(1)-0.1, maxx+0.1,0., 0., 5, kGray+1, 10);
0910 else
0911 DrawLines(hist->GetXaxis()->GetBinCenter(1)-0.1,hist->GetXaxis()->GetBinCenter(hist->GetNbinsX()-1)+0.1,0., 0., 5, kGray+1, 10);
0912 }
0913 canvas2D->SaveAs(nameOutput.Data());
0914 }
0915
0916
0917
0918
0919 void PlotSimple2D( TCanvas* canvas2D,
0920 TH2* hist, double miny, double maxy, double maxx,
0921 Float_t textSizeRel, TString nameOutput, RunInfo currRunInfo,
0922 int labelOpt = 1, Bool_t hasNeg = kFALSE, TString drwOpt ="colz",
0923 bool blegAbove = false, TString additionalLabel = ""
0924 ){
0925 canvas2D->cd();
0926 SetStyleHistoTH2ForGraphs( hist, hist->GetXaxis()->GetTitle(), hist->GetYaxis()->GetTitle(), 0.85*textSizeRel, textSizeRel, 0.85*textSizeRel, textSizeRel,0.9, 1.05);
0927 hist->GetZaxis()->SetLabelSize(0.85*textSizeRel);
0928 hist->GetZaxis()->SetTitleOffset(1.06);
0929 hist->GetZaxis()->SetTitleSize(textSizeRel);
0930
0931
0932 if (miny > -10000 && maxy > -10000)hist->GetYaxis()->SetRangeUser(miny-0.1,maxy+0.1);
0933 if (maxx > -10000)hist->GetXaxis()->SetRangeUser(hist->GetXaxis()->GetBinCenter(1)-0.1,maxx+0.1);
0934 if (!hasNeg)
0935 hist->GetZaxis()->SetRangeUser(hist->GetMinimum(0),hist->GetMaximum());
0936 else
0937 hist->GetZaxis()->SetRangeUser(hist->GetMinimum(),hist->GetMaximum());
0938
0939 if (((TString)hist->GetZaxis()->GetTitle()).Contains("counts")){
0940 gStyle->SetPaintTextFormat(".0f");
0941 std::cout << "entered counts case" << std::endl;
0942 } else {
0943 gStyle->SetPaintTextFormat(".3f");
0944 }
0945 hist->DrawCopy(drwOpt.Data());
0946
0947 if (!blegAbove)
0948 DrawLatex(0.85, 0.92, GetStringFromRunInfo(currRunInfo,labelOpt), true, 0.85*textSizeRel, 42);
0949 else
0950 DrawLatex(0.92, 0.97, GetStringFromRunInfo(currRunInfo,labelOpt), true, 0.85*textSizeRel, 42);
0951
0952 if (additionalLabel.CompareTo("") != 0){
0953 if (!blegAbove)
0954 DrawLatex(0.11, 0.92, additionalLabel, false, 0.85*textSizeRel, 42);
0955 else
0956 DrawLatex(0.08, 0.97, additionalLabel, false, 0.85*textSizeRel, 42);
0957 }
0958
0959 if (((TString)hist->GetXaxis()->GetTitle()).Contains("cell ID")){
0960 std::cout << "entered cell ID" << std::endl;
0961 if (maxx > -10000)
0962 DrawLines(hist->GetXaxis()->GetBinCenter(1)-0.1, maxx+0.1,0., 0., 5, kGray+1, 10);
0963 else
0964 DrawLines(hist->GetXaxis()->GetBinCenter(1)-0.1,hist->GetXaxis()->GetBinCenter(hist->GetNbinsX()-1)+0.1,0., 0., 5, kGray+1, 10);
0965 }
0966 canvas2D->SaveAs(nameOutput.Data());
0967 }
0968
0969
0970
0971
0972 void Plot2DWithGraph( TCanvas* canvas2D,
0973 TH2* hist, TGraphErrors* graph, double maxy, double maxx,
0974 Float_t textSizeRel, TString nameOutput, RunInfo currRunInfo,
0975 int labelOpt = 1, Bool_t hasNeg = kFALSE, TString drwOpt ="colz",
0976 bool blegAbove = false, TString additionalLabel = ""
0977 ){
0978 canvas2D->cd();
0979
0980 SetStyleHistoTH2ForGraphs( hist, hist->GetXaxis()->GetTitle(), hist->GetYaxis()->GetTitle(), 0.85*textSizeRel, textSizeRel, 0.85*textSizeRel, textSizeRel,0.9, 1.05);
0981 hist->GetZaxis()->SetLabelSize(0.85*textSizeRel);
0982 hist->GetZaxis()->SetTitleOffset(1.06);
0983 hist->GetZaxis()->SetTitleSize(textSizeRel);
0984
0985
0986 if (canvas2D->GetLogy() == 1){
0987 if (maxy > -10000)hist->GetYaxis()->SetRangeUser(0.05,maxy+0.1);
0988 } else {
0989 if (maxy > -10000)hist->GetYaxis()->SetRangeUser(hist->GetYaxis()->GetBinCenter(1)-0.1,maxy+0.1);
0990 }
0991 if (maxx > -10000)hist->GetXaxis()->SetRangeUser(hist->GetXaxis()->GetBinCenter(1)-0.1,maxx+0.1);
0992 if (!hasNeg)
0993 hist->GetZaxis()->SetRangeUser(hist->GetMinimum(0),hist->GetMaximum());
0994 else
0995 hist->GetZaxis()->SetRangeUser(hist->GetMinimum(),hist->GetMaximum());
0996
0997 if (((TString)hist->GetZaxis()->GetTitle()).Contains("counts")){
0998 gStyle->SetPaintTextFormat(".0f");
0999 std::cout << "entered counts case" << std::endl;
1000 } else {
1001 gStyle->SetPaintTextFormat(".3f");
1002 }
1003 hist->DrawCopy(drwOpt.Data());
1004
1005 if (graph){
1006 SetMarkerDefaultsTGraphErr( graph, 24, 2, kGray+1,kGray+1, 3, kFALSE, 0, kFALSE);
1007 graph->Draw("same,pe");
1008 }
1009 if (!blegAbove){
1010 DrawLatex(0.835, 0.935, Form("#it{#bf{LFHCal TB:} %s}",GetStringFromRunInfo(currRunInfo,7).Data()), true, textSizeRel, 42);
1011 DrawLatex(0.835, 0.90, GetStringFromRunInfo(currRunInfo,labelOpt), true, 0.85*textSizeRel, 42);
1012 DrawLatex(0.835, 0.865, Form("%s",GetStringFromRunInfo(currRunInfo,8).Data()), true, 0.85*textSizeRel, 42);
1013 }
1014 else
1015 DrawLatex(0.92, 0.97, GetStringFromRunInfo(currRunInfo,labelOpt), true, 0.85*textSizeRel, 42);
1016
1017 if (additionalLabel.CompareTo("") != 0){
1018 if (!blegAbove)
1019 DrawLatex(0.11, 0.92, additionalLabel, false, 0.85*textSizeRel, 42);
1020 else
1021 DrawLatex(0.08, 0.97, additionalLabel, false, 0.85*textSizeRel, 42);
1022 }
1023 if (((TString)hist->GetXaxis()->GetTitle()).Contains("cell ID")){
1024 if (maxx > -10000)
1025 DrawLines(hist->GetXaxis()->GetBinCenter(1)-0.1, maxx+0.1,0., 0., 5, kGray+1, 10);
1026 else
1027 DrawLines(hist->GetXaxis()->GetBinCenter(1)-0.1,hist->GetXaxis()->GetBinCenter(hist->GetNbinsX()-1)+0.1,0., 0., 5, kGray+1, 10);
1028 }
1029 canvas2D->SaveAs(nameOutput.Data());
1030 }
1031
1032
1033
1034
1035 void PlotSimple1D( TCanvas* canvas2D,
1036 TH1* hist, Int_t maxy, Int_t maxx,
1037 Float_t textSizeRel, TString nameOutput, RunInfo currRunInfo,
1038 int labelOpt = 1,
1039 TString additionalLabel = ""
1040 ){
1041 canvas2D->cd();
1042 SetStyleHistoTH1ForGraphs( hist, hist->GetXaxis()->GetTitle(), hist->GetYaxis()->GetTitle(), 0.85*textSizeRel, textSizeRel, 0.85*textSizeRel, textSizeRel,0.9, 1.05);
1043
1044 SetMarkerDefaults(hist, 20, 1, kBlue+1, kBlue+1, kFALSE);
1045
1046
1047 if (maxy > -10000)hist->GetYaxis()->SetRangeUser(-0.5,maxy+0.1);
1048 if (maxx > -10000)hist->GetXaxis()->SetRangeUser(0.5,maxx+0.1);
1049
1050 hist->Draw("p,e");
1051
1052 DrawLatex(0.95, 0.92, GetStringFromRunInfo(currRunInfo,labelOpt), true, 0.85*textSizeRel, 42);
1053 if (additionalLabel.CompareTo("") != 0){
1054 DrawLatex(0.95, 0.92-textSizeRel, additionalLabel, true, 0.85*textSizeRel, 42);
1055 }
1056 canvas2D->SaveAs(nameOutput.Data());
1057 }
1058
1059
1060
1061
1062 void PlotContamination1D( TCanvas* canvas2D,
1063 TH1* histAll, TH1* histMuon, TH1* histPrim, Int_t maxy, Int_t maxx,
1064 Float_t textSizeRel, TString nameOutput, RunInfo currRunInfo,
1065 int labelOpt = 1,
1066 TString additionalLabel = ""
1067 ){
1068 canvas2D->cd();
1069 SetStyleHistoTH1ForGraphs( histAll, histAll->GetXaxis()->GetTitle(), histAll->GetYaxis()->GetTitle(), 0.85*textSizeRel, textSizeRel, 0.85*textSizeRel, textSizeRel,0.9, 1.05);
1070
1071 SetMarkerDefaults(histAll, 20, 1, kBlue+1, kBlue+1, kFALSE);
1072
1073
1074 if (maxy > -10000)histAll->GetYaxis()->SetRangeUser(-0.5,maxy+0.1);
1075 if (maxx > -10000)histAll->GetXaxis()->SetRangeUser(0.5,maxx+0.1);
1076
1077 histAll->Draw("p,e");
1078 SetMarkerDefaults(histMuon, 25, 1, kGray+1, kGray+1, kFALSE);
1079 histMuon->Draw("p,e,same");
1080 SetMarkerDefaults(histPrim, 24, 1, kRed+1, kRed+1, kFALSE);
1081 histPrim->Draw("p,e,same");
1082
1083
1084 DrawLatex(0.95, 0.92, GetStringFromRunInfo(currRunInfo,labelOpt), true, 0.85*textSizeRel, 42);
1085 if (additionalLabel.CompareTo("") != 0){
1086 DrawLatex(0.95, 0.92-textSizeRel, additionalLabel, true, 0.85*textSizeRel, 42);
1087 }
1088
1089 TLegend* legend = GetAndSetLegend2( 0.11, 0.93-3*textSizeRel, 0.4, 0.93,0.85*textSizeRel, 1, "", 42,0.1);
1090 legend->AddEntry(histAll, "no evt. selection", "p");
1091 legend->AddEntry(histMuon, "muon events", "p");
1092 legend->AddEntry(histPrim, "remaining events", "p");
1093 legend->Draw();
1094
1095 canvas2D->SaveAs(nameOutput.Data());
1096 }
1097
1098
1099
1100
1101
1102 void PlotLayerOverlay( TCanvas* canvas2D,
1103 TH1D** histLayer, Float_t maxy, Float_t maxx, Float_t meanLayer, int maxLayer,
1104 Float_t textSizeRel, TString nameOutput, RunInfo currRunInfo,
1105 int labelOpt = 1,
1106 TString additionalLabel = "", bool frebin = true
1107 ){
1108 canvas2D->cd();
1109 canvas2D->SetLogy(1);
1110
1111 SetStyleHistoTH1ForGraphs( histLayer[0], histLayer[0]->GetXaxis()->GetTitle(), histLayer[0]->GetYaxis()->GetTitle(), 0.85*textSizeRel, textSizeRel, 0.85*textSizeRel, textSizeRel,0.9, 1.05);
1112
1113
1114 TString title = histLayer[0]->GetXaxis()->GetTitle();
1115 bool Exaxis = false;
1116 bool Posxaxis = false;
1117 bool NCellsxaxis = false;
1118 if (title.Contains("E_{layer}"))
1119 Exaxis = true;
1120 if (title.Contains("(cm)"))
1121 Posxaxis = true;
1122 if (title.Contains("N_{cells,layer}"))
1123 NCellsxaxis = true;
1124
1125 if (maxy > -10000 )
1126 histLayer[0]->GetYaxis()->SetRangeUser(1,maxy);
1127 if (maxx > -10000 && !Posxaxis){
1128 std::cout << "resetting x range: 0 - " << maxx << std::endl;
1129 histLayer[0]->GetXaxis()->SetRange(1,histLayer[0]->GetXaxis()->FindBin(maxx)+1);
1130 } else if (maxx > -10000 && Posxaxis){
1131 histLayer[0]->GetXaxis()->SetRange(histLayer[0]->GetXaxis()->FindBin(-maxx)-1,histLayer[0]->GetXaxis()->FindBin(maxx)+1);
1132 }
1133 histLayer[0]->DrawCopy("axis");
1134
1135 Setup* setup = Setup::GetInstance();
1136
1137 TLegend* legend = nullptr;
1138 Int_t lineBottom = (2+8);
1139 if (!(setup->GetNMaxLayer()+1 == 64))
1140 lineBottom = (2+4);
1141 else if ( setup->GetNMaxLayer()+1 == 64 && (NCellsxaxis || Posxaxis))
1142 lineBottom = (2+5);
1143
1144 if (setup->GetNMaxLayer()+1 == 64 && (NCellsxaxis || Posxaxis )){
1145 legend = GetAndSetLegend2( 0.11, 0.93-lineBottom*0.85*textSizeRel, 0.95, 0.93-2*0.85*textSizeRel,0.75*textSizeRel, 15, Form("Layer, #LTlayer#GT = %.2f",meanLayer), 42,0.4);
1146 } else if (setup->GetNMaxLayer()+1 == 64 ){
1147 legend = GetAndSetLegend2( 0.4, 0.93-lineBottom*0.85*textSizeRel, 0.95, 0.93-2*0.85*textSizeRel,0.75*textSizeRel, 8, Form("Layer, #LTlayer#GT = %.2f",meanLayer), 42,0.4);
1148 } else {
1149 legend = GetAndSetLegend2( 0.4, 0.93-lineBottom*0.85*textSizeRel, 0.95, 0.93-2*0.85*textSizeRel,0.75*textSizeRel, 5, Form("Layer, #LTlayer#GT = %.2f",meanLayer), 42,0.2);
1150 }
1151 for (int l = 0; l< setup->GetNMaxLayer()+1; l++){
1152 if (Exaxis & frebin)histLayer[l]->Rebin(4);
1153 SetLineDefaults(histLayer[l], GetColorLayer(l), 4, GetLineStyleLayer(l));
1154 histLayer[l]->Draw("same,hist");
1155 if (maxLayer == l)
1156 legend->AddEntry(histLayer[l],Form("#bf{%d}",l),"l");
1157 else
1158 legend->AddEntry(histLayer[l],Form("%d",l),"l");
1159 }
1160 histLayer[0]->DrawCopy("axis,same");
1161 legend->Draw();
1162
1163 DrawLatex(0.95, 0.92, Form("#it{#bf{LFHCal TB:} %s}",GetStringFromRunInfo(currRunInfo,7).Data()), true, 0.85*textSizeRel, 42);
1164 DrawLatex(0.95, 0.885, GetStringFromRunInfo(currRunInfo,labelOpt), true, 0.85*textSizeRel, 42);
1165 if (additionalLabel.CompareTo("") != 0){
1166 DrawLatex(0.95, 0.885-textSizeRel, additionalLabel, true, 0.85*textSizeRel, 42);
1167 }
1168 if ( setup->GetNMaxLayer()+1 == 64 && (NCellsxaxis || Posxaxis))
1169 lineBottom--;
1170 DrawLatex(0.95, 0.935-(lineBottom+1)*0.85*textSizeRel, "#bf{bold #} indicates max layer", true, 0.75*textSizeRel, 42);
1171
1172 canvas2D->SaveAs(nameOutput.Data());
1173 }
1174
1175
1176
1177
1178
1179 void PlotSimple2DZRange( TCanvas* canvas2D,
1180 TH2* hist, Int_t maxy, Int_t maxx, double minZ, double maxZ,
1181 Float_t textSizeRel, TString nameOutput, RunInfo currRunInfo,
1182 int labelOpt = 1, TString drwOpt ="colz",
1183 bool blegAbove = false, TString additionalLabel = ""
1184 ){
1185 canvas2D->cd();
1186 SetStyleHistoTH2ForGraphs( hist, hist->GetXaxis()->GetTitle(), hist->GetYaxis()->GetTitle(), 0.85*textSizeRel, textSizeRel, 0.85*textSizeRel, textSizeRel,0.9, 1.05);
1187 hist->GetZaxis()->SetLabelSize(0.85*textSizeRel);
1188 hist->GetZaxis()->SetTitleOffset(1.06);
1189 hist->GetZaxis()->SetTitleSize(textSizeRel);
1190
1191
1192 if (maxy > -10000)hist->GetYaxis()->SetRangeUser(-0.5,maxy+0.1);
1193 if (maxx > -10000)hist->GetXaxis()->SetRangeUser(0.5,maxx+0.1);
1194 hist->GetZaxis()->SetRangeUser(minZ,maxZ);
1195
1196 if (((TString)hist->GetZaxis()->GetTitle()).Contains("counts")){
1197 gStyle->SetPaintTextFormat(".0f");
1198 std::cout << "entered counts case" << std::endl;
1199 } else {
1200 gStyle->SetPaintTextFormat(".3f");
1201 }
1202 hist->Draw(drwOpt.Data());
1203
1204 if (!blegAbove)
1205 DrawLatex(0.85, 0.92, GetStringFromRunInfo(currRunInfo,labelOpt), true, 0.85*textSizeRel, 42);
1206 else
1207 DrawLatex(0.92, 0.97, GetStringFromRunInfo(currRunInfo,labelOpt), true, 0.85*textSizeRel, 42);
1208
1209 if (additionalLabel.CompareTo("") != 0){
1210 if (!blegAbove)
1211 DrawLatex(0.11, 0.92, additionalLabel, false, 0.85*textSizeRel, 42);
1212 else
1213 DrawLatex(0.08, 0.97, additionalLabel, false, 0.85*textSizeRel, 42);
1214 }
1215 canvas2D->SaveAs(nameOutput.Data());
1216 }
1217
1218
1219
1220
1221 void ReturnCorrectValuesForCanvasScaling( Int_t sizeX,
1222 Int_t sizeY,
1223 Int_t nCols,
1224 Int_t nRows,
1225 Double_t leftMargin,
1226 Double_t rightMargin,
1227 Double_t upperMargin,
1228 Double_t lowerMargin,
1229 Double_t* arrayBoundariesX,
1230 Double_t* arrayBoundariesY,
1231 Double_t* relativeMarginsX,
1232 Double_t* relativeMarginsY,
1233 int verbose = 1){
1234 Int_t realsizeX = sizeX- (Int_t)(sizeX*leftMargin)- (Int_t)(sizeX*rightMargin);
1235 Int_t realsizeY = sizeY- (Int_t)(sizeY*upperMargin)- (Int_t)(sizeY*lowerMargin);
1236
1237 Int_t nPixelsLeftColumn = (Int_t)(sizeX*leftMargin);
1238 Int_t nPixelsRightColumn = (Int_t)(sizeX*rightMargin);
1239 Int_t nPixelsUpperColumn = (Int_t)(sizeY*upperMargin);
1240 Int_t nPixelsLowerColumn = (Int_t)(sizeY*lowerMargin);
1241
1242 Int_t nPixelsSinglePlotX = (Int_t) (realsizeX/nCols);
1243 Int_t nPixelsSinglePlotY = (Int_t) (realsizeY/nRows);
1244 if(verbose > 0){
1245 std::cout << "Setup multi panel canvas"<< std::endl;
1246 std::cout << "X: "<< realsizeX << "\t" << nPixelsSinglePlotX << std::endl;
1247 std::cout << "Y: "<< realsizeY << "\t" << nPixelsSinglePlotY << std::endl;
1248 std::cout << "columns:"<< nPixelsLeftColumn << "\t" << nPixelsRightColumn << "\t" << nPixelsLowerColumn << "\t" << nPixelsUpperColumn << std::endl;
1249 }
1250 Int_t pixel = 0;
1251 if(verbose > 1)std::cout << "boundaries X" << std::endl;
1252 for (Int_t i = 0; i < nCols+1; i++){
1253 if (i == 0){
1254 arrayBoundariesX[i] = 0.;
1255 pixel = pixel+nPixelsLeftColumn+nPixelsSinglePlotX;
1256 } else if (i == nCols){
1257 arrayBoundariesX[i] = 1.;
1258 pixel = pixel+nPixelsRightColumn;
1259 } else {
1260 arrayBoundariesX[i] = (Double_t)pixel/sizeX;
1261 pixel = pixel+nPixelsSinglePlotX;
1262 }
1263 if(verbose > 1)std::cout << "arrayBoundariesX: " << i << "\t" << arrayBoundariesX[i] << "\t" << pixel<<std::endl;
1264 }
1265
1266 if(verbose > 1)std::cout << "boundaries Y" << std::endl;
1267 pixel = sizeY;
1268 for (Int_t i = 0; i < nRows+1; i++){
1269 if (i == 0){
1270 arrayBoundariesY[i] = 1.;
1271 pixel = pixel-nPixelsUpperColumn-nPixelsSinglePlotY;
1272 } else if (i == nRows){
1273 arrayBoundariesY[i] = 0.;
1274 pixel = pixel-nPixelsLowerColumn;
1275 } else {
1276 arrayBoundariesY[i] = (Double_t)pixel/sizeY;
1277 pixel = pixel-nPixelsSinglePlotY;
1278 }
1279 if(verbose > 1)std::cout << i << "\t" << arrayBoundariesY[i] <<"\t" << pixel<<std::endl;
1280 }
1281
1282 relativeMarginsX[0] = (Double_t)nPixelsLeftColumn/(nPixelsLeftColumn+nPixelsSinglePlotX);
1283 relativeMarginsX[1] = 0;
1284 relativeMarginsX[2] = (Double_t)nPixelsRightColumn/(nPixelsRightColumn+nPixelsSinglePlotX);;
1285
1286 relativeMarginsY[0] = (Double_t)nPixelsUpperColumn/(nPixelsUpperColumn+nPixelsSinglePlotY);
1287 relativeMarginsY[1] = 0;
1288 relativeMarginsY[2] = (Double_t)nPixelsLowerColumn/(nPixelsLowerColumn+nPixelsSinglePlotY);;
1289
1290 return;
1291 }
1292
1293
1294 void ReturnCorrectValuesTextSize( TPad * pad,
1295 Double_t &textsizeLabels,
1296 Double_t &textsizeFac,
1297 Int_t textSizeLabelsPixel,
1298 Double_t dummyWUP){
1299 if(dummyWUP){}
1300
1301 textsizeLabels = 0;
1302 textsizeFac = 0;
1303 if (pad->XtoPixel(pad->GetX2()) < pad->YtoPixel(pad->GetY1())){
1304 textsizeLabels = (Double_t)textSizeLabelsPixel/pad->XtoPixel(pad->GetX2()) ;
1305 textsizeFac = (Double_t)1./pad->XtoPixel(pad->GetX2()) ;
1306 } else {
1307 textsizeLabels = (Double_t)textSizeLabelsPixel/pad->YtoPixel(pad->GetY1());
1308 textsizeFac = (Double_t)1./pad->YtoPixel(pad->GetY1());
1309 }
1310 std::cout << textsizeLabels << std::endl;
1311 std::cout << textsizeFac << std::endl;
1312
1313 return;
1314
1315 }
1316
1317
1318
1319
1320 void CreateCanvasAndPadsFor8PannelTBPlot(TCanvas* &canvas, TPad* pads[8], Double_t* topRCornerX, Double_t* topRCornerY, Double_t* relSize8P, Int_t textSizePixel = 30, Double_t marginLeft = 0.03, TString add = "", bool rightCorner = true, int debug = 0){
1321 Double_t arrayBoundsXIndMeasRatio[5];
1322 Double_t arrayBoundsYIndMeasRatio[3];
1323 Double_t relativeMarginsIndMeasRatioX[3];
1324 Double_t relativeMarginsIndMeasRatioY[3];
1325 ReturnCorrectValuesForCanvasScaling(2200,1200, 4, 2,marginLeft, 0.005, 0.005,0.05,arrayBoundsXIndMeasRatio,arrayBoundsYIndMeasRatio,relativeMarginsIndMeasRatioX,relativeMarginsIndMeasRatioY, debug);
1326
1327 canvas = new TCanvas(Form("canvas8Panel%s", add.Data()),"",0,0,2200,1200);
1328 canvas->cd();
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341 pads[0] = new TPad(Form("pad8Pane%sl_0", add.Data()), "", arrayBoundsXIndMeasRatio[0], arrayBoundsYIndMeasRatio[2], arrayBoundsXIndMeasRatio[1], arrayBoundsYIndMeasRatio[1],-1, -1, -2);
1342 pads[1] = new TPad(Form("pad8Pane%sl_1", add.Data()), "", arrayBoundsXIndMeasRatio[1], arrayBoundsYIndMeasRatio[2], arrayBoundsXIndMeasRatio[2], arrayBoundsYIndMeasRatio[1],-1, -1, -2);
1343 pads[2] = new TPad(Form("pad8Pane%sl_2", add.Data()), "", arrayBoundsXIndMeasRatio[2], arrayBoundsYIndMeasRatio[2], arrayBoundsXIndMeasRatio[3], arrayBoundsYIndMeasRatio[1],-1, -1, -2);
1344 pads[3] = new TPad(Form("pad8Pane%sl_3", add.Data()), "", arrayBoundsXIndMeasRatio[3], arrayBoundsYIndMeasRatio[2], arrayBoundsXIndMeasRatio[4], arrayBoundsYIndMeasRatio[1],-1, -1, -2);
1345 pads[4] = new TPad(Form("pad8Pane%sl_4", add.Data()), "", arrayBoundsXIndMeasRatio[0], arrayBoundsYIndMeasRatio[1],arrayBoundsXIndMeasRatio[1], arrayBoundsYIndMeasRatio[0],-1, -1, -2);
1346 pads[5] = new TPad(Form("pad8Pane%sl_4", add.Data()), "", arrayBoundsXIndMeasRatio[1], arrayBoundsYIndMeasRatio[1],arrayBoundsXIndMeasRatio[2], arrayBoundsYIndMeasRatio[0],-1, -1, -2);
1347 pads[6] = new TPad(Form("pad8Pane%sl_4", add.Data()), "", arrayBoundsXIndMeasRatio[2], arrayBoundsYIndMeasRatio[1],arrayBoundsXIndMeasRatio[3], arrayBoundsYIndMeasRatio[0],-1, -1, -2);
1348 pads[7] = new TPad(Form("pad8Pane%sl_4", add.Data()), "", arrayBoundsXIndMeasRatio[3], arrayBoundsYIndMeasRatio[1],arrayBoundsXIndMeasRatio[4], arrayBoundsYIndMeasRatio[0],-1, -1, -2);
1349
1350 DefaultPadSettings( pads[4], relativeMarginsIndMeasRatioX[0], relativeMarginsIndMeasRatioX[1], relativeMarginsIndMeasRatioY[0], relativeMarginsIndMeasRatioY[1]);
1351 DefaultPadSettings( pads[5], relativeMarginsIndMeasRatioX[1], relativeMarginsIndMeasRatioX[1], relativeMarginsIndMeasRatioY[0], relativeMarginsIndMeasRatioY[1]);
1352 DefaultPadSettings( pads[6], relativeMarginsIndMeasRatioX[1], relativeMarginsIndMeasRatioX[1], relativeMarginsIndMeasRatioY[0], relativeMarginsIndMeasRatioY[1]);
1353 DefaultPadSettings( pads[7], relativeMarginsIndMeasRatioX[1], relativeMarginsIndMeasRatioX[2], relativeMarginsIndMeasRatioY[0], relativeMarginsIndMeasRatioY[1]);
1354 DefaultPadSettings( pads[0], relativeMarginsIndMeasRatioX[0], relativeMarginsIndMeasRatioX[1], relativeMarginsIndMeasRatioY[1], relativeMarginsIndMeasRatioY[2]);
1355 DefaultPadSettings( pads[1], relativeMarginsIndMeasRatioX[1], relativeMarginsIndMeasRatioX[1], relativeMarginsIndMeasRatioY[1], relativeMarginsIndMeasRatioY[2]);
1356 DefaultPadSettings( pads[2], relativeMarginsIndMeasRatioX[1], relativeMarginsIndMeasRatioX[1], relativeMarginsIndMeasRatioY[1], relativeMarginsIndMeasRatioY[2]);
1357 DefaultPadSettings( pads[3], relativeMarginsIndMeasRatioX[1], relativeMarginsIndMeasRatioX[2], relativeMarginsIndMeasRatioY[1], relativeMarginsIndMeasRatioY[2]);
1358
1359 topRCornerY[0] = 1-relativeMarginsIndMeasRatioY[1];
1360 topRCornerY[1] = 1-relativeMarginsIndMeasRatioY[1];
1361 topRCornerY[2] = 1-relativeMarginsIndMeasRatioY[1];
1362 topRCornerY[3] = 1-relativeMarginsIndMeasRatioY[1];
1363 topRCornerY[4] = 1-relativeMarginsIndMeasRatioY[0];
1364 topRCornerY[5] = 1-relativeMarginsIndMeasRatioY[0];
1365 topRCornerY[6] = 1-relativeMarginsIndMeasRatioY[0];
1366 topRCornerY[7] = 1-relativeMarginsIndMeasRatioY[0];
1367 if (rightCorner){
1368 topRCornerX[0] = 1-relativeMarginsIndMeasRatioX[1];
1369 topRCornerX[1] = 1-relativeMarginsIndMeasRatioX[1];
1370 topRCornerX[2] = 1-relativeMarginsIndMeasRatioX[1];
1371 topRCornerX[3] = 1-relativeMarginsIndMeasRatioX[2];
1372 topRCornerX[4] = 1-relativeMarginsIndMeasRatioX[1];
1373 topRCornerX[5] = 1-relativeMarginsIndMeasRatioX[1];
1374 topRCornerX[6] = 1-relativeMarginsIndMeasRatioX[1];
1375 topRCornerX[7] = 1-relativeMarginsIndMeasRatioX[2];
1376 } else {
1377 topRCornerX[0] = relativeMarginsIndMeasRatioX[0];
1378 topRCornerX[1] = relativeMarginsIndMeasRatioX[1];
1379 topRCornerX[2] = relativeMarginsIndMeasRatioX[1];
1380 topRCornerX[3] = relativeMarginsIndMeasRatioX[1];
1381 topRCornerX[4] = relativeMarginsIndMeasRatioX[0];
1382 topRCornerX[5] = relativeMarginsIndMeasRatioX[1];
1383 topRCornerX[6] = relativeMarginsIndMeasRatioX[1];
1384 topRCornerX[7] = relativeMarginsIndMeasRatioX[1];
1385 }
1386
1387 for (Int_t p = 0; p < 8; p++){
1388 if (pads[p]->XtoPixel(pads[p]->GetX2()) < pads[p]->YtoPixel(pads[p]->GetY1())){
1389 relSize8P[p] = (Double_t)textSizePixel/pads[p]->XtoPixel(pads[p]->GetX2()) ;
1390 } else {
1391 relSize8P[p] = (Double_t)textSizePixel/pads[p]->YtoPixel(pads[p]->GetY1());
1392 }
1393 if(debug > 1)std::cout << p << "\t" << topRCornerX[p]<< "\t" << topRCornerY[p] << "\t" << relSize8P[p] << std::endl;
1394 }
1395 return;
1396 }
1397
1398
1399
1400
1401
1402 void PlotNoiseWithFitsFullLayer (TCanvas* canvas8Panel, TPad* pads[8], Double_t* topRCornerX, Double_t* topRCornerY, Double_t* relSize8P, Int_t textSizePixel,
1403 std::map<int,TileSpectra> spectra, Setup* setupT, bool isHG,
1404 Double_t xPMin, Double_t xPMax, Double_t scaleYMax, int layer, int mod, TString nameOutput, RunInfo currRunInfo){
1405
1406 Double_t maxY = 0;
1407 std::map<int, TileSpectra>::iterator ithSpectra;
1408
1409 int nRow = setupT->GetNMaxRow()+1;
1410 int nCol = setupT->GetNMaxColumn()+1;
1411 int skipped = 0;
1412 for (int r = 0; r < nRow; r++){
1413 for (int c = 0; c < nCol; c++){
1414 int tempCellID = setupT->GetCellID(r,c, layer, mod);
1415 ithSpectra=spectra.find(tempCellID);
1416 if(ithSpectra==spectra.end()){
1417 std::cout << "WARNING: skipping cell ID: " << tempCellID << "\t row " << r << "\t column " << c << "\t layer " << layer << "\t module " << mod << std::endl;
1418 skipped++;
1419 continue;
1420 }
1421 TH1D* tempHist = nullptr;
1422 if (isHG){
1423 tempHist = ithSpectra->second.GetHG();
1424 } else {
1425 tempHist = ithSpectra->second.GetLG();
1426 }
1427 if (maxY < FindLargestBin1DHist(tempHist, xPMin , xPMax)) maxY = FindLargestBin1DHist(tempHist, xPMin , xPMax);
1428 }
1429 }
1430
1431 for (int r = 0; r < nRow; r++){
1432 for (int c = 0; c < nCol; c++){
1433 canvas8Panel->cd();
1434 int tempCellID = setupT->GetCellID(r,c, layer, mod);
1435 int p = setupT->GetChannelInLayer(tempCellID);
1436 pads[p]->Draw();
1437 pads[p]->cd();
1438 pads[p]->SetLogy();
1439 ithSpectra=spectra.find(tempCellID);
1440 if(ithSpectra==spectra.end()){
1441 std::cout << "WARNING: skipping cell ID: " << tempCellID << "\t row " << r << "\t column " << c << "\t layer " << layer << "\t module " << mod << std::endl;
1442 pads[p]->Clear();
1443 pads[p]->Draw();
1444 if (p ==7 ){
1445 DrawLatex(topRCornerX[p]-0.04, topRCornerY[p]-4*0.85*relSize8P[p]-1.4*relSize8P[p], GetStringFromRunInfo(currRunInfo, 2), true, 0.85*relSize8P[p], 42);
1446 DrawLatex(topRCornerX[p]-0.04, topRCornerY[p]-4*0.85*relSize8P[p]-2.2*relSize8P[p], GetStringFromRunInfo(currRunInfo, 3), true, 0.85*relSize8P[p], 42);
1447 }
1448 continue;
1449 }
1450 TH1D* tempHist = nullptr;
1451 if (isHG){
1452 tempHist = ithSpectra->second.GetHG();
1453 } else {
1454 tempHist = ithSpectra->second.GetLG();
1455 }
1456 SetStyleHistoTH1ForGraphs( tempHist, tempHist->GetXaxis()->GetTitle(), tempHist->GetYaxis()->GetTitle(), 0.85*textSizePixel, textSizePixel, 0.85*textSizePixel, textSizePixel,0.9, 1.1, 510, 510, 43, 63);
1457 SetMarkerDefaults(tempHist, 20, 1, kBlue+1, kBlue+1, kFALSE);
1458 tempHist->GetXaxis()->SetRangeUser(xPMin,xPMax);
1459 tempHist->GetYaxis()->SetRangeUser(0.7,scaleYMax*maxY);
1460
1461 tempHist->Draw("pe");
1462 short bctemp = ithSpectra->second.GetCalib()->BadChannel;
1463 if (bctemp != -64 && bctemp < 3){
1464 Color_t boxCol = kGray;
1465 if (bctemp == 1)
1466 boxCol = kGray+1;
1467 else if (bctemp == 0)
1468 boxCol = kGray+2;
1469 TBox* badChannelArea = CreateBox(boxCol, xPMin, 0.7, xPMax,scaleYMax*maxY, 1001 );
1470 badChannelArea->SetFillColorAlpha(boxCol, 0.35);
1471 badChannelArea->Draw();
1472 tempHist->Draw("same,axis");
1473 tempHist->Draw("same,pe");
1474 }
1475
1476 TString label = Form("row %d col %d", r, c);
1477 if (p == 7){
1478 label = Form("row %d col %d layer %d", r, c, layer);
1479 }
1480 TLatex *labelChannel = new TLatex(topRCornerX[p]-0.04,topRCornerY[p]-1.2*relSize8P[p],label);
1481 SetStyleTLatex( labelChannel, 0.85*textSizePixel,4,1,43,kTRUE,31);
1482
1483
1484 TF1* fit = nullptr;
1485 if (isHG){
1486 fit = ithSpectra->second.GetBackModel(1);
1487 } else {
1488 fit = ithSpectra->second.GetBackModel(0);
1489 }
1490 if (fit){
1491 SetStyleFit(fit , xPMin, xPMax, 7, 7, kBlack);
1492 fit->Draw("same");
1493 TLegend* legend = GetAndSetLegend2( topRCornerX[p]-8*relSize8P[p], topRCornerY[p]-4*0.85*relSize8P[p]-0.4*relSize8P[p], topRCornerX[p]-0.04, topRCornerY[p]-0.6*relSize8P[p],0.85*textSizePixel, 1, label, 43,0.2);
1494 legend->AddEntry(fit, "Gauss noise fit", "l");
1495 legend->AddEntry((TObject*)0, Form("#mu = %2.2f #pm %2.2f",fit->GetParameter(1), fit->GetParError(1) ) , " ");
1496 legend->AddEntry((TObject*)0, Form("#sigma = %2.2f #pm %2.2f",fit->GetParameter(2), fit->GetParError(2) ) , " ");
1497 legend->Draw();
1498
1499 } else {
1500 labelChannel->Draw();
1501 }
1502
1503 if (xPMin < -5) DrawLines(0, 0,0.7, scaleYMax*maxY, 2, kGray+1, 10);
1504
1505 if (p ==7 ){
1506 DrawLatex(topRCornerX[p]-0.04, topRCornerY[p]-4*0.85*relSize8P[p]-1.4*relSize8P[p], GetStringFromRunInfo(currRunInfo, 2), true, 0.85*relSize8P[p], 42);
1507 DrawLatex(topRCornerX[p]-0.04, topRCornerY[p]-4*0.85*relSize8P[p]-2.2*relSize8P[p], GetStringFromRunInfo(currRunInfo, 3), true, 0.85*relSize8P[p], 42);
1508 }
1509 }
1510 }
1511 if (skipped < 6)
1512 canvas8Panel->SaveAs(nameOutput.Data());
1513 }
1514
1515
1516
1517
1518
1519 void PlotNoiseAdvWithFitsFullLayer (TCanvas* canvas8Panel, TPad* pads[8], Double_t* topRCornerX, Double_t* topRCornerY, Double_t* relSize8P, Int_t textSizePixel,
1520 std::map<int,TileSpectra> spectra, std::map<int,TileSpectra> spectraTrigg, bool isHG,
1521 Double_t xPMin, Double_t xPMax, Double_t scaleYMax, int layer, int mod, TString nameOutput, RunInfo currRunInfo){
1522
1523 Double_t maxY = 0;
1524 std::map<int, TileSpectra>::iterator ithSpectra;
1525 std::map<int, TileSpectra>::iterator ithSpectraTrigg;
1526
1527 Setup* setupT = Setup::GetInstance();
1528 int nRow = setupT->GetNMaxRow()+1;
1529 int nCol = setupT->GetNMaxColumn()+1;
1530 int skipped = 0;
1531 for (int r = 0; r < nRow; r++){
1532 for (int c = 0; c < nCol; c++){
1533 int tempCellID = setupT->GetCellID(r,c, layer, mod);
1534 ithSpectra=spectra.find(tempCellID);
1535 if(ithSpectra==spectra.end()){
1536 std::cout << "WARNING: skipping cell ID: " << tempCellID << "\t row " << r << "\t column " << c << "\t layer " << layer << "\t module " << mod << std::endl;
1537 continue;
1538 }
1539 TH1D* tempHist = nullptr;
1540 if (isHG){
1541 tempHist = ithSpectra->second.GetHG();
1542 } else {
1543 tempHist = ithSpectra->second.GetLG();
1544 }
1545 if (maxY < FindLargestBin1DHist(tempHist, xPMin , xPMax)) maxY = FindLargestBin1DHist(tempHist, xPMin , xPMax);
1546 }
1547 }
1548 for (int r = 0; r < nRow; r++){
1549 for (int c = 0; c < nCol; c++){
1550 canvas8Panel->cd();
1551 int tempCellID = setupT->GetCellID(r,c, layer, mod);
1552 int p = setupT->GetChannelInLayer(tempCellID);
1553 pads[p]->Draw();
1554 pads[p]->cd();
1555 pads[p]->SetLogy();
1556 ithSpectra=spectra.find(tempCellID);
1557 if(ithSpectra==spectra.end()){
1558 skipped++;
1559 std::cout << "WARNING: skipping cell ID: " << tempCellID << "\t row " << r << "\t column " << c << "\t layer " << layer << "\t module " << mod << std::endl;
1560 pads[p]->Clear();
1561 pads[p]->Draw();
1562 if (p ==7 ){
1563 DrawLatex(topRCornerX[p]-0.045, topRCornerY[p]-4*0.85*relSize8P[p]-1.4*relSize8P[p], GetStringFromRunInfo(currRunInfo, 2), true, 0.85*relSize8P[p], 42);
1564 DrawLatex(topRCornerX[p]-0.045, topRCornerY[p]-4*0.85*relSize8P[p]-2.2*relSize8P[p], GetStringFromRunInfo(currRunInfo, 3), true, 0.85*relSize8P[p], 42);
1565 }
1566 continue;
1567 }
1568 ithSpectraTrigg=spectraTrigg.find(tempCellID);
1569 TH1D* tempHist = nullptr;
1570 if (isHG){
1571 tempHist = ithSpectra->second.GetHG();
1572 } else {
1573 tempHist = ithSpectra->second.GetLG();
1574 }
1575 SetStyleHistoTH1ForGraphs( tempHist, tempHist->GetXaxis()->GetTitle(), tempHist->GetYaxis()->GetTitle(), 0.85*textSizePixel, textSizePixel, 0.85*textSizePixel, textSizePixel,0.9, 1.1, 510, 510, 43, 63);
1576 SetMarkerDefaults(tempHist, 20, 1, kBlue+1, kBlue+1, kFALSE);
1577 tempHist->GetXaxis()->SetRangeUser(xPMin,xPMax);
1578 tempHist->GetYaxis()->SetRangeUser(0.7,scaleYMax*maxY);
1579
1580 tempHist->Draw("pe");
1581 short bctemp = ithSpectra->second.GetCalib()->BadChannel;
1582 if (bctemp != -64 && bctemp < 3){
1583 Color_t boxCol = kGray;
1584 if (bctemp == 1)
1585 boxCol = kGray+1;
1586 else if (bctemp == 0)
1587 boxCol = kGray+2;
1588 TBox* badChannelArea = CreateBox(boxCol, xPMin, 0.7, xPMax,scaleYMax*maxY, 1001 );
1589 badChannelArea->Draw();
1590 tempHist->Draw("same,axis");
1591 tempHist->Draw("same,pe");
1592 }
1593
1594 TH1D* tempHistT = nullptr;
1595 if (isHG){
1596 tempHistT = ithSpectraTrigg->second.GetHG();
1597 } else {
1598 tempHistT = ithSpectraTrigg->second.GetLG();
1599 }
1600 SetMarkerDefaults(tempHistT, 24, 1, kRed+1, kRed+1, kFALSE);
1601 tempHistT->Draw("same,pe");
1602
1603 TString label = Form("row %d col %d", r, c);
1604 if (p == 7){
1605 label = Form("row %d col %d layer %d", r, c, layer);
1606 }
1607 TLatex *labelChannel = new TLatex(topRCornerX[p]-0.045,topRCornerY[p]-1.2*relSize8P[p],label);
1608 SetStyleTLatex( labelChannel, 0.85*textSizePixel,4,1,43,kTRUE,31);
1609
1610
1611 TF1* fit = nullptr;
1612 bool isTrigFit = false;
1613 if (isHG){
1614 fit = ithSpectraTrigg->second.GetBackModel(1);
1615 if (!fit){
1616 fit = ithSpectra->second.GetBackModel(1);
1617
1618 } else {
1619 isTrigFit = true;
1620 }
1621 } else {
1622 fit = ithSpectraTrigg->second.GetBackModel(0);
1623 if (!fit){
1624 fit = ithSpectra->second.GetBackModel(0);
1625 } else {
1626 isTrigFit = true;
1627 }
1628 }
1629 if (fit){
1630 if (isTrigFit)
1631 SetStyleFit(fit , 0, 2000, 7, 3, kRed+3);
1632 else
1633 SetStyleFit(fit , 0, 2000, 7, 7, kBlue+3);
1634 fit->Draw("same");
1635 TLegend* legend = GetAndSetLegend2( topRCornerX[p]-10*relSize8P[p], topRCornerY[p]-4*0.85*relSize8P[p]-0.4*relSize8P[p], topRCornerX[p]-0.04, topRCornerY[p]-0.6*relSize8P[p],0.85*textSizePixel, 1, label, 43,0.1);
1636 if (isTrigFit)
1637 legend->AddEntry(fit, "Gauss noise fit, trigg.", "l");
1638 else
1639 legend->AddEntry(fit, "Gauss noise fit", "l");
1640 legend->AddEntry((TObject*)0, Form("#mu = %2.2f #pm %2.2f",fit->GetParameter(1), fit->GetParError(1) ) , " ");
1641 legend->AddEntry((TObject*)0, Form("#sigma = %2.2f #pm %2.2f",fit->GetParameter(2), fit->GetParError(2) ) , " ");
1642 legend->Draw();
1643 } else {
1644 labelChannel->Draw();
1645 }
1646
1647 DrawLines(0, 0,0.7, scaleYMax*maxY, 2, kGray+1, 10);
1648 if (p ==7 ){
1649 DrawLatex(topRCornerX[p]-0.045, topRCornerY[p]-4*0.85*relSize8P[p]-1.4*relSize8P[p], GetStringFromRunInfo(currRunInfo, 2), true, 0.85*relSize8P[p], 42);
1650 DrawLatex(topRCornerX[p]-0.045, topRCornerY[p]-4*0.85*relSize8P[p]-2.2*relSize8P[p], GetStringFromRunInfo(currRunInfo, 3), true, 0.85*relSize8P[p], 42);
1651 }
1652
1653 }
1654 }
1655 if (skipped < 6)
1656 canvas8Panel->SaveAs(nameOutput.Data());
1657 }
1658
1659
1660
1661
1662
1663 void PlotMipWithFitsFullLayer (TCanvas* canvas8Panel, TPad* pads[8], Double_t* topRCornerX, Double_t* topRCornerY, Double_t* relSize8P, Int_t textSizePixel,
1664 std::map<int,TileSpectra> spectra, std::map<int,TileSpectra> spectraTrigg, Setup* setupT, bool isHG,
1665 Double_t xPMin, Double_t xPMax, Double_t scaleYMax, int layer, int mod, TString nameOutput, RunInfo currRunInfo){
1666
1667 Double_t maxY = 0;
1668 std::map<int, TileSpectra>::iterator ithSpectra;
1669 std::map<int, TileSpectra>::iterator ithSpectraTrigg;
1670
1671 int nRow = setupT->GetNMaxRow()+1;
1672 int nCol = setupT->GetNMaxColumn()+1;
1673 int skipped = 0;
1674 for (int r = 0; r < nRow; r++){
1675 for (int c = 0; c < nCol; c++){
1676 int tempCellID = setupT->GetCellID(r,c, layer, mod);
1677 ithSpectra=spectra.find(tempCellID);
1678 if(ithSpectra==spectra.end()){
1679 std::cout << "WARNING: skipping cell ID: " << tempCellID << "\t row " << r << "\t column " << c << "\t layer " << layer << "\t module " << mod << std::endl;
1680 continue;
1681 }
1682 TH1D* tempHist = nullptr;
1683 if (isHG){
1684 tempHist = ithSpectra->second.GetHG();
1685 } else {
1686 tempHist = ithSpectra->second.GetLG();
1687 }
1688 if (maxY < FindLargestBin1DHist(tempHist, xPMin , xPMax)) maxY = FindLargestBin1DHist(tempHist, xPMin , xPMax);
1689 }
1690 }
1691
1692 for (int r = 0; r < nRow; r++){
1693 for (int c = 0; c < nCol; c++){
1694 canvas8Panel->cd();
1695 int tempCellID = setupT->GetCellID(r,c, layer, mod);
1696 int p = setupT->GetChannelInLayer(tempCellID);
1697 pads[p]->Draw();
1698 pads[p]->cd();
1699 pads[p]->SetLogy();
1700 ithSpectra=spectra.find(tempCellID);
1701 if(ithSpectra==spectra.end()){
1702 skipped++;
1703 std::cout << "WARNING: skipping cell ID: " << tempCellID << "\t row " << r << "\t column " << c << "\t layer " << layer << "\t module " << mod << std::endl;
1704 pads[p]->Clear();
1705 pads[p]->Draw();
1706 if (p ==7 ){
1707 DrawLatex(topRCornerX[p]-0.045, topRCornerY[p]-4*0.85*relSize8P[p]-1.4*relSize8P[p], GetStringFromRunInfo(currRunInfo, 2), true, 0.85*relSize8P[p], 42);
1708 DrawLatex(topRCornerX[p]-0.045, topRCornerY[p]-4*0.85*relSize8P[p]-2.2*relSize8P[p], GetStringFromRunInfo(currRunInfo, 3), true, 0.85*relSize8P[p], 42);
1709 }
1710 continue;
1711 }
1712 ithSpectraTrigg=spectraTrigg.find(tempCellID);
1713 TH1D* tempHist = nullptr;
1714 double noiseWidth = 0;
1715 if (isHG){
1716 tempHist = ithSpectra->second.GetHG();
1717 noiseWidth = ithSpectra->second.GetCalib()->PedestalSigH;
1718 } else {
1719 tempHist = ithSpectra->second.GetLG();
1720 noiseWidth = ithSpectra->second.GetCalib()->PedestalSigL;
1721 }
1722 SetStyleHistoTH1ForGraphs( tempHist, tempHist->GetXaxis()->GetTitle(), tempHist->GetYaxis()->GetTitle(), 0.85*textSizePixel, textSizePixel, 0.85*textSizePixel, textSizePixel,0.9, 1.1, 510, 510, 43, 63);
1723 SetMarkerDefaults(tempHist, 20, 1, kBlue+1, kBlue+1, kFALSE);
1724 tempHist->GetXaxis()->SetRangeUser(xPMin,xPMax);
1725 tempHist->GetYaxis()->SetRangeUser(0.7,scaleYMax*maxY);
1726
1727 tempHist->Draw("pe");
1728 short bctemp = ithSpectra->second.GetCalib()->BadChannel;
1729 if (bctemp != -64 && bctemp < 3){
1730 Color_t boxCol = kGray;
1731 if (bctemp == 1)
1732 boxCol = kGray+1;
1733 else if (bctemp == 0)
1734 boxCol = kGray+2;
1735 TBox* badChannelArea = CreateBox(boxCol, xPMin, 0.7, xPMax,scaleYMax*maxY, 1001 );
1736 badChannelArea->Draw();
1737 tempHist->Draw("same,axis");
1738 tempHist->Draw("same,pe");
1739 }
1740
1741 TH1D* tempHistT = nullptr;
1742
1743 if (isHG){
1744 tempHistT = ithSpectraTrigg->second.GetHG();
1745 } else {
1746 tempHistT = ithSpectraTrigg->second.GetLG();
1747 }
1748 SetMarkerDefaults(tempHistT, 24, 1, kRed+1, kRed+1, kFALSE);
1749 tempHistT->Draw("same,pe");
1750
1751 TString label = Form("row %d col %d", r, c);
1752 if (p == 7){
1753 label = Form("row %d col %d layer %d", r, c, layer);
1754 }
1755 TLatex *labelChannel = new TLatex(topRCornerX[p]-0.045,topRCornerY[p]-1.2*relSize8P[p],label);
1756 SetStyleTLatex( labelChannel, 0.85*textSizePixel,4,1,43,kTRUE,31);
1757
1758
1759 TF1* fit = nullptr;
1760 bool isTrigFit = false;
1761 double maxFit = 0;
1762 if (isHG){
1763 fit = ithSpectraTrigg->second.GetSignalModel(1);
1764 if (!fit){
1765 fit = ithSpectra->second.GetSignalModel(1);
1766 if (fit){
1767 maxFit = ithSpectra->second.GetCalib()->ScaleH;
1768 }
1769 } else {
1770 isTrigFit = true;
1771 maxFit = ithSpectraTrigg->second.GetCalib()->ScaleH;
1772 }
1773 } else {
1774 fit = ithSpectraTrigg->second.GetSignalModel(0);
1775 if (!fit){
1776 fit = ithSpectra->second.GetSignalModel(0);
1777 if (fit){
1778 maxFit = ithSpectra->second.GetCalib()->ScaleL;
1779 }
1780 } else {
1781 isTrigFit = true;
1782 maxFit = ithSpectraTrigg->second.GetCalib()->ScaleL;
1783 }
1784 }
1785 if (fit){
1786 if (isTrigFit)
1787 SetStyleFit(fit , 0, 2000, 7, 3, kRed+3);
1788 else
1789 SetStyleFit(fit , 0, 2000, 7, 7, kBlue+3);
1790 fit->Draw("same");
1791 TLegend* legend = GetAndSetLegend2( topRCornerX[p]-10*relSize8P[p], topRCornerY[p]-4*0.85*relSize8P[p]-0.4*relSize8P[p], topRCornerX[p]-0.04, topRCornerY[p]-0.6*relSize8P[p],0.85*textSizePixel, 1, label, 43,0.1);
1792 if (isTrigFit)
1793 legend->AddEntry(fit, "Landau-Gauss fit, trigg.", "l");
1794 else
1795 legend->AddEntry(fit, "Landau-Gauss fit", "l");
1796 legend->AddEntry((TObject*)0, Form("#scale[0.8]{L MPV = %2.2f #pm %2.2f}",fit->GetParameter(1), fit->GetParError(1) ) , " ");
1797 legend->AddEntry((TObject*)0, Form("#scale[0.8]{Max = %2.2f}", maxFit ) , " ");
1798 legend->Draw();
1799 DrawLines(maxFit, maxFit,0.7, scaleYMax*maxY/10, 5, kRed+3, 7);
1800 } else {
1801 labelChannel->Draw();
1802 }
1803
1804 DrawLines(noiseWidth*3, noiseWidth*3,0.7, scaleYMax*maxY, 2, kGray+1, 10);
1805 DrawLines(noiseWidth*5, noiseWidth*5,0.7, scaleYMax*maxY, 2, kGray+1, 6);
1806
1807 if (p ==7 ){
1808 DrawLatex(topRCornerX[p]-0.045, topRCornerY[p]-4*0.85*relSize8P[p]-1.4*relSize8P[p], GetStringFromRunInfo(currRunInfo, 2), true, 0.85*relSize8P[p], 42);
1809 DrawLatex(topRCornerX[p]-0.045, topRCornerY[p]-4*0.85*relSize8P[p]-2.2*relSize8P[p], GetStringFromRunInfo(currRunInfo, 3), true, 0.85*relSize8P[p], 42);
1810 }
1811 }
1812 }
1813 if (skipped < 6)
1814 canvas8Panel->SaveAs(nameOutput.Data());
1815 }
1816
1817
1818
1819
1820 void PlotSpectraFullLayer (TCanvas* canvas8Panel, TPad* pads[8], Double_t* topRCornerX, Double_t* topRCornerY, Double_t* relSize8P, Int_t textSizePixel,
1821 std::map<int,TileSpectra> spectra, int isHG,
1822 Double_t xPMin, Double_t xPMax, Double_t scaleYMax, int layer, int mod, TString nameOutput, RunInfo currRunInfo){
1823
1824 Double_t maxY = 0;
1825 std::map<int, TileSpectra>::iterator ithSpectra;
1826 Setup* setupT = Setup::GetInstance();
1827
1828 int nRow = setupT->GetNMaxRow()+1;
1829 int nCol = setupT->GetNMaxColumn()+1;
1830 int skipped = 0;
1831 for (int r = 0; r < nRow; r++){
1832 for (int c = 0; c < nCol; c++){
1833 int tempCellID = setupT->GetCellID(r,c, layer, mod);
1834 ithSpectra=spectra.find(tempCellID);
1835 if(ithSpectra==spectra.end()){
1836 std::cout << "WARNING: skipping cell ID: " << tempCellID << "\t row " << r << "\t column " << c << "\t layer " << layer << "\t module " << mod << std::endl;
1837 continue;
1838 }
1839 TH1D* tempHist = nullptr;
1840 if (isHG == 0){
1841 tempHist = ithSpectra->second.GetHG();
1842 } else if (isHG == 1){
1843 tempHist = ithSpectra->second.GetLG();
1844 } else {
1845 tempHist = ithSpectra->second.GetComb();
1846 }
1847 if (maxY < FindLargestBin1DHist(tempHist, xPMin , xPMax)) maxY = FindLargestBin1DHist(tempHist, xPMin , xPMax);
1848 }
1849 }
1850
1851 for (int r = 0; r < nRow; r++){
1852 for (int c = 0; c < nCol; c++){
1853 canvas8Panel->cd();
1854 int tempCellID = setupT->GetCellID(r,c, layer, mod);
1855 int p = setupT->GetChannelInLayer(tempCellID);
1856 pads[p]->Draw();
1857 pads[p]->cd();
1858 pads[p]->SetLogy();
1859 ithSpectra=spectra.find(tempCellID);
1860 if(ithSpectra==spectra.end()){
1861 skipped++;
1862 std::cout << "WARNING: skipping cell ID: " << tempCellID << "\t row " << r << "\t column " << c << "\t layer " << layer << "\t module " << mod << std::endl;
1863 pads[p]->Clear();
1864 pads[p]->Draw();
1865 if (p ==7 ){
1866 DrawLatex(topRCornerX[p]-0.045, topRCornerY[p]-4*0.85*relSize8P[p]-1.4*relSize8P[p], GetStringFromRunInfo(currRunInfo, 2), true, 0.85*relSize8P[p], 42);
1867 DrawLatex(topRCornerX[p]-0.045, topRCornerY[p]-4*0.85*relSize8P[p]-2.2*relSize8P[p], GetStringFromRunInfo(currRunInfo, 3), true, 0.85*relSize8P[p], 42);
1868 }
1869 continue;
1870 }
1871 TH1D* tempHist = nullptr;
1872 double noiseWidth = 0;
1873 if (isHG == 0){
1874 tempHist = ithSpectra->second.GetHG();
1875 noiseWidth = ithSpectra->second.GetCalib()->PedestalSigH;
1876 } else if (isHG == 1){
1877 tempHist = ithSpectra->second.GetLG();
1878 noiseWidth = ithSpectra->second.GetCalib()->PedestalSigL;
1879 } else {
1880 tempHist = ithSpectra->second.GetComb();
1881 }
1882 SetStyleHistoTH1ForGraphs( tempHist, tempHist->GetXaxis()->GetTitle(), tempHist->GetYaxis()->GetTitle(), 0.85*textSizePixel, textSizePixel, 0.85*textSizePixel, textSizePixel,0.9, 1.1, 510, 510, 43, 63);
1883 SetMarkerDefaults(tempHist, 20, 1, kBlue+1, kBlue+1, kFALSE);
1884 tempHist->GetXaxis()->SetRangeUser(xPMin,xPMax);
1885 tempHist->GetYaxis()->SetRangeUser(0.7,scaleYMax*maxY);
1886
1887 tempHist->Draw("pe");
1888 short bctemp = ithSpectra->second.GetCalib()->BadChannel;
1889 if (bctemp != -64 && bctemp < 3){
1890 Color_t boxCol = kGray;
1891 if (bctemp == 1)
1892 boxCol = kGray+1;
1893 else if (bctemp == 0)
1894 boxCol = kGray+2;
1895 TBox* badChannelArea = CreateBox(boxCol, xPMin, 0.7, xPMax,scaleYMax*maxY, 1001 );
1896 badChannelArea->Draw();
1897 tempHist->Draw("same,axis");
1898 tempHist->Draw("same,pe");
1899 }
1900
1901 TString label = Form("row %d col %d", r, c);
1902 if (p == 7){
1903 label = Form("row %d col %d layer %d", r, c, layer);
1904 }
1905 TLatex *labelChannel = new TLatex(topRCornerX[p]-0.045,topRCornerY[p]-1.2*relSize8P[p],label);
1906 SetStyleTLatex( labelChannel, 0.85*textSizePixel,4,1,43,kTRUE,31);
1907 labelChannel->Draw();
1908
1909 if (isHG < 2){
1910 DrawLines(noiseWidth*3, noiseWidth*3,0.7, scaleYMax*maxY, 2, kGray+1, 10);
1911 DrawLines(noiseWidth*5, noiseWidth*5,0.7, scaleYMax*maxY, 2, kGray+1, 6);
1912 } else {
1913 DrawLines(0.3, 0.3, 0.7, scaleYMax*maxY, 2, kGray+1, 10);
1914 }
1915 if (p ==7 ){
1916 DrawLatex(topRCornerX[p]-0.045, topRCornerY[p]-4*0.85*relSize8P[p]-1.4*relSize8P[p], GetStringFromRunInfo(currRunInfo, 2), true, 0.85*relSize8P[p], 42);
1917 DrawLatex(topRCornerX[p]-0.045, topRCornerY[p]-4*0.85*relSize8P[p]-2.2*relSize8P[p], GetStringFromRunInfo(currRunInfo, 3), true, 0.85*relSize8P[p], 42);
1918 }
1919 }
1920 }
1921 if (skipped < 6)
1922 canvas8Panel->SaveAs(nameOutput.Data());
1923 }
1924
1925
1926
1927
1928
1929 void PlotCorrWithFitsFullLayer (TCanvas* canvas8Panel, TPad* pads[8], Double_t* topRCornerX, Double_t* topRCornerY, Double_t* relSize8P, Int_t textSizePixel,
1930 std::map<int,TileSpectra> spectra, int option,
1931 Double_t xPMin, Double_t xPMax, Double_t maxY, int layer, int mod, TString nameOutput, RunInfo currRunInfo){
1932
1933 Setup* setupT = Setup::GetInstance();
1934
1935 std::map<int, TileSpectra>::iterator ithSpectra;
1936 int nRow = setupT->GetNMaxRow()+1;
1937 int nCol = setupT->GetNMaxColumn()+1;
1938 int skipped = 0;
1939
1940 for (int r = 0; r < nRow; r++){
1941 for (int c = 0; c < nCol; c++){
1942 canvas8Panel->cd();
1943 int tempCellID = setupT->GetCellID(r,c, layer, mod);
1944 int p = setupT->GetChannelInLayer(tempCellID);
1945 pads[p]->Draw();
1946 pads[p]->SetLogy(0);
1947 pads[p]->cd();
1948
1949 ithSpectra=spectra.find(tempCellID);
1950 if(ithSpectra==spectra.end()){
1951 skipped++;
1952 std::cout << "WARNING: skipping cell ID: " << tempCellID << "\t row " << r << "\t column " << c << "\t layer " << layer << "\t module " << mod << std::endl;
1953 pads[p]->Clear();
1954 pads[p]->Draw();
1955 if (p ==7 ){
1956 DrawLatex(topRCornerX[p]+0.045, topRCornerY[p]-4*0.85*relSize8P[p]-1.4*relSize8P[p], GetStringFromRunInfo(currRunInfo, 2), false, 0.85*relSize8P[p], 42);
1957 DrawLatex(topRCornerX[p]+0.045, topRCornerY[p]-4*0.85*relSize8P[p]-2.2*relSize8P[p], GetStringFromRunInfo(currRunInfo, 3), false, 0.85*relSize8P[p], 42);
1958 }
1959 continue;
1960 }
1961 TProfile* tempProfile = nullptr;
1962 if (option == 1 || option == 2){
1963 tempProfile = ithSpectra->second.GetHGLGcorr();
1964 } else {
1965 tempProfile = ithSpectra->second.GetLGHGcorr();
1966 }
1967 if (!tempProfile) continue;
1968 TH1D* dummyhist = new TH1D("dummyhist", "", tempProfile->GetNbinsX(), tempProfile->GetXaxis()->GetXmin(), tempProfile->GetXaxis()->GetXmax());
1969 SetStyleHistoTH1ForGraphs( dummyhist, tempProfile->GetXaxis()->GetTitle(), tempProfile->GetYaxis()->GetTitle(), 0.85*textSizePixel, textSizePixel, 0.85*textSizePixel, textSizePixel,0.9, 1.5, 510, 510, 43, 63);
1970
1971
1972
1973 SetMarkerDefaultsProfile(tempProfile, 20, 1, kBlue+1, kBlue+1);
1974 Int_t maxX = 3900;
1975 if (option == 0 || option == 2 )
1976 maxX = 340;
1977 if (option == 2){
1978 dummyhist->GetYaxis()->SetRangeUser(-maxY,maxY);
1979 dummyhist->GetXaxis()->SetRangeUser(xPMin,maxX);
1980 } else {
1981 dummyhist->GetYaxis()->SetRangeUser(0,maxY);
1982 dummyhist->GetXaxis()->SetRangeUser(0,maxX);
1983 }
1984
1985
1986 dummyhist->Draw("axis");
1987
1988 short bctemp = ithSpectra->second.GetCalib()->BadChannel;
1989 if (bctemp != -64 && bctemp < 3){
1990 Color_t boxCol = kGray;
1991 if (bctemp == 1)
1992 boxCol = kGray+1;
1993 else if (bctemp == 0)
1994 boxCol = kGray+2;
1995 TBox* badChannelArea = CreateBox(boxCol, 0, 0, maxX,maxY, 1001 );
1996 badChannelArea->Draw();
1997 dummyhist->Draw("axis,same");
1998 }
1999
2000 tempProfile->Draw("pe, same");
2001
2002 TString label = Form("row %d col %d", r, c);
2003 if (p == 7){
2004 label = Form("row %d col %d layer %d", r, c, layer);
2005 }
2006 TLatex *labelChannel = new TLatex(topRCornerX[p]+0.045,topRCornerY[p]-1.2*relSize8P[p],label);
2007 SetStyleTLatex( labelChannel, 0.85*textSizePixel,4,1,43,kTRUE,11);
2008
2009
2010 TF1* fit = nullptr;
2011 if (option == 1 ){
2012 fit = ithSpectra->second.GetCorrModel(1);
2013 } else if (option == 0 ){
2014 fit = ithSpectra->second.GetCorrModel(0);
2015 }
2016 if (fit){
2017 Double_t rangeFit[2] = {0,0};
2018 fit->GetRange(rangeFit[0], rangeFit[1]);
2019 SetStyleFit(fit , rangeFit[0], rangeFit[1], 7, 3, kRed+3);
2020 fit->Draw("same");
2021 TLegend* legend = GetAndSetLegend2( topRCornerX[p]+0.045, topRCornerY[p]-4*0.85*relSize8P[p]-0.4*relSize8P[p], topRCornerX[p]+6*relSize8P[p], topRCornerY[p]-0.6*relSize8P[p],0.85*textSizePixel, 1, label, 43,0.1);
2022 legend->AddEntry(fit, "linear fit, trigg.", "l");
2023 legend->AddEntry((TObject*)0, Form("#scale[0.8]{b = %2.3f #pm %2.4f}",fit->GetParameter(0), fit->GetParError(0) ) , " ");
2024 legend->AddEntry((TObject*)0, Form("#scale[0.8]{a = %2.3f #pm %2.4f}",fit->GetParameter(1), fit->GetParError(1) ) , " ");
2025 legend->Draw();
2026 } else {
2027 labelChannel->Draw();
2028 }
2029
2030 if (option == 2){
2031 DrawLines(xPMin,maxX,0, 0, 2, kGray+1, 10);
2032 }
2033 if (p ==7 ){
2034 DrawLatex(topRCornerX[p]+0.045, topRCornerY[p]-4*0.85*relSize8P[p]-1.4*relSize8P[p], GetStringFromRunInfo(currRunInfo, 2), false, 0.85*relSize8P[p], 42);
2035 DrawLatex(topRCornerX[p]+0.045, topRCornerY[p]-4*0.85*relSize8P[p]-2.2*relSize8P[p], GetStringFromRunInfo(currRunInfo, 3), false, 0.85*relSize8P[p], 42);
2036 }
2037 }
2038 }
2039 if (skipped < 6)
2040 canvas8Panel->SaveAs(nameOutput.Data());
2041 }
2042
2043
2044
2045
2046
2047 void PlotCorr2DFullLayer (TCanvas* canvas8Panel, TPad* pads[8], Double_t* topRCornerX, Double_t* topRCornerY, Double_t* relSize8P, Int_t textSizePixel,
2048 std::map<int,TileSpectra> spectra,
2049 Double_t xPMin, Double_t xPMax, Double_t maxY, int layer, int mod, TString nameOutput, RunInfo currRunInfo){
2050
2051 Setup* setupT = Setup::GetInstance();
2052
2053 std::map<int, TileSpectra>::iterator ithSpectra;
2054 int nRow = setupT->GetNMaxRow()+1;
2055 int nCol = setupT->GetNMaxColumn()+1;
2056 int skipped = 0;
2057 ReadOut::Type rotype = ReadOut::Type::Undef;
2058
2059 for (int r = 0; r < nRow; r++){
2060 for (int c = 0; c < nCol; c++){
2061 canvas8Panel->cd();
2062 int tempCellID = setupT->GetCellID(r,c, layer, mod);
2063 int p = setupT->GetChannelInLayer(tempCellID);
2064 pads[p]->Draw();
2065 pads[p]->SetLogy(0);
2066 pads[p]->SetLogz(1);
2067 pads[p]->cd();
2068
2069 ithSpectra=spectra.find(tempCellID);
2070 if(ithSpectra==spectra.end()){
2071 skipped++;
2072 std::cout << "WARNING: skipping cell ID: " << tempCellID << "\t row " << r << "\t column " << c << "\t layer " << layer << "\t module " << mod << std::endl;
2073 pads[p]->Clear();
2074 pads[p]->Draw();
2075 if (p ==7 ){
2076 DrawLatex(topRCornerX[p]+0.045, topRCornerY[p]-4*0.85*relSize8P[p]-1.4*relSize8P[p], GetStringFromRunInfo(currRunInfo, 2), false, 0.85*relSize8P[p], 42);
2077 DrawLatex(topRCornerX[p]+0.045, topRCornerY[p]-4*0.85*relSize8P[p]-2.2*relSize8P[p], GetStringFromRunInfo(currRunInfo, 3), false, 0.85*relSize8P[p], 42);
2078 }
2079 continue;
2080 } else {
2081 rotype = ithSpectra->second.GetROType();
2082 }
2083 TProfile* tempProfile = ithSpectra->second.GetLGHGcorr();
2084 TH2D* temp2D = ithSpectra->second.GetCorr();
2085 if (!tempProfile) continue;
2086 SetStyleHistoTH2ForGraphs( temp2D, temp2D->GetXaxis()->GetTitle(), temp2D->GetYaxis()->GetTitle(), 0.85*textSizePixel, textSizePixel, 0.85*textSizePixel, textSizePixel,0.9, 1.5, 510, 510, 43, 63);
2087 SetMarkerDefaultsProfile(tempProfile, 24, 0.7, kRed+2, kRed+2);
2088
2089 temp2D->GetYaxis()->SetRangeUser(0,maxY);
2090 temp2D->GetXaxis()->SetRangeUser(0,xPMax);
2091 temp2D->Draw("colz");
2092
2093 short bctemp = ithSpectra->second.GetCalib()->BadChannel;
2094 if (bctemp != -64 && bctemp < 3){
2095 Color_t boxCol = kGray;
2096 if (bctemp == 1)
2097 boxCol = kGray+1;
2098 else if (bctemp == 0)
2099 boxCol = kGray+2;
2100 TBox* badChannelArea = CreateBox(boxCol, 0, 0, xPMax,maxY, 1001 );
2101 badChannelArea->Draw();
2102 temp2D->Draw("axis,same");
2103 }
2104
2105 TString xTit = temp2D->GetXaxis()->GetTitle();
2106 if (xTit.Contains("ample") != 0){
2107 tempProfile->Draw("pe, same");
2108 }
2109
2110 TString label = Form("row %d col %d", r, c);
2111 if (p == 7){
2112 label = Form("row %d col %d layer %d", r, c, layer);
2113 }
2114 TLatex *labelChannel = new TLatex(topRCornerX[p]+0.045,topRCornerY[p]-1.2*relSize8P[p],label);
2115 SetStyleTLatex( labelChannel, 0.85*textSizePixel,4,1,43,kTRUE,11);
2116
2117 TF1* fit = ithSpectra->second.GetCorrModel(0);
2118 if (rotype == ReadOut::Type::Hgcroc)
2119 fit = ithSpectra->second.GetCorrModel(1);
2120 if (fit){
2121 Double_t rangeFit[2] = {0,0};
2122 fit->GetRange(rangeFit[0], rangeFit[1]);
2123 SetStyleFit(fit , rangeFit[0], rangeFit[1], 7, 3, kRed+3);
2124 fit->Draw("same");
2125 TLegend* legend = nullptr;
2126 if (rotype == ReadOut::Type::Caen){
2127 legend = GetAndSetLegend2( topRCornerX[p]+0.045, topRCornerY[p]-4*0.85*relSize8P[p]-0.4*relSize8P[p], topRCornerX[p]+6*relSize8P[p], topRCornerY[p]-0.6*relSize8P[p],0.85*textSizePixel, 1, label, 43,0.1);
2128 legend->AddEntry(fit, "linear fit, trigg.", "l");
2129 legend->AddEntry((TObject*)0, Form("#scale[0.8]{b = %2.3f #pm %2.4f}",fit->GetParameter(0), fit->GetParError(0) ) , " ");
2130 legend->AddEntry((TObject*)0, Form("#scale[0.8]{a = %2.3f #pm %2.4f}",fit->GetParameter(1), fit->GetParError(1) ) , " ");
2131 } else {
2132 legend = GetAndSetLegend2( topRCornerX[p]+0.045, topRCornerY[p]-3*0.85*relSize8P[p]-0.4*relSize8P[p], topRCornerX[p]+6*relSize8P[p], topRCornerY[p]-0.6*relSize8P[p],0.85*textSizePixel, 1, label, 43,0.1);
2133 legend->AddEntry(fit, "const fit", "l");
2134 legend->AddEntry((TObject*)0, Form("#scale[0.8]{a = %2.3f #pm %2.4f}",fit->GetParameter(0), fit->GetParError(0) ) , " ");
2135 }
2136 legend->Draw();
2137 } else {
2138 labelChannel->Draw();
2139 }
2140
2141 if (p ==7 ){
2142 DrawLatex(topRCornerX[p]+0.045, topRCornerY[p]-4*0.85*relSize8P[p]-1.4*relSize8P[p], GetStringFromRunInfo(currRunInfo, 2), false, 0.85*relSize8P[p], 42);
2143 DrawLatex(topRCornerX[p]+0.045, topRCornerY[p]-4*0.85*relSize8P[p]-2.2*relSize8P[p], GetStringFromRunInfo(currRunInfo, 3), false, 0.85*relSize8P[p], 42);
2144 }
2145 }
2146 }
2147 if (skipped < 6)
2148 canvas8Panel->SaveAs(nameOutput.Data());
2149 }
2150
2151
2152
2153
2154
2155
2156 void PlotTriggerPrimWithFitsFullLayer (TCanvas* canvas8Panel, TPad* pads[8], Double_t* topRCornerX, Double_t* topRCornerY,
2157 Double_t* relSize8P, Int_t textSizePixel,
2158 std::map<int,TileSpectra> spectra, Setup* setupT,
2159 double avMip, double facLow, double facHigh,
2160 Double_t xPMin, Double_t xPMax, Double_t scaleYMax,
2161 int layer, int mod, TString nameOutput, RunInfo currRunInfo){
2162
2163 Double_t maxY = 0;
2164 std::map<int, TileSpectra>::iterator ithSpectra;
2165 std::map<int, TileSpectra>::iterator ithSpectraTrigg;
2166
2167 int nRow = setupT->GetNMaxRow()+1;
2168 int nCol = setupT->GetNMaxColumn()+1;
2169 int skipped = 0;
2170 for (int r = 0; r < nRow; r++){
2171 for (int c = 0; c < nCol; c++){
2172 int tempCellID = setupT->GetCellID(r,c, layer, mod);
2173 ithSpectra=spectra.find(tempCellID);
2174 if(ithSpectra==spectra.end()){
2175 std::cout << "WARNING: skipping cell ID: " << tempCellID << "\t row " << r << "\t column " << c << "\t layer " << layer << "\t module " << mod << std::endl;
2176 continue;
2177 }
2178 TH1D* tempHist = ithSpectra->second.GetTriggPrim();
2179 if (maxY < FindLargestBin1DHist(tempHist, xPMin , xPMax)) maxY = FindLargestBin1DHist(tempHist, xPMin , xPMax);
2180 }
2181 }
2182
2183 for (int r = 0; r < nRow; r++){
2184 for (int c = 0; c < nCol; c++){
2185 canvas8Panel->cd();
2186 int tempCellID = setupT->GetCellID(r,c, layer, mod);
2187 int p = setupT->GetChannelInLayer(tempCellID);
2188 pads[p]->Draw();
2189 pads[p]->cd();
2190 pads[p]->SetLogy();
2191 ithSpectra=spectra.find(tempCellID);
2192 if(ithSpectra==spectra.end()){
2193 skipped++;
2194 std::cout << "WARNING: skipping cell ID: " << tempCellID << "\t row " << r << "\t column " << c << "\t layer " << layer << "\t module " << mod << std::endl;
2195 pads[p]->Clear();
2196 pads[p]->Draw();
2197 if (p ==7 ){
2198 DrawLatex(topRCornerX[p]-0.045, topRCornerY[p]-2.*relSize8P[p], GetStringFromRunInfo(currRunInfo, 2), true, 0.85*relSize8P[p], 42);
2199 DrawLatex(topRCornerX[p]-0.045, topRCornerY[p]-3.*relSize8P[p], GetStringFromRunInfo(currRunInfo, 3), true, 0.85*relSize8P[p], 42);
2200 DrawLatex(topRCornerX[p]-0.045, topRCornerY[p]-4.*relSize8P[p], "Trigger primitives", true, 0.85*relSize8P[p], 42);
2201 }
2202 continue;
2203 }
2204 TH1D* tempHist = ithSpectra->second.GetTriggPrim();
2205 SetStyleHistoTH1ForGraphs( tempHist, tempHist->GetXaxis()->GetTitle(), tempHist->GetYaxis()->GetTitle(), 0.85*textSizePixel, textSizePixel, 0.85*textSizePixel, textSizePixel,0.9, 1.1, 510, 510, 43, 63);
2206 SetMarkerDefaults(tempHist, 20, 1, kBlue+1, kBlue+1, kFALSE);
2207 tempHist->GetXaxis()->SetRangeUser(xPMin,xPMax);
2208 tempHist->GetYaxis()->SetRangeUser(0.7,scaleYMax*maxY);
2209
2210 tempHist->Draw("pe");
2211 short bctemp = ithSpectra->second.GetCalib()->BadChannel;
2212 if (bctemp != -64 && bctemp < 3){
2213 Color_t boxCol = kGray;
2214 if (bctemp == 1)
2215 boxCol = kGray+1;
2216 else if (bctemp == 0)
2217 boxCol = kGray+2;
2218 TBox* badChannelArea = CreateBox(boxCol, xPMin, 0.7, xPMax,scaleYMax*maxY, 1001 );
2219 badChannelArea->Draw();
2220 tempHist->Draw("same,axis");
2221 tempHist->Draw("same,pe");
2222 }
2223
2224 TString label = Form("row %d col %d", r, c);
2225 if (p == 7){
2226 label = Form("row %d col %d layer %d", r, c, layer);
2227 }
2228 TLatex *labelChannel = new TLatex(topRCornerX[p]-0.045,topRCornerY[p]-1.2*relSize8P[p],label);
2229 SetStyleTLatex( labelChannel, 0.85*textSizePixel,4,1,43,kTRUE,31);
2230 labelChannel->Draw();
2231
2232 TBox* triggArea = CreateBox(kBlue-8, avMip*facLow, 0.7, avMip*facHigh,scaleYMax*maxY, 1001 );
2233 triggArea->Draw();
2234
2235 DrawLines(avMip*facLow, avMip*facLow,0.7, scaleYMax*maxY, 1, 1, 7);
2236 DrawLines(avMip*facHigh, avMip*facHigh,0.7, scaleYMax*maxY, 1, 1, 7);
2237 tempHist->Draw("same,axis");
2238 tempHist->Draw("same,pe");
2239
2240 if (p ==7 ){
2241 DrawLatex(topRCornerX[p]-0.045, topRCornerY[p]-2.*relSize8P[p], GetStringFromRunInfo(currRunInfo, 2), true, 0.85*relSize8P[p], 42);
2242 DrawLatex(topRCornerX[p]-0.045, topRCornerY[p]-3.*relSize8P[p], GetStringFromRunInfo(currRunInfo, 3), true, 0.85*relSize8P[p], 42);
2243 DrawLatex(topRCornerX[p]-0.045, topRCornerY[p]-4.*relSize8P[p], "Trigger primitives", true, 0.85*relSize8P[p], 42);
2244 }
2245 }
2246 }
2247 if (skipped < 6)
2248 canvas8Panel->SaveAs(nameOutput.Data());
2249 }
2250
2251
2252
2253
2254 void EventDisplayWithSliceHighlighted( TH3F* h3All, TH1D* h1XAll, TH1D* h1YAll, TH1D* h1ZAll,
2255 TH3F* h3LocTrigg, TH1D* h1XLocTrigg, TH1D* h1YLocTrigg, TH1D* h1ZLocTrigg,
2256 TH3F* h3Remain, TH1D* h1XRemain, TH1D* h1YRemain, TH1D* h1ZRemain,
2257 Int_t evtNr, Float_t etot, Float_t maxE,
2258 Float_t maxEX, Float_t maxEY, Float_t maxEZ, bool ktrigg,
2259 RunInfo currRunInfo, TString outputName, TString suffix = "pdf"
2260 ){
2261 Double_t textSizeRel = 0.035;
2262 Double_t textSizeSubpad = 0.06;
2263
2264 TCanvas* canvas3D2 = new TCanvas("canvas3D2","",0,0,1400,750);
2265
2266 TPad* padEvt[4];
2267 padEvt[0] = new TPad("pad_0", "", 0, 0, 0.75, 0.9,-1, -1, -2);
2268 padEvt[1] = new TPad("pad_1", "", 0.75, 0.66, 1, 1,-1, -1, -2);
2269 padEvt[2] = new TPad("pad_2", "", 0.75, 0.33, 1, 0.66,-1, -1, -2);
2270 padEvt[3] = new TPad("pad_3", "", 0.75, 0., 1., 0.33,-1, -1, -2);
2271
2272 DefaultPadSettings( padEvt[0], 0.04, 0.02, 0.0, 0.1);
2273 padEvt[0]->SetFillStyle(4000);
2274 padEvt[0]->SetLineStyle(0);
2275 DefaultPadSettings( padEvt[1], 0.12, 0.015, 0.02, 0.12);
2276 padEvt[1]->SetFillStyle(4000);
2277 padEvt[1]->SetLineStyle(0);
2278 DefaultPadSettings( padEvt[2], 0.12, 0.015, 0.02, 0.12);
2279 padEvt[2]->SetFillStyle(4000);
2280 padEvt[2]->SetLineStyle(0);
2281 DefaultPadSettings( padEvt[3], 0.12, 0.015, 0.02, 0.12);
2282 padEvt[3]->SetFillStyle(4000);
2283 padEvt[3]->SetLineStyle(0);
2284
2285 canvas3D2->Draw();
2286 canvas3D2->cd();
2287
2288 DrawLatex(0.01, 0.95, Form("#it{#bf{LFHCal TB}}: #it{%s}",GetStringFromRunInfo(currRunInfo, 6).Data()), false, textSizeRel, 42);
2289 DrawLatex(0.01, 0.92, GetStringFromRunInfo(currRunInfo, 1), false, 0.85*textSizeRel, 42);
2290 if(ktrigg) DrawLatex(0.01, 0.89, Form("Event %d, muon triggered",evtNr), false, 0.85*textSizeRel, 42);
2291 else DrawLatex(0.01, 0.89, Form("Event %d",evtNr), false, 0.85*textSizeRel, 42);
2292 DrawLatex(0.01, 0.86, Form("#it{E}_{tot} = %.2f mip eq/tile", etot), false, 0.85*textSizeRel, 42);
2293 DrawLatex(0.01, 0.83, Form("#it{E}_{max,cell} = %.2f mip eq/tile", maxE), false, 0.85*textSizeRel, 42);
2294
2295 padEvt[0]->Draw();
2296 padEvt[0]->cd();
2297 padEvt[0]->SetTheta(50);
2298 padEvt[0]->SetPhi(40);
2299
2300 SetStyleHistoTH3ForGraphs(h3All, "#it{z} (cm) ", " #it{x} (cm)","#it{y} (cm)", 0.65*textSizeRel,0.85*textSizeRel, 0.65*textSizeRel,0.85*textSizeRel, 0.65*textSizeRel,0.85*textSizeRel, 1.5, 1.3, 0.7, 510, 505, 502);
2301 h3All->GetXaxis()->SetLabelOffset(-0.004);
2302 h3All->GetYaxis()->SetLabelOffset(-0.002);
2303 SetStyleHistoTH3ForGraphs(h3LocTrigg, "#it{z} (cm) ", "#it{x} (cm)","#it{y} (cm)", 0.65*textSizeRel,0.85*textSizeRel, 0.65*textSizeRel,0.85*textSizeRel, 0.65*textSizeRel,0.85*textSizeRel, 1.5, 1.6, 0.6, 510, 505, 502);
2304 SetStyleHistoTH3ForGraphs(h3Remain, "#it{z} (cm) ", "#it{x} (cm)","#it{y} (cm)", 0.65*textSizeRel,0.85*textSizeRel, 0.65*textSizeRel,0.85*textSizeRel, 0.65*textSizeRel,0.85*textSizeRel, 1.5, 1.6, 0.6, 510, 505, 502);
2305 h3All->SetMaximum(maxE);
2306 h3All->SetLineColor(kBlack);
2307 h3All->Draw("box");
2308 h3Remain->SetMaximum(maxE);
2309 h3Remain->SetLineColor(kBlue+1);
2310 h3Remain->Draw("box,same,X+,Y+,Z+");
2311 h3LocTrigg->SetMaximum(maxE);
2312 h3LocTrigg->SetLineColor(kRed+1);
2313 h3LocTrigg->SetFillColorAlpha(kRed+1, 0.5);
2314 h3LocTrigg->Draw("BOX3,same");
2315
2316 canvas3D2->cd();
2317 padEvt[1]->Draw();
2318 padEvt[1]->cd();
2319 SetStyleHistoTH1ForGraphs( h1XAll, "#it{x} (cm)", "#it{E} (mip eq./tile)", 0.85*textSizeSubpad, textSizeSubpad, 0.85*textSizeSubpad, textSizeSubpad,0.9, 0.9);
2320 SetMarkerDefaults(h1XAll, 24, 1, kBlack, kBlack, kFALSE);
2321 SetMarkerDefaults(h1XLocTrigg, 20, 0.8, kRed+1, kRed+1, kFALSE);
2322 SetMarkerDefaults(h1XRemain, 34, 0.8, kBlue+1, kBlue+1, kFALSE);
2323 h1XAll->GetYaxis()->SetRangeUser(0.,1.1*maxEX);
2324 h1XAll->Draw("pe");
2325 h1XLocTrigg->Draw("pe,same");
2326 h1XRemain->Draw("pe,same");
2327 canvas3D2->cd();
2328 padEvt[2]->Draw();
2329 padEvt[2]->cd();
2330 SetStyleHistoTH1ForGraphs( h1YAll, "#it{y} (cm)", "#it{E} (mip eq./tile)", 0.85*textSizeSubpad, textSizeSubpad, 0.85*textSizeSubpad, textSizeSubpad,0.9, 0.9);
2331 SetMarkerDefaults(h1YAll, 24, 1, kBlack, kBlack, kFALSE);
2332 SetMarkerDefaults(h1YLocTrigg, 20, 0.8, kRed+1, kRed+1, kFALSE);
2333 SetMarkerDefaults(h1YRemain, 34, 0.8, kBlue+1, kBlue+1, kFALSE);
2334 h1YAll->GetYaxis()->SetRangeUser(0.,1.1*maxEY);
2335 h1YAll->Draw("pe");
2336 h1YLocTrigg->Draw("pe,same");
2337 h1YRemain->Draw("pe,same");
2338
2339 canvas3D2->cd();
2340 padEvt[3]->Draw();
2341 padEvt[3]->cd();
2342 SetStyleHistoTH1ForGraphs( h1ZAll, "#it{z} (cm)", "#it{E} (mip eq./tile)", 0.85*textSizeSubpad, textSizeSubpad, 0.85*textSizeSubpad, textSizeSubpad,0.9, 0.9);
2343 SetMarkerDefaults(h1ZAll, 24, 1, kBlack, kBlack, kFALSE);
2344 SetMarkerDefaults(h1ZLocTrigg, 20, 0.8, kRed+1, kRed+1, kFALSE);
2345 SetMarkerDefaults(h1ZRemain, 34, 0.8, kBlue+1, kBlue+1, kFALSE);
2346 h1ZAll->GetYaxis()->SetRangeUser(0.,1.1*maxEZ);
2347 h1ZAll->Draw("pe");
2348 h1ZLocTrigg->Draw("pe,same");
2349 h1ZRemain->Draw("pe,same");
2350
2351 canvas3D2->cd();
2352 TLegend* legend = GetAndSetLegend2( 0.6, 0.89, 0.75, 0.97, 0.85*textSizeRel, 1, "", 42, 0.2);
2353 legend->AddEntry(h1ZAll, "all cells", "pl");
2354 legend->AddEntry(h1ZLocTrigg, "local #mu triggered", "pl");
2355 legend->AddEntry(h1ZRemain, "remaining cells", "pl");
2356 legend->Draw();
2357
2358 canvas3D2->SaveAs( Form("%s%06i.%s", outputName.Data(), evtNr, suffix.Data()));
2359
2360 delete padEvt[0];
2361 delete padEvt[1];
2362 delete padEvt[2];
2363 delete padEvt[3];
2364 delete legend;
2365 delete canvas3D2;
2366 return;
2367 }
2368
2369
2370
2371
2372 void EventDisplayWithSlice( TH3F* h3All, TH1D* h1XAll, TH1D* h1YAll, TH1D* h1ZAll,
2373 Int_t evtNr, Float_t etot, Float_t maxE,
2374 Float_t maxEX, Float_t maxEY, Float_t maxEZ, bool ktrigg,
2375 RunInfo currRunInfo, TString outputName, TString suffix = "pdf"
2376 ){
2377 Double_t textSizeRel = 0.035;
2378 Double_t textSizeSubpad = 0.06;
2379
2380 TCanvas* canvas3D2 = new TCanvas("canvas3D2","",0,0,1400,750);
2381
2382 TPad* padEvt[4];
2383 padEvt[0] = new TPad("pad_0", "", 0, 0, 0.75, 0.9,-1, -1, -2);
2384 padEvt[1] = new TPad("pad_1", "", 0.75, 0.66, 1, 1,-1, -1, -2);
2385 padEvt[2] = new TPad("pad_2", "", 0.75, 0.33, 1, 0.66,-1, -1, -2);
2386 padEvt[3] = new TPad("pad_3", "", 0.75, 0., 1., 0.33,-1, -1, -2);
2387
2388 DefaultPadSettings( padEvt[0], 0.04, 0.02, 0.0, 0.1);
2389 padEvt[0]->SetFillStyle(4000);
2390 padEvt[0]->SetLineStyle(0);
2391 DefaultPadSettings( padEvt[1], 0.12, 0.015, 0.02, 0.12);
2392 padEvt[1]->SetFillStyle(4000);
2393 padEvt[1]->SetLineStyle(0);
2394 DefaultPadSettings( padEvt[2], 0.12, 0.015, 0.02, 0.12);
2395 padEvt[2]->SetFillStyle(4000);
2396 padEvt[2]->SetLineStyle(0);
2397 DefaultPadSettings( padEvt[3], 0.12, 0.015, 0.02, 0.12);
2398 padEvt[3]->SetFillStyle(4000);
2399 padEvt[3]->SetLineStyle(0);
2400
2401 canvas3D2->Draw();
2402 canvas3D2->cd();
2403
2404 DrawLatex(0.01, 0.95, Form("#it{#bf{LFHCal TB}}: #it{%s}",GetStringFromRunInfo(currRunInfo, 6).Data()), false, textSizeRel, 42);
2405 DrawLatex(0.01, 0.92, GetStringFromRunInfo(currRunInfo, 1), false, 0.85*textSizeRel, 42);
2406 if(ktrigg) DrawLatex(0.01, 0.89, Form("Event %d, muon triggered",evtNr), false, 0.85*textSizeRel, 42);
2407 else DrawLatex(0.01, 0.89, Form("Event %d",evtNr), false, 0.85*textSizeRel, 42);
2408 DrawLatex(0.01, 0.86, Form("#it{E}_{tot} = %.2f mip eq/tile", etot), false, 0.85*textSizeRel, 42);
2409 DrawLatex(0.01, 0.83, Form("#it{E}_{max,cell} = %.2f mip eq/tile", maxE), false, 0.85*textSizeRel, 42);
2410
2411 padEvt[0]->Draw();
2412 padEvt[0]->cd();
2413 padEvt[0]->SetTheta(50);
2414 padEvt[0]->SetPhi(40);
2415
2416 SetStyleHistoTH3ForGraphs(h3All, "#it{z} (cm) ", " #it{x} (cm)","#it{y} (cm)", 0.65*textSizeRel,0.85*textSizeRel, 0.65*textSizeRel,0.85*textSizeRel, 0.65*textSizeRel,0.85*textSizeRel, 1.5, 1.3, 0.7, 510, 505, 502);
2417 h3All->GetXaxis()->SetLabelOffset(-0.004);
2418 h3All->GetYaxis()->SetLabelOffset(-0.002);
2419 h3All->SetMaximum(maxE);
2420 h3All->SetFillColor(kBlue+1);
2421 h3All->SetLineColor(kBlue+1);
2422 h3All->Draw("box1");
2423
2424 canvas3D2->cd();
2425 padEvt[1]->Draw();
2426 padEvt[1]->cd();
2427 SetStyleHistoTH1ForGraphs( h1XAll, "#it{x} (cm)", "#it{E} (mip eq./tile)", 0.85*textSizeSubpad, textSizeSubpad, 0.85*textSizeSubpad, textSizeSubpad,0.9, 0.9);
2428 SetMarkerDefaults(h1XAll, 24, 1, kBlue+1, kBlue+1, kFALSE);
2429 h1XAll->GetYaxis()->SetRangeUser(0.,1.1*maxEX);
2430 h1XAll->Draw("pe");
2431 canvas3D2->cd();
2432
2433 padEvt[2]->Draw();
2434 padEvt[2]->cd();
2435 SetStyleHistoTH1ForGraphs( h1YAll, "#it{y} (cm)", "#it{E} (mip eq./tile)", 0.85*textSizeSubpad, textSizeSubpad, 0.85*textSizeSubpad, textSizeSubpad,0.9, 0.9);
2436 SetMarkerDefaults(h1YAll, 24, 1, kBlue+1, kBlue+1, kFALSE);
2437 h1YAll->GetYaxis()->SetRangeUser(0.,1.1*maxEY);
2438 h1YAll->Draw("pe");
2439
2440 canvas3D2->cd();
2441 padEvt[3]->Draw();
2442 padEvt[3]->cd();
2443 SetStyleHistoTH1ForGraphs( h1ZAll, "#it{z} (cm)", "#it{E} (mip eq./tile)", 0.85*textSizeSubpad, textSizeSubpad, 0.85*textSizeSubpad, textSizeSubpad,0.9, 0.9);
2444 SetMarkerDefaults(h1ZAll, 24, 1, kBlue+1, kBlue+1, kFALSE);
2445 h1ZAll->GetYaxis()->SetRangeUser(0.,1.1*maxEZ);
2446 h1ZAll->Draw("pe");
2447
2448 canvas3D2->cd();
2449 canvas3D2->SaveAs( Form("%s%06i.%s", outputName.Data(), evtNr, suffix.Data()));
2450
2451 delete padEvt[0];
2452 delete padEvt[1];
2453 delete padEvt[2];
2454 delete padEvt[3];
2455 delete canvas3D2;
2456 return;
2457 }
2458
2459
2460
2461
2462 void PlotTrendingPerLayer (TCanvas* canvas8Panel, TPad* pads[8], Double_t* topRCornerX, Double_t* topRCornerY, Double_t* relSize8P, Int_t textSizePixel,
2463 std::map<int,TileTrend> trending, int optionTrend,
2464 Double_t xPMin, Double_t xPMax, int layer, int mod, TString nameOutput, TString nameOutputSummary, RunInfo currRunInfo, Int_t detailedPlot = 1){
2465
2466 Setup* setupT = Setup::GetInstance();
2467
2468 std::map<int, TileTrend>::iterator ithTrend;
2469 int nRow = setupT->GetNMaxRow()+1;
2470 int nCol = setupT->GetNMaxColumn()+1;
2471 int skipped = 0;
2472 bool isSameVoltage = true;
2473 double commanVoltage = 0;
2474
2475 Double_t minY = 9999;
2476 Double_t maxY = 0.;
2477
2478 for (int r = 0; r < nRow; r++){
2479 for (int c = 0; c < nCol; c++){
2480 int tempCellID = setupT->GetCellID(r,c, layer, mod);
2481 ithTrend=trending.find(tempCellID);
2482 if (optionTrend == 0){
2483 if(minY>ithTrend->second.GetMinHGped()) minY=ithTrend->second.GetMinHGped();
2484 if(maxY<ithTrend->second.GetMaxHGped()) maxY=ithTrend->second.GetMaxHGped();
2485 } else if (optionTrend == 1){
2486 if(minY>ithTrend->second.GetMinLGped()) minY=ithTrend->second.GetMinLGped();
2487 if(maxY<ithTrend->second.GetMaxLGped()) maxY=ithTrend->second.GetMaxLGped();
2488 } else if (optionTrend == 2){
2489 if(minY>ithTrend->second.GetMinHGscale()) minY=ithTrend->second.GetMinHGscale();
2490 if(maxY<ithTrend->second.GetMaxHGscale()) maxY=ithTrend->second.GetMaxHGscale();
2491 } else if (optionTrend == 3){
2492 if(minY>ithTrend->second.GetMinLGscale()) minY=ithTrend->second.GetMinLGscale();
2493 if(maxY<ithTrend->second.GetMaxLGscale()) maxY=ithTrend->second.GetMaxLGscale();
2494 } else if (optionTrend == 4){
2495 if(minY>ithTrend->second.GetMinLGHGcorr()) minY=ithTrend->second.GetMinLGHGcorr();
2496 if(maxY<ithTrend->second.GetMaxLGHGcorr()) maxY=ithTrend->second.GetMaxLGHGcorr();
2497 } else if (optionTrend == 5){
2498 if(minY>ithTrend->second.GetMinHGLGcorr()) minY=ithTrend->second.GetMinHGLGcorr();
2499 if(maxY<ithTrend->second.GetMaxHGLGcorr()) maxY=ithTrend->second.GetMaxHGLGcorr();
2500 } else if (optionTrend == 6){
2501 if(minY>ithTrend->second.GetMinTrigg()) minY=ithTrend->second.GetMinTrigg();
2502 if(maxY<ithTrend->second.GetMaxTrigg()) maxY=ithTrend->second.GetMaxTrigg();
2503 } else if (optionTrend == 7){
2504 if(minY>ithTrend->second.GetMinSBSignal()) minY=ithTrend->second.GetMinSBSignal();
2505 if(maxY<ithTrend->second.GetMaxSBSignal()) maxY=ithTrend->second.GetMaxSBSignal();
2506 } else if (optionTrend == 8){
2507 if(minY>ithTrend->second.GetMinSBNoise()) minY=ithTrend->second.GetMinSBNoise();
2508 if(maxY<ithTrend->second.GetMaxSBNoise()) maxY=ithTrend->second.GetMaxSBNoise();
2509 } else if (optionTrend == 9){
2510 if(minY>ithTrend->second.GetMinHGMPV()) minY=ithTrend->second.GetMinHGMPV();
2511 if(maxY<ithTrend->second.GetMaxHGMPV()) maxY=ithTrend->second.GetMaxHGMPV();
2512 } else if (optionTrend == 10){
2513 if(minY>ithTrend->second.GetMinLGMPV()) minY=ithTrend->second.GetMinLGMPV();
2514 if(maxY<ithTrend->second.GetMaxLGMPV()) maxY=ithTrend->second.GetMaxLGMPV();
2515 } else if (optionTrend == 11){
2516 if(minY>ithTrend->second.GetMinHGLSigma()) minY=ithTrend->second.GetMinHGLSigma();
2517 if(maxY<ithTrend->second.GetMaxHGLSigma()) maxY=ithTrend->second.GetMaxHGLSigma();
2518 } else if (optionTrend == 12){
2519 if(minY>ithTrend->second.GetMinLGLSigma()) minY=ithTrend->second.GetMinLGLSigma();
2520 if(maxY<ithTrend->second.GetMaxLGLSigma()) maxY=ithTrend->second.GetMaxLGLSigma();
2521 } else if (optionTrend == 13){
2522 if(minY>ithTrend->second.GetMinHGGSigma()) minY=ithTrend->second.GetMinHGGSigma();
2523 if(maxY<ithTrend->second.GetMaxHGGSigma()) maxY=ithTrend->second.GetMaxHGGSigma();
2524 } else if (optionTrend == 14){
2525 if(minY>ithTrend->second.GetMinLGGSigma()) minY=ithTrend->second.GetMinLGGSigma();
2526 if(maxY<ithTrend->second.GetMaxLGGSigma()) maxY=ithTrend->second.GetMaxLGGSigma();
2527 } else if (optionTrend == 15){
2528 if(minY>ithTrend->second.GetMinHGpedwidth()) minY=ithTrend->second.GetMinHGpedwidth();
2529 if(maxY<ithTrend->second.GetMaxHGpedwidth()) maxY=ithTrend->second.GetMaxHGpedwidth();
2530 } else if (optionTrend == 16){
2531 if(minY>ithTrend->second.GetMinLGpedwidth()) minY=ithTrend->second.GetMinLGpedwidth();
2532 if(maxY<ithTrend->second.GetMaxLGpedwidth()) maxY=ithTrend->second.GetMaxLGpedwidth();
2533 } else if (optionTrend == 17){
2534 if(minY>ithTrend->second.GetMinLGHGOffset()) minY=ithTrend->second.GetMinLGHGOffset();
2535 if(maxY<ithTrend->second.GetMaxLGHGOffset()) maxY=ithTrend->second.GetMaxLGHGOffset();
2536 } else if (optionTrend == 18){
2537 if(minY>ithTrend->second.GetMinHGLGOffset()) minY=ithTrend->second.GetMinHGLGOffset();
2538 if(maxY<ithTrend->second.GetMaxHGLGOffset()) maxY=ithTrend->second.GetMaxHGLGOffset();
2539 }
2540 for (int rc = 0; rc < ithTrend->second.GetNRuns() && rc < 30; rc++ ){
2541 if (r == 0 && c == 0){
2542 if (rc == 0){
2543 commanVoltage = ithTrend->second.GetVoltage(rc);
2544 } else {
2545 if (commanVoltage != ithTrend->second.GetVoltage(rc)) isSameVoltage = false;
2546 }
2547 }
2548 }
2549 }
2550 }
2551 if (minY == 9999 && maxY == 0.){
2552 std::cout <<"Something went wrong! No ranges set for layer " << layer << " \t trend plotting option: " << optionTrend << "\t ABORTING!" << std::endl;
2553 return;
2554 }
2555
2556 if (optionTrend == 6){
2557 if (minY ==0 ) minY = 1;
2558 else minY = minY/5.;
2559 maxY= maxY*5.;
2560 } else if (optionTrend == 17 || optionTrend == 18 ){
2561 minY = 1.1*minY;
2562 maxY = 2*maxY;
2563 } else {
2564 minY = 0.9*minY;
2565 maxY = 1.1*maxY;
2566 }
2567 for (int r = 0; r < nRow; r++){
2568 for (int c = 0; c < nCol; c++){
2569
2570 canvas8Panel->cd();
2571 int tempCellID = setupT->GetCellID(r,c, layer, mod);
2572 int p = setupT->GetChannelInLayer(tempCellID);
2573
2574 TString label = Form("row %d col %d", r, c);
2575 TString label2 = Form("Common V_{op} = %2.1f V", commanVoltage);
2576 if (p == 7){
2577 label = Form("row %d col %d layer %d", r, c, layer);
2578 }
2579
2580 pads[p]->Draw();
2581
2582 if (optionTrend == 6){
2583 pads[p]->SetLogy(1);
2584 } else {
2585 pads[p]->SetLogy(0);
2586 }
2587
2588 pads[p]->cd();
2589 ithTrend=trending.find(tempCellID);
2590 if(ithTrend==trending.end()){
2591 skipped++;
2592 std::cout << "WARNING: skipping cell ID: " << tempCellID << "\t row " << r << "\t column " << c << "\t layer " << layer << "\t module " << mod << std::endl;
2593 pads[p]->Clear();
2594 pads[p]->Draw();
2595 if (p ==4 ){
2596 TString lab1 = Form("#it{#bf{LFHCal TB:}} %s", GetStringFromRunInfo(currRunInfo, 9).Data());
2597 TString lab2 = GetStringFromRunInfo(currRunInfo, 8);
2598 TString lab3 = GetStringFromRunInfo(currRunInfo, 10);
2599 DrawLatex(topRCornerX[p]-0.045, topRCornerY[p]-1.2*relSize8P[p]-1*0.85*relSize8P[p], lab1, true, 0.85*textSizePixel, 43);
2600 DrawLatex(topRCornerX[p]-0.045, topRCornerY[p]-1.2*relSize8P[p]-2*0.85*relSize8P[p], lab2, true, 0.85*textSizePixel, 43);
2601 DrawLatex(topRCornerX[p]-0.045, topRCornerY[p]-1.2*relSize8P[p]-3*0.85*relSize8P[p], lab3, true, 0.85*textSizePixel, 43);
2602 }
2603 continue;
2604 }
2605 TGraphErrors* tempGraph = nullptr;
2606 if (optionTrend == 0) tempGraph = ithTrend->second.GetHGped();
2607 else if (optionTrend == 1) tempGraph = ithTrend->second.GetLGped();
2608 else if (optionTrend == 2) tempGraph = ithTrend->second.GetHGScale();
2609 else if (optionTrend == 3) tempGraph = ithTrend->second.GetLGScale();
2610 else if (optionTrend == 4) tempGraph = ithTrend->second.GetLGHGcorr();
2611 else if (optionTrend == 5) tempGraph = ithTrend->second.GetHGLGcorr();
2612 else if (optionTrend == 6) tempGraph = ithTrend->second.GetTrigger();
2613 else if (optionTrend == 7) tempGraph = ithTrend->second.GetSBSignal();
2614 else if (optionTrend == 8) tempGraph = ithTrend->second.GetSBNoise();
2615 else if (optionTrend == 9) tempGraph = ithTrend->second.GetHGLMPV();
2616 else if (optionTrend == 10) tempGraph = ithTrend->second.GetLGLMPV();
2617 else if (optionTrend == 11) tempGraph = ithTrend->second.GetHGLSigma();
2618 else if (optionTrend == 12) tempGraph = ithTrend->second.GetLGLSigma();
2619 else if (optionTrend == 13) tempGraph = ithTrend->second.GetHGGSigma();
2620 else if (optionTrend == 14) tempGraph = ithTrend->second.GetLGGSigma();
2621 else if (optionTrend == 15) tempGraph = ithTrend->second.GetHGpedwidth();
2622 else if (optionTrend == 16) tempGraph = ithTrend->second.GetLGpedwidth();
2623 else if (optionTrend == 17) tempGraph = ithTrend->second.GetLGHGOff();
2624 else if (optionTrend == 18) tempGraph = ithTrend->second.GetHGLGOff();
2625 if (!tempGraph) continue;
2626 TH1D* dummyhist = new TH1D("dummyhist", "", 100, xPMin, xPMax);
2627 SetStyleHistoTH1ForGraphs( dummyhist, tempGraph->GetXaxis()->GetTitle(), tempGraph->GetYaxis()->GetTitle(), 0.85*textSizePixel, textSizePixel, 0.85*textSizePixel, textSizePixel,0.9, 1.5, 510, 510, 43, 63);
2628
2629 SetMarkerDefaultsTGraphErr(tempGraph, 20, 1, kBlue+1, kBlue+1);
2630 dummyhist->GetYaxis()->SetRangeUser(minY,maxY);
2631 dummyhist->Draw("axis");
2632 tempGraph->Draw("pe, same");
2633
2634 DrawLatex(topRCornerX[p]-0.045, topRCornerY[p]-1.2*relSize8P[p], label, true, 0.85*textSizePixel, 43);
2635 if (isSameVoltage && p == 7){
2636 DrawLatex(topRCornerX[p]-0.045, topRCornerY[p]-1.2*relSize8P[p]-1*0.85*relSize8P[p], label2, true, 0.85*textSizePixel, 43);
2637 }
2638 if (p ==4 ){
2639 TString lab1 = Form("#it{#bf{LFHCal TB:}} %s", GetStringFromRunInfo(currRunInfo, 9).Data());
2640 TString lab2 = GetStringFromRunInfo(currRunInfo, 8);
2641 TString lab3 = GetStringFromRunInfo(currRunInfo, 10);
2642 DrawLatex(topRCornerX[p]-0.045, topRCornerY[p]-1.2*relSize8P[p]-1*0.85*relSize8P[p], lab1, true, 0.85*textSizePixel, 43);
2643 DrawLatex(topRCornerX[p]-0.045, topRCornerY[p]-1.2*relSize8P[p]-2*0.85*relSize8P[p], lab2, true, 0.85*textSizePixel, 43);
2644 DrawLatex(topRCornerX[p]-0.045, topRCornerY[p]-1.2*relSize8P[p]-3*0.85*relSize8P[p], lab3, true, 0.85*textSizePixel, 43);
2645 }
2646 }
2647 }
2648 if (skipped < 8){
2649 if(detailedPlot) canvas8Panel->SaveAs(nameOutput.Data());
2650 if (layer == 0) canvas8Panel->Print(Form("%s.pdf[",nameOutputSummary.Data()));
2651 canvas8Panel->Print(Form("%s.pdf",nameOutputSummary.Data()));
2652 if (layer == setupT->GetNMaxLayer()) canvas8Panel->Print(Form("%s.pdf]",nameOutputSummary.Data()));
2653 }
2654 }
2655
2656
2657
2658
2659
2660 void PlotCalibRunOverlay( TCanvas* canvas2D, Int_t option,
2661 std::map<int, CalibSummary> sumRuns,
2662 Float_t textSizeRel, TString nameOutput, RunInfo currRunInfo,
2663
2664 TString additionalLabel = "", int debug = 0
2665 ){
2666
2667 Double_t minY = 0;
2668 Double_t maxY = 0;
2669 Double_t minX = 9999;
2670 Double_t maxX = 0;
2671 bool isSameVoltage = true;
2672 double commanVoltage = 0;
2673
2674 std::map<int, CalibSummary>::iterator itrun;
2675 Int_t nruns = 0;
2676 for(itrun=sumRuns.begin(); itrun!=sumRuns.end(); ++itrun){
2677 TH1D* tempH = nullptr;
2678 if (option==0) tempH = itrun->second.GetHGped();
2679 else if (option==1) tempH = itrun->second.GetHGpedwidth();
2680 else if (option==2) tempH = itrun->second.GetLGped();
2681 else if (option==3) tempH = itrun->second.GetLGpedwidth();
2682 else if (option==4) tempH = itrun->second.GetHGScale();
2683 else if (option==5) tempH = itrun->second.GetHGScalewidth();
2684 else if (option==6) tempH = itrun->second.GetLGScale();
2685 else if (option==7) tempH = itrun->second.GetLGScalewidth();
2686 else if (option==8) tempH = itrun->second.GetLGHGcorr();
2687 else if (option==9) tempH = itrun->second.GetHGLGcorr();
2688 else if (option==10) tempH = itrun->second.GetLGScaleCalc();
2689 else if (option==11) tempH = itrun->second.GetLGHGOffcorr();
2690 else if (option==12) tempH = itrun->second.GetHGLGOffcorr();
2691 if (maxY < tempH->GetMaximum()) maxY = tempH->GetMaximum();
2692 if ( maxX < FindLastBinXAboveMin(tempH)) maxX = FindLastBinXAboveMin(tempH);
2693 if ( minX > FindFirstBinXAboveMin(tempH)) minX = FindFirstBinXAboveMin(tempH);
2694 if (nruns==0){
2695 commanVoltage = itrun->second.GetVoltage();
2696 } else {
2697 if (commanVoltage != itrun->second.GetVoltage()) isSameVoltage = false;
2698 }
2699 nruns++;
2700 }
2701
2702
2703 TString label2 = Form("Common V_{op} = %2.1f V", commanVoltage);
2704 canvas2D->cd();
2705
2706 TH1D* histos[30];
2707 if (debug > 0){
2708 if (nruns > 30) std::cout << "more than 30 runs are included in this, only 30 will be plotted, currently " << nruns << "\t runs were requested" << std::endl;
2709 else std::cout << nruns << " will be plotted" << std::endl;
2710 }
2711 double lineBottom = 6;
2712 if (nruns < 6) lineBottom = 1;
2713 else if (nruns < 11) lineBottom = 2;
2714 else if (nruns < 16) lineBottom = 3;
2715 else if (nruns < 21) lineBottom = 4;
2716 else if (nruns < 26) lineBottom = 5;
2717 TLegend* legend = GetAndSetLegend2( 0.55, 0.88-lineBottom*textSizeRel, 0.95, 0.88,
2718 0.85*textSizeRel, 5, "",42,0.35);;
2719 int currRun = 0;
2720 for(itrun=sumRuns.begin(); (itrun!=sumRuns.end()) && (currRun < 30); ++itrun){
2721 histos[currRun] = nullptr;
2722 if (option==0) histos[currRun] = itrun->second.GetHGped();
2723 else if (option==1) histos[currRun] = itrun->second.GetHGpedwidth();
2724 else if (option==2) histos[currRun] = itrun->second.GetLGped();
2725 else if (option==3) histos[currRun] = itrun->second.GetLGpedwidth();
2726 else if (option==4) histos[currRun] = itrun->second.GetHGScale();
2727 else if (option==5) histos[currRun] = itrun->second.GetHGScalewidth();
2728 else if (option==6) histos[currRun] = itrun->second.GetLGScale();
2729 else if (option==7) histos[currRun] = itrun->second.GetLGScalewidth();
2730 else if (option==8) histos[currRun] = itrun->second.GetLGHGcorr();
2731 else if (option==9) histos[currRun] = itrun->second.GetHGLGcorr();
2732 else if (option==10) histos[currRun] = itrun->second.GetLGScaleCalc();
2733 else if (option==11) histos[currRun] = itrun->second.GetLGHGOffcorr();
2734 else if (option==12) histos[currRun] = itrun->second.GetHGLGOffcorr();
2735 SetStyleHistoTH1ForGraphs( histos[currRun], histos[currRun]->GetXaxis()->GetTitle(), histos[currRun]->GetYaxis()->GetTitle(), 0.85*textSizeRel, textSizeRel, 0.85*textSizeRel, textSizeRel,0.95, 1.02);
2736 SetLineDefaults(histos[currRun], GetColorLayer(currRun), 4, GetLineStyleLayer(currRun));
2737 if(currRun == 0){
2738 histos[currRun]->GetXaxis()->SetRangeUser(minX-5*histos[currRun]->GetBinWidth(1),maxX+5*histos[currRun]->GetBinWidth(1));
2739 histos[currRun]->GetYaxis()->SetRangeUser(minY,maxY*1.1);
2740 histos[currRun]->Draw("hist");
2741 } else {
2742 histos[currRun]->Draw("same,hist");
2743 }
2744 legend->AddEntry(histos[currRun],Form("%d",itrun->first),"l");
2745 currRun++;
2746 }
2747 histos[0]->DrawCopy("axis,same");
2748 legend->Draw();
2749
2750 DrawLatex(0.95, 0.92, Form("#it{#bf{LFHCal TB:} %s}",GetStringFromRunInfo(currRunInfo,7).Data()), true, 0.85*textSizeRel, 42);
2751 DrawLatex(0.95, 0.885, GetStringFromRunInfo(currRunInfo,8), true, 0.85*textSizeRel, 42);
2752 if (isSameVoltage)
2753 DrawLatex(0.95, 0.88-0.5*0.85*textSizeRel-lineBottom*textSizeRel , label2, true, 0.85*textSizeRel, 42);
2754
2755 canvas2D->SaveAs(nameOutput.Data());
2756 }
2757
2758
2759
2760
2761 void PlotRunOverlayPerLayer (TCanvas* canvas8Panel, TPad* pads[8], Double_t* topRCornerX, Double_t* topRCornerY, Double_t* relSize8P, Int_t textSizePixel,
2762 std::map<int,TileTrend> trending, int nruns, int optionTrend,
2763 Double_t xPMin, Double_t xPMax, int layer, int mod, TString nameOutput, TString nameOutputSummary, RunInfo currRunInfo, Int_t detailedPlot = 1){
2764
2765 Setup* setupT = Setup::GetInstance();
2766
2767 std::map<int, TileTrend>::iterator ithTrend;
2768 int nRow = setupT->GetNMaxRow()+1;
2769 int nCol = setupT->GetNMaxColumn()+1;
2770 int skipped = 0;
2771
2772 Double_t maxY = 0.;
2773 Double_t minY = 9999.;
2774 bool isSameVoltage = true;
2775 double commanVoltage = 0;
2776 for (int r = 0; r < nRow; r++){
2777 for (int c = 0; c < nCol; c++){
2778 int tempCellID = setupT->GetCellID(r,c, layer, mod);
2779 ithTrend=trending.find(tempCellID);
2780 if (optionTrend == 0){
2781 if(maxY<ithTrend->second.GetMaxHGSpec()) maxY=ithTrend->second.GetMaxHGSpec();
2782 if(minY>ithTrend->second.GetMinHGSpec()) minY=ithTrend->second.GetMinHGSpec();
2783 } else if (optionTrend == 1){
2784 if(maxY<ithTrend->second.GetMaxLGSpec()) maxY=ithTrend->second.GetMaxLGSpec();
2785 if(minY>ithTrend->second.GetMinLGSpec()) minY=ithTrend->second.GetMinLGSpec();
2786 }
2787
2788 for (int rc = 0; rc < ithTrend->second.GetNRuns() && rc < 30; rc++ ){
2789 if (r == 0 && c == 0){
2790 if (rc == 0){
2791 commanVoltage = ithTrend->second.GetVoltage(rc);
2792 } else {
2793 if (commanVoltage != ithTrend->second.GetVoltage(rc)) isSameVoltage = false;
2794 }
2795 }
2796 }
2797 }
2798 }
2799 if (maxY == 0 && minY == 9999.){
2800 std::cout <<"Something went wrong! No ranges set for layer " << layer << " \t trend plotting option: " << optionTrend << "\t ABORTING!" << std::endl;
2801 return;
2802 }
2803 maxY = 3*maxY;
2804 TH1D* histos[30];
2805
2806 double lineBottom = (1.4+6);
2807 if (nruns < 6) lineBottom = (1.4+1);
2808 else if (nruns < 11) lineBottom = (1.4+2);
2809 else if (nruns < 16) lineBottom = (1.4+3);
2810 else if (nruns < 21) lineBottom = (1.4+4);
2811 else if (nruns < 26) lineBottom = (1.4+5);
2812 TLegend* legend = nullptr;
2813
2814 for (int r = 0; r < nRow; r++){
2815 for (int c = 0; c < nCol; c++){
2816 canvas8Panel->cd();
2817 int tempCellID = setupT->GetCellID(r,c, layer, mod);
2818 int p = setupT->GetChannelInLayer(tempCellID);
2819 pads[p]->Draw();
2820 pads[p]->cd();
2821 pads[p]->SetLogy(1);
2822 ithTrend=trending.find(tempCellID);
2823
2824 TString label = Form("row %d col %d", r, c);
2825 TString label2 = Form("Common V_{op} = %2.1f V", commanVoltage);
2826 if (p == 7){
2827 label = Form("row %d col %d layer %d", r, c, layer);
2828 }
2829 if(ithTrend==trending.end()){
2830 skipped++;
2831 std::cout << "WARNING: skipping cell ID: " << tempCellID << "\t row " << r << "\t column " << c << "\t layer " << layer << "\t module " << mod << std::endl;
2832 pads[p]->Clear();
2833 pads[p]->Draw();
2834 if (p ==4 ){
2835 TString lab1 = Form("#it{#bf{LFHCal TB:}} %s", GetStringFromRunInfo(currRunInfo, 9).Data());
2836 TString lab2 = GetStringFromRunInfo(currRunInfo, 8);
2837 TString lab3 = GetStringFromRunInfo(currRunInfo, 10);
2838 DrawLatex(topRCornerX[p]-0.045, topRCornerY[p]-1.2*relSize8P[p]-1*0.85*relSize8P[p], lab1, true, 0.85*textSizePixel, 43);
2839 DrawLatex(topRCornerX[p]-0.045, topRCornerY[p]-1.2*relSize8P[p]-2*0.85*relSize8P[p], lab2, true, 0.85*textSizePixel, 43);
2840 DrawLatex(topRCornerX[p]-0.045, topRCornerY[p]-1.2*relSize8P[p]-3*0.85*relSize8P[p], lab3, true, 0.85*textSizePixel, 43);
2841 }
2842
2843 DrawLatex(topRCornerX[p]-0.045, topRCornerY[p]-1.2*relSize8P[p], label, true, 0.85*textSizePixel, 43);
2844 continue;
2845 }
2846
2847 if (p ==7 ){
2848 double startLegY = topRCornerY[p]-lineBottom*relSize8P[p];
2849 double endLegY = topRCornerY[p]-1.4*relSize8P[p];
2850 legend = GetAndSetLegend2( 0.3, startLegY, topRCornerX[p]-0.045/2, endLegY,
2851 0.85*textSizePixel, 5, "",43,0.25);
2852 }
2853
2854 for (int rc = 0; rc < ithTrend->second.GetNRuns() && rc < 30; rc++ ){
2855 int tmpRunNr = ithTrend->second.GetRunNr(rc);
2856 histos[rc] = nullptr;
2857 if (tmpRunNr != -1) {
2858 if (optionTrend == 0){
2859 histos[rc] = ithTrend->second.GetHGTriggRun(ithTrend->second.GetRunNr(rc));
2860 } else if (optionTrend == 1){
2861 histos[rc] = ithTrend->second.GetLGTriggRun(ithTrend->second.GetRunNr(rc));
2862 }
2863 }
2864 if (histos[rc]){
2865 SetStyleHistoTH1ForGraphs( histos[rc], histos[rc]->GetXaxis()->GetTitle(), histos[rc]->GetYaxis()->GetTitle(), 0.85*textSizePixel, textSizePixel, 0.85*textSizePixel, textSizePixel,0.95, 1.3, 510, 510, 43, 63);
2866 SetLineDefaults(histos[rc], GetColorLayer(rc), 2, GetLineStyleLayer(rc));
2867 if(rc == 0){
2868 histos[rc]->GetXaxis()->SetRangeUser(xPMin,xPMax);
2869 histos[rc]->GetYaxis()->SetRangeUser(minY,maxY);
2870 histos[rc]->Draw("hist");
2871 } else {
2872 histos[rc]->Draw("same,hist");
2873 }
2874 if(p == 7) legend->AddEntry(histos[rc],Form("%d",tmpRunNr),"l");
2875 }
2876 }
2877 if (histos[0]) histos[0]->Draw("axis,same");
2878
2879
2880 DrawLatex(topRCornerX[p]-0.045, topRCornerY[p]-1.2*relSize8P[p], label, true, 0.85*textSizePixel, 43);
2881 if (isSameVoltage && p == 7){
2882 DrawLatex(topRCornerX[p]-0.045, topRCornerY[p]-(lineBottom+0.5)*relSize8P[p], label2, true, 0.85*textSizePixel, 43);
2883 }
2884
2885 if (p == 7) legend->Draw();
2886 if (p ==4 ){
2887 TString lab1 = Form("#it{#bf{LFHCal TB:}} %s", GetStringFromRunInfo(currRunInfo, 9).Data());
2888 TString lab2 = GetStringFromRunInfo(currRunInfo, 8);
2889 TString lab3 = GetStringFromRunInfo(currRunInfo, 10);
2890 DrawLatex(topRCornerX[p]-0.045, topRCornerY[p]-1.2*relSize8P[p]-1*0.85*relSize8P[p], lab1, true, 0.85*textSizePixel, 43);
2891 DrawLatex(topRCornerX[p]-0.045, topRCornerY[p]-1.2*relSize8P[p]-2*0.85*relSize8P[p], lab2, true, 0.85*textSizePixel, 43);
2892 DrawLatex(topRCornerX[p]-0.045, topRCornerY[p]-1.2*relSize8P[p]-3*0.85*relSize8P[p], lab3, true, 0.85*textSizePixel, 43);
2893 }
2894 }
2895 }
2896 if (skipped < 8){
2897 if(detailedPlot) canvas8Panel->SaveAs(nameOutput.Data());
2898 if (layer == 0) canvas8Panel->Print(Form("%s.pdf[",nameOutputSummary.Data()));
2899 canvas8Panel->Print(Form("%s.pdf",nameOutputSummary.Data()));
2900 if (layer == setupT->GetNMaxLayer()) canvas8Panel->Print(Form("%s.pdf]",nameOutputSummary.Data()));
2901 }
2902 }
2903
2904
2905
2906
2907 void PlotRunOverlayProfilePerLayer (TCanvas* canvas8Panel, TPad* pads[8], Double_t* topRCornerX, Double_t* topRCornerY, Double_t* relSize8P, Int_t textSizePixel,
2908 std::map<int,TileTrend> trending, int nruns,
2909 Double_t xPMin, Double_t xPMax, Double_t yPMin, Double_t yPMax, int layer, int mod, TString nameOutput, TString nameOutputSummary, RunInfo currRunInfo, Int_t detailedPlot = 1){
2910
2911 Setup* setupT = Setup::GetInstance();
2912
2913 std::map<int, TileTrend>::iterator ithTrend;
2914 int nRow = setupT->GetNMaxRow()+1;
2915 int nCol = setupT->GetNMaxColumn()+1;
2916 int skipped = 0;
2917
2918 bool isSameVoltage = true;
2919 double commanVoltage = 0;
2920 for (int r = 0; r < nRow; r++){
2921 for (int c = 0; c < nCol; c++){
2922 int tempCellID = setupT->GetCellID(r,c, layer, mod);
2923 ithTrend=trending.find(tempCellID);
2924 for (int rc = 0; rc < ithTrend->second.GetNRuns() && rc < 30; rc++ ){
2925 if (r == 0 && c == 0){
2926 if (rc == 0){
2927 commanVoltage = ithTrend->second.GetVoltage(rc);
2928 } else {
2929 if (commanVoltage != ithTrend->second.GetVoltage(rc)) isSameVoltage = false;
2930 }
2931 }
2932 }
2933 }
2934 }
2935 TProfile* profs[30];
2936
2937 double lineBottom = (1.4+6);
2938 if (nruns < 6) lineBottom = (1.4+1);
2939 else if (nruns < 11) lineBottom = (1.4+2);
2940 else if (nruns < 16) lineBottom = (1.4+3);
2941 else if (nruns < 21) lineBottom = (1.4+4);
2942 else if (nruns < 26) lineBottom = (1.4+5);
2943 TLegend* legend = nullptr;
2944
2945 for (int r = 0; r < nRow; r++){
2946 for (int c = 0; c < nCol; c++){
2947 canvas8Panel->cd();
2948 int tempCellID = setupT->GetCellID(r,c, layer, mod);
2949 int p = setupT->GetChannelInLayer(tempCellID);
2950 pads[p]->Draw();
2951 pads[p]->cd();
2952 pads[p]->SetLogy(0);
2953 ithTrend=trending.find(tempCellID);
2954
2955 TString label = Form("row %d col %d", r, c);
2956 TString label2 = Form("Common V_{op} = %2.1f V", commanVoltage);
2957 if (p == 7){
2958 label = Form("row %d col %d layer %d", r, c, layer);
2959 }
2960 if(ithTrend==trending.end()){
2961 skipped++;
2962 std::cout << "WARNING: skipping cell ID: " << tempCellID << "\t row " << r << "\t column " << c << "\t layer " << layer << "\t module " << mod << std::endl;
2963 pads[p]->Clear();
2964 pads[p]->Draw();
2965 if (p ==4 ){
2966 TString lab1 = Form("#it{#bf{LFHCal TB:}} %s", GetStringFromRunInfo(currRunInfo, 9).Data());
2967 TString lab2 = GetStringFromRunInfo(currRunInfo, 8);
2968 TString lab3 = GetStringFromRunInfo(currRunInfo, 10);
2969 DrawLatex(topRCornerX[p]+0.045, topRCornerY[p]-1.2*relSize8P[p]-1*0.85*relSize8P[p], lab1, false, 0.85*textSizePixel, 43);
2970 DrawLatex(topRCornerX[p]+0.045, topRCornerY[p]-1.2*relSize8P[p]-2*0.85*relSize8P[p], lab2, false, 0.85*textSizePixel, 43);
2971 DrawLatex(topRCornerX[p]+0.045, topRCornerY[p]-1.2*relSize8P[p]-3*0.85*relSize8P[p], lab3, false, 0.85*textSizePixel, 43);
2972 }
2973
2974 DrawLatex(topRCornerX[p]+0.045, topRCornerY[p]-1.2*relSize8P[p], label, false, 0.85*textSizePixel, 43);
2975 continue;
2976 }
2977
2978 if (p ==7 ){
2979 double startLegY = topRCornerY[p]-lineBottom*relSize8P[p];
2980 double endLegY = topRCornerY[p]-1.4*relSize8P[p];
2981 legend = GetAndSetLegend2( topRCornerX[p]+0.045/2, startLegY, 0.7, endLegY,
2982 0.85*textSizePixel, 5, "",43,0.25);
2983 }
2984
2985 TH1D* dummyhist;
2986 for (int rc = 0; rc < ithTrend->second.GetNRuns() && rc < 30; rc++ ){
2987 int tmpRunNr = ithTrend->second.GetRunNr(rc);
2988 profs[rc] = nullptr;
2989 if (tmpRunNr != -1) {
2990 profs[rc] = ithTrend->second.GetLGHGTriggRun(ithTrend->second.GetRunNr(rc));
2991 }
2992 if (profs[rc]){
2993 if (rc == 0){
2994 dummyhist = new TH1D("dummyhist", "", profs[rc]->GetNbinsX(), profs[rc]->GetXaxis()->GetXmin(), profs[rc]->GetXaxis()->GetXmax());
2995 SetStyleHistoTH1ForGraphs( dummyhist, profs[rc]->GetXaxis()->GetTitle(), profs[rc]->GetYaxis()->GetTitle(), 0.85*textSizePixel, textSizePixel, 0.85*textSizePixel, textSizePixel,0.9, 1.5, 510, 510, 43, 63);
2996 dummyhist->GetXaxis()->SetRangeUser(xPMin,xPMax);
2997 dummyhist->GetYaxis()->SetRangeUser(yPMin,yPMax);
2998 dummyhist->Draw("axis");
2999 }
3000
3001 SetLineDefaults(profs[rc], GetColorLayer(rc), 2, GetLineStyleLayer(rc));
3002 profs[rc]->SetMarkerStyle(24);
3003 profs[rc]->Draw("same,pe");
3004 if(p == 7) legend->AddEntry(profs[rc],Form("%d",tmpRunNr),"p");
3005 }
3006 }
3007 if (dummyhist) dummyhist->Draw("axis,same");
3008
3009
3010 DrawLatex(topRCornerX[p]+0.045, topRCornerY[p]-1.2*relSize8P[p], label, false, 0.85*textSizePixel, 43);
3011 if (isSameVoltage && p == 7){
3012 DrawLatex(topRCornerX[p]+0.045, topRCornerY[p]-(lineBottom+0.5)*relSize8P[p], label2, false, 0.85*textSizePixel, 43);
3013 }
3014
3015 if (p == 7) legend->Draw();
3016 if (p ==4 ){
3017 TString lab1 = Form("#it{#bf{LFHCal TB:}} %s", GetStringFromRunInfo(currRunInfo, 9).Data());
3018 TString lab2 = GetStringFromRunInfo(currRunInfo, 8);
3019 TString lab3 = GetStringFromRunInfo(currRunInfo, 10);
3020 DrawLatex(topRCornerX[p]+0.045, topRCornerY[p]-1.2*relSize8P[p]-1*0.85*relSize8P[p], lab1, false, 0.85*textSizePixel, 43);
3021 DrawLatex(topRCornerX[p]+0.045, topRCornerY[p]-1.2*relSize8P[p]-2*0.85*relSize8P[p], lab2, false, 0.85*textSizePixel, 43);
3022 DrawLatex(topRCornerX[p]+0.045, topRCornerY[p]-1.2*relSize8P[p]-3*0.85*relSize8P[p], lab3, false, 0.85*textSizePixel, 43);
3023 }
3024 }
3025 }
3026 if (skipped < 8){
3027 if(detailedPlot) canvas8Panel->SaveAs(nameOutput.Data());
3028 if (layer == 0) canvas8Panel->Print(Form("%s.pdf[",nameOutputSummary.Data()));
3029 canvas8Panel->Print(Form("%s.pdf",nameOutputSummary.Data()));
3030 if (layer == setupT->GetNMaxLayer()) canvas8Panel->Print(Form("%s.pdf]",nameOutputSummary.Data()));
3031 }
3032 }
3033
3034
3035
3036
3037 #endif