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/MassWindow.h"
00008 #include "DataFormats/HepMCCandidate/interface/GenParticle.h"
00009 #include "SimDataFormats/Track/interface/SimTrack.h"
00010 #include "DataFormats/Candidate/interface/LeafCandidate.h"
00011 #include "DataFormats/Math/interface/LorentzVector.h"
00012 #include <CLHEP/Vector/LorentzVector.h>
00013 #include "DataFormats/MuonReco/interface/Muon.h"
00014 #include "DataFormats/MuonReco/interface/MuonFwd.h"
00015 #include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h"
00016 #include "DataFormats/HepMCCandidate/interface/GenParticleFwd.h"
00017 #include "SimDataFormats/Track/interface/SimTrackContainer.h"
00018 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00019
00029 class BackgroundHandler
00030 {
00031 public:
00032 BackgroundHandler( const std::vector<int> & identifiers,
00033 const std::vector<double> & leftWindowBorders,
00034 const std::vector<double> & rightWindowBorders,
00035 const double * ResMass,
00036 const double * massWindowHalfWidth );
00037 ~BackgroundHandler();
00038
00040 void initializeParNums();
00041
00043 inline int regionsParNum()
00044 {
00045 return parNumsResonances_[0];
00046 }
00047
00049 bool checkBackgroundWindow(const double & mass, const int iRegion)
00050 {
00051 return backgroundWindow_[iRegion].isIn(mass);
00052 }
00053
00054 void countEventsInAllWindows(const std::vector<std::pair<reco::Particle::LorentzVector,reco::Particle::LorentzVector> > & muonPairs,
00055 const double & weight);
00056
00058 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);
00059
00061 bool unlockParameter(const std::vector<int> & resfind, const unsigned int ipar);
00062
00064 std::pair<double, double> windowBorders( const bool doBackgroundFit, const int ires );
00065
00071 double resMass( const bool doBackgroundFit, const int ires );
00072
00079 void rescale( std::vector<double> & parBgr, const double * ResMass, const double * massWindowHalfWidth,
00080 const std::vector<std::pair<reco::Particle::LorentzVector,reco::Particle::LorentzVector> > & muonPairs,
00081 const double & weight = 1. );
00082
00088 std::pair<double, double> backgroundFunction( const bool doBackgroundFit,
00089 const double * parval, const int resTotNum, const int ires,
00090 const bool * resConsidered, const double * ResMass, const double ResHalfWidth[],
00091
00092 const int MuonType, const double & mass, const double & eta1, const double & eta2 );
00093 private:
00095 void consistencyCheck( const std::vector<int> & identifiers,
00096 const std::vector<double> & leftWindowBorders,
00097 const std::vector<double> & rightWindowBorders ) const throw(cms::Exception);
00098
00099
00100
00101
00102 int regToResHW_[3];
00103
00104
00105
00106
00107
00108 int resToReg_[6];
00109
00110
00111
00112
00113
00114
00115 int parNumsRegions_[3];
00116
00117
00118 int parNumsResonances_[6];
00119
00120
00121
00122
00123 std::vector<MassWindow> resonanceWindow_;
00124 std::vector<MassWindow> backgroundWindow_;
00125 };
00126
00127 #endif // BackgroundHandler_h