CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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
 

Public Member Functions

void addComment (const std::string &line)
 
std::auto_ptr< HepMC::GenEvent > asHepMCEvent () const
 
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 boost::shared_ptr
< LHERunInfo > & 
getRunInfo () const
 
 LHEEvent (const boost::shared_ptr< LHERunInfo > &runInfo, std::istream &in)
 
 LHEEvent (const boost::shared_ptr< LHERunInfo > &runInfo, const HEPEUP &hepeup)
 
 LHEEvent (const boost::shared_ptr< LHERunInfo > &runInfo, const HEPEUP &hepeup, const LHEEventProduct::PDF *pdf, const std::vector< std::string > &comments)
 
 LHEEvent (const boost::shared_ptr< LHERunInfo > &runInfo, const LHEEventProduct &product)
 
void removeResonances (const std::vector< int > &ids)
 
void setPDF (std::auto_ptr< PDF > pdf)
 
 ~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
 
std::auto_ptr< PDFpdf
 
const boost::shared_ptr
< LHERunInfo
runInfo
 

Detailed Description

Definition at line 25 of file LHEEvent.h.

Member Typedef Documentation

Definition at line 39 of file LHEEvent.h.

Constructor & Destructor Documentation

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

Definition at line 36 of file LHEEvent.cc.

References abs, lhef::HEPEUP::AQCDUP, lhef::HEPEUP::AQEDUP, comments, hepeup, i, lhef::HEPEUP::ICOLUP, lhef::HEPEUP::IDPRUP, lhef::HEPEUP::IDUP, lhef::HEPEUP::ISTUP, geometryCSVtoXML::line, lhef::HEPEUP::MOTHUP, lhef::HEPEUP::NUP, pdf, lhef::HEPEUP::PUP, lhef::HEPEUP::resize(), lhef::HEPEUP::SCALUP, skipWhitespace(), lhef::HEPEUP::SPINUP, GlobalPosition_Frontier_DevDB_cff::tag, lhef::HEPEUP::VTIMUP, lhef::HEPEUP::XPDWUP, and lhef::HEPEUP::XWGTUP.

37  :
38  runInfo(runInfo), counted(false)
39 {
40  hepeup.NUP = 0;
41  hepeup.XPDWUP.first = hepeup.XPDWUP.second = 0.0;
42 
45  if (!in.good())
46  throw cms::Exception("InvalidFormat")
47  << "Les Houches file contained invalid"
48  " event header." << std::endl;
49 
50  int idwtup = runInfo->getHEPRUP()->IDWTUP;
51  if (idwtup >= 0 && hepeup.XWGTUP < 0) {
52  edm::LogWarning("Generator|LHEInterface")
53  << "Non-allowed egative event weight encountered."
54  << std::endl;
56  }
57 
58  if (std::abs(idwtup) == 3 && std::abs(hepeup.XWGTUP) != 1.) {
59  edm::LogWarning("Generator|LHEInterface")
60  << "Event weight not set to one for abs(IDWTUP) == 3"
61  << std::endl;
62  hepeup.XWGTUP = hepeup.XWGTUP > 0. ? 1.0 : -1.0;
63  }
64 
65  hepeup.resize();
66 
67  for(int i = 0; i < hepeup.NUP; i++) {
68  in >> hepeup.IDUP[i] >> hepeup.ISTUP[i]
69  >> hepeup.MOTHUP[i].first >> hepeup.MOTHUP[i].second
70  >> hepeup.ICOLUP[i].first >> hepeup.ICOLUP[i].second
71  >> hepeup.PUP[i][0] >> hepeup.PUP[i][1] >> hepeup.PUP[i][2]
72  >> hepeup.PUP[i][3] >> hepeup.PUP[i][4]
73  >> hepeup.VTIMUP[i] >> hepeup.SPINUP[i];
74  if (!in.good())
75  throw cms::Exception("InvalidFormat")
76  << "Les Houches file contained invalid event"
77  " in particle line " << (i + 1)
78  << "." << std::endl;
79  }
80 
81  while(skipWhitespace(in) == '#') {
82  std::string line;
83  std::getline(in, line);
84  std::istringstream ss(line);
85  std::string tag;
86  ss >> tag;
87  if (tag == "#pdf") {
88  pdf.reset(new PDF);
89  ss >> pdf->id.first >> pdf->id.second
90  >> pdf->x.first >> pdf->x.second
91  >> pdf->scalePDF
92  >> pdf->xPDF.first >> pdf->xPDF.second;
93  if (ss.bad()) {
94  edm::LogWarning("Generator|LHEInterface")
95  << "Les Houches event contained"
96  " unparseable PDF information."
97  << std::endl;
98  pdf.reset();
99  } else
100  continue;
101  }
102 
103  comments.push_back(line + "\n");
104  }
105 
106  if (!in.eof())
107  edm::LogWarning("Generator|LHEInterface")
108  << "Les Houches file contained spurious"
109  " content after event data." << std::endl;
110 }
int i
Definition: DBlmapReader.cc:9
HEPEUP hepeup
Definition: LHEEvent.h:73
std::vector< std::string > comments
Definition: LHEEvent.h:75
#define abs(x)
Definition: mlp_lapack.h:159
std::vector< double > VTIMUP
Definition: LesHouches.h:254
std::pair< double, double > XPDWUP
Definition: LesHouches.h:204
std::auto_ptr< PDF > pdf
Definition: LHEEvent.h:74
std::vector< std::pair< int, int > > MOTHUP
Definition: LesHouches.h:236
void resize(int nup)
Definition: LesHouches.h:161
const boost::shared_ptr< LHERunInfo > runInfo
Definition: LHEEvent.h:71
std::vector< FiveVector > PUP
Definition: LesHouches.h:248
std::vector< double > SPINUP
Definition: LesHouches.h:261
std::vector< int > ISTUP
Definition: LesHouches.h:230
LHEEventProduct::PDF PDF
Definition: LHEEvent.h:39
std::vector< int > IDUP
Definition: LesHouches.h:225
double AQCDUP
Definition: LesHouches.h:220
bool counted
Definition: LHEEvent.h:76
double AQEDUP
Definition: LesHouches.h:215
static int skipWhitespace(std::istream &in)
Definition: LHEEvent.cc:23
double XWGTUP
Definition: LesHouches.h:196
std::vector< std::pair< int, int > > ICOLUP
Definition: LesHouches.h:242
double SCALUP
Definition: LesHouches.h:210
lhef::LHEEvent::LHEEvent ( const boost::shared_ptr< LHERunInfo > &  runInfo,
const HEPEUP hepeup 
)

