7777//
7878// For plotting (fractional) asymmetry in the correction factors
7979//
80- // PlotHistCorrAsymmetry(infile, text, prefixF, iformat, save);
81- // Defaults: prefixF="", iformat=0, save=0
80+ // PlotHistCorrAsymmetry(infile, text, prefixF, depth, iformat, save);
81+ // Defaults: prefixF="", depth = -1, iformat=0, save=0
8282//
8383// For plotting correction factors from upto 5 different runs
8484// on the same canvas
@@ -2472,7 +2472,8 @@ void PlotHistCorrFactor(char* infile,
24722472 }
24732473}
24742474
2475- void PlotHistCorrAsymmetry (char * infile , std ::string text , std ::string prefixF = "" , int iformat = 0 , int save = 0 ) {
2475+ void PlotHistCorrAsymmetry (
2476+ char * infile , std ::string text , std ::string prefixF = "" , int depth = -1 , int iformat = 0 , int save = 0 ) {
24762477 std ::map < int , cfactors > cfacs ;
24772478 int etamin (100 ), etamax (- 100 ), maxdepth (0 );
24782479 double scale (1.0 );
@@ -2492,21 +2493,23 @@ void PlotHistCorrAsymmetry(char* infile, std::string text, std::string prefixF =
24922493 std ::vector < int > entries ;
24932494 char name [100 ];
24942495 double dy (0 );
2495- for (int j = 0 ; j < maxdepth ; ++ j ) {
2496- sprintf (name , "hd%d" , j + 1 );
2496+ int maxd = (depth < 0 ) ? maxdepth : 1 ;
2497+ for (int j = 0 ; j < maxd ; ++ j ) {
2498+ int dep = (depth <= 0 ) ? (j + 1 ) : depth ;
2499+ sprintf (name , "hd%d" , dep );
24972500 TObject * ob = gROOT -> FindObject (name );
24982501 if (ob )
24992502 ob -> Delete ();
25002503 TH1D * h = new TH1D (name , name , nbin , 0 , etamax );
25012504 int nent (0 );
25022505 for (std ::map < int , cfactors > ::const_iterator itr = cfacs .begin (); itr != cfacs .end (); ++ itr ) {
2503- if ((itr -> second ).depth == j + 1 ) {
2506+ if ((itr -> second ).depth == dep ) {
25042507 int ieta = (itr -> second ).ieta ;
25052508 float vl1 = (itr -> second ).corrf ;
25062509 float dv1 = (itr -> second ).dcorr ;
25072510 if (ieta > 0 ) {
25082511 for (std ::map < int , cfactors > ::const_iterator ktr = cfacs .begin (); ktr != cfacs .end (); ++ ktr ) {
2509- if (((ktr -> second ).depth == j + 1 ) && ((ktr -> second ).ieta == - ieta )) {
2512+ if (((ktr -> second ).depth == dep ) && ((ktr -> second ).ieta == - ieta )) {
25102513 float vl2 = (ktr -> second ).corrf ;
25112514 float dv2 = (ktr -> second ).dcorr ;
25122515 float val = 2.0 * (vl1 - vl2 ) / (vl1 + vl2 );
@@ -2520,9 +2523,9 @@ void PlotHistCorrAsymmetry(char* infile, std::string text, std::string prefixF =
25202523 }
25212524 }
25222525 }
2523- h -> SetLineColor (colors [j ]);
2524- h -> SetMarkerColor (colors [j ]);
2525- h -> SetMarkerStyle (mtype [j ]);
2526+ h -> SetLineColor (colors [dep - 1 ]);
2527+ h -> SetMarkerColor (colors [dep - 1 ]);
2528+ h -> SetMarkerStyle (mtype [dep - 1 ]);
25262529 h -> GetXaxis ()-> SetTitle ("i#eta" );
25272530 h -> GetYaxis ()-> SetTitle ("Asymmetry in Correction Factor" );
25282531 h -> GetYaxis ()-> SetLabelOffset (0.005 );
@@ -2532,7 +2535,10 @@ void PlotHistCorrAsymmetry(char* infile, std::string text, std::string prefixF =
25322535 entries .push_back (nent );
25332536 dy += 0.025 ;
25342537 }
2535- sprintf (name , "c_%sCorrAsymmetry" , prefixF .c_str ());
2538+ if (depth < 0 )
2539+ sprintf (name , "c_%sCorrAsymmetry" , prefixF .c_str ());
2540+ else
2541+ sprintf (name , "c_%sCorrAsymmetryD%d" , prefixF .c_str (), depth );
25362542 TCanvas * pad = new TCanvas (name , name , 700 , 500 );
25372543 pad -> SetRightMargin (0.10 );
25382544 pad -> SetTopMargin (0.10 );
@@ -2541,12 +2547,13 @@ void PlotHistCorrAsymmetry(char* infile, std::string text, std::string prefixF =
25412547 TLegend * legend = new TLegend (0.60 , yl , 0.90 , yl + 0.035 * hists .size ());
25422548 legend -> SetFillColor (kWhite );
25432549 for (unsigned int k = 0 ; k < hists .size (); ++ k ) {
2550+ int dep = (depth < 0 ) ? (k + 1 ) : depth ;
25442551 if (k == 0 )
25452552 hists [k ]-> Draw ("" );
25462553 else
25472554 hists [k ]-> Draw ("sames" );
25482555 pad -> Update ();
2549- sprintf (name , "Depth %d (%s)" , k + 1 , text .c_str ());
2556+ sprintf (name , "Depth %d (%s)" , dep , text .c_str ());
25502557 legend -> AddEntry (hists [k ], name , "lp" );
25512558 }
25522559 legend -> Draw ("same" );
0 commit comments