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.
1 
3 
7 
9 
10 #include "HepMC/GenEvent.h"
11 
13 
14 using namespace gen;
15 using namespace edm;
16 
17 CLHEP::HepRandomEngine* decayRandomEngine = nullptr;
18 
20  : fIsInitialized(false),
21  fTauolaInterface(0),
22  fEvtGenInterface(0),
23  fPhotosInterface(0)
24 {
25 
26  std::vector<std::string> extGenNames =
27  pset.getParameter< std::vector<std::string> >("parameterSets");
28 
29  for (unsigned int ip=0; ip<extGenNames.size(); ++ip )
30  {
31  std::string curSet = extGenNames[ip];
32  if ( curSet == "EvtGen" )
33  {
37  }
38  else if ( curSet == "Tauola" )
39  {
40  // this is for old tauola27 (+pretauola)
41  //
42  // --> fTauolaInterface = new gen::TauolaInterface(pset.getUntrackedParameter< ParameterSet >(curSet));
43  //
44  // for tauola++, here it should be something like:
45  //
52  }
53  else if ( curSet == "Photos" )
54  {
57  }
58  }
59 }
60 
62 {
63  if ( fEvtGenInterface ) delete fEvtGenInterface;
64  if ( fTauolaInterface ) delete fTauolaInterface;
65  if ( fPhotosInterface ) delete fPhotosInterface;
66 }
67 
68 HepMC::GenEvent* ExternalDecayDriver::decay( HepMC::GenEvent* evt )
69 {
70 
71  if ( !fIsInitialized ) return evt;
72 
73  if ( fEvtGenInterface )
74  {
75  evt = fEvtGenInterface->decay( evt );
76  if ( !evt ) return 0;
77  }
78 
79  if ( fTauolaInterface )
80  {
81  evt = fTauolaInterface->decay( evt );
82  if ( !evt ) return 0;
83  }
84 
85  if ( fPhotosInterface )
86  {
87  evt = fPhotosInterface->apply( evt );
88  if ( !evt ) return 0;
89  }
90 
91  return evt;
92 }
93 
95 {
96 
97  if ( fIsInitialized ) return;
98 
99  if ( fTauolaInterface )
100  {
101  fTauolaInterface->init( es );
102  for ( std::vector<int>::const_iterator i=fTauolaInterface->operatesOnParticles().begin();
103  i!=fTauolaInterface->operatesOnParticles().end(); i++ )
104  fPDGs.push_back( *i );
105  }
106 
107  if ( fEvtGenInterface )
108  {
110  for ( std::vector<int>::const_iterator i=fEvtGenInterface->operatesOnParticles().begin();
111  i!=fEvtGenInterface->operatesOnParticles().end(); i++ )
112  fPDGs.push_back( *i );
113  }
114 
115 
116  if ( fPhotosInterface )
117  {
119 // for tauola++
120  if ( fPhotosInterface )
121  {
122  for ( unsigned int iss=0; iss<fPhotosInterface->specialSettings().size(); iss++ )
123  {
125  }
126  }
127  }
128 
129 // this is specific to old tauola27 only, because it calls up photos automatically
130 //
131 //
132 // if ( fTauolaInterface )
133 // {
134 // // override !
135 // fSpecialSettings.clear();
136 // fSpecialSettings.push_back( "QED-brem-off:15" );
137 // }
138 
139  fIsInitialized = true;
140 
141  return;
142 }
143 
145 {
147  // similar for EvtGen and/or Photos, if needs be
148  return;
149 }
150 
151 void ExternalDecayDriver::setRandomEngine(CLHEP::HepRandomEngine* v)
152 {
154  if ( fTauolaInterface ) {
156  }
157  if ( fEvtGenInterface ) {
159  }
160 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
PhotosInterface * fPhotosInterface
HepMC::GenEvent * decay(HepMC::GenEvent *)
HepMC::GenEvent * decay(HepMC::GenEvent *)
void setPSet(const edm::ParameterSet &)
const std::vector< int > & operatesOnParticles()
TauolaInterface * fTauolaInterface
static const std::string kTauola
HepMC::GenEvent * decay(HepMC::GenEvent *)
static const std::string kPhotos
double v[5][pyjets_maxn]
void init(const edm::EventSetup &)
void setRandomEngine(CLHEP::HepRandomEngine *v)
static const std::string kPythia6
static const std::string kEvtGen
const std::vector< std::string > & specialSettings()
std::vector< std::string > exSharedResources
EvtGenInterface * fEvtGenInterface
std::vector< std::string > fSpecialSettings
ExternalDecayDriver(const edm::ParameterSet &)
static TauolaInterface * getInstance()
const std::vector< int > & operatesOnParticles()
void init(const edm::EventSetup &)
volatile std::atomic< bool > shutdown_flag false
CLHEP::HepRandomEngine * decayRandomEngine
void setRandomEngine(CLHEP::HepRandomEngine *)
HepMC::GenEvent * apply(HepMC::GenEvent *)
void setRandomEngine(CLHEP::HepRandomEngine *v)