CMS 3D CMS Logo

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)
 
 ~LHAupLesHouches () override
 

Private Member Functions

bool setEvent (int idProcIn) override
 
bool setInit () override
 

Private Attributes

lhef::LHEEventevent
 
std::map< std::string, std::string > * fEvAttributes
 
lhef::LHERunInforunInfo
 
bool setScalesFromLHEF_
 

Detailed Description

Definition at line 20 of file LHAupLesHouches.h.

Constructor & Destructor Documentation

◆ LHAupLesHouches()

LHAupLesHouches::LHAupLesHouches ( )
inline

Definition at line 22 of file LHAupLesHouches.h.

22 : setScalesFromLHEF_(false), fEvAttributes(nullptr) { ; }

◆ ~LHAupLesHouches()

LHAupLesHouches::~LHAupLesHouches ( )
inlineoverride

Definition at line 32 of file LHAupLesHouches.h.

32  {
33  if (fEvAttributes)
34  delete fEvAttributes;
35  }

References fEvAttributes.

Member Function Documentation

◆ loadEvent()

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

Definition at line 28 of file LHAupLesHouches.h.

28 { this->event = event; }

References event.

◆ loadRunInfo()

void LHAupLesHouches::loadRunInfo ( lhef::LHERunInfo runInfo)
inline

Definition at line 25 of file LHAupLesHouches.h.

25 { this->runInfo = runInfo; }

References runInfo.

◆ setEvent()

bool LHAupLesHouches::setEvent ( int  idProcIn)
overrideprivate

Definition at line 50 of file LHAupLesHouches.cc.

50  {
51  if (!event)
52  return false;
53 
54  if (event->getReadAttempts() > 0)
55  return false; // record already tried
56 
57  const lhef::HEPEUP &hepeup = *event->getHEPEUP();
58 
59  if (!hepeup.NUP)
60  return false;
61 
62  setProcess(hepeup.IDPRUP, hepeup.XWGTUP, hepeup.SCALUP, hepeup.AQEDUP, hepeup.AQCDUP);
63 
64  const std::vector<float> &scales = event->scales();
65 
66  unsigned int iscale = 0;
67  for (int i = 0; i < hepeup.NUP; i++) {
68  //retrieve scale corresponding to each particle
69  double scalein = -1.;
70 
71  //handle clustering scales if present,
72  //applies to outgoing partons only
73  if (setScalesFromLHEF_ && !scales.empty() && hepeup.ISTUP[i] == 1) {
74  if (iscale >= scales.size()) {
75  edm::LogError("InvalidLHEInput") << "Pythia8 requires"
76  << "cluster scales for all outgoing partons or for none" << std::endl;
77  }
78  scalein = scales[iscale];
79  ++iscale;
80  }
81 
82  addParticle(hepeup.IDUP[i],
83  hepeup.ISTUP[i],
84  hepeup.MOTHUP[i].first,
85  hepeup.MOTHUP[i].second,
86  hepeup.ICOLUP[i].first,
87  hepeup.ICOLUP[i].second,
88  hepeup.PUP[i][0],
89  hepeup.PUP[i][1],
90  hepeup.PUP[i][2],
91  hepeup.PUP[i][3],
92  hepeup.PUP[i][4],
93  hepeup.VTIMUP[i],
94  hepeup.SPINUP[i],
95  scalein);
96  }
97 
98  if (!infoPtr->eventAttributes) {
99  fEvAttributes->clear();
100  infoPtr->eventAttributes = fEvAttributes;
101  } else {
102  infoPtr->eventAttributes = fEvAttributes; // make sure still there
103  infoPtr->eventAttributes->clear();
104  }
105 
106  //fill parton multiplicities if available
107  int npLO = event->npLO();
108  int npNLO = event->npNLO();
109 
110  //default value of -99 indicates tags were not present in the original LHE file
111  //don't pass to pythia in this case to emulate pythia internal lhe reader behaviour
112  if (npLO != -99) {
113  char buffer[100];
114  snprintf(buffer, 100, "%i", npLO);
115  (*infoPtr->eventAttributes)["npLO"] = buffer;
116  }
117  if (npNLO != -99) {
118  char buffer[100];
119  snprintf(buffer, 100, "%i", npNLO);
120  (*infoPtr->eventAttributes)["npNLO"] = buffer;
121  }
122 
123  //add #rwgt info from comments
124  const std::vector<std::string> &comments = event->getComments();
125  for (unsigned i = 0; i < comments.size(); i++) {
126  if (comments[i].rfind("#rwgt", 0) == 0)
127  (*infoPtr->eventAttributes)["#rwgt"] = comments[i];
128  }
129 
130  const lhef::LHEEvent::PDF *pdf = event->getPDF();
131  if (pdf) {
132  this->setPdf(pdf->id.first,
133  pdf->id.second,
134  pdf->x.first,
135  pdf->x.second,
136  pdf->scalePDF,
137  pdf->xPDF.first,
138  pdf->xPDF.second,
139  true);
140  } else {
141  this->setPdf(hepeup.IDUP[0],
142  hepeup.IDUP[1],
143  hepeup.PUP[0][3] / runInfo->getHEPRUP()->EBMUP.first,
144  hepeup.PUP[1][3] / runInfo->getHEPRUP()->EBMUP.second,
145  0.,
146  0.,
147  0.,
148  false);
149  }
150 
151  event->attempted();
152 
153  return true;
154 }

References lhef::HEPEUP::AQCDUP, lhef::HEPEUP::AQEDUP, edmScanValgrind::buffer, indexGen::comments, mps_fire::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.

◆ setInit()

bool LHAupLesHouches::setInit ( )
overrideprivate

Definition at line 14 of file LHAupLesHouches.cc.

14  {
15  if (!runInfo)
16  return false;
17  const lhef::HEPRUP &heprup = *runInfo->getHEPRUP();
18 
19  setBeamA(heprup.IDBMUP.first, heprup.EBMUP.first, heprup.PDFGUP.first, heprup.PDFSUP.first);
20  setBeamB(heprup.IDBMUP.second, heprup.EBMUP.second, heprup.PDFGUP.second, heprup.PDFSUP.second);
21  setStrategy(heprup.IDWTUP);
22 
23  for (int i = 0; i < heprup.NPRUP; i++)
24  addProcess(heprup.LPRUP[i], heprup.XSECUP[i], heprup.XERRUP[i], heprup.XMAXUP[i]);
25 
26  //hadronisation->onInit().emit();
27 
28  //runInfo.reset();
29 
30  //fill SLHA header information if available
31  std::vector<std::string> slha = runInfo->findHeader("slha");
32  if (!slha.empty()) {
33  std::string slhaheader;
34  for (std::vector<std::string>::const_iterator iter = slha.begin(); iter != slha.end(); ++iter) {
35  slhaheader.append(*iter);
36  }
37  infoPtr->setHeader("slha", slhaheader);
38  }
39 
40  //will be used to work around missing initialization inside pythia8
41  if (!fEvAttributes) {
42  fEvAttributes = new std::map<std::string, std::string>;
43  } else {
44  fEvAttributes->clear();
45  }
46 
47  return true;
48 }

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

◆ setScalesFromLHEF()

void LHAupLesHouches::setScalesFromLHEF ( bool  b)
inline

Definition at line 30 of file LHAupLesHouches.h.

30 { setScalesFromLHEF_ = b; }

References b, and setScalesFromLHEF_.

Member Data Documentation

◆ event

lhef::LHEEvent* LHAupLesHouches::event
private

◆ fEvAttributes

std::map<std::string, std::string>* LHAupLesHouches::fEvAttributes
private

Definition at line 49 of file LHAupLesHouches.h.

Referenced by ~LHAupLesHouches().

◆ runInfo

lhef::LHERunInfo* LHAupLesHouches::runInfo
private

Definition at line 42 of file LHAupLesHouches.h.

Referenced by loadRunInfo().

◆ setScalesFromLHEF_

bool LHAupLesHouches::setScalesFromLHEF_
private

Definition at line 47 of file LHAupLesHouches.h.

Referenced by setScalesFromLHEF().

lhef::HEPEUP::AQCDUP
double AQCDUP
Definition: LesHouches.h:218
lhef::HEPRUP::XSECUP
std::vector< double > XSECUP
Definition: LesHouches.h:112
mps_fire.i
i
Definition: mps_fire.py:355
lhef::HEPEUP::MOTHUP
std::vector< std::pair< int, int > > MOTHUP
Definition: LesHouches.h:234
gen::PdfInfo::x
std::pair< double, double > x
Definition: PdfInfo.h:13
lhef::HEPEUP::ISTUP
std::vector< int > ISTUP
Definition: LesHouches.h:228
lhef::HEPEUP::SPINUP
std::vector< double > SPINUP
Definition: LesHouches.h:259
LHAupLesHouches::runInfo
lhef::LHERunInfo * runInfo
Definition: LHAupLesHouches.h:42
edmScanValgrind.buffer
buffer
Definition: edmScanValgrind.py:171
lhef::HEPRUP::EBMUP
std::pair< double, double > EBMUP
Definition: LesHouches.h:82
gen::PdfInfo
Definition: PdfInfo.h:11
lhef::HEPEUP::NUP
int NUP
Definition: LesHouches.h:184
gen::PdfInfo::xPDF
std::pair< double, double > xPDF
Definition: PdfInfo.h:14
lhef::HEPRUP::LPRUP
std::vector< int > LPRUP
Definition: LesHouches.h:128
b
double b
Definition: hdecay.h:118
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
lhef::HEPEUP::ICOLUP
std::vector< std::pair< int, int > > ICOLUP
Definition: LesHouches.h:240
indexGen.comments
comments
Definition: indexGen.py:75
lhef::HEPRUP::PDFGUP
std::pair< int, int > PDFGUP
Definition: LesHouches.h:88
edm::LogError
Definition: MessageLogger.h:183
lhef::HEPEUP::VTIMUP
std::vector< double > VTIMUP
Definition: LesHouches.h:252
lhef::HEPRUP::NPRUP
int NPRUP
Definition: LesHouches.h:107
lhef::HEPRUP
Definition: LesHouches.h:22
lhef::HEPRUP::IDWTUP
int IDWTUP
Definition: LesHouches.h:101
lhef::HEPEUP::AQEDUP
double AQEDUP
Definition: LesHouches.h:213
lhef::HEPEUP
Definition: LesHouches.h:138
lhef::LHERunInfo::getHEPRUP
const HEPRUP * getHEPRUP() const
Definition: LHERunInfo.h:51
gen::PdfInfo::scalePDF
double scalePDF
Definition: PdfInfo.h:15
lhef::HEPEUP::XWGTUP
double XWGTUP
Definition: LesHouches.h:194
LHAupLesHouches::setScalesFromLHEF_
bool setScalesFromLHEF_
Definition: LHAupLesHouches.h:47
lhef::HEPRUP::XERRUP
std::vector< double > XERRUP
Definition: LesHouches.h:118
lhef::HEPRUP::PDFSUP
std::pair< int, int > PDFSUP
Definition: LesHouches.h:94
lhef::HEPEUP::IDUP
std::vector< int > IDUP
Definition: LesHouches.h:223
gen::PdfInfo::id
std::pair< int, int > id
Definition: PdfInfo.h:12
lhef::HEPEUP::IDPRUP
int IDPRUP
Definition: LesHouches.h:189
lhef::HEPRUP::XMAXUP
std::vector< double > XMAXUP
Definition: LesHouches.h:123
event
Definition: event.py:1
lhef::LHERunInfo::findHeader
std::vector< std::string > findHeader(const std::string &tag) const
Definition: LHERunInfo.cc:436
LHAupLesHouches::event
lhef::LHEEvent * event
Definition: LHAupLesHouches.h:44
lhef::HEPEUP::PUP
std::vector< FiveVector > PUP
Definition: LesHouches.h:246
lhef::HEPEUP::SCALUP
double SCALUP
Definition: LesHouches.h:208
LHAupLesHouches::fEvAttributes
std::map< std::string, std::string > * fEvAttributes
Definition: LHAupLesHouches.h:49
lhef::HEPRUP::IDBMUP
std::pair< int, int > IDBMUP
Definition: LesHouches.h:77