Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-17 11:24:00

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   GenFilterInfo(const GenFilterInfo&);
0018   virtual ~GenFilterInfo();
0019 
0020   // getters
0021   unsigned int numEventsTried() const { return (numTotalPositiveEvents_ + numTotalNegativeEvents_); }
0022   unsigned int numEventsPassed() const { return fmax(0, (numPassPositiveEvents_ - numPassNegativeEvents_)); }
0023   unsigned int numEventsTotal() const { return fmax(0, (numTotalPositiveEvents_ - numTotalNegativeEvents_)); }
0024 
0025   unsigned int numPassPositiveEvents() const { return numPassPositiveEvents_; }
0026   unsigned int numTotalPositiveEvents() const { return numTotalPositiveEvents_; }
0027 
0028   unsigned int numPassNegativeEvents() const { return numPassNegativeEvents_; }
0029   unsigned int numTotalNegativeEvents() const { return numTotalNegativeEvents_; }
0030 
0031   double sumPassWeights() const { return sumPassWeights_; }
0032   double sumPassWeights2() const { return sumPassWeights2_; }
0033 
0034   double sumFailWeights() const { return sumTotalWeights_ - sumPassWeights_; }
0035   double sumFailWeights2() const { return sumTotalWeights2_ - sumPassWeights2_; }
0036 
0037   double sumWeights() const { return sumTotalWeights_; }
0038   double sumWeights2() const { return sumTotalWeights2_; }
0039 
0040   double filterEfficiency(int idwtup = +3) const;
0041   double filterEfficiencyError(int idwtup = +3) const;
0042   // merge method. It will be used when merging different jobs populating the same lumi section
0043   bool mergeProduct(GenFilterInfo const& other);
0044   void swap(GenFilterInfo& other);
0045 
0046 private:
0047   unsigned int numPassPositiveEvents_;
0048   unsigned int numPassNegativeEvents_;
0049   unsigned int numTotalPositiveEvents_;
0050   unsigned int numTotalNegativeEvents_;
0051 
0052   double sumPassWeights_;
0053   double sumPassWeights2_;
0054   double sumTotalWeights_;
0055   double sumTotalWeights2_;
0056 };
0057 
0058 #endif  // SimDataFormats_GeneratorProducts_GenFilterInfo_h