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  {
50  // in the future, here it should be something like:
51  // fPhotosInterface = new gen::PhotosInterface();
52  // fPhotosInterface->avoidTauLeptonicDecays();
53  }
54  else if ( curSet == "Photos" )
55  {
57  }
58 
59  }
60 
61 }
62 
64 {
65  if ( fEvtGenInterface ) delete fEvtGenInterface;
66  if ( fTauolaInterface ) delete fTauolaInterface;
67  if ( fPhotosInterface ) delete fPhotosInterface;
68 }
69 
70 HepMC::GenEvent* ExternalDecayDriver::decay( HepMC::GenEvent* evt )
71 {
72 
73  if ( !fIsInitialized ) return evt;
74 
75  if ( fEvtGenInterface )
76  {
77  evt = fEvtGenInterface->decay( evt );
78  if ( !evt ) return 0;
79  }
80 
81  if ( fTauolaInterface )
82  {
83  evt = fTauolaInterface->decay( evt );
84  if ( !evt ) return 0;
85  }
86 
87 
88  if ( fPhotosInterface )
89  {
90  evt = fPhotosInterface->apply( evt );
91  if ( !evt ) return 0;
92  }
93 
94 
95  return evt;
96 }
97 
99 {
100 
101  if ( fIsInitialized ) return;
102 
103  if ( fTauolaInterface )
104  {
105  fTauolaInterface->init( es );
106  for ( std::vector<int>::const_iterator i=fTauolaInterface->operatesOnParticles().begin();
107  i!=fTauolaInterface->operatesOnParticles().end(); i++ )
108  fPDGs.push_back( *i );
109  }
110 
111  if ( fEvtGenInterface )
112  {
114  for ( std::vector<int>::const_iterator i=fEvtGenInterface->operatesOnParticles().begin();
115  i!=fEvtGenInterface->operatesOnParticles().end(); i++ )
116  fPDGs.push_back( *i );
117  }
118 
119 
120  if ( fPhotosInterface )
121  {
123 /* will fix shortly, for future tauola++
124  if ( fPhotosInterface )
125  {
126  for ( unsigned int iss=0; iss<fPhotosInterface->specialSettings().size(); iss++ )
127  {
128  fSpecialSettings.push_back( fPhotosInterface->specialSettings()[iss]; )
129  }
130  }
131 */
132  }
133 
134  // now do special settings
135 
136  // This is TEMPORARY THING, until we switch to tauola++ !!!
137 
138  if ( fPhotosInterface )
139  {
140  fSpecialSettings.push_back( "QED-brem-off:all" );
141  }
142  if ( fTauolaInterface )
143  {
144  // override !
145  fSpecialSettings.clear();
146  fSpecialSettings.push_back( "QED-brem-off:15" );
147  }
148 
149  fIsInitialized = true;
150 
151  return;
152 }
153 
155 {
157  // similar for EvtGen and/or Photos, if needs be
158  return;
159 }
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 *)
const std::vector< int > & operatesOnParticles()
TauolaInterface * fTauolaInterface
HepMC::GenEvent * decay(HepMC::GenEvent *)
void init(const edm::EventSetup &)
EvtGenInterface * fEvtGenInterface
std::vector< std::string > fSpecialSettings
ExternalDecayDriver(const edm::ParameterSet &)
const std::vector< int > & operatesOnParticles()
void init(const edm::EventSetup &)
CLHEP::HepRandomEngine * decayRandomEngine
HepMC::GenEvent * apply(HepMC::GenEvent *)