7 #include "RooGlobalFunc.h"
9 #include "RooRealVar.h"
10 #include "RooDataSet.h"
11 #include "RooAbsData.h"
12 #include "RooDataHist.h"
13 #include "RooGaussian.h"
14 #include "RooLandau.h"
15 #include "RooChebychev.h"
16 #include "RooAddPdf.h"
17 #include "RooExtendPdf.h"
18 #include "RooCBShape.h"
19 #include "RooNovosibirsk.h"
20 #include "RooFFTConvPdf.h"
21 #include "RooExponential.h"
22 #include "RooSimultaneous.h"
23 #include "RooPolynomial.h"
24 #include "RooFitResult.h"
25 #include "RooCategory.h"
26 #include "RooBinning.h"
27 #include "RooWorkspace.h"
28 #include "RooChi2Var.h"
29 #include "RooMinuit.h"
30 #include "RooFormulaVar.h"
44 #include<TGraphErrors.h>
55 #include "AtlasStyle.C"
57 using namespace RooFit ;
66 void makePlots( RooAbsData* originalDataSet,
73 TString extraCuts =
"");
74 void makeFits( RooAbsData* originalDataSet,
80 TString additionalCut =
"" );
91 TString
PATH =
"./Results/";
93 void run_EoverP(TString
fileName =
"../share/eoverpValidationOut.root",
int refit=2,
int netabins=12,
int nphibins=12){
103 if( !((refit >= 0) && (refit <= 2)) ){
104 std::cout <<
"ERROR :: Input parameter 'refit' must be equal to 0, 1, or 2!" << std::endl;
107 if( (netabins < 1) || (nphibins < 1) ){
108 std::cout <<
"ERROR :: Can't have less than one bin in eta/phi!" << std::endl;
115 RooRealVar ClusterEnergy(
"ClusterEnergy",
"ClusterEnergy",0,1e10,
"MeV") ;
116 RooRealVar ClusterPhi(
"ClusterPhi",
"#phi",0);
117 RooRealVar ClusterEta(
"ClusterEta",
"#eta",0);
118 RooRealVar
charge(
"charge",
"charge",0);
119 RooRealVar TrackTheta(
"TrackTheta",
"TrackTheta",0);
120 RooRealVar TrackQoverP(
"QoverP",
"QoverP",-1e10,1e10,
"MeV^{-1}");
121 RooRealVar
EoverP(
"EoverP",
"E/p",0,5,
"");
122 RooRealVar Et(
"Et",
"E_{T}",0,1e10,
"GeV");
123 RooRealVar
Eta(
"Eta",
"#eta",-3,3,
"");
126 arg.add(ClusterEnergy);
131 arg.add(TrackQoverP);
140 TChain *eoverpTree =
new TChain(
"EGrefitterSmall");
143 Double_t el_ClusterEnergy;
144 Double_t el_ClusterPhi;
145 Double_t el_ClusterEta;
147 Double_t el_TrackTheta;
151 eoverpTree->SetBranchAddress(
"ClusterEnergy", &el_ClusterEnergy);
152 eoverpTree->SetBranchAddress(
"ClusterPhi", &el_ClusterPhi);
153 eoverpTree->SetBranchAddress(
"ClusterEta", &el_ClusterEta);
154 eoverpTree->SetBranchAddress(
"charge", &el_charge);
155 eoverpTree->SetBranchAddress(
"TrackTheta", &el_TrackTheta);
156 eoverpTree->SetBranchAddress(
"Default_QoverP", &el_QoverP);
157 eoverpTree->SetBranchAddress(
"Refitted1_QoverP", &el_QoverP1);
158 eoverpTree->SetBranchAddress(
"Refitted2_QoverP", &el_QoverP2);
160 RooDataSet* dataSet =
new RooDataSet(
"DataSet",
"DataSet",
arg);
168 Int_t nEl = eoverpTree->GetEntries();
169 for (Int_t
i=0;
i<nEl;
i++){
171 std::cout <<
"Filling variables for electron #" <<
i << std::endl;
172 eoverpTree->GetEntry(
i);
175 Et.setVal(el_ClusterEnergy*
sin(el_TrackTheta)*1
e-3);
177 ClusterPhi.setVal(el_ClusterPhi);
178 ClusterEnergy.setVal(el_ClusterEnergy);
179 ClusterEta.setVal(el_ClusterEta);
182 EoverP.setVal(fabs(el_QoverP)*el_ClusterEnergy);
186 EoverP.setVal(fabs(el_QoverP1)*el_ClusterEnergy);
190 EoverP.setVal(fabs(el_QoverP2)*el_ClusterEnergy);
199 c.Print(
PATH+
"new_eoverp_plots.pdf(");
212 c.Print(
PATH+
"new_eoverp_plots.pdf)");
231 double stepSize = 5./nBinsEta;
232 for (
int i(0);
i<= nBinsEta; ++
i){
237 stepSize = 2 * TMath::Pi()/nBinsPhi;
238 for (
int i(0);
i<= nBinsPhi; ++
i){
244 meanPlotPos->SetTitle(
"Mean Plot Positive "+extraCuts);
245 meanPlotPos->GetXaxis()->SetTitle(
"#eta");
246 meanPlotPos->GetYaxis()->SetTitle(
"#phi [rad]");
248 meanPlotNeg->SetTitle(
"Mean Plot Negative "+extraCuts);
249 meanPlotNeg->GetXaxis()->SetTitle(
"#eta");
250 meanPlotNeg->GetYaxis()->SetTitle(
"#phi [rad]");
260 TFile
f(
PATH+
"fitEoverP.root",
"Recreate");
261 meanPlotPos->Write();
262 meanPlotNeg->Write();
268 for (
int i=0;
i<= 100;
i++){
273 double eopRange[102];
275 for (
int i=0;
i<= 100;
i++){
276 eopRange[
i] = 0.8+stepSize*(
double)
i;
279 TH2F *ptvsEta =
new TH2F(
"meanPtVsEta"+extraCuts,
"meanPtVsEta"+extraCuts,nBinsEta,
etaRange,100,ptRange);
280 TH2F *eoverPvsEta =
new TH2F(
"eoverPvsEta"+extraCuts,
"eoverPvsEta"+extraCuts,nBinsEta,
etaRange,100,eopRange);
282 RooArgSet vars(Et,eOverP,
eta);
283 for(
int i=0;
i < originalDataSet->numEntries();
i++){
285 const RooArgSet*
args = originalDataSet->get(
i);
288 double valEt = Et.getVal();
289 double valeOverP = eOverP.getVal();
290 double valEta =
eta.getVal();
294 ptvsEta->Fill(valEta,valEt);
295 eoverPvsEta->Fill(valEta,valeOverP);
299 eoverPvsEta->Write();
313 TString additionalCut )
319 TCanvas *
c =
new TCanvas();
326 RooRealVar meanPos(
"<E/p>+",
"meanPos",1,0.,2.8,
"") ;
327 RooRealVar meanNeg(
"<E/p>-",
"meanNeg",1,0.,2.8,
"") ;
328 RooRealVar
sigma(
"#sigma",
"sigma",0.1,0,5,
"") ;
329 RooRealVar alpha(
"#alpha",
"alpha",-1,-100,-0.0001,
"") ;
330 RooRealVar
n(
"n",
"n",1,0.1,1000,
"") ;
333 RooRealVar LandauMeanPos (
"LandauM+",
"LandauMeanPos", 1,0.7,1.5,
"");
334 LandauMeanPos.setConstant(kFALSE);
335 RooRealVar LandauMeanNeg (
"LandauM-",
"LandauMeanNeg", 1,0.7,1.5,
"");
336 LandauMeanNeg.setConstant(kFALSE);
337 RooRealVar LandauS (
"Landau #sigma",
"Landau Sigma", 0.1,0,5,
"");
338 LandauS.setConstant(kFALSE);
341 RooGaussian gaussianPos(
"PosGauss",
"Initial Gauss", eOverP, meanPos,
sigma);
342 RooGaussian gaussianNeg(
"NegGauss",
"Initial Gauss", eOverP, meanNeg,
sigma);
343 RooCBShape crystalBallPos(
"PosCB",
"Crystal Ball shape", eOverP, meanPos,
sigma, alpha,
n);
344 RooCBShape crystalBallNeg(
"NegCB",
"Crystal Ball shape", eOverP, meanNeg,
sigma, alpha,
n);
345 RooLandau LandauPos (
"PosLandau",
"Initial Landau", eOverP, LandauMeanPos, LandauS);
346 RooLandau LandauNeg (
"NegLandau",
"Initial Landau", eOverP, LandauMeanNeg, LandauS);
349 RooFFTConvPdf LcwGPos (
"LcwG_Pos",
"Landau (x) Gauss", eOverP, LandauPos, gaussianPos);
350 RooFFTConvPdf LcwGNeg (
"LcwG_Neg",
"Landau (x) Gauss", eOverP, LandauNeg, gaussianNeg);
354 eOverP.setRange(
"fitGauss",0.5,1.5);
355 eOverP.setRange(
"fitLandau",0.5,1.5);
356 eOverP.setRange(
"final",0.0,3.0);
357 eOverP.setRange(
"finalFit",0.8,2.5);
363 static const int nBinsX = meanPlotPos->GetXaxis()->GetNbins();
364 static const int nBinsY = meanPlotPos->GetYaxis()->GetNbins();
366 RooAbsData* absDataSetPos = originalDataSet->reduce(
Cut(
"charge > 0"+ additionalCut) );
367 RooAbsData* absDataSetNeg = originalDataSet->reduce(
Cut(
"charge < 0"+ additionalCut) );
368 RooDataSet* dataSetPos =
dynamic_cast<RooDataSet*
>( absDataSetPos );
369 RooDataSet* dataSetNeg =
dynamic_cast<RooDataSet*
>( absDataSetNeg );
370 RooArgSet vars(xvar,yvar,eOverP);
372 RooDataSet* binnedDataPos[nBinsX][nBinsY];
373 RooDataSet* binnedDataNeg[nBinsX][nBinsY];
376 for(
int xvarStep = 0; xvarStep<nBinsX; xvarStep++){
377 for(
int yvarStep = 0; yvarStep<nBinsY; yvarStep++){
379 TString rangeName = xvar.getTitle() +
"Bin";
380 rangeName += xvarStep;
381 rangeName +=
"_"+yvar.getTitle()+
"Bin";
382 rangeName += yvarStep;
384 binnedDataPos[xvarStep][yvarStep] = (RooDataSet*)originalDataSet->emptyClone() ;
385 binnedDataNeg[xvarStep][yvarStep] = (RooDataSet*)originalDataSet->emptyClone() ;
387 binnedDataPos[xvarStep][yvarStep]->SetName(rangeName+
"_Pos");
388 binnedDataNeg[xvarStep][yvarStep]->SetName(rangeName+
"_Neg");
397 for (
int i=0;
i<dataSetPos->numEntries();
i++) {
398 const RooArgSet*
args = dataSetPos->get(
i);
400 int globalbin = meanPlotPos->FindBin(xvar.getVal(),yvar.getVal());
402 meanPlotPos->GetBinXYZ(
globalbin,binx,biny,binz);
403 binnedDataPos[binx-1][biny-1]->add(*
args);
406 for (
int i=0;
i<dataSetNeg->numEntries();
i++) {
407 const RooArgSet*
args = dataSetNeg->get(
i);
409 int globalbin = meanPlotNeg->FindBin(xvar.getVal(),yvar.getVal());
411 meanPlotNeg->GetBinXYZ(
globalbin,binx,biny,binz);
412 binnedDataNeg[binx-1][biny-1]->add(*
args);
418 for(
int xvarStep = 0; xvarStep<nBinsX; xvarStep++){
419 for(
int yvarStep = 0; yvarStep<nBinsY; yvarStep++){
421 TString rangeName = xvar.getTitle() +
"Bin";
422 rangeName += xvarStep;
423 rangeName +=
"_"+yvar.getTitle()+
"Bin";
424 rangeName += yvarStep;
427 RooPlot* framePos = eOverP.frame(
Title(
"E/P pos"),
Range(
"final"));
428 RooPlot* frameNeg = eOverP.frame(
Title(
"E/P neg"),
Range(
"final"));
431 RooDataSet* smallDataSetPos = binnedDataPos[xvarStep][yvarStep];
432 RooDataSet* smallDataSetNeg = binnedDataNeg[xvarStep][yvarStep];
435 smallDataSetPos->plotOn(framePos,LineColor(kBlue),MarkerColor(kBlue));
436 smallDataSetNeg->plotOn(frameNeg,LineColor(kRed),MarkerColor(kRed));
448 RooCategory
sample(
"sample",
"sample");
451 RooDataSet combData(
"combData",
"combined data",eOverP,
Index(
sample),Import(
"Pos",*smallDataSetPos),Import(
"Neg",*smallDataSetNeg));
457 RooSimultaneous simPdfGS(
"simPdfGS",
"simultaneous pdf",
sample);
458 simPdfGS.addPdf(gaussianPos,
"Pos");
459 simPdfGS.addPdf(gaussianNeg,
"Neg");
461 RooSimultaneous simPdfCB(
"simPdfCB",
"simultaneous pdf",
sample);
462 simPdfCB.addPdf(crystalBallPos,
"Pos");
463 simPdfCB.addPdf(crystalBallNeg,
"Neg");
465 RooSimultaneous simPdfLnd(
"simPdfLnd",
"simultaneous pdf",
sample);
466 simPdfLnd.addPdf(LandauPos,
"Pos");
467 simPdfLnd.addPdf(LandauNeg,
"Neg");
469 RooSimultaneous simPdfLcwG(
"simPdfLcwG",
"simultaneous pdf",
sample);
470 simPdfLcwG.addPdf(LcwGPos,
"Pos");
471 simPdfLcwG.addPdf(LcwGNeg,
"Neg");
477 double fitMeanPos = -999.;
478 double fitMeanNeg = -999.;
479 double fitSigma = -999.;
482 eOverP.setRange(
"fitGauss_Pos",0.5,1.5);
483 eOverP.setRange(
"fitGauss_Neg",0.5,1.5);
485 RooFitResult* fitResult = simPdfGS.fitTo(combData,
Range(
"fitGauss"),SplitRange(),Save());
487 std::cout <<
"WARNING:: FIRST GAUSSIAN FIT PRODUCED A FIT RESULT" <<std::endl;
489 std::cout <<
"WARNING:: FIRST GAUSSIAN FIT DID NOT PRODUCE A FIT RESULT" <<std::endl;
491 fitMeanPos = meanPos.getVal();
492 fitMeanNeg = meanNeg.getVal();
493 fitSigma =
sigma.getVal();
495 eOverP.setRange(
"fitGauss_Pos",fitMeanPos-2*fitSigma,fitMeanPos+2*fitSigma);
496 eOverP.setRange(
"fitGauss_Neg",fitMeanNeg-2*fitSigma,fitMeanNeg+2*fitSigma);
497 if ( fitResult && fitResult->status() != 0){
498 std::cout <<
"WARNING:: FIRST GAUSSIAN FIT DID NOT CONVERGE" <<std::endl;
502 eOverP.setRange(
"fitGauss_Pos",0.1,1.9);
503 eOverP.setRange(
"fitGauss_Neg",0.1,1.9);
507 fitResult = simPdfGS.fitTo(combData,
Range(
"fitGauss"),SplitRange(),Save() );
508 if ( fitResult && fitResult->status() != 0){
509 std::cout <<
"WARNING::SECOND GAUSSIAN FIT DID NOT CONVERGE" <<std::endl;
538 if (fitResult)
delete fitResult;
539 fitMeanPos = meanPos.getVal();
540 fitMeanNeg = meanNeg.getVal();
541 fitSigma =
sigma.getVal();
543 eOverP.setRange(
"fitGauss_Pos",fitMeanPos-1.25*fitSigma,fitMeanPos+1*fitSigma);
544 eOverP.setRange(
"fitGauss_Neg",fitMeanNeg-1.25*fitSigma,fitMeanNeg+1*fitSigma);
547 fitResult = simPdfGS.fitTo(combData,
Range(
"fitGauss"),SplitRange(), Save() );
548 if ( fitResult && fitResult->status() != 0){
549 std::cout <<
"WARNING::FINAL GAUSSIAN FIT DID NOT CONVERGE" <<std::endl;
555 if(fitResult)
delete fitResult;
581 eOverP.setRange(
"finalFit_Pos",fitMeanPos-1.5*fitSigma,2.5);
582 eOverP.setRange(
"finalFit_Neg",fitMeanNeg-1.5*fitSigma,2.5);
584 if (fitMeanPos-1.5*fitSigma > 1.4 )
585 eOverP.setRange(
"finalFit_Pos",1.2,2.5);
586 if (fitMeanNeg-1.5*fitSigma > 1.4 )
587 eOverP.setRange(
"finalFit_Neg",1.2,2.5);
590 eOverP.setRange(
"finalFit_Pos",0.8,2.5);
591 eOverP.setRange(
"finalFit_Neg",0.8,2.5);
604 fitResult = simPdfCB.fitTo(combData,
Range(
"finalFit"),SplitRange(), Save() ) ;
605 crystalBallPos.plotOn(framePos,LineColor(kAzure-2),
Range(
"finalFit_Pos"),NormRange(
"finalFit_Pos"));
606 crystalBallNeg.plotOn(frameNeg,LineColor(kRed-7),
Range(
"finalFit_Neg"),NormRange(
"finalFit_Neg"));
619 if(simCount > 5)
break;
620 fitResult = simPdfLcwG.fitTo(combData,
Range(
"finalFit"),SplitRange(), Save() ) ;
622 }
while(fitResult && ( fitResult->status() != 0 || fitResult->covQual() != 3 ));
624 LcwGPos.plotOn(framePos,LineColor(kAzure-2),
Range(
"finalFit_Pos"),NormRange(
"finalFit_Pos"));
625 LcwGNeg.plotOn(frameNeg,LineColor(kRed-7),
Range(
"finalFit_Neg"),NormRange(
"finalFit_Neg"));
631 cout <<
" ** fit_EoverP ** Please type RETURN to continue:\n>";
637 meanPlotPos->SetBinContent(xvarStep+1,yvarStep+1,meanPos.getVal());
638 meanPlotPos->SetBinError (xvarStep+1,yvarStep+1,meanPos.getError());
639 meanPlotNeg->SetBinContent(xvarStep+1,yvarStep+1,meanNeg.getVal());
640 meanPlotNeg->SetBinError (xvarStep+1,yvarStep+1,meanNeg.getError());
642 if( fitResult && ( fitResult->status() != 0 || fitResult->covQual() != 3 ) ){
643 std::cout <<
"WARNING::FINAL SIM FIT DID NOT CONVERGE FULLY" <<std::endl;
644 meanPlotPos->SetBinContent(xvarStep+1,yvarStep+1,1);
645 meanPlotPos->SetBinError (xvarStep+1,yvarStep+1,0.5);
646 meanPlotNeg->SetBinContent(xvarStep+1,yvarStep+1,1);
647 meanPlotNeg->SetBinError (xvarStep+1,yvarStep+1,0.5);
650 if(fitResult)
delete fitResult;
656 frameNeg->Draw(
"same");
659 TString* xvarTString =
new TString(xvar.getTitle());
660 TString* yvarTString =
new TString(yvar.getTitle());
662 const char *yvarChar = *yvarTString;
663 const char *xvarChar = *xvarTString;
666 myText(0.25,0.96,kBlack,Form(
"Slice %01.2f< %s <%01.2f, %01.2f< %s <%01.2f"
667 ,meanPlotPos->GetXaxis()->GetBinLowEdge(xvarStep+1)
669 ,meanPlotPos->GetXaxis()->GetBinLowEdge(xvarStep+2)
670 ,meanPlotPos->GetYaxis()->GetBinLowEdge(yvarStep+1)
672 ,meanPlotPos->GetYaxis()->GetBinLowEdge(yvarStep+2)) );
674 myMarkerText(0.65,0.85,kBlue,20,Form(
"e^{+}, <E/p> %01.3f #pm %01.3f",meanPlotPos->GetBinContent(xvarStep+1,yvarStep+1), meanPlotNeg->GetBinError(xvarStep+1,yvarStep+1) ),1.0,0.03);
675 myMarkerText(0.65,0.80,kRed,20,Form(
"e^{-}, <E/p> %01.3f #pm %01.3f",meanPlotNeg->GetBinContent(xvarStep+1,yvarStep+1), meanPlotPos->GetBinError(xvarStep+1,yvarStep+1) ),1.0,0.03);
678 c->Print(
PATH+
"new_eoverp_plots.pdf");
682 delete smallDataSetPos;
683 delete smallDataSetNeg;
690 const UInt_t Number = 3;
691 Double_t
Green[Number] = { 0.00, 1.00, 0.00};
692 Double_t
Red[Number] = { 1.00, 0.10, 0.00};
693 Double_t Blue[Number] = { 0.10, 0.10, 1.00};
694 Double_t Length[Number] = { 0.00, 0.50, 1.00 };
700 clone->Divide(meanPlotNeg);
703 TH2F* clone2 =(
TH2F*) meanPlotPos->Clone();
704 clone2->Add( meanPlotNeg, -1);
705 clone2->SetContour(
nb);
707 Double_t minPlot,maxPlot;
710 c->SetRightMargin(0.12);
715 minPlot=
clone->GetMinimum();
716 maxPlot=
clone->GetMaximum();
717 if (maxPlot-1 > 1-minPlot)
clone->SetMinimum(2-maxPlot);
718 else clone->SetMaximum(2-minPlot);
720 c->Print(
PATH+
"new_eoverp_plots.pdf");
722 meanPlotPos->Draw(
"colz");
723 meanPlotPos->SetContour(
nb);
726 minPlot= meanPlotPos->GetMinimum();
727 maxPlot= meanPlotPos->GetMaximum();
728 if (maxPlot-1 > 1-minPlot) meanPlotPos->SetMinimum(2-maxPlot);
729 else meanPlotPos->SetMaximum(2-minPlot);
731 c->Print(
PATH+
"new_eoverp_plots.pdf");
733 meanPlotNeg->Draw(
"colz");
734 meanPlotNeg->SetContour(
nb);
737 minPlot= meanPlotNeg->GetMinimum();
738 maxPlot= meanPlotNeg->GetMaximum();
739 if (maxPlot-1 > 1-minPlot) meanPlotNeg->SetMinimum(2-maxPlot);
740 else meanPlotNeg->SetMaximum(2-minPlot);
742 c->Print(
PATH+
"new_eoverp_plots.pdf");
745 pull->GetXaxis()->SetTitle(
"Fit Pull");
746 pull->GetYaxis()->SetTitle(
"Entries per 0.2");
748 c->SetRightMargin(0.03);
749 TF1 myGauss(
"myGaus",
"gaus");
750 for(
int xvarStep(0); xvarStep<nBinsX; ++xvarStep){
751 for(
int yvarStep(0); yvarStep<nBinsY; ++yvarStep){
752 double R =
clone->GetBinContent(xvarStep+1,yvarStep+1);
753 std::cout <<
"INFO : R "<<
R <<
" Ratio delta " << (1-
R)/(1+
R) <<
" Diff Delta "<< clone2->GetBinContent(xvarStep+1,yvarStep+1)/-2. <<
" Diff Delta "<< 1-(clone2->GetBinContent(xvarStep+1,yvarStep+1)/-2.)/((1-
R)/(1+
R)) <<std::endl;
754 pull->Fill( ( 1-
clone->GetBinContent(xvarStep+1,yvarStep+1))/
clone->GetBinError (xvarStep+1,yvarStep+1) );
759 myMarkerText(0.7,0.85,kWhite,1,Form(
"Gaussian, #mu = %01.3f #pm %01.3f",myGauss.GetParameter(1), myGauss.GetParError(1) ),1.0,0.03);
760 myMarkerText(0.7,0.80,kWhite,1,Form(
"Gaussian, #sigma = %01.3f #pm %01.3f",myGauss.GetParameter(2), myGauss.GetParError(2) ),1.0,0.03);
761 myMarkerText(0.7,0.75,kWhite,1,Form(
"Mean, = %01.3f #pm %01.3f",
pull->GetMean(),
pull->GetMeanError() ),1.0,0.03);
762 myMarkerText(0.7,0.70,kWhite,1,Form(
"RMS, = %01.3f #pm %01.3f",
pull->GetRMS(),
pull->GetRMSError() ),1.0,0.03);
764 c->Print(
PATH+
"new_eoverp_plots.pdf");
776 std::cout <<
"INFO::makeSlicePlots()" << std::endl;
781 maxStep =
pos->GetNbinsX();
783 maxStep =
pos->GetNbinsY();
787 for (
int i(0);
i <maxStep; ++
i ){
794 posProjection =
pos->ProjectionY(
"_py",
i+1 ,
i+1);
795 negProjection = neg->ProjectionY(
"_py",
i+1 ,
i+1);
800 posProjection =
pos->ProjectionX(
"_px",
i+1 ,
i+1);
801 negProjection = neg->ProjectionX(
"_px",
i+1 ,
i+1);
810 delete posProjection;
811 delete negProjection;
813 std::cout <<
"INFO::Finished makeSlicePlots()" << std::endl;
820 std::cout <<
"INFO::Starting makeRatioPlots()" << std::endl;
821 TCanvas
c1(
"C1",
"C1",600,600);
822 TPad *pad1 =
new TPad(
"pad1",
"pad1",0,0.5,1,1);
823 pad1->SetTopMargin(0.05/0.5);
824 pad1->SetRightMargin(0.05);
825 pad1->SetBottomMargin(0.16);
826 pad1->SetLeftMargin(0.16);
828 pad1->SetBottomMargin(0);
832 TH1D* h1clone = (TH1D*)
h1->Clone();
833 h1->SetMarkerColor(kBlue);
834 h1->SetMarkerStyle(20);
835 h1->GetYaxis()->SetRangeUser(0.85,1.45);
836 h1->GetYaxis()->SetLabelSize(0.05/0.5);
837 h1->GetYaxis()->SetTitleSize(0.05/0.5);
838 h1->GetYaxis()->SetTitle(
"<E/p>");
840 h2->SetMarkerColor(kRed);
841 h2->SetMarkerStyle(22);
844 TPad *pad2 =
new TPad(
"pad2",
"pad2",0,0,1,0.5);
845 pad2->SetTopMargin(0.05);
846 pad2->SetRightMargin(0.05);
847 pad2->SetBottomMargin(0.16/0.5);
848 pad2->SetLeftMargin(0.16);
854 h1clone->SetStats(0);
856 h1clone->SetMarkerColor(kBlack);
857 h1clone->SetMarkerStyle(20);
858 h1clone->GetYaxis()->SetLabelSize(0.05/0.5);
859 h1clone->GetXaxis()->SetLabelSize(0.05/0.5);
860 h1clone->GetYaxis()->SetTitleSize(0.05/0.5);
861 h1clone->GetXaxis()->SetTitleSize(0.05/0.5);
862 h1clone->GetYaxis()->SetRangeUser(0.8,1.2);
863 h1clone->GetYaxis()->SetTitle(
"<E/p>^{+}/<E/p>^{-}");
871 if(
name.Contains(
"Y",TString::kExact))
872 title +=
"Phi slice ";
874 title +=
"Eta slice ";
877 TLegend *leg1 =
new TLegend(0.75,0.82,0.9,0.92);
878 leg1->SetBorderSize(0);
879 leg1->SetFillColor(0);
880 leg1->AddEntry(
"",
title,
"");
881 leg1->AddEntry(
h1,
"Positive",
"p");
882 leg1->AddEntry(h2,
"Negative",
"p");
886 c1.Print(
PATH+
"new_eoverp_plots.pdf");
890 std::cout <<
"INFO::Finished makeRatioPlots()" << std::endl;
896 gROOT->LoadMacro(
"AtlasStyle.C");
903 TH2F *FinalCorrections =
new TH2F(
"FinalCorrections",
"FinalCorrections",16,-2.5,2.5,16,-3.14159,3.14159);
904 return FinalCorrections;
913 std::cout <<
"INFO :: GetCorrection -> Bin number ";
915 int binNumber = corrections->FindBin(
eta,
phi);
920 std::cout <<
"INFO :: GetCorrection -> delta" << std::endl;
921 double delta = corrections->GetBinContent(binNumber);
928 std::cout <<
"INFO :: In makeScalingHist()" << std::endl;
933 std::cout <<
"ERROR :: makeScalingHist(): No input directory specified!" << std::endl;
937 TFile *file0 = TFile::Open(
dir+
"fitEoverP.root");
939 TH2F* meanPlotNeg = (
TH2F*) file0->Get(
"meanPlotNeg");
940 TH2F* meanPlotPos = (
TH2F*) file0->Get(
"meanPlotPos");
943 if(!meanPlotNeg || !meanPlotNeg){
944 std::cout<<
"ERROR :: makeScalingHist(): inputfile does not contain the desired histograms " << std::endl;
948 meanPlotNeg->Draw(
"colz");
949 meanPlotPos->Draw(
"colz");
950 meanPlotNeg->Sumw2();
951 meanPlotPos->Sumw2();
957 TH2F* meanPtVsEta = (
TH2F*) file0->Get(
"meanPtVsEta");
959 std::cout <<
"ERROR :: makeScalingHist(): inputfile does not contain the meanPtVsEta histogram " << std::endl;
962 for(
int i=1;
i<=meanPtVsEta->GetNbinsX();
i++){
963 TH1D* projection = meanPtVsEta->ProjectionY(
"_py",
i ,
i);
964 pt[
i-1] = (projection->GetMean()*1000.);
970 a->Add(meanPlotNeg,-1);
973 for(
int i=1;
i <=
a->GetNbinsX();
i++){
974 for(
int j=1; j <=
a->GetNbinsY(); j++){
975 double temp =
a->GetBinContent(
i,j);
977 temp =
a->GetBinError(
i,j);
984 TFile
f(
dir+
"Scaling.root",
"RECREATE");
985 a->SetName(
"FinalCorrections");
986 a->SetTitle(
"FinalCorrections");