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 
9 
10 #include "HepMC/GenEvent.h"
11 
15 
16 using namespace gen;
17 using namespace edm;
18 
19 CLHEP::HepRandomEngine* decayRandomEngine;
20 
22  : hastauolapp(false),
23  fIsInitialized(false),
24  fTauolaInterface(0),
25  fEvtGenInterface(0),
26  fPhotosInterface(0)
27 {
28 
29  std::vector<std::string> extGenNames = 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  std::string curSet = extGenNames[ip];
42  if ( curSet == "EvtGen" || curSet == "EvtGenLHC91"){
43  fEvtGenInterface = (EvtGenInterfaceBase*)(EvtGenFactory::get()->create("EvtGenLHC91", pset.getUntrackedParameter< ParameterSet >(curSet)));
45  }
46  if ( curSet == "Tauola" || curSet == "Tauola271215" ){
47  fTauolaInterface = (TauolaInterfaceBase*)(TauolaFactory::get()->create("Tauola271215", pset.getUntrackedParameter< ParameterSet >(curSet)));
49  }
50  if(curSet =="Tauolapp111a"){
51  fTauolaInterface = (TauolaInterfaceBase*)(TauolaFactory::get()->create("Tauolapp111a", pset.getUntrackedParameter< ParameterSet >(curSet)));
52  fPhotosInterface = (PhotosInterfaceBase*)(PhotosFactory::get()->create("Photos2155", pset.getUntrackedParameter< ParameterSet >(curSet)));
56  hastauolapp=true;
57  }
58  if ( curSet == "Photos" || curSet == "Photos2155Legacy"){
59  if ( !fPhotosInterface ){
60  fPhotosInterface = (PhotosInterfaceBase*)(PhotosFactory::get()->create("Photos2155Legacy", pset.getUntrackedParameter< ParameterSet >(curSet)));
62  }
63  }
64  if (curSet == "Photos2155"){
65  if ( !fPhotosInterface ){
68  }
69  }
70  }
71 }
72 
74  if ( fEvtGenInterface ) delete fEvtGenInterface;
75  if ( fTauolaInterface ) delete fTauolaInterface;
76  if ( fPhotosInterface ) delete fPhotosInterface;
77 }
78 
79 HepMC::GenEvent* ExternalDecayDriver::decay( HepMC::GenEvent* evt ){
80 
81  if ( !fIsInitialized ) return evt;
82 
83  if ( fEvtGenInterface ){
84  evt = fEvtGenInterface->decay( evt );
85  if ( !evt ) return 0;
86  }
87 
88  if ( fTauolaInterface ){
89  evt = fTauolaInterface->decay( evt );
90  if ( !evt ) return 0;
91  }
92 
93  if ( fPhotosInterface ){
94  evt = fPhotosInterface->apply( evt );
95  if ( !evt ) return 0;
96  }
97 
98  return evt;
99 }
100 
102 
103  if ( fIsInitialized ) return;
104 
105  if ( fTauolaInterface ) {
106  fTauolaInterface->init( es );
107  for ( std::vector<int>::const_iterator i=fTauolaInterface->operatesOnParticles().begin();
108  i!=fTauolaInterface->operatesOnParticles().end(); i++ )
109  fPDGs.push_back( *i );
110  }
111  if ( fEvtGenInterface ){
113  for ( std::vector<int>::const_iterator i=fEvtGenInterface->operatesOnParticles().begin();
114  i!=fEvtGenInterface->operatesOnParticles().end(); i++ )
115  fPDGs.push_back( *i );
116  }
117 
118 
119  if( fPhotosInterface){
121  if(hastauolapp){
122  if ( fPhotosInterface ){
123  for ( unsigned int iss=0; iss<fPhotosInterface->specialSettings().size(); iss++ ){
125  }
126  }
127  }
128  }
129  // now put in hack for TauolaFortran settings
130  if(!hastauolapp){
131  if ( fPhotosInterface ){
132  fSpecialSettings.push_back( "QED-brem-off:all" );
133  }
134  if ( fTauolaInterface ){
135  // override !
136  fSpecialSettings.clear();
137  fSpecialSettings.push_back( "QED-brem-off:15" );
138  }
139  }
140  fIsInitialized = true;
141 
142  return;
143 }
144 
146 {
148  // similar for EvtGen and/or Photos, if needs be
149  return;
150 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
virtual void SetDecayRandomEngine(CLHEP::HepRandomEngine *decayRandomEngine)
TauolaInterfaceBase * fTauolaInterface
CLHEP::HepRandomEngine * decayRandomEngine
virtual void init(const edm::EventSetup &)
PhotosInterfaceBase * fPhotosInterface
virtual void SetDecayRandomEngine(CLHEP::HepRandomEngine *decayRandomEngine)
HepMC::GenEvent * decay(HepMC::GenEvent *)
void init(const edm::EventSetup &)
virtual void configureOnlyFor(int)
virtual HepMC::GenEvent * apply(HepMC::GenEvent *evt)
virtual void SetPhotosDecayRandomEngine(CLHEP::HepRandomEngine *decayRandomEngine)
virtual const std::vector< int > & operatesOnParticles()
std::vector< std::string > fSpecialSettings
EvtGenInterfaceBase * fEvtGenInterface
virtual void avoidTauLeptonicDecays()
ExternalDecayDriver(const edm::ParameterSet &)
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()
T get(const Candidate &c)
Definition: component.h:56