CMS 3D CMS Logo

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  const std::vector<float> &scales() const { return scales_; }
56  void setScales(const std::vector<float> &scales) { scales_ = scales; }
57 
58  int npLO() const { return npLO_; }
59  int npNLO() const { return npNLO_; }
60 
61  void setNpLO(int n) { npLO_ = n; }
62  void setNpNLO(int n) { npNLO_ = n; }
63 
64  void addComment(const std::string &line) { comments.push_back(line); }
65 
66  static void removeParticle(lhef::HEPEUP &hepeup, int index);
67  void removeResonances(const std::vector<int> &ids);
68 
70  double weight = 1.0, double matchWeight = 1.0);
71 
72  void attempted() { readAttemptCounter++; return; }
73 
74  void fillPdfInfo(HepMC::PdfInfo *info) const;
75  void fillEventInfo(HepMC::GenEvent *hepmc) const;
76 
77  std::auto_ptr<HepMC::GenEvent> asHepMCEvent() const;
78 
79  static const HepMC::GenVertex *findSignalVertex(
80  const HepMC::GenEvent *event, bool status3 = true);
81 
82  static void fixHepMCEventTimeOrdering(HepMC::GenEvent *event);
83 
84  private:
85  static bool checkHepMCTree(const HepMC::GenEvent *event);
86  HepMC::GenParticle *makeHepMCParticle(unsigned int i) const;
87 
88  const boost::shared_ptr<LHERunInfo> runInfo;
89 
91  std::auto_ptr<PDF> pdf;
92  std::vector<WGT> weights_;
93  std::vector<std::string> comments;
94  bool counted;
97  std::vector<float> scales_; //scale value used to exclude EWK-produced partons from matching
98  int npLO_; //number of partons for LO process (used to steer matching/merging)
99  int npNLO_; //number of partons for NLO process (used to steer matching/merging)
100 };
101 
102 } // namespace lhef
103 
104 #endif // GeneratorEvent_LHEInterface_LHEEvent_h
const PDF * getPDF() const
Definition: LHEEvent.h:45
HEPEUP hepeup
Definition: LHEEvent.h:90
static const TGPicture * info(bool iBackgroundIsBlack)
int npLO() const
Definition: LHEEvent.h:58
void addWeight(const WGT &wgt)
Definition: LHEEvent.h:49
LHEEventProduct::WGT WGT
Definition: LHEEvent.h:40
std::vector< std::string > comments
Definition: LHEEvent.h:93
const HEPRUP * getHEPRUP() const
Definition: LHEEvent.h:44
void fillEventInfo(HepMC::GenEvent *hepmc) const
Definition: LHEEvent.cc:249
static void fixHepMCEventTimeOrdering(HepMC::GenEvent *event)
Definition: LHEEvent.cc:513
void removeResonances(const std::vector< int > &ids)
Definition: LHEEvent.cc:196
Definition: weight.py:1
void count(LHERunInfo::CountMode count, double weight=1.0, double matchWeight=1.0)
Definition: LHEEvent.cc:207
const int getReadAttempts()
Definition: LHEEvent.h:47
const HEPEUP * getHEPEUP() const
Definition: LHEEvent.h:43
std::auto_ptr< PDF > pdf
Definition: LHEEvent.h:91
int npNLO() const
Definition: LHEEvent.h:59
void attempted()
Definition: LHEEvent.h:72
LHEEvent(const boost::shared_ptr< LHERunInfo > &runInfo, std::istream &in)
Definition: LHEEvent.cc:36
int readAttemptCounter
Definition: LHEEvent.h:95
void addComment(const std::string &line)
Definition: LHEEvent.h:64
const std::vector< std::string > & getComments() const
Definition: LHEEvent.h:46
const boost::shared_ptr< LHERunInfo > runInfo
Definition: LHEEvent.h:88
void setScales(const std::vector< float > &scales)
Definition: LHEEvent.h:56
HepMC::GenParticle * makeHepMCParticle(unsigned int i) const
Definition: LHEEvent.cc:387
static void removeParticle(lhef::HEPEUP &hepeup, int index)
Definition: LHEEvent.cc:156
void fillPdfInfo(HepMC::PdfInfo *info) const
Definition: LHEEvent.cc:221
void setNpNLO(int n)
Definition: LHEEvent.h:62
LHEEventProduct::PDF PDF
Definition: LHEEvent.h:39
const std::vector< float > & scales() const
Definition: LHEEvent.h:55
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:448
double originalXWGTUP() const
Definition: LHEEvent.h:52
void setPDF(std::auto_ptr< PDF > pdf)
Definition: LHEEvent.h:50
std::vector< float > scales_
Definition: LHEEvent.h:97
bool counted
Definition: LHEEvent.h:94
void setNpLO(int n)
Definition: LHEEvent.h:61
static bool checkHepMCTree(const HepMC::GenEvent *event)
Definition: LHEEvent.cc:404
std::auto_ptr< HepMC::GenEvent > asHepMCEvent() const
Definition: LHEEvent.cc:257
const std::vector< WGT > & weights() const
Definition: LHEEvent.h:53
std::vector< WGT > weights_
Definition: LHEEvent.h:92
Definition: event.py:1
double originalXWGTUP_
Definition: LHEEvent.h:96