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 22 of file LHAupLesHouches.h.

Constructor & Destructor Documentation

LHAupLesHouches::LHAupLesHouches ( )
inline

Definition at line 24 of file LHAupLesHouches.h.

24 : setScalesFromLHEF_(false),fEvAttributes(nullptr) {;}
std::map< std::string, std::string > * fEvAttributes
LHAupLesHouches::~LHAupLesHouches ( )
inlineoverride

Definition at line 36 of file LHAupLesHouches.h.

References fEvAttributes, setEvent(), and setInit().

36 {if(fEvAttributes) delete fEvAttributes;}
std::map< std::string, std::string > * fEvAttributes

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)
overrideprivate

Definition at line 56 of file LHAupLesHouches.cc.

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.

Referenced by ~LHAupLesHouches().

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

Definition at line 16 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, AlCaHLTBitMon_QueryRunRegistry::string, lhef::HEPRUP::XERRUP, lhef::HEPRUP::XMAXUP, and lhef::HEPRUP::XSECUP.

Referenced by ~LHAupLesHouches().

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  //will be used to work around missing initialization inside pythia8
46  if(!fEvAttributes) {
47  fEvAttributes = new std::map<std::string, std::string >;
48  } else {
49  fEvAttributes->clear();
50  }
51 
52  return true;
53 }
std::pair< double, double > EBMUP
Definition: LesHouches.h:91
std::pair< int, int > IDBMUP
Definition: LesHouches.h:86
std::pair< int, int > PDFGUP
Definition: LesHouches.h:97
std::vector< double > XERRUP
Definition: LesHouches.h:127
std::vector< double > XMAXUP
Definition: LesHouches.h:132
const HEPRUP * getHEPRUP() const
Definition: LHERunInfo.h:52
std::pair< int, int > PDFSUP
Definition: LesHouches.h:103
lhef::LHERunInfo * runInfo
std::map< std::string, std::string > * fEvAttributes
std::vector< std::string > findHeader(const std::string &tag) const
Definition: LHERunInfo.cc:525
std::vector< double > XSECUP
Definition: LesHouches.h:121
std::vector< int > LPRUP
Definition: LesHouches.h:137
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
std::map<std::string, std::string>* LHAupLesHouches::fEvAttributes
private

Definition at line 51 of file LHAupLesHouches.h.

Referenced by ~LHAupLesHouches().

lhef::LHERunInfo* LHAupLesHouches::runInfo
private

Definition at line 44 of file LHAupLesHouches.h.

Referenced by loadRunInfo().

bool LHAupLesHouches::setScalesFromLHEF_
private

Definition at line 49 of file LHAupLesHouches.h.

Referenced by setScalesFromLHEF().