CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
myPythia6ServiceWithCallback Class Reference
Inheritance diagram for myPythia6ServiceWithCallback:
gen::Pythia6Service gen::FortranInstance

Public Member Functions

 myPythia6ServiceWithCallback (const edm::ParameterSet &cfg)
 
void setEvent (const HepMC::GenEvent *genEvt)
 
 ~myPythia6ServiceWithCallback ()
 
- Public Member Functions inherited from gen::Pythia6Service
void closePYUPDA ()
 
void closeSLHA ()
 
virtual void enter ()
 
void openPYUPDA (const char *, bool write_file)
 
void openSLHA (const char *)
 
 Pythia6Service ()
 
 Pythia6Service (edm::ParameterSet const &)
 
CLHEP::HepRandomEngine * randomEngine () const
 
void setCSAParams ()
 
void setGeneralParams ()
 
void setPYUPDAParams (bool afterPyinit)
 
void setRandomEngine (CLHEP::HepRandomEngine *v)
 
void setSLHAFromHeader (const std::vector< std::string > &lines)
 
void setSLHAParams ()
 
 ~Pythia6Service ()
 
- Public Member Functions inherited from gen::FortranInstance
void call (void(&fn)())
 
template<typename T >
T call (T(&fn)())
 
template<typename A >
void call (void(&fn)(A), A a)
 
template<typename T , typename A >
T call (T(&fn)(A), A a)
 
template<typename A1 , typename A2 >
void call (void(&fn)(A1, A2), A1 a1, A2 a2)
 
template<typename T , typename A1 , typename A2 >
T call (T(&fn)(A1, A2), A1 a1, A2 a2)
 
 FortranInstance ()
 
virtual void leave ()
 
virtual ~FortranInstance ()
 

Private Member Functions

void upEvnt ()
 
void upInit ()
 
bool upVeto ()
 

Private Attributes

double beamEnergy_
 
const HepMC::GenEvent * genEvt_
 
int verbosity_
 

Additional Inherited Members

- Static Public Member Functions inherited from gen::FortranInstance
template<typename T >
static TgetInstance ()
 
- Static Public Attributes inherited from gen::FortranInstance
static const std::string kFortranInstance = "FortranInstance"
 

Detailed Description

Definition at line 32 of file GenMuonRadiationAlgorithm.cc.

Constructor & Destructor Documentation

myPythia6ServiceWithCallback::myPythia6ServiceWithCallback ( const edm::ParameterSet cfg)
inline

Definition at line 35 of file GenMuonRadiationAlgorithm.cc.

36  : gen::Pythia6Service(cfg),
37  beamEnergy_(cfg.getParameter<double>("beamEnergy")),
38  genEvt_(0),
39  verbosity_(cfg.getParameter<int>("verbosity"))
40  {}
T getParameter(std::string const &) const
myPythia6ServiceWithCallback::~myPythia6ServiceWithCallback ( )
inline

Definition at line 41 of file GenMuonRadiationAlgorithm.cc.

41 {}

Member Function Documentation

void myPythia6ServiceWithCallback::setEvent ( const HepMC::GenEvent *  genEvt)
inline

Definition at line 43 of file GenMuonRadiationAlgorithm.cc.

References TtGenEvtProducer_cfi::genEvt, and genEvt_.

Referenced by GenMuonRadiationAlgorithm::compFSR().

44  {
45  genEvt_ = genEvt;
46  }
void myPythia6ServiceWithCallback::upEvnt ( )
inlineprivatevirtual

Reimplemented from gen::FortranInstance.

Definition at line 71 of file GenMuonRadiationAlgorithm.cc.

References lhef::HEPEUP::AQCDUP, lhef::HEPEUP::AQEDUP, gather_cfg::cout, lhef::CommonBlocks::fillHEPEUP(), genEvt_, lhef::HEPEUP::ICOLUP, lhef::HEPEUP::IDPRUP, lhef::HEPEUP::IDUP, reco::if(), lhef::HEPEUP::ISTUP, lhef::HEPEUP::MOTHUP, lhef::HEPEUP::NUP, benchmark_cfg::pdgId, lhef::HEPEUP::PUP, lhef::HEPEUP::resize(), lhef::HEPEUP::SCALUP, lhef::HEPEUP::SPINUP, verbosity_, lhef::HEPEUP::VTIMUP, lhef::HEPEUP::XPDWUP, and lhef::HEPEUP::XWGTUP.

