@@ -2305,7 +2305,7 @@ void PlotHistCorrFactor(char* infile,
23052305
23062306void PlotHistCorrFactor (char * infile ,
23072307 std ::string text ,
2308- int depth ,
2308+ int depth ,
23092309 std ::string prefixF ,
23102310 double scale = 1.0 ,
23112311 int nmin = 100 ,
@@ -2388,14 +2388,14 @@ void PlotHistCorrFactor(char* infile,
23882388 if (drawStatBox ) {
23892389 TPaveStats * st1 = (TPaveStats * )hists [k ]-> GetListOfFunctions ()-> FindObject ("stats" );
23902390 if (st1 != nullptr ) {
2391- dy = (entries [k ] > nmin ) ? 0.05 : 0.025 ;
2392- st1 -> SetLineColor (colors [k ]);
2393- st1 -> SetTextColor (colors [k ]);
2394- st1 -> SetY1NDC (yh - dy );
2395- st1 -> SetY2NDC (yh );
2396- st1 -> SetX1NDC (0.70 );
2397- st1 -> SetX2NDC (0.90 );
2398- yh -= dy ;
2391+ dy = (entries [k ] > nmin ) ? 0.05 : 0.025 ;
2392+ st1 -> SetLineColor (colors [k ]);
2393+ st1 -> SetTextColor (colors [k ]);
2394+ st1 -> SetY1NDC (yh - dy );
2395+ st1 -> SetY2NDC (yh );
2396+ st1 -> SetX1NDC (0.70 );
2397+ st1 -> SetX2NDC (0.90 );
2398+ yh -= dy ;
23992399 }
24002400 }
24012401 sprintf (name , "Depth %d (%s)" , depth , text .c_str ());
@@ -2640,12 +2640,15 @@ void PlotHistCorrFactors(char* infile1,
26402640 h -> SetMarkerStyle (mtype [j ]);
26412641 h -> SetMarkerSize (0.9 );
26422642 h -> GetXaxis ()-> SetTitle ("i#eta" );
2643- sprintf (name , "CF_{%s}/CF_{Set}" , texts [0 ].c_str ());
2643+ if (nfile > 2 )
2644+ sprintf (name , "CF_{%s}/CF_{Set}" , texts [0 ].c_str ());
2645+ else
2646+ sprintf (name , "CF_{%s}/CF_{%s}" , texts [0 ].c_str (), texts [ih ].c_str ());
26442647 h -> GetYaxis ()-> SetTitle (name );
26452648 h -> GetYaxis ()-> SetLabelOffset (0.005 );
26462649 h -> GetYaxis ()-> SetTitleSize (0.036 );
26472650 h -> GetYaxis ()-> SetTitleOffset (1.20 );
2648- h -> GetYaxis ()-> SetRangeUser (0.80 , 1.20 );
2651+ h -> GetYaxis ()-> SetRangeUser (0.50 , 1.50 );
26492652 hists .push_back (h );
26502653 fitr .push_back (fit );
26512654 htype .push_back (ih );
@@ -2713,7 +2716,7 @@ void PlotHistCorrFactors(char* infile1,
27132716 pad -> SetTopMargin (0.10 );
27142717 double yh = 0.90 ;
27152718 double yl = yh - 0.035 * hists .size () - dy - 0.01 ;
2716- TLegend * legend = new TLegend (0.55 , yl , 0.90 , yl + 0.035 * nline );
2719+ TLegend * legend = new TLegend (0.45 , yl , 0.90 , yl + 0.035 * nline );
27172720 legend -> SetFillColor (kWhite );
27182721 for (unsigned int k = 0 ; k < hists .size (); ++ k ) {
27192722 if (k == 0 )
@@ -2742,7 +2745,7 @@ void PlotHistCorrFactors(char* infile1,
27422745 legend -> AddEntry (hists [k ], name , "lp" );
27432746 }
27442747 legend -> Draw ("same" );
2745- TPaveText * txt0 = new TPaveText (0.12 , 0.84 , 0.49 , 0.89 , "blNDC" );
2748+ TPaveText * txt0 = new TPaveText (0.11 , 0.84 , 0.45 , 0.89 , "blNDC" );
27462749 txt0 -> SetFillColor (0 );
27472750 char txt [40 ];
27482751 if (isRealData )
@@ -2829,82 +2832,80 @@ void PlotHistCorr2Factors(char* infile1,
28292832 int nline (0 );
28302833 if (ratio ) {
28312834 for (int ih = 1 ; ih < nfile ; ++ ih ) {
2832- sprintf (name , "h%dd%d" , ih , depth );
2833- TH1D * h = new TH1D (name , name , nbin , etamin , etamax );
2834- double sumNum (0 ), sumDen (0 );
2835- std ::map < int , cfactors > ::const_iterator ktr = cfacs [ih ].begin ();
2836- for (std ::map < int , cfactors > ::const_iterator itr = cfacs [0 ].begin (); itr != cfacs [0 ].end (); ++ itr , ++ ktr ) {
2837- int dep = (itr -> second ).depth ;
2838- if (dep == depth ) {
2839- int ieta = (itr -> second ).ieta ;
2840- int bin = ieta - etamin + 1 ;
2841- float val = (itr -> second ).corrf / (ktr -> second ).corrf ;
2842- float dvl =
2843- val * sqrt ((((itr -> second ).dcorr * (itr -> second ).dcorr ) / ((itr -> second ).corrf * (itr -> second ).corrf )) +
2844- (((ktr -> second ).dcorr * (ktr -> second ).dcorr ) / ((ktr -> second ).corrf * (ktr -> second ).corrf )));
2845- h -> SetBinContent (bin , val );
2846- h -> SetBinError (bin , dvl );
2847- sumNum += (val / (dvl * dvl ));
2848- sumDen += (1.0 / (dvl * dvl ));
2835+ sprintf (name , "h%dd%d" , ih , depth );
2836+ TH1D * h = new TH1D (name , name , nbin , etamin , etamax );
2837+ double sumNum (0 ), sumDen (0 );
2838+ std ::map < int , cfactors > ::const_iterator ktr = cfacs [ih ].begin ();
2839+ for (std ::map < int , cfactors > ::const_iterator itr = cfacs [0 ].begin (); itr != cfacs [0 ].end (); ++ itr , ++ ktr ) {
2840+ int dep = (itr -> second ).depth ;
2841+ if (dep == depth ) {
2842+ int ieta = (itr -> second ).ieta ;
2843+ int bin = ieta - etamin + 1 ;
2844+ float val = (itr -> second ).corrf / (ktr -> second ).corrf ;
2845+ float dvl = val * sqrt ((((itr -> second ).dcorr * (itr -> second ).dcorr ) / ((itr -> second ).corrf * (itr -> second ).corrf )) + (((ktr -> second ).dcorr * (ktr -> second ).dcorr ) / ((ktr -> second ).corrf * (ktr -> second ).corrf )));
2846+ h -> SetBinContent (bin , val );
2847+ h -> SetBinError (bin , dvl );
2848+ sumNum += (val / (dvl * dvl ));
2849+ sumDen += (1.0 / (dvl * dvl ));
28492850 }
2850- }
2851- double fit = (sumDen > 0 ) ? (sumNum / sumDen ) : 1.0 ;
2852- std ::cout << "Fit to Pol0: " << fit << std ::endl ;
2853- h -> SetLineColor (colors [ih ]);
2854- h -> SetMarkerColor (colors [ih ]);
2855- h -> SetMarkerStyle (mtype [depth - 1 ]);
2856- h -> SetMarkerSize (0.9 );
2857- h -> GetXaxis ()-> SetTitle ("i#eta" );
2858- sprintf (name , "CF_{%s}/CF_{%s}" , texts [0 ].c_str (), texts [1 ].c_str ());
2859- h -> GetYaxis ()-> SetTitle (name );
2860- h -> GetYaxis ()-> SetLabelOffset (0.005 );
2861- h -> GetYaxis ()-> SetTitleSize (0.036 );
2862- h -> GetYaxis ()-> SetTitleOffset (1.20 );
2863- h -> GetYaxis ()-> SetRangeUser (0.50 , 1.50 );
2864- hists .push_back (h );
2865- fitr .push_back (fit );
2866- htype .push_back (ih );
2867- ++ nline ;
2851+ }
2852+ double fit = (sumDen > 0 ) ? (sumNum / sumDen ) : 1.0 ;
2853+ std ::cout << "Fit to Pol0: " << fit << std ::endl ;
2854+ h -> SetLineColor (colors [ih ]);
2855+ h -> SetMarkerColor (colors [ih ]);
2856+ h -> SetMarkerStyle (mtype [depth - 1 ]);
2857+ h -> SetMarkerSize (0.9 );
2858+ h -> GetXaxis ()-> SetTitle ("i#eta" );
2859+ sprintf (name , "CF_{%s}/CF_{%s}" , texts [0 ].c_str (), texts [1 ].c_str ());
2860+ h -> GetYaxis ()-> SetTitle (name );
2861+ h -> GetYaxis ()-> SetLabelOffset (0.005 );
2862+ h -> GetYaxis ()-> SetTitleSize (0.036 );
2863+ h -> GetYaxis ()-> SetTitleOffset (1.20 );
2864+ h -> GetYaxis ()-> SetRangeUser (0.50 , 1.50 );
2865+ hists .push_back (h );
2866+ fitr .push_back (fit );
2867+ htype .push_back (ih );
2868+ ++ nline ;
28682869 }
28692870 } else {
28702871 for (int k1 = 0 ; k1 < nfile ; ++ k1 ) {
2871- sprintf (name , "h%dd%d" , k1 , depth );
2872- TH1D * h = new TH1D (name , name , nbin , etamin , etamax );
2873- int nent (0 );
2874- for (std ::map < int , cfactors > ::const_iterator itr = cfacs [k1 ].begin (); itr != cfacs [k1 ].end (); ++ itr ) {
2875- int dep = (itr -> second ).depth ;
2876- if (dep == depth ) {
2877- int ieta = (itr -> second ).ieta ;
2878- int bin = ieta - etamin + 1 ;
2879- float val = (itr -> second ).corrf ;
2880- float dvl = (itr -> second ).dcorr ;
2881- h -> SetBinContent (bin , val );
2882- h -> SetBinError (bin , dvl );
2883- nent ++ ;
2884- }
2885- }
2886- if (nent > nmin ) {
2887- fits ++ ;
2888- if (drawStatBox )
2889- dy += 0.025 ;
2890- sprintf (name , "h%ddf%d" , k1 , depth );
2891- TF1 * func = new TF1 (name , "pol0" , etamin , etamax );
2892- h -> Fit (func , "+QWLR" , "" );
2893- }
2894- h -> SetLineColor (colors [k1 ]);
2895- h -> SetMarkerColor (colors [k1 ]);
2896- h -> SetMarkerStyle (mtype [depth - 1 ]);
2897- h -> SetMarkerSize (0.9 );
2898- h -> GetXaxis ()-> SetTitle ("i#eta" );
2899- h -> GetYaxis ()-> SetTitle ("Correction Factor" );
2900- h -> GetYaxis ()-> SetLabelOffset (0.005 );
2901- h -> GetYaxis ()-> SetTitleOffset (1.20 );
2902- h -> GetYaxis ()-> SetRangeUser (0.5 , 1.5 );
2903- hists .push_back (h );
2904- entries .push_back (nent );
2905- if (drawStatBox )
2906- dy += 0.025 ;
2907- htype .push_back (k1 );
2872+ sprintf (name , "h%dd%d" , k1 , depth );
2873+ TH1D * h = new TH1D (name , name , nbin , etamin , etamax );
2874+ int nent (0 );
2875+ for (std ::map < int , cfactors > ::const_iterator itr = cfacs [k1 ].begin (); itr != cfacs [k1 ].end (); ++ itr ) {
2876+ int dep = (itr -> second ).depth ;
2877+ if (dep == depth ) {
2878+ int ieta = (itr -> second ).ieta ;
2879+ int bin = ieta - etamin + 1 ;
2880+ float val = (itr -> second ).corrf ;
2881+ float dvl = (itr -> second ).dcorr ;
2882+ h -> SetBinContent (bin , val );
2883+ h -> SetBinError (bin , dvl );
2884+ nent ++ ;
2885+ }
2886+ }
2887+ if (nent > nmin ) {
2888+ fits ++ ;
2889+ if (drawStatBox )
2890+ dy += 0.025 ;
2891+ sprintf (name , "h%ddf%d" , k1 , depth );
2892+ TF1 * func = new TF1 (name , "pol0" , etamin , etamax );
2893+ h -> Fit (func , "+QWLR" , "" );
2894+ }
2895+ h -> SetLineColor (colors [k1 ]);
2896+ h -> SetMarkerColor (colors [k1 ]);
2897+ h -> SetMarkerStyle (mtype [depth - 1 ]);
2898+ h -> SetMarkerSize (0.9 );
2899+ h -> GetXaxis ()-> SetTitle ("i#eta" );
2900+ h -> GetYaxis ()-> SetTitle ("Correction Factor" );
2901+ h -> GetYaxis ()-> SetLabelOffset (0.005 );
2902+ h -> GetYaxis ()-> SetTitleOffset (1.20 );
2903+ h -> GetYaxis ()-> SetRangeUser (0.5 , 1.5 );
2904+ hists .push_back (h );
2905+ entries .push_back (nent );
2906+ if (drawStatBox )
2907+ dy += 0.025 ;
2908+ htype .push_back (k1 );
29082909 }
29092910 ++ nline ;
29102911 }
0 commit comments