CMS 3D CMS Logo

ConcurrentExternalDecayDriver.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  std::vector<std::string> extGenNames = pset.getParameter<std::vector<std::string> >("parameterSets");
25 
26  for (unsigned int ip = 0; ip < extGenNames.size(); ++ip) {
27  std::string curSet = extGenNames[ip];
28  throw cms::Exception("ThreadUnsafeDecayer") << "The decayer " << curSet << " is not thread-friendly.";
29  /*
30  if (curSet == "EvtGen") {
31  fEvtGenInterface = std::unique_ptr<EvtGenInterfaceBase>(
32  EvtGenFactory::get()->create("EvtGen", pset.getUntrackedParameter<ParameterSet>(curSet)));
33  exSharedResources.emplace_back(edm::SharedResourceNames::kEvtGen);
34  exSharedResources.emplace_back(edm::SharedResourceNames::kPythia6);
35  exSharedResources.emplace_back(gen::FortranInstance::kFortranInstance);
36  } else if (curSet == "EvtGen1" || curSet == "EvtGen130") {
37  fEvtGenInterface = std::unique_ptr<EvtGenInterfaceBase>(
38  EvtGenFactory::get()->create("EvtGen130", pset.getUntrackedParameter<ParameterSet>(curSet)));
39  exSharedResources.emplace_back(edm::SharedResourceNames::kEvtGen);
40  exSharedResources.emplace_back(edm::SharedResourceNames::kPythia8);
41  exSharedResources.emplace_back(edm::SharedResourceNames::kTauola);
42  exSharedResources.emplace_back(edm::SharedResourceNames::kPhotos);
43  exSharedResources.emplace_back(gen::FortranInstance::kFortranInstance);
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();
51  exSharedResources.emplace_back(edm::SharedResourceNames::kTauola);
52  exSharedResources.emplace_back(edm::SharedResourceNames::kPhotos);
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)));
57  exSharedResources.emplace_back(edm::SharedResourceNames::kPhotos);
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)));
63  exSharedResources.emplace_back(edm::SharedResourceNames::kPhotos);
64  }
65  }
66  */
67  }
68 }
69 
71 
73  /* if (fTauolaInterface)
74  fTauolaInterface->SetLHE(lheEvent); */
75  return decay(evt);
76 }
77 
79  if (!fIsInitialized)
80  return evt;
81  /*
82  if (fEvtGenInterface) {
83  evt = fEvtGenInterface->decay(evt);
84  if (!evt)
85  return nullptr;
86  }
87 
88  if (fTauolaInterface) {
89  evt = fTauolaInterface->decay(evt);
90  if (!evt)
91  return nullptr;
92  }
93 
94  if (fPhotosInterface) {
95  evt = fPhotosInterface->apply(evt);
96  if (!evt)
97  return nullptr;
98  }
99  */
100  return evt;
101 }
102 
104  if (fIsInitialized)
105  return;
106  /*
107  if (fTauolaInterface) {
108  fTauolaInterface->init(es);
109  for (std::vector<int>::const_iterator i = fTauolaInterface->operatesOnParticles().begin();
110  i != fTauolaInterface->operatesOnParticles().end();
111  i++)
112  fPDGs.push_back(*i);
113  }
114 
115  if (fEvtGenInterface) {
116  fEvtGenInterface->init();
117  for (std::vector<int>::const_iterator i = fEvtGenInterface->operatesOnParticles().begin();
118  i != fEvtGenInterface->operatesOnParticles().end();
119  i++)
120  fPDGs.push_back(*i);
121  for (unsigned int iss = 0; iss < fEvtGenInterface->specialSettings().size(); iss++) {
122  fSpecialSettings.push_back(fEvtGenInterface->specialSettings()[iss]);
123  }
124  }
125 
126  if (fPhotosInterface) {
127  fPhotosInterface->init();
128  // for tauola++
129  if (fPhotosInterface) {
130  for (unsigned int iss = 0; iss < fPhotosInterface->specialSettings().size(); iss++) {
131  fSpecialSettings.push_back(fPhotosInterface->specialSettings()[iss]);
132  }
133  }
134  }
135  */
136 
137  fIsInitialized = true;
138 
139  return;
140 }
141 
143  /* if (fTauolaInterface)
144  fTauolaInterface->statistics();
145  if (fPhotosInterface)
146  fPhotosInterface->statistics();
147  */
148  // similar for EvtGen if needed
149  return;
150 }
151 
152 void ConcurrentExternalDecayDriver::setRandomEngine(CLHEP::HepRandomEngine* v) {
153  /*
154  if (fTauolaInterface)
155  fTauolaInterface->setRandomEngine(v);
156  if (fEvtGenInterface)
157  fEvtGenInterface->setRandomEngine(v);
158  if (fPhotosInterface)
159  fPhotosInterface->setRandomEngine(v);
160  */
161 }
T getParameter(std::string const &) const
double v[5][pyjets_maxn]
ConcurrentExternalDecayDriver(const edm::ParameterSet &)
HepMC::GenEvent * decay(HepMC::GenEvent *evt)
void setRandomEngine(CLHEP::HepRandomEngine *)
HLT enums.