Go to the documentation of this file.00001 #ifndef BackgroundHandler_h
00002 #define BackgroundHandler_h
00003
00004 #include "MuonAnalysis/MomentumScaleCalibration/interface/Functions.h"
00005 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00006 #include <vector>
00007 #include "MuonAnalysis/MomentumScaleCalibration/interface/MuScleFitUtils.h"
00008 #include "MuonAnalysis/MomentumScaleCalibration/interface/MassWindow.h"
00009
00019 class BackgroundHandler
00020 {
00021 public:
00022 BackgroundHandler( const std::vector<int> & identifiers,
00023 const std::vector<double> & leftWindowBorders,
00024 const std::vector<double> & rightWindowBorders,
00025 const double * ResMass,
00026 const double * massWindowHalfWidth );
00027 ~BackgroundHandler();
00028
00030 void initializeParNums();
00031
00033 inline int regionsParNum()
00034 {
00035 return parNumsResonances_[0];
00036 }
00037
00039 bool checkBackgroundWindow(const double & mass, const int iRegion)
00040 {
00041 return backgroundWindow_[iRegion].isIn(mass);
00042 }
00043
00044 void countEventsInAllWindows(const std::vector<std::pair<reco::Particle::LorentzVector,reco::Particle::LorentzVector> > & muonPairs,
00045 const double & weight);
00046
00048 void setParameters(double* Start, double* Step, double* Mini, double* Maxi, int* ind, TString* parname, const std::vector<double> & parBgr, const std::vector<int> & parBgrOrder, const int muonType);
00049
00051 bool unlockParameter(const std::vector<int> & resfind, const unsigned int ipar);
00052
00054 std::pair<double, double> windowBorders( const bool doBackgroundFit, const int ires );
00055
00061 double resMass( const bool doBackgroundFit, const int ires );
00062
00069 void rescale( std::vector<double> & parBgr, const double * ResMass, const double * massWindowHalfWidth,
00070 const std::vector<std::pair<reco::Particle::LorentzVector,reco::Particle::LorentzVector> > & muonPairs,
00071 const double & weight = 1. );
00072
00078 std::pair<double, double> backgroundFunction( const bool doBackgroundFit,
00079 const double * parval, const int resTotNum, const int ires,
00080 const bool * resConsidered, const double * ResMass, const double ResHalfWidth[],
00081 const int MuonType, const double & mass, const double & resEta );
00082 private:
00084 void consistencyCheck( const std::vector<int> & identifiers,
00085 const std::vector<double> & leftWindowBorders,
00086 const std::vector<double> & rightWindowBorders ) const throw(cms::Exception);
00087
00088
00089
00090
00091 int regToResHW_[3];
00092
00093
00094
00095
00096
00097 int resToReg_[6];
00098
00099
00100
00101
00102
00103
00104 int parNumsRegions_[3];
00105
00106
00107 int parNumsResonances_[6];
00108
00109
00110
00111
00112 std::vector<MassWindow> resonanceWindow_;
00113 std::vector<MassWindow> backgroundWindow_;
00114 };
00115
00116 #endif // BackgroundHandler_h