File indexing completed on 2026-10-08 08:36:30
0001
0002
0003
0004
0005 void DefaultCancasSettings( TCanvas* c1,
0006 Double_t leftMargin,
0007 Double_t rightMargin,
0008 Double_t topMargin,
0009 Double_t bottomMargin){
0010 c1->SetTickx();
0011 c1->SetTicky();
0012 c1->SetGridx(0);
0013 c1->SetGridy(0);
0014 c1->SetLogy(0);
0015 c1->SetLeftMargin(leftMargin);
0016 c1->SetRightMargin(rightMargin);
0017 c1->SetTopMargin(topMargin);
0018 c1->SetBottomMargin(bottomMargin);
0019 c1->SetFillColor(0);
0020 }
0021
0022
0023 void SetMarkerDefaultsTGraph( TGraph* graph,
0024 Style_t markerStyle,
0025 Size_t markerSize,
0026 Color_t markerColor,
0027 Color_t lineColor,
0028 Width_t lineWidth = 1,
0029 Style_t lineStyle = 1,
0030 Bool_t boxes = kFALSE,
0031 Color_t fillColor = 0,
0032 Bool_t isHollow = kFALSE
0033 ) {
0034 graph->SetMarkerStyle(markerStyle);
0035 graph->SetMarkerSize(markerSize);
0036 graph->SetMarkerColor(markerColor);
0037 graph->SetLineColor(lineColor);
0038 graph->SetLineWidth(lineWidth);
0039 graph->SetLineWidth(lineStyle);
0040 if (boxes){
0041 graph->SetFillColor(fillColor);
0042 if (fillColor!=0){
0043 if (!isHollow){
0044 graph->SetFillStyle(1001);
0045 } else {
0046 graph->SetFillStyle(0);
0047 }
0048 } else {
0049 graph->SetFillStyle(0);
0050 }
0051 }
0052 }
0053
0054
0055 void SetMarkerDefaults( TH1* histo1,
0056 TString xtitle = "",
0057 TString ytitle = "",
0058 Style_t markerStyle = 20,
0059 Size_t markerSize = 1,
0060 Color_t markerColor = kBlack,
0061 Color_t lineColor = kBlack,
0062 double textsize = 0.045,
0063 double labelsize = 0.045,
0064 double xoffset = 1.,
0065 double yoffset = 1. ) {
0066 histo1->SetTitle("");
0067 histo1->SetStats(0);
0068 histo1->SetMarkerStyle(markerStyle);
0069 histo1->SetMarkerSize(markerSize);
0070 histo1->SetMarkerColor(markerColor);
0071 histo1->SetLineColor(lineColor);
0072 histo1->GetYaxis()->SetLabelFont(42);
0073 histo1->GetXaxis()->SetLabelFont(42);
0074 histo1->GetYaxis()->SetLabelSize(labelsize);
0075 histo1->GetXaxis()->SetLabelSize(labelsize);
0076 histo1->GetYaxis()->SetTitleFont(62);
0077 histo1->GetXaxis()->SetTitleFont(62);
0078 histo1->GetYaxis()->SetTitleSize(textsize);
0079 histo1->GetXaxis()->SetTitleSize(textsize);
0080 if(!xtitle.EqualTo("")) histo1->GetXaxis()->SetTitle(xtitle);
0081 if(!ytitle.EqualTo("")) histo1->GetYaxis()->SetTitle(ytitle);
0082 histo1->GetXaxis()->SetTitleOffset(xoffset);
0083 histo1->GetYaxis()->SetTitleOffset(yoffset);
0084 }
0085
0086
0087
0088
0089 void StyleSettingsBasics( TString format = ""){
0090
0091 gStyle->SetOptDate(0);
0092 gStyle->SetOptStat(0);
0093 gStyle->SetPalette(1,0);
0094 gStyle->SetFrameBorderMode(0);
0095 gStyle->SetFrameFillColor(0);
0096 gStyle->SetTitleFillColor(0);
0097 gStyle->SetTextSize(0.5);
0098 gStyle->SetLabelSize(0.03,"xyz");
0099 gStyle->SetLabelOffset(0.006,"xyz");
0100 gStyle->SetTitleFontSize(0.04);
0101 gStyle->SetTitleOffset(1,"y");
0102 gStyle->SetTitleOffset(0.7,"x");
0103 gStyle->SetCanvasColor(0);
0104 gStyle->SetPadTickX(1);
0105 gStyle->SetPadTickY(1);
0106
0107 gStyle->SetLineWidth(1);
0108 gStyle->SetPaintTextFormat(".3f");
0109
0110 gStyle->SetPadTopMargin(0.03);
0111 gStyle->SetPadBottomMargin(0.09);
0112 gStyle->SetPadRightMargin(0.03);
0113 gStyle->SetPadLeftMargin(0.13);
0114
0115
0116 TGaxis::SetMaxDigits(4);
0117 gErrorIgnoreLevel=kError;
0118
0119 if (format.CompareTo("eps") == 0 ||format.CompareTo("pdf") == 0 ) gStyle->SetLineScalePS(1);
0120 }
0121
0122
0123 void SetStyleHistoTH3ForGraphs( TH2* histo,
0124 TString XTitle,
0125 TString YTitle,
0126 TString ZTitle,
0127 Size_t xLableSize,
0128 Size_t xTitleSize,
0129 Size_t yLableSize,
0130 Size_t yTitleSize,
0131 Size_t zLableSize,
0132 Size_t zTitleSize,
0133 Float_t xTitleOffset = 1,
0134 Float_t yTitleOffset = 1,
0135 Float_t zTitleOffset = 1,
0136 Int_t xNDivisions = 510,
0137 Int_t yNDivisions = 510,
0138 Int_t zNDivisions = 510,
0139 Font_t textFontLabel = 42,
0140 Font_t textFontTitle = 62
0141 ){
0142 histo->SetXTitle(XTitle);
0143 histo->SetYTitle(YTitle);
0144 histo->SetZTitle(ZTitle);
0145 histo->SetTitle("");
0146
0147 histo->GetXaxis()->SetLabelFont(textFontLabel);
0148 histo->GetYaxis()->SetLabelFont(textFontLabel);
0149 histo->GetZaxis()->SetLabelFont(textFontLabel);
0150 histo->GetXaxis()->SetTitleFont(textFontTitle);
0151 histo->GetYaxis()->SetTitleFont(textFontTitle);
0152 histo->GetZaxis()->SetTitleFont(textFontTitle);
0153
0154 histo->GetXaxis()->SetDecimals();
0155 histo->GetXaxis()->SetLabelSize(xLableSize);
0156 histo->GetXaxis()->SetTitleSize(xTitleSize);
0157 histo->GetXaxis()->SetTitleOffset(xTitleOffset);
0158 histo->GetXaxis()->SetNdivisions(xNDivisions,kTRUE);
0159
0160 histo->GetYaxis()->SetDecimals();
0161 histo->GetYaxis()->SetLabelSize(yLableSize);
0162 histo->GetYaxis()->SetTitleSize(yTitleSize);
0163 histo->GetYaxis()->SetTitleOffset(yTitleOffset);
0164 histo->GetYaxis()->SetNdivisions(yNDivisions,kTRUE);
0165
0166 histo->GetZaxis()->SetDecimals();
0167 histo->GetZaxis()->SetLabelSize(zLableSize);
0168 histo->GetZaxis()->SetTitleSize(zTitleSize);
0169 histo->GetZaxis()->SetTitleOffset(zTitleOffset);
0170 histo->GetZaxis()->SetNdivisions(zNDivisions,kTRUE);
0171 }
0172
0173
0174 void DrawCanvasSettings( TCanvas* c1,
0175 Double_t leftMargin,
0176 Double_t rightMargin,
0177 Double_t topMargin,
0178 Double_t bottomMargin){
0179
0180 c1->SetTickx();
0181 c1->SetTicky();
0182 c1->SetGridx(0);
0183 c1->SetGridy(0);
0184 c1->SetLogy(0);
0185 c1->SetLeftMargin(leftMargin);
0186 c1->SetRightMargin(rightMargin);
0187 c1->SetTopMargin(topMargin);
0188 c1->SetBottomMargin(bottomMargin);
0189 c1->SetFillColor(0);
0190 }
0191
0192
0193 TLegend *GetAndSetLegend2( Double_t positionX,
0194 Double_t positionY,
0195 Double_t positionXRight,
0196 Double_t positionYUp,
0197 Size_t textSize,
0198 Int_t columns = 1,
0199 TString header = "",
0200 Font_t textFont = 43,
0201 Double_t margin = 0
0202 ){
0203
0204 TLegend *legend = new TLegend(positionX,positionY,positionXRight,positionYUp);
0205 legend->SetNColumns(columns);
0206 legend->SetLineColor(0);
0207 legend->SetLineWidth(0);
0208 legend->SetFillColor(0);
0209 legend->SetFillStyle(0);
0210 legend->SetLineStyle(0);
0211 legend->SetBorderSize(0);
0212 legend->SetTextFont(textFont);
0213 legend->SetTextSize(textSize);
0214 if (margin != 0) legend->SetMargin(margin);
0215 if (header.CompareTo("")!= 0) legend->SetHeader(header);
0216 return legend;
0217 }
0218
0219
0220 void DrawLines(Float_t startX, Float_t endX,
0221 Float_t startY, Float_t endY,
0222 Float_t linew, Float_t lineColor = 4, Style_t lineStyle = 1, Float_t opacity = 1.){
0223 TLine * l1 = new TLine (startX,startY,endX,endY);
0224 l1->SetLineColor(lineColor);
0225 l1->SetLineWidth(linew);
0226 l1->SetLineStyle(lineStyle);
0227 if (opacity != 1.)
0228 l1->SetLineColorAlpha(lineColor,opacity);
0229
0230 l1->Draw("same");
0231 }
0232
0233
0234 void SetPlotStyle() {
0235
0236 const Int_t nRGBs = 5;
0237 const Int_t nCont = 255;
0238
0239 Double_t stops[nRGBs] = { 0.00, 0.34, 0.61, 0.84, 1.00 };
0240 Double_t red[nRGBs] = { 0.00, 0.00, 0.87, 1.00, 0.51 };
0241 Double_t green[nRGBs] = { 0.31, 0.81, 1.00, 0.20, 0.00 };
0242 Double_t blue[nRGBs] = { 0.51, 1., 0.12, 0.00, 0.00};
0243
0244 TColor::CreateGradientColorTable(nRGBs, stops, red, green, blue, nCont);
0245 gStyle->SetNumberContours(nCont);
0246 }
0247
0248
0249
0250 void DrawLatex( const double PosX = 0.5,
0251 const double PosY = 0.5,
0252 TString text = "",
0253 const bool alignRight = false,
0254 const double TextSize = 0.044,
0255 const int font = 42,
0256 const double dDist = 0.05,
0257 const int color = 1,
0258 double angle = 0.
0259 ){
0260
0261 std::vector<TString> Latex;
0262
0263 TObjArray *textStr = text.Tokenize(";");
0264 for(Int_t i = 0; i<textStr->GetEntries() ; i++){
0265 TObjString* tempObj = (TObjString*) textStr->At(i);
0266 Latex.push_back( tempObj->GetString());
0267 }
0268 for(unsigned int i = 0; i < Latex.size(); ++i){
0269 TLatex l(PosX, PosY - i*dDist, Latex[i]);
0270 l.SetNDC();
0271 l.SetTextFont(font);
0272 l.SetTextColor(color);
0273 l.SetTextSize(TextSize);
0274 if(alignRight) l.SetTextAlign(31);
0275 if (angle!= 0.)l.SetTextAngle(angle);
0276 l.DrawClone("same");
0277 }
0278 }
0279
0280 void DrawLabelsAndLinesLFHCal1D(Double_t min, Double_t max, Double_t textSizeRel, Double_t lumi = 1, Double_t averageZ = 500, Int_t option = 1){
0281
0282 if (option == 1){
0283 Double_t posXIns = -(0.0527*averageZ+1.4774);
0284 DrawLines(20, 20, min, min*4, 2, kGray+1, 7);
0285 DrawLines(6.5, 6.5, min, min*2, 2, kGray+1, 7);
0286 DrawLines(-40, -40, min, min*4, 2, kGray+1, 7);
0287 DrawLines(posXIns, posXIns, min, min*2, 2, kGray+1, 7);
0288 DrawLines(100, 100, min, min*4, 2, kGray+1, 7);
0289 DrawLines(-100, -100, min, min*4, 2, kGray+1, 7);
0290 DrawLines(250, 250, min, min*4, 2, kGray+1, 7);
0291 DrawLines(-250, -250, min, min*4, 2, kGray+1, 7);
0292
0293 DrawLines(20, 20, 0.7*max, max, 2, kGray+1, 7);
0294 DrawLines(6.5, 6.5, 0.7*max, max, 2, kGray+1, 7);
0295 DrawLines(-40, -40, 0.7*max, max, 2, kGray+1, 7);
0296 DrawLines(posXIns, posXIns, 0.7*max, max, 2, kGray+1, 7);
0297 DrawLines(100, 100, 0.7*max, max, 2, kGray+1, 7);
0298 DrawLines(-100, -100, 0.7*max, max, 2, kGray+1, 7);
0299 DrawLines(250, 250, 0.7*max, max, 2, kGray+1, 7);
0300 DrawLines(-250, -250, 0.7*max, max, 2, kGray+1, 7);
0301
0302 DrawLatex(0.5, 0.18, "insert", false,textSizeRel*0.85, 62,0.05, 1);
0303 DrawLatex(0.6, 0.21, "3x3 mm SiPMs", false,textSizeRel*0.85, 62,0.05, 1);
0304 DrawLatex(0.35, 0.21, "3x3 mm SiPMs", false,textSizeRel*0.85, 62,0.05, 1);
0305 DrawLatex(0.75, 0.18, "1.3x1.3 mm SiPMs", false,textSizeRel*0.85, 62,0.05, 1);
0306 DrawLatex(0.125, 0.18, "1.3x1.3 mm SiPMs", false,textSizeRel*0.85, 62,0.05, 1);
0307 DrawLatex(0.1, 0.92, Form("#it{LFHCal} region, %.0f fb^{-1}",lumi), false,textSizeRel, 62,0.05, 1);
0308 } else if (option == 2){
0309 DrawLines(30, 30, min, min*4, 2, kGray+1, 7);
0310 DrawLines(-30, -30, min, min*4, 2, kGray+1, 7);
0311 DrawLines(100, 100, min, min*4, 2, kGray+1, 7);
0312 DrawLines(-100, -100, min, min*4, 2, kGray+1, 7);
0313 DrawLines(250, 250, min, min*4, 2, kGray+1, 7);
0314 DrawLines(-250, -250, min, min*4, 2, kGray+1, 7);
0315
0316 DrawLatex(0.5, 0.18, "insert", false,textSizeRel*0.85, 62,0.05, 1);
0317 DrawLatex(0.6, 0.21, "3x3 mm SiPMs", false,textSizeRel*0.85, 62,0.05, 1);
0318 DrawLatex(0.35, 0.21, "3x3 mm SiPMs", false,textSizeRel*0.85, 62,0.05, 1);
0319 DrawLatex(0.75, 0.18, "1.3x1.3 mm SiPMs", false,textSizeRel*0.85, 62,0.05, 1);
0320 DrawLatex(0.125, 0.18, "1.3x1.3 mm SiPMs", false,textSizeRel*0.85, 62,0.05, 1);
0321 DrawLatex(0.1, 0.92, Form("#it{LFHCal} region, %.0f fb^{-1}",lumi), false,textSizeRel, 62,0.05, 1);
0322 }
0323 }
0324
0325 void DrawLabelsAndLinesLFHCal2D(Double_t* zPos, TString* labels, Double_t textSizeRel, Int_t option = 1){
0326 for (Int_t b =0; b < 9; b++){
0327 if (b == 0 || b == 8)
0328 DrawLines(zPos[b], zPos[b], -260, 260, 2, kBlack, 7);
0329 else
0330 DrawLines(zPos[b], zPos[b], -260, -210, 2, kGray+2, 7);
0331 }
0332 DrawLatex(0.185, 0.11, labels[0], false,textSizeRel*0.85, 62,0.05, 1, 90.);
0333 DrawLatex(0.26, 0.11, labels[1], false,textSizeRel*0.85, 62,0.05, 1, 90.);
0334 DrawLatex(0.35, 0.11, labels[2], false,textSizeRel*0.85, 62,0.05, 1, 90.);
0335 DrawLatex(0.45, 0.11, labels[3], false,textSizeRel*0.85, 62,0.05, 1, 90.);
0336 DrawLatex(0.54, 0.11, labels[4], false,textSizeRel*0.85, 62,0.05, 1, 90.);
0337 DrawLatex(0.64, 0.11, labels[5], false,textSizeRel*0.85, 62,0.05, 1, 90.);
0338 DrawLatex(0.71, 0.11, labels[6], false,textSizeRel*0.85, 62,0.05, 1, 90.);
0339 DrawLatex(0.76, 0.11, labels[7], false,textSizeRel*0.85, 62,0.05, 1, 90.);
0340
0341 DrawLines(zPos[0], zPos[8], -100, -100, 2, kBlack, 7);
0342 DrawLines(zPos[0], zPos[8], 100, 100, 2, kBlack, 7);
0343 DrawLines(zPos[0], zPos[8], 20, 20, 2, kBlack, 7);
0344 DrawLines(zPos[0], zPos[8], 6.5, 6.5, 2, kBlack, 7);
0345 DrawLines(zPos[0], zPos[8], -40, -40, 2, kBlack, 7);
0346 DrawLines(zPos[0], zPos[8], -20.85, -27.8, 2, kBlack, 7);
0347
0348 DrawLatex(0.17, 0.82, "1.3x1.3 mm SiPMs", false,textSizeRel*0.85, 62,0.05, 1);
0349 DrawLatex(0.17, 0.63, "3x3 mm SiPMs", false,textSizeRel*0.85, 62,0.05, 1);
0350 DrawLatex(0.17, 0.545, "insert", false,textSizeRel*0.85, 62,0.05, 1);
0351 DrawLatex(0.17, 0.465, "insert", false,textSizeRel*0.85, 62,0.05, 1);
0352 DrawLatex(0.17, 0.4, "3x3 mm SiPMs", false,textSizeRel*0.85, 62,0.05, 1);
0353 DrawLatex(0.17, 0.25, "1.3x1.3 mm SiPMs", false,textSizeRel*0.85, 62,0.05, 1);
0354
0355 }
0356
0357 void DrawLabelsAndLinesNHCal1D(Double_t min, Double_t max, Double_t textSizeRel, Double_t lumi = 1, Int_t option = 1){
0358
0359 if (option == 1){
0360 DrawLines(10, 10, min, min*4, 2, kGray+1, 7);
0361 DrawLines(253, 253, min, min*4, 2, kGray+1, 7);
0362 DrawLines(-10, -10, min, min*4, 2, kGray+1, 7);
0363 DrawLines(-253, -253, min, min*4, 2, kGray+1, 7);
0364
0365 DrawLatex(0.12, 0.92, Form("#it{NHCal} region, %.0f fb^{-1}",lumi), false,textSizeRel, 62,0.05, 1);
0366 } else if (option == 2){
0367 DrawLines(10, 10, min, min*4, 2, kGray+1, 7);
0368 DrawLines(253, 253, min, min*4, 2, kGray+1, 7);
0369 DrawLines(-10, -10, min, min*4, 2, kGray+1, 7);
0370 DrawLines(-253, -253, min, min*4, 2, kGray+1, 7);
0371
0372 DrawLatex(0.12, 0.92, Form("#it{NHCal} region, %.0f fb^{-1}",lumi), false,textSizeRel, 62,0.05, 1);
0373 }
0374 }
0375
0376 void DrawLabelsAndLinesNHCal2D(Double_t* zPos, TString* labels, Double_t textSizeRel, Int_t option = 1){
0377 for (Int_t b =0; b < 7; b++){
0378 if (b == 0 || b == 6)
0379 DrawLines(-zPos[b], -zPos[b], -260, 260, 2, kBlack, 7);
0380 else
0381 DrawLines(-zPos[b], -zPos[b], -260, -210, 2, kGray+2, 7);
0382 }
0383 DrawLatex(0.21, 0.11, labels[5], false,textSizeRel*0.85, 62,0.05, 1, 90.);
0384 DrawLatex(0.3, 0.11, labels[4], false,textSizeRel*0.85, 62,0.05, 1, 90.);
0385 DrawLatex(0.39, 0.11, labels[3], false,textSizeRel*0.85, 62,0.05, 1, 90.);
0386 DrawLatex(0.48, 0.11, labels[2], false,textSizeRel*0.85, 62,0.05, 1, 90.);
0387 DrawLatex(0.57, 0.11, labels[1], false,textSizeRel*0.85, 62,0.05, 1, 90.);
0388 DrawLatex(0.69, 0.11, labels[0], false,textSizeRel*0.85, 62,0.05, 1, 90.);
0389
0390 DrawLines(-zPos[0], -zPos[6], 10, 10, 2, kBlack, 7);
0391 DrawLines(-zPos[0], -zPos[6], -10, -10, 2, kBlack, 7);
0392 }
0393
0394 void DrawLabelsAndLinesBHCal2D(Double_t* rPos, Double_t textSizeRel, Int_t option = 1){
0395 for (Int_t b =0; b < 5; b++){
0396 if (b == 0 || b == 4){
0397 DrawLines(-327.825, 327.825, -rPos[b], -rPos[b], 2, kBlack, 7);
0398 DrawLines(-327.825, 327.825, rPos[b], rPos[b], 2, kBlack, 7);
0399 } else {
0400 DrawLines(-327.825, -327.825+40, -rPos[b], -rPos[b], 2, kGray+2, 7);
0401 DrawLines(327.825-40, 327.825, -rPos[b], -rPos[b], 2, kGray+2, 7);
0402 DrawLines(-327.825, -327.825+40, rPos[b], rPos[b], 2, kGray+2, 7);
0403 DrawLines(327.825-40, 327.825, rPos[b], rPos[b], 2, kGray+2, 7);
0404 }
0405 }
0406
0407
0408
0409
0410
0411
0412
0413 DrawLines(-327.825, -327.825,-rPos[4], rPos[4], 2, kBlack, 7);
0414 DrawLines(327.825, 327.825, -rPos[4], rPos[4], 2, kBlack, 7);
0415 }
0416
0417
0418 void SetStyleMultiGraph( TMultiGraph* mgraph,
0419 TString XTitle,
0420 TString YTitle,
0421 Size_t xLableSize,
0422 Size_t xTitleSize,
0423 Size_t yLableSize,
0424 Size_t yTitleSize,
0425 Float_t xTitleOffset = 1,
0426 Float_t yTitleOffset = 1,
0427 Int_t xNDivisions = 510,
0428 Int_t yNDivisions = 510,
0429 Font_t textFontLabel = 42,
0430 Font_t textFontTitle = 62
0431 ){
0432 mgraph->GetXaxis()->SetTitle(XTitle);
0433 mgraph->GetYaxis()->SetTitle(YTitle);
0434 mgraph->SetTitle("");
0435
0436 mgraph->GetYaxis()->SetLabelFont(textFontLabel);
0437 mgraph->GetXaxis()->SetLabelFont(textFontLabel);
0438 mgraph->GetYaxis()->SetTitleFont(textFontTitle);
0439 mgraph->GetXaxis()->SetTitleFont(textFontTitle);
0440
0441 mgraph->GetXaxis()->SetLabelSize(xLableSize);
0442 mgraph->GetXaxis()->SetTitleSize(xTitleSize);
0443 mgraph->GetXaxis()->SetTitleOffset(xTitleOffset);
0444 mgraph->GetXaxis()->SetNdivisions(xNDivisions,kTRUE);
0445
0446 mgraph->GetYaxis()->SetDecimals();
0447 mgraph->GetYaxis()->SetLabelSize(yLableSize);
0448 mgraph->GetYaxis()->SetTitleSize(yTitleSize);
0449 mgraph->GetYaxis()->SetTitleOffset(yTitleOffset);
0450 mgraph->GetYaxis()->SetNdivisions(yNDivisions,kTRUE);
0451 }
0452