CMS 3D CMS Logo

LHERunInfo.h
Go to the documentation of this file.
1 #ifndef GeneratorInterface_LHEInterface_LHERunInfo_h
2 #define GeneratorInterface_LHEInterface_LHERunInfo_h
3 
4 #include <iostream>
5 #include <memory>
6 #include <vector>
7 #include <string>
8 
10 
13 
14 #ifndef XERCES_CPP_NAMESPACE_QUALIFIER
15 #define UNDEF_XERCES_CPP_NAMESPACE_QUALIFIER
16 #define XERCES_CPP_NAMESPACE_QUALIFIER dummy::
17 namespace dummy {
18  class DOMNode;
19  class DOMDocument;
20 } // namespace dummy
21 #endif
22 
23 namespace lhef {
24 
25  class LHERunInfo {
26  public:
27  LHERunInfo(std::istream &in);
28  LHERunInfo(const HEPRUP &heprup);
29  LHERunInfo(const HEPRUP &heprup,
30  const std::vector<LHERunInfoProduct::Header> &headers,
31  const std::vector<std::string> &comments);
32  LHERunInfo(const LHERunInfoProduct &product);
33  ~LHERunInfo();
34 
36  public:
37  Header();
38  Header(const std::string &tag);
39  Header(const Header &orig);
40  Header(const LHERunInfoProduct::Header &orig);
41  ~Header();
42 
43 #ifndef UNDEF_XERCES_CPP_NAMESPACE_QUALIFIER
44  const XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *getXMLNode() const;
45 #endif
46 
47  private:
48  mutable XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *xmlDoc;
49  };
50 
51  const HEPRUP *getHEPRUP() const { return &heprup; }
52 
53  bool operator==(const LHERunInfo &other) const;
54  inline bool operator!=(const LHERunInfo &other) const { return !(*this == other); }
55 
56  const std::vector<Header> &getHeaders() const { return headers; }
57  const std::vector<std::string> &getComments() const { return comments; }
58 
59  std::vector<std::string> findHeader(const std::string &tag) const;
60 
61  void addHeader(const Header &header) { headers.push_back(header); }
62  void addComment(const std::string &line) { comments.push_back(line); }
63 
65 
66  struct XSec {
67  public:
68  XSec() : value_(0.0), error_(0.0) {}
69  XSec(double v, double e) : value_(v), error_(e) {}
70  double value() { return value_; }
71  double error() { return error_; }
72 
73  private:
74  double value_;
75  double error_;
76  };
77 
78  void count(int process, CountMode count, double eventWeight = 1.0, double brWeight = 1.0, double matchWeight = 1.0);
79  XSec xsec() const;
80  void statistics() const;
81 
82  std::pair<int, int> pdfSetTranslation() const;
83 
84  struct Counter {
85  public:
86  Counter() : n_(0), sum_(0.0), sum2_(0.0) {}
87  Counter(unsigned int n1, double sum1, double sum21) : n_(n1), sum_(sum1), sum2_(sum21) {}
88  inline void add(double weight) {
89  n_++;
90  sum_ += weight;
91  sum2_ += weight * weight;
92  }
93  unsigned int n() const { return n_; }
94  double sum() const { return sum_; }
95  double sum2() const { return sum2_; }
96 
97  private:
98  unsigned int n_;
99  double sum_;
100  double sum2_;
101  };
102 
103  struct Process {
104  public:
107  // accessors
108  int process() const { return process_; }
109  unsigned int heprupIndex() const { return heprupIndex_; }
110  XSec getLHEXSec() const { return lheXSec_; }
111 
112  unsigned int nPassPos() const { return nPassPos_; }
113  unsigned int nPassNeg() const { return nPassNeg_; }
114  unsigned int nTotalPos() const { return nTotalPos_; }
115  unsigned int nTotalNeg() const { return nTotalNeg_; }
116 
117  Counter tried() const { return tried_; }
118  Counter selected() const { return selected_; }
119  Counter killed() const { return killed_; }
120  Counter accepted() const { return accepted_; }
121  Counter acceptedBr() const { return acceptedBr_; }
122 
123  // setters
124  void setProcess(int id) { process_ = id; }
125  void setHepRupIndex(int id) { heprupIndex_ = id; }
126  void setLHEXSec(double value, double error) { lheXSec_ = XSec(value, error); }
127 
128  void addNPassPos(unsigned int n = 1) { nPassPos_ += n; }
129  void addNPassNeg(unsigned int n = 1) { nPassNeg_ += n; }
130  void addNTotalPos(unsigned int n = 1) { nTotalPos_ += n; }
131  void addNTotalNeg(unsigned int n = 1) { nTotalNeg_ += n; }
132 
133  void addTried(double w) { tried_.add(w); }
134  void addSelected(double w) { selected_.add(w); }
135  void addKilled(double w) { killed_.add(w); }
136  void addAccepted(double w) { accepted_.add(w); }
137  void addAcceptedBr(double w) { acceptedBr_.add(w); }
138 
139  private:
140  int process_;
142  unsigned int heprupIndex_;
143  unsigned int nPassPos_;
144  unsigned int nPassNeg_;
145  unsigned int nTotalPos_;
146  unsigned int nTotalNeg_;
152  };
153 
154  private:
155  void init();
156 
158  std::vector<Process> processes;
159  std::vector<Header> headers;
160  std::vector<std::string> comments;
161 
162  public:
163  const std::vector<Process> &getLumiProcesses() const { return processesLumi; }
164  const int getHEPIDWTUP() const { return heprup.IDWTUP; }
165  void initLumi();
166 
167  private:
168  std::vector<Process> processesLumi;
169  };
170 
171 } // namespace lhef
172 
173 #ifdef UNDEF_XERCES_CPP_NAMESPACE_QUALIFIER
174 #undef XERCES_CPP_NAMESPACE_QUALIFIER
175 #endif
176 
177 #endif // GeneratorRunInfo_LHEInterface_LHERunInfo_h
lhef::LHERunInfo::addComment
void addComment(const std::string &line)
Definition: LHERunInfo.h:62
lhef::LHERunInfo::kAccepted
Definition: LHERunInfo.h:64
lhef::LHERunInfo::Process::tried_
Counter tried_
Definition: LHERunInfo.h:147
lhef::LHERunInfo::Process::addAccepted
void addAccepted(double w)
Definition: LHERunInfo.h:136
lhef::LHERunInfo::Process::nPassPos_
unsigned int nPassPos_
Definition: LHERunInfo.h:143
lhef::LHERunInfo::Process::nTotalPos_
unsigned int nTotalPos_
Definition: LHERunInfo.h:145
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
lhef::LHERunInfo::Counter::sum_
double sum_
Definition: LHERunInfo.h:99
LHERunInfoProduct::Header
Definition: LHERunInfoProduct.h:16
lhef::LHERunInfo::Process::accepted
Counter accepted() const
Definition: LHERunInfo.h:120
lhef::LHERunInfo::XSec
Definition: LHERunInfo.h:66
lhef::LHERunInfo::Counter::Counter
Counter()
Definition: LHERunInfo.h:86
lhef::LHERunInfo::Counter::add
void add(double weight)
Definition: LHERunInfo.h:88
lhef::LHERunInfo::Header::xmlDoc
dummy::DOMDocument * xmlDoc
Definition: LHERunInfo.h:48
lhef::LHERunInfo::Process::addKilled
void addKilled(double w)
Definition: LHERunInfo.h:135
lhef::LHERunInfo::getLumiProcesses
const std::vector< Process > & getLumiProcesses() const
Definition: LHERunInfo.h:163
lhef::LHERunInfo::Counter::Counter
Counter(unsigned int n1, double sum1, double sum21)
Definition: LHERunInfo.h:87
lhef::LHERunInfo::Process::tried
Counter tried() const
Definition: LHERunInfo.h:117
mps_merge.weight
weight
Definition: mps_merge.py:88
lhef::LHERunInfo::XSec::XSec
XSec()
Definition: LHERunInfo.h:68
XERCES_CPP_NAMESPACE_QUALIFIER
#define XERCES_CPP_NAMESPACE_QUALIFIER
Definition: LHERunInfo.h:16
lhef::LHERunInfo::processesLumi
std::vector< Process > processesLumi
Definition: LHERunInfo.h:168
lhef::LHERunInfo::headers
std::vector< Header > headers
Definition: LHERunInfo.h:159
lhef::LHERunInfo::processes
std::vector< Process > processes
Definition: LHERunInfo.h:158
lhef::LHERunInfo::Process::nPassNeg_
unsigned int nPassNeg_
Definition: LHERunInfo.h:144
lhef::LHERunInfo::Counter
Definition: LHERunInfo.h:84
lhef::LHERunInfo::Process::setHepRupIndex
void setHepRupIndex(int id)
Definition: LHERunInfo.h:125
findQualityFiles.v
v
Definition: findQualityFiles.py:179
lhef::LHERunInfo::Process::addTried
void addTried(double w)
Definition: LHERunInfo.h:133
relativeConstraints.error
error
Definition: relativeConstraints.py:53
lhef::LHERunInfo::Process::addNPassNeg
void addNPassNeg(unsigned int n=1)
Definition: LHERunInfo.h:129
lhef::LHERunInfo::operator==
bool operator==(const LHERunInfo &other) const
Definition: LHERunInfo.cc:117
lhef::LHERunInfo::getHEPIDWTUP
const int getHEPIDWTUP() const
Definition: LHERunInfo.h:164
lhef::LHERunInfo::XSec::XSec
XSec(double v, double e)
Definition: LHERunInfo.h:69
lhef::LHERunInfo::getComments
const std::vector< std::string > & getComments() const
Definition: LHERunInfo.h:57
lhef::LHERunInfo::Process::acceptedBr_
Counter acceptedBr_
Definition: LHERunInfo.h:151
lhef::LHERunInfo::kSelected
Definition: LHERunInfo.h:64
lhef::LHERunInfo::Process::addSelected
void addSelected(double w)
Definition: LHERunInfo.h:134
lhef::LHERunInfo::Process::nPassNeg
unsigned int nPassNeg() const
Definition: LHERunInfo.h:113
LHERunInfoProduct.h
LHERunInfoProduct
Definition: LHERunInfoProduct.h:13
lhef::LHERunInfo::getHeaders
const std::vector< Header > & getHeaders() const
Definition: LHERunInfo.h:56
lhef::LHERunInfo::Process::nTotalPos
unsigned int nTotalPos() const
Definition: LHERunInfo.h:114
GlobalPosition_Frontier_DevDB_cff.tag
tag
Definition: GlobalPosition_Frontier_DevDB_cff.py:11
lhef::LHERunInfo::Counter::sum2_
double sum2_
Definition: LHERunInfo.h:100
w
const double w
Definition: UKUtility.cc:23
lhef::LHERunInfo::XSec::value
double value()
Definition: LHERunInfo.h:70
lhef::LHERunInfo::Process::process_
int process_
Definition: LHERunInfo.h:140
lhef::LHERunInfo::Process::lheXSec_
XSec lheXSec_
Definition: LHERunInfo.h:141
lhef::LHERunInfo::Process::nPassPos
unsigned int nPassPos() const
Definition: LHERunInfo.h:112
lhef::LHERunInfo::LHERunInfo
LHERunInfo(std::istream &in)
Definition: LHERunInfo.cc:38
lhef::LHERunInfo::Process::setProcess
void setProcess(int id)
Definition: LHERunInfo.h:124
lhef::LHERunInfo::operator!=
bool operator!=(const LHERunInfo &other) const
Definition: LHERunInfo.h:54
trackingPlots.other
other
Definition: trackingPlots.py:1460
lhef::LHERunInfo::Process::setLHEXSec
void setLHEXSec(double value, double error)
Definition: LHERunInfo.h:126
lhef::LHERunInfo::Counter::n_
unsigned int n_
Definition: LHERunInfo.h:98
LHERunInfoProduct::Header::tag
const std::string & tag() const
Definition: LHERunInfoProduct.h:27
lhef::LHERunInfo::comments
std::vector< std::string > comments
Definition: LHERunInfo.h:160
lhef::LHERunInfo::Process
Definition: LHERunInfo.h:103
lhef::LHERunInfo::Process::heprupIndex
unsigned int heprupIndex() const
Definition: LHERunInfo.h:109
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
lhef::LHERunInfo::Process::getLHEXSec
XSec getLHEXSec() const
Definition: LHERunInfo.h:110
lhef::LHERunInfo
Definition: LHERunInfo.h:25
lhef::LHERunInfo::Process::selected
Counter selected() const
Definition: LHERunInfo.h:118
lhef::LHERunInfo::Process::killed
Counter killed() const
Definition: LHERunInfo.h:119
lhef::LHERunInfo::~LHERunInfo
~LHERunInfo()
Definition: LHERunInfo.cc:91
lhef::LHERunInfo::init
void init()
Definition: LHERunInfo.cc:93
LaserDQM_cfg.process
process
Definition: LaserDQM_cfg.py:3
lhef
Definition: ExhumeHadronizer.h:12
recoMuon::in
Definition: RecoMuonEnumerators.h:6
lhef::LHERunInfo::count
void count(int process, CountMode count, double eventWeight=1.0, double brWeight=1.0, double matchWeight=1.0)
Definition: LHERunInfo.cc:119
lhef::LHERunInfo::CountMode
CountMode
Definition: LHERunInfo.h:64
lhef::LHERunInfo::addHeader
void addHeader(const Header &header)
Definition: LHERunInfo.h:61
value
Definition: value.py:1
lhef::LHERunInfo::Process::acceptedBr
Counter acceptedBr() const
Definition: LHERunInfo.h:121
lhef::HEPRUP
Definition: LesHouches.h:22
lhef::HEPRUP::IDWTUP
int IDWTUP
Definition: LesHouches.h:101
lhef::LHERunInfo::Process::nTotalNeg
unsigned int nTotalNeg() const
Definition: LHERunInfo.h:115
lhef::LHERunInfo::Counter::sum2
double sum2() const
Definition: LHERunInfo.h:95
lhef::LHERunInfo::Header::Header
Header()
Definition: LHERunInfo.cc:387
lhef::LHERunInfo::getHEPRUP
const HEPRUP * getHEPRUP() const
Definition: LHERunInfo.h:51
lhef::LHERunInfo::kKilled
Definition: LHERunInfo.h:64
LesHouches.h
lhef::LHERunInfo::Counter::n
unsigned int n() const
Definition: LHERunInfo.h:93
lhef::LHERunInfo::XSec::error
double error()
Definition: LHERunInfo.h:71
lhef::LHERunInfo::xsec
XSec xsec() const
Definition: LHERunInfo.cc:163
lhef::LHERunInfo::Process::selected_
Counter selected_
Definition: LHERunInfo.h:148
lhef::LHERunInfo::Header
Definition: LHERunInfo.h:35
lhef::LHERunInfo::Header::~Header
~Header()
Definition: LHERunInfo.cc:396
lhef::LHERunInfo::initLumi
void initLumi()
Definition: LHERunInfo.cc:104
lhef::LHERunInfo::Process::addNPassPos
void addNPassPos(unsigned int n=1)
Definition: LHERunInfo.h:128
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
lhef::LHERunInfo::Process::Process
Process(int id)
Definition: LHERunInfo.h:106
lhef::LHERunInfo::Process::process
int process() const
Definition: LHERunInfo.h:108
lhef::LHERunInfo::Process::heprupIndex_
unsigned int heprupIndex_
Definition: LHERunInfo.h:142
RecoTauValidation_cfi.header
header
Definition: RecoTauValidation_cfi.py:292
lhef::LHERunInfo::Process::killed_
Counter killed_
Definition: LHERunInfo.h:149
lhef::LHERunInfo::XSec::error_
double error_
Definition: LHERunInfo.h:75
lhef::LHERunInfo::Process::addNTotalNeg
void addNTotalNeg(unsigned int n=1)
Definition: LHERunInfo.h:131
ParameterSet.h
dummy
Definition: DummySelector.h:38
lhef::LHERunInfo::Process::nTotalNeg_
unsigned int nTotalNeg_
Definition: LHERunInfo.h:146
lhef::LHERunInfo::kTried
Definition: LHERunInfo.h:64
lhef::LHERunInfo::XSec::value_
double value_
Definition: LHERunInfo.h:74
mps_splice.line
line
Definition: mps_splice.py:76
lhef::LHERunInfo::findHeader
std::vector< std::string > findHeader(const std::string &tag) const
Definition: LHERunInfo.cc:434
lhef::LHERunInfo::Process::Process
Process()
Definition: LHERunInfo.h:105
lhef::LHERunInfo::Process::addNTotalPos
void addNTotalPos(unsigned int n=1)
Definition: LHERunInfo.h:130
lhef::LHERunInfo::Process::accepted_
Counter accepted_
Definition: LHERunInfo.h:150
lhef::LHERunInfo::statistics
void statistics() const
Definition: LHERunInfo.cc:252
lhef::LHERunInfo::heprup
HEPRUP heprup
Definition: LHERunInfo.h:157
lhef::LHERunInfo::Process::addAcceptedBr
void addAcceptedBr(double w)
Definition: LHERunInfo.h:137
lhef::LHERunInfo::pdfSetTranslation
std::pair< int, int > pdfSetTranslation() const
Definition: LHERunInfo.cc:527
weight
Definition: weight.py:1
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
lhef::LHERunInfo::Counter::sum
double sum() const
Definition: LHERunInfo.h:94