CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
gen::ExternalDecayDriver Class Reference

#include <ExternalDecayDriver.h>

Public Member Functions

HepMC::GenEventdecay (HepMC::GenEvent *evt)
 
HepMC::GenEventdecay (HepMC::GenEvent *evt, lhef::LHEEvent *lheEvent)
 
 ExternalDecayDriver (const edm::ParameterSet &, edm::ConsumesCollector)
 
void init (const edm::EventSetup &)
 
const std::vector< int > & operatesOnParticles ()
 
void setRandomEngine (CLHEP::HepRandomEngine *)
 
std::vector< std::string > const & sharedResources () const
 
const std::vector< std::string > & specialSettings ()
 
void statistics () const
 
 ~ExternalDecayDriver ()
 

Private Attributes

std::vector< std::string > exSharedResources
 
std::unique_ptr< EvtGenInterfaceBasefEvtGenInterface
 
bool fIsInitialized
 
std::vector< int > fPDGs
 
std::unique_ptr< PhotosInterfaceBasefPhotosInterface
 
std::vector< std::string > fSpecialSettings
 
std::unique_ptr< TauolaInterfaceBasefTauolaInterface
 

Detailed Description

Definition at line 29 of file ExternalDecayDriver.h.

Constructor & Destructor Documentation

◆ ExternalDecayDriver()

ExternalDecayDriver::ExternalDecayDriver ( const edm::ParameterSet pset,
edm::ConsumesCollector  iCollector 
)

Definition at line 23 of file ExternalDecayDriver.cc.

References exSharedResources, fEvtGenInterface, fPhotosInterface, fTauolaInterface, get, edm::SharedResourceNames::kEvtGen, gen::FortranInstance::kFortranInstance, edm::SharedResourceNames::kPhotos, edm::SharedResourceNames::kPythia6, edm::SharedResourceNames::kPythia8, edm::SharedResourceNames::kTauola, muonDTDigis_cfi::pset, and AlCaHLTBitMon_QueryRunRegistry::string.

24  : fIsInitialized(false) {
25  std::vector<std::string> extGenNames = pset.getParameter<std::vector<std::string> >("parameterSets");
26 
27  for (unsigned int ip = 0; ip < extGenNames.size(); ++ip) {
28  std::string curSet = extGenNames[ip];
29  if (curSet == "EvtGen") {
30  fEvtGenInterface = std::unique_ptr<EvtGenInterfaceBase>(
31  EvtGenFactory::get()->create("EvtGen", pset.getUntrackedParameter<ParameterSet>(curSet)));
35  } else if (curSet == "EvtGen1" || curSet == "EvtGen130") {
36  fEvtGenInterface = std::unique_ptr<EvtGenInterfaceBase>(
37  EvtGenFactory::get()->create("EvtGen130", pset.getUntrackedParameter<ParameterSet>(curSet)));
43  } else if (curSet == "Tauola" || curSet == "Tauolapp" || curSet == "Tauolapp114") {
44  fTauolaInterface = std::unique_ptr<TauolaInterfaceBase>(
45  TauolaFactory::get()->create("Tauolapp114", pset.getUntrackedParameter<ParameterSet>(curSet), iCollector));
48  } else if (curSet == "Photospp" || curSet == "Photospp356") {
49  if (!fPhotosInterface) {
50  fPhotosInterface = std::unique_ptr<PhotosInterfaceBase>(
51  PhotosFactory::get()->create("Photospp356", pset.getUntrackedParameter<ParameterSet>(curSet)));
53  }
54  }
55  }
56 }
std::unique_ptr< PhotosInterfaceBase > fPhotosInterface
static const std::string kTauola
static const std::string kPhotos
static const std::string kPythia6
static const std::string kEvtGen
std::vector< std::string > exSharedResources
std::unique_ptr< EvtGenInterfaceBase > fEvtGenInterface
std::unique_ptr< TauolaInterfaceBase > fTauolaInterface
static const std::string kFortranInstance
#define get
static const std::string kPythia8

