File indexing completed on 2024-04-06 12:22:42
0001 #ifndef FitResolSlices_cc
0002 #define FitResolSlices_cc
0003
0004 #include "FitSlices.cc"
0005 #include "TFile.h"
0006 #include "TH1F.h"
0007 #include "TROOT.h"
0008
0009
0010
0011
0012
0013 class FitResolSlices : public FitSlices
0014 {
0015 public:
0016 void fit(const TString & inputFileName = "0_MuScleFit.root", const TString & outputFileName = "ResolCheck_0.root",
0017 const TString & signalType = "gaussian",
0018 const double & xMean = 0., const double & xMin = -1., const double & xMax = 1.,
0019 const double & sigma = 0.03, const double & sigmaMin = 0., const double & sigmaMax = 0.1,
0020 const TString & histoBaseName = "hResolPtGenVSMu_ResoVS", const TString & histoBaseTitle = "ResolPtVs",
0021 TFile * externalOutputFile = 0)
0022 {
0023 gROOT->SetBatch(kTRUE);
0024
0025 TFile * inputFile = new TFile(inputFileName, "READ");
0026
0027 TFile * outputFile = externalOutputFile;
0028 if( outputFile == 0 ) {
0029 outputFile = new TFile(outputFileName, "RECREATE");
0030 }
0031 outputFile->mkdir(histoBaseName);
0032 outputFile->cd(histoBaseName);
0033 TDirectory * dir = (TDirectory*)outputFile->Get(histoBaseName);
0034
0035 fitSlice(histoBaseName+"Pt", histoBaseTitle+"Pt",
0036 xMean, xMin, xMax, sigma, sigmaMin, sigmaMax,
0037 signalType, "",
0038 inputFile, dir);
0039
0040 fitSlice(histoBaseName+"Eta", histoBaseTitle+"Eta",
0041 xMean, xMin, xMax, sigma, sigmaMin, sigmaMax,
0042 signalType, "",
0043 inputFile, dir);
0044
0045 if( externalOutputFile == 0 ) {
0046 outputFile->Write();
0047 outputFile->Close();
0048 }
0049 }
0050 };
0051
0052 #endif