Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:28:50

0001 #ifndef SimDataFormats_GeneratorProducts_GenRunInfoProduct_h
0002 #define SimDataFormats_GeneratorProducts_GenRunInfoProduct_h
0003 
0004 /** \class GenRunInfoProduct
0005  *
0006  */
0007 
0008 class GenRunInfoProduct {
0009 public:
0010   // a few forward declarations
0011   struct XSec;
0012 
0013   // constructors, destructors
0014   GenRunInfoProduct();
0015   GenRunInfoProduct(const GenRunInfoProduct &other);
0016 
0017   // getters
0018 
0019   const XSec &internalXSec() const { return internalXSec_; }
0020   const XSec &externalXSecLO() const { return externalXSecLO_; }
0021   const XSec &externalXSecNLO() const { return externalXSecNLO_; }
0022   double filterEfficiency() const { return externalFilterEfficiency_; }
0023 
0024   // setters
0025 
0026   void setInternalXSec(const XSec &xsec) { internalXSec_ = xsec; }
0027   void setExternalXSecLO(const XSec &xsec) { externalXSecLO_ = xsec; }
0028   void setExternalXSecNLO(const XSec &xsec) { externalXSecNLO_ = xsec; }
0029   void setFilterEfficiency(double effic) { externalFilterEfficiency_ = effic; }
0030 
0031   // struct definitions
0032   struct XSec {
0033   public:
0034     XSec() : value_(-1.), error_(-1.) {}
0035     XSec(double value, double error = -1.) : value_(value), error_(error) {}
0036     XSec(const XSec &other) : value_(other.value_), error_(other.error_) {}
0037 
0038     double value() const { return value_; }
0039     double error() const { return error_; }
0040 
0041     bool isSet() const { return value_ >= 0.; }
0042     bool hasError() const { return error_ >= 0.; }
0043 
0044     operator double() const { return value_; }
0045     operator bool() const { return isSet(); }
0046 
0047     bool operator==(const XSec &other) const { return value_ == other.value_ && error_ == other.error_; }
0048     bool operator!=(const XSec &other) const { return !(*this == other); }
0049 
0050   private:
0051     double value_, error_;
0052   };
0053 
0054   // convenience (return the value, prefer externally specified over internal one)
0055   double crossSection() const { return externalXSecLO_ ? externalXSecLO_.value() : internalXSec_.value(); }
0056 
0057   // methods used by EDM
0058   bool isProductEqual(const GenRunInfoProduct &other) const;
0059 
0060 private:
0061   // cross sections
0062   XSec internalXSec_;                      // the one computed during cmsRun
0063   XSec externalXSecLO_, externalXSecNLO_;  // from config file
0064   double externalFilterEfficiency_;        // from config file
0065 };
0066 
0067 #endif  // SimDataFormats_GeneratorProducts_GenRunInfoProduct_h