Back to home page

Project CMSSW displayed by LXR

 
 

    


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

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 
0016   // getters
0017 
0018   const XSec &internalXSec() const { return internalXSec_; }
0019   const XSec &externalXSecLO() const { return externalXSecLO_; }
0020   const XSec &externalXSecNLO() const { return externalXSecNLO_; }
0021   double filterEfficiency() const { return externalFilterEfficiency_; }
0022 
0023   // setters
0024 
0025   void setInternalXSec(const XSec &xsec) { internalXSec_ = xsec; }
0026   void setExternalXSecLO(const XSec &xsec) { externalXSecLO_ = xsec; }
0027   void setExternalXSecNLO(const XSec &xsec) { externalXSecNLO_ = xsec; }
0028   void setFilterEfficiency(double effic) { externalFilterEfficiency_ = effic; }
0029 
0030   // struct definitions
0031   struct XSec {
0032   public:
0033     XSec() : value_(-1.), error_(-1.) {}
0034     XSec(double value, double error = -1.) : value_(value), error_(error) {}
0035 
0036     double value() const { return value_; }
0037     double error() const { return error_; }
0038 
0039     bool isSet() const { return value_ >= 0.; }
0040     bool hasError() const { return error_ >= 0.; }
0041 
0042     operator double() const { return value_; }
0043     operator bool() const { return isSet(); }
0044 
0045     bool operator==(const XSec &other) const { return value_ == other.value_ && error_ == other.error_; }
0046     bool operator!=(const XSec &other) const { return !(*this == other); }
0047 
0048   private:
0049     double value_, error_;
0050   };
0051 
0052   // convenience (return the value, prefer externally specified over internal one)
0053   double crossSection() const { return externalXSecLO_ ? externalXSecLO_.value() : internalXSec_.value(); }
0054 
0055   // methods used by EDM
0056   bool isProductEqual(const GenRunInfoProduct &other) const;
0057 
0058 private:
0059   // cross sections
0060   XSec internalXSec_;                      // the one computed during cmsRun
0061   XSec externalXSecLO_, externalXSecNLO_;  // from config file
0062   double externalFilterEfficiency_;        // from config file
0063 };
0064 
0065 #endif  // SimDataFormats_GeneratorProducts_GenRunInfoProduct_h