4848// text0 is the text for general title added within ()
4949// type=0 plots response distributions and MPV of response vs ieta
5050// =1 plots MPV of response vs RBX #
51- // *drawStatBox* is of type *int* here specifying the index for
52- // calling SetOptStat and SetOptFit
5351//
5452// For plotting stored histograms from CalibTree
5553// PlotFiveHists(infile, text0, prefix0, type, iname, drawStatBox, normalize,
6159// text0 is the text for general title added within ()
6260// prefix0 is the tag attached to the canvas name
6361// type has the same meaning as in PlotTwoHists
64- // *drawStatBox* is of type *int* here specifying the index for
65- // calling SetOptStat and SetOptFit
6662//
6763// PlotHistCorrResults(infile, text, prefixF, save);
6864// Defaults: save=0
177173// For plotting ratio of correction factors as defined in a file
178174// give by infileX for 2 depths (depth1, depth2) as a function of
179175// ieta obaned from 2 sources of data (defined by text1 and text2)
176+ //
180177// PlotHistCorrRatio(infile1, text1, infile2, text2, depth1, depth2, prefix,
181178// text0, etaMin, etaMax, doFit, isRealData, year, iformat,
182179// range, save)
@@ -676,7 +673,7 @@ results fitDoubleSidedCrystalball(TH1D* hist, bool /* fitTwice */, bool debug) {
676673 return results (value , error , width , werror );
677674}
678675
679- void readCorrFactors (char * infile ,
676+ void readCorrFactors (std :: string infile ,
680677 double scale ,
681678 std ::map < int , cfactors > & cfacs ,
682679 int & etamin ,
@@ -685,7 +682,7 @@ void readCorrFactors(char* infile,
685682 int iformat = 0 ,
686683 bool debug = false) {
687684 cfacs .clear ();
688- std ::ifstream fInput (infile );
685+ std ::ifstream fInput (infile . c_str () );
689686 if (!fInput .good ()) {
690687 std ::cout << "Cannot open file " << infile << std ::endl ;
691688 } else {
@@ -2313,7 +2310,7 @@ void PlotHistCorrResults(std::string infile, std::string text, std::string prefi
23132310 }
23142311}
23152312
2316- void PlotHistCorrFactor (char * infile ,
2313+ void PlotHistCorrFactor (std :: string infile ,
23172314 std ::string text ,
23182315 std ::string prefixF ,
23192316 double scale = 1.0 ,
@@ -2457,7 +2454,7 @@ void PlotHistCorrFactor(char* infile,
24572454 }
24582455}
24592456
2460- void PlotHistCorrFactor (char * infile ,
2457+ void PlotHistCorrFactor (std :: string infile ,
24612458 std ::string text ,
24622459 int depth ,
24632460 std ::string prefixF ,
@@ -2600,7 +2597,7 @@ void PlotHistCorrFactor(char* infile,
26002597}
26012598
26022599void PlotHistCorrAsymmetry (
2603- char * infile , std ::string text , std ::string prefixF = "" , int depth = -1 , int iformat = 0 , int save = 0 ) {
2600+ std :: string infile , std ::string text , std ::string prefixF = "" , int depth = -1 , int iformat = 0 , int save = 0 ) {
26042601 std ::map < int , cfactors > cfacs ;
26052602 int etamin (100 ), etamax (- 100 ), maxdepth (0 );
26062603 double scale (1.0 );
@@ -2702,29 +2699,29 @@ void PlotHistCorrAsymmetry(
27022699 }
27032700}
27042701
2705- void PlotHistCorrFactors (char * infile1 ,
2702+ void PlotHistCorrFactors (std :: string infile1 ,
27062703 std ::string text1 ,
2707- char * infile2 ,
2704+ std :: string infile2 ,
27082705 std ::string text2 ,
2709- char * infile3 ,
2706+ std :: string infile3 ,
27102707 std ::string text3 ,
2711- char * infile4 ,
2708+ std :: string infile4 ,
27122709 std ::string text4 ,
2713- char * infile5 ,
2710+ std :: string infile5 ,
27142711 std ::string text5 ,
27152712 std ::string prefixF ,
2716- bool ratio = false ,
2717- bool drawStatBox = true ,
2713+ bool ratio = true ,
2714+ bool drawStatBox = false ,
27182715 int nmin = 100 ,
2719- bool isRealData = false ,
2716+ bool isRealData = true ,
27202717 const char * year = "2025" ,
27212718 int iformat = 0 ,
2722- int range = 1 ,
2719+ int range = 0 ,
27232720 int save = 0 ) {
27242721 std ::map < int , cfactors > cfacs [5 ];
27252722 std ::vector < std ::string > texts ;
27262723 int nfile (0 ), etamin (100 ), etamax (- 100 ), maxdepth (0 );
2727- const char * blank ("");
2724+ std :: string blank ("");
27282725 if (infile1 != blank ) {
27292726 readCorrFactors (infile1 , 1.0 , cfacs [nfile ], etamin , etamax , maxdepth , iformat );
27302727 if (cfacs [nfile ].size () > 0 ) {
@@ -2814,7 +2811,7 @@ void PlotHistCorrFactors(char* infile1,
28142811 if (dep == j + 1 ) {
28152812 int ieta = (itr -> second ).ieta ;
28162813 int bin = ieta - etamin + 1 ;
2817- float val = (itr -> second ).corrf / (ktr -> second ).corrf ;
2814+ float val = (ktr -> second ).corrf / (itr -> second ).corrf ;
28182815 float dvl =
28192816 val *
28202817 sqrt ((((itr -> second ).dcorr * (itr -> second ).dcorr ) / ((itr -> second ).corrf * (itr -> second ).corrf )) +
@@ -2836,9 +2833,9 @@ void PlotHistCorrFactors(char* infile1,
28362833 h -> SetMarkerSize (0.9 );
28372834 h -> GetXaxis ()-> SetTitle ("i#eta" );
28382835 if (nfile > 2 )
2839- sprintf (name , "CF_{%s }/CF_{Set }" , texts [0 ].c_str ());
2836+ sprintf (name , "CF_{Set }/CF_{%s }" , texts [0 ].c_str ());
28402837 else
2841- sprintf (name , "CF_{%s}/CF_{%s}" , texts [0 ].c_str (), texts [ih ].c_str ());
2838+ sprintf (name , "CF_{%s}/CF_{%s}" , texts [ih ].c_str (), texts [0 ].c_str ());
28422839 h -> GetYaxis ()-> SetTitle (name );
28432840 h -> GetYaxis ()-> SetLabelOffset (0.005 );
28442841 h -> GetYaxis ()-> SetTitleSize (0.036 );
@@ -2940,7 +2937,7 @@ void PlotHistCorrFactors(char* infile1,
29402937 }
29412938 sprintf (name , "Depth %d (%s)" , depths [k ], texts [k1 ].c_str ());
29422939 } else {
2943- sprintf (name , "Depth %d (Mean[CF_{%s}/CF_{%s}] = %5.3f)" , depths [k ], text1 .c_str (), texts [ k1 ] .c_str (), fitr [k ]);
2940+ sprintf (name , "Depth %d (Mean[CF_{%s}/CF_{%s}] = %5.3f)" , depths [k ], texts [ k1 ] .c_str (), text1 .c_str (), fitr [k ]);
29442941 }
29452942 if ((depths [k ] == 1 ) || (k1 <= 1 ) || (maxdepth <= 4 ))
29462943 legend -> AddEntry (hists [k ], name , "lp" );
@@ -2977,9 +2974,9 @@ void PlotHistCorrFactors(char* infile1,
29772974 }
29782975}
29792976
2980- void PlotHistCorr2Factors (char * infile1 ,
2977+ void PlotHistCorr2Factors (std :: string infile1 ,
29812978 std ::string text1 ,
2982- char * infile2 ,
2979+ std :: string infile2 ,
29832980 std ::string text2 ,
29842981 int depth ,
29852982 std ::string prefixF ,
@@ -2994,7 +2991,7 @@ void PlotHistCorr2Factors(char* infile1,
29942991 std ::map < int , cfactors > cfacs [5 ];
29952992 std ::vector < std ::string > texts ;
29962993 int nfile (0 ), etamin (100 ), etamax (- 100 ), maxdepth (0 );
2997- const char * blank ("");
2994+ std :: string blank ("");
29982995 if (infile1 != blank ) {
29992996 readCorrFactors (infile1 , 1.0 , cfacs [nfile ], etamin , etamax , maxdepth , iformat );
30002997 if (cfacs [nfile ].size () > 0 ) {
@@ -3208,15 +3205,15 @@ void PlotHistCorr2Factors(char* infile1,
32083205 }
32093206}
32103207
3211- void PlotHistCorrDFactors (char * infile1 ,
3208+ void PlotHistCorrDFactors (std :: string infile1 ,
32123209 std ::string text1 ,
3213- char * infile2 ,
3210+ std :: string infile2 ,
32143211 std ::string text2 ,
3215- char * infile3 ,
3212+ std :: string infile3 ,
32163213 std ::string text3 ,
3217- char * infile4 ,
3214+ std :: string infile4 ,
32183215 std ::string text4 ,
3219- char * infile5 ,
3216+ std :: string infile5 ,
32203217 std ::string text5 ,
32213218 int depth ,
32223219 std ::string prefixF ,
@@ -3231,7 +3228,7 @@ void PlotHistCorrDFactors(char* infile1,
32313228 std ::map < int , cfactors > cfacs [5 ];
32323229 std ::vector < std ::string > texts ;
32333230 int nfile (0 ), etamin (100 ), etamax (- 100 ), maxdepth (0 );
3234- const char * blank ("");
3231+ std :: string blank ("");
32353232 if (infile1 != blank ) {
32363233 readCorrFactors (infile1 , 1.0 , cfacs [nfile ], etamin , etamax , maxdepth , iformat );
32373234 if (cfacs [nfile ].size () > 0 ) {
@@ -3320,7 +3317,7 @@ void PlotHistCorrDFactors(char* infile1,
33203317 if (dep == depth ) {
33213318 int ieta = (itr -> second ).ieta ;
33223319 int bin = ieta - etamin + 1 ;
3323- float val = (itr -> second ).corrf / (ktr -> second ).corrf ;
3320+ float val = (ktr -> second ).corrf / (itr -> second ).corrf ;
33243321 float dvl =
33253322 val * sqrt ((((itr -> second ).dcorr * (itr -> second ).dcorr ) / ((itr -> second ).corrf * (itr -> second ).corrf )) +
33263323 (((ktr -> second ).dcorr * (ktr -> second ).dcorr ) / ((ktr -> second ).corrf * (ktr -> second ).corrf )));
@@ -3341,9 +3338,9 @@ void PlotHistCorrDFactors(char* infile1,
33413338 h -> SetMarkerSize (0.9 );
33423339 h -> GetXaxis ()-> SetTitle ("i#eta" );
33433340 if (nfile > 2 )
3344- sprintf (name , "CF_{%s }/CF_{Set }" , texts [0 ].c_str ());
3341+ sprintf (name , "CF_{Set }/CF_{%s }" , texts [0 ].c_str ());
33453342 else
3346- sprintf (name , "CF_{%s}/CF_{%s}" , texts [0 ].c_str (), texts [ih ].c_str ());
3343+ sprintf (name , "CF_{%s}/CF_{%s}" , texts [ih ].c_str (), texts [0 ].c_str ());
33473344 h -> GetYaxis ()-> SetTitle (name );
33483345 h -> GetYaxis ()-> SetLabelOffset (0.005 );
33493346 h -> GetYaxis ()-> SetTitleSize (0.036 );
@@ -3434,7 +3431,7 @@ void PlotHistCorrDFactors(char* infile1,
34343431 }
34353432 sprintf (name , "Depth %d (%s)" , depth , texts [k1 ].c_str ());
34363433 } else {
3437- sprintf (name , "Depth %d (Mean[CF_{%s}/CF_{%s}] = %5.3f)" , depth , text1 .c_str (), texts [ k1 ] .c_str (), fitr [k ]);
3434+ sprintf (name , "Depth %d (Mean[CF_{%s}/CF_{%s}] = %5.3f)" , depth , texts [ k1 ] .c_str (), text1 .c_str (), fitr [k ]);
34383435 }
34393436 legend -> AddEntry (hists [k ], name , "lp" );
34403437 }
@@ -3676,8 +3673,8 @@ void PlotHistCorrLumis(std::string infilec, int conds, double lumi, int save = 0
36763673 }
36773674}
36783675
3679- void PlotHistCorrRel (char * infile1 ,
3680- char * infile2 ,
3676+ void PlotHistCorrRel (std :: string infile1 ,
3677+ std :: string infile2 ,
36813678 std ::string text1 ,
36823679 std ::string text2 ,
36833680 int iformat1 = 0 ,
@@ -3804,8 +3801,8 @@ void PlotHistCorrRel(char* infile1,
38043801 }
38053802}
38063803
3807- void PlotHistCorrDepth (char * infile1 ,
3808- char * infile2 ,
3804+ void PlotHistCorrDepth (std :: string infile1 ,
3805+ std :: string infile2 ,
38093806 std ::string text1 ,
38103807 std ::string text2 ,
38113808 int depth ,
@@ -4185,7 +4182,7 @@ void PlotPUCorrHists(std::string infile = "corrfac.root",
41854182 }
41864183}
41874184
4188- void PlotHistCorr (const char * infile ,
4185+ void PlotHistCorr (std :: string infile ,
41894186 std ::string prefix ,
41904187 std ::string text0 ,
41914188 int eta = 0 ,
@@ -4206,7 +4203,7 @@ void PlotHistCorr(const char* infile,
42064203 std ::string text [3 ] = {"Uncorrected no PU" , "Uncorrected PU" , "Corrected PU" };
42074204 int colors [3 ] = {1 , 4 , 2 };
42084205 int styles [3 ] = {1 , 3 , 2 };
4209- TFile * file = new TFile (infile );
4206+ TFile * file = new TFile (infile . c_str () );
42104207 if (mode < 0 || mode > 2 )
42114208 mode = 1 ;
42124209 int etamin = (eta == 0 ) ? -27 : eta ;
@@ -4283,7 +4280,7 @@ void PlotHistCorr(const char* infile,
42834280 }
42844281}
42854282
4286- void PlotPropertyHist (const char * infile ,
4283+ void PlotPropertyHist (std :: string infile ,
42874284 std ::string prefix ,
42884285 std ::string text ,
42894286 int etaMax = 25 ,
@@ -4320,7 +4317,7 @@ void PlotPropertyHist(const char* infile,
43204317 gStyle -> SetOptStat (0 );
43214318 gStyle -> SetOptFit (0 );
43224319
4323- TFile * file = new TFile (infile );
4320+ TFile * file = new TFile (infile . c_str () );
43244321 char name [100 ], namep [100 ];
43254322 for (int k = 1 ; k <= etaMax ; ++ k ) {
43264323 for (int j = 0 ; j < 3 ; ++ j ) {
@@ -4619,15 +4616,15 @@ void PlotMeanError(const std::string infilest, int reg = 3, bool resol = false,
46194616 }
46204617}
46214618
4622- void PlotDepthCorrFactor (char * infile ,
4619+ void PlotDepthCorrFactor (std :: string infile ,
46234620 std ::string text ,
46244621 std ::string prefix = "" ,
46254622 bool isRealData = true,
46264623 bool drawStatBox = true,
46274624 int save = 0 ) {
46284625 std ::map < int , cfactors > cfacs ;
46294626 int etamin (100 ), etamax (- 100 ), maxdepth (0 );
4630- std ::ifstream ifile (infile );
4627+ std ::ifstream ifile (infile . c_str () );
46314628 if (!ifile .is_open ()) {
46324629 std ::cout << "Cannot open duplicate file " << infile << std ::endl ;
46334630 } else {
@@ -4836,7 +4833,7 @@ void DrawHistPhiSymmetry(TH1D* hist0, bool isRealData, bool drawStatBox, bool sa
48364833}
48374834
48384835void PlotPhiSymmetryResults (
4839- char * infile , bool isRealData = true, bool drawStatBox = true, bool debug = false, bool save = false) {
4836+ std :: string infile , bool isRealData = true, bool drawStatBox = true, bool debug = false, bool save = false) {
48404837 const int maxDepthHB (4 ), maxDepthHE (7 );
48414838 const double cfacMin (0.70 ), cfacMax (1.5 );
48424839 const int nbin = (100.0 * (cfacMax - cfacMin ));
@@ -4866,7 +4863,7 @@ void PlotPhiSymmetryResults(
48664863 std ::cout << "Book " << h -> GetName () << " Title " << h -> GetTitle () << " range " << nbin << ":" << cfacMin << ":"
48674864 << cfacMax << std ::endl ;
48684865 }
4869- std ::ifstream fInput (infile );
4866+ std ::ifstream fInput (infile . c_str () );
48704867 if (!fInput .good ()) {
48714868 std ::cout << "Cannot open file " << infile << std ::endl ;
48724869 } else {
@@ -4946,9 +4943,9 @@ void PlotPhiSymmetryResults(
49464943 }
49474944}
49484945
4949- void PlotHistCorrRatio (char * infile1 ,
4946+ void PlotHistCorrRatio (std :: string infile1 ,
49504947 std ::string text1 ,
4951- char * infile2 ,
4948+ std :: string infile2 ,
49524949 std ::string text2 ,
49534950 int depth1 ,
49544951 int depth2 ,
@@ -4965,7 +4962,7 @@ void PlotHistCorrRatio(char* infile1,
49654962 std ::map < int , cfactors > cfacs [2 ];
49664963 std ::vector < std ::string > texts ;
49674964 int nfile (0 ), etamin (100 ), etamax (- 100 ), maxdepth (0 );
4968- const char * blank ("");
4965+ std :: string blank ("");
49694966 if (infile1 != blank ) {
49704967 readCorrFactors (infile1 , 1.0 , cfacs [nfile ], etamin , etamax , maxdepth , iformat );
49714968 if (cfacs [nfile ].size () > 0 ) {
0 commit comments