CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes
lhef::LHEEvent Class Reference

#include <LHEEvent.h>

Public Types

typedef LHEEventProduct::PDF PDF
 
typedef LHEEventProduct::WGT WGT
 

Public Member Functions

void addComment (const std::string &line)
 
void addWeight (const WGT &wgt)
 
std::unique_ptr< HepMC::GenEventasHepMCEvent () const
 
void attempted ()
 
void count (LHERunInfo::CountMode count, double weight=1.0, double matchWeight=1.0)
 
void fillEventInfo (HepMC::GenEvent *hepmc) const
 
void fillPdfInfo (HepMC::PdfInfo *info) const
 
const std::vector< std::string > & getComments () const
 
const HEPEUPgetHEPEUP () const
 
const HEPRUPgetHEPRUP () const
 
const PDFgetPDF () const
 
const int getReadAttempts ()
 
const std::shared_ptr< LHERunInfo > & getRunInfo () const
 
 LHEEvent (const std::shared_ptr< LHERunInfo > &runInfo, const HEPEUP &hepeup)
 
 LHEEvent (const std::shared_ptr< LHERunInfo > &runInfo, const HEPEUP &hepeup, const LHEEventProduct::PDF *pdf, const std::vector< std::string > &comments)
 
 LHEEvent (const std::shared_ptr< LHERunInfo > &runInfo, const LHEEventProduct &product)
 
 LHEEvent (const std::shared_ptr< LHERunInfo > &runInfo, std::istream &in)
 
int npLO () const
 
int npNLO () const
 
double originalXWGTUP () const
 
void removeResonances (const std::vector< int > &ids)
 
const std::vector< float > & scales () const
 
void setNpLO (int n)
 
void setNpNLO (int n)
 
void setPDF (std::unique_ptr< PDF > pdf)
 
void setScales (const std::vector< float > &scales)
 
const std::vector< WGT > & weights () const
 
 ~LHEEvent ()
 

Static Public Member Functions

static const HepMC::GenVertex * findSignalVertex (const HepMC::GenEvent *event, bool status3=true)
 
static void fixHepMCEventTimeOrdering (HepMC::GenEvent *event)
 
static void removeParticle (lhef::HEPEUP &hepeup, int index)
 

Private Member Functions

HepMC::GenParticle * makeHepMCParticle (unsigned int i) const
 

Static Private Member Functions

static bool checkHepMCTree (const HepMC::GenEvent *event)
 

Private Attributes

std::vector< std::string > comments
 
bool counted
 
HEPEUP hepeup
 
int npLO_
 
int npNLO_
 
double originalXWGTUP_
 
std::unique_ptr< PDFpdf
 
int readAttemptCounter
 
const std::shared_ptr< LHERunInforunInfo
 
std::vector< float > scales_
 
std::vector< WGTweights_
 

Detailed Description

Definition at line 23 of file LHEEvent.h.

Member Typedef Documentation

◆ PDF

Definition at line 34 of file LHEEvent.h.

◆ WGT

Definition at line 35 of file LHEEvent.h.

Constructor & Destructor Documentation

◆ LHEEvent() [1/4]

lhef::LHEEvent::LHEEvent ( const std::shared_ptr< LHERunInfo > &  runInfo,
std::istream &  in 
)

Definition at line 35 of file LHEEvent.cc.

36  : runInfo(runInfo),
37  weights_(0),
38  counted(false),
40  npLO_(-99),
41  npNLO_(-99)
42 
43  {
44  hepeup.NUP = 0;
45  hepeup.XPDWUP.first = hepeup.XPDWUP.second = 0.0;
46 
48  if (!in.good())
49  throw cms::Exception("InvalidFormat") << "Les Houches file contained invalid"
50  " event header."
51  << std::endl;
52 
53  // store the original value of XWGTUP for the user
55 
56  int idwtup = runInfo->getHEPRUP()->IDWTUP;
57  if (idwtup >= 0 && hepeup.XWGTUP < 0) {
58  edm::LogWarning("Generator|LHEInterface") << "Non-allowed negative event weight encountered." << std::endl;
60  }
61 
62  if (std::abs(idwtup) == 3 && std::abs(hepeup.XWGTUP) != 1.) {
63  edm::LogInfo("Generator|LHEInterface") << "Event weight not set to one for abs(IDWTUP) == 3" << std::endl;
64  hepeup.XWGTUP = hepeup.XWGTUP > 0. ? 1.0 : -1.0;
65  }
66 
67  hepeup.resize();
68 
69  for (int i = 0; i < hepeup.NUP; i++) {
70  in >> hepeup.IDUP[i] >> hepeup.ISTUP[i] >> hepeup.MOTHUP[i].first >> hepeup.MOTHUP[i].second >>
71  hepeup.ICOLUP[i].first >> hepeup.ICOLUP[i].second >> hepeup.PUP[i][0] >> hepeup.PUP[i][1] >>
72  hepeup.PUP[i][2] >> hepeup.PUP[i][3] >> hepeup.PUP[i][4] >> hepeup.VTIMUP[i] >> hepeup.SPINUP[i];
73  if (!in.good())
74  throw cms::Exception("InvalidFormat") << "Les Houches file contained invalid event"
75  " in particle line "
76  << (i + 1) << "." << std::endl;
77  }
78 
79  while (skipWhitespace(in) == '#') {
81  std::getline(in, line);
82  std::istringstream ss(line);
84  ss >> tag;
85  if (tag == "#pdf") {
86  pdf.reset(new PDF);
87  ss >> pdf->id.first >> pdf->id.second >> pdf->x.first >> pdf->x.second >> pdf->scalePDF >> pdf->xPDF.first >>
88  pdf->xPDF.second;
89  if (ss.bad()) {
90  edm::LogWarning("Generator|LHEInterface") << "Les Houches event contained"
91  " unparseable PDF information."
92  << std::endl;
93  pdf.reset();
94  } else
95  continue;
96  }
97  comments.push_back(line + "\n");
98  }
99 
100  if (!in.eof())
101  edm::LogWarning("Generator|LHEInterface") << "Les Houches file contained spurious"
102  " content after event data."
103  << std::endl;
104  }

References funct::abs(), lhef::HEPEUP::AQCDUP, lhef::HEPEUP::AQEDUP, comments, hepeup, mps_fire::i, lhef::HEPEUP::ICOLUP, lhef::HEPEUP::IDPRUP, lhef::HEPEUP::IDUP, recoMuon::in, lhef::HEPEUP::ISTUP, mps_splice::line, lhef::HEPEUP::MOTHUP, lhef::HEPEUP::NUP, originalXWGTUP_, pdf, lhef::HEPEUP::PUP, lhef::HEPEUP::resize(), runInfo, lhef::HEPEUP::SCALUP, skipWhitespace(), lhef::HEPEUP::SPINUP, contentValuesCheck::ss, AlCaHLTBitMon_QueryRunRegistry::string, GlobalPosition_Frontier_DevDB_cff::tag, lhef::HEPEUP::VTIMUP, lhef::HEPEUP::XPDWUP, and lhef::HEPEUP::XWGTUP.

◆ LHEEvent() [2/4]

lhef::LHEEvent::LHEEvent ( const std::shared_ptr< LHERunInfo > &  runInfo,
const HEPEUP hepeup 
)

Definition at line 106 of file LHEEvent.cc.

107  : runInfo(runInfo), hepeup(hepeup), counted(false), readAttemptCounter(0), npLO_(-99), npNLO_(-99) {}

◆ LHEEvent() [3/4]

lhef::LHEEvent::LHEEvent ( const std::shared_ptr< LHERunInfo > &  runInfo,
const HEPEUP hepeup,
const LHEEventProduct::PDF pdf,
const std::vector< std::string > &  comments 
)

Definition at line 109 of file LHEEvent.cc.

113  : runInfo(runInfo),
114  hepeup(hepeup),
115  pdf(pdf ? new PDF(*pdf) : nullptr),
117  counted(false),
119  npLO_(-99),
120  npNLO_(-99) {}

◆ LHEEvent() [4/4]

lhef::LHEEvent::LHEEvent ( const std::shared_ptr< LHERunInfo > &  runInfo,
const LHEEventProduct product 
)

Definition at line 122 of file LHEEvent.cc.

123  : runInfo(runInfo),
124  hepeup(product.hepeup()),
125  pdf(product.pdf() ? new PDF(*product.pdf()) : nullptr),
126  weights_(product.weights()),
127  comments(product.comments_begin(), product.comments_end()),
128  counted(false),
130  originalXWGTUP_(product.originalXWGTUP()),
131  scales_(product.scales()),
132  npLO_(product.npLO()),
133  npNLO_(product.npNLO()) {}

◆ ~LHEEvent()

lhef::LHEEvent::~LHEEvent ( )

Definition at line 135 of file LHEEvent.cc.

135 {}

Member Function Documentation

◆ addComment()

void lhef::LHEEvent::addComment ( const std::string &  line)
inline

Definition at line 59 of file LHEEvent.h.

59 { comments.push_back(line); }

References comments, and mps_splice::line.

◆ addWeight()

void lhef::LHEEvent::addWeight ( const WGT wgt)
inline

Definition at line 44 of file LHEEvent.h.

44 { weights_.push_back(wgt); }

References weights_.

◆ asHepMCEvent()

std::unique_ptr< HepMC::GenEvent > lhef::LHEEvent::asHepMCEvent ( ) const

Definition at line 225 of file LHEEvent.cc.

225  {
226  std::unique_ptr<HepMC::GenEvent> hepmc(new HepMC::GenEvent);
227 
228  hepmc->set_signal_process_id(hepeup.IDPRUP);
229  hepmc->set_event_scale(hepeup.SCALUP);
230  hepmc->set_alphaQED(hepeup.AQEDUP);
231  hepmc->set_alphaQCD(hepeup.AQCDUP);
232 
233  unsigned int nup = hepeup.NUP; // particles in event
234 
235  // any particles in HEPEUP block?
236  if (!nup) {
237  edm::LogWarning("Generator|LHEInterface") << "Les Houches Event does not contain any partons. "
238  << "Not much to convert.";
239  return hepmc;
240  }
241 
242  // stores (pointers to) converted particles
243  std::vector<HepMC::GenParticle *> genParticles;
244  std::vector<HepMC::GenVertex *> genVertices;
245 
246  // I. convert particles
247  for (unsigned int i = 0; i < nup; i++)
248  genParticles.push_back(makeHepMCParticle(i));
249 
250  // II. loop again to build vertices
251  for (unsigned int i = 0; i < nup; i++) {
252  unsigned int mother1 = hepeup.MOTHUP.at(i).first;
253  unsigned int mother2 = hepeup.MOTHUP.at(i).second;
254  double cTau = hepeup.VTIMUP.at(i); // decay time
255 
256  // current particle has a mother? --- Sorry, parent! We're PC.
257  if (mother1) {
258  mother1--; // FORTRAN notation!
259  if (mother2)
260  mother2--;
261  else
262  mother2 = mother1;
263 
264  HepMC::GenParticle *in_par = genParticles.at(mother1);
265  HepMC::GenVertex *current_vtx = in_par->end_vertex(); // vertex of first mother
266 
267  if (!current_vtx) {
268  current_vtx = new HepMC::GenVertex(HepMC::FourVector(0, 0, 0, cTau));
269 
270  // add vertex to event
271  genVertices.push_back(current_vtx);
272  }
273 
274  for (unsigned int j = mother1; j <= mother2; j++) // set mother-daughter relations
275  if (!genParticles.at(j)->end_vertex())
276  current_vtx->add_particle_in(genParticles.at(j));
277 
278  // connect THIS outgoing particle to current vertex
279  current_vtx->add_particle_out(genParticles.at(i));
280  }
281  }
282 
283  checkHepMCTree(hepmc.get());
284 
285  // III. restore color flow
286  // ok, nobody knows how to do it so far...
287 
288  // IV. fill run information
289  const HEPRUP *heprup = getHEPRUP();
290 
291  // set beam particles
293  HepMC::FourVector(0.0, 0.0, +heprup->EBMUP.first, heprup->EBMUP.first), heprup->IDBMUP.first);
295  HepMC::FourVector(0.0, 0.0, -heprup->EBMUP.second, heprup->EBMUP.second), heprup->IDBMUP.second);
296  b1->set_status(3);
297  b2->set_status(3);
298 
299  HepMC::GenVertex *v1 = new HepMC::GenVertex();
300  HepMC::GenVertex *v2 = new HepMC::GenVertex();
301  v1->add_particle_in(b1);
302  v2->add_particle_in(b2);
303 
304  hepmc->add_vertex(v1);
305  hepmc->add_vertex(v2);
306  hepmc->set_beam_particles(b1, b2);
307 
308  // first two particles have to be the hard partons going into the interaction
309  if (genParticles.size() >= 2) {
310  if (!genParticles.at(0)->production_vertex() && !genParticles.at(1)->production_vertex()) {
311  v1->add_particle_out(genParticles.at(0));
312  v2->add_particle_out(genParticles.at(1));
313  } else
314  edm::LogWarning("Generator|LHEInterface") << "Initial partons do already have a"
315  " production vertex. "
316  << std::endl
317  << "Beam particles not connected.";
318  } else
319  edm::LogWarning("Generator|LHEInterface") << "Can't find any initial partons to be"
320  " connected to the beam particles.";
321 
322  for (std::vector<HepMC::GenVertex *>::const_iterator iter = genVertices.begin(); iter != genVertices.end(); ++iter)
323  hepmc->add_vertex(*iter);
324 
325  // do some more consistency checks
326  for (unsigned int i = 0; i < nup; i++) {
327  if (!genParticles.at(i)->parent_event()) {
328  edm::LogWarning("Generator|LHEInterface") << "Not all LHE particles could be stored"
329  " stored in the HepMC event. "
330  << std::endl
331  << "Check the mother-daughter relations"
332  " in the given LHE input file.";
333  break;
334  }
335  }
336 
337  hepmc->set_signal_process_vertex(const_cast<HepMC::GenVertex *>(findSignalVertex(hepmc.get(), false)));
338 
339  return hepmc;
340  }

References lhef::HEPEUP::AQCDUP, lhef::HEPEUP::AQEDUP, b1, b2, checkHepMCTree(), pdg::cTau(), findSignalVertex(), GenParticle::GenParticle, genParticles2HepMC_cfi::genParticles, getHEPRUP(), hepeup, mps_fire::i, lhef::HEPEUP::IDPRUP, dqmiolumiharvest::j, makeHepMCParticle(), lhef::HEPEUP::MOTHUP, lhef::HEPEUP::NUP, lhef::HEPEUP::SCALUP, and lhef::HEPEUP::VTIMUP.

◆ attempted()

void lhef::LHEEvent::attempted ( )
inline

Definition at line 66 of file LHEEvent.h.

66  {
68  return;
69  }

References readAttemptCounter.

◆ checkHepMCTree()

bool lhef::LHEEvent::checkHepMCTree ( const HepMC::GenEvent event)
staticprivate

Definition at line 355 of file LHEEvent.cc.

355  {
356  double px = 0, py = 0, pz = 0, E = 0;
357 
358  for (HepMC::GenEvent::particle_const_iterator iter = event->particles_begin(); iter != event->particles_end();
359  iter++) {
360  int status = (*iter)->status();
361  HepMC::FourVector fv = (*iter)->momentum();
362 
363  // incoming particles
364  if (status == 3 && *iter != event->beam_particles().first && *iter != event->beam_particles().second) {
365  px -= fv.px();
366  py -= fv.py();
367  pz -= fv.pz();
368  E -= fv.e();
369  }
370 
371  // outgoing particles
372  if (status == 1) {
373  px += fv.px();
374  py += fv.py();
375  pz += fv.pz();
376  E += fv.e();
377  }
378  }
379 
380  if (px * px + py * py + pz * pz + E * E > 0.1) {
381  edm::LogWarning("Generator|LHEInterface")
382  << "Energy-momentum badly conserved. " << std::setprecision(3) << "sum p_i = [" << std::setw(7) << E << ", "
383  << std::setw(7) << px << ", " << std::setw(7) << py << ", " << std::setw(7) << pz << "]";
384 
385  return false;
386  }
387 
388  return true;
389  }

References multPhiCorr_741_25nsDY_cfi::px, multPhiCorr_741_25nsDY_cfi::py, and mps_update::status.

Referenced by asHepMCEvent().

◆ count()

void lhef::LHEEvent::count ( LHERunInfo::CountMode  count,
double  weight = 1.0,
double  matchWeight = 1.0 
)

Definition at line 182 of file LHEEvent.cc.

182  {
183  if (counted)
184  edm::LogWarning("Generator|LHEInterface") << "LHEEvent::count called twice on same event!" << std::endl;
185 
186  runInfo->count(hepeup.IDPRUP, mode, hepeup.XWGTUP, weight, matchWeight);
187 
188  counted = true;
189  }

References counted, hepeup, lhef::HEPEUP::IDPRUP, ALCARECOPromptCalibProdSiPixelAli0T_cff::mode, runInfo, and lhef::HEPEUP::XWGTUP.

Referenced by gen::Pythia6Hadronizer::hadronize(), Pythia8Hadronizer::hadronize(), and Herwig6Hadronizer::hadronize().

◆ fillEventInfo()

void lhef::LHEEvent::fillEventInfo ( HepMC::GenEvent hepmc) const

Definition at line 218 of file LHEEvent.cc.

218  {
219  event->set_signal_process_id(hepeup.IDPRUP);
220  event->set_event_scale(hepeup.SCALUP);
221  event->set_alphaQED(hepeup.AQEDUP);
222  event->set_alphaQCD(hepeup.AQCDUP);
223  }

References lhef::HEPEUP::AQCDUP, lhef::HEPEUP::AQEDUP, hepeup, lhef::HEPEUP::IDPRUP, and lhef::HEPEUP::SCALUP.

Referenced by gen::Pythia6Hadronizer::finalizeEvent(), and Herwig6Hadronizer::finalizeEvent().

◆ fillPdfInfo()

void lhef::LHEEvent::fillPdfInfo ( HepMC::PdfInfo *  info) const

Definition at line 191 of file LHEEvent.cc.

191  {
192  if (pdf.get()) {
193  info->set_id1(pdf->id.first);
194  info->set_id2(pdf->id.second);
195  info->set_x1(pdf->x.first);
196  info->set_x2(pdf->x.second);
197  info->set_pdf1(pdf->xPDF.first);
198  info->set_pdf2(pdf->xPDF.second);
199  info->set_scalePDF(pdf->scalePDF);
200  } else if (hepeup.NUP >= 2) {
201  const HEPRUP *heprup = getHEPRUP();
202  info->set_id1(hepeup.IDUP[0] == 21 ? 0 : hepeup.IDUP[0]);
203  info->set_id2(hepeup.IDUP[1] == 21 ? 0 : hepeup.IDUP[1]);
204  info->set_x1(std::abs(hepeup.PUP[0][2] / heprup->EBMUP.first));
205  info->set_x2(std::abs(hepeup.PUP[1][2] / heprup->EBMUP.second));
206  info->set_pdf1(-1.0);
207  info->set_pdf2(-1.0);
208  info->set_scalePDF(hepeup.SCALUP);
209  } else {
210  info->set_x1(-1.0);
211  info->set_x2(-1.0);
212  info->set_pdf1(-1.0);
213  info->set_pdf2(-1.0);
214  info->set_scalePDF(hepeup.SCALUP);
215  }
216  }

References funct::abs(), lhef::HEPRUP::EBMUP, getHEPRUP(), hepeup, lhef::HEPEUP::IDUP, info(), lhef::HEPEUP::NUP, pdf, lhef::HEPEUP::PUP, and lhef::HEPEUP::SCALUP.

Referenced by gen::Pythia6Hadronizer::finalizeEvent(), and Herwig6Hadronizer::finalizeEvent().

◆ findSignalVertex()

const HepMC::GenVertex * lhef::LHEEvent::findSignalVertex ( const HepMC::GenEvent event,
bool  status3 = true 
)
static

Definition at line 391 of file LHEEvent.cc.

391  {
392  double largestMass2 = -9.0e-30;
393  const HepMC::GenVertex *vertex = nullptr;
394  for (HepMC::GenEvent::vertex_const_iterator iter = event->vertices_begin(); iter != event->vertices_end(); ++iter) {
395  if ((*iter)->particles_in_size() < 2)
396  continue;
397  if ((*iter)->particles_out_size() < 1 ||
398  ((*iter)->particles_out_size() == 1 &&
399  (!(*(*iter)->particles_out_const_begin())->end_vertex() ||
400  !(*(*iter)->particles_out_const_begin())->end_vertex()->particles_out_size())))
401  continue;
402 
403  double px = 0.0, py = 0.0, pz = 0.0, E = 0.0;
404  bool hadStatus3 = false;
405  for (HepMC::GenVertex::particles_out_const_iterator iter2 = (*iter)->particles_out_const_begin();
406  iter2 != (*iter)->particles_out_const_end();
407  ++iter2) {
408  hadStatus3 = hadStatus3 || (*iter2)->status() == 3;
409  px += (*iter2)->momentum().px();
410  py += (*iter2)->momentum().py();
411  pz += (*iter2)->momentum().pz();
412  E += (*iter2)->momentum().e();
413  }
414  if (status3 && !hadStatus3)
415  continue;
416 
417  double mass2 = E * E - (px * px + py * py + pz * pz);
418  if (mass2 > largestMass2) {
419  vertex = *iter;
420  largestMass2 = mass2;
421  }
422  }
423 
424  return vertex;
425  }

References multPhiCorr_741_25nsDY_cfi::px, multPhiCorr_741_25nsDY_cfi::py, and bphysicsOniaDQM_cfi::vertex.

Referenced by asHepMCEvent().

◆ fixHepMCEventTimeOrdering()

void lhef::LHEEvent::fixHepMCEventTimeOrdering ( HepMC::GenEvent event)
static

Definition at line 451 of file LHEEvent.cc.

451  {
452  std::set<const HepMC::GenVertex *> visited;
453  HepMC::FourVector zeroTime;
454  for (HepMC::GenEvent::vertex_iterator iter = event->vertices_begin(); iter != event->vertices_end(); ++iter)
455  fixSubTree(*iter, zeroTime, visited);
456  }

References lhef::fixSubTree(), and class-composition::visited.

Referenced by gen::PomwigHadronizer::finalizeEvent(), and Herwig6Hadronizer::finalizeEvent().

◆ getComments()

const std::vector<std::string>& lhef::LHEEvent::getComments ( ) const
inline

Definition at line 41 of file LHEEvent.h.

41 { return comments; }

References comments.

Referenced by Herwig6Hadronizer::upEvnt().

◆ getHEPEUP()

const HEPEUP* lhef::LHEEvent::getHEPEUP ( ) const
inline

◆ getHEPRUP()

const HEPRUP* lhef::LHEEvent::getHEPRUP ( ) const
inline

Definition at line 39 of file LHEEvent.h.

39 { return runInfo->getHEPRUP(); }

References runInfo.

Referenced by asHepMCEvent(), and fillPdfInfo().

◆ getPDF()

const PDF* lhef::LHEEvent::getPDF ( ) const
inline

Definition at line 40 of file LHEEvent.h.

40 { return pdf.get(); }

References pdf.

◆ getReadAttempts()

const int lhef::LHEEvent::getReadAttempts ( )
inline

Definition at line 42 of file LHEEvent.h.

42 { return readAttemptCounter; }

References readAttemptCounter.

◆ getRunInfo()

const std::shared_ptr<LHERunInfo>& lhef::LHEEvent::getRunInfo ( ) const
inline

Definition at line 37 of file LHEEvent.h.

37 { return runInfo; }

References runInfo.

◆ makeHepMCParticle()

HepMC::GenParticle * lhef::LHEEvent::makeHepMCParticle ( unsigned int  i) const
private

Definition at line 342 of file LHEEvent.cc.

342  {
343  HepMC::GenParticle *particle = new HepMC::GenParticle(
344  HepMC::FourVector(hepeup.PUP.at(i)[0], hepeup.PUP.at(i)[1], hepeup.PUP.at(i)[2], hepeup.PUP.at(i)[3]),
345  hepeup.IDUP.at(i));
346 
347  int status = hepeup.ISTUP.at(i);
348 
349  particle->set_generated_mass(hepeup.PUP.at(i)[4]);
350  particle->set_status(status > 0 ? (status == 2 ? 3 : status) : 3);
351 
352  return particle;
353  }

References GenParticle::GenParticle, hepeup, mps_fire::i, lhef::HEPEUP::IDUP, lhef::HEPEUP::ISTUP, lhef::HEPEUP::PUP, and mps_update::status.

Referenced by asHepMCEvent().

◆ npLO()

int lhef::LHEEvent::npLO ( ) const
inline

Definition at line 53 of file LHEEvent.h.

53 { return npLO_; }

References npLO_.

◆ npNLO()

int lhef::LHEEvent::npNLO ( ) const
inline

Definition at line 54 of file LHEEvent.h.

54 { return npNLO_; }

References npNLO_.

◆ originalXWGTUP()

double lhef::LHEEvent::originalXWGTUP ( ) const
inline

Definition at line 47 of file LHEEvent.h.

47 { return originalXWGTUP_; }

References originalXWGTUP_.

◆ removeParticle()

void lhef::LHEEvent::removeParticle ( lhef::HEPEUP hepeup,
int  index 
)
static

Definition at line 137 of file LHEEvent.cc.

137  {
138  index--;
139  if (index < 0 || index >= hepeup.NUP) {
140  edm::LogError("Generator|LHEInterface")
141  << "removeParticle: Index " << (index + 1) << " out of bounds." << std::endl;
142  return;
143  }
144 
145  std::pair<int, int> mo = hepeup.MOTHUP[index];
146 
147  hepeup.IDUP.erase(hepeup.IDUP.begin() + index);
148  hepeup.ISTUP.erase(hepeup.ISTUP.begin() + index);
149  hepeup.MOTHUP.erase(hepeup.MOTHUP.begin() + index);
150  hepeup.ICOLUP.erase(hepeup.ICOLUP.begin() + index);
151  hepeup.PUP.erase(hepeup.PUP.begin() + index);
152  hepeup.VTIMUP.erase(hepeup.VTIMUP.begin() + index);
153  hepeup.SPINUP.erase(hepeup.SPINUP.begin() + index);
154 
155  hepeup.NUP--;
156 
157  index++;
158  for (int i = 0; i < hepeup.NUP; i++) {
159  if (hepeup.MOTHUP[i].first == index) {
160  if (hepeup.MOTHUP[i].second > 0)
161  edm::LogError("Generator|LHEInterface")
162  << "removeParticle: Particle " << (i + 2) << " has two mothers." << std::endl;
163  hepeup.MOTHUP[i] = mo;
164  }
165 
166  if (hepeup.MOTHUP[i].first > index)
167  hepeup.MOTHUP[i].first--;
168  if (hepeup.MOTHUP[i].second > index)
169  hepeup.MOTHUP[i].second--;
170  }
171  }

References hepeup, mps_fire::i, lhef::HEPEUP::ICOLUP, lhef::HEPEUP::IDUP, lhef::HEPEUP::ISTUP, lhef::HEPEUP::MOTHUP, lhef::HEPEUP::NUP, lhef::HEPEUP::PUP, lhef::HEPEUP::SPINUP, and lhef::HEPEUP::VTIMUP.

Referenced by removeResonances().

◆ removeResonances()

void lhef::LHEEvent::removeResonances ( const std::vector< int > &  ids)

Definition at line 173 of file LHEEvent.cc.

173  {
174  for (int i = 1; i <= hepeup.NUP; i++) {
175  int id = std::abs(hepeup.IDUP[i - 1]);
176  if (hepeup.MOTHUP[i - 1].first > 0 && hepeup.MOTHUP[i - 1].second > 0 &&
177  std::find(ids.begin(), ids.end(), id) != ids.end())
178  removeParticle(hepeup, i--);
179  }
180  }

References funct::abs(), spr::find(), hepeup, mps_fire::i, triggerObjects_cff::id, lhef::HEPEUP::IDUP, lhef::HEPEUP::MOTHUP, lhef::HEPEUP::NUP, and removeParticle().

◆ scales()

const std::vector<float>& lhef::LHEEvent::scales ( ) const
inline

Definition at line 50 of file LHEEvent.h.

50 { return scales_; }

References scales_.

Referenced by setScales().

◆ setNpLO()

void lhef::LHEEvent::setNpLO ( int  n)
inline

Definition at line 56 of file LHEEvent.h.

56 { npLO_ = n; }

References dqmiodumpmetadata::n, and npLO_.

◆ setNpNLO()

void lhef::LHEEvent::setNpNLO ( int  n)
inline

Definition at line 57 of file LHEEvent.h.

57 { npNLO_ = n; }

References dqmiodumpmetadata::n, and npNLO_.

◆ setPDF()

void lhef::LHEEvent::setPDF ( std::unique_ptr< PDF pdf)
inline

Definition at line 45 of file LHEEvent.h.

45 { this->pdf = std::move(pdf); }

References eostools::move(), and pdf.

◆ setScales()

void lhef::LHEEvent::setScales ( const std::vector< float > &  scales)
inline

Definition at line 51 of file LHEEvent.h.

51 { scales_ = scales; }

References scales(), and scales_.

◆ weights()

const std::vector<WGT>& lhef::LHEEvent::weights ( ) const
inline

Definition at line 48 of file LHEEvent.h.

48 { return weights_; }

References weights_.

Member Data Documentation

◆ comments

std::vector<std::string> lhef::LHEEvent::comments
private

Definition at line 89 of file LHEEvent.h.

Referenced by addComment(), getComments(), and LHEEvent().

◆ counted

bool lhef::LHEEvent::counted
private

Definition at line 90 of file LHEEvent.h.

Referenced by count().

◆ hepeup

HEPEUP lhef::LHEEvent::hepeup
private

◆ npLO_

int lhef::LHEEvent::npLO_
private

Definition at line 94 of file LHEEvent.h.

Referenced by npLO(), and setNpLO().

◆ npNLO_

int lhef::LHEEvent::npNLO_
private

Definition at line 95 of file LHEEvent.h.

Referenced by npNLO(), and setNpNLO().

◆ originalXWGTUP_

double lhef::LHEEvent::originalXWGTUP_
private

Definition at line 92 of file LHEEvent.h.

Referenced by LHEEvent(), and originalXWGTUP().

◆ pdf

std::unique_ptr<PDF> lhef::LHEEvent::pdf
private

Definition at line 87 of file LHEEvent.h.

Referenced by fillPdfInfo(), getPDF(), LHEEvent(), and setPDF().

◆ readAttemptCounter

int lhef::LHEEvent::readAttemptCounter
private

Definition at line 91 of file LHEEvent.h.

Referenced by attempted(), and getReadAttempts().

◆ runInfo

const std::shared_ptr<LHERunInfo> lhef::LHEEvent::runInfo
private

Definition at line 84 of file LHEEvent.h.

Referenced by count(), getHEPRUP(), getRunInfo(), and LHEEvent().

◆ scales_

std::vector<float> lhef::LHEEvent::scales_
private

Definition at line 93 of file LHEEvent.h.

Referenced by scales(), and setScales().

◆ weights_

std::vector<WGT> lhef::LHEEvent::weights_
private

Definition at line 88 of file LHEEvent.h.

Referenced by addWeight(), and weights().

lhef::HEPEUP::AQCDUP
double AQCDUP
Definition: LesHouches.h:218
lhef::fixSubTree
static void fixSubTree(HepMC::GenVertex *vertex, HepMC::FourVector &_time, std::set< const HepMC::GenVertex * > &visited)
Definition: LHEEvent.cc:427
mps_fire.i
i
Definition: mps_fire.py:355
genParticles2HepMC_cfi.genParticles
genParticles
Definition: genParticles2HepMC_cfi.py:4
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
lhef::LHEEvent::npNLO_
int npNLO_
Definition: LHEEvent.h:95
lhef::HEPEUP::MOTHUP
std::vector< std::pair< int, int > > MOTHUP
Definition: LesHouches.h:234
mps_update.status
status
Definition: mps_update.py:69
LHEEventProduct::originalXWGTUP
double originalXWGTUP() const
Definition: LHEEventProduct.h:34
lhef::HEPEUP::ISTUP
std::vector< int > ISTUP
Definition: LesHouches.h:228
multPhiCorr_741_25nsDY_cfi.py
py
Definition: multPhiCorr_741_25nsDY_cfi.py:12
skipWhitespace
static int skipWhitespace(std::istream &in)
Definition: LHEEvent.cc:23
ALCARECOPromptCalibProdSiPixelAli0T_cff.mode
mode
Definition: ALCARECOPromptCalibProdSiPixelAli0T_cff.py:96
edm::LogInfo
Definition: MessageLogger.h:254
lhef::HEPEUP::SPINUP
std::vector< double > SPINUP
Definition: LesHouches.h:259
lhef::LHEEvent::counted
bool counted
Definition: LHEEvent.h:90
info
static const TGPicture * info(bool iBackgroundIsBlack)
Definition: FWCollectionSummaryWidget.cc:152
lhef::LHEEvent::makeHepMCParticle
HepMC::GenParticle * makeHepMCParticle(unsigned int i) const
Definition: LHEEvent.cc:342
b2
static constexpr float b2
Definition: L1EGammaCrystalsEmulatorProducer.cc:83
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
lhef::LHEEvent::PDF
LHEEventProduct::PDF PDF
Definition: LHEEvent.h:34
LHEEventProduct::npNLO
int npNLO() const
Definition: LHEEventProduct.h:41
HepMC::GenEvent
Definition: hepmc_rootio.cc:9
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
lhef::LHEEvent::weights_
std::vector< WGT > weights_
Definition: LHEEvent.h:88
b1
static constexpr float b1
Definition: L1EGammaCrystalsEmulatorProducer.cc:83
lhef::HEPEUP::NUP
int NUP
Definition: LesHouches.h:184
LHEEventProduct::comments_begin
comments_const_iterator comments_begin() const
Definition: LHEEventProduct.h:50
lhef::LHEEvent::checkHepMCTree
static bool checkHepMCTree(const HepMC::GenEvent *event)
Definition: LHEEvent.cc:355
GlobalPosition_Frontier_DevDB_cff.tag
tag
Definition: GlobalPosition_Frontier_DevDB_cff.py:11
lhef::LHEEvent::findSignalVertex
static const HepMC::GenVertex * findSignalVertex(const HepMC::GenEvent *event, bool status3=true)
Definition: LHEEvent.cc:391
lhef::LHEEvent::scales_
std::vector< float > scales_
Definition: LHEEvent.h:93
class-composition.visited
visited
Definition: class-composition.py:74
lhef::LHEEvent::originalXWGTUP_
double originalXWGTUP_
Definition: LHEEvent.h:92
lhef::LHEEvent::pdf
std::unique_ptr< PDF > pdf
Definition: LHEEvent.h:87
lhef::LHEEvent::npLO_
int npLO_
Definition: LHEEvent.h:94
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::LogWarning
Definition: MessageLogger.h:141
lhef::HEPEUP::ICOLUP
std::vector< std::pair< int, int > > ICOLUP
Definition: LesHouches.h:240
bphysicsOniaDQM_cfi.vertex
vertex
Definition: bphysicsOniaDQM_cfi.py:7
edm::LogError
Definition: MessageLogger.h:183
lhef::HEPEUP::VTIMUP
std::vector< double > VTIMUP
Definition: LesHouches.h:252
recoMuon::in
Definition: RecoMuonEnumerators.h:6
LHEEventProduct::weights
const std::vector< WGT > & weights() const
Definition: LHEEventProduct.h:35
lhef::HEPEUP::AQEDUP
double AQEDUP
Definition: LesHouches.h:213
lhef::LHEEvent::hepeup
HEPEUP hepeup
Definition: LHEEvent.h:86
lhef::HEPEUP::XWGTUP
double XWGTUP
Definition: LesHouches.h:194
pdg::cTau
double cTau(int pdgID, const HepPDT::ParticleDataTable *pdt)
Definition: pdg_functions.cc:26
lhef::HEPEUP::XPDWUP
std::pair< double, double > XPDWUP
Definition: LesHouches.h:202
LHEEventProduct::hepeup
const lhef::HEPEUP & hepeup() const
Definition: LHEEventProduct.h:46
multPhiCorr_741_25nsDY_cfi.px
px
Definition: multPhiCorr_741_25nsDY_cfi.py:10
GenParticle.GenParticle
GenParticle
Definition: GenParticle.py:18
eostools.move
def move(src, dest)
Definition: eostools.py:511
LHEEventProduct::scales
const std::vector< float > & scales() const
Definition: LHEEventProduct.h:37
LHEEventProduct::comments_end
comments_const_iterator comments_end() const
Definition: LHEEventProduct.h:51
lhef::HEPEUP::IDUP
std::vector< int > IDUP
Definition: LesHouches.h:223
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
LHEEventProduct::pdf
const PDF * pdf() const
Definition: LHEEventProduct.h:47
lhef::LHEEvent::comments
std::vector< std::string > comments
Definition: LHEEvent.h:89
lhef::LHEEvent::scales
const std::vector< float > & scales() const
Definition: LHEEvent.h:50
lhef::HEPEUP::IDPRUP
int IDPRUP
Definition: LesHouches.h:189
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
lhef::LHEEvent::runInfo
const std::shared_ptr< LHERunInfo > runInfo
Definition: LHEEvent.h:84
lhef::HEPEUP::resize
void resize(int nup)
Definition: LesHouches.h:161
cms::Exception
Definition: Exception.h:70
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
event
Definition: event.py:1
mps_splice.line
line
Definition: mps_splice.py:76
lhef::LHEEvent::readAttemptCounter
int readAttemptCounter
Definition: LHEEvent.h:91
lhef::HEPEUP::PUP
std::vector< FiveVector > PUP
Definition: LesHouches.h:246
weight
Definition: weight.py:1
lhef::HEPEUP::SCALUP
double SCALUP
Definition: LesHouches.h:208
LHEEventProduct::npLO
int npLO() const
Definition: LHEEventProduct.h:40
lhef::LHEEvent::removeParticle
static void removeParticle(lhef::HEPEUP &hepeup, int index)
Definition: LHEEvent.cc:137
lhef::LHEEvent::getHEPRUP
const HEPRUP * getHEPRUP() const
Definition: LHEEvent.h:39
reco::vertex_iterator
VertexRefVector::iterator vertex_iterator
iterator over a vector of references to Vertex objects in the same collection
Definition: VertexFwd.h:19