CMS 3D CMS Logo

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 
25  : fIsInitialized(false)
26 {
27  std::vector<std::string> extGenNames =
28  pset.getParameter< std::vector<std::string> >("parameterSets");
29 
30  for (unsigned int ip=0; ip<extGenNames.size(); ++ip ) {
31  std::string curSet = extGenNames[ip];
32  if ( curSet == "EvtGen") {
33  fEvtGenInterface = std::unique_ptr<EvtGenInterfaceBase>(EvtGenFactory::get()->create("EvtGen", pset.getUntrackedParameter< ParameterSet >(curSet)));
37  }
38  else if( curSet == "EvtGen1" || curSet == "EvtGen130" ) {
39  fEvtGenInterface = std::unique_ptr<EvtGenInterfaceBase>(EvtGenFactory::get()->create("EvtGen130", pset.getUntrackedParameter< ParameterSet >(curSet)));
45  }
46  else if ( curSet == "Tauola" || curSet == "Tauolapp" || curSet == "Tauolapp114" ) {
47  fTauolaInterface = std::unique_ptr<TauolaInterfaceBase>(TauolaFactory::get()->create("Tauolapp114", pset.getUntrackedParameter< ParameterSet >(curSet)));
48  fPhotosInterface = std::unique_ptr<PhotosInterfaceBase>(PhotosFactory::get()->create("Photos2155", pset.getUntrackedParameter< ParameterSet >(curSet)));
49  fPhotosInterface->configureOnlyFor( 15 );
50  fPhotosInterface->avoidTauLeptonicDecays();
53  }
54  else if ( curSet == "Photos" || curSet == "Photos2155" ) {
55  if ( !fPhotosInterface ) {
56  fPhotosInterface = std::unique_ptr<PhotosInterfaceBase>(PhotosFactory::get()->create("Photos2155", pset.getUntrackedParameter< ParameterSet>(curSet)));
58  }
59  }
60  else if (curSet == "Photospp" || curSet == "Photospp356" ) {
61  if ( !fPhotosInterface ) {
62  fPhotosInterface = std::unique_ptr<PhotosInterfaceBase>(PhotosFactory::get()->create("Photospp356", pset.getUntrackedParameter< ParameterSet>(curSet)));
64  }
65  }
66  }
67 }
68 
70 
72  if(fTauolaInterface) fTauolaInterface->SetLHE(lheEvent);
73  return decay(evt);
74 }
75 
76 
78 {
79  if ( !fIsInitialized ) return evt;
80 
81  if ( fEvtGenInterface ) {
82  evt = fEvtGenInterface->decay( evt );
83  if ( !evt ) return nullptr;
84  }
85 
86  if ( fTauolaInterface ) {
87  evt = fTauolaInterface->decay( evt );
88  if ( !evt ) return nullptr;
89  }
90 
91  if ( fPhotosInterface ) {
92  evt = fPhotosInterface->apply( evt );
93  if ( !evt ) return nullptr;
94  }
95 
96  return evt;
97 }
98 
99 
101 {
102  if ( fIsInitialized ) return;
103 
104  if ( fTauolaInterface ) {
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  fEvtGenInterface->init();
113  for ( std::vector<int>::const_iterator i=fEvtGenInterface->operatesOnParticles().begin();
114  i!=fEvtGenInterface->operatesOnParticles().end(); i++ )
115  fPDGs.push_back( *i );
116  for ( unsigned int iss=0; iss<fEvtGenInterface->specialSettings().size(); iss++ ) {
117  fSpecialSettings.push_back( fEvtGenInterface->specialSettings()[iss] );
118  }
119 
120  }
121 
122  if ( fPhotosInterface ) {
123  fPhotosInterface->init();
124  // for tauola++
125  if ( fPhotosInterface ) {
126  for ( unsigned int iss=0; iss<fPhotosInterface->specialSettings().size(); iss++ ){
127  fSpecialSettings.push_back( fPhotosInterface->specialSettings()[iss] );
128  }
129  }
130  }
131 
132  fIsInitialized = true;
133 
134  return;
135 }
136 
137 
139 {
140  if ( fTauolaInterface ) fTauolaInterface->statistics();
141  if ( fPhotosInterface ) fPhotosInterface->statistics();
142  // similar for EvtGen if needed
143  return;
144 }
145 
146 
147 void ExternalDecayDriver::setRandomEngine(CLHEP::HepRandomEngine* v)
148 {
149  if ( fTauolaInterface ) fTauolaInterface->setRandomEngine(v);
150  if ( fEvtGenInterface ) fEvtGenInterface->setRandomEngine(v);
151  if ( fPhotosInterface ) fPhotosInterface->setRandomEngine(v);
152 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::unique_ptr< PhotosInterfaceBase > fPhotosInterface
static const std::string kTauola
static const std::string kPhotos
double v[5][pyjets_maxn]
void init(const edm::EventSetup &)
static const std::string kPythia6
static const std::string kEvtGen
std::vector< std::string > exSharedResources
std::unique_ptr< EvtGenInterfaceBase > fEvtGenInterface
std::vector< std::string > fSpecialSettings
std::unique_ptr< TauolaInterfaceBase > fTauolaInterface
static const std::string kFortranInstance
HepMC::GenEvent * decay(HepMC::GenEvent *evt)
ExternalDecayDriver(const edm::ParameterSet &)
HLT enums.
static const std::string kPythia8
void setRandomEngine(CLHEP::HepRandomEngine *)
T get(const Candidate &c)
Definition: component.h:55