CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
Herwig6Hadronizer Class Reference
Inheritance diagram for Herwig6Hadronizer:
gen::BaseHadronizer gen::Herwig6Instance gen::FortranInstance

Public Member Functions

const char * classname () const
 
bool decay ()
 
bool declareSpecialSettings (const std::vector< std::string >)
 
bool declareStableParticles (const std::vector< int > &pdgIds)
 
void finalizeEvent ()
 
bool generatePartonsAndHadronize ()
 
bool hadronize ()
 
 Herwig6Hadronizer (const edm::ParameterSet &params)
 
bool initialize (const lhef::HEPRUP *heprup)
 
bool initializeForExternalPartons ()
 
bool initializeForInternalPartons ()
 
bool residualDecay ()
 
void setSLHAFromHeader (const std::vector< std::string > &lines)
 
void statistics ()
 
 ~Herwig6Hadronizer ()
 
- Public Member Functions inherited from gen::BaseHadronizer
 BaseHadronizer (edm::ParameterSet const &ps)
 
edm::EventgetEDMEvent () const
 
HepMC::GenEvent * getGenEvent ()
 
GenEventInfoProductgetGenEventInfo ()
 
GenRunInfoProductgetGenRunInfo ()
 
const boost::shared_ptr
< lhef::LHERunInfo > & 
getLHERunInfo () const
 
void resetEvent (HepMC::GenEvent *event)
 
void resetEventInfo (GenEventInfoProduct *eventInfo)
 
void setEDMEvent (edm::Event &event)
 
void setLHEEvent (lhef::LHEEvent *event)
 
void setLHERunInfo (lhef::LHERunInfo *runInfo)
 
 ~BaseHadronizer ()
 
- Public Member Functions inherited from gen::Herwig6Instance
bool callWithTimeout (unsigned int secs, void(*fn)())
 
bool give (const std::string &line)
 
 Herwig6Instance (CLHEP::HepRandomEngine *randomEngine=0)
 
 Herwig6Instance (int dummy)
 
virtual ~Herwig6Instance ()
 
- Public Member Functions inherited from gen::FortranInstance
void call (void(&fn)())
 
template<typename T >
call (T(&fn)())
 
template<typename A >
void call (void(&fn)(A), A a)
 
template<typename T , typename A >
call (T(&fn)(A), A a)
 
template<typename A1 , typename A2 >
void call (void(&fn)(A1, A2), A1 a1, A2 a2)
 
template<typename T , typename A1 , typename A2 >
call (T(&fn)(A1, A2), A1 a1, A2 a2)
 
virtual void enter ()
 
 FortranInstance ()
 
virtual void leave ()
 
virtual bool upVeto ()
 
virtual ~FortranInstance ()
 

Private Member Functions

void clear ()
 
int pythiaStatusCode (const HepMC::GenParticle *p) const
 
void pythiaStatusCodes ()
 
virtual void upEvnt ()
 
virtual void upInit ()
 

Private Attributes

double comEnergy
 
HepMC::IO_HERWIG conv
 
bool doMPInteraction
 
bool emulatePythiaStatusCodes
 
bool externalPartons
 
bool fConvertToPDG
 
int hepmcVerbosity
 
int herwigVerbosity
 
int maxEventsToPrint
 
bool needClear
 
int numTrials
 
gen::ParameterCollector parameters
 
bool printCards
 
bool readMCatNLOfile
 
bool useJimmy
 

Additional Inherited Members

- Static Public Member Functions inherited from gen::FortranInstance
template<typename T >
static T * getInstance ()
 
- Protected Member Functions inherited from gen::BaseHadronizer
std::auto_ptr< HepMC::GenEvent > & event ()
 
std::auto_ptr
< GenEventInfoProduct > & 
eventInfo ()
 
lhef::LHEEventlheEvent ()
 
lhef::LHERunInfolheRunInfo ()
 
GenRunInfoProductrunInfo ()
 
- Protected Member Functions inherited from gen::Herwig6Instance
virtual bool hwwarn (const std::string &fn, int code)
 

Detailed Description

Definition at line 75 of file Herwig6Hadronizer.cc.

Constructor & Destructor Documentation

Herwig6Hadronizer::Herwig6Hadronizer ( const edm::ParameterSet params)

Definition at line 136 of file Herwig6Hadronizer.cc.

References edm::ParameterSet::exists(), fConvertToPDG, and edm::ParameterSet::getParameter().