Definition at line 112 of file LHEEvent.cc.

113  :
114  runInfo(runInfo), hepeup(hepeup), counted(false)
115 {
116 }
HEPEUP hepeup
Definition: LHEEvent.h:73
const boost::shared_ptr< LHERunInfo > runInfo
Definition: LHEEvent.h:71
bool counted
Definition: LHEEvent.h:76
lhef::LHEEvent::LHEEvent ( const boost::shared_ptr< LHERunInfo > &  runInfo,
const HEPEUP hepeup,
const LHEEventProduct::PDF pdf,
const std::vector< std::string > &  comments 
)

Definition at line 118 of file LHEEvent.cc.

121  :
122  runInfo(runInfo), hepeup(hepeup), pdf(pdf ? new PDF(*pdf) : 0),
123  comments(comments), counted(false)
124 {
125 }
HEPEUP hepeup
Definition: LHEEvent.h:73
std::vector< std::string > comments
Definition: LHEEvent.h:75
std::auto_ptr< PDF > pdf
Definition: LHEEvent.h:74
const boost::shared_ptr< LHERunInfo > runInfo
Definition: LHEEvent.h:71
LHEEventProduct::PDF PDF
Definition: LHEEvent.h:39
bool counted
Definition: LHEEvent.h:76
lhef::LHEEvent::LHEEvent ( const boost::shared_ptr< LHERunInfo > &  runInfo,
const LHEEventProduct product 
)

Definition at line 127 of file LHEEvent.cc.

128  :
129  runInfo(runInfo), hepeup(product.hepeup()),
130  pdf(product.pdf() ? new PDF(*product.pdf()) : 0),
131  comments(product.comments_begin(), product.comments_end()),
132  counted(false)
133 {
134 }
HEPEUP hepeup
Definition: LHEEvent.h:73
const lhef::HEPEUP & hepeup() const
const PDF * pdf() const
std::vector< std::string > comments
Definition: LHEEvent.h:75
std::auto_ptr< PDF > pdf
Definition: LHEEvent.h:74
comments_const_iterator comments_begin() const
const boost::shared_ptr< LHERunInfo > runInfo
Definition: LHEEvent.h:71
LHEEventProduct::PDF PDF
Definition: LHEEvent.h:39
comments_const_iterator comments_end() const
bool counted
Definition: LHEEvent.h:76
lhef::LHEEvent::~LHEEvent ( )

