Go to the documentation of this file.00001 #ifndef GeneratorInterface_LHEInterface_LHEEvent_h
00002 #define GeneratorInterface_LHEInterface_LHEEvent_h
00003
00004 #include <iostream>
00005 #include <utility>
00006 #include <memory>
00007 #include <vector>
00008 #include <string>
00009
00010 #include <boost/shared_ptr.hpp>
00011
00012 #include <HepMC/GenEvent.h>
00013 #include <HepMC/GenVertex.h>
00014 #include <HepMC/PdfInfo.h>
00015
00016 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00017
00018 #include "SimDataFormats/GeneratorProducts/interface/LesHouches.h"
00019 #include "SimDataFormats/GeneratorProducts/interface/LHEEventProduct.h"
00020
00021 #include "GeneratorInterface/LHEInterface/interface/LHERunInfo.h"
00022
00023 namespace lhef {
00024
00025 class LHEEvent {
00026 public:
00027 LHEEvent(const boost::shared_ptr<LHERunInfo> &runInfo,
00028 std::istream &in);
00029 LHEEvent(const boost::shared_ptr<LHERunInfo> &runInfo,
00030 const HEPEUP &hepeup);
00031 LHEEvent(const boost::shared_ptr<LHERunInfo> &runInfo,
00032 const HEPEUP &hepeup,
00033 const LHEEventProduct::PDF *pdf,
00034 const std::vector<std::string> &comments);
00035 LHEEvent(const boost::shared_ptr<LHERunInfo> &runInfo,
00036 const LHEEventProduct &product);
00037 ~LHEEvent();
00038
00039 typedef LHEEventProduct::PDF PDF;
00040 typedef LHEEventProduct::WGT WGT;
00041
00042 const boost::shared_ptr<LHERunInfo> &getRunInfo() const { return runInfo; }
00043 const HEPEUP *getHEPEUP() const { return &hepeup; }
00044 const HEPRUP *getHEPRUP() const { return runInfo->getHEPRUP(); }
00045 const PDF *getPDF() const { return pdf.get(); }
00046 const std::vector<std::string> &getComments() const { return comments; }
00047 const int getReadAttempts() { return readAttemptCounter; }
00048
00049 void addWeight(const WGT& wgt) { weights_.push_back(wgt); }
00050 void setPDF(std::auto_ptr<PDF> pdf) { this->pdf = pdf; }
00051
00052 double originalXWGTUP() const { return originalXWGTUP_; }
00053 const std::vector<WGT>& weights() const { return weights_; }
00054
00055 void addComment(const std::string &line) { comments.push_back(line); }
00056
00057 static void removeParticle(lhef::HEPEUP &hepeup, int index);
00058 void removeResonances(const std::vector<int> &ids);
00059
00060 void count(LHERunInfo::CountMode count,
00061 double weight = 1.0, double matchWeight = 1.0);
00062
00063 void attempted() { readAttemptCounter++; return; }
00064
00065 void fillPdfInfo(HepMC::PdfInfo *info) const;
00066 void fillEventInfo(HepMC::GenEvent *hepmc) const;
00067
00068 std::auto_ptr<HepMC::GenEvent> asHepMCEvent() const;
00069
00070 static const HepMC::GenVertex *findSignalVertex(
00071 const HepMC::GenEvent *event, bool status3 = true);
00072
00073 static void fixHepMCEventTimeOrdering(HepMC::GenEvent *event);
00074
00075 private:
00076 static bool checkHepMCTree(const HepMC::GenEvent *event);
00077 HepMC::GenParticle *makeHepMCParticle(unsigned int i) const;
00078
00079 const boost::shared_ptr<LHERunInfo> runInfo;
00080
00081 HEPEUP hepeup;
00082 std::auto_ptr<PDF> pdf;
00083 std::vector<WGT> weights_;
00084 std::vector<std::string> comments;
00085 bool counted;
00086 int readAttemptCounter;
00087 double originalXWGTUP_;
00088 };
00089
00090 }
00091
00092 #endif // GeneratorEvent_LHEInterface_LHEEvent_h