136  :
137  BaseHadronizer(params),
138  needClear(false),
139  parameters(params.getParameter<edm::ParameterSet>("HerwigParameters")),
140  herwigVerbosity(params.getUntrackedParameter<int>("herwigVerbosity", 0)),
141  hepmcVerbosity(params.getUntrackedParameter<int>("hepmcVerbosity", 0)),
142  maxEventsToPrint(params.getUntrackedParameter<int>("maxEventsToPrint", 0)),
143  printCards(params.getUntrackedParameter<bool>("printCards", false)),
144  emulatePythiaStatusCodes(params.getUntrackedParameter<bool>("emulatePythiaStatusCodes", false)),
145  comEnergy(params.getParameter<double>("comEnergy")),
146  useJimmy(params.getParameter<bool>("useJimmy")),
147  doMPInteraction(params.getParameter<bool>("doMPInteraction")),
148  numTrials(params.getUntrackedParameter<int>("numTrialsMPI", 100)),
149  readMCatNLOfile(false)
150 {
151 
152  fConvertToPDG = false;
153  if ( params.exists( "doPDGConvert" ) )
154  fConvertToPDG = params.getParameter<bool>("doPDGConvert");
155 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
BaseHadronizer(edm::ParameterSet const &ps)
bool exists(std::string const &parameterName) const
checks if a parameter exists
gen::ParameterCollector parameters
Herwig6Hadronizer::~Herwig6Hadronizer ( )

Definition at line 157 of file Herwig6Hadronizer.cc.

References clear().

158 {
159  clear();
160 }

Member Function Documentation

const char* Herwig6Hadronizer::classname ( ) const
inline

Definition at line 99 of file Herwig6Hadronizer.cc.

99 { return "Herwig6Hadronizer"; }
void Herwig6Hadronizer::clear ( void  )
private

Definition at line 162 of file Herwig6Hadronizer.cc.

References gen::FortranInstance::call(), jmefin, needClear, and useJimmy.

Referenced by python.Vispa.Views.BoxDecayView.BoxDecayView::closeEvent(), initialize(), python.Vispa.Views.LineDecayView.LineDecayView::setDataObjects(), python.Vispa.Views.BoxDecayView.BoxDecayView::updateContent(), and ~Herwig6Hadronizer().

163 {
164  if (!needClear)
165  return;
166 
167  // teminate elementary process
168  call(hwefin);
169  if (useJimmy)
170  call(jmefin);
171 
172  needClear = false;
173 }
void call(void(&fn)())
#define jmefin
Definition: herwig.h:322
bool Herwig6Hadronizer::decay ( )

Definition at line 571 of file Herwig6Hadronizer.cc.

References conv, gen::BaseHadronizer::event(), fConvertToPDG, and wrapper.

572 {
573  // hadron decays
574 
575  InstanceWrapper wrapper(this); // safe guard
576 
577  hwdhad(); // unstable particle decays
578  hwdhvy(); // heavy flavour decays
579  hwmevt(); // soft underlying event
580 
581  hwufne(); // finalize event
582 
583  if (hwevnt.IERROR)
584  return false;
585 
586  event().reset(new HepMC::GenEvent);
587  if (!conv.fill_next_event(event().get()))
588  throw cms::Exception("Herwig6Error")
589  << "HepMC Conversion problems in event." << std::endl;
590 
591  // do particle ID conversion Herwig->PDG, if requested
592  if ( fConvertToPDG ) {
593  for ( HepMC::GenEvent::particle_iterator part = event()->particles_begin(); part != event()->particles_end(); ++part) {
594  if ((*part)->pdg_id() != HepPID::translateHerwigtoPDT((*part)->pdg_id()))
595  (*part)->set_pdg_id(HepPID::translateHerwigtoPDT((*part)->pdg_id()));
596  }
597  }
598 
599  return true;
600 }
HepMC::IO_HERWIG conv
std::auto_ptr< HepMC::GenEvent > & event()
part
Definition: HCALResponse.h:21
static HepMC::HEPEVT_Wrapper wrapper
bool Herwig6Hadronizer::declareSpecialSettings ( const std::vector< std::string >  )

Definition at line 403 of file Herwig6Hadronizer.cc.

404 {
405  return true;
406 }
bool Herwig6Hadronizer::declareStableParticles ( const std::vector< int > &  pdgIds)

Definition at line 394 of file Herwig6Hadronizer.cc.

395 {
396  for(std::vector<int>::const_iterator iter = pdgIds.begin();
397  iter != pdgIds.end(); ++iter)
398  if (!markStable(*iter))
399  return false;
400  return true;
401 }
void Herwig6Hadronizer::finalizeEvent ( )

Definition at line 465 of file Herwig6Hadronizer.cc.

References abs, emulatePythiaStatusCodes, gen::BaseHadronizer::event(), gen::BaseHadronizer::eventInfo(), externalPartons, lhef::LHEEvent::fillEventInfo(), lhef::LHEEvent::fillPdfInfo(), lhef::LHEEvent::fixHepMCEventTimeOrdering(), configurableAnalysis::GenParticle, hwuaem_(), hwualf_(), gen::BaseHadronizer::lheEvent(), gen::BaseHadronizer::lheRunInfo(), NULL, and pythiaStatusCodes().

466 {
468 
469  HepMC::PdfInfo pdfInfo;
470  if(externalPartons) {
471  lheEvent()->fillEventInfo( event().get() );
472  lheEvent()->fillPdfInfo( &pdfInfo );
473 
474  // for MC@NLO: IDWRUP is not filled...
475  if(event()->signal_process_id()==0)
476  event()->set_signal_process_id( abs(hwproc.IPROC) );
477 
478  }
479 
480  HepMC::GenParticle* incomingParton = NULL;
481  HepMC::GenParticle* targetParton = NULL;
482 
483  HepMC::GenParticle* incomingProton = NULL;
484  HepMC::GenParticle* targetProton = NULL;
485 
486  // find incoming parton (first entry with IST=121)
487  for(HepMC::GenEvent::particle_const_iterator it = event()->particles_begin();
488  (it != event()->particles_end() && incomingParton==NULL); it++)
489  if((*it)->status()==121) incomingParton = (*it);
490 
491  // find target parton (first entry with IST=122)
492  for(HepMC::GenEvent::particle_const_iterator it = event()->particles_begin();
493  (it != event()->particles_end() && targetParton==NULL); it++)
494  if((*it)->status()==122) targetParton = (*it);
495 
496  // find incoming Proton (first entry ID=2212, IST=101)
497  for(HepMC::GenEvent::particle_const_iterator it = event()->particles_begin();
498  (it != event()->particles_end() && incomingProton==NULL); it++)
499  if((*it)->status()==101 && (*it)->pdg_id()==2212) incomingProton = (*it);
500 
501  // find target Proton (first entry ID=2212, IST=102)
502  for(HepMC::GenEvent::particle_const_iterator it = event()->particles_begin();
503  (it != event()->particles_end() && targetProton==NULL); it++)
504  if((*it)->status()==102 && (*it)->pdg_id()==2212) targetProton = (*it);
505 
506  // find hard scale Q (computed from colliding partons)
507  if( incomingParton && targetParton ) {
508  math::XYZTLorentzVector totMomentum(0,0,0,0);
509  totMomentum+=incomingParton->momentum();
510  totMomentum+=targetParton->momentum();
511  double evScale = totMomentum.mass();
512  double evScale2 = evScale*evScale;
513 
514  // find alpha_QED & alpha_QCD
515  int one=1;
516  double alphaQCD=hwualf_(&one,&evScale);
517  double alphaQED=hwuaem_(&evScale2);
518 
519  if(!externalPartons || event()->event_scale() < 0) event()->set_event_scale(evScale);
520  if(!externalPartons || event()->alphaQCD() < 0) event()->set_alphaQCD(alphaQCD);
521  if(!externalPartons || event()->alphaQED() < 0) event()->set_alphaQED(alphaQED);
522 
523  if(!externalPartons || pdfInfo.x1() < 0) {
524  // get the PDF information
525  pdfInfo.set_id1( incomingParton->pdg_id()==21 ? 0 : incomingParton->pdg_id());
526  pdfInfo.set_id2( targetParton->pdg_id()==21 ? 0 : targetParton->pdg_id());
527  if( incomingProton && targetProton ) {
528  double x1 = incomingParton->momentum().pz()/incomingProton->momentum().pz();
529  double x2 = targetParton->momentum().pz()/targetProton->momentum().pz();
530  pdfInfo.set_x1(x1);
531  pdfInfo.set_x2(x2);
532  }
533  // we do not fill pdf1 & pdf2, since they are not easily available (what are they needed for anyways???)
534  pdfInfo.set_scalePDF(evScale); // the same as Q above... does this make sense?
535  }
536 
537  if(!externalPartons || event()->signal_process_id() < 0) event()->set_signal_process_id( abs(hwproc.IPROC) );
538  event()->set_pdf_info( pdfInfo );
539  }
540 
541  // add event weight & PDF information
542  if (lheRunInfo() != 0 && std::abs(lheRunInfo()->getHEPRUP()->IDWTUP) == 4)
543  // in LHE weighting mode 4 the weight is an xsec, so convert form HERWIG
544  // to standard CMS unit "picobarn"
545  event()->weights().push_back( 1.0e3 * hwevnt.EVWGT );
546  else
547  event()->weights().push_back( hwevnt.EVWGT );
548 
549 
550  // find final parton (first entry with IST=123)
551  HepMC::GenParticle* finalParton = NULL;
552  for(HepMC::GenEvent::particle_const_iterator it = event()->particles_begin();
553  (it != event()->particles_end() && finalParton==NULL); it++)
554  if((*it)->status()==123) finalParton = (*it);
555 
556 
557  // add GenEventInfo & binning Values
558  eventInfo().reset(new GenEventInfoProduct(event().get()));
559  if(finalParton) {
560  double thisPt=finalParton->momentum().perp();
561  eventInfo()->setBinningValues(std::vector<double>(1, thisPt));
562  }
563 
564  // emulate PY6 status codes, if switched on...
567 
568 }
void fillEventInfo(HepMC::GenEvent *hepmc) const
Definition: LHEEvent.cc:240
#define abs(x)
Definition: mlp_lapack.h:159
static void fixHepMCEventTimeOrdering(HepMC::GenEvent *event)
Definition: LHEEvent.cc:503
#define NULL
Definition: scimark2.h:8
std::auto_ptr< HepMC::GenEvent > & event()
double hwualf_(int *mode, double *scale)
double hwuaem_(double *scale)
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:30
lhef::LHEEvent * lheEvent()
void fillPdfInfo(HepMC::PdfInfo *info) const
Definition: LHEEvent.cc:212
std::auto_ptr< GenEventInfoProduct > & eventInfo()
lhef::LHERunInfo * lheRunInfo()
bool Herwig6Hadronizer::generatePartonsAndHadronize ( )
inline

Definition at line 93 of file Herwig6Hadronizer.cc.

References hadronize().

93 { return hadronize(); }
bool Herwig6Hadronizer::hadronize ( )

Definition at line 424 of file Herwig6Hadronizer.cc.

References gen::Herwig6Instance::callWithTimeout(), lhef::LHEEvent::count(), doMPInteraction, error, gen::BaseHadronizer::event(), hwwarn_(), lhef::LHERunInfo::kAccepted, lhef::LHERunInfo::kKilled, gen::BaseHadronizer::lheEvent(), useJimmy, and wrapper.

Referenced by generatePartonsAndHadronize().

425 {
426  // hard process generation, parton shower, hadron formation
427 
428  InstanceWrapper wrapper(this); // safe guard
429 
430  event().reset();
431 
432  // call herwig routines to create HEPEVT
433 
434  hwuine(); // initialize event
435 
436  if (callWithTimeout(10, hwepro)) { // process event and PS
437  // We hung for more than 10 seconds
438  int error = 199;
439  hwwarn_("HWHGUP", &error);
440  }
441 
442  hwbgen(); // parton cascades
443 
444  // call jimmy ... only if event is not killed yet by HERWIG
445  if (useJimmy && doMPInteraction && !hwevnt.IERROR && call_hwmsct()) {
447  return false;
448  }
449 
450  hwdhob(); // heavy quark decays
451  hwcfor(); // cluster formation
452  hwcdec(); // cluster decays
453 
454  // if event *not* killed by HERWIG, return true
455  if (hwevnt.IERROR) {
456  hwufne(); // finalize event, to keep system clean
458  return false;
459  }
460 
462  return true;
463 }
void count(LHERunInfo::CountMode count, double weight=1.0, double matchWeight=1.0)
Definition: LHEEvent.cc:198
std::auto_ptr< HepMC::GenEvent > & event()
lhef::LHEEvent * lheEvent()
bool callWithTimeout(unsigned int secs, void(*fn)())
void hwwarn_(const char *method, int *id)
static HepMC::HEPEVT_Wrapper wrapper
bool Herwig6Hadronizer::initialize ( const lhef::HEPRUP heprup)

Definition at line 221 of file Herwig6Hadronizer.cc.

References gen::ParameterCollector::begin(), gen::FortranInstance::call(), clear(), comEnergy, edm::errors::Configuration, doMPInteraction, lhef::HEPRUP::EBMUP, gen::ParameterCollector::end(), edm::hlt::Exception, externalPartons, lhef::LHERunInfo::findHeader(), gen::Herwig6Instance::give(), hepmcVerbosity, herwigVerbosity, hwdspn, hwprch, i, lhef::HEPRUP::IDBMUP, info, jimmin, jminit, jmparm, gen::BaseHadronizer::lheRunInfo(), geometryCSVtoXML::line, maxEventsToPrint, needClear, parameters, lhef::LHERunInfo::pdfSetTranslation(), printCards, setSLHAFromHeader(), and useJimmy.

Referenced by initializeForExternalPartons(), and initializeForInternalPartons().

222 {
223  clear();
224 
225  externalPartons = (heprup != 0);
226 
227  std::ostringstream info;
228  info << "---------------------------------------------------\n";
229  info << "Initializing Herwig6Hadronizer for "
230  << (externalPartons ? "external" : "internal") << " partons\n";
231  info << "---------------------------------------------------\n";
232 
233  info << " Herwig verbosity level = " << herwigVerbosity << "\n";
234  info << " HepMC verbosity = " << hepmcVerbosity << "\n";
235  info << " Number of events to be printed = " << maxEventsToPrint << "\n";
236 
237  // Call hwudat to set up HERWIG block data
238  hwudat();
239 
240  // Setting basic parameters
241  if (externalPartons) {
242  hwproc.PBEAM1 = heprup->EBMUP.first;
243  hwproc.PBEAM2 = heprup->EBMUP.second;
244  pdgToHerwig(heprup->IDBMUP.first, hwbmch.PART1);
245  pdgToHerwig(heprup->IDBMUP.second, hwbmch.PART2);
246  } else {
247  hwproc.PBEAM1 = 0.5 * comEnergy;
248  hwproc.PBEAM2 = 0.5 * comEnergy;
249  pdgToHerwig(2212, hwbmch.PART1);
250  pdgToHerwig(2212, hwbmch.PART2);
251  }
252 
253  if (useJimmy) {
254  info << " HERWIG will be using JIMMY for UE/MI.\n";
255  jmparm.MSFLAG = 1;
256  if (doMPInteraction)
257  info << " JIMMY trying to generate multiple interactions.\n";
258  }
259 
260 
261  // set the IPROC already here... needed for VB pairs
262 
263  bool iprocFound=false;
264 
266  line != parameters.end(); ++line) {
267  if(!strcmp((line->substr(0,5)).c_str(),"IPROC")) {
268  if (!give(*line))
270  << "Herwig 6 did not accept the following: \""
271  << *line << "\"." << std::endl;
272  else iprocFound=true;
273  }
274  }
275 
276  if (!iprocFound && !externalPartons)
278  << "You have to define the process with IPROC." << std::endl;
279 
280  // initialize other common blocks ...
281  call(hwigin);
282  hwevnt.MAXER = 100000000; // O(inf)
283  hwpram.LWSUD = 0; // don't write Sudakov form factors
284  hwdspn.LWDEC = 0; // don't write three/four body decays
285  // (no fort.77 and fort.88 ...)
286 
287  // init LHAPDF glue
288 
289  std::memset(hwprch.AUTPDF, ' ', sizeof hwprch.AUTPDF);
290  for(unsigned int i = 0; i < 2; i++) {
291  hwpram.MODPDF[i] = -111;
292  std::memcpy(hwprch.AUTPDF[i], "HWLHAPDF", 8);
293  }
294 
295  if (useJimmy)
296  call(jimmin);
297 
298  hwevnt.MAXPR = maxEventsToPrint;
299  hwpram.IPRINT = herwigVerbosity;
300 // hwprop.RMASS[6] = 175.0; //FIXME
301 
302  if (printCards) {
303  info << "\n";
304  info << "------------------------------------\n";
305  info << "Reading HERWIG parameters\n";
306  info << "------------------------------------\n";
307 
308  }
310  line != parameters.end(); ++line) {
311  if (printCards)
312  info << " " << *line << "\n";
313  if (!give(*line))
315  << "Herwig 6 did not accept the following: \""
316  << *line << "\"." << std::endl;
317  }
318 
319  if (printCards)
320  info << "\n";
321 
322  if (externalPartons) {
323  std::vector<std::string> slha =
324  lheRunInfo()->findHeader("slha");
325  if (!slha.empty())
326  setSLHAFromHeader(slha);
327  }
328 
329  needClear = true;
330 
331  std::pair<int, int> pdfs(-1, -1);
332  if (externalPartons)
333  pdfs = lheRunInfo()->pdfSetTranslation();
334 
335  if (hwpram.MODPDF[0] != -111 || hwpram.MODPDF[1] != -111) {
336  for(unsigned int i = 0; i < 2; i++)
337  if (hwpram.MODPDF[i] == -111)
338  hwpram.MODPDF[i] = -1;
339 
340  if (pdfs.first != -1 || pdfs.second != -1)
341  edm::LogError("Generator|Herwig6Hadronzier")
342  << "Both external Les Houches event and "
343  "config file specify a PDF set. "
344  "User PDF will override external one."
345  << std::endl;
346 
347  pdfs.first = hwpram.MODPDF[0] != -111 ? hwpram.MODPDF[0] : -1;
348  pdfs.second = hwpram.MODPDF[1] != -111 ? hwpram.MODPDF[1] : -1;
349  }
350 
351  hwpram.MODPDF[0] = pdfs.first;
352  hwpram.MODPDF[1] = pdfs.second;
353 
354  if (externalPartons)
355  hwproc.IPROC = -1;
356 
357  // HERWIG preparations ...
358  call(hwuinc);
359  markStable(13); // MU+
360  markStable(-13); // MU-
361  markStable(3112); // SIGMA+
362  markStable(-3112); // SIGMABAR+
363  markStable(3222); // SIGMA-
364  markStable(-3222); // SIGMABAR-
365  markStable(3122); // LAMBDA0
366  markStable(-3122); // LAMBDABAR0
367  markStable(3312); // XI-
368  markStable(-3312); // XIBAR+
369  markStable(3322); // XI0
370  markStable(-3322); // XI0BAR
371  markStable(3334); // OMEGA-
372  markStable(-3334); // OMEGABAR+
373  markStable(211); // PI+
374  markStable(-211); // PI-
375  markStable(321); // K+
376  markStable(-321); // K-
377  markStable(310); // K_S0
378  markStable(130); // K_L0
379 
380  // better: merge with declareStableParticles
381  // and get the list from configuration / Geant4 / Core somewhere
382 
383  // initialize HERWIG event generation
384  call(hweini);
385 
386  if (useJimmy)
387  call(jminit);
388 
389  edm::LogInfo(info.str());
390 
391  return true;
392 }
int i
Definition: DBlmapReader.cc:9
void call(void(&fn)())
void setSLHAFromHeader(const std::vector< std::string > &lines)
std::pair< double, double > EBMUP
Definition: LesHouches.h:78
#define hwdspn
Definition: herwig.h:223
#define jminit
Definition: herwig.h:320
std::pair< int, int > IDBMUP
Definition: LesHouches.h:73
#define hwprch
Definition: herwig.h:63
#define jmparm
Definition: herwig.h:301
bool give(const std::string &line)
lhef::LHERunInfo * lheRunInfo()
std::pair< int, int > pdfSetTranslation() const
Definition: LHERunInfo.cc:502
const_iterator end() const
const_iterator begin() const
std::vector< std::string > findHeader(const std::string &tag) const
Definition: LHERunInfo.cc:390
#define jimmin
Definition: herwig.h:319
gen::ParameterCollector parameters
bool Herwig6Hadronizer::initializeForExternalPartons ( )
inline

