CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_0/src/SimDataFormats/GeneratorProducts/interface/GenRunInfoProduct.h

Go to the documentation of this file.
00001 #ifndef SimDataFormats_GeneratorProducts_GenRunInfoProduct_h
00002 #define SimDataFormats_GeneratorProducts_GenRunInfoProduct_h
00003 
00008 class GenRunInfoProduct {
00009     public:
00010         // a few forward declarations
00011         struct XSec;
00012 
00013         // constructors, destructors
00014         GenRunInfoProduct();
00015         GenRunInfoProduct(const GenRunInfoProduct &other);
00016         virtual ~GenRunInfoProduct();
00017 
00018         // getters
00019 
00020         const XSec &internalXSec() const { return internalXSec_; }
00021         const XSec &externalXSecLO() const { return externalXSecLO_; }
00022         const XSec &externalXSecNLO() const { return externalXSecNLO_; }
00023         double filterEfficiency() const { return externalFilterEfficiency_; }
00024 
00025         // setters
00026 
00027         void setInternalXSec(const XSec &xsec) { internalXSec_ = xsec; }
00028         void setExternalXSecLO(const XSec &xsec) { externalXSecLO_ = xsec; }
00029         void setExternalXSecNLO(const XSec &xsec) { externalXSecNLO_ = xsec; }
00030         void setFilterEfficiency(double effic) { externalFilterEfficiency_ = effic; }
00031 
00032         // struct definitions
00033         struct XSec {
00034             public:
00035                 XSec() : value_(-1.), error_(-1.) {}
00036                 XSec(double value, double error = -1.) :
00037                         value_(value), error_(error) {}
00038                 XSec(const XSec &other) :
00039                         value_(other.value_), error_(other.error_) {}
00040 
00041                 double value() const { return value_; }
00042                 double error() const { return error_; }
00043 
00044                 bool isSet() const { return value_ >= 0.; }
00045                 bool hasError() const { return error_ >= 0.; }
00046 
00047                 operator double() const { return value_; }
00048                 operator bool() const { return isSet(); }
00049 
00050                 bool operator == (const XSec &other) const
00051                 { return value_ == other.value_ && error_ == other.error_; }
00052                 bool operator != (const XSec &other) const { return !(*this == other); }
00053 
00054             private:
00055                 double value_, error_;
00056         };
00057 
00058         // convenience (return the value, prefer externally specified over internal one)
00059         double crossSection() const
00060         { return externalXSecLO_ ? externalXSecLO_.value() : internalXSec_.value(); }
00061 
00062         // methods used by EDM
00063         virtual bool mergeProduct(const GenRunInfoProduct &other);
00064         virtual bool isProductEqual(const GenRunInfoProduct &other) const;
00065 
00066     private:
00067         // cross sections
00068         XSec    internalXSec_;  // the one computed during cmsRun
00069         XSec    externalXSecLO_, externalXSecNLO_;      // from config file
00070         double  externalFilterEfficiency_;              // from config file
00071 };
00072 
00073 #endif // SimDataFormats_GeneratorProducts_GenRunInfoProduct_h