CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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));
46  fPhotosInterface = std::unique_ptr<PhotosInterfaceBase>(
47  PhotosFactory::get()->create("Photos2155", pset.getUntrackedParameter<ParameterSet>(curSet)));
48  fPhotosInterface->configureOnlyFor(15);
49  fPhotosInterface->avoidTauLeptonicDecays();
52  } else if (curSet == "Photos" || curSet == "Photos2155") {
53  if (!fPhotosInterface) {
54  fPhotosInterface = std::unique_ptr<PhotosInterfaceBase>(
55  PhotosFactory::get()->create("Photos2155", pset.getUntrackedParameter<ParameterSet>(curSet)));
57  }
58  } else if (curSet == "Photospp" || curSet == "Photospp356") {
59  if (!fPhotosInterface) {
60  fPhotosInterface = std::unique_ptr<PhotosInterfaceBase>(
61  PhotosFactory::get()->create("Photospp356", pset.getUntrackedParameter<ParameterSet>(curSet)));
63  }
64  }
65  }
66 }
67 
69 
71  if (fTauolaInterface)
72  fTauolaInterface->SetLHE(lheEvent);
73  return decay(evt);
74 }
75 
77  if (!fIsInitialized)
78  return evt;
79 
80  if (fEvtGenInterface) {
81  evt = fEvtGenInterface->decay(evt);
82  if (!evt)
83  return nullptr;
84  }
85 
86  if (fTauolaInterface) {
87  evt = fTauolaInterface->decay(evt);
88  if (!evt)
89  return nullptr;
90  }
91 
92  if (fPhotosInterface) {
93  evt = fPhotosInterface->apply(evt);
94  if (!evt)
95  return nullptr;
96  }
97 
98  return evt;
99 }
100 
102  if (fIsInitialized)
103  return;
104 
105  if (fTauolaInterface) {
106  fTauolaInterface->init(es);
107  for (std::vector<int>::const_iterator i = fTauolaInterface->operatesOnParticles().begin();
108  i != fTauolaInterface->operatesOnParticles().end();
109  i++)
110  fPDGs.push_back(*i);
111  }
112 
113  if (fEvtGenInterface) {
114  fEvtGenInterface->init();
115  for (std::vector<int>::const_iterator i = fEvtGenInterface->operatesOnParticles().begin();
116  i != fEvtGenInterface->operatesOnParticles().end();
117  i++)
118  fPDGs.push_back(*i);
119  for (unsigned int iss = 0; iss < fEvtGenInterface->specialSettings().size(); iss++) {
120  fSpecialSettings.push_back(fEvtGenInterface->specialSettings()[iss]);
121  }
122  }
123 
124  if (fPhotosInterface) {
125  fPhotosInterface->init();
126  // for tauola++
127  if (fPhotosInterface) {
128  for (unsigned int iss = 0; iss < fPhotosInterface->specialSettings().size(); iss++) {
129  fSpecialSettings.push_back(fPhotosInterface->specialSettings()[iss]);
130  }
131  }
132  }
133 
134  fIsInitialized = true;
135 
136  return;
137 }
138 
140  if (fTauolaInterface)
141  fTauolaInterface->statistics();
142  if (fPhotosInterface)
143  fPhotosInterface->statistics();
144  // similar for EvtGen if needed
145  return;
146 }
147 
148 void ExternalDecayDriver::setRandomEngine(CLHEP::HepRandomEngine* v) {
149  if (fTauolaInterface)
150  fTauolaInterface->setRandomEngine(v);
151  if (fEvtGenInterface)
152  fEvtGenInterface->setRandomEngine(v);
153  if (fPhotosInterface)
154  fPhotosInterface->setRandomEngine(v);
155 }
T getUntrackedParameter(std::string const &, T const &) const
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)
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
#define get
static const std::string kPythia8
void setRandomEngine(CLHEP::HepRandomEngine *)