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
0009
0010
0011
0012
0013
0014
0015
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
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
0051 double weightedEvents_;
0052
0053 std::vector<unsigned int> indexes_;
0054 backgroundFunctionBase* backgroundFunction_;
0055 };
0056
0057 #endif