Definition at line 85 of file Herwig6Hadronizer.cc.

References initialize(), and gen::BaseHadronizer::lheRunInfo().

85 { return initialize(lheRunInfo()->getHEPRUP()); }
bool initialize(const lhef::HEPRUP *heprup)
lhef::LHERunInfo * lheRunInfo()
bool Herwig6Hadronizer::initializeForInternalPartons ( )
inline

Definition at line 84 of file Herwig6Hadronizer.cc.

References initialize().

84 { return initialize(0); }
bool initialize(const lhef::HEPRUP *heprup)
int Herwig6Hadronizer::pythiaStatusCode ( const HepMC::GenParticle *  p) const
private

Definition at line 650 of file Herwig6Hadronizer.cc.

References externalPartons, configurableAnalysis::GenParticle, lumiQueryAPI::q, and ntuplemaker::status.

Referenced by pythiaStatusCodes().

651 {
652  int status = p->status();
653 
654  // weird 9922212 particles...
655  if (status == 3 && !p->end_vertex())
656  return 2;
657 
658  if (status >= 1 && status <= 3)
659  return status;
660 
661  if (!p->end_vertex())
662  return 1;
663 
664  // let's prevent particles having status 3, if the identical
665  // particle downstream is a better status 3 candidate
666  int currentId = p->pdg_id();
667  int orig = status;
668  if (status == 123 || status == 124 ||
669  status == 155 || status == 156 || status == 160 ||
670  (status >= 195 && status <= 197)) {
671  for(const HepMC::GenParticle *q = p;;) {
672  const HepMC::GenVertex *vtx = q->end_vertex();
673  if (!vtx)
674  break;
675 
676  HepMC::GenVertex::particles_out_const_iterator iter;
677  for(iter = vtx->particles_out_const_begin();
678  iter != vtx->particles_out_const_end(); ++iter)
679  if ((*iter)->pdg_id() == currentId)
680  break;
681 
682  if (iter == vtx->particles_out_const_end())
683  break;
684 
685  q = *iter;
686  if (q->status() == 3 ||
687  ((status == 120 || status == 123 ||
688  status == 124) && orig > 124))
689  return 4;
690  }
691  }
692 
693  int nesting = 0;
694  for(;;) {
695  if ((status >= 120 && status <= 122) || status == 3) {
696  // avoid flagging status 3 if there is a
697  // better status 3 candidate upstream
698  if (externalPartons)
699  return ((orig >= 121 && orig <= 124) ||
700  orig == 3) ? 3 : 4;
701  else
702  return (nesting ||
703  (status != 3 && orig <= 124)) ? 3 : 4;
704  }
705 
706  // check whether we are leaving the hard process
707  // including heavy resonance decays
708  if (!(status == 4 || status == 123 || status == 124 ||
709  status == 155 || status == 156 || status == 160 ||
710  (status >= 195 && status <= 197)))
711  break;
712 
713  const HepMC::GenVertex *vtx = p->production_vertex();
714  if (!vtx || !vtx->particles_in_size())
715  break;
716 
717  p = *vtx->particles_in_const_begin();
718  status = p->status();
719 
720  int newId = p->pdg_id();
721 
722  if (!newId)
723  break;
724 
725  // nesting increases if we move to the next-best mother
726  if (newId != currentId) {
727  if (++nesting > 1 && externalPartons)
728  break;
729  currentId = newId;
730  }
731  }
732 
733  return 2;
734 }
tuple status
Definition: ntuplemaker.py:245
void Herwig6Hadronizer::pythiaStatusCodes ( )
private

