File indexing completed on 2025-01-18 09:15:50
0001
0002
0003
0004
0005
0006 #ifndef PLOTTINGGENERAL
0007 #define PLOTTINGGENERAL
0008
0009 #include <TStyle.h>
0010 #include <TGaxis.h>
0011 #include <TCanvas.h>
0012 #include <TLegend.h>
0013 #include <TFrame.h>
0014 #include "TArrow.h"
0015 #include "TMarker.h"
0016 #include "TFile.h"
0017 #include "TMinuit.h"
0018 #include "TRandom.h"
0019 #include "TRandom3.h"
0020 #include "TSystem.h"
0021 #include "TObjString.h"
0022 #ifndef __CLING__
0023 #include <Riostream.h>
0024 #include <TLatex.h>
0025 #endif
0026 #include <TProfile.h>
0027
0028 struct runInfo{
0029 runInfo(): runNr(0), species(""), energy(0), vop(0), lgSet(0), hgSet(0), assemblyNr(0){}
0030 int runNr;
0031 TString species;
0032 float energy;
0033 float vop;
0034 int lgSet;
0035 int hgSet;
0036 int assemblyNr;
0037 } ;
0038 using namespace std;
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051 std::vector<runInfo> readRunInfosFromFile(TString runListFileName, Int_t debug, Int_t specialData = 0 ){
0052 std::vector<runInfo> runs;
0053 std::cout << "INFO: You have given the following run list file: " << runListFileName.Data() << std::endl;
0054 ifstream runListFile;
0055 runListFile.open(runListFileName,ios_base::in);
0056 if (!runListFile) {
0057 std::cout << "ERROR: file " << runListFileName.Data() << " not found!" << std::endl;
0058 return runs;
0059 }
0060
0061 for( TString tempLine; tempLine.ReadLine(runListFile, kTRUE); ) {
0062
0063 if (tempLine.BeginsWith("%") || tempLine.BeginsWith("#")){
0064 continue;
0065 }
0066 if (debug > 0) std::cout << tempLine.Data() << std::endl;
0067
0068
0069 TObjArray *tempArr = tempLine.Tokenize("\t");
0070 if(tempArr->GetEntries()<1){
0071 if (debug > 1) std::cout << "nothing to be done" << std::endl;
0072 delete tempArr;
0073 continue;
0074 } else if (tempArr->GetEntries() == 1 ){
0075
0076 tempArr = tempLine.Tokenize(" ");
0077 if(tempArr->GetEntries()<1){
0078 if (debug > 1) std::cout << "nothing to be done" << std::endl;
0079 delete tempArr;
0080 continue;
0081 } else if (tempArr->GetEntries() == 1 ) {
0082 if (debug > 1) std::cout << ((TString)((TObjString*)tempArr->At(0))->GetString()).Data() << " has not been reset, no value given!" << std::endl;
0083 delete tempArr;
0084 continue;
0085 }
0086 }
0087
0088
0089 runInfo tempRun;
0090 tempRun.runNr = ((TString)((TObjString*)tempArr->At(0))->GetString()).Atoi();
0091 tempRun.species = (TString)((TObjString*)tempArr->At(1))->GetString();
0092 tempRun.energy = ((TString)((TObjString*)tempArr->At(2))->GetString()).Atof();
0093 tempRun.vop = ((TString)((TObjString*)tempArr->At(3))->GetString()).Atof();
0094 tempRun.hgSet = ((TString)((TObjString*)tempArr->At(4))->GetString()).Atoi();
0095 tempRun.lgSet = ((TString)((TObjString*)tempArr->At(5))->GetString()).Atoi();
0096 if (specialData == 1) tempRun.assemblyNr = ((TString)((TObjString*)tempArr->At(6))->GetString()).Atoi();
0097
0098 if (debug > 0) std::cout << "Run " << tempRun.runNr << "\t species: " << tempRun.species << "\t energy: " << tempRun.energy << "\t Vop: " << tempRun.vop << std::endl;
0099 runs.push_back(tempRun);
0100 }
0101 std::cout << "registered " << runs.size() << std::endl;
0102 return runs;
0103 }
0104
0105
0106
0107
0108 Int_t findCurrentRun(std::vector<runInfo> runs, Int_t run){
0109 Int_t currRun = 0;
0110 while (runs.at(currRun).runNr != run && currRun < (Int_t)runs.size()) currRun++;
0111 if (currRun == (Int_t)runs.size()) return -1;
0112 else return currRun;
0113 }
0114
0115
0116
0117
0118 runInfo GetRunInfoObject(std::vector<runInfo> runs, Int_t runIndex){
0119 runInfo run;
0120 run.runNr = runs.at(runIndex).runNr;
0121 run.species = runs.at(runIndex).species;
0122 run.energy = runs.at(runIndex).energy;
0123 run.vop = runs.at(runIndex).vop;
0124 run.lgSet = runs.at(runIndex).lgSet;
0125 run.hgSet = runs.at(runIndex).hgSet;
0126 run.assemblyNr = runs.at(runIndex).assemblyNr;
0127 return run;
0128 }
0129
0130
0131
0132 TString ReturnDateStr(){
0133 TDatime today;
0134 int iDate = today.GetDate();
0135 int iYear = iDate/10000;
0136 int iMonth = (iDate%10000)/100;
0137 int iDay = iDate%100;
0138 return Form("%i_%02d_%02d",iYear, iMonth, iDay);
0139 }
0140
0141
0142
0143
0144
0145
0146 void StyleSettingsThesis( TString format = ""){
0147
0148 gStyle->SetOptDate(0);
0149 gStyle->SetOptStat(0);
0150 gStyle->SetPalette(1,0);
0151 gStyle->SetFrameBorderMode(0);
0152 gStyle->SetFrameFillColor(0);
0153 gStyle->SetTitleFillColor(0);
0154 gStyle->SetTextSize(0.5);
0155 gStyle->SetLabelSize(0.03,"xyz");
0156 gStyle->SetLabelOffset(0.006,"xyz");
0157 gStyle->SetTitleFontSize(0.04);
0158 gStyle->SetTitleOffset(1,"y");
0159 gStyle->SetTitleOffset(0.7,"x");
0160 gStyle->SetCanvasColor(0);
0161 gStyle->SetPadTickX(1);
0162 gStyle->SetPadTickY(1);
0163 gStyle->SetLineWidth(1);
0164
0165 gStyle->SetPadTopMargin(0.03);
0166 gStyle->SetPadBottomMargin(0.09);
0167 gStyle->SetPadRightMargin(0.03);
0168 gStyle->SetPadLeftMargin(0.13);
0169
0170
0171 TGaxis::SetMaxDigits(4);
0172 gErrorIgnoreLevel=kError;
0173
0174 if (format.CompareTo("eps") == 0 ||format.CompareTo("pdf") == 0 ) gStyle->SetLineScalePS(1);
0175 }
0176
0177
0178
0179
0180 void StyleSettings(){
0181
0182 gStyle->SetOptDate(0);
0183 gStyle->SetOptStat(0);
0184 gStyle->SetPalette(1,0);
0185 gStyle->SetFrameBorderMode(0);
0186 gStyle->SetFrameFillColor(0);
0187 gStyle->SetTitleFillColor(0);
0188 gStyle->SetTextSize(0.5);
0189 gStyle->SetLabelSize(0.03,"xyz");
0190 gStyle->SetLabelOffset(0.002,"xyz");
0191 gStyle->SetTitleFontSize(0.04);
0192 gStyle->SetTitleOffset(1,"y");
0193 gStyle->SetTitleOffset(0.7,"x");
0194 gStyle->SetCanvasColor(0);
0195 gStyle->SetPadTickX(1);
0196 gStyle->SetPadTickY(1);
0197 gStyle->SetLineWidth(1);
0198
0199 gStyle->SetPadTopMargin(0.1);
0200 gStyle->SetPadBottomMargin(0.1);
0201 gStyle->SetPadRightMargin(0.08);
0202 gStyle->SetPadLeftMargin(0.12);
0203
0204 gErrorIgnoreLevel=kError;
0205
0206 TGaxis::SetMaxDigits(3);
0207 }
0208
0209
0210 void SetPlotStyle() {
0211
0212 const Int_t nRGBs = 5;
0213 const Int_t nCont = 255;
0214
0215 Double_t stops[nRGBs] = { 0.00, 0.34, 0.61, 0.84, 1.00 };
0216 Double_t red[nRGBs] = { 0.00, 0.00, 0.87, 1.00, 0.51 };
0217 Double_t green[nRGBs] = { 0.31, 0.81, 1.00, 0.20, 0.00 };
0218 Double_t blue[nRGBs] = { 0.51, 1., 0.12, 0.00, 0.00};
0219
0220
0221
0222
0223
0224
0225
0226
0227 TColor::CreateGradientColorTable(nRGBs, stops, red, green, blue, nCont);
0228 gStyle->SetNumberContours(nCont);
0229 }
0230
0231
0232 void SetPlotStyleNConts( Int_t nCont = 255) {
0233 const Int_t nRGBs = 5;
0234 Double_t stops[nRGBs] = { 0.00, 0.34, 0.61, 0.84, 1.00 };
0235 Double_t red[nRGBs] = { 0.00, 0.00, 0.87, 1.00, 0.51 };
0236 Double_t green[nRGBs] = { 0.00, 0.81, 1.00, 0.20, 0.00 };
0237 Double_t blue[nRGBs] = { 0.51, 1.00, 0.12, 0.00, 0.00 };
0238 TColor::CreateGradientColorTable(nRGBs, stops, red, green, blue, nCont);
0239 gStyle->SetNumberContours(nCont);
0240 }
0241
0242
0243 void DrawCanvasSettings( TCanvas* c1,
0244 Double_t leftMargin,
0245 Double_t rightMargin,
0246 Double_t topMargin,
0247 Double_t bottomMargin){
0248
0249 c1->SetTickx();
0250 c1->SetTicky();
0251 c1->SetGridx(0);
0252 c1->SetGridy(0);
0253 c1->SetLogy(0);
0254 c1->SetLeftMargin(leftMargin);
0255 c1->SetRightMargin(rightMargin);
0256 c1->SetTopMargin(topMargin);
0257 c1->SetBottomMargin(bottomMargin);
0258 c1->SetFillColor(0);
0259 }
0260
0261
0262 TCanvas *GetAndSetCanvas( TString name,
0263 Double_t leftmargin = 0.11,
0264 Double_t bottommargin = 0.1,
0265 Double_t x = 1400,
0266 Double_t y = 1000){
0267
0268 TCanvas *canvas = new TCanvas(name,name,x,y);
0269 canvas->SetLeftMargin(leftmargin);
0270 canvas->SetRightMargin(0.015);
0271 canvas->SetTopMargin(0.03);
0272 canvas->SetBottomMargin(bottommargin);
0273 canvas->SetFillColor(0);
0274
0275 return canvas;
0276
0277 }
0278
0279
0280 TLegend *GetAndSetLegend( Double_t positionX,
0281 Double_t positionY,
0282 Double_t entries,
0283 Int_t Columns = 1,
0284 TString header =""){
0285
0286 if(header.CompareTo("") != 0) entries++;
0287 Double_t positionYPlus = 0.04*1.1*(Double_t)entries;
0288 TLegend *legend = new TLegend(positionX,positionY,positionX+(0.25*Columns),positionY+positionYPlus);
0289 legend->SetNColumns(Columns);
0290 legend->SetLineColor(0);
0291 legend->SetLineWidth(0);
0292 legend->SetFillColor(0);
0293 legend->SetFillStyle(0);
0294 legend->SetLineStyle(0);
0295 legend->SetTextSize(0.04);
0296 legend->SetTextFont(42);
0297 if(header.CompareTo("") != 0)legend->SetHeader(header);
0298 return legend;
0299 }
0300
0301
0302 TLegend *GetAndSetLegend2( Double_t positionX,
0303 Double_t positionY,
0304 Double_t positionXRight,
0305 Double_t positionYUp,
0306 Size_t textSize,
0307 Int_t columns = 1,
0308 TString header = "",
0309 Font_t textFont = 43,
0310 Double_t margin = 0
0311 ){
0312
0313 TLegend *legend = new TLegend(positionX,positionY,positionXRight,positionYUp);
0314 legend->SetNColumns(columns);
0315 legend->SetLineColor(0);
0316 legend->SetLineWidth(0);
0317 legend->SetFillColor(0);
0318 legend->SetFillStyle(0);
0319 legend->SetLineStyle(0);
0320 legend->SetBorderSize(0);
0321 legend->SetTextFont(textFont);
0322 legend->SetTextSize(textSize);
0323 if (margin != 0) legend->SetMargin(margin);
0324 if (header.CompareTo("")!= 0) legend->SetHeader(header);
0325 return legend;
0326 }
0327
0328
0329 void SetHistogramm( TH1 *hist,
0330 TString xLabel,
0331 TString yLabel,
0332 Double_t rangeYlow = -99.,
0333 Double_t rangeYhigh = -99.,
0334 Double_t xOffset = 1.0,
0335 Double_t yOffset = 1.15,
0336 Font_t font = 42
0337 ){
0338
0339 Double_t scale = 1./gPad->GetAbsHNDC();
0340
0341 if(rangeYlow != -99.) hist->GetYaxis()->SetRangeUser(rangeYlow,rangeYhigh);
0342 hist->SetTitle("");
0343 hist->SetXTitle(xLabel);
0344 hist->SetYTitle(yLabel);
0345 hist->GetYaxis()->SetDecimals();
0346 hist->GetYaxis()->SetTitleOffset(yOffset/scale);
0347 hist->GetXaxis()->SetTitleOffset(xOffset);
0348 hist->GetXaxis()->SetTitleSize(0.04*scale);
0349 hist->GetYaxis()->SetTitleSize(0.04*scale);
0350 hist->GetXaxis()->SetLabelSize(0.035*scale);
0351 hist->GetYaxis()->SetLabelSize(0.035*scale);
0352 hist->GetXaxis()->SetLabelFont(font);
0353 hist->GetYaxis()->SetLabelFont(font);
0354 hist->SetMarkerSize(1.);
0355 hist->SetMarkerStyle(20);
0356 }
0357
0358
0359 void SetGraph( TGraph *graph,
0360 TString xLabel,
0361 TString yLabel,
0362 Double_t rangeYlow = -99.,
0363 Double_t rangeYhigh = -99.,
0364 Double_t xOffset = 1.0,
0365 Double_t yOffset = 1.15){
0366
0367 Double_t scale = 1./gPad->GetAbsHNDC();
0368
0369 if(rangeYlow != -99.) graph->GetYaxis()->SetRangeUser(rangeYlow,rangeYhigh);
0370 graph->GetXaxis()->SetTitle(xLabel);
0371 graph->GetYaxis()->SetTitle(yLabel);
0372 graph->GetYaxis()->SetDecimals();
0373 graph->GetYaxis()->SetTitleOffset(yOffset/scale);
0374 graph->GetXaxis()->SetTitleOffset(xOffset);
0375 graph->GetXaxis()->SetTitleSize(0.04*scale);
0376 graph->GetYaxis()->SetTitleSize(0.04*scale);
0377 graph->GetXaxis()->SetLabelSize(0.035*scale);
0378 graph->GetYaxis()->SetLabelSize(0.035*scale);
0379 graph->GetXaxis()->SetLabelFont(42);
0380 graph->GetYaxis()->SetLabelFont(42);
0381 graph->SetMarkerSize(1.);
0382 graph->SetMarkerStyle(20);
0383 }
0384
0385
0386 void SetMarkerDefaults( TH1* histo1,
0387 Style_t markerStyle,
0388 Size_t markerSize,
0389 Color_t markerColor,
0390 Color_t lineColor,
0391 Bool_t setFont = kTRUE) {
0392 histo1->SetMarkerStyle(markerStyle);
0393 histo1->SetMarkerSize(markerSize);
0394 histo1->SetMarkerColor(markerColor);
0395 histo1->SetLineColor(lineColor);
0396 if (setFont){
0397 histo1->GetYaxis()->SetLabelFont(42);
0398 histo1->GetXaxis()->SetLabelFont(42);
0399 histo1->GetYaxis()->SetTitleFont(62);
0400 histo1->GetXaxis()->SetTitleFont(62);
0401 }
0402 }
0403
0404 void SetMarkerDefaults( TH1* histo1,
0405 TString xtitle = "",
0406 TString ytitle = "",
0407 Style_t markerStyle = 20,
0408 Size_t markerSize = 1,
0409 Color_t markerColor = kBlack,
0410 Color_t lineColor = kBlack,
0411 double textsize = 0.045,
0412 double labelsize = 0.045,
0413 double xoffset = 1.,
0414 double yoffset = 1. ) {
0415 histo1->SetTitle("");
0416 histo1->SetStats(0);
0417 histo1->SetMarkerStyle(markerStyle);
0418 histo1->SetMarkerSize(markerSize);
0419 histo1->SetMarkerColor(markerColor);
0420 histo1->SetLineColor(lineColor);
0421 histo1->GetYaxis()->SetLabelFont(42);
0422 histo1->GetXaxis()->SetLabelFont(42);
0423 histo1->GetYaxis()->SetLabelSize(labelsize);
0424 histo1->GetXaxis()->SetLabelSize(labelsize);
0425 histo1->GetYaxis()->SetTitleFont(62);
0426 histo1->GetXaxis()->SetTitleFont(62);
0427 histo1->GetYaxis()->SetTitleSize(textsize);
0428 histo1->GetXaxis()->SetTitleSize(textsize);
0429 if(!xtitle.EqualTo("")) histo1->GetXaxis()->SetTitle(xtitle);
0430 if(!ytitle.EqualTo("")) histo1->GetYaxis()->SetTitle(ytitle);
0431 histo1->GetXaxis()->SetTitleOffset(xoffset);
0432 histo1->GetYaxis()->SetTitleOffset(yoffset);
0433 }
0434
0435 void SetMarkerDefaultsProfile( TProfile* prof,
0436 Style_t markerStyle,
0437 Size_t markerSize,
0438 Color_t markerColor,
0439 Color_t lineColor ) {
0440 prof->SetMarkerStyle(markerStyle);
0441 prof->SetMarkerSize(markerSize);
0442 prof->SetMarkerColor(markerColor);
0443 prof->SetLineColor(lineColor);
0444 prof->GetYaxis()->SetLabelFont(42);
0445 prof->GetXaxis()->SetLabelFont(42);
0446 prof->GetYaxis()->SetTitleFont(62);
0447 prof->GetXaxis()->SetTitleFont(62);
0448 }
0449
0450
0451 void SetLineDefaults( TH1* histo1,
0452 Int_t LineColor,
0453 Int_t LineWidth,
0454 Int_t LineStyle ) {
0455 histo1->SetLineColor(LineColor);
0456 histo1->SetLineWidth(LineWidth);
0457 histo1->SetLineStyle(LineStyle);
0458 }
0459
0460
0461 void SetLineDefaultsTF1( TF1* Fit1,
0462 Int_t LineColor,
0463 Int_t LineWidth,
0464 Int_t LineStyle ) {
0465 Fit1->SetLineColor(LineColor);
0466 Fit1->SetLineWidth(LineWidth);
0467 Fit1->SetLineStyle(LineStyle);
0468 }
0469
0470
0471
0472 void ScalingHistogram(TH1 *histo, Double_t Factor){
0473 histo->Sumw2();
0474 histo->Scale(Factor);
0475 }
0476
0477
0478
0479 void ScalingHistogram(TH2 *histo, Double_t Factor){
0480 histo->Sumw2();
0481 histo->Scale(Factor);
0482 }
0483
0484
0485 void StylingSliceHistos(TH1 *histo, Float_t markersize){
0486 histo->SetMarkerStyle(20);
0487 histo->SetMarkerSize(markersize);
0488 }
0489
0490
0491 void DivideTH1ByBinWidth(TH1 *histo){
0492 histo->Sumw2();
0493 for (Int_t i = 1; i < histo->GetNbinsX()+1; i++){
0494 histo->SetBinContent(i,histo->GetBinContent(i)/histo->GetXaxis()->GetBinWidth(i));
0495 histo->SetBinError(i,histo->GetBinError(i)/histo->GetXaxis()->GetBinWidth(i));
0496 }
0497 }
0498
0499 void DivideTH2ByBinWidth(TH2 *histo){
0500 histo->Sumw2();
0501 for (Int_t i = 1; i < histo->GetNbinsX()+1; i++){
0502 for (Int_t j = 1; j < histo->GetNbinsY()+1; j++){
0503 histo->SetBinContent(i,j,histo->GetBinContent(i,j)/histo->GetXaxis()->GetBinWidth(i)/histo->GetXaxis()->GetBinWidth(i));
0504 histo->SetBinError(i,j,histo->GetBinError(i,j)/histo->GetXaxis()->GetBinWidth(i)/histo->GetXaxis()->GetBinWidth(i));
0505 }
0506 }
0507 }
0508
0509 void RebinWithBinCorrection(TH1 *histo, Int_t rebinFactor, Int_t bin = 3){
0510 histo->Sumw2();
0511 histo->Rebin(rebinFactor);
0512 Double_t binWidth= histo->GetXaxis()->GetBinWidth(bin);
0513 for (Int_t i = 1; i < histo->GetNbinsX()+1; i++){
0514 histo->SetBinContent(i,histo->GetBinContent(i)/binWidth);
0515 histo->SetBinError(i,histo->GetBinError(i)/binWidth);
0516 }
0517 }
0518
0519
0520 void RebinWithBinCorrection2D(TH2 *histo, Int_t rebinFactor1, Int_t rebinFactor2, Int_t bin = 3){
0521
0522 histo->Rebin2D(rebinFactor1,rebinFactor2);
0523 Double_t binWidthY= histo->GetYaxis()->GetBinWidth(bin);
0524 Double_t binWidthX= histo->GetXaxis()->GetBinWidth(bin);
0525 histo->Scale(1/binWidthY*1/binWidthX);
0526 }
0527
0528
0529 void RebinWithBinCorrection2DSumw2(TH2 *histo, Int_t rebinFactor1, Int_t rebinFactor2, Int_t bin = 3){
0530 histo->Sumw2();
0531 histo->Rebin2D(rebinFactor1,rebinFactor2);
0532 Double_t binWidthY= histo->GetYaxis()->GetBinWidth(bin);
0533 Double_t binWidthX= histo->GetXaxis()->GetBinWidth(bin);
0534 histo->Scale(1/binWidthY*1/binWidthX);
0535 }
0536
0537
0538
0539
0540
0541
0542
0543
0544
0545
0546
0547
0548
0549
0550
0551
0552
0553
0554 void DrawAutoHisto( TH1* histo1,
0555 TString Title,
0556 TString XTitle,
0557 TString YTitle,
0558 Bool_t YRangeMax,
0559 Double_t YMaxFactor,
0560 Double_t YMinimum,
0561 Bool_t YRange,
0562 Double_t YMin,
0563 Double_t YMax,
0564 Bool_t XRange,
0565 Double_t XMin,
0566 Double_t XMax,
0567 Double_t yOffset=1.,
0568 Double_t dummyWUP=1.) {
0569 if (dummyWUP){}
0570 if (YRangeMax && !XRange){
0571 YRange = kFALSE;
0572 Double_t maxRangeR = histo1->GetMaximum();
0573 Double_t minRangeR = histo1->GetMinimum();
0574 if(YMinimum > minRangeR){minRangeR = YMinimum;}
0575 histo1->GetYaxis()->SetRangeUser(minRangeR, maxRangeR*YMaxFactor);
0576 }
0577 if (YRangeMax && XRange){
0578 YRange = kFALSE;
0579 Double_t maxRangeR = histo1->GetMaximum();
0580 Double_t minRangeR = histo1->GetMinimum();
0581 if(YMinimum > minRangeR){minRangeR = YMinimum;}
0582 histo1->GetYaxis()->SetRangeUser(minRangeR, maxRangeR*YMaxFactor);
0583 histo1->GetXaxis()->SetRangeUser(XMin, XMax);
0584 }
0585 if (YRange && XRange){
0586 histo1->GetYaxis()->SetRangeUser(YMin, YMax);
0587 histo1->GetXaxis()->SetRangeUser(XMin, XMax);
0588 }
0589 if (!YRangeMax && !YRange && XRange){
0590 histo1->GetXaxis()->SetRangeUser(XMin, XMax);
0591 }
0592
0593 if (YRange && !XRange){
0594 histo1->GetYaxis()->SetRangeUser(YMin, YMax);
0595 }
0596
0597
0598 histo1->SetTitle(Title.Data());
0599
0600 if(XTitle.CompareTo("") != 0){
0601 histo1->SetXTitle(XTitle.Data());
0602 }
0603 if(YTitle.CompareTo("") != 0){
0604 histo1->SetYTitle(YTitle.Data());
0605 }
0606
0607 histo1->GetYaxis()->SetLabelFont(42);
0608 histo1->GetXaxis()->SetLabelFont(42);
0609 histo1->GetYaxis()->SetTitleFont(62);
0610 histo1->GetXaxis()->SetTitleFont(62);
0611 histo1->GetYaxis()->SetLabelSize(0.035);
0612 histo1->GetYaxis()->SetTitleSize(0.043);
0613 histo1->GetYaxis()->SetDecimals();
0614 histo1->GetYaxis()->SetTitleOffset(yOffset);
0615 histo1->GetXaxis()->SetTitleSize(0.043);
0616 histo1->GetXaxis()->SetLabelSize(0.035);
0617 histo1->DrawCopy("e,hist");
0618 }
0619
0620
0621
0622
0623
0624
0625
0626
0627
0628
0629
0630
0631
0632
0633
0634 void DrawAutoHisto2D( TH2 *histo,
0635 TString Title,
0636 TString XTitle,
0637 TString YTitle,
0638 TString Input,
0639 Bool_t YRange,
0640 Float_t YMin,
0641 Float_t YMax,
0642 Bool_t XRange,
0643 Float_t XMin,
0644 Float_t XMax,
0645 Double_t titleOffsetX = 1.2,
0646 Double_t titleOffsetY = 1.4,
0647 Size_t labelSizeX = 0.035,
0648 Size_t titleSizeX = 0.043,
0649 Size_t labelSizeY = 0.035,
0650 Size_t titleSizeY = 0.043){
0651
0652
0653 if (YRange && XRange){
0654 histo->GetYaxis()->SetRangeUser(YMin, YMax);
0655 histo->GetXaxis()->SetRangeUser(XMin, XMax);
0656 }
0657 if ( !YRange && XRange){
0658 histo->GetXaxis()->SetRangeUser(XMin, XMax);
0659 }
0660
0661 if (YRange && !XRange){
0662 histo->GetYaxis()->SetRangeUser(YMin, YMax);
0663 }
0664
0665 if(Title.CompareTo("") != 0){
0666 histo->SetTitle(Title.Data());
0667 }
0668 if(XTitle.CompareTo("") != 0){
0669 histo->SetXTitle(XTitle.Data());
0670 }
0671 if(YTitle.CompareTo("") != 0){
0672 histo->SetYTitle(YTitle.Data());
0673 }
0674 histo->GetYaxis()->SetLabelFont(42);
0675 histo->GetXaxis()->SetLabelFont(42);
0676 histo->GetYaxis()->SetTitleFont(62);
0677 histo->GetXaxis()->SetTitleFont(62);
0678
0679 histo->GetYaxis()->SetLabelSize(labelSizeY);
0680 histo->GetYaxis()->SetTitleSize(titleSizeY);
0681 histo->GetYaxis()->SetTitleOffset(titleOffsetY);
0682 histo->GetYaxis()->SetDecimals();
0683
0684 histo->GetXaxis()->SetLabelSize(labelSizeX);
0685 histo->GetXaxis()->SetTitleSize(titleSizeX);
0686 histo->GetXaxis()->SetTitleOffset(titleOffsetX);
0687 histo->DrawCopy("colz");
0688 if(Input.CompareTo("") != 0){
0689 TLegend* leg2 = new TLegend(0.6,0.82,0.83,0.9);
0690 leg2->SetTextSize(0.04);
0691 leg2->SetFillColor(0);
0692 leg2->AddEntry(histo,(Input.Data()));
0693 leg2->Draw("same");
0694 }
0695 }
0696
0697
0698
0699
0700
0701
0702
0703
0704
0705
0706
0707
0708
0709
0710
0711
0712
0713
0714 void DrawRatioHisto( TH1* histo1,
0715 TString Title,
0716 TString XTitle,
0717 TString YTitle,
0718 Bool_t YRangeMax,
0719 Float_t YMaxFactor,
0720 Float_t YMinimum,
0721 Bool_t YRange,
0722 Float_t YMin,
0723 Float_t YMax,
0724 Bool_t XRange,
0725 Float_t XMin,
0726 Float_t XMax) {
0727 if (YRangeMax && !XRange){
0728 YRange = kFALSE;
0729 Double_t maxRangeR = histo1->GetMaximum();
0730 Double_t minRangeR = histo1->GetMinimum();
0731 if(YMinimum > minRangeR){minRangeR = YMinimum;}
0732 histo1->GetYaxis()->SetRangeUser(minRangeR, maxRangeR*YMaxFactor);
0733 }
0734 if (YRangeMax && XRange){
0735 YRange = kFALSE;
0736 Double_t maxRangeR = histo1->GetMaximum();
0737 Double_t minRangeR = histo1->GetMinimum();
0738 if(YMinimum > minRangeR){minRangeR = YMinimum;}
0739 histo1->GetYaxis()->SetRangeUser(minRangeR, maxRangeR*YMaxFactor);
0740 histo1->GetXaxis()->SetRangeUser(XMin, XMax);
0741 }
0742 if (YRange && XRange){
0743 histo1->GetYaxis()->SetRangeUser(YMin, YMax);
0744 histo1->GetXaxis()->SetRangeUser(XMin, XMax);
0745 }
0746 if (!YRangeMax && !YRange && XRange){
0747 histo1->GetXaxis()->SetRangeUser(XMin, XMax);
0748 }
0749
0750 if (YRange && !XRange){
0751 histo1->GetYaxis()->SetRangeUser(YMin, YMax);
0752 }
0753
0754 if(Title.CompareTo("") != 0){ histo1->SetTitle(Title.Data());
0755 }else{ histo1->SetTitle("");}
0756
0757 if(XTitle.CompareTo("") != 0){
0758 histo1->SetXTitle(XTitle.Data());
0759 }
0760 if(YTitle.CompareTo("") != 0){
0761 histo1->SetYTitle(YTitle.Data());
0762 }
0763 histo1->GetYaxis()->SetLabelFont(42);
0764 histo1->GetXaxis()->SetLabelFont(42);
0765 histo1->GetYaxis()->SetTitleFont(62);
0766 histo1->GetXaxis()->SetTitleFont(62);
0767
0768 histo1->GetYaxis()->SetTitleSize(0.04);
0769 histo1->GetYaxis()->SetLabelSize(0.03);
0770 histo1->GetYaxis()->SetDecimals();
0771 histo1->GetYaxis()->SetTitleOffset(0.9);
0772 histo1->GetXaxis()->SetTitleOffset(0.9);
0773 histo1->GetXaxis()->SetTitleSize(0.04);
0774 histo1->GetXaxis()->SetLabelSize(0.03);
0775 histo1->SetLineColor(kBlue-5);
0776 histo1->SetMarkerStyle(20);
0777 histo1->SetMarkerSize(0.5);
0778 histo1->DrawCopy("hist,e");
0779 histo1->DrawCopy("same,p");
0780 }
0781
0782
0783
0784 void DefaultCancasSettings( TCanvas* c1,
0785 Double_t leftMargin,
0786 Double_t rightMargin,
0787 Double_t topMargin,
0788 Double_t bottomMargin){
0789 c1->SetTickx();
0790 c1->SetTicky();
0791 c1->SetGridx(0);
0792 c1->SetGridy(0);
0793 c1->SetLogy(0);
0794 c1->SetLeftMargin(leftMargin);
0795 c1->SetRightMargin(rightMargin);
0796 c1->SetTopMargin(topMargin);
0797 c1->SetBottomMargin(bottomMargin);
0798 c1->SetFillColor(0);
0799 }
0800
0801
0802 void DefaultPadSettings( TPad* pad1,
0803 Double_t leftMargin,
0804 Double_t rightMargin,
0805 Double_t topMargin,
0806 Double_t bottomMargin){
0807 pad1->SetFillColor(0);
0808 pad1->GetFrame()->SetFillColor(0);
0809 pad1->SetBorderMode(0);
0810 pad1->SetLeftMargin(leftMargin);
0811 pad1->SetBottomMargin(bottomMargin);
0812 pad1->SetRightMargin(rightMargin);
0813 pad1->SetTopMargin(topMargin);
0814 pad1->SetTickx();
0815 pad1->SetTicky();
0816 }
0817
0818
0819 void SetMarkerDefaultsTGraph( TGraph* graph,
0820 Style_t markerStyle,
0821 Size_t markerSize,
0822 Color_t markerColor,
0823 Color_t lineColor,
0824 Width_t lineWidth = 1,
0825 Style_t lineStyle = 1,
0826 Bool_t boxes = kFALSE,
0827 Color_t fillColor = 0,
0828 Bool_t isHollow = kFALSE
0829 ) {
0830 graph->SetMarkerStyle(markerStyle);
0831 graph->SetMarkerSize(markerSize);
0832 graph->SetMarkerColor(markerColor);
0833 graph->SetLineColor(lineColor);
0834 graph->SetLineWidth(lineWidth);
0835 graph->SetLineWidth(lineStyle);
0836 if (boxes){
0837 graph->SetFillColor(fillColor);
0838 if (fillColor!=0){
0839 if (!isHollow){
0840 graph->SetFillStyle(1001);
0841 } else {
0842 graph->SetFillStyle(0);
0843 }
0844 } else {
0845 graph->SetFillStyle(0);
0846 }
0847 }
0848 }
0849
0850
0851 void SetMarkerDefaultsTGraphErr( TGraphErrors* graph,
0852 Style_t markerStyle,
0853 Size_t markerSize,
0854 Color_t markerColor,
0855 Color_t lineColor,
0856 Width_t lineWidth = 1,
0857 Bool_t boxes = kFALSE,
0858 Color_t fillColor = 0,
0859 Bool_t isHollow = kFALSE) {
0860 graph->SetMarkerStyle(markerStyle);
0861 graph->SetMarkerSize(markerSize);
0862 graph->SetMarkerColor(markerColor);
0863 graph->SetLineColor(lineColor);
0864 graph->SetLineWidth(lineWidth);
0865 if (boxes){
0866 graph->SetFillColor(fillColor);
0867 if (fillColor!=0){
0868 if (!isHollow){
0869 graph->SetFillStyle(1001);
0870 } else {
0871 graph->SetFillStyle(0);
0872 }
0873 } else {
0874 graph->SetFillStyle(0);
0875 }
0876 }
0877 }
0878
0879
0880 void SetMarkerDefaultsTGraphAsym( TGraphAsymmErrors* graph,
0881 Style_t markerStyle,
0882 Size_t markerSize,
0883 Color_t markerColor,
0884 Color_t lineColor,
0885 Width_t lineWidth =1,
0886 Bool_t boxes = kFALSE,
0887 Color_t fillColor = 0,
0888 Bool_t isHollow = kFALSE
0889 ) {
0890 if (!graph) return;
0891 graph->SetMarkerStyle(markerStyle);
0892 graph->SetMarkerSize(markerSize);
0893 graph->SetMarkerColor(markerColor);
0894 graph->SetLineColor(lineColor);
0895 graph->SetLineWidth(lineWidth);
0896 if (boxes){
0897 graph->SetFillColor(fillColor);
0898 if (fillColor!=0){
0899 if (!isHollow){
0900 graph->SetFillStyle(1001);
0901 } else {
0902 graph->SetFillStyle(0);
0903 }
0904 } else {
0905 graph->SetFillStyle(0);
0906 }
0907 }
0908 }
0909
0910
0911 void SetMarkerDefaultsTF1( TF1* fit1,
0912 Style_t lineStyle,
0913 Size_t lineWidth,
0914 Color_t lineColor ) {
0915 if (!fit1) return;
0916 fit1->SetLineColor(lineColor);
0917 fit1->SetLineStyle(lineStyle);
0918 fit1->SetLineWidth(lineWidth);
0919 }
0920
0921
0922 void SetStyleTLatex( TLatex* text,
0923 Size_t textSize,
0924 Width_t lineWidth,
0925 Color_t textColor = 1,
0926 Font_t textFont = 42,
0927 Bool_t kNDC = kTRUE,
0928 Short_t align = 11
0929 ){
0930 if (kNDC) {text->SetNDC();}
0931 text->SetTextFont(textFont);
0932 text->SetTextColor(textColor);
0933 text->SetTextSize(textSize);
0934 text->SetLineWidth(lineWidth);
0935 text->SetTextAlign(align);
0936 }
0937
0938
0939 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){
0940
0941 std::vector<TString> Latex;
0942
0943 TObjArray *textStr = text.Tokenize(";");
0944 for(Int_t i = 0; i<textStr->GetEntries() ; i++){
0945 TObjString* tempObj = (TObjString*) textStr->At(i);
0946 Latex.push_back( tempObj->GetString());
0947 }
0948
0949 double ddistance = dDist;
0950 for(unsigned int i = 0; i < Latex.size(); ++i){
0951 TLatex l(PosX, PosY - i*dDist, Latex[i]);
0952 l.SetNDC();
0953 l.SetTextFont(font);
0954 l.SetTextColor(color);
0955 l.SetTextSize(TextSize);
0956 if(alignRight) l.SetTextAlign(31);
0957 l.DrawClone("same");
0958 }
0959 }
0960
0961
0962 void SetStyleHisto( TH1* histo,
0963 Width_t lineWidth,
0964 Style_t lineStyle,
0965 Color_t lineColor) {
0966 if (!histo) return;
0967 histo->SetLineWidth(lineWidth);
0968 histo->SetLineStyle(lineStyle);
0969 histo->SetLineColor(lineColor);
0970 }
0971
0972
0973 void SetStyleFit( TF1* fit,
0974 Double_t xRangeStart,
0975 Double_t xRangeEnd,
0976 Width_t lineWidth,
0977 Style_t lineStyle,
0978 Color_t lineColor) {
0979 if (!fit) return;
0980 fit->SetRange(xRangeStart,xRangeEnd);
0981 fit->SetLineWidth(lineWidth);
0982 fit->SetLineStyle(lineStyle);
0983 fit->SetLineColor(lineColor);
0984 }
0985
0986
0987 void SetStyleHistoTH2ForGraphs( TH2* histo,
0988 TString XTitle,
0989 TString YTitle,
0990 Size_t xLableSize,
0991 Size_t xTitleSize,
0992 Size_t yLableSize,
0993 Size_t yTitleSize,
0994 Float_t xTitleOffset = 1,
0995 Float_t yTitleOffset = 1,
0996 Int_t xNDivisions = 510,
0997 Int_t yNDivisions = 510,
0998 Font_t textFontLabel = 42,
0999 Font_t textFontTitle = 62
1000 ){
1001 histo->SetXTitle(XTitle);
1002 histo->SetYTitle(YTitle);
1003 histo->SetTitle("");
1004 histo->SetStats(0);
1005
1006 histo->GetXaxis()->SetLabelFont(textFontLabel);
1007 histo->GetYaxis()->SetLabelFont(textFontLabel);
1008 histo->GetXaxis()->SetTitleFont(textFontTitle);
1009 histo->GetYaxis()->SetTitleFont(textFontTitle);
1010
1011 histo->GetXaxis()->SetLabelSize(xLableSize);
1012 histo->GetXaxis()->SetTitleSize(xTitleSize);
1013 histo->GetXaxis()->SetTitleOffset(xTitleOffset);
1014 histo->GetXaxis()->SetNdivisions(xNDivisions,kTRUE);
1015
1016 histo->GetYaxis()->SetDecimals();
1017 histo->GetYaxis()->SetLabelSize(yLableSize);
1018 histo->GetYaxis()->SetTitleSize(yTitleSize);
1019 histo->GetYaxis()->SetTitleOffset(yTitleOffset);
1020 histo->GetYaxis()->SetNdivisions(yNDivisions,kTRUE);
1021 }
1022
1023
1024 void SetStyleHistoTH1ForGraphs( TH1* histo,
1025 TString XTitle,
1026 TString YTitle,
1027 Size_t xLableSize,
1028 Size_t xTitleSize,
1029 Size_t yLableSize,
1030 Size_t yTitleSize,
1031 Float_t xTitleOffset = 1,
1032 Float_t yTitleOffset = 1,
1033 Int_t xNDivisions = 510,
1034 Int_t yNDivisions = 510,
1035 Font_t textFontLabel = 42,
1036 Font_t textFontTitle = 62
1037 ){
1038 histo->SetXTitle(XTitle);
1039 histo->SetYTitle(YTitle);
1040 histo->SetTitle("");
1041
1042 histo->GetYaxis()->SetLabelFont(textFontLabel);
1043 histo->GetXaxis()->SetLabelFont(textFontLabel);
1044 histo->GetYaxis()->SetTitleFont(textFontTitle);
1045 histo->GetXaxis()->SetTitleFont(textFontTitle);
1046
1047 histo->GetXaxis()->SetLabelSize(xLableSize);
1048 histo->GetXaxis()->SetTitleSize(xTitleSize);
1049 histo->GetXaxis()->SetTitleOffset(xTitleOffset);
1050 histo->GetXaxis()->SetNdivisions(xNDivisions,kTRUE);
1051
1052 histo->GetYaxis()->SetDecimals();
1053 histo->GetYaxis()->SetLabelSize(yLableSize);
1054 histo->GetYaxis()->SetTitleSize(yTitleSize);
1055 histo->GetYaxis()->SetTitleOffset(yTitleOffset);
1056 histo->GetYaxis()->SetNdivisions(yNDivisions,kTRUE);
1057 }
1058
1059
1060 void ReturnCorrectValuesForCanvasScaling( Int_t sizeX,
1061 Int_t sizeY,
1062 Int_t nCols,
1063 Int_t nRows,
1064 Double_t leftMargin,
1065 Double_t rightMargin,
1066 Double_t upperMargin,
1067 Double_t lowerMargin,
1068 Double_t* arrayBoundariesX,
1069 Double_t* arrayBoundariesY,
1070 Double_t* relativeMarginsX,
1071 Double_t* relativeMarginsY,
1072 Bool_t verbose = kTRUE){
1073 Int_t realsizeX = sizeX- (Int_t)(sizeX*leftMargin)- (Int_t)(sizeX*rightMargin);
1074 Int_t realsizeY = sizeY- (Int_t)(sizeY*upperMargin)- (Int_t)(sizeY*lowerMargin);
1075
1076 Int_t nPixelsLeftColumn = (Int_t)(sizeX*leftMargin);
1077 Int_t nPixelsRightColumn = (Int_t)(sizeX*rightMargin);
1078 Int_t nPixelsUpperColumn = (Int_t)(sizeY*upperMargin);
1079 Int_t nPixelsLowerColumn = (Int_t)(sizeY*lowerMargin);
1080
1081 Int_t nPixelsSinglePlotX = (Int_t) (realsizeX/nCols);
1082 Int_t nPixelsSinglePlotY = (Int_t) (realsizeY/nRows);
1083 if(verbose){
1084 cout << realsizeX << "\t" << nPixelsSinglePlotX << endl;
1085 cout << realsizeY << "\t" << nPixelsSinglePlotY << endl;
1086 cout << nPixelsLeftColumn << "\t" << nPixelsRightColumn << "\t" << nPixelsLowerColumn << "\t" << nPixelsUpperColumn << endl;
1087 }
1088 Int_t pixel = 0;
1089 if(verbose)cout << "boundaries X" << endl;
1090 for (Int_t i = 0; i < nCols+1; i++){
1091 if (i == 0){
1092 arrayBoundariesX[i] = 0.;
1093 pixel = pixel+nPixelsLeftColumn+nPixelsSinglePlotX;
1094 } else if (i == nCols){
1095 arrayBoundariesX[i] = 1.;
1096 pixel = pixel+nPixelsRightColumn;
1097 } else {
1098 arrayBoundariesX[i] = (Double_t)pixel/sizeX;
1099 pixel = pixel+nPixelsSinglePlotX;
1100 }
1101 if(verbose)cout << "arrayBoundariesX: " << i << "\t" << arrayBoundariesX[i] << "\t" << pixel<<endl;
1102 }
1103
1104 if(verbose)cout << "boundaries Y" << endl;
1105 pixel = sizeY;
1106 for (Int_t i = 0; i < nRows+1; i++){
1107 if (i == 0){
1108 arrayBoundariesY[i] = 1.;
1109 pixel = pixel-nPixelsUpperColumn-nPixelsSinglePlotY;
1110 } else if (i == nRows){
1111 arrayBoundariesY[i] = 0.;
1112 pixel = pixel-nPixelsLowerColumn;
1113 } else {
1114 arrayBoundariesY[i] = (Double_t)pixel/sizeY;
1115 pixel = pixel-nPixelsSinglePlotY;
1116 }
1117 if(verbose)cout << i << "\t" << arrayBoundariesY[i] <<"\t" << pixel<<endl;
1118 }
1119
1120 relativeMarginsX[0] = (Double_t)nPixelsLeftColumn/(nPixelsLeftColumn+nPixelsSinglePlotX);
1121 relativeMarginsX[1] = 0;
1122 relativeMarginsX[2] = (Double_t)nPixelsRightColumn/(nPixelsRightColumn+nPixelsSinglePlotX);;
1123
1124 relativeMarginsY[0] = (Double_t)nPixelsUpperColumn/(nPixelsUpperColumn+nPixelsSinglePlotY);
1125 relativeMarginsY[1] = 0;
1126 relativeMarginsY[2] = (Double_t)nPixelsLowerColumn/(nPixelsLowerColumn+nPixelsSinglePlotY);;
1127
1128 return;
1129 }
1130
1131
1132 void ReturnCorrectValuesTextSize( TPad * pad,
1133 Double_t &textsizeLabels,
1134 Double_t &textsizeFac,
1135 Int_t textSizeLabelsPixel,
1136 Double_t dummyWUP){
1137 if(dummyWUP){}
1138
1139 textsizeLabels = 0;
1140 textsizeFac = 0;
1141 if (pad->XtoPixel(pad->GetX2()) < pad->YtoPixel(pad->GetY1())){
1142 textsizeLabels = (Double_t)textSizeLabelsPixel/pad->XtoPixel(pad->GetX2()) ;
1143 textsizeFac = (Double_t)1./pad->XtoPixel(pad->GetX2()) ;
1144 } else {
1145 textsizeLabels = (Double_t)textSizeLabelsPixel/pad->YtoPixel(pad->GetY1());
1146 textsizeFac = (Double_t)1./pad->YtoPixel(pad->GetY1());
1147 }
1148 cout << textsizeLabels << endl;
1149 cout << textsizeFac << endl;
1150
1151 return;
1152
1153 }
1154
1155
1156
1157
1158
1159
1160
1161
1162 void DrawLines(Float_t startX, Float_t endX,
1163 Float_t startY, Float_t endY,
1164 Float_t linew, Float_t lineColor = 4, Style_t lineStyle = 1, Float_t opacity = 1.){
1165 TLine * l1 = new TLine (startX,startY,endX,endY);
1166 l1->SetLineColor(lineColor);
1167 l1->SetLineWidth(linew);
1168 l1->SetLineStyle(lineStyle);
1169 if (opacity != 1.)
1170 l1->SetLineColorAlpha(lineColor,opacity);
1171
1172 l1->Draw("same");
1173 }
1174
1175
1176
1177
1178 TBox* CreateBox(Color_t colorBox, Double_t xStart, Double_t yStart, Double_t xEnd, Double_t yEnd, Style_t fillStyle = 1001 ) {
1179 TBox* box = new TBox(xStart ,yStart , xEnd, yEnd);
1180 box->SetLineColor(colorBox);
1181 box->SetFillColor(colorBox);
1182 box->SetFillStyle(fillStyle);
1183 return box;
1184 }
1185
1186
1187
1188
1189 void CreateCanvasAndPadsFor8PannelTBPlot(TCanvas* &canvas, TPad* pads[8], Double_t* topRCornerX, Double_t* topRCornerY, Double_t* relSize8P, Int_t textSizePixel = 30){
1190 Double_t arrayBoundsXIndMeasRatio[5];
1191 Double_t arrayBoundsYIndMeasRatio[3];
1192 Double_t relativeMarginsIndMeasRatioX[3];
1193 Double_t relativeMarginsIndMeasRatioY[3];
1194 ReturnCorrectValuesForCanvasScaling(2200,1200, 4, 2,0.03, 0.005, 0.005,0.05,arrayBoundsXIndMeasRatio,arrayBoundsYIndMeasRatio,relativeMarginsIndMeasRatioX,relativeMarginsIndMeasRatioY);
1195
1196 canvas = new TCanvas("canvas8Panel","",0,0,2200,1200);
1197 canvas->cd();
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208 pads[7] = new TPad("pad8Panel_7", "", arrayBoundsXIndMeasRatio[0], arrayBoundsYIndMeasRatio[1],arrayBoundsXIndMeasRatio[1], arrayBoundsYIndMeasRatio[0],-1, -1, -2);
1209 pads[6] = new TPad("pad8Panel_6", "", arrayBoundsXIndMeasRatio[1], arrayBoundsYIndMeasRatio[1],arrayBoundsXIndMeasRatio[2], arrayBoundsYIndMeasRatio[0],-1, -1, -2);
1210 pads[5] = new TPad("pad8Panel_5", "", arrayBoundsXIndMeasRatio[2], arrayBoundsYIndMeasRatio[1],arrayBoundsXIndMeasRatio[3], arrayBoundsYIndMeasRatio[0],-1, -1, -2);
1211 pads[4] = new TPad("pad8Panel_4", "", arrayBoundsXIndMeasRatio[3], arrayBoundsYIndMeasRatio[1],arrayBoundsXIndMeasRatio[4], arrayBoundsYIndMeasRatio[0],-1, -1, -2);
1212 pads[0] = new TPad("pad8Panel_0", "", arrayBoundsXIndMeasRatio[0], arrayBoundsYIndMeasRatio[2], arrayBoundsXIndMeasRatio[1], arrayBoundsYIndMeasRatio[1],-1, -1, -2);
1213 pads[1] = new TPad("pad8Panel_1", "", arrayBoundsXIndMeasRatio[1], arrayBoundsYIndMeasRatio[2], arrayBoundsXIndMeasRatio[2], arrayBoundsYIndMeasRatio[1],-1, -1, -2);
1214 pads[2] = new TPad("pad8Panel_2", "", arrayBoundsXIndMeasRatio[2], arrayBoundsYIndMeasRatio[2], arrayBoundsXIndMeasRatio[3], arrayBoundsYIndMeasRatio[1],-1, -1, -2);
1215 pads[3] = new TPad("pad8Panel_3", "", arrayBoundsXIndMeasRatio[3], arrayBoundsYIndMeasRatio[2], arrayBoundsXIndMeasRatio[4], arrayBoundsYIndMeasRatio[1],-1, -1, -2);
1216
1217 DefaultPadSettings( pads[7], relativeMarginsIndMeasRatioX[0], relativeMarginsIndMeasRatioX[1], relativeMarginsIndMeasRatioY[0], relativeMarginsIndMeasRatioY[1]);
1218 DefaultPadSettings( pads[6], relativeMarginsIndMeasRatioX[1], relativeMarginsIndMeasRatioX[1], relativeMarginsIndMeasRatioY[0], relativeMarginsIndMeasRatioY[1]);
1219 DefaultPadSettings( pads[5], relativeMarginsIndMeasRatioX[1], relativeMarginsIndMeasRatioX[1], relativeMarginsIndMeasRatioY[0], relativeMarginsIndMeasRatioY[1]);
1220 DefaultPadSettings( pads[4], relativeMarginsIndMeasRatioX[1], relativeMarginsIndMeasRatioX[2], relativeMarginsIndMeasRatioY[0], relativeMarginsIndMeasRatioY[1]);
1221 DefaultPadSettings( pads[0], relativeMarginsIndMeasRatioX[0], relativeMarginsIndMeasRatioX[1], relativeMarginsIndMeasRatioY[1], relativeMarginsIndMeasRatioY[2]);
1222 DefaultPadSettings( pads[1], relativeMarginsIndMeasRatioX[1], relativeMarginsIndMeasRatioX[1], relativeMarginsIndMeasRatioY[1], relativeMarginsIndMeasRatioY[2]);
1223 DefaultPadSettings( pads[2], relativeMarginsIndMeasRatioX[1], relativeMarginsIndMeasRatioX[1], relativeMarginsIndMeasRatioY[1], relativeMarginsIndMeasRatioY[2]);
1224 DefaultPadSettings( pads[3], relativeMarginsIndMeasRatioX[1], relativeMarginsIndMeasRatioX[2], relativeMarginsIndMeasRatioY[1], relativeMarginsIndMeasRatioY[2]);
1225
1226 topRCornerX[0] = 1-relativeMarginsIndMeasRatioX[1];
1227 topRCornerY[0] = 1-relativeMarginsIndMeasRatioY[1];
1228 topRCornerX[1] = 1-relativeMarginsIndMeasRatioX[1];
1229 topRCornerY[1] = 1-relativeMarginsIndMeasRatioY[1];
1230 topRCornerX[2] = 1-relativeMarginsIndMeasRatioX[1];
1231 topRCornerY[2] = 1-relativeMarginsIndMeasRatioY[1];
1232 topRCornerX[3] = 1-relativeMarginsIndMeasRatioX[2];
1233 topRCornerY[3] = 1-relativeMarginsIndMeasRatioY[1];
1234 topRCornerX[4] = 1-relativeMarginsIndMeasRatioX[2];
1235 topRCornerY[4] = 1-relativeMarginsIndMeasRatioY[0];
1236 topRCornerX[5] = 1-relativeMarginsIndMeasRatioX[1];
1237 topRCornerY[5] = 1-relativeMarginsIndMeasRatioY[0];
1238 topRCornerX[6] = 1-relativeMarginsIndMeasRatioX[1];
1239 topRCornerY[6] = 1-relativeMarginsIndMeasRatioY[0];
1240 topRCornerX[7] = 1-relativeMarginsIndMeasRatioX[1];
1241 topRCornerY[7] = 1-relativeMarginsIndMeasRatioY[0];
1242
1243 for (Int_t p = 0; p < 8; p++){
1244 if (pads[p]->XtoPixel(pads[p]->GetX2()) < pads[p]->YtoPixel(pads[p]->GetY1())){
1245 relSize8P[p] = (Double_t)textSizePixel/pads[p]->XtoPixel(pads[p]->GetX2()) ;
1246 } else {
1247 relSize8P[p] = (Double_t)textSizePixel/pads[p]->YtoPixel(pads[p]->GetY1());
1248 }
1249 std::cout << p << "\t" << topRCornerX[p]<< "\t" << topRCornerY[p] << "\t" << relSize8P[p] << std::endl;
1250 }
1251 return;
1252 }
1253
1254
1255
1256
1257 TString GetStringFromRunInfo(runInfo currRunInfo, Int_t option = 1){
1258 if (option == 1){
1259 if (currRunInfo.species.Contains("cosmics")){
1260 return Form("cosmics, Run %d, #it{V}_{#it{op}} = %1.1f V", currRunInfo.runNr, currRunInfo.vop );
1261 } else if (currRunInfo.species.CompareTo("g") == 0){
1262 return Form("LED, Run %d, #it{V}_{#it{op}} = %1.1f V", currRunInfo.runNr, currRunInfo.vop );
1263 } else {
1264 return Form("%s-beam, #it{E}_{#it{b}}= %.0f GeV, Run %d, #it{V}_{#it{op}} = %1.1f V", currRunInfo.species.Data(), currRunInfo.energy, currRunInfo.runNr, currRunInfo.vop );
1265 }
1266 } else if (option == 2){
1267 if (currRunInfo.species.CompareTo("cosmics") == 0){
1268 return "cosmics";
1269 } else if (currRunInfo.species.CompareTo("g") == 0){
1270 return "LED";
1271 } else {
1272 return Form("%s-beam, #it{E}_{#it{b}}= %.0f GeV", currRunInfo.species.Data(), currRunInfo.energy);
1273 }
1274 } else if (option == 3){
1275 return Form("Run %d, #it{V}_{#it{op}} = %1.1f V", currRunInfo.runNr, currRunInfo.vop ) ;
1276 } else if (option == 4){
1277 if (currRunInfo.species.CompareTo("cosmics") == 0){
1278 return Form("cosmics, Run %d, #it{V}_{#it{op}} = %1.1f V, HG = %1d, LG = %1d", currRunInfo.runNr, currRunInfo.vop, currRunInfo.hgSet, currRunInfo.lgSet);
1279 } else if (currRunInfo.species.CompareTo("g") == 0){
1280 return Form("LED, Run %d, #it{V}_{#it{op}} = %1.1f V, HG = %1d, LG = %1d", currRunInfo.runNr, currRunInfo.vop, currRunInfo.hgSet, currRunInfo.lgSet);
1281 } else{
1282 return Form("%s-beam, #it{E}_{#it{b}}= %.0f GeV, Run %d, #it{V}_{#it{op}} = %1.1f V, HG = %1d, LG = %1d", currRunInfo.species.Data(), currRunInfo.energy, currRunInfo.runNr, currRunInfo.vop, currRunInfo.hgSet, currRunInfo.lgSet);
1283 }
1284 }
1285
1286 return "";
1287 }
1288
1289 #endif