72  {
73  if ( verbosity_ ) std::cout << "<upEvnt>:" << std::endl;
74  int numParticles = 0;
75  for ( HepMC::GenEvent::particle_const_iterator genParticle = genEvt_->particles_begin();
76  genParticle != genEvt_->particles_end(); ++genParticle ) {
77  ++numParticles;
78  }
79  lhef::HEPEUP hepeup;
80  hepeup.NUP = numParticles;
81  if ( verbosity_ ) std::cout << " numParticles = " << numParticles << std::endl;
82  hepeup.IDPRUP = 1;
83  hepeup.XWGTUP = 1.;
84  hepeup.XPDWUP.first = 0.;
85  hepeup.XPDWUP.second = 0.;
86  hepeup.SCALUP = -1.;
87  hepeup.AQEDUP = -1.;
88  hepeup.AQCDUP = -1.;
89  hepeup.resize();
90  std::map<int, int> barcodeToIdxMap;
91  int genParticleIdx = 0;
92  for ( HepMC::GenEvent::particle_const_iterator genParticle = genEvt_->particles_begin();
93  genParticle != genEvt_->particles_end(); ++genParticle ) {
94  barcodeToIdxMap[(*genParticle)->barcode()] = genParticleIdx + 1; // CV: conversion between C++ and Fortran array index conventions
95  int pdgId = (*genParticle)->pdg_id();
96  hepeup.IDUP[genParticleIdx] = pdgId;
97  if ( pdgId == 2212 && !(*genParticle)->production_vertex() ) {
98  hepeup.ISTUP[genParticleIdx] = -1;
99  } else {
100  hepeup.ISTUP[genParticleIdx] = (*genParticle)->status();
101  }
102  if ( (*genParticle)->production_vertex() ) {
103  int firstMother = 0;
104  bool firstMother_initialized = false;
105  int lastMother = 0;
106  bool lastMother_initialized = false;
107  for ( HepMC::GenVertex::particles_in_const_iterator genMother = (*genParticle)->production_vertex()->particles_in_const_begin();
108  genMother != (*genParticle)->production_vertex()->particles_in_const_end(); ++genMother ) {
109  int genMotherBarcode = (*genMother)->barcode();
110  assert(barcodeToIdxMap.find(genMotherBarcode) != barcodeToIdxMap.end());
111  int genMotherIdx = barcodeToIdxMap[genMotherBarcode];
112  if ( genMotherIdx < firstMother || !firstMother_initialized ) {
113  firstMother = genMotherIdx;
114  firstMother_initialized = true;
115  }
116  if ( genMotherIdx > lastMother || !lastMother_initialized ) {
117  lastMother = genMotherIdx;
118  lastMother_initialized = true;
119  }
120  }
121  hepeup.MOTHUP[genParticleIdx].first = firstMother;
122  hepeup.MOTHUP[genParticleIdx].second = ( lastMother > firstMother ) ? lastMother : 0;
123  } else {
124  hepeup.MOTHUP[genParticleIdx].first = 0;
125  hepeup.MOTHUP[genParticleIdx].second = 0;
126  }
127  hepeup.ICOLUP[genParticleIdx].first = 0;
128  hepeup.ICOLUP[genParticleIdx].second = 0;
129  hepeup.PUP[genParticleIdx][0] = (*genParticle)->momentum().px();
130  hepeup.PUP[genParticleIdx][1] = (*genParticle)->momentum().py();
131  hepeup.PUP[genParticleIdx][2] = (*genParticle)->momentum().pz();
132  hepeup.PUP[genParticleIdx][3] = (*genParticle)->momentum().e();
133  hepeup.PUP[genParticleIdx][4] = (*genParticle)->momentum().m();
134  if ( (*genParticle)->status() == 1 ) hepeup.VTIMUP[genParticleIdx] = 1.e+6;
135  else hepeup.VTIMUP[genParticleIdx] = 0.;
136  hepeup.SPINUP[genParticleIdx] = 9;
137  if ( verbosity_ ) {
138  std::cout << "adding genParticle #" << (genParticleIdx + 1)
139  << " (pdgId = " << hepeup.IDUP[genParticleIdx] << ", status = " << hepeup.ISTUP[genParticleIdx] << "):"
140  << " En = " << hepeup.PUP[genParticleIdx][3] << ","
141  << " Px = " << hepeup.PUP[genParticleIdx][0] << ","
142  << " Py = " << hepeup.PUP[genParticleIdx][1] << ","
143  << " Pz = " << hepeup.PUP[genParticleIdx][2] << " (mass = " << hepeup.PUP[genParticleIdx][4] << ")" << std::endl;
144  std::cout << "(mothers = " << hepeup.MOTHUP[genParticleIdx].first << ":" << hepeup.MOTHUP[genParticleIdx].second << ")" << std::endl;
145  }
146  ++genParticleIdx;
147  }
149  }
std::vector< double > VTIMUP
Definition: LesHouches.h:254
std::pair< double, double > XPDWUP
Definition: LesHouches.h:204
std::vector< std::pair< int, int > > MOTHUP
Definition: LesHouches.h:236
void resize(int nup)
Definition: LesHouches.h:161
std::vector< FiveVector > PUP
Definition: LesHouches.h:248
static void fillHEPEUP(const HEPEUP *hepeup)
std::vector< double > SPINUP
Definition: LesHouches.h:261
std::vector< int > ISTUP
Definition: LesHouches.h:230
std::vector< int > IDUP
Definition: LesHouches.h:225
double AQCDUP
Definition: LesHouches.h:220
if(dp >Float(M_PI)) dp-
tuple cout
Definition: gather_cfg.py:121
double AQEDUP
Definition: LesHouches.h:215
double XWGTUP
Definition: LesHouches.h:196
std::vector< std::pair< int, int > > ICOLUP
Definition: LesHouches.h:242
double SCALUP
Definition: LesHouches.h:210
void myPythia6ServiceWithCallback::upInit ( )
inlineprivatevirtual

