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
lhef::LHEEvent::getHEPEUP
const HEPEUP * getHEPEUP() const
Definition: LHEEvent.h:38
mps_fire.i
i
Definition: mps_fire.py:355
LHEEventProduct
Definition: LHEEventProduct.h:12
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
lhef::LHEEvent::npNLO_
int npNLO_
Definition: LHEEvent.h:95
lhef::LHEEvent::fillEventInfo
void fillEventInfo(HepMC::GenEvent *hepmc) const
Definition: LHEEvent.cc:218
lhef::LHEEvent::setScales
void setScales(const std::vector< float > &scales)
Definition: LHEEvent.h:51
lhef::LHEEvent::weights
const std::vector< WGT > & weights() const
Definition: LHEEvent.h:48
lhef::LHEEvent::getRunInfo
const std::shared_ptr< LHERunInfo > & getRunInfo() const
Definition: LHEEvent.h:37
gen::WeightsInfo
Definition: WeightsInfo.h:10
lhef::LHEEvent::counted
bool counted
Definition: LHEEvent.h:90
info
static const TGPicture * info(bool iBackgroundIsBlack)
Definition: FWCollectionSummaryWidget.cc:152
lhef::LHEEvent::makeHepMCParticle
HepMC::GenParticle * makeHepMCParticle(unsigned int i) const
Definition: LHEEvent.cc:342
lhef::LHEEvent::fillPdfInfo
void fillPdfInfo(HepMC::PdfInfo *info) const
Definition: LHEEvent.cc:191
lhef::LHEEvent::PDF
LHEEventProduct::PDF PDF
Definition: LHEEvent.h:34
HepMC::GenEvent
Definition: hepmc_rootio.cc:9
lhef::LHEEvent::setPDF
void setPDF(std::unique_ptr< PDF > pdf)
Definition: LHEEvent.h:45
lhef::LHEEvent::weights_
std::vector< WGT > weights_
Definition: LHEEvent.h:88
gen::PdfInfo
Definition: PdfInfo.h:11
lhef::LHEEvent::checkHepMCTree
static bool checkHepMCTree(const HepMC::GenEvent *event)
Definition: LHEEvent.cc:355
lhef::LHEEvent::setNpLO
void setNpLO(int n)
Definition: LHEEvent.h:56
lhef::LHEEvent::findSignalVertex
static const HepMC::GenVertex * findSignalVertex(const HepMC::GenEvent *event, bool status3=true)
Definition: LHEEvent.cc:391
lhef::LHEEvent::originalXWGTUP
double originalXWGTUP() const
Definition: LHEEvent.h:47
lhef::LHEEvent::scales_
std::vector< float > scales_
Definition: LHEEvent.h:93
lhef::LHEEvent::npLO
int npLO() const
Definition: LHEEvent.h:53
lhef::LHEEvent::originalXWGTUP_
double originalXWGTUP_
Definition: LHEEvent.h:92
lhef::LHEEvent::pdf
std::unique_ptr< PDF > pdf
Definition: LHEEvent.h:87
lhef::LHEEvent::npLO_
int npLO_
Definition: LHEEvent.h:94
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
lhef::LHEEvent::getPDF
const PDF * getPDF() const
Definition: LHEEvent.h:40
LHERunInfo.h
lhef
Definition: ExhumeHadronizer.h:12
recoMuon::in
Definition: RecoMuonEnumerators.h:6
lhef::LHERunInfo::CountMode
CountMode
Definition: LHERunInfo.h:64
lhef::LHEEvent
Definition: LHEEvent.h:23
lhef::HEPRUP
Definition: LesHouches.h:22
lhef::LHEEvent::getComments
const std::vector< std::string > & getComments() const
Definition: LHEEvent.h:41
lhef::LHEEvent::fixHepMCEventTimeOrdering
static void fixHepMCEventTimeOrdering(HepMC::GenEvent *event)
Definition: LHEEvent.cc:451
lhef::LHEEvent::hepeup
HEPEUP hepeup
Definition: LHEEvent.h:86
lhef::HEPEUP
Definition: LesHouches.h:138
LesHouches.h
lhef::LHEEvent::addComment
void addComment(const std::string &line)
Definition: LHEEvent.h:59
LHEEventProduct.h
lhef::LHEEvent::LHEEvent
LHEEvent(const std::shared_ptr< LHERunInfo > &runInfo, std::istream &in)
Definition: LHEEvent.cc:35
GenParticle.GenParticle
GenParticle
Definition: GenParticle.py:18
eostools.move
def move(src, dest)
Definition: eostools.py:511
lhef::LHEEvent::~LHEEvent
~LHEEvent()
Definition: LHEEvent.cc:135
lhef::LHEEvent::comments
std::vector< std::string > comments
Definition: LHEEvent.h:89
lhef::LHEEvent::addWeight
void addWeight(const WGT &wgt)
Definition: LHEEvent.h:44
lhef::LHEEvent::scales
const std::vector< float > & scales() const
Definition: LHEEvent.h:50
lhef::LHEEvent::WGT
LHEEventProduct::WGT WGT
Definition: LHEEvent.h:35
lhef::LHEEvent::asHepMCEvent
std::unique_ptr< HepMC::GenEvent > asHepMCEvent() const
Definition: LHEEvent.cc:225
lhef::LHEEvent::count
void count(LHERunInfo::CountMode count, double weight=1.0, double matchWeight=1.0)
Definition: LHEEvent.cc:182
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
lhef::LHEEvent::runInfo
const std::shared_ptr< LHERunInfo > runInfo
Definition: LHEEvent.h:84
lhef::LHEEvent::removeResonances
void removeResonances(const std::vector< int > &ids)
Definition: LHEEvent.cc:173
ParameterSet.h
lhef::LHEEvent::attempted
void attempted()
Definition: LHEEvent.h:66
event
Definition: event.py:1
lhef::LHEEvent::setNpNLO
void setNpNLO(int n)
Definition: LHEEvent.h:57
mps_splice.line
line
Definition: mps_splice.py:76
lhef::LHEEvent::getReadAttempts
const int getReadAttempts()
Definition: LHEEvent.h:42
lhef::LHEEvent::readAttemptCounter
int readAttemptCounter
Definition: LHEEvent.h:91
weight
Definition: weight.py:1
lhef::LHEEvent::removeParticle
static void removeParticle(lhef::HEPEUP &hepeup, int index)
Definition: LHEEvent.cc:137
lhef::LHEEvent::getHEPRUP
const HEPRUP * getHEPRUP() const
Definition: LHEEvent.h:39
lhef::LHEEvent::npNLO
int npNLO() const
Definition: LHEEvent.h:54