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 "HepMC/GenEvent.h"
11 #include "HepMC/GenVertex.h"
12 #include "HepMC/PdfInfo.h"
13 
15 
18 
20 
21 namespace lhef {
22 
23  class LHEEvent {
24  public:
25  LHEEvent(const std::shared_ptr<LHERunInfo> &runInfo, std::istream &in);
26  LHEEvent(const std::shared_ptr<LHERunInfo> &runInfo, const HEPEUP &hepeup);
27  LHEEvent(const std::shared_ptr<LHERunInfo> &runInfo,
28  const HEPEUP &hepeup,
30  const std::vector<std::string> &comments);
31  LHEEvent(const std::shared_ptr<LHERunInfo> &runInfo, const LHEEventProduct &product);
32  ~LHEEvent();
33 
36 
37  const std::shared_ptr<LHERunInfo> &getRunInfo() const { return runInfo; }
38  const HEPEUP *getHEPEUP() const { return &hepeup; }
39  const HEPRUP *getHEPRUP() const { return runInfo->getHEPRUP(); }
40  const PDF *getPDF() const { return pdf.get(); }
41  const std::vector<std::string> &getComments() const { return comments; }
42  const int getReadAttempts() { return readAttemptCounter; }
43 
44  void addWeight(const WGT &wgt) { weights_.push_back(wgt); }
45  void setPDF(std::unique_ptr<PDF> pdf) { this->pdf = std::move(pdf); }
46 
47  double originalXWGTUP() const { return originalXWGTUP_; }
48  const std::vector<WGT> &weights() const { return weights_; }
49 
50  const std::vector<float> &scales() const { return scales_; }
51  void setScales(const std::vector<float> &scales) { scales_ = scales; }
52 
53  int npLO() const { return npLO_; }
54  int npNLO() const { return npNLO_; }
55 
56  void setNpLO(int n) { npLO_ = n; }
57  void setNpNLO(int n) { npNLO_ = n; }
58 
59  void addComment(const std::string &line) { comments.push_back(line); }
60 
61  static void removeParticle(lhef::HEPEUP &hepeup, int index);
62  void removeResonances(const std::vector<int> &ids);
63 
64  void count(LHERunInfo::CountMode count, double weight = 1.0, double matchWeight = 1.0);
65 
66  void attempted() {
68  return;
69  }
70 
71  void fillPdfInfo(HepMC::PdfInfo *info) const;
72  void fillEventInfo(HepMC::GenEvent *hepmc) const;
73 
74  std::unique_ptr<HepMC::GenEvent> asHepMCEvent() const;
75 
76  static const HepMC::GenVertex *findSignalVertex(const HepMC::GenEvent *event, bool status3 = true);
77 
79 
80  private:
81  static bool checkHepMCTree(const HepMC::GenEvent *event);
82  HepMC::GenParticle *makeHepMCParticle(unsigned int i) const;
83 
84  const std::shared_ptr<LHERunInfo> runInfo;
85 
87  std::unique_ptr<PDF> pdf;
88  std::vector<WGT> weights_;
89  std::vector<std::string> comments;
90  bool counted;
93  std::vector<float> scales_; //scale value used to exclude EWK-produced partons from matching
94  int npLO_; //number of partons for LO process (used to steer matching/merging)
95  int npNLO_; //number of partons for NLO process (used to steer matching/merging)
96  };
97 
98 } // namespace lhef
99 
100 #endif // GeneratorEvent_LHEInterface_LHEEvent_h
const std::vector< std::string > & getComments() const
Definition: LHEEvent.h:41
HEPEUP hepeup
Definition: LHEEvent.h:86
static const TGPicture * info(bool iBackgroundIsBlack)
const PDF * getPDF() const
Definition: LHEEvent.h:40
LHEEvent(const std::shared_ptr< LHERunInfo > &runInfo, std::istream &in)
Definition: LHEEvent.cc:37
void addWeight(const WGT &wgt)
Definition: LHEEvent.h:44
LHEEventProduct::WGT WGT
Definition: LHEEvent.h:35
std::vector< std::string > comments
Definition: LHEEvent.h:89
const std::vector< float > & scales() const
Definition: LHEEvent.h:50
const std::shared_ptr< LHERunInfo > runInfo
Definition: LHEEvent.h:84
static void fixHepMCEventTimeOrdering(HepMC::GenEvent *event)
Definition: LHEEvent.cc:453
void removeResonances(const std::vector< int > &ids)
Definition: LHEEvent.cc:175
Definition: weight.py:1
void count(LHERunInfo::CountMode count, double weight=1.0, double matchWeight=1.0)
Definition: LHEEvent.cc:184
const int getReadAttempts()
Definition: LHEEvent.h:42
int npNLO() const
Definition: LHEEvent.h:54
std::unique_ptr< HepMC::GenEvent > asHepMCEvent() const
Definition: LHEEvent.cc:227
void attempted()
Definition: LHEEvent.h:66
int readAttemptCounter
Definition: LHEEvent.h:91
void addComment(const std::string &line)
Definition: LHEEvent.h:59
void fillEventInfo(HepMC::GenEvent *hepmc) const
Definition: LHEEvent.cc:220
void setScales(const std::vector< float > &scales)
Definition: LHEEvent.h:51
static void removeParticle(lhef::HEPEUP &hepeup, int index)
Definition: LHEEvent.cc:139
const std::vector< WGT > & weights() const
Definition: LHEEvent.h:48
const std::shared_ptr< LHERunInfo > & getRunInfo() const
Definition: LHEEvent.h:37
const HEPRUP * getHEPRUP() const
Definition: LHEEvent.h:39
void setNpNLO(int n)
Definition: LHEEvent.h:57
LHEEventProduct::PDF PDF
Definition: LHEEvent.h:34
void fillPdfInfo(HepMC::PdfInfo *info) const
Definition: LHEEvent.cc:193
const HEPEUP * getHEPEUP() const
Definition: LHEEvent.h:38
HepMC::GenParticle * makeHepMCParticle(unsigned int i) const
Definition: LHEEvent.cc:344
double originalXWGTUP() const
Definition: LHEEvent.h:47
static const HepMC::GenVertex * findSignalVertex(const HepMC::GenEvent *event, bool status3=true)
Definition: LHEEvent.cc:393
std::vector< float > scales_
Definition: LHEEvent.h:93
std::unique_ptr< PDF > pdf
Definition: LHEEvent.h:87
void setPDF(std::unique_ptr< PDF > pdf)
Definition: LHEEvent.h:45
bool counted
Definition: LHEEvent.h:90
void setNpLO(int n)
Definition: LHEEvent.h:56
static bool checkHepMCTree(const HepMC::GenEvent *event)
Definition: LHEEvent.cc:357
int npLO() const
Definition: LHEEvent.h:53
def move(src, dest)
Definition: eostools.py:511
std::vector< WGT > weights_
Definition: LHEEvent.h:88
Definition: event.py:1
double originalXWGTUP_
Definition: LHEEvent.h:92