Definition at line 136 of file LHEEvent.cc.

137 {
138 }

Member Function Documentation

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

Definition at line 49 of file LHEEvent.h.

49 { comments.push_back(line); }
std::vector< std::string > comments
Definition: LHEEvent.h:75
std::auto_ptr< HepMC::GenEvent > lhef::LHEEvent::asHepMCEvent ( ) const

Definition at line 248 of file LHEEvent.cc.

References lhef::HEPEUP::AQCDUP, lhef::HEPEUP::AQEDUP, checkHepMCTree(), findSignalVertex(), configurableAnalysis::GenParticle, genParticleCandidates2GenParticles_cfi::genParticles, getHEPRUP(), hepeup, i, lhef::HEPEUP::IDPRUP, j, makeHepMCParticle(), lhef::HEPEUP::MOTHUP, lhef::HEPEUP::NUP, lhef::HEPEUP::SCALUP, and lhef::HEPEUP::VTIMUP.

249 {
250  std::auto_ptr<HepMC::GenEvent> hepmc(new HepMC::GenEvent);
251 
252  hepmc->set_signal_process_id(hepeup.IDPRUP);
253  hepmc->set_event_scale(hepeup.SCALUP);
254  hepmc->set_alphaQED(hepeup.AQEDUP);
255  hepmc->set_alphaQCD(hepeup.AQCDUP);
256 
257  unsigned int nup = hepeup.NUP; // particles in event
258 
259  // any particles in HEPEUP block?
260  if (!nup) {
261  edm::LogWarning("Generator|LHEInterface")
262  << "Les Houches Event does not contain any partons. "
263  << "Not much to convert." ;
264  return hepmc;
265  }
266 
267  // stores (pointers to) converted particles
268  std::vector<HepMC::GenParticle*> genParticles;
269  std::vector<HepMC::GenVertex*> genVertices;
270 
271  // I. convert particles
272  for(unsigned int i = 0; i < nup; i++)
273  genParticles.push_back(makeHepMCParticle(i));
274 
275  // II. loop again to build vertices
276  for(unsigned int i = 0; i < nup; i++) {
277  unsigned int mother1 = hepeup.MOTHUP.at(i).first;
278  unsigned int mother2 = hepeup.MOTHUP.at(i).second;
279  double cTau = hepeup.VTIMUP.at(i); // decay time
280 
281  // current particle has a mother? --- Sorry, parent! We're PC.
282  if (mother1) {
283  mother1--; // FORTRAN notation!
284  if (mother2)
285  mother2--;
286  else
287  mother2 = mother1;
288 
289  HepMC::GenParticle *in_par = genParticles.at(mother1);
290  HepMC::GenVertex *current_vtx = in_par->end_vertex(); // vertex of first mother
291 
292  if (!current_vtx) {
293  current_vtx = new HepMC::GenVertex(
294  HepMC::FourVector(0, 0, 0, cTau));
295 
296  // add vertex to event
297  genVertices.push_back(current_vtx);
298  }
299 
300  for(unsigned int j = mother1; j <= mother2; j++) // set mother-daughter relations
301  if (!genParticles.at(j)->end_vertex())
302  current_vtx->add_particle_in(genParticles.at(j));
303 
304  // connect THIS outgoing particle to current vertex
305  current_vtx->add_particle_out(genParticles.at(i));
306  }
307  }
308 
309  checkHepMCTree(hepmc.get());
310 
311  // III. restore color flow
312  // ok, nobody knows how to do it so far...
313 
314  // IV. fill run information
315  const HEPRUP *heprup = getHEPRUP();
316 
317  // set beam particles
319  HepMC::FourVector(0.0, 0.0, +heprup->EBMUP.first,
320  heprup->EBMUP.first),
321  heprup->IDBMUP.first);
323  HepMC::FourVector(0.0, 0.0, -heprup->EBMUP.second,
324  heprup->EBMUP.second),
325  heprup->IDBMUP.second);
326  b1->set_status(3);
327  b2->set_status(3);
328 
329  HepMC::GenVertex *v1 = new HepMC::GenVertex();
330  HepMC::GenVertex *v2 = new HepMC::GenVertex();
331  v1->add_particle_in(b1);
332  v2->add_particle_in(b2);
333 
334  hepmc->add_vertex(v1);
335  hepmc->add_vertex(v2);
336  hepmc->set_beam_particles(b1, b2);
337 
338  // first two particles have to be the hard partons going into the interaction
339  if (genParticles.size() >= 2) {
340  if (!genParticles.at(0)->production_vertex() &&
341  !genParticles.at(1)->production_vertex()) {
342  v1->add_particle_out(genParticles.at(0));
343  v2->add_particle_out(genParticles.at(1));
344  } else
345  edm::LogWarning("Generator|LHEInterface")
346  << "Initial partons do already have a"
347  " production vertex. " << std::endl
348  << "Beam particles not connected.";
349  } else
350  edm::LogWarning("Generator|LHEInterface")
351  << "Can't find any initial partons to be"
352  " connected to the beam particles.";
353 
354  for(std::vector<HepMC::GenVertex*>::const_iterator iter = genVertices.begin();
355  iter != genVertices.end(); ++iter)
356  hepmc->add_vertex(*iter);
357 
358  // do some more consistency checks
359  for(unsigned int i = 0; i < nup; i++) {
360  if (!genParticles.at(i)->parent_event()) {
361  edm::LogWarning("Generator|LHEInterface")
362  << "Not all LHE particles could be stored"
363  " stored in the HepMC event. "
364  << std::endl
365  << "Check the mother-daughter relations"
366  " in the given LHE input file.";
367  break;
368  }
369  }
370 
371  hepmc->set_signal_process_vertex(
372  const_cast<HepMC::GenVertex*>(
373  findSignalVertex(hepmc.get(), false)));
374 
375  return hepmc;
376 }
int i
Definition: DBlmapReader.cc:9
HEPEUP hepeup
Definition: LHEEvent.h:73
const HEPRUP * getHEPRUP() const
Definition: LHEEvent.h:43
std::vector< double > VTIMUP
Definition: LesHouches.h:254
std::vector< std::pair< int, int > > MOTHUP
Definition: LesHouches.h:236
HepMC::GenParticle * makeHepMCParticle(unsigned int i) const
Definition: LHEEvent.cc:378
int j
Definition: DBlmapReader.cc:9
double AQCDUP
Definition: LesHouches.h:220
static const HepMC::GenVertex * findSignalVertex(const HepMC::GenEvent *event, bool status3=true)
Definition: LHEEvent.cc:439
double AQEDUP
Definition: LesHouches.h:215
static bool checkHepMCTree(const HepMC::GenEvent *event)
Definition: LHEEvent.cc:395
double SCALUP
Definition: LesHouches.h:210
bool lhef::LHEEvent::checkHepMCTree ( const HepMC::GenEvent *  event)
staticprivate