Definition at line 736 of file Herwig6Hadronizer.cc.

References gen::BaseHadronizer::event(), and pythiaStatusCode().

Referenced by finalizeEvent().

737 {
738  for(HepMC::GenEvent::particle_iterator iter =
739  event()->particles_begin();
740  iter != event()->particles_end(); iter++)
741  (*iter)->set_status(pythiaStatusCode(*iter));
742 
743  for(HepMC::GenEvent::particle_iterator iter =
744  event()->particles_begin();
745  iter != event()->particles_end(); iter++)
746  if ((*iter)->status() == 4)
747  (*iter)->set_status(2);
748 }
std::auto_ptr< HepMC::GenEvent > & event()
int pythiaStatusCode(const HepMC::GenParticle *p) const
bool Herwig6Hadronizer::residualDecay ( )

Definition at line 602 of file Herwig6Hadronizer.cc.

603 {
604  return true;
605 }
void Herwig6Hadronizer::setSLHAFromHeader ( const std::vector< std::string > &  lines)

Definition at line 175 of file Herwig6Hadronizer.cc.

References Association::block, ExpressReco_HICollisions_FallBack::blocks, geometryCSVtoXML::line, pos, split, and EcalElecEmulTccFlatFileProducerFromTPG_cfg::tokens.

Referenced by initialize().

