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  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  if (curSet == "EvtGen") {
29  fEvtGenInterface = std::unique_ptr<EvtGenInterfaceBase>(
30  EvtGenFactory::get()->create("EvtGen", pset.getUntrackedParameter<ParameterSet>(curSet)));
34  } else if (curSet == "EvtGen1" || curSet == "EvtGen130") {
35  fEvtGenInterface = std::unique_ptr<EvtGenInterfaceBase>(
36  EvtGenFactory::get()->create("EvtGen130", pset.getUntrackedParameter<ParameterSet>(curSet)));
42  } else if (curSet == "Tauola" || curSet == "Tauolapp" || curSet == "Tauolapp114") {
43  fTauolaInterface = std::unique_ptr<TauolaInterfaceBase>(
44  TauolaFactory::get()->create("Tauolapp114", pset.getUntrackedParameter<ParameterSet>(curSet)));
45  fPhotosInterface = std::unique_ptr<PhotosInterfaceBase>(
46  PhotosFactory::get()->create("Photos2155", pset.getUntrackedParameter<ParameterSet>(curSet)));
47  fPhotosInterface->configureOnlyFor(15);
48  fPhotosInterface->avoidTauLeptonicDecays();
51  } else if (curSet == "Photos" || curSet == "Photos2155") {
52  if (!fPhotosInterface) {
53  fPhotosInterface = std::unique_ptr<PhotosInterfaceBase>(
54  PhotosFactory::get()->create("Photos2155", pset.getUntrackedParameter<ParameterSet>(curSet)));
56  }
57  } else if (curSet == "Photospp" || curSet == "Photospp356") {
58  if (!fPhotosInterface) {
59  fPhotosInterface = std::unique_ptr<PhotosInterfaceBase>(
60  PhotosFactory::get()->create("Photospp356", pset.getUntrackedParameter<ParameterSet>(curSet)));
62  }
63  }
64  }
65 }
66 
68 
70  if (fTauolaInterface)
71  fTauolaInterface->SetLHE(lheEvent);
72  return decay(evt);
73 }
74 
76  if (!fIsInitialized)
77  return evt;
78 
79  if (fEvtGenInterface) {
80  evt = fEvtGenInterface->decay(evt);
81  if (!evt)
82  return nullptr;
83  }
84 
85  if (fTauolaInterface) {
86  evt = fTauolaInterface->decay(evt);
87  if (!evt)
88  return nullptr;
89  }
90 
91  if (fPhotosInterface) {
92  evt = fPhotosInterface->apply(evt);
93  if (!evt)
94  return nullptr;
95  }
96 
97  return evt;
98 }
99 
101  if (fIsInitialized)
102  return;
103 
104  if (fTauolaInterface) {
105  fTauolaInterface->init(es);
106  for (std::vector<int>::const_iterator i = fTauolaInterface->operatesOnParticles().begin();
107  i != fTauolaInterface->operatesOnParticles().end();
108  i++)
109  fPDGs.push_back(*i);
110  }
111 
112  if (fEvtGenInterface) {
113  fEvtGenInterface->init();
114  for (std::vector<int>::const_iterator i = fEvtGenInterface->operatesOnParticles().begin();
115  i != fEvtGenInterface->operatesOnParticles().end();
116  i++)
117  fPDGs.push_back(*i);
118  for (unsigned int iss = 0; iss < fEvtGenInterface->specialSettings().size(); iss++) {
119  fSpecialSettings.push_back(fEvtGenInterface->specialSettings()[iss]);
120  }
121  }
122 
123  if (fPhotosInterface) {
124  fPhotosInterface->init();
125  // for tauola++
126  if (fPhotosInterface) {
127  for (unsigned int iss = 0; iss < fPhotosInterface->specialSettings().size(); iss++) {
128  fSpecialSettings.push_back(fPhotosInterface->specialSettings()[iss]);
129  }
130  }
131  }
132 
133  fIsInitialized = true;
134 
135  return;
136 }
137 
139  if (fTauolaInterface)
140  fTauolaInterface->statistics();
141  if (fPhotosInterface)
142  fPhotosInterface->statistics();
143  // similar for EvtGen if needed
144  return;
145 }
146 
147 void ExternalDecayDriver::setRandomEngine(CLHEP::HepRandomEngine* v) {
148  if (fTauolaInterface)
149  fTauolaInterface->setRandomEngine(v);
150  if (fEvtGenInterface)
151  fEvtGenInterface->setRandomEngine(v);
152  if (fPhotosInterface)
153  fPhotosInterface->setRandomEngine(v);
154 }
EvtGenFactory.h
EvtGenInterfaceBase.h
mps_fire.i
i
Definition: mps_fire.py:428
gen::ExternalDecayDriver::~ExternalDecayDriver
~ExternalDecayDriver()
funct::false
false
Definition: Factorize.h:29
gen::ExternalDecayDriver::exSharedResources
std::vector< std::string > exSharedResources
Definition: ExternalDecayDriver.h:55
edm
HLT enums.
Definition: AlignableModifier.h:19
ExternalDecayDriver.h
gen::FortranInstance::kFortranInstance
static const std::string kFortranInstance
Definition: FortranInstance.h:88
TauolaFactory.h
gen::ExternalDecayDriver::statistics
void statistics() const
Definition: ExternalDecayDriver.cc:138
beamerCreator.create
def create(alignables, pedeDump, additionalData, outputFile, config)
Definition: beamerCreator.py:44
gen::ExternalDecayDriver::init
void init(const edm::EventSetup &)
Definition: ExternalDecayDriver.cc:100
gen::ExternalDecayDriver::fPhotosInterface
std::unique_ptr< PhotosInterfaceBase > fPhotosInterface
Definition: ExternalDecayDriver.h:51
gen::ExternalDecayDriver::decay
HepMC::GenEvent * decay(HepMC::GenEvent *evt)
Definition: ExternalDecayDriver.cc:75
HepMC::GenEvent
Definition: hepmc_rootio.cc:9
gen::ExternalDecayDriver::setRandomEngine
void setRandomEngine(CLHEP::HepRandomEngine *)
Definition: ExternalDecayDriver.cc:147
edm::SharedResourceNames::kPythia8
static const std::string kPythia8
Definition: SharedResourceNames.h:27
gen::ExternalDecayDriver::fEvtGenInterface
std::unique_ptr< EvtGenInterfaceBase > fEvtGenInterface
Definition: ExternalDecayDriver.h:50
LHERunInfoProduct.h
edm::SharedResourceNames::kPhotos
static const std::string kPhotos
Definition: SharedResourceNames.h:28
gen::ExternalDecayDriver::fTauolaInterface
std::unique_ptr< TauolaInterfaceBase > fTauolaInterface
Definition: ExternalDecayDriver.h:49
SharedResourceNames.h
gen
Definition: PythiaDecays.h:13
FortranInstance.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
TauolaInterfaceBase.h
edm::ParameterSet
Definition: ParameterSet.h:47
LHERunInfo.h
PhotosFactory.h
lhef::LHEEvent
Definition: LHEEvent.h:23
gen::v
double v[5][pyjets_maxn]
Definition: Cascade2Hadronizer.cc:76
gen::ExternalDecayDriver::fIsInitialized
bool fIsInitialized
Definition: ExternalDecayDriver.h:48
gen::ExternalDecayDriver::ExternalDecayDriver
ExternalDecayDriver(const edm::ParameterSet &)
Definition: ExternalDecayDriver.cc:23
edm::EventSetup
Definition: EventSetup.h:57
get
#define get
PhotosInterfaceBase.h
LHEEventProduct.h
edm::SharedResourceNames::kEvtGen
static const std::string kEvtGen
Definition: SharedResourceNames.h:30
gen::ExternalDecayDriver::fSpecialSettings
std::vector< std::string > fSpecialSettings
Definition: ExternalDecayDriver.h:53
edm::SharedResourceNames::kPythia6
static const std::string kPythia6
Definition: SharedResourceNames.h:26
gen::ExternalDecayDriver::fPDGs
std::vector< int > fPDGs
Definition: ExternalDecayDriver.h:52
LHEEvent.h
edm::SharedResourceNames::kTauola
static const std::string kTauola
Definition: SharedResourceNames.h:29
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27