CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ThePEGHadronisation.cc
Go to the documentation of this file.
1 #include <string>
2 #include <iostream>
3 #include <sstream>
4 #include <memory>
5 #include <assert.h>
6 
7 #include <boost/shared_ptr.hpp>
8 
9 #include <HepMC/GenEvent.h>
10 #include <HepMC/GenParticle.h>
11 #include <HepMC/PdfInfo.h>
12 
13 #include <ThePEG/Repository/Repository.h>
14 #include <ThePEG/EventRecord/Event.h>
15 #include <ThePEG/Config/ThePEG.h>
16 #include <ThePEG/LesHouches/LesHouchesReader.h>
17 
21 
24 
29 
31 
32 using namespace std;
33 using namespace ThePEG;
34 using namespace lhef;
35 
36 namespace lhef {
37 
39  public:
42 
43  private:
44  void doInit();
45  std::auto_ptr<HepMC::GenEvent> doHadronisation();
46  void newRunInfo(const boost::shared_ptr<LHERunInfo> &runInfo);
47 
48  void initLHE();
49 
50  boost::shared_ptr<LHEProxy> proxy_;
51 
53 };
54 
55 void ThePEGHadronisation::initLHE()
56 {
57  ostringstream ss;
58  ss << proxy_->getID();
59 
60  ostringstream logstream;
61  ThePEG::Repository::exec("set " + handlerDirectory_ +
62  "/LHEReader:ProxyID " + ss.str(), logstream);
63  edm::LogInfo("Generator|LHEInterface") << logstream.str();
64 }
65 
66 ThePEGHadronisation::ThePEGHadronisation(const edm::ParameterSet &params) :
67  ThePEGInterface(params),
68  Hadronisation(params),
69  handlerDirectory_(params.getParameter<string>("eventHandlers"))
70 {
71  initRepository(params);
73  initLHE();
74 }
75 
77 {
78 }
79 
81 {
82 }
83 
84 std::auto_ptr<HepMC::GenEvent> ThePEGHadronisation::doHadronisation()
85 {
86  edm::LogInfo("Generator|LHEInterface") << "Start production";
87 
88  proxy_->loadEvent(getRawEvent());
89 
90  ThePEG::EventPtr thepegEvent;
91  try {
93  thepegEvent = eg_->shoot();
94  } catch(ThePEG::Stop) {
95  // no event
96  }
97 
98  if (!thepegEvent) {
99  edm::LogWarning("Generator|LHEInterface")
100  << "thepegEvent not initialized";
101  return std::auto_ptr<HepMC::GenEvent>();
102  }
103 
104  std::auto_ptr<HepMC::GenEvent> event = convert(thepegEvent);
105  if (!event.get())
106  return event;
107 
108  HepMC::PdfInfo pdf;
109  clearAuxiliary(event.get(), &pdf);
110  getRawEvent()->fillPdfInfo(&pdf);
111  fillAuxiliary(event.get(), &pdf, thepegEvent);
112  event->set_pdf_info(pdf);
113 
114  return event;
115 }
116 
118  const boost::shared_ptr<LHERunInfo> &runInfo)
119 {
120  proxy_->loadRunInfo(runInfo);
121  initGenerator();
122 }
123 
125 
126 } // namespace lhef
void initRepository(const edm::ParameterSet &params) const
void newRunInfo(const boost::shared_ptr< LHERunInfo > &runInfo)
DEFINE_LHE_HADRONISATION_PLUGIN(ThePEGHadronisation)
const boost::shared_ptr< LHEEvent > & getRawEvent() const
Definition: Hadronisation.h:59
void flushRandomNumberGenerator()
std::auto_ptr< HepMC::GenEvent > doHadronisation()
ThePEG::EGPtr eg_
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
static std::auto_ptr< HepMC::GenEvent > convert(const ThePEG::EventPtr &event)
const std::string handlerDirectory_
boost::shared_ptr< LHEProxy > proxy_
static void clearAuxiliary(HepMC::GenEvent *hepmc, HepMC::PdfInfo *pdf)
static boost::shared_ptr< LHEProxy > create()
Definition: LHEProxy.cc:41
static void fillAuxiliary(HepMC::GenEvent *hepmc, HepMC::PdfInfo *pdf, const ThePEG::EventPtr &event)