Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:31:37

0001 #include "/home/destroyar/Desktop/MuScleFit/RooFitTest/Macros/FitXslices.cc"
0002 #include "TFile.h"
0003 #include "TH1F.h"
0004 #include "TROOT.h"
0005 
0006 /**
0007  * Edit the input and output files and eventually the rebins. <br>
0008  * To run this macro: root -l testSlices.cpp+
0009  */
0010 
0011 void testSlices(const TString & inputFileName = "3_MuScleFit.root", const TString & outputFileName = "BiasCheck_3.root")
0012 {
0013   gROOT->SetBatch(kTRUE);
0014 
0015   TFile * inputFile = new TFile(inputFileName, "READ");
0016 
0017   TFile * outputFile = new TFile(outputFileName, "RECREATE");
0018 
0019   FitXslices fitXslices;
0020 
0021   // Mass vs Pt
0022   TH2F * histoPt = (TH2F*)inputFile->Get("hRecBestResVSMu_MassVSPt");
0023   histoPt->RebinX(4);
0024   histoPt->RebinY(2);
0025   fitXslices.fitter()->initMean(3.1, 2.9, 3.3);
0026   outputFile->mkdir("MassVsPt");
0027   outputFile->cd("MassVsPt");
0028   // fitXslices(histoPt, 3., 3.2, "doubleGaussian", "exponential");
0029   fitXslices(histoPt, 3., 3.2, "gaussian", "exponential");
0030   // fitXslices(histoPt, 2.5, 3.7);
0031   // Mass vs Eta
0032   TH2F * histoEta = (TH2F*)inputFile->Get("hRecBestResVSMu_MassVSEta");
0033   histoEta->RebinX(1);
0034   histoEta->RebinY(1);
0035   outputFile->mkdir("MassVsEta");
0036   outputFile->cd("MassVsEta");
0037   // fitXslices(histoEta, 3., 3.2, "gaussian", "");
0038   fitXslices(histoEta, 3., 3.2, "doubleGaussian", "exponential");
0039   // Mass vs PhiPlus
0040   TH2F * histoPhiPlus = (TH2F*)inputFile->Get("hRecBestResVSMu_MassVSPhiPlus");
0041   histoPhiPlus->RebinX(2);
0042   histoPhiPlus->RebinY(2);
0043   outputFile->mkdir("MassVsPhiPlus");
0044   outputFile->cd("MassVsPhiPlus");
0045   fitXslices(histoPhiPlus, 3., 3.2, "gaussian", "exponential");
0046   // Mass vs PhiMinus
0047   TH2F * histoPhiMinus = (TH2F*)inputFile->Get("hRecBestResVSMu_MassVSPhiMinus");
0048   histoPhiMinus->RebinX(2);
0049   histoPhiMinus->RebinY(2);
0050   outputFile->mkdir("MassVsPhiMinus");
0051   outputFile->cd("MassVsPhiMinus");
0052   fitXslices(histoPhiMinus, 3., 3.2, "gaussian", "exponential");
0053 
0054   outputFile->Write();
0055   outputFile->Close();
0056 }