CMS 3D CMS Logo

ExternalDecayDriver.cc
Go to the documentation of this file.
2 
10 #include "HepMC/GenEvent.h"
12 // LHE Run
15 
16 // LHE Event
19 
20 using namespace gen;
21 using namespace edm;
22 
23 CLHEP::HepRandomEngine* decayRandomEngine = nullptr;
24 
26  std::vector<std::string> extGenNames = pset.getParameter<std::vector<std::string> >("parameterSets");
27 
28  for (unsigned int ip = 0; ip < extGenNames.size(); ++ip) {
29  std::string curSet = extGenNames[ip];
30  if (curSet == "EvtGen") {
31  fEvtGenInterface = std::unique_ptr<EvtGenInterfaceBase>(
32  EvtGenFactory::get()->create("EvtGen", pset.getUntrackedParameter<ParameterSet>(curSet)));
36  } else if (curSet == "EvtGen1" || curSet == "EvtGen130") {
37  fEvtGenInterface = std::unique_ptr<EvtGenInterfaceBase>(
38  EvtGenFactory::get()->create("EvtGen130", pset.getUntrackedParameter<ParameterSet>(curSet)));
44  } else if (curSet == "Tauola" || curSet == "Tauolapp" || curSet == "Tauolapp114") {
45  fTauolaInterface = std::unique_ptr<TauolaInterfaceBase>(
46  TauolaFactory::get()->create("Tauolapp114", pset.getUntrackedParameter<ParameterSet>(curSet)));
47  fPhotosInterface = std::unique_ptr<PhotosInterfaceBase>(
48  PhotosFactory::get()->create("Photos2155", pset.getUntrackedParameter<ParameterSet>(curSet)));
49  fPhotosInterface->configureOnlyFor(15);
50  fPhotosInterface->avoidTauLeptonicDecays();
53  } else if (curSet == "Photos" || curSet == "Photos2155") {
54  if (!fPhotosInterface) {
55  fPhotosInterface = std::unique_ptr<PhotosInterfaceBase>(
56  PhotosFactory::get()->create("Photos2155", pset.getUntrackedParameter<ParameterSet>(curSet)));
58  }
59  } else if (curSet == "Photospp" || curSet == "Photospp356") {
60  if (!fPhotosInterface) {
61  fPhotosInterface = std::unique_ptr<PhotosInterfaceBase>(
62  PhotosFactory::get()->create("Photospp356", pset.getUntrackedParameter<ParameterSet>(curSet)));
64  }
65  }
66  }
67 }
68 
70 
72  if (fTauolaInterface)
73  fTauolaInterface->SetLHE(lheEvent);
74  return decay(evt);
75 }
76 
78  if (!fIsInitialized)
79  return evt;
80 
81  if (fEvtGenInterface) {
82  evt = fEvtGenInterface->decay(evt);
83  if (!evt)
84  return nullptr;
85  }
86 
87  if (fTauolaInterface) {
88  evt = fTauolaInterface->decay(evt);
89  if (!evt)
90  return nullptr;
91  }
92 
93  if (fPhotosInterface) {
94  evt = fPhotosInterface->apply(evt);
95  if (!evt)
96  return nullptr;
97  }
98 
99  return evt;
100 }
101 
103  if (fIsInitialized)
104  return;
105 
106  if (fTauolaInterface) {
107  fTauolaInterface->init(es);
108  for (std::vector<int>::const_iterator i = fTauolaInterface->operatesOnParticles().begin();
109  i != fTauolaInterface->operatesOnParticles().end();
110  i++)
111  fPDGs.push_back(*i);
112  }
113 
114  if (fEvtGenInterface) {
115  fEvtGenInterface->init();
116  for (std::vector<int>::const_iterator i = fEvtGenInterface->operatesOnParticles().begin();
117  i != fEvtGenInterface->operatesOnParticles().end();
118  i++)
119  fPDGs.push_back(*i);
120  for (unsigned int iss = 0; iss < fEvtGenInterface->specialSettings().size(); iss++) {
121  fSpecialSettings.push_back(fEvtGenInterface->specialSettings()[iss]);
122  }
123  }
124 
125  if (fPhotosInterface) {
126  fPhotosInterface->init();
127  // for tauola++
128  if (fPhotosInterface) {
129  for (unsigned int iss = 0; iss < fPhotosInterface->specialSettings().size(); iss++) {
130  fSpecialSettings.push_back(fPhotosInterface->specialSettings()[iss]);
131  }
132  }
133  }
134 
135  fIsInitialized = true;
136 
137  return;
138 }
139 
141  if (fTauolaInterface)
142  fTauolaInterface->statistics();
143  if (fPhotosInterface)
144  fPhotosInterface->statistics();
145  // similar for EvtGen if needed
146  return;
147 }
148 
149 void ExternalDecayDriver::setRandomEngine(CLHEP::HepRandomEngine* v) {
151  if (fTauolaInterface)
152  fTauolaInterface->setRandomEngine(v);
153  if (fEvtGenInterface)
154  fEvtGenInterface->setRandomEngine(v);
155  if (fPhotosInterface)
156  fPhotosInterface->setRandomEngine(v);
157 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
CLHEP::HepRandomEngine * decayRandomEngine
std::unique_ptr< PhotosInterfaceBase > fPhotosInterface
static const std::string kTauola
static const std::string kPhotos
double v[5][pyjets_maxn]
void init(const edm::EventSetup &)
static const std::string kPythia6
static const std::string kEvtGen
std::vector< std::string > exSharedResources
std::unique_ptr< EvtGenInterfaceBase > fEvtGenInterface
std::vector< std::string > fSpecialSettings
std::unique_ptr< TauolaInterfaceBase > fTauolaInterface
static const std::string kFortranInstance
HepMC::GenEvent * decay(HepMC::GenEvent *evt)
ExternalDecayDriver(const edm::ParameterSet &)
HLT enums.
static const std::string kPythia8
void setRandomEngine(CLHEP::HepRandomEngine *)