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 
24  : fIsInitialized(false) {
25  std::vector<std::string> extGenNames = pset.getParameter<std::vector<std::string> >("parameterSets");
26 
27  for (unsigned int ip = 0; ip < extGenNames.size(); ++ip) {
28  std::string curSet = extGenNames[ip];
29  if (curSet == "EvtGen") {
30  fEvtGenInterface = std::unique_ptr<EvtGenInterfaceBase>(
31  EvtGenFactory::get()->create("EvtGen", pset.getUntrackedParameter<ParameterSet>(curSet)));
35  } else if (curSet == "EvtGen1" || curSet == "EvtGen130") {
36  fEvtGenInterface = std::unique_ptr<EvtGenInterfaceBase>(
37  EvtGenFactory::get()->create("EvtGen130", pset.getUntrackedParameter<ParameterSet>(curSet)));
43  } else if (curSet == "Tauola" || curSet == "Tauolapp" || curSet == "Tauolapp114") {
44  fTauolaInterface = std::unique_ptr<TauolaInterfaceBase>(
45  TauolaFactory::get()->create("Tauolapp114", pset.getUntrackedParameter<ParameterSet>(curSet), iCollector));
48  } else if (curSet == "Photospp" || curSet == "Photospp356") {
49  if (!fPhotosInterface) {
50  fPhotosInterface = std::unique_ptr<PhotosInterfaceBase>(
51  PhotosFactory::get()->create("Photospp356", pset.getUntrackedParameter<ParameterSet>(curSet)));
53  }
54  }
55  }
56 }
57 
59 
61  if (fTauolaInterface)
62  fTauolaInterface->SetLHE(lheEvent);
63  return decay(evt);
64 }
65 
67  if (!fIsInitialized)
68  return evt;
69 
70  if (fEvtGenInterface) {
71  evt = fEvtGenInterface->decay(evt);
72  if (!evt)
73  return nullptr;
74  }
75 
76  if (fTauolaInterface) {
77  evt = fTauolaInterface->decay(evt);
78  if (!evt)
79  return nullptr;
80  }
81 
82  if (fPhotosInterface) {
83  evt = fPhotosInterface->apply(evt);
84  if (!evt)
85  return nullptr;
86  }
87 
88  return evt;
89 }
90 
92  if (fIsInitialized)
93  return;
94 
95  if (fTauolaInterface) {
96  fTauolaInterface->init(es);
97  for (std::vector<int>::const_iterator i = fTauolaInterface->operatesOnParticles().begin();
98  i != fTauolaInterface->operatesOnParticles().end();
99  i++)
100  fPDGs.push_back(*i);
101  }
102 
103  if (fEvtGenInterface) {
104  fEvtGenInterface->init();
105  for (std::vector<int>::const_iterator i = fEvtGenInterface->operatesOnParticles().begin();
106  i != fEvtGenInterface->operatesOnParticles().end();
107  i++)
108  fPDGs.push_back(*i);
109  for (unsigned int iss = 0; iss < fEvtGenInterface->specialSettings().size(); iss++) {
110  fSpecialSettings.push_back(fEvtGenInterface->specialSettings()[iss]);
111  }
112  }
113 
114  if (fPhotosInterface) {
115  fPhotosInterface->init();
116  // for tauola++
117  if (fPhotosInterface) {
118  for (unsigned int iss = 0; iss < fPhotosInterface->specialSettings().size(); iss++) {
119  fSpecialSettings.push_back(fPhotosInterface->specialSettings()[iss]);
120  }
121  }
122  }
123 
124  fIsInitialized = true;
125 
126  return;
127 }
128 
130  if (fTauolaInterface)
131  fTauolaInterface->statistics();
132  if (fPhotosInterface)
133  fPhotosInterface->statistics();
134  // similar for EvtGen if needed
135  return;
136 }
137 
138 void ExternalDecayDriver::setRandomEngine(CLHEP::HepRandomEngine* v) {
139  if (fTauolaInterface)
140  fTauolaInterface->setRandomEngine(v);
141  if (fEvtGenInterface)
142  fEvtGenInterface->setRandomEngine(v);
143  if (fPhotosInterface)
144  fPhotosInterface->setRandomEngine(v);
145 }
std::unique_ptr< PhotosInterfaceBase > fPhotosInterface
ExternalDecayDriver(const edm::ParameterSet &, edm::ConsumesCollector)
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)
HLT enums.
#define get
static const std::string kPythia8
void setRandomEngine(CLHEP::HepRandomEngine *)