177 {
178  std::set<std::string> blocks;
179  std::string block;
180  for(std::vector<std::string>::const_iterator iter = lines.begin();
181  iter != lines.end(); ++iter) {
182  std::string line = *iter;
183  std::transform(line.begin(), line.end(),
184  line.begin(), (int(*)(int))std::toupper);
185  std::string::size_type pos = line.find('#');
186  if (pos != std::string::npos)
187  line.resize(pos);
188 
189  if (line.empty())
190  continue;
191 
192  if (!boost::algorithm::is_space()(line[0])) {
193  std::vector<std::string> tokens;
194  boost::split(tokens, line,
195  boost::algorithm::is_space(),
196  boost::token_compress_on);
197  if (!tokens.size())
198  continue;
199  block.clear();
200  if (tokens.size() < 2)
201  continue;
202  if (tokens[0] == "BLOCK")
203  block = tokens[1];
204  else if (tokens[0] == "DECAY")
205  block = "DECAY";
206 
207  if (block.empty())
208  continue;
209 
210  if (!blocks.count(block)) {
211  blocks.insert(block);
212  edm::LogWarning("Generator|Herwig6Hadronzier")
213  << "Unsupported SLHA block \"" << block
214  << "\". It will be ignored."
215  << std::endl;
216  }
217  }
218  }
219 }
uint16_t size_type
block
Formating index page&#39;s pieces.
Definition: Association.py:187
double split
Definition: MVATrainer.cc:139
void Herwig6Hadronizer::statistics ( )

