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
LHAupLesHouches Class Reference

#include <LHAupLesHouches.h>

Inheritance diagram for LHAupLesHouches:

Public Member Functions

 LHAupLesHouches ()
 
void loadEvent (lhef::LHEEvent *event)
 
void loadRunInfo (lhef::LHERunInfo *runInfo)
 
void setScalesFromLHEF (bool b)
 

Private Member Functions

bool setEvent (int idProcIn)
 
bool setInit ()
 

Private Attributes

lhef::LHEEventevent
 
lhef::LHERunInforunInfo
 
bool setScalesFromLHEF_
 

Detailed Description

Definition at line 22 of file LHAupLesHouches.h.

Constructor & Destructor Documentation

LHAupLesHouches::LHAupLesHouches ( )
inline

Definition at line 24 of file LHAupLesHouches.h.

24 : setScalesFromLHEF_(false) {;}

Member Function Documentation

void LHAupLesHouches::loadEvent ( lhef::LHEEvent event)
inline

Definition at line 31 of file LHAupLesHouches.h.

References event.

32  { this->event = event; }
lhef::LHEEvent * event
void LHAupLesHouches::loadRunInfo ( lhef::LHERunInfo runInfo)
inline

Definition at line 27 of file LHAupLesHouches.h.

References runInfo.

28  { this->runInfo = runInfo; }
lhef::LHERunInfo * runInfo
bool LHAupLesHouches::setEvent ( int  idProcIn)
private

Definition at line 53 of file LHAupLesHouches.cc.

References lhef::HEPEUP::AQCDUP, lhef::HEPEUP::AQEDUP, event(), i, lhef::HEPEUP::ICOLUP, gen::PdfInfo::id, lhef::HEPEUP::IDPRUP, lhef::HEPEUP::IDUP, lhef::HEPEUP::ISTUP, lhef::HEPEUP::MOTHUP, lhef::HEPEUP::NUP, lhef::HEPEUP::PUP, gen::PdfInfo::scalePDF, lhef::HEPEUP::SCALUP, lhef::HEPEUP::SPINUP, lhef::HEPEUP::VTIMUP, gen::PdfInfo::x, gen::PdfInfo::xPDF, and lhef::HEPEUP::XWGTUP.

54 {
55  if (!event) return false;
56 
57  if ( event->getReadAttempts() > 0 ) return false; // record already tried
58 
59  const lhef::HEPEUP &hepeup = *event->getHEPEUP();
60 
61  if ( !hepeup.NUP ) return false;
62 
63  setProcess(hepeup.IDPRUP, hepeup.XWGTUP, hepeup.SCALUP,
64  hepeup.AQEDUP, hepeup.AQCDUP);
65 
66  const std::vector<float> &scales = event->scales();
67 
68  unsigned int iscale = 0;
69  for(int i = 0; i < hepeup.NUP; i++) {
70  //retrieve scale corresponding to each particle
71  double scalein = -1.;
72 
73  //handle clustering scales if present,
74  //applies to outgoing partons only
75  if (setScalesFromLHEF_ && scales.size()>0 && hepeup.ISTUP[i]==1) {
76  if (iscale>=scales.size()) {
77  edm::LogError("InvalidLHEInput") << "Pythia8 requires"
78  << "cluster scales for all outgoing partons or for none"
79  << std::endl;
80  }
81  scalein = scales[iscale];
82  ++iscale;
83  }
84 
85  addParticle(hepeup.IDUP[i], hepeup.ISTUP[i],
86  hepeup.MOTHUP[i].first, hepeup.MOTHUP[i].second,
87  hepeup.ICOLUP[i].first, hepeup.ICOLUP[i].second,
88  hepeup.PUP[i][0], hepeup.PUP[i][1],
89  hepeup.PUP[i][2], hepeup.PUP[i][3],
90  hepeup.PUP[i][4], hepeup.VTIMUP[i],
91  hepeup.SPINUP[i],scalein);
92  }
93 
94  infoPtr->eventAttributes->clear();
95 
96  //fill parton multiplicities if available
97  int npLO = event->npLO();
98  int npNLO = event->npNLO();
99 
100  //default value of -99 indicates tags were not present in the original LHE file
101  //don't pass to pythia in this case to emulate pythia internal lhe reader behaviour
102  if (npLO!=-99) {
103  char buffer [100];
104  snprintf( buffer, 100, "%i",npLO);
105  (*infoPtr->eventAttributes)["npLO"] = buffer;
106  }
107  if (npNLO!=-99) {
108  char buffer [100];
109  snprintf( buffer, 100, "%i",npNLO);
110  (*infoPtr->eventAttributes)["npNLO"] = buffer;
111  }
112 
113  const lhef::LHEEvent::PDF *pdf = event->getPDF();
114  if (pdf) {
115  this->setPdf(pdf->id.first, pdf->id.second,
116  pdf->x.first, pdf->x.second,
117  pdf->scalePDF,
118  pdf->xPDF.first, pdf->xPDF.second, true);
119  }
120  else {
121  this->setPdf(hepeup.IDUP[0], hepeup.IDUP[1],
122  hepeup.PUP[0][3] / runInfo->getHEPRUP()->EBMUP.first,
123  hepeup.PUP[1][3] / runInfo->getHEPRUP()->EBMUP.second,
124  0., 0., 0., false);
125  }
126 
127  event->attempted();
128 
129  return true;
130 }
int i
Definition: DBlmapReader.cc:9
std::pair< double, double > EBMUP
Definition: LesHouches.h:78
std::pair< double, double > x
Definition: PdfInfo.h:11
lhef::LHEEvent * event
std::vector< double > VTIMUP
Definition: LesHouches.h:254
const int getReadAttempts()
Definition: LHEEvent.h:47
std::pair< double, double > xPDF
Definition: PdfInfo.h:12
std::vector< std::pair< int, int > > MOTHUP
Definition: LesHouches.h:236
std::vector< FiveVector > PUP
Definition: LesHouches.h:248
std::vector< double > SPINUP
Definition: LesHouches.h:261
std::vector< int > ISTUP
Definition: LesHouches.h:230
std::vector< int > IDUP
Definition: LesHouches.h:225
std::pair< int, int > id
Definition: PdfInfo.h:10
double AQCDUP
Definition: LesHouches.h:220
const HEPRUP * getHEPRUP() const
Definition: LHERunInfo.h:52
lhef::LHERunInfo * runInfo
double AQEDUP
Definition: LesHouches.h:215
double XWGTUP
Definition: LesHouches.h:196
double scalePDF
Definition: PdfInfo.h:13
std::vector< std::pair< int, int > > ICOLUP
Definition: LesHouches.h:242
double SCALUP
Definition: LesHouches.h:210
bool LHAupLesHouches::setInit ( )
private

Definition at line 16 of file LHAupLesHouches.cc.

References lhef::HEPRUP::EBMUP, i, lhef::HEPRUP::IDBMUP, lhef::HEPRUP::IDWTUP, lhef::HEPRUP::LPRUP, lhef::HEPRUP::NPRUP, lhef::HEPRUP::PDFGUP, lhef::HEPRUP::PDFSUP, lhef::HEPRUP::XERRUP, lhef::HEPRUP::XMAXUP, and lhef::HEPRUP::XSECUP.

17 {
18  if (!runInfo) return false;
19  const lhef::HEPRUP &heprup = *runInfo->getHEPRUP();
20 
21  setBeamA(heprup.IDBMUP.first, heprup.EBMUP.first,
22  heprup.PDFGUP.first, heprup.PDFSUP.first);
23  setBeamB(heprup.IDBMUP.second, heprup.EBMUP.second,
24  heprup.PDFGUP.second, heprup.PDFSUP.second);
25  setStrategy(heprup.IDWTUP);
26 
27  for(int i = 0; i < heprup.NPRUP; i++)
28  addProcess(heprup.LPRUP[i], heprup.XSECUP[i],
29  heprup.XERRUP[i], heprup.XMAXUP[i]);
30 
31  //hadronisation->onInit().emit();
32 
33  //runInfo.reset();
34 
35  //fill SLHA header information if available
36  std::vector<std::string> slha = runInfo->findHeader("slha");
37  if (!slha.empty()) {
38  std::string slhaheader;
39  for(std::vector<std::string>::const_iterator iter = slha.begin(); iter != slha.end(); ++iter) {
40  slhaheader.append(*iter);
41  }
42  infoPtr->setHeader("slha",slhaheader);
43  }
44 
45  //work around missing initialization inside pythia8
46  infoPtr->eventAttributes = new std::map<std::string, std::string >;
47 
48 
49  return true;
50 }
int i
Definition: DBlmapReader.cc:9
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
const HEPRUP * getHEPRUP() const
Definition: LHERunInfo.h:52
std::pair< int, int > PDFSUP
Definition: LesHouches.h:90
lhef::LHERunInfo * runInfo
std::vector< std::string > findHeader(const std::string &tag) const
Definition: LHERunInfo.cc:529
std::vector< double > XSECUP
Definition: LesHouches.h:108
std::vector< int > LPRUP
Definition: LesHouches.h:124
void LHAupLesHouches::setScalesFromLHEF ( bool  b)
inline

Definition at line 34 of file LHAupLesHouches.h.

References b, and setScalesFromLHEF_.

34 { setScalesFromLHEF_ = b; }
double b
Definition: hdecay.h:120

Member Data Documentation

lhef::LHEEvent* LHAupLesHouches::event
private

Definition at line 44 of file LHAupLesHouches.h.

Referenced by loadEvent().

lhef::LHERunInfo* LHAupLesHouches::runInfo
private

Definition at line 42 of file LHAupLesHouches.h.

Referenced by loadRunInfo().

bool LHAupLesHouches::setScalesFromLHEF_
private

Definition at line 47 of file LHAupLesHouches.h.

Referenced by setScalesFromLHEF().