Definition at line 395 of file LHEEvent.cc.

References ntuplemaker::status.

Referenced by asHepMCEvent().

396 {
397  double px = 0, py = 0, pz = 0, E = 0;
398 
399  for(HepMC::GenEvent::particle_const_iterator iter = event->particles_begin();
400  iter != event->particles_end(); iter++) {
401  int status = (*iter)->status();
402  HepMC::FourVector fv = (*iter)->momentum();
403 
404  // incoming particles
405  if (status == 3 &&
406  *iter != event->beam_particles().first &&
407  *iter != event->beam_particles().second) {
408  px -= fv.px();
409  py -= fv.py();
410  pz -= fv.pz();
411  E -= fv.e();
412  }
413 
414  // outgoing particles
415  if (status == 1) {
416  px += fv.px();
417  py += fv.py();
418  pz += fv.pz();
419  E += fv.e();
420  }
421  }
422 
423  if (px*px + py*py + pz*pz + E*E > 0.1) {
424  edm::LogWarning("Generator|LHEInterface")
425  << "Energy-momentum badly conserved. "
426  << std::setprecision(3)
427  << "sum p_i = ["
428  << std::setw(7) << E << ", "
429  << std::setw(7) << px << ", "
430  << std::setw(7) << py << ", "
431  << std::setw(7) << pz << "]";
432 
433  return false;
434  }
435 
436  return true;
437 }
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
tuple status
Definition: ntuplemaker.py:245
void lhef::LHEEvent::count ( LHERunInfo::CountMode  count,
double  weight = 1.0,
double  matchWeight = 1.0 
)

Definition at line 198 of file LHEEvent.cc.

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

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