Definition at line 408 of file Herwig6Hadronizer.cc.

References gen::BaseHadronizer::runInfo(), and GenRunInfoProduct::setInternalXSec().

409 {
410  if (!runInfo().internalXSec()) {
411  // not set via LHE, so get it from HERWIG
412  // the reason is that HERWIG doesn't compute the xsec
413  // in all LHE modes
414 
415  double RNWGT = 1. / hwevnt.NWGTS;
416  double AVWGT = hwevnt.WGTSUM * RNWGT;
417 
418  double xsec = 1.0e3 * AVWGT;
419 
420  runInfo().setInternalXSec(xsec);
421  }
422 }
void setInternalXSec(const XSec &xsec)
GenRunInfoProduct & runInfo()
void Herwig6Hadronizer::upEvnt ( )
privatevirtual

Reimplemented from gen::FortranInstance.

Definition at line 632 of file Herwig6Hadronizer.cc.

References begin, edm::errors::Configuration, lhef::CommonBlocks::fillHEPEUP(), lhef::LHEEvent::getComments(), gen::Herwig6Instance::give(), gen::BaseHadronizer::lheEvent(), and readMCatNLOfile.

633 {
635 
636  // if MCatNLO external file is read, read comment & pass IHPRO to HERWIG
637  if(readMCatNLOfile) {
638  for(std::vector<std::string>::const_iterator iter=lheEvent()->getComments().begin();
639  iter!=lheEvent()->getComments().end(); ++iter) {
640  std::string toParse(iter->substr(1));
641  if (!give(toParse))
643  << "Herwig 6 did not accept the following: \""
644  << toParse << "\"." << std::endl;
645  }
646  }
647 
648 }
const std::vector< std::string > & getComments() const
Definition: LHEEvent.h:45
lhef::LHEEvent * lheEvent()
static void fillHEPEUP(const HEPEUP *hepeup)
bool give(const std::string &line)
#define begin
Definition: vmac.h:31
void Herwig6Hadronizer::upInit ( )
privatevirtual

