CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
LHEEvent.h
Go to the documentation of this file.
1 #ifndef GeneratorInterface_LHEInterface_LHEEvent_h
2 #define GeneratorInterface_LHEInterface_LHEEvent_h
3 
4 #include <iostream>
5 #include <utility>
6 #include <memory>
7 #include <vector>
8 #include <string>
9 
10 #include <boost/shared_ptr.hpp>
11 
12 #include <HepMC/GenEvent.h>
13 #include <HepMC/GenVertex.h>
14 #include <HepMC/PdfInfo.h>
15 
17 
20 
22 
23 namespace lhef {
24 
25 class LHEEvent {
26  public:
27  LHEEvent(const boost::shared_ptr<LHERunInfo> &runInfo,
28  std::istream &in);
29  LHEEvent(const boost::shared_ptr<LHERunInfo> &runInfo,
30  const HEPEUP &hepeup);
31  LHEEvent(const boost::shared_ptr<LHERunInfo> &runInfo,
32  const HEPEUP &hepeup,
34  const std::vector<std::string> &comments);
35  LHEEvent(const boost::shared_ptr<LHERunInfo> &runInfo,
36  const LHEEventProduct &product);
37  ~LHEEvent();
38 
41 
42  const boost::shared_ptr<LHERunInfo> &getRunInfo() const { return runInfo; }
43  const HEPEUP *getHEPEUP() const { return &hepeup; }
44  const HEPRUP *getHEPRUP() const { return runInfo->getHEPRUP(); }
45  const PDF *getPDF() const { return pdf.get(); }
46  const std::vector<std::string> &getComments() const { return comments; }
47  const int getReadAttempts() { return readAttemptCounter; }
48 
49  void addWeight(const WGT& wgt) { weights_.push_back(wgt); }
50  void setPDF(std::auto_ptr<PDF> pdf) { this->pdf = pdf; }
51 
52  double originalXWGTUP() const { return originalXWGTUP_; }
53  const std::vector<WGT>& weights() const { return weights_; }
54 
55  void addComment(const std::string &line) { comments.push_back(line); }
56 
57  static void removeParticle(lhef::HEPEUP &hepeup, int index);
58  void removeResonances(const std::vector<int> &ids);
59 
61  double weight = 1.0, double matchWeight = 1.0);
62 
63  void attempted() { readAttemptCounter++; return; }
64 
65  void fillPdfInfo(HepMC::PdfInfo *info) const;
66  void fillEventInfo(HepMC::GenEvent *hepmc) const;
67 
68  std::auto_ptr<HepMC::GenEvent> asHepMCEvent() const;
69 
70  static const HepMC::GenVertex *findSignalVertex(
71  const HepMC::GenEvent *event, bool status3 = true);
72 
73  static void fixHepMCEventTimeOrdering(HepMC::GenEvent *event);
74 
75  private:
76  static bool checkHepMCTree(const HepMC::GenEvent *event);
77  HepMC::GenParticle *makeHepMCParticle(unsigned int i) const;
78 
79  const boost::shared_ptr<LHERunInfo> runInfo;
80 
82  std::auto_ptr<PDF> pdf;
83  std::vector<WGT> weights_;
84  std::vector<std::string> comments;
85  bool counted;
88 };
89 
90 } // namespace lhef
91 
92 #endif // GeneratorEvent_LHEInterface_LHEEvent_h
const PDF * getPDF() const
Definition: LHEEvent.h:45
int i
Definition: DBlmapReader.cc:9
HEPEUP hepeup
Definition: LHEEvent.h:81
void addWeight(const WGT &wgt)
Definition: LHEEvent.h:49
LHEEventProduct::WGT WGT
Definition: LHEEvent.h:40
std::vector< std::string > comments
Definition: LHEEvent.h:84
const HEPRUP * getHEPRUP() const
Definition: LHEEvent.h:44
void fillEventInfo(HepMC::GenEvent *hepmc) const
Definition: LHEEvent.cc:245
static void fixHepMCEventTimeOrdering(HepMC::GenEvent *event)
Definition: LHEEvent.cc:508
void removeResonances(const std::vector< int > &ids)
Definition: LHEEvent.cc:192
void count(LHERunInfo::CountMode count, double weight=1.0, double matchWeight=1.0)
Definition: LHEEvent.cc:203
const int getReadAttempts()
Definition: LHEEvent.h:47
const HEPEUP * getHEPEUP() const
Definition: LHEEvent.h:43
std::auto_ptr< PDF > pdf
Definition: LHEEvent.h:82
void attempted()
Definition: LHEEvent.h:63
LHEEvent(const boost::shared_ptr< LHERunInfo > &runInfo, std::istream &in)
Definition: LHEEvent.cc:36
int readAttemptCounter
Definition: LHEEvent.h:86
void addComment(const std::string &line)
Definition: LHEEvent.h:55
const std::vector< std::string > & getComments() const
Definition: LHEEvent.h:46
const boost::shared_ptr< LHERunInfo > runInfo
Definition: LHEEvent.h:79
HepMC::GenParticle * makeHepMCParticle(unsigned int i) const
Definition: LHEEvent.cc:383
static void removeParticle(lhef::HEPEUP &hepeup, int index)
Definition: LHEEvent.cc:152
void fillPdfInfo(HepMC::PdfInfo *info) const
Definition: LHEEvent.cc:217
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
LHEEventProduct::PDF PDF
Definition: LHEEvent.h:39
const boost::shared_ptr< LHERunInfo > & getRunInfo() const
Definition: LHEEvent.h:42
static const HepMC::GenVertex * findSignalVertex(const HepMC::GenEvent *event, bool status3=true)
Definition: LHEEvent.cc:444
double originalXWGTUP() const
Definition: LHEEvent.h:52
void setPDF(std::auto_ptr< PDF > pdf)
Definition: LHEEvent.h:50
bool counted
Definition: LHEEvent.h:85
static bool checkHepMCTree(const HepMC::GenEvent *event)
Definition: LHEEvent.cc:400
std::auto_ptr< HepMC::GenEvent > asHepMCEvent() const
Definition: LHEEvent.cc:253
const std::vector< WGT > & weights() const
Definition: LHEEvent.h:53
std::vector< WGT > weights_
Definition: LHEEvent.h:83
double originalXWGTUP_
Definition: LHEEvent.h:87