200 {
201  if (counted)
202  edm::LogWarning("Generator|LHEInterface")
203  << "LHEEvent::count called twice on same event!"
204  << std::endl;
205 
207  weight, matchWeight);
208 
209  counted = true;
210 }
HEPEUP hepeup
Definition: LHEEvent.h:73
const boost::shared_ptr< LHERunInfo > runInfo
Definition: LHEEvent.h:71
int mode
Definition: AMPTWrapper.h:139
bool counted
Definition: LHEEvent.h:76
double XWGTUP
Definition: LesHouches.h:196
void lhef::LHEEvent::fillEventInfo ( HepMC::GenEvent *  hepmc) const

Definition at line 240 of file LHEEvent.cc.

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

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

241 {
242  event->set_signal_process_id(hepeup.IDPRUP);
243  event->set_event_scale(hepeup.SCALUP);
244  event->set_alphaQED(hepeup.AQEDUP);
245  event->set_alphaQCD(hepeup.AQCDUP);
246 }
HEPEUP hepeup
Definition: LHEEvent.h:73
double AQCDUP
Definition: LesHouches.h:220
double AQEDUP
Definition: LesHouches.h:215
double SCALUP
Definition: LesHouches.h:210
void lhef::LHEEvent::fillPdfInfo ( HepMC::PdfInfo *  info) const

Definition at line 212 of file LHEEvent.cc.

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

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

213 {
214  if (pdf.get()) {
215  info->set_id1(pdf->id.first);
216  info->set_id2(pdf->id.second);
217  info->set_x1(pdf->x.first);
218  info->set_x2(pdf->x.second);
219  info->set_pdf1(pdf->xPDF.first);
220  info->set_pdf2(pdf->xPDF.second);
221  info->set_scalePDF(pdf->scalePDF);
222  } else if (hepeup.NUP >= 2) {
223  const HEPRUP *heprup = getHEPRUP();
224  info->set_id1(hepeup.IDUP[0] == 21 ? 0 : hepeup.IDUP[0]);
225  info->set_id2(hepeup.IDUP[1] == 21 ? 0 : hepeup.IDUP[1]);
226  info->set_x1(std::abs(hepeup.PUP[0][2] / heprup->EBMUP.first));
227  info->set_x2(std::abs(hepeup.PUP[1][2] / heprup->EBMUP.second));
228  info->set_pdf1(-1.0);
229  info->set_pdf2(-1.0);
230  info->set_scalePDF(hepeup.SCALUP);
231  } else {
232  info->set_x1(-1.0);
233  info->set_x2(-1.0);
234  info->set_pdf1(-1.0);
235  info->set_pdf2(-1.0);
236  info->set_scalePDF(hepeup.SCALUP);
237  }
238 }
HEPEUP hepeup
Definition: LHEEvent.h:73
const HEPRUP * getHEPRUP() const
Definition: LHEEvent.h:43
#define abs(x)
Definition: mlp_lapack.h:159
std::auto_ptr< PDF > pdf
Definition: LHEEvent.h:74
std::vector< FiveVector > PUP
Definition: LesHouches.h:248
std::vector< int > IDUP
Definition: LesHouches.h:225
double SCALUP
Definition: LesHouches.h:210
const HepMC::GenVertex * lhef::LHEEvent::findSignalVertex ( const HepMC::GenEvent *  event,
bool  status3 = true 
)
static

Definition at line 439 of file LHEEvent.cc.

Referenced by asHepMCEvent(), lhef::Hadronisation::hadronize(), and lhef::Hadronisation::showeredEvent().