Reimplemented from gen::FortranInstance.

Definition at line 607 of file Herwig6Hadronizer.cc.

References edm::errors::Configuration, lhef::CommonBlocks::fillHEPRUP(), lhef::LHERunInfo::getHeaders(), gen::Herwig6Instance::give(), heprup_, gen::BaseHadronizer::lheRunInfo(), HEPRUP_::pdfgup, HEPRUP_::pdfsup, and readMCatNLOfile.

608 {
610  heprup_.pdfgup[0] = heprup_.pdfgup[1] = -1;
611  heprup_.pdfsup[0] = heprup_.pdfsup[1] = -1;
612  // we set up the PDFs ourselves
613 
614  // pass HERWIG paramaters fomr header (if present)
615  std::string mcnloHeader="herwig6header";
616  std::vector<lhef::LHERunInfo::Header> headers=lheRunInfo()->getHeaders();
617  for(std::vector<lhef::LHERunInfo::Header>::const_iterator hIter=headers.begin();hIter!=headers.end(); ++hIter) {
618  if(hIter->tag()==mcnloHeader){
619  readMCatNLOfile=true;
620  for(lhef::LHERunInfo::Header::const_iterator lIter=hIter->begin(); lIter != hIter->end(); ++lIter) {
621  if((lIter->c_str())[0]!='#' && (lIter->c_str())[0]!='\n') { // it's not a comment)
622  if (!give(*lIter))
624  << "Herwig 6 did not accept the following: \""
625  << *lIter << "\"." << std::endl;
626  }
627  }
628  }
629  }
630 }
int pdfgup[2]
struct HEPRUP_ heprup_
std::vector< std::string >::const_iterator const_iterator
const std::vector< Header > & getHeaders() const
Definition: LHERunInfo.h:58
bool give(const std::string &line)
lhef::LHERunInfo * lheRunInfo()
int pdfsup[2]
static void fillHEPRUP(const HEPRUP *heprup)

Member Data Documentation

double Herwig6Hadronizer::comEnergy
private

Definition at line 120 of file Herwig6Hadronizer.cc.

Referenced by initialize().

HepMC::IO_HERWIG Herwig6Hadronizer::conv
private

Definition at line 110 of file Herwig6Hadronizer.cc.

Referenced by decay().

bool Herwig6Hadronizer::doMPInteraction
private

Definition at line 122 of file Herwig6Hadronizer.cc.

Referenced by hadronize(), and initialize().

bool Herwig6Hadronizer::emulatePythiaStatusCodes
private

Definition at line 119 of file Herwig6Hadronizer.cc.

Referenced by finalizeEvent().

bool Herwig6Hadronizer::externalPartons
private

Definition at line 112 of file Herwig6Hadronizer.cc.

Referenced by finalizeEvent(), initialize(), and pythiaStatusCode().

bool Herwig6Hadronizer::fConvertToPDG
private

Definition at line 124 of file Herwig6Hadronizer.cc.

Referenced by decay(), and Herwig6Hadronizer().

int Herwig6Hadronizer::hepmcVerbosity
private

Definition at line 116 of file Herwig6Hadronizer.cc.

Referenced by initialize().

int Herwig6Hadronizer::herwigVerbosity
private

Definition at line 115 of file Herwig6Hadronizer.cc.

Referenced by initialize().

int Herwig6Hadronizer::maxEventsToPrint
private

Definition at line 117 of file Herwig6Hadronizer.cc.

Referenced by initialize().

bool Herwig6Hadronizer::needClear
private

Definition at line 111 of file Herwig6Hadronizer.cc.

Referenced by clear(), and initialize().

int Herwig6Hadronizer::numTrials
private

Definition at line 123 of file Herwig6Hadronizer.cc.

gen::ParameterCollector Herwig6Hadronizer::parameters
private
bool Herwig6Hadronizer::printCards
private

Definition at line 118 of file Herwig6Hadronizer.cc.

Referenced by initialize().

bool Herwig6Hadronizer::readMCatNLOfile
private

Definition at line 126 of file Herwig6Hadronizer.cc.

Referenced by upEvnt(), and upInit().

bool Herwig6Hadronizer::useJimmy
private

Definition at line 121 of file Herwig6Hadronizer.cc.

Referenced by clear(), hadronize(), and initialize().