CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_13_patch3/src/GeneratorInterface/LHEInterface/interface/LHEEvent.h

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 
00041         const boost::shared_ptr<LHERunInfo> &getRunInfo() const { return runInfo; }
00042         const HEPEUP *getHEPEUP() const { return &hepeup; }
00043         const HEPRUP *getHEPRUP() const { return runInfo->getHEPRUP(); }
00044         const PDF *getPDF() const { return pdf.get(); }
00045         const std::vector<std::string> &getComments() const { return comments; }
00046         const int getReadAttempts() { return readAttemptCounter; }
00047 
00048         void setPDF(std::auto_ptr<PDF> pdf) { this->pdf = pdf; }
00049 
00050         void addComment(const std::string &line) { comments.push_back(line); }
00051 
00052         static void removeParticle(lhef::HEPEUP &hepeup, int index);
00053         void removeResonances(const std::vector<int> &ids);
00054 
00055         void count(LHERunInfo::CountMode count,
00056                    double weight = 1.0, double matchWeight = 1.0);
00057 
00058         void attempted() { readAttemptCounter++; return; }
00059         
00060         void fillPdfInfo(HepMC::PdfInfo *info) const;
00061         void fillEventInfo(HepMC::GenEvent *hepmc) const;
00062 
00063         std::auto_ptr<HepMC::GenEvent> asHepMCEvent() const;
00064 
00065         static const HepMC::GenVertex *findSignalVertex(
00066                         const HepMC::GenEvent *event, bool status3 = true);
00067 
00068         static void fixHepMCEventTimeOrdering(HepMC::GenEvent *event);
00069 
00070     private:
00071         static bool checkHepMCTree(const HepMC::GenEvent *event);
00072         HepMC::GenParticle *makeHepMCParticle(unsigned int i) const;
00073 
00074         const boost::shared_ptr<LHERunInfo>     runInfo;
00075 
00076         HEPEUP                                  hepeup;
00077         std::auto_ptr<PDF>                      pdf;
00078         std::vector<std::string>                comments;
00079         bool                                    counted;
00080         int                                     readAttemptCounter;
00081 };
00082 
00083 } // namespace lhef
00084 
00085 #endif // GeneratorEvent_LHEInterface_LHEEvent_h