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 
15 
16 using namespace gen;
17 using namespace edm;
18 
19 CLHEP::HepRandomEngine* decayRandomEngine;
20 
22  : fIsInitialized(false),
23  fTauolaInterface(0),
24  fEvtGenInterface(0),
25  fPhotosInterface(0)
26 {
27 
28  std::vector<std::string> extGenNames =
29  pset.getParameter< std::vector<std::string> >("parameterSets");
30 
32  if(!rng.isAvailable()) {
33  throw cms::Exception("Configuration")
34  << "The RandomNumberProducer module requires the RandomNumberGeneratorService\n"
35  "which appears to be absent. Please add that service to your configuration\n"
36  "or remove the modules that require it." << std::endl;
37  }
38  decayRandomEngine = &rng->getEngine();
39 
40  for (unsigned int ip=0; ip<extGenNames.size(); ++ip )
41  {
42  std::string curSet = extGenNames[ip];
43  if ( curSet == "EvtGen" )
44  {
46  }
47  else if ( curSet == "Tauola" )
48  {
49  // this is for old tauola27 (+pretauola)
50  //
51  // --> fTauolaInterface = new gen::TauolaInterface(pset.getUntrackedParameter< ParameterSet >(curSet));
52  //
53  // for tauola++, here it should be something like:
54  //
60  }
61  else if ( curSet == "Photos" )
62  {
64  }
65 
66  }
67 
68 }
69 
71 {
72  if ( fEvtGenInterface ) delete fEvtGenInterface;
73  if ( fTauolaInterface ) delete fTauolaInterface;
74  if ( fPhotosInterface ) delete fPhotosInterface;
75 }
76 
77 HepMC::GenEvent* ExternalDecayDriver::decay( HepMC::GenEvent* evt )
78 {
79 
80  if ( !fIsInitialized ) return evt;
81 
82  if ( fEvtGenInterface )
83  {
84  evt = fEvtGenInterface->decay( evt );
85  if ( !evt ) return 0;
86  }
87 
88  if ( fTauolaInterface )
89  {
90  evt = fTauolaInterface->decay( evt );
91  if ( !evt ) return 0;
92  }
93 
94  if ( fPhotosInterface )
95  {
96  evt = fPhotosInterface->apply( evt );
97  if ( !evt ) return 0;
98  }
99 
100  return evt;
101 }
102 
104 {
105 
106  if ( fIsInitialized ) return;
107 
108  if ( fTauolaInterface )
109  {
110  fTauolaInterface->init( es );
111  for ( std::vector<int>::const_iterator i=fTauolaInterface->operatesOnParticles().begin();
112  i!=fTauolaInterface->operatesOnParticles().end(); i++ )
113  fPDGs.push_back( *i );
114  }
115 
116  if ( fEvtGenInterface )
117  {
119  for ( std::vector<int>::const_iterator i=fEvtGenInterface->operatesOnParticles().begin();
120  i!=fEvtGenInterface->operatesOnParticles().end(); i++ )
121  fPDGs.push_back( *i );
122  }
123 
124 
125  if ( fPhotosInterface )
126  {
128 // for tauola++
129  if ( fPhotosInterface )
130  {
131  for ( unsigned int iss=0; iss<fPhotosInterface->specialSettings().size(); iss++ )
132  {
134  }
135  }
136  }
137 
138 // this is specific to old tauola27 only, because it calls up photos automatically
139 //
140 //
141 // if ( fTauolaInterface )
142 // {
143 // // override !
144 // fSpecialSettings.clear();
145 // fSpecialSettings.push_back( "QED-brem-off:15" );
146 // }
147 
148  fIsInitialized = true;
149 
150  return;
151 }
152 
154 {
156  // similar for EvtGen and/or Photos, if needs be
157  return;
158 }
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
HepMC::GenEvent * decay(HepMC::GenEvent *)
void init(const edm::EventSetup &)
const std::vector< std::string > & specialSettings()
EvtGenInterface * fEvtGenInterface
std::vector< std::string > fSpecialSettings
ExternalDecayDriver(const edm::ParameterSet &)
static TauolaInterface * getInstance()
const std::vector< int > & operatesOnParticles()
void init(const edm::EventSetup &)
CLHEP::HepRandomEngine * decayRandomEngine
HepMC::GenEvent * apply(HepMC::GenEvent *)