◆ ~ExternalDecayDriver()

ExternalDecayDriver::~ExternalDecayDriver ( )
default

Member Function Documentation

◆ decay() [1/2]

HepMC::GenEvent * ExternalDecayDriver::decay ( HepMC::GenEvent evt)

Definition at line 66 of file ExternalDecayDriver.cc.

References fEvtGenInterface, fIsInitialized, fPhotosInterface, and fTauolaInterface.

Referenced by decay().

66  {
67  if (!fIsInitialized)
68  return evt;
69 
70  if (fEvtGenInterface) {
71  evt = fEvtGenInterface->decay(evt);
72  if (!evt)
73  return nullptr;
74  }
75 
76  if (fTauolaInterface) {
77  evt = fTauolaInterface->decay(evt);
78  if (!evt)
79  return nullptr;
80  }
81 
82  if (fPhotosInterface) {
83  evt = fPhotosInterface->apply(evt);
84  if (!evt)
85  return nullptr;
86  }
87 
88  return evt;
89 }
std::unique_ptr< PhotosInterfaceBase > fPhotosInterface
std::unique_ptr< EvtGenInterfaceBase > fEvtGenInterface
std::unique_ptr< TauolaInterfaceBase > fTauolaInterface

◆ decay() [2/2]

HepMC::GenEvent * ExternalDecayDriver::decay ( HepMC::GenEvent evt,
lhef::LHEEvent lheEvent 
)

Definition at line 60 of file ExternalDecayDriver.cc.

References decay(), and fTauolaInterface.

60  {
61  if (fTauolaInterface)
62  fTauolaInterface->SetLHE(lheEvent);
63  return decay(evt);
64 }
std::unique_ptr< TauolaInterfaceBase > fTauolaInterface
HepMC::GenEvent * decay(HepMC::GenEvent *evt)

◆ init()

void ExternalDecayDriver::init ( const edm::EventSetup es)

Definition at line 91 of file ExternalDecayDriver.cc.

References fEvtGenInterface, fIsInitialized, fPDGs, fPhotosInterface, fSpecialSettings, fTauolaInterface, and mps_fire::i.

91  {
92  if (fIsInitialized)
93  return;
94 
95  if (fTauolaInterface) {
96  fTauolaInterface->init(es);
97  for (std::vector<int>::const_iterator i = fTauolaInterface->operatesOnParticles().begin();
98  i != fTauolaInterface->operatesOnParticles().end();
99  i++)
100  fPDGs.push_back(*i);
101  }
102 
103  if (fEvtGenInterface) {
104  fEvtGenInterface->init();
105  for (std::vector<int>::const_iterator i = fEvtGenInterface->operatesOnParticles().begin();
106  i != fEvtGenInterface->operatesOnParticles().end();
107  i++)
108  fPDGs.push_back(*i);
109  for (unsigned int iss = 0; iss < fEvtGenInterface->specialSettings().size(); iss++) {
110  fSpecialSettings.push_back(fEvtGenInterface->specialSettings()[iss]);
111  }
112  }
113 
114  if (fPhotosInterface) {
115  fPhotosInterface->init();
116  // for tauola++
117  if (fPhotosInterface) {
118  for (unsigned int iss = 0; iss < fPhotosInterface->specialSettings().size(); iss++) {
119  fSpecialSettings.push_back(fPhotosInterface->specialSettings()[iss]);
120  }
121  }
122  }
123 
124  fIsInitialized = true;
125 
126  return;
127 }
std::unique_ptr< PhotosInterfaceBase > fPhotosInterface
std::unique_ptr< EvtGenInterfaceBase > fEvtGenInterface
std::vector< std::string > fSpecialSettings
std::unique_ptr< TauolaInterfaceBase > fTauolaInterface

◆ operatesOnParticles()

const std::vector<int>& gen::ExternalDecayDriver::operatesOnParticles ( )
inline

Definition at line 37 of file ExternalDecayDriver.h.

References fPDGs.

37 { return fPDGs; }

◆ setRandomEngine()

void ExternalDecayDriver::setRandomEngine ( CLHEP::HepRandomEngine *  v)

Definition at line 138 of file ExternalDecayDriver.cc.

References fEvtGenInterface, fPhotosInterface, fTauolaInterface, and gen::v.

138  {
139  if (fTauolaInterface)
140  fTauolaInterface->setRandomEngine(v);
141  if (fEvtGenInterface)
142  fEvtGenInterface->setRandomEngine(v);
143  if (fPhotosInterface)
144  fPhotosInterface->setRandomEngine(v);
145 }
std::unique_ptr< PhotosInterfaceBase > fPhotosInterface
double v[5][pyjets_maxn]
std::unique_ptr< EvtGenInterfaceBase > fEvtGenInterface
std::unique_ptr< TauolaInterfaceBase > fTauolaInterface

◆ sharedResources()

std::vector<std::string> const& gen::ExternalDecayDriver::sharedResources ( ) const
inline

Definition at line 46 of file ExternalDecayDriver.h.

References exSharedResources.

46 { return exSharedResources; }
std::vector< std::string > exSharedResources

◆ specialSettings()

const std::vector<std::string>& gen::ExternalDecayDriver::specialSettings ( )
inline

Definition at line 38 of file ExternalDecayDriver.h.

References fSpecialSettings.

38 { return fSpecialSettings; }
std::vector< std::string > fSpecialSettings

◆ statistics()

void ExternalDecayDriver::statistics ( ) const

Definition at line 129 of file ExternalDecayDriver.cc.

References fPhotosInterface, and fTauolaInterface.

129  {
130  if (fTauolaInterface)
131  fTauolaInterface->statistics();
132  if (fPhotosInterface)
133  fPhotosInterface->statistics();
134  // similar for EvtGen if needed
135  return;
136 }
std::unique_ptr< PhotosInterfaceBase > fPhotosInterface
std::unique_ptr< TauolaInterfaceBase > fTauolaInterface

Member Data Documentation

◆ exSharedResources

std::vector<std::string> gen::ExternalDecayDriver::exSharedResources
private

Definition at line 56 of file ExternalDecayDriver.h.

Referenced by ExternalDecayDriver(), and sharedResources().

◆ fEvtGenInterface

std::unique_ptr<EvtGenInterfaceBase> gen::ExternalDecayDriver::fEvtGenInterface
private

Definition at line 51 of file ExternalDecayDriver.h.

Referenced by decay(), ExternalDecayDriver(), init(), and setRandomEngine().

◆ fIsInitialized

bool gen::ExternalDecayDriver::fIsInitialized
private

Definition at line 49 of file ExternalDecayDriver.h.

Referenced by decay(), and init().

◆ fPDGs

std::vector<int> gen::ExternalDecayDriver::fPDGs
private

Definition at line 53 of file ExternalDecayDriver.h.

Referenced by init(), and operatesOnParticles().

◆ fPhotosInterface

std::unique_ptr<PhotosInterfaceBase> gen::ExternalDecayDriver::fPhotosInterface
private

Definition at line 52 of file ExternalDecayDriver.h.

Referenced by decay(), ExternalDecayDriver(), init(), setRandomEngine(), and statistics().

◆ fSpecialSettings

std::vector<std::string> gen::ExternalDecayDriver::fSpecialSettings
private

Definition at line 54 of file ExternalDecayDriver.h.

Referenced by init(), and specialSettings().

◆ fTauolaInterface

std::unique_ptr<TauolaInterfaceBase> gen::ExternalDecayDriver::fTauolaInterface
private

Definition at line 50 of file ExternalDecayDriver.h.

Referenced by decay(), ExternalDecayDriver(), init(), setRandomEngine(), and statistics().