Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:29:41

0001 #ifndef SimDataFormats_GeneratorProducts_GenFilterInfo_h
0002 #define SimDataFormats_GeneratorProducts_GenFilterInfo_h
0003 
0004 /** \class GenFilterInfo
0005  *
0006  */
0007 
0008 #include <cmath>
0009 #include <iostream>
0010 
0011 class GenFilterInfo {
0012 public:
0013   // constructors, destructors
0014   GenFilterInfo();
0015   GenFilterInfo(unsigned int, unsigned int);  // obsolete, should be avoided for new classes
0016   GenFilterInfo(unsigned int, unsigned int, unsigned int, unsigned int, double, double, double, double);
0017   virtual ~GenFilterInfo();
0018 
0019   // getters
0020   unsigned int numEventsTried() const { return (numTotalPositiveEvents_ + numTotalNegativeEvents_); }
0021   unsigned int numEventsPassed() const { return fmax(0, (numPassPositiveEvents_ - numPassNegativeEvents_)); }
0022   unsigned int numEventsTotal() const { return fmax(0, (numTotalPositiveEvents_ - numTotalNegativeEvents_)); }
0023 
0024   unsigned int numPassPositiveEvents() const { return numPassPositiveEvents_; }
0025   unsigned int numTotalPositiveEvents() const { return numTotalPositiveEvents_; }
0026 
0027   unsigned int numPassNegativeEvents() const { return numPassNegativeEvents_; }
0028   unsigned int numTotalNegativeEvents() const { return numTotalNegativeEvents_; }
0029 
0030   double sumPassWeights() const { return sumPassWeights_; }
0031   double sumPassWeights2() const { return sumPassWeights2_; }
0032 
0033   double sumFailWeights() const { return sumTotalWeights_ - sumPassWeights_; }
0034   double sumFailWeights2() const { return sumTotalWeights2_ - sumPassWeights2_; }
0035 
0036   double sumWeights() const { return sumTotalWeights_; }
0037   double sumWeights2() const { return sumTotalWeights2_; }
0038 
0039   double filterEfficiency(int idwtup = +3) const;
0040   double filterEfficiencyError(int idwtup = +3) const;
0041   // merge method. It will be used when merging different jobs populating the same lumi section
0042   bool mergeProduct(GenFilterInfo const& other);
0043   void swap(GenFilterInfo& other);
0044 
0045 private:
0046   unsigned int numPassPositiveEvents_;
0047   unsigned int numPassNegativeEvents_;
0048   unsigned int numTotalPositiveEvents_;
0049   unsigned int numTotalNegativeEvents_;
0050 
0051   double sumPassWeights_;
0052   double sumPassWeights2_;
0053   double sumTotalWeights_;
0054   double sumTotalWeights2_;
0055 };
0056 
0057 #endif  // SimDataFormats_GeneratorProducts_GenFilterInfo_h