441 {
442  double largestMass2 = -9.0e-30;
443  const HepMC::GenVertex *vertex = 0;
444  for(HepMC::GenEvent::vertex_const_iterator iter = event->vertices_begin();
445  iter != event->vertices_end(); ++iter) {
446  if ((*iter)->particles_in_size() < 2)
447  continue;
448  if ((*iter)->particles_out_size() < 1 ||
449  ((*iter)->particles_out_size() == 1 &&
450  (!(*(*iter)->particles_out_const_begin())->end_vertex() ||
451  !(*(*iter)->particles_out_const_begin())
452  ->end_vertex()->particles_out_size())))
453  continue;
454 
455  double px = 0.0, py = 0.0, pz = 0.0, E = 0.0;
456  bool hadStatus3 = false;
457  for(HepMC::GenVertex::particles_out_const_iterator iter2 =
458  (*iter)->particles_out_const_begin();
459  iter2 != (*iter)->particles_out_const_end(); ++iter2) {
460  hadStatus3 = hadStatus3 || (*iter2)->status() == 3;
461  px += (*iter2)->momentum().px();
462  py += (*iter2)->momentum().py();
463  pz += (*iter2)->momentum().pz();
464  E += (*iter2)->momentum().e();
465  }
466  if (status3 && !hadStatus3)
467  continue;
468 
469  double mass2 = E * E - (px * px + py * py + pz * pz);
470  if (mass2 > largestMass2) {
471  vertex = *iter;
472  largestMass2 = mass2;
473  }
474  }
475 
476  return vertex;
477 }
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
void lhef::LHEEvent::fixHepMCEventTimeOrdering ( HepMC::GenEvent *  event)
static

Definition at line 503 of file LHEEvent.cc.

References lhef::fixSubTree().

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

504 {
505  std::set<const HepMC::GenVertex*> visited;
506  HepMC::FourVector zeroTime;
507  for(HepMC::GenEvent::vertex_iterator iter = event->vertices_begin();
508  iter != event->vertices_end(); ++iter)
509  fixSubTree(*iter, zeroTime, visited);
510 }
static void fixSubTree(HepMC::GenVertex *vertex, HepMC::FourVector time, std::set< const HepMC::GenVertex * > &visited)
Definition: LHEEvent.cc:479
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
VertexRefVector::iterator vertex_iterator
iterator over a vector of references to Vertex objects in the same collection
Definition: VertexFwd.h:19
const std::vector<std::string>& lhef::LHEEvent::getComments ( ) const
inline

Definition at line 45 of file LHEEvent.h.

References comments.

Referenced by Herwig6Hadronizer::upEvnt().

45 { return comments; }
std::vector< std::string > comments
Definition: LHEEvent.h:75
const HEPEUP* lhef::LHEEvent::getHEPEUP ( ) const
inline

Definition at line 42 of file LHEEvent.h.

References hepeup.

Referenced by gen::FortranCallback::fillEvent().

42 { return &hepeup; }
HEPEUP hepeup
Definition: LHEEvent.h:73
const HEPRUP* lhef::LHEEvent::getHEPRUP ( ) const
inline

Definition at line 43 of file LHEEvent.h.

Referenced by asHepMCEvent(), and fillPdfInfo().

43 { return runInfo->getHEPRUP(); }
const boost::shared_ptr< LHERunInfo > runInfo
Definition: LHEEvent.h:71
const PDF* lhef::LHEEvent::getPDF ( ) const
inline

Definition at line 44 of file LHEEvent.h.

44 { return pdf.get(); }
std::auto_ptr< PDF > pdf
Definition: LHEEvent.h:74
const boost::shared_ptr<LHERunInfo>& lhef::LHEEvent::getRunInfo ( ) const
inline

Definition at line 41 of file LHEEvent.h.

References runInfo.

41 { return runInfo; }
const boost::shared_ptr< LHERunInfo > runInfo
Definition: LHEEvent.h:71
HepMC::GenParticle * lhef::LHEEvent::makeHepMCParticle ( unsigned int  i) const
private

Definition at line 378 of file LHEEvent.cc.

References configurableAnalysis::GenParticle, hepeup, lhef::HEPEUP::IDUP, lhef::HEPEUP::ISTUP, lhef::HEPEUP::PUP, and ntuplemaker::status.

Referenced by asHepMCEvent().

379 {
380  HepMC::GenParticle *particle = new HepMC::GenParticle(
381  HepMC::FourVector(hepeup.PUP.at(i)[0],
382  hepeup.PUP.at(i)[1],
383  hepeup.PUP.at(i)[2],
384  hepeup.PUP.at(i)[3]),
385  hepeup.IDUP.at(i));
386 
387  int status = hepeup.ISTUP.at(i);
388 
389  particle->set_generated_mass(hepeup.PUP.at(i)[4]);
390  particle->set_status(status > 0 ? (status == 2 ? 3 : status) : 3);
391 
392  return particle;
393 }
int i
Definition: DBlmapReader.cc:9
HEPEUP hepeup
Definition: LHEEvent.h:73
std::vector< FiveVector > PUP
Definition: LesHouches.h:248
std::vector< int > ISTUP
Definition: LesHouches.h:230
std::vector< int > IDUP
Definition: LesHouches.h:225
tuple status
Definition: ntuplemaker.py:245
void lhef::LHEEvent::removeParticle ( lhef::HEPEUP hepeup,
int  index 
)
static

