@@ -3032,24 +3032,24 @@ void PlotHistCorr2Factors(char* infile1,
30323032}
30333033
30343034void PlotHistCorrDFactors (char * infile1 ,
3035- std ::string text1 ,
3036- char * infile2 ,
3037- std ::string text2 ,
3038- char * infile3 ,
3039- std ::string text3 ,
3040- char * infile4 ,
3041- std ::string text4 ,
3042- char * infile5 ,
3043- std ::string text5 ,
3044- int depth ,
3045- std ::string prefixF ,
3046- bool ratio = true,
3047- bool drawStatBox = false,
3048- int nmin = 100 ,
3049- bool isRealData = true,
3050- int year = 2024 ,
3051- int iformat = 0 ,
3052- int save = 0 ) {
3035+ std ::string text1 ,
3036+ char * infile2 ,
3037+ std ::string text2 ,
3038+ char * infile3 ,
3039+ std ::string text3 ,
3040+ char * infile4 ,
3041+ std ::string text4 ,
3042+ char * infile5 ,
3043+ std ::string text5 ,
3044+ int depth ,
3045+ std ::string prefixF ,
3046+ bool ratio = true,
3047+ bool drawStatBox = false,
3048+ int nmin = 100 ,
3049+ bool isRealData = true,
3050+ int year = 2024 ,
3051+ int iformat = 0 ,
3052+ int save = 0 ) {
30533053 std ::map < int , cfactors > cfacs [5 ];
30543054 std ::vector < std ::string > texts ;
30553055 int nfile (0 ), etamin (100 ), etamax (- 100 ), maxdepth (0 );
@@ -3115,93 +3115,95 @@ void PlotHistCorrDFactors(char* infile1,
31153115 int nline (0 );
31163116 if (ratio ) {
31173117 for (int ih = 1 ; ih < nfile ; ++ ih ) {
3118- sprintf (name , "h%dd%d" , ih , depth );
3119- TObject * ob = gROOT -> FindObject (name );
3120- if (ob )
3121- ob -> Delete ();
3122- TH1D * h = new TH1D (name , name , nbin , etamin , etamax );
3123- double sumNum (0 ), sumDen (0 );
3124- std ::map < int , cfactors > ::const_iterator ktr = cfacs [ih ].begin ();
3125- for (std ::map < int , cfactors > ::const_iterator itr = cfacs [0 ].begin (); itr != cfacs [0 ].end (); ++ itr , ++ ktr ) {
3126- int dep = (itr -> second ).depth ;
3127- if (dep == depth ) {
3128- int ieta = (itr -> second ).ieta ;
3129- int bin = ieta - etamin + 1 ;
3130- float val = (itr -> second ).corrf / (ktr -> second ).corrf ;
3131- 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 )));
3132- h -> SetBinContent (bin , val );
3133- h -> SetBinError (bin , dvl );
3134- sumNum += (val / (dvl * dvl ));
3135- sumDen += (1.0 / (dvl * dvl ));
3136- }
3137- }
3138- double fit = (sumDen > 0 ) ? (sumNum / sumDen ) : 1.0 ;
3139- std ::cout << "Fit to Pol0: " << fit << std ::endl ;
3140- h -> SetLineColor (colors [ih ]);
3141- h -> SetMarkerColor (colors [ih ]);
3142- h -> SetMarkerStyle (mtype [depth - 1 ]);
3143- h -> SetMarkerSize (0.9 );
3144- h -> GetXaxis ()-> SetTitle ("i#eta" );
3145- if (nfile > 2 )
3146- sprintf (name , "CF_{%s}/CF_{Set}" , texts [0 ].c_str ());
3147- else
3148- sprintf (name , "CF_{%s}/CF_{%s}" , texts [0 ].c_str (), texts [ih ].c_str ());
3149- h -> GetYaxis ()-> SetTitle (name );
3150- h -> GetYaxis ()-> SetLabelOffset (0.005 );
3151- h -> GetYaxis ()-> SetTitleSize (0.036 );
3152- h -> GetYaxis ()-> SetTitleOffset (1.20 );
3153- h -> GetYaxis ()-> SetRangeUser (0.50 , 1.50 );
3154- hists .push_back (h );
3155- fitr .push_back (fit );
3156- htype .push_back (ih );
3157- ++ nline ;
3118+ sprintf (name , "h%dd%d" , ih , depth );
3119+ TObject * ob = gROOT -> FindObject (name );
3120+ if (ob )
3121+ ob -> Delete ();
3122+ TH1D * h = new TH1D (name , name , nbin , etamin , etamax );
3123+ double sumNum (0 ), sumDen (0 );
3124+ std ::map < int , cfactors > ::const_iterator ktr = cfacs [ih ].begin ();
3125+ for (std ::map < int , cfactors > ::const_iterator itr = cfacs [0 ].begin (); itr != cfacs [0 ].end (); ++ itr , ++ ktr ) {
3126+ int dep = (itr -> second ).depth ;
3127+ if (dep == depth ) {
3128+ int ieta = (itr -> second ).ieta ;
3129+ int bin = ieta - etamin + 1 ;
3130+ float val = (itr -> second ).corrf / (ktr -> second ).corrf ;
3131+ float dvl =
3132+ val * sqrt ((((itr -> second ).dcorr * (itr -> second ).dcorr ) / ((itr -> second ).corrf * (itr -> second ).corrf )) +
3133+ (((ktr -> second ).dcorr * (ktr -> second ).dcorr ) / ((ktr -> second ).corrf * (ktr -> second ).corrf )));
3134+ h -> SetBinContent (bin , val );
3135+ h -> SetBinError (bin , dvl );
3136+ sumNum += (val / (dvl * dvl ));
3137+ sumDen += (1.0 / (dvl * dvl ));
3138+ }
3139+ }
3140+ double fit = (sumDen > 0 ) ? (sumNum / sumDen ) : 1.0 ;
3141+ std ::cout << "Fit to Pol0: " << fit << std ::endl ;
3142+ h -> SetLineColor (colors [ih ]);
3143+ h -> SetMarkerColor (colors [ih ]);
3144+ h -> SetMarkerStyle (mtype [depth - 1 ]);
3145+ h -> SetMarkerSize (0.9 );
3146+ h -> GetXaxis ()-> SetTitle ("i#eta" );
3147+ if (nfile > 2 )
3148+ sprintf (name , "CF_{%s}/CF_{Set}" , texts [0 ].c_str ());
3149+ else
3150+ sprintf (name , "CF_{%s}/CF_{%s}" , texts [0 ].c_str (), texts [ih ].c_str ());
3151+ h -> GetYaxis ()-> SetTitle (name );
3152+ h -> GetYaxis ()-> SetLabelOffset (0.005 );
3153+ h -> GetYaxis ()-> SetTitleSize (0.036 );
3154+ h -> GetYaxis ()-> SetTitleOffset (1.20 );
3155+ h -> GetYaxis ()-> SetRangeUser (0.50 , 1.50 );
3156+ hists .push_back (h );
3157+ fitr .push_back (fit );
3158+ htype .push_back (ih );
3159+ ++ nline ;
31583160 }
31593161 } else {
31603162 for (int k1 = 0 ; k1 < nfile ; ++ k1 ) {
3161- sprintf (name , "h%dd%d" , k1 , depth );
3162- TObject * ob = gROOT -> FindObject (name );
3163- if (ob )
3164- ob -> Delete ();
3165- TH1D * h = new TH1D (name , name , nbin , etamin , etamax );
3166- int nent (0 );
3167- for (std ::map < int , cfactors > ::const_iterator itr = cfacs [k1 ].begin (); itr != cfacs [k1 ].end (); ++ itr ) {
3168- int dep = (itr -> second ).depth ;
3169- if (dep == depth ) {
3170- int ieta = (itr -> second ).ieta ;
3171- int bin = ieta - etamin + 1 ;
3172- float val = (itr -> second ).corrf ;
3173- float dvl = (itr -> second ).dcorr ;
3174- h -> SetBinContent (bin , val );
3175- h -> SetBinError (bin , dvl );
3176- nent ++ ;
3177- }
3178- }
3179- if (nent > nmin ) {
3180- fits ++ ;
3181- if (drawStatBox )
3182- dy += 0.025 ;
3183- sprintf (name , "h%ddf%d" , k1 , depth );
3184- TObject * ob = gROOT -> FindObject (name );
3185- if (ob )
3186- ob -> Delete ();
3187- TF1 * func = new TF1 (name , "pol0" , etamin , etamax );
3188- h -> Fit (func , "+QWLR" , "" );
3189- }
3190- h -> SetLineColor (colors [k1 ]);
3191- h -> SetMarkerColor (colors [k1 ]);
3192- h -> SetMarkerStyle (mtype [depth - 1 ]);
3193- h -> SetMarkerSize (0.9 );
3194- h -> GetXaxis ()-> SetTitle ("i#eta" );
3195- h -> GetYaxis ()-> SetTitle ("Correction Factor" );
3196- h -> GetYaxis ()-> SetLabelOffset (0.005 );
3197- h -> GetYaxis ()-> SetTitleOffset (1.20 );
3198- h -> GetYaxis ()-> SetRangeUser (0.5 , 1.5 );
3199- hists .push_back (h );
3200- entries .push_back (nent );
3201- if (drawStatBox )
3202- dy += 0.025 ;
3203- htype .push_back (k1 );
3204- ++ nline ;
3163+ sprintf (name , "h%dd%d" , k1 , depth );
3164+ TObject * ob = gROOT -> FindObject (name );
3165+ if (ob )
3166+ ob -> Delete ();
3167+ TH1D * h = new TH1D (name , name , nbin , etamin , etamax );
3168+ int nent (0 );
3169+ for (std ::map < int , cfactors > ::const_iterator itr = cfacs [k1 ].begin (); itr != cfacs [k1 ].end (); ++ itr ) {
3170+ int dep = (itr -> second ).depth ;
3171+ if (dep == depth ) {
3172+ int ieta = (itr -> second ).ieta ;
3173+ int bin = ieta - etamin + 1 ;
3174+ float val = (itr -> second ).corrf ;
3175+ float dvl = (itr -> second ).dcorr ;
3176+ h -> SetBinContent (bin , val );
3177+ h -> SetBinError (bin , dvl );
3178+ nent ++ ;
3179+ }
3180+ }
3181+ if (nent > nmin ) {
3182+ fits ++ ;
3183+ if (drawStatBox )
3184+ dy += 0.025 ;
3185+ sprintf (name , "h%ddf%d" , k1 , depth );
3186+ TObject * ob = gROOT -> FindObject (name );
3187+ if (ob )
3188+ ob -> Delete ();
3189+ TF1 * func = new TF1 (name , "pol0" , etamin , etamax );
3190+ h -> Fit (func , "+QWLR" , "" );
3191+ }
3192+ h -> SetLineColor (colors [k1 ]);
3193+ h -> SetMarkerColor (colors [k1 ]);
3194+ h -> SetMarkerStyle (mtype [depth - 1 ]);
3195+ h -> SetMarkerSize (0.9 );
3196+ h -> GetXaxis ()-> SetTitle ("i#eta" );
3197+ h -> GetYaxis ()-> SetTitle ("Correction Factor" );
3198+ h -> GetYaxis ()-> SetLabelOffset (0.005 );
3199+ h -> GetYaxis ()-> SetTitleOffset (1.20 );
3200+ h -> GetYaxis ()-> SetRangeUser (0.5 , 1.5 );
3201+ hists .push_back (h );
3202+ entries .push_back (nent );
3203+ if (drawStatBox )
3204+ dy += 0.025 ;
3205+ htype .push_back (k1 );
3206+ ++ nline ;
32053207 }
32063208 }
32073209 if (ratio )
0 commit comments