CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 
23 CLHEP::HepRandomEngine* decayRandomEngine = nullptr;
24 
26  : fIsInitialized(false),
27  fTauolaInterface(0),
28  fEvtGenInterface(0),
29  fPhotosInterface(0)
30 {
31  std::vector<std::string> extGenNames =
32  pset.getParameter< std::vector<std::string> >("parameterSets");
33 
34  for (unsigned int ip=0; ip<extGenNames.size(); ++ip ){
35  std::string curSet = extGenNames[ip];
36  if ( curSet == "EvtGen"){
41  }
42  else if( curSet == "EvtGen130"){
49  }
50  else if ( curSet == "Tauola" || curSet == "Tauolapp114" ){
51  fTauolaInterface = (TauolaInterfaceBase*)(TauolaFactory::get()->create("Tauolapp114", pset.getUntrackedParameter< ParameterSet >(curSet)));
52  fPhotosInterface = (PhotosInterfaceBase*)(PhotosFactory::get()->create("Photos2155", pset.getUntrackedParameter< ParameterSet >(curSet)));
57  }
58  else if ( curSet == "Photos" || curSet == "Photos2155" ){
59  if ( !fPhotosInterface ){
62  }
63  }
64  else if (curSet == "Photospp" || curSet == "Photospp356" ){
65  if ( !fPhotosInterface ){
66  fPhotosInterface = (PhotosInterfaceBase*)(PhotosFactory::get()->create("Photospp356", pset.getUntrackedParameter< ParameterSet>(curSet)));
68  }
69  }
70  }
71 }
72 
74 {
75  if ( fEvtGenInterface ) delete fEvtGenInterface;
76  if ( fTauolaInterface ) delete fTauolaInterface;
77  if ( fPhotosInterface ) delete fPhotosInterface;
78 }
79 
80 
81 HepMC::GenEvent* ExternalDecayDriver::decay(HepMC::GenEvent* evt, lhef::LHEEvent *lheEvent){
83  return decay(evt);
84 }
85 HepMC::GenEvent* ExternalDecayDriver::decay( HepMC::GenEvent* evt )
86 {
87  if ( !fIsInitialized ) return evt;
88 
89  if ( fEvtGenInterface ){
90  evt = fEvtGenInterface->decay( evt );
91  if ( !evt ) return 0;
92  }
93 
94  if ( fTauolaInterface ){
95  evt = fTauolaInterface->decay( evt );
96  if ( !evt ) return 0;
97  }
98 
99  if ( fPhotosInterface ){
100  evt = fPhotosInterface->apply( evt );
101  if ( !evt ) return 0;
102  }
103 
104  return evt;
105 }
106 
108 {
109 
110  if ( fIsInitialized ) return;
111 
112  if ( fTauolaInterface ){
113  fTauolaInterface->init( es );
114  for ( std::vector<int>::const_iterator i=fTauolaInterface->operatesOnParticles().begin();
115  i!=fTauolaInterface->operatesOnParticles().end(); i++ )
116  fPDGs.push_back( *i );
117  }
118 
119  if ( fEvtGenInterface ){
121  for ( std::vector<int>::const_iterator i=fEvtGenInterface->operatesOnParticles().begin();
122  i!=fEvtGenInterface->operatesOnParticles().end(); i++ )
123  fPDGs.push_back( *i );
124  for ( unsigned int iss=0; iss<fEvtGenInterface->specialSettings().size(); iss++ ){
126  }
127 
128  }
129 
130 
131  if ( fPhotosInterface ){
133  // for tauola++
134  if ( fPhotosInterface ){
135  for ( unsigned int iss=0; iss<fPhotosInterface->specialSettings().size(); iss++ ){
137  }
138  }
139  }
140 
141  fIsInitialized = true;
142 
143  return;
144 }
145 
147 {
150  // similar for EvtGen if needed
151  return;
152 }
153 
154 void ExternalDecayDriver::setRandomEngine(CLHEP::HepRandomEngine* v)
155 {
160 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
virtual void init()=0
virtual void configureOnlyFor(int)=0
TauolaInterfaceBase * fTauolaInterface
CLHEP::HepRandomEngine * decayRandomEngine
virtual void init(const edm::EventSetup &)
PhotosInterfaceBase * fPhotosInterface
static const std::string kTauola
static const std::string kPhotos
double v[5][pyjets_maxn]
virtual void setRandomEngine(CLHEP::HepRandomEngine *decayRandomEngine)=0
void init(const edm::EventSetup &)
static const std::string kPythia6
virtual HepMC::GenEvent * apply(HepMC::GenEvent *evt)
static const std::string kEvtGen
virtual const std::vector< std::string > & specialSettings()
std::vector< std::string > exSharedResources
virtual const std::vector< int > & operatesOnParticles()
std::vector< std::string > fSpecialSettings
static const std::string kFortranInstance
EvtGenInterfaceBase * fEvtGenInterface
HepMC::GenEvent * decay(HepMC::GenEvent *evt)
ExternalDecayDriver(const edm::ParameterSet &)
virtual void SetLHE(lhef::LHEEvent *l)
virtual HepMC::GenEvent * decay(HepMC::GenEvent *evt)
virtual HepMC::GenEvent * decay(HepMC::GenEvent *evt)
virtual const std::vector< std::string > & specialSettings()
virtual const std::vector< int > & operatesOnParticles()
volatile std::atomic< bool > shutdown_flag false
static const std::string kPythia8
virtual void setRandomEngine(CLHEP::HepRandomEngine *v)=0
void setRandomEngine(CLHEP::HepRandomEngine *)
virtual void setRandomEngine(CLHEP::HepRandomEngine *v)=0
T get(const Candidate &c)
Definition: component.h:55
virtual void avoidTauLeptonicDecays()=0