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,7 @@ 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 (char * infile , std ::string text , std ::string prefixF = "" , int depth = -1 , int iformat = 0 , int save = 0 ) {
24762476 std ::map < int , cfactors > cfacs ;
24772477 int etamin (100 ), etamax (- 100 ), maxdepth (0 );
24782478 double scale (1.0 );
@@ -2492,21 +2492,23 @@ void PlotHistCorrAsymmetry(char* infile, std::string text, std::string prefixF =
24922492 std ::vector < int > entries ;
24932493 char name [100 ];
24942494 double dy (0 );
2495- for (int j = 0 ; j < maxdepth ; ++ j ) {
2496- sprintf (name , "hd%d" , j + 1 );
2495+ int maxd = (depth < 0 ) ? maxdepth : 1 ;
2496+ for (int j = 0 ; j < maxd ; ++ j ) {
2497+ int dep = (depth < 0 ) ? (j + 1 ) : depth ;
2498+ sprintf (name , "hd%d" , dep );
24972499 TObject * ob = gROOT -> FindObject (name );
24982500 if (ob )
24992501 ob -> Delete ();
25002502 TH1D * h = new TH1D (name , name , nbin , 0 , etamax );
25012503 int nent (0 );
25022504 for (std ::map < int , cfactors > ::const_iterator itr = cfacs .begin (); itr != cfacs .end (); ++ itr ) {
2503- if ((itr -> second ).depth == j + 1 ) {
2505+ if ((itr -> second ).depth == dep ) {
25042506 int ieta = (itr -> second ).ieta ;
25052507 float vl1 = (itr -> second ).corrf ;
25062508 float dv1 = (itr -> second ).dcorr ;
25072509 if (ieta > 0 ) {
25082510 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 )) {
2511+ if (((ktr -> second ).depth == dep ) && ((ktr -> second ).ieta == - ieta )) {
25102512 float vl2 = (ktr -> second ).corrf ;
25112513 float dv2 = (ktr -> second ).dcorr ;
25122514 float val = 2.0 * (vl1 - vl2 ) / (vl1 + vl2 );
@@ -2520,9 +2522,9 @@ void PlotHistCorrAsymmetry(char* infile, std::string text, std::string prefixF =
25202522 }
25212523 }
25222524 }
2523- h -> SetLineColor (colors [j ]);
2524- h -> SetMarkerColor (colors [j ]);
2525- h -> SetMarkerStyle (mtype [j ]);
2525+ h -> SetLineColor (colors [dep - 1 ]);
2526+ h -> SetMarkerColor (colors [dep - 1 ]);
2527+ h -> SetMarkerStyle (mtype [dep - 1 ]);
25262528 h -> GetXaxis ()-> SetTitle ("i#eta" );
25272529 h -> GetYaxis ()-> SetTitle ("Asymmetry in Correction Factor" );
25282530 h -> GetYaxis ()-> SetLabelOffset (0.005 );
@@ -2532,7 +2534,10 @@ void PlotHistCorrAsymmetry(char* infile, std::string text, std::string prefixF =
25322534 entries .push_back (nent );
25332535 dy += 0.025 ;
25342536 }
2535- sprintf (name , "c_%sCorrAsymmetry" , prefixF .c_str ());
2537+ if (depth < 0 )
2538+ sprintf (name , "c_%sCorrAsymmetry" , prefixF .c_str ());
2539+ else
2540+ sprintf (name , "c_%sCorrAsymmetryD%d" , prefixF .c_str (), depth );
25362541 TCanvas * pad = new TCanvas (name , name , 700 , 500 );
25372542 pad -> SetRightMargin (0.10 );
25382543 pad -> SetTopMargin (0.10 );
@@ -2541,12 +2546,13 @@ void PlotHistCorrAsymmetry(char* infile, std::string text, std::string prefixF =
25412546 TLegend * legend = new TLegend (0.60 , yl , 0.90 , yl + 0.035 * hists .size ());
25422547 legend -> SetFillColor (kWhite );
25432548 for (unsigned int k = 0 ; k < hists .size (); ++ k ) {
2549+ int dep = (depth < 0 ) ? (k + 1 ) : depth ;
25442550 if (k == 0 )
25452551 hists [k ]-> Draw ("" );
25462552 else
25472553 hists [k ]-> Draw ("sames" );
25482554 pad -> Update ();
2549- sprintf (name , "Depth %d (%s)" , k + 1 , text .c_str ());
2555+ sprintf (name , "Depth %d (%s)" , dep , text .c_str ());
25502556 legend -> AddEntry (hists [k ], name , "lp" );
25512557 }
25522558 legend -> Draw ("same" );
0 commit comments