CMS 3D CMS Logo

CMSSW_4_4_3_patch1/src/MuonAnalysis/MomentumScaleCalibration/interface/MassWindow.h

Go to the documentation of this file.
00001 #ifndef MassWindow_h
00002 #define MassWindow_h
00003 
00004 #include "MuonAnalysis/MomentumScaleCalibration/interface/Functions.h"
00005 #include <vector>
00006 
00018 class MassWindow
00019 {
00020 public:
00021   MassWindow(const double & centralMass, const double & lowerBound, const double & upperBound,
00022              const std::vector<unsigned int> & indexes, backgroundFunctionBase * backgroundFunction) :
00023     centralMass_(centralMass), lowerBound_(lowerBound), upperBound_(upperBound), weightedEvents_(0.),
00024     indexes_(indexes), backgroundFunction_(backgroundFunction)
00025   {}
00026   // Used to count the number of events in the window
00027   void count(const double & mass, const double & weight = 1.)
00028   {
00029     if( mass > lowerBound_ && mass < upperBound_ ) {
00030       weightedEvents_ += weight;
00031     }
00032   }
00033   inline void resetCounter() { weightedEvents_ = 0; }
00034   inline bool isIn(const double & mass) { return( mass > lowerBound_ && mass < upperBound_ ); }
00035   inline double mass() const {return centralMass_;}
00036   inline double lowerBound() const {return lowerBound_;}
00037   inline double upperBound() const {return upperBound_;}
00038   inline double events() const {return weightedEvents_;}
00039   inline backgroundFunctionBase * backgroundFunction() const {return backgroundFunction_;}
00040   inline const std::vector<unsigned int> * indexes() const {return &indexes_;}
00041 protected:
00042   double centralMass_;
00043   double lowerBound_;
00044   double upperBound_;
00045   // Number of events in the window
00046   double weightedEvents_;
00047   // Indexes of the resonances in this window
00048   std::vector<unsigned int> indexes_;
00049   backgroundFunctionBase * backgroundFunction_;
00050 };
00051 
00052 #endif