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 &)
 
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 ()
 

Detailed Description

Definition at line 33 of file GenMuonRadiationAlgorithm.cc.

Constructor & Destructor Documentation

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

Definition at line 36 of file GenMuonRadiationAlgorithm.cc.

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

Definition at line 42 of file GenMuonRadiationAlgorithm.cc.

42 {}

Member Function Documentation

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

Definition at line 44 of file GenMuonRadiationAlgorithm.cc.

References TtGenEvtProducer_cfi::genEvt, and genEvt_.

Referenced by GenMuonRadiationAlgorithm::compFSR().

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

Reimplemented from gen::FortranInstance.

Definition at line 72 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.

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

51  {
52  // initialize LEs Houches accord common block (see hep-ph/0109068)
53  // needed to run PYTHIA in parton shower mode
54  if ( verbosity_ ) std::cout << "<upInit:" << std::endl;
55  lhef::HEPRUP heprup;
56  heprup.IDBMUP.first = 2212;
57  heprup.IDBMUP.second = 2212;
58  heprup.EBMUP.first = beamEnergy_;
59  heprup.EBMUP.second = beamEnergy_;
60  heprup.PDFGUP.first = -9; // CV: LHE input event contains proton remnants
61  heprup.PDFGUP.second = -9;
62  heprup.PDFSUP.first = 10042;
63  heprup.PDFSUP.second = 10042;
64  heprup.IDWTUP = 3;
65  heprup.NPRUP = 1;
66  heprup.XSECUP.push_back(1.e+3);
67  heprup.XERRUP.push_back(0.);
68  heprup.XMAXUP.push_back(1.);
69  heprup.LPRUP.push_back(1);
71  }
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 151 of file GenMuonRadiationAlgorithm.cc.

References gather_cfg::cout, and verbosity_.

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

Member Data Documentation

double myPythia6ServiceWithCallback::beamEnergy_
private

Definition at line 157 of file GenMuonRadiationAlgorithm.cc.

Referenced by upInit().

const HepMC::GenEvent* myPythia6ServiceWithCallback::genEvt_
private

Definition at line 159 of file GenMuonRadiationAlgorithm.cc.

Referenced by setEvent(), and upEvnt().

int myPythia6ServiceWithCallback::verbosity_
private

Definition at line 161 of file GenMuonRadiationAlgorithm.cc.

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