Go to the documentation of this file.00001 #ifndef MUSCLEFITBASE_H
00002 #define MUSCLEFITBASE_H
00003
00008 #include <map>
00009 #include <string>
00010 #include "TFile.h"
00011 #include "Histograms.h"
00012 #include "MuScleFitUtils.h"
00013 #include "FWCore/Utilities/interface/InputTag.h"
00014 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00015 #include "MuonAnalysis/MomentumScaleCalibration/interface/MuonPair.h"
00016 #include "MuonAnalysis/MomentumScaleCalibration/interface/GenMuonPair.h"
00017
00018 class MuScleFitBase
00019 {
00020 public:
00021 MuScleFitBase(const edm::ParameterSet& iConfig) :
00022 probabilitiesFileInPath_( iConfig.getUntrackedParameter<std::string>( "ProbabilitiesFileInPath" , "MuonAnalysis/MomentumScaleCalibration/test/Probs_new_Horace_CTEQ_1000.root" ) ),
00023 probabilitiesFile_( iConfig.getUntrackedParameter<std::string>( "ProbabilitiesFile" , "" ) ),
00024 theMuonType_( iConfig.getParameter<int>( "MuonType" ) ),
00025 theMuonLabel_( iConfig.getParameter<edm::InputTag>( "MuonLabel" ) ),
00026 theRootFileName_( iConfig.getUntrackedParameter<std::string>("OutputFileName") ),
00027 theGenInfoRootFileName_( iConfig.getUntrackedParameter<std::string>("OutputGenInfoFileName", "genSimRecoPlots.root") ),
00028 debug_( iConfig.getUntrackedParameter<int>("debug",0) )
00029 {}
00030 virtual ~MuScleFitBase() {}
00031 protected:
00033 void fillHistoMap(TFile* outputFile, unsigned int iLoop);
00035 void clearHistoMap();
00037 void writeHistoMap( const unsigned int iLoop );
00038
00040 void readProbabilityDistributionsFromFile();
00041
00042 std::string probabilitiesFileInPath_;
00043 std::string probabilitiesFile_;
00044
00045 int theMuonType_;
00046 edm::InputTag theMuonLabel_;
00047 std::string theRootFileName_;
00048 std::string theGenInfoRootFileName_;
00049
00050 int debug_;
00051
00053 class ProbForIntegral
00054 {
00055 public:
00056 ProbForIntegral( const double & massResol, const int iRes, const int iY, const bool isZ ) :
00057 massResol_(massResol),
00058 iRes_(iRes), iY_(iY), isZ_(isZ)
00059 {}
00060 double operator()(const double * mass, const double *)
00061 {
00062 if( isZ_ ) {
00063 return( MuScleFitUtils::probability(*mass, massResol_, MuScleFitUtils::GLZValue, MuScleFitUtils::GLZNorm, iRes_, iY_) );
00064 }
00065 return( MuScleFitUtils::probability(*mass, massResol_, MuScleFitUtils::GLValue, MuScleFitUtils::GLNorm, iRes_, iY_) );
00066 }
00067 protected:
00068 double massResol_;
00069 int iRes_, iY_;
00070 bool isZ_;
00071 };
00072
00074 std::vector<TFile*> theFiles_;
00075
00077 std::map<std::string, Histograms*> mapHisto_;
00078
00080 std::vector<MuonPair> muonPairs_;
00082 std::vector<GenMuonPair> genMuonPairs_;
00083 };
00084
00085 #endif