Definition at line 147 of file LHEEvent.cc.

References i, lhef::HEPEUP::ICOLUP, lhef::HEPEUP::IDUP, getHLTprescales::index, lhef::HEPEUP::ISTUP, lhef::HEPEUP::MOTHUP, lhef::HEPEUP::NUP, lhef::pop(), lhef::HEPEUP::PUP, lhef::HEPEUP::resize(), lhef::HEPEUP::SPINUP, and lhef::HEPEUP::VTIMUP.

Referenced by removeResonances().

148 {
149  index--;
150  if (index < 0 || index >= hepeup.NUP) {
151  edm::LogError("Generator|LHEInterface")
152  << "removeParticle: Index " << (index + 1)
153  << " out of bounds." << std::endl;
154  return;
155  }
156 
157  std::pair<int, int> mo = hepeup.MOTHUP[index];
158 
159  pop(hepeup.IDUP, index);
160  pop(hepeup.ISTUP, index);
161  pop(hepeup.MOTHUP, index);
162  pop(hepeup.ICOLUP, index);
163  pop(hepeup.PUP, index);
164  pop(hepeup.VTIMUP, index);
165  pop(hepeup.SPINUP, index);
166  hepeup.NUP--;
167  hepeup.resize();
168 
169  index++;
170  for(int i = 0; i < hepeup.NUP; i++) {
171  if (hepeup.MOTHUP[i].first == index) {
172  if (hepeup.MOTHUP[i].second > 0)
173  edm::LogError("Generator|LHEInterface")
174  << "removeParticle: Particle "
175  << (i + 2) << " has two mothers."
176  << std::endl;
177  hepeup.MOTHUP[i] = mo;
178  }
179 
180  if (hepeup.MOTHUP[i].first > index)
181  hepeup.MOTHUP[i].first--;
182  if (hepeup.MOTHUP[i].second > index)
183  hepeup.MOTHUP[i].second--;
184  }
185 }
int i
Definition: DBlmapReader.cc:9
std::vector< double > VTIMUP
Definition: LesHouches.h:254
static void pop(std::vector< T > &vec, unsigned int index)
Definition: LHEEvent.cc:141
std::vector< std::pair< int, int > > MOTHUP
Definition: LesHouches.h:236
void resize(int nup)
Definition: LesHouches.h:161
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::vector< std::pair< int, int > > ICOLUP
Definition: LesHouches.h:242
void lhef::LHEEvent::removeResonances ( const std::vector< int > &  ids)

Definition at line 187 of file LHEEvent.cc.

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

188 {
189  for(int i = 1; i <= hepeup.NUP; i++) {
190  int id = std::abs(hepeup.IDUP[i - 1]);
191  if (hepeup.MOTHUP[i - 1].first > 0 &&
192  hepeup.MOTHUP[i - 1].second > 0 &&
193  std::find(ids.begin(), ids.end(), id) != ids.end())
194  removeParticle(hepeup, i--);
195  }
196 }
int i
Definition: DBlmapReader.cc:9
HEPEUP hepeup
Definition: LHEEvent.h:73
#define abs(x)
Definition: mlp_lapack.h:159
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
std::vector< std::pair< int, int > > MOTHUP
Definition: LesHouches.h:236
static void removeParticle(lhef::HEPEUP &hepeup, int index)
Definition: LHEEvent.cc:147
std::vector< int > IDUP
Definition: LesHouches.h:225
void lhef::LHEEvent::setPDF ( std::auto_ptr< PDF pdf)
inline

Definition at line 47 of file LHEEvent.h.

References pdf.

47 { this->pdf = pdf; }
std::auto_ptr< PDF > pdf
Definition: LHEEvent.h:74

Member Data Documentation

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

Definition at line 75 of file LHEEvent.h.

Referenced by getComments(), and LHEEvent().

bool lhef::LHEEvent::counted
private

Definition at line 76 of file LHEEvent.h.

Referenced by count().

HEPEUP lhef::LHEEvent::hepeup
private
std::auto_ptr<PDF> lhef::LHEEvent::pdf
private

Definition at line 74 of file LHEEvent.h.

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

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

Definition at line 71 of file LHEEvent.h.

Referenced by count(), and getRunInfo().