Reimplemented from gen::FortranInstance.

Definition at line 49 of file GenMuonRadiationAlgorithm.cc.

References beamEnergy_, gather_cfg::cout, alignCSCRings::e, lhef::HEPRUP::EBMUP, lhef::CommonBlocks::fillHEPRUP(), lhef::HEPRUP::IDBMUP, lhef::HEPRUP::IDWTUP, lhef::HEPRUP::LPRUP, lhef::HEPRUP::NPRUP, lhef::HEPRUP::PDFGUP, lhef::HEPRUP::PDFSUP, verbosity_, lhef::HEPRUP::XERRUP, lhef::HEPRUP::XMAXUP, and lhef::HEPRUP::XSECUP.

50  {
51  // initialize LEs Houches accord common block (see hep-ph/0109068)
52  // needed to run PYTHIA in parton shower mode
53  if ( verbosity_ ) std::cout << "<upInit:" << std::endl;
54  lhef::HEPRUP heprup;
55  heprup.IDBMUP.first = 2212;
56  heprup.IDBMUP.second = 2212;
57  heprup.EBMUP.first = beamEnergy_;
58  heprup.EBMUP.second = beamEnergy_;
59  heprup.PDFGUP.first = -9; // CV: LHE input event contains proton remnants
60  heprup.PDFGUP.second = -9;
61  heprup.PDFSUP.first = 10042;
62  heprup.PDFSUP.second = 10042;
63  heprup.IDWTUP = 3;
64  heprup.NPRUP = 1;
65  heprup.XSECUP.push_back(1.e+3);
66  heprup.XERRUP.push_back(0.);
67  heprup.XMAXUP.push_back(1.);
68  heprup.LPRUP.push_back(1);
70  }
std::pair< double, double > EBMUP
Definition: LesHouches.h:78
std::pair< int, int > IDBMUP
Definition: LesHouches.h:73
std::pair< int, int > PDFGUP
Definition: LesHouches.h:84
std::vector< double > XERRUP
Definition: LesHouches.h:114
std::vector< double > XMAXUP
Definition: LesHouches.h:119
std::pair< int, int > PDFSUP
Definition: LesHouches.h:90
tuple cout
Definition: gather_cfg.py:121
std::vector< double > XSECUP
Definition: LesHouches.h:108
static void fillHEPRUP(const HEPRUP *heprup)
std::vector< int > LPRUP
Definition: LesHouches.h:124
bool myPythia6ServiceWithCallback::upVeto ( )
inlineprivatevirtual

Reimplemented from gen::FortranInstance.

Definition at line 150 of file GenMuonRadiationAlgorithm.cc.

References gather_cfg::cout, and verbosity_.

151  {
152  if ( verbosity_ ) std::cout << "<upVeto>:" << std::endl;
153  return false; // keep current event
154  }
tuple cout
Definition: gather_cfg.py:121

Member Data Documentation

double myPythia6ServiceWithCallback::beamEnergy_
private

Definition at line 156 of file GenMuonRadiationAlgorithm.cc.

Referenced by upInit().

const HepMC::GenEvent* myPythia6ServiceWithCallback::genEvt_
private

Definition at line 158 of file GenMuonRadiationAlgorithm.cc.

Referenced by setEvent(), and upEvnt().

int myPythia6ServiceWithCallback::verbosity_
private

Definition at line 160 of file GenMuonRadiationAlgorithm.cc.

Referenced by upEvnt(), upInit(), and upVeto().