Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:22:37

0001 #ifndef MassWindow_h
0002 #define MassWindow_h
0003 
0004 #include "MuonAnalysis/MomentumScaleCalibration/interface/Functions.h"
0005 #include <vector>
0006 
0007 /**
0008  * Holds the information relative to a mass window: <br>
0009  * - central mass value <br>
0010  * - lower and upper bound <br>
0011  * - indexes of the resonances in the window <br>
0012  * - pointer to the background function <br>
0013  * It is used for both resonance and background windows. It stores the number of events
0014  * in the window that are counted with the "count" method. It is a double because the events
0015  * can be weighted.
0016  */
0017 
0018 class MassWindow {
0019 public:
0020   MassWindow(const double& centralMass,
0021              const double& lowerBound,
0022              const double& upperBound,
0023              const std::vector<unsigned int>& indexes,
0024              backgroundFunctionBase* backgroundFunction)
0025       : centralMass_(centralMass),
0026         lowerBound_(lowerBound),
0027         upperBound_(upperBound),
0028         weightedEvents_(0.),
0029         indexes_(indexes),
0030         backgroundFunction_(backgroundFunction) {}
0031   // Used to count the number of events in the window
0032   void count(const double& mass, const double& weight = 1.) {
0033     if (mass > lowerBound_ && mass < upperBound_) {
0034       weightedEvents_ += weight;
0035     }
0036   }
0037   inline void resetCounter() { weightedEvents_ = 0; }
0038   inline bool isIn(const double& mass) { return (mass > lowerBound_ && mass < upperBound_); }
0039   inline double mass() const { return centralMass_; }
0040   inline double lowerBound() const { return lowerBound_; }
0041   inline double upperBound() const { return upperBound_; }
0042   inline double events() const { return weightedEvents_; }
0043   inline backgroundFunctionBase* backgroundFunction() const { return backgroundFunction_; }
0044   inline const std::vector<unsigned int>* indexes() const { return &indexes_; }
0045 
0046 protected:
0047   double centralMass_;
0048   double lowerBound_;
0049   double upperBound_;
0050   // Number of events in the window
0051   double weightedEvents_;
0052   // Indexes of the resonances in this window
0053   std::vector<unsigned int> indexes_;
0054   backgroundFunctionBase* backgroundFunction_;
0055 };
0056 
0057 #endif