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) { ; }
std::map< std::string, std::string > * fEvAttributes

◆ ~LHAupLesHouches()

LHAupLesHouches::~LHAupLesHouches ( )
inlineoverride

Definition at line 32 of file LHAupLesHouches.h.

References fEvAttributes.

32  {
33  if (fEvAttributes)
34  delete fEvAttributes;
35  }
std::map< std::string, std::string > * fEvAttributes

Member Function Documentation

◆ loadEvent()

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

Definition at line 28 of file LHAupLesHouches.h.

References event.

28 { this->event = event; }
lhef::LHEEvent * event

◆ loadRunInfo()

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

Definition at line 25 of file LHAupLesHouches.h.

References runInfo.

25 { this->runInfo = runInfo; }
lhef::LHERunInfo * runInfo

◆ setEvent()

bool LHAupLesHouches::setEvent ( int  idProcIn)
overrideprivate

Definition at line 50 of file LHAupLesHouches.cc.

References lhef::HEPEUP::AQCDUP, lhef::HEPEUP::AQEDUP, edmScanValgrind::buffer, 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, submitPVValidationJobs::runInfo, gen::PdfInfo::scalePDF, lhef::HEPEUP::SCALUP, lhef::HEPEUP::SPINUP, lhef::HEPEUP::VTIMUP, gen::PdfInfo::x, gen::PdfInfo::xPDF, and lhef::HEPEUP::XWGTUP.

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 }
std::vector< std::pair< int, int > > ICOLUP
Definition: LesHouches.h:240
std::pair< double, double > EBMUP
Definition: LesHouches.h:82
std::pair< double, double > x
Definition: PdfInfo.h:13
std::vector< double > VTIMUP
Definition: LesHouches.h:252
Log< level::Error, false > LogError
const HEPRUP * getHEPRUP() const
Definition: LHERunInfo.h:51
std::pair< double, double > xPDF
Definition: PdfInfo.h:14
std::vector< FiveVector > PUP
Definition: LesHouches.h:246
std::vector< double > SPINUP
Definition: LesHouches.h:259
std::vector< int > ISTUP
Definition: LesHouches.h:228
std::vector< std::pair< int, int > > MOTHUP
Definition: LesHouches.h:234
std::vector< int > IDUP
Definition: LesHouches.h:223
std::pair< int, int > id
Definition: PdfInfo.h:12
double AQCDUP
Definition: LesHouches.h:218
lhef::LHERunInfo * runInfo
std::map< std::string, std::string > * fEvAttributes
double AQEDUP
Definition: LesHouches.h:213
double XWGTUP
Definition: LesHouches.h:194
double scalePDF
Definition: PdfInfo.h:15
Definition: event.py:1
double SCALUP
Definition: LesHouches.h:208

◆ setInit()

bool LHAupLesHouches::setInit ( )
overrideprivate

Definition at line 14 of file LHAupLesHouches.cc.

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, submitPVValidationJobs::runInfo, AlCaHLTBitMon_QueryRunRegistry::string, lhef::HEPRUP::XERRUP, lhef::HEPRUP::XMAXUP, and lhef::HEPRUP::XSECUP.

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 }
std::pair< double, double > EBMUP
Definition: LesHouches.h:82
std::pair< int, int > IDBMUP
Definition: LesHouches.h:77
const HEPRUP * getHEPRUP() const
Definition: LHERunInfo.h:51
std::pair< int, int > PDFGUP
Definition: LesHouches.h:88
std::vector< std::string > findHeader(const std::string &tag) const
Definition: LHERunInfo.cc:434
std::vector< double > XERRUP
Definition: LesHouches.h:118
std::vector< double > XMAXUP
Definition: LesHouches.h:123
std::pair< int, int > PDFSUP
Definition: LesHouches.h:94
lhef::LHERunInfo * runInfo
std::map< std::string, std::string > * fEvAttributes
std::vector< double > XSECUP
Definition: LesHouches.h:112
std::vector< int > LPRUP
Definition: LesHouches.h:128

◆ setScalesFromLHEF()

void LHAupLesHouches::setScalesFromLHEF ( bool  b)
inline

Definition at line 30 of file LHAupLesHouches.h.

References b, and setScalesFromLHEF_.

30 { setScalesFromLHEF_ = b; }
double b
Definition: hdecay.h:118

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