CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
gen::Cascade2Hadronizer Class Reference

#include <Cascade2Hadronizer.h>

Inheritance diagram for gen::Cascade2Hadronizer:
gen::BaseHadronizer

Public Member Functions

 Cascade2Hadronizer (edm::ParameterSet const &ps)
 
void cascadePrintParameters ()
 
bool cascadeReadParameters (const std::string &ParameterString)
 
const char * classname () const
 
bool decay ()
 
bool declareSpecialSettings (const std::vector< std::string > &)
 
bool declareStableParticles (const std::vector< int > &)
 
void finalizeEvent ()
 
bool generatePartonsAndHadronize ()
 
bool hadronize ()
 
bool initializeForExternalPartons ()
 
bool initializeForInternalPartons ()
 
void pythia6PrintParameters ()
 
bool readSettings (int)
 
bool residualDecay ()
 
void statistics ()
 
 ~Cascade2Hadronizer () override
 
- Public Member Functions inherited from gen::BaseHadronizer
 BaseHadronizer (edm::ParameterSet const &ps)
 
void cleanLHE ()
 
void generateLHE (edm::LuminosityBlock const &lumi, CLHEP::HepRandomEngine *rengine, unsigned int ncpu)
 
edm::EventgetEDMEvent () const
 
std::unique_ptr< HepMC::GenEventgetGenEvent ()
 
std::unique_ptr
< GenEventInfoProduct
getGenEventInfo ()
 
virtual std::unique_ptr
< GenLumiInfoHeader
getGenLumiInfoHeader () const
 
GenRunInfoProductgetGenRunInfo ()
 
std::unique_ptr< lhef::LHEEventgetLHEEvent ()
 
const std::shared_ptr
< lhef::LHERunInfo > & 
getLHERunInfo () const
 
const std::string & gridpackPath () const
 
int randomIndex () const
 
const std::string & randomInitConfigDescription () const
 
void randomizeIndex (edm::LuminosityBlock const &lumi, CLHEP::HepRandomEngine *rengine)
 
void resetEvent (std::unique_ptr< HepMC::GenEvent > event)
 
void resetEventInfo (std::unique_ptr< GenEventInfoProduct > eventInfo)
 
virtual bool select (HepMC::GenEvent *) const
 
void setEDMEvent (edm::Event &event)
 
void setLHEEvent (std::unique_ptr< lhef::LHEEvent > event)
 
void setLHERunInfo (std::unique_ptr< lhef::LHERunInfo > runInfo)
 
void setRandomEngine (CLHEP::HepRandomEngine *v)
 
std::vector< std::string > const & sharedResources () const
 
virtual ~BaseHadronizer () noexcept(false)
 

Private Member Functions

void doSetRandomEngine (CLHEP::HepRandomEngine *v) override
 
std::vector< std::string > const & doSharedResources () const override
 
void fillTmpStorage ()
 
void flushTmpStorage ()
 
void imposeProperTime ()
 

Private Attributes

double fComEnergy
 
bool fConvertToPDG
 
bool fDisplayPythiaBanner
 
bool fDisplayPythiaCards
 
double fextCrossSection
 
double fextCrossSectionError
 
double fFilterEfficiency
 
bool fHepMCVerbosity
 
unsigned int fMaxEventsToPrint
 
edm::ParameterSet fParameters
 
Pythia6ServicefPy6Service
 
unsigned int fPythiaListVerbosity
 

Static Private Attributes

static const std::vector
< std::string > 
theSharedResources
 

Additional Inherited Members

- Protected Member Functions inherited from gen::BaseHadronizer
std::unique_ptr
< HepMC::GenEvent > & 
event ()
 
std::unique_ptr
< GenEventInfoProduct > & 
eventInfo ()
 
lhef::LHEEventlheEvent ()
 
lhef::LHERunInfolheRunInfo ()
 
GenRunInfoProductrunInfo ()
 
- Protected Attributes inherited from gen::BaseHadronizer
std::string lheFile_
 
int randomIndex_
 

Detailed Description

Definition at line 24 of file Cascade2Hadronizer.h.

Constructor & Destructor Documentation

gen::Cascade2Hadronizer::Cascade2Hadronizer ( edm::ParameterSet const &  ps)

Definition at line 82 of file Cascade2Hadronizer.cc.

References gen::call_pygive(), edm::errors::Configuration, Exception, edm::ParameterSet::exists(), fConvertToPDG, fDisplayPythiaBanner, fDisplayPythiaCards, flushTmpStorage(), fParameters, and edm::ParameterSet::getParameter().

84  fPy6Service(new Pythia6ServiceWithCallback(pset)), //-- this will store py6 parameters for further settings
85 
86  fComEnergy(pset.getParameter<double>("comEnergy")),
87  fextCrossSection(pset.getUntrackedParameter<double>("crossSection", -1.)),
88  fextCrossSectionError(pset.getUntrackedParameter<double>("crossSectionError", -1.)),
89  fFilterEfficiency(pset.getUntrackedParameter<double>("filterEfficiency", -1.)),
90 
91  fMaxEventsToPrint(pset.getUntrackedParameter<int>("maxEventsToPrint", 0)),
92  fHepMCVerbosity(pset.getUntrackedParameter<bool>("pythiaHepMCVerbosity", false)),
93  fPythiaListVerbosity(pset.getUntrackedParameter<int>("pythiaPylistVerbosity", 0)),
94 
95  fDisplayPythiaBanner(pset.getUntrackedParameter<bool>("displayPythiaBanner", false)),
96  fDisplayPythiaCards(pset.getUntrackedParameter<bool>("displayPythiaCards", false)) {
97  fParameters = pset.getParameter<ParameterSet>("Cascade2Parameters");
98 
99  fConvertToPDG = false;
100  if (pset.exists("doPDGConvert"))
101  fConvertToPDG = pset.getParameter<bool>("doPDGConvert");
102 
103  //-- silence Pythia6 banner printout, unless display requested
104 
105  if (!fDisplayPythiaBanner) {
106  if (!call_pygive("MSTU(12)=12345")) {
107  throw edm::Exception(edm::errors::Configuration, "PythiaError") << " Pythia did not accept MSTU(12)=12345";
108  }
109  }
110 
111  //-- silence printouts from PYGIVE, unless display requested
112 
113  if (!fDisplayPythiaCards) {
114  if (!call_pygive("MSTU(13)=0")) {
115  throw edm::Exception(edm::errors::Configuration, "PythiaError") << " Pythia did not accept MSTU(13)=0";
116  }
117  }
118 
119  //-- tmp stuff to deal with EvtGen corrupting pyjets
120  flushTmpStorage();
121  }
Pythia6Service * fPy6Service
BaseHadronizer(edm::ParameterSet const &ps)
bool call_pygive(const std::string &line)
edm::ParameterSet fParameters
gen::Cascade2Hadronizer::~Cascade2Hadronizer ( )
override

Definition at line 123 of file Cascade2Hadronizer.cc.

References fPy6Service.

123  {
124  if (fPy6Service != nullptr)
125  delete fPy6Service;
126  }
Pythia6Service * fPy6Service

Member Function Documentation

void gen::Cascade2Hadronizer::cascadePrintParameters ( )

Definition at line 726 of file Cascade2Hadronizer.cc.

References cagluon, cahflav, cainpu, caluco, capar1, capar6, captcut, cascol, cashower, caspdf, casprre, casshwr, gather_cfg::cout, fComEnergy, fextCrossSection, fextCrossSectionError, fFilterEfficiency, integr, jpsi, and scalf.

Referenced by initializeForInternalPartons().

726  {
727  cout << "" << endl;
728  cout << "----------------------------------" << endl;
729  cout << "---- Cascade Parameters ----" << endl;
730  cout << "----------------------------------" << endl;
731  cout << "" << endl;
732 
733  cout << "computation switch: " << endl;
734  cout << "number of calls per iteration for bases: " << integr.ncb << endl;
735  cout << "relative precision for grid optimisation: " << integr.acc1 << " %" << endl;
736  cout << "relative precision for integration: " << integr.acc2 << " %" << endl;
737  cout << "" << endl;
738 
739  cout << "kinematics: " << endl;
740  cout << "flavour code of beam 1: " << caluco.ke << endl;
741  cout << "direct or resolved particle 1: " << capar6.ires[0] << endl;
742  cout << "pz of incoming beam 1: " << cainpu.plepin << " GeV" << endl;
743  cout << "flavour code of beam 2: " << caluco.kp << endl;
744  cout << "direct or resolved particle 2: " << capar6.ires[1] << endl;
745  cout << "pz of incoming beam 2: " << cainpu.ppin << " GeV" << endl;
746  cout << "number of active flavors: " << caluco.nflav << endl;
747  cout << "" << endl;
748 
749  cout << "hard subprocess selection: " << endl;
750  cout << "hard subprocess number (IPRO): " << capar1.ipro << endl;
751  cout << "IPRO = 10, switch to select QCD process g* g* -> q qbar: " << cascol.irpa << endl;
752  cout << "IPRO = 10, switch to select QCD process g* g -> g g: " << cascol.irpb << endl;
753  cout << "IPRO = 10, switch to select QCD process g* q -> g q: " << cascol.irpc << endl;
754  cout << "flavor of heavy quark produced (IPRO = 11, 504, 514): " << cahflav.ihfla << endl;
755  // cout<<"select vector meson state: "<<jpsi.i23s<<endl;
756  cout << "use matrix element including J/psi (Upsilon) polarisation: " << jpsi.ipsipol << endl;
757  cout << "pt2 cut in matrix element for massless partons: " << captcut.pt2cut[capar1.ipro - 1] << " GeV^2" << endl;
758  cout << "" << endl;
759 
760  cout << "parton shower and fragmentation: " << endl;
761  cout << "switch for fragmentation: " << cainpu.nfrag << endl;
762  cout << "switch for parton shower (0 off - 1 initial state - 2 final state - 3 initial & final state): "
763  << cainpu.ifps << endl;
764  cout << "switch for time like parton shower in initial state: " << casshwr.itimshr << endl;
765  cout << "select CCFM (1) or DGLAP (0) evolution: " << casshwr.iccfm << endl;
766  cout << "scale switch for final state parton shower: " << cainpu.ifinal << endl;
767  cout << "scale factor for final state parton shower: " << scalf.scalfaf << endl;
768  cout << "switch for proton remnant treatment: " << casprre.irspl << endl;
769  cout << "keep track of intermediate state in parton shower: " << cashower.ipst << endl;
770  cout << "mode of interaction for e p: " << cainpu.inter << endl;
771  cout << "" << endl;
772 
773  cout << "pdfs, couplings and scales: " << endl;
774  cout << "switch for running alphaem: " << capar1.irunaem << endl;
775  cout << "switch for running alphas: " << capar1.iruna << endl;
776  cout << "scale in alphas: " << capar1.iq2 << endl;
777  cout << "scale factor for scale in alphas: " << scalf.scalfa << endl;
778  cout << "unintegrated pdf: " << cagluon.iglu << endl;
779  cout << "path where updf are stored: " << caspdf.pdfpath << endl;
780  cout << "" << endl;
781 
782  cout << "center of mass energy, cross section, filter efficiency: " << endl;
783  cout << "center of mass energy: " << fComEnergy << " GeV" << endl;
784  cout << "external LO cross section: " << fextCrossSection << " +/- " << fextCrossSectionError << " pb" << endl;
785  cout << "filter efficiency: " << fFilterEfficiency << endl;
786  cout << "" << endl;
787  }
#define cainpu
#define captcut
#define cahflav
#define caluco
#define cagluon
#define integr
#define cascol
#define caspdf
#define scalf
#define capar6
#define capar1
#define cashower
#define casshwr
#define jpsi
#define casprre
tuple cout
Definition: gather_cfg.py:144
bool gen::Cascade2Hadronizer::cascadeReadParameters ( const std::string &  ParameterString)

Definition at line 626 of file Cascade2Hadronizer.cc.

References cagluon, cahflav, cainpu, caluco, capar1, capar6, captcut, cascol, cashower, casprre, casshwr, integr, jpsi, and scalf.

Referenced by initializeForInternalPartons().

626  {
627  bool accepted = true;
628 
629  if (!strncmp(ParameterString.c_str(), "KE", 2))
630  caluco.ke = atoi(&ParameterString[strcspn(ParameterString.c_str(), "=") + 1]);
631 
632  else if (!strncmp(ParameterString.c_str(), "IRES(1)", 7))
633  capar6.ires[0] = atoi(&ParameterString[strcspn(ParameterString.c_str(), "=") + 1]);
634 
635  else if (!strncmp(ParameterString.c_str(), "KP", 2))
636  caluco.kp = atoi(&ParameterString[strcspn(ParameterString.c_str(), "=") + 1]);
637 
638  else if (!strncmp(ParameterString.c_str(), "IRES(2)", 7))
639  capar6.ires[1] = atoi(&ParameterString[strcspn(ParameterString.c_str(), "=") + 1]);
640 
641  else if (!strncmp(ParameterString.c_str(), "NFRAG", 5))
642  cainpu.nfrag = atoi(&ParameterString[strcspn(ParameterString.c_str(), "=") + 1]);
643 
644  else if (!strncmp(ParameterString.c_str(), "IPST", 4))
645  cashower.ipst = atoi(&ParameterString[strcspn(ParameterString.c_str(), "=") + 1]);
646 
647  else if (!strncmp(ParameterString.c_str(), "IPSIPOL", 7))
648  jpsi.ipsipol = atoi(&ParameterString[strcspn(ParameterString.c_str(), "=") + 1]);
649 
650  //-- from version 2.2.03 on
651  // else if(!strncmp(ParameterString.c_str(),"I23S",4))
652  // jpsi.i23s = atoi(&ParameterString[strcspn(ParameterString.c_str(),"=")+1]);
653 
654  else if (!strncmp(ParameterString.c_str(), "IFPS", 4))
655  cainpu.ifps = atoi(&ParameterString[strcspn(ParameterString.c_str(), "=") + 1]);
656 
657  else if (!strncmp(ParameterString.c_str(), "ITIMSHR", 7))
658  casshwr.itimshr = atoi(&ParameterString[strcspn(ParameterString.c_str(), "=") + 1]);
659 
660  else if (!strncmp(ParameterString.c_str(), "IRUNAEM", 7))
661  capar1.irunaem = atoi(&ParameterString[strcspn(ParameterString.c_str(), "=") + 1]);
662 
663  else if (!strncmp(ParameterString.c_str(), "IRUNA", 5))
664  capar1.iruna = atoi(&ParameterString[strcspn(ParameterString.c_str(), "=") + 1]);
665 
666  else if (!strncmp(ParameterString.c_str(), "IQ2", 3))
667  capar1.iq2 = atoi(&ParameterString[strcspn(ParameterString.c_str(), "=") + 1]);
668 
669  else if (!strncmp(ParameterString.c_str(), "IPRO", 4))
670  capar1.ipro = atoi(&ParameterString[strcspn(ParameterString.c_str(), "=") + 1]);
671 
672  else if (!strncmp(ParameterString.c_str(), "NFLAV", 5))
673  caluco.nflav = atoi(&ParameterString[strcspn(ParameterString.c_str(), "=") + 1]);
674 
675  else if (!strncmp(ParameterString.c_str(), "INTER", 5))
676  cainpu.inter = atoi(&ParameterString[strcspn(ParameterString.c_str(), "=") + 1]);
677 
678  else if (!strncmp(ParameterString.c_str(), "IHFLA", 5))
679  cahflav.ihfla = atoi(&ParameterString[strcspn(ParameterString.c_str(), "=") + 1]);
680 
681  else if (!strncmp(ParameterString.c_str(), "IRPA", 4))
682  cascol.irpa = atoi(&ParameterString[strcspn(ParameterString.c_str(), "=") + 1]);
683 
684  else if (!strncmp(ParameterString.c_str(), "IRPB", 4))
685  cascol.irpb = atoi(&ParameterString[strcspn(ParameterString.c_str(), "=") + 1]);
686 
687  else if (!strncmp(ParameterString.c_str(), "IRPC", 4))
688  cascol.irpc = atoi(&ParameterString[strcspn(ParameterString.c_str(), "=") + 1]);
689 
690  else if (!strncmp(ParameterString.c_str(), "ICCFM", 5))
691  casshwr.iccfm = atoi(&ParameterString[strcspn(ParameterString.c_str(), "=") + 1]);
692 
693  else if (!strncmp(ParameterString.c_str(), "IFINAL", 6))
694  cainpu.ifinal = atoi(&ParameterString[strcspn(ParameterString.c_str(), "=") + 1]);
695 
696  else if (!strncmp(ParameterString.c_str(), "IGLU", 4))
697  cagluon.iglu = atoi(&ParameterString[strcspn(ParameterString.c_str(), "=") + 1]);
698 
699  else if (!strncmp(ParameterString.c_str(), "IRspl", 5))
700  casprre.irspl = atoi(&ParameterString[strcspn(ParameterString.c_str(), "=") + 1]);
701 
702  else if (!strncmp(ParameterString.c_str(), "PT2CUT", 6))
703  captcut.pt2cut[capar1.ipro - 1] = atof(&ParameterString[strcspn(ParameterString.c_str(), "=") + 1]);
704 
705  else if (!strncmp(ParameterString.c_str(), "NCB", 3))
706  integr.ncb = atoi(&ParameterString[strcspn(ParameterString.c_str(), "=") + 1]);
707 
708  else if (!strncmp(ParameterString.c_str(), "ACC1", 4))
709  integr.acc1 = atof(&ParameterString[strcspn(ParameterString.c_str(), "=") + 1]);
710 
711  else if (!strncmp(ParameterString.c_str(), "ACC2", 4))
712  integr.acc2 = atof(&ParameterString[strcspn(ParameterString.c_str(), "=") + 1]);
713 
714  else if (!strncmp(ParameterString.c_str(), "SCALFAF", 7))
715  scalf.scalfaf = atof(&ParameterString[strcspn(ParameterString.c_str(), "=") + 1]);
716 
717  else if (!strncmp(ParameterString.c_str(), "SCALFA", 6))
718  scalf.scalfa = atof(&ParameterString[strcspn(ParameterString.c_str(), "=") + 1]);
719 
720  else
721  accepted = false;
722 
723  return accepted;
724  }
#define cainpu
#define captcut
#define cahflav
#define caluco
#define cagluon
#define integr
#define cascol
#define scalf
#define capar6
#define capar1
#define cashower
#define casshwr
#define jpsi
#define casprre
const char * gen::Cascade2Hadronizer::classname ( ) const

Definition at line 622 of file Cascade2Hadronizer.cc.

622 { return "gen::Cascade2Hadronizer"; }
bool gen::Cascade2Hadronizer::decay ( )

Definition at line 277 of file Cascade2Hadronizer.cc.

277 { return true; }
bool gen::Cascade2Hadronizer::declareSpecialSettings ( const std::vector< std::string > &  )
inline

Definition at line 38 of file Cascade2Hadronizer.h.

38 { return true; }
bool gen::Cascade2Hadronizer::declareStableParticles ( const std::vector< int > &  _pdg)

Definition at line 517 of file Cascade2Hadronizer.cc.

References gen::call_pygive(), mps_fire::i, and gen::pycomp_().

517  {
518  vector<int> pdg = _pdg;
519  for (size_t i = 0; i < pdg.size(); i++) {
520  int PyID = HepPID::translatePDTtoPythia(pdg[i]);
521  int pyCode = pycomp_(PyID);
522 
523  if (pyCode > 0) {
524  ostringstream pyCard;
525  pyCard << "MDCY(" << pyCode << ",1)=0";
526  //-- cout << "pdg= " << pdg[i] << " " << pyCard.str() << endl;
527 
528  call_pygive(pyCard.str());
529  }
530  }
531 
532  return true;
533  }
bool call_pygive(const std::string &line)
int pycomp_(int &)
void gen::Cascade2Hadronizer::doSetRandomEngine ( CLHEP::HepRandomEngine *  v)
overrideprivatevirtual

Reimplemented from gen::BaseHadronizer.

Definition at line 128 of file Cascade2Hadronizer.cc.

References cascade2RandomEngine, fPy6Service, gen::Pythia6Service::setRandomEngine(), and gen::v.

128  {
131  }
Pythia6Service * fPy6Service
double v[5][pyjets_maxn]
static CLHEP::HepRandomEngine * cascade2RandomEngine
void setRandomEngine(CLHEP::HepRandomEngine *v)
std::vector<std::string> const& gen::Cascade2Hadronizer::doSharedResources ( ) const
inlineoverrideprivatevirtual

Reimplemented from gen::BaseHadronizer.

Definition at line 51 of file Cascade2Hadronizer.h.

References theSharedResources.

51 { return theSharedResources; }
static const std::vector< std::string > theSharedResources
void gen::Cascade2Hadronizer::fillTmpStorage ( )
private

Definition at line 147 of file Cascade2Hadronizer.cc.

References mps_fire::i, and gen::pyjets_local.

Referenced by generatePartonsAndHadronize().

147  {
148  pyjets_local.n = pyjets.n;
149  pyjets_local.npad = pyjets.npad;
150 
151  for (int ip = 0; ip < pyjets_maxn; ip++) {
152  for (int i = 0; i < 5; i++) {
153  pyjets_local.k[i][ip] = pyjets.k[i][ip];
154  pyjets_local.p[i][ip] = pyjets.p[i][ip];
155  pyjets_local.v[i][ip] = pyjets.v[i][ip];
156  }
157  }
158  return;
159  }
static struct gen::@697 pyjets_local
void gen::Cascade2Hadronizer::finalizeEvent ( )

Definition at line 161 of file Cascade2Hadronizer.cc.

References gen::call_pylist(), gather_cfg::cout, debug, gen::BaseHadronizer::event(), gen::BaseHadronizer::eventInfo(), fConvertToPDG, fHepMCVerbosity, fMaxEventsToPrint, fPythiaListVerbosity, imposeProperTime(), pydat1, pyint1, and pypars.

161  {
162  HepMC::PdfInfo pdf;
163 
164  //-- filling factorization "Q scale" now! pthat moved to binningValues()
165 
166  if (event()->signal_process_id() <= 0)
167  event()->set_signal_process_id(pypars.msti[0]);
168  if (event()->event_scale() <= 0)
169  event()->set_event_scale(pypars.pari[22]);
170  if (event()->alphaQED() <= 0)
171  event()->set_alphaQED(pyint1.vint[56]);
172  if (event()->alphaQCD() <= 0)
173  event()->set_alphaQCD(pyint1.vint[57]);
174 
175  //-- get pdf info directly from Pythia6 and set it up into HepMC::GenEvent
176  //-- S. Mrenna: Prefer vint block
177 
178  if (pdf.id1() <= 0)
179  pdf.set_id1(pyint1.mint[14] == 21 ? 0 : pyint1.mint[14]);
180  if (pdf.id2() <= 0)
181  pdf.set_id2(pyint1.mint[15] == 21 ? 0 : pyint1.mint[15]);
182  if (pdf.x1() <= 0)
183  pdf.set_x1(pyint1.vint[40]);
184  if (pdf.x2() <= 0)
185  pdf.set_x2(pyint1.vint[41]);
186  if (pdf.pdf1() <= 0)
187  pdf.set_pdf1(pyint1.vint[38] / pyint1.vint[40]);
188  if (pdf.pdf2() <= 0)
189  pdf.set_pdf2(pyint1.vint[39] / pyint1.vint[41]);
190  if (pdf.scalePDF() <= 0)
191  pdf.set_scalePDF(pyint1.vint[50]);
192 
193  event()->set_pdf_info(pdf);
194 
195  if (debug) {
196  cout << "standard Py6 event weight: pyint1.vint[96]: " << pyint1.vint[96] << endl;
197  cout << "event weight returned by PYEVWT: 1./(pyint1.vint[98]): " << 1. / (pyint1.vint[98]) << endl;
198  }
199 
200  //-- this is "standard" Py6 event weight (corresponds to PYINT1/VINT(97))
201  // event()->weights().push_back(pyint1.vint[96]);
202 
203  //-- this is event weight as 1./VINT(99) (PYINT1/VINT(99) is returned by the PYEVWT)
204  // event()->weights().push_back(1./(pyint1.vint[98]));
205 
206  //-- all cascade events have weight = 1
207  event()->weights().push_back(1.);
208 
209  //-- now create the GenEventInfo product from the GenEvent and fill the missing pieces
210 
211  eventInfo() = std::make_unique<GenEventInfoProduct>(event().get());
212 
213  //-- in Pythia6 pthat is used to subdivide samples into different bins
214  //-- in LHE mode the binning is done by the external ME generator
215  //-- which is likely not pthat, so only filling it for Py6 internal mode
216 
217  eventInfo()->setBinningValues(vector<double>(1, pypars.pari[16]));
218 
219  //-- here we treat long-lived particles
220 
221  if (pydat1.mstj[21] == 3 || pydat1.mstj[21] == 4)
223 
224  //-- convert particle IDs Py6 -> PDG (if requested)
225 
226  if (fConvertToPDG) {
227  for (HepMC::GenEvent::particle_iterator part = event()->particles_begin(); part != event()->particles_end();
228  ++part) {
229  (*part)->set_pdg_id(HepPID::translatePythiatoPDT((*part)->pdg_id()));
230  }
231  }
232 
233  //-- service printouts, if requested
234  if (fMaxEventsToPrint > 0) {
238  if (fHepMCVerbosity) {
239  cout << "Event process = " << pypars.msti[0] << endl << "----------------------" << endl;
240  event()->print();
241  }
242  }
243 
244  return;
245  }
#define pydat1
void call_pylist(int mode)
#define pyint1
std::unique_ptr< HepMC::GenEvent > & event()
#define pypars
#define debug
Definition: HDRShower.cc:19
part
Definition: HCALResponse.h:20
std::unique_ptr< GenEventInfoProduct > & eventInfo()
tuple cout
Definition: gather_cfg.py:144
void gen::Cascade2Hadronizer::flushTmpStorage ( )
private

Definition at line 133 of file Cascade2Hadronizer.cc.

References mps_fire::i, and gen::pyjets_local.

Referenced by Cascade2Hadronizer(), and generatePartonsAndHadronize().

133  {
134  pyjets_local.n = 0;
135  pyjets_local.npad = 0;
136 
137  for (int ip = 0; ip < pyjets_maxn; ip++) {
138  for (int i = 0; i < 5; i++) {
139  pyjets_local.k[i][ip] = 0;
140  pyjets_local.p[i][ip] = 0.;
141  pyjets_local.v[i][ip] = 0.;
142  }
143  }
144  return;
145  }
static struct gen::@697 pyjets_local
bool gen::Cascade2Hadronizer::generatePartonsAndHadronize ( )

Definition at line 249 of file Cascade2Hadronizer.cc.

References call_event(), gen::BaseHadronizer::event(), fillTmpStorage(), flushTmpStorage(), fPy6Service, gen::FortranCallback::getInstance(), hepevtio, pyint1, and gen::FortranCallback::resetIterationsPerEvent().

249  {
250  //-- grab Py6 instance
251  Pythia6Service::InstanceWrapper guard(fPy6Service);
252 
254 
255  //-- skip event if py6 considers it bad
256  if (pyint1.mint[50] != 0) {
257  event().reset();
258  return false;
259  }
260 
261  //-- generation of the event with CASCADE
262  call_event();
263 
264  //-- pythia pyhepc routine converts common PYJETS in common HEPEVT
265  call_pyhepc(1);
266 
267  //-- delete the created event from memory
268  event().reset(hepevtio.read_next_event());
269 
270  //-- this is to deal with post-gen tools & residualDecay() that may reuse PYJETS
271  flushTmpStorage();
272  fillTmpStorage();
273 
274  return true;
275  }
Pythia6Service * fPy6Service
#define pyint1
std::unique_ptr< HepMC::GenEvent > & event()
static FortranCallback * getInstance()
void call_event()
HepMC::IO_HEPEVT hepevtio
bool gen::Cascade2Hadronizer::hadronize ( )

Definition at line 247 of file Cascade2Hadronizer.cc.

247 { return false; }
void gen::Cascade2Hadronizer::imposeProperTime ( )
private

Definition at line 535 of file Cascade2Hadronizer.cc.

References funct::abs(), gen::FortranInstance::call(), gen::BaseHadronizer::event(), fPy6Service, log, gen::pycomp_(), pydat1, gen::pyr_(), mathSSE::sqrt(), and submitPVValidationJobs::t.

Referenced by finalizeEvent().

535  {
536  // this is practically a copy/paste of the original code by J.Alcaraz,
537  // taken directly from PythiaSource
538 
539  int dumm = 0;
540  HepMC::GenEvent::vertex_const_iterator vbegin = event()->vertices_begin();
541  HepMC::GenEvent::vertex_const_iterator vend = event()->vertices_end();
542  HepMC::GenEvent::vertex_const_iterator vitr = vbegin;
543 
544  for (; vitr != vend; ++vitr) {
545  HepMC::GenVertex::particle_iterator pbegin = (*vitr)->particles_begin(HepMC::children);
546  HepMC::GenVertex::particle_iterator pend = (*vitr)->particles_end(HepMC::children);
547  HepMC::GenVertex::particle_iterator pitr = pbegin;
548 
549  for (; pitr != pend; ++pitr) {
550  if ((*pitr)->end_vertex())
551  continue;
552  if ((*pitr)->status() != 1)
553  continue;
554 
555  int pdgcode = abs((*pitr)->pdg_id());
556  // Do nothing if the particle is not expected to decay
557  if (pydat3.mdcy[0][pycomp_(pdgcode) - 1] != 1)
558  continue;
559 
560  double ctau = pydat2.pmas[3][pycomp_(pdgcode) - 1];
561  HepMC::FourVector mom = (*pitr)->momentum();
562  HepMC::FourVector vin = (*vitr)->position();
563  double x = 0.;
564  double y = 0.;
565  double z = 0.;
566  double t = 0.;
567  bool decayInRange = false;
568  while (!decayInRange) {
569  double unif_rand = fPy6Service->call(pyr_, &dumm);
570  // Value of 0 is excluded, so following line is OK
571  double proper_length = -ctau * log(unif_rand);
572  double factor = proper_length / mom.m();
573  x = vin.x() + factor * mom.px();
574  y = vin.y() + factor * mom.py();
575  z = vin.z() + factor * mom.pz();
576  t = vin.t() + factor * mom.e();
577 
578  // Decay must be happen outside a cylindrical region
579  if (pydat1.mstj[21] == 4) {
580  if (sqrt(x * x + y * y) > pydat1.parj[72] || fabs(z) > pydat1.parj[73])
581  decayInRange = true;
582  // Decay must be happen outside a given sphere
583  } else if (pydat1.mstj[21] == 3) {
584  if (sqrt(x * x + y * y + z * z) > pydat1.parj[71])
585  decayInRange = true;
586  }
587  // Decay is always OK otherwise
588  else {
589  decayInRange = true;
590  }
591  }
592 
593  HepMC::GenVertex* vdec = new HepMC::GenVertex(HepMC::FourVector(x, y, z, t));
594  event()->add_vertex(vdec);
595  vdec->add_particle_in((*pitr));
596  }
597  }
598 
599  return;
600  }
#define pydat1
static std::vector< std::string > checklist log
void call(void(&fn)())
Pythia6Service * fPy6Service
double pyr_(int *idummy)
T sqrt(T t)
Definition: SSEVec.h:19
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::unique_ptr< HepMC::GenEvent > & event()
int pycomp_(int &)
bool gen::Cascade2Hadronizer::initializeForExternalPartons ( )

Definition at line 445 of file Cascade2Hadronizer.cc.

445 { return false; }
bool gen::Cascade2Hadronizer::initializeForInternalPartons ( )

Definition at line 447 of file Cascade2Hadronizer.cc.

References cainpu, call_caend(), call_cascade(), call_cascha(), call_casini(), cascadePrintParameters(), cascadeReadParameters(), gen::Pythia6Service::closeSLHA(), edm::errors::Configuration, Exception, fComEnergy, fParameters, fPy6Service, edm::ParameterSet::getParameter(), mps_fire::i, pythia6PrintParameters(), gen::Pythia6Service::setCSAParams(), gen::Pythia6Service::setGeneralParams(), gen::Pythia6Service::setPYUPDAParams(), and gen::Pythia6Service::setSLHAParams().

447  {
448  //-- grab Py6 instance
449  Pythia6Service::InstanceWrapper guard(fPy6Service);
450 
451  //-- change standard parameters of JETSET/PYTHIA - replace call_pytcha()
452 
454 
458 
460 
461  //-- mstu(8) is set to NMXHEP in this dummy call (version >=6.404)
462  call_pyhepc(1);
463 
464  //-- initialise random number generator: has been changed to be CMSSW compliant
465  //-- dcasrn overloaded: call to rluxgo not needed anymore
466  //-- call_rluxgo(4,314159265,0,0);
467 
468  //-- initialise CASCADE parameters (default values)
469  call_casini();
470 
471  //-- Read the parameters and pass them to the common blocks
472  //-- call_steer();
473 
474  //-- initialise CASCADE parameters (user values)
475 
476  //-- retrieve all the different sets
477  vector<string> AllSets = fParameters.getParameter<vector<string> >("parameterSets");
478 
479  //-- loop over the different sets
480  for (unsigned i = 0; i < AllSets.size(); ++i) {
481  string Set = AllSets[i];
482  vector<string> Para_Set = fParameters.getParameter<vector<string> >(Set);
483 
484  //-- loop over all the parameters and stop in case of mistake
485  for (vector<string>::const_iterator itPara = Para_Set.begin(); itPara != Para_Set.end(); ++itPara) {
486  if (!cascadeReadParameters(*itPara)) {
487  throw edm::Exception(edm::errors::Configuration, "CascadeError")
488  << " Cascade did not accept the following parameter: \"" << *itPara << "\"" << endl;
489  }
490  } //-- end loop over all the parameters
491  } //-- end loop over the different sets
492 
493  cainpu.plepin = -fComEnergy / 2;
494  cainpu.ppin = fComEnergy / 2;
495 
497 
498  //-- change standard parameters of CASCADE
499  call_cascha();
500 
501  //-- change standard parameters of JETSET/PYTHIA
502  //-- call_pytcha();
503 
504  //-- set up for running CASCADE (integration of the cross-section)
505  call_cascade();
506 
507  //-- print cross-section result from integration
508  call_caend(1);
509 
511 
513 
514  return true;
515  }
#define cainpu
Pythia6Service * fPy6Service
void call_casini()
edm::ParameterSet fParameters
void call_cascade()
void call_caend(int mode)
void setPYUPDAParams(bool afterPyinit)
bool cascadeReadParameters(const std::string &ParameterString)
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
void call_cascha()
void gen::Cascade2Hadronizer::pythia6PrintParameters ( )

Definition at line 789 of file Cascade2Hadronizer.cc.

References gather_cfg::cout, and pydat1.

Referenced by initializeForInternalPartons().

789  {
790  cout << "" << endl;
791  cout << "----------------------------------" << endl;
792  cout << "---- Pythia6 Parameters ----" << endl;
793  cout << "----------------------------------" << endl;
794  cout << "" << endl;
795 
796  cout << "charm mass: " << pydat2.pmas[0][3] << " GeV (default value = 1.5 GeV)" << endl;
797  cout << "bottom mass: " << pydat2.pmas[0][4] << " GeV (default value = 4.8 GeV)" << endl;
798  cout << "Higgs mass: " << pydat2.pmas[0][24] << " GeV (default value = 115 GeV)" << endl;
799 
800  cout << "lambda QCD: " << pydat1.paru[111] << " GeV (default value = 0.25 GeV)" << endl;
801 
802  cout << "alphas behaviour: " << pydat1.mstu[110] << " (default value = 1)" << endl;
803  cout << "nr of flavours wrt lambda QCD: " << pydat1.mstu[111] << " (default value = 5)" << endl;
804  cout << "min nr of flavours for alphas: " << pydat1.mstu[112] << " (default value = 3)" << endl;
805  cout << "max nr of flavours for alphas: " << pydat1.mstu[113] << " (default value = 5)" << endl;
806 
807  cout << "maximum angle settings: " << pydat1.mstj[47] << " (default value = 0)" << endl;
808 
809  cout << "" << endl;
810  }
#define pydat1
tuple cout
Definition: gather_cfg.py:144
bool gen::Cascade2Hadronizer::readSettings ( int  key)

Definition at line 432 of file Cascade2Hadronizer.cc.

References fPy6Service, gen::Pythia6Service::setCSAParams(), gen::Pythia6Service::setGeneralParams(), and gen::Pythia6Service::setSLHAParams().

432  {
433  //-- grab Py6 instance
434  Pythia6Service::InstanceWrapper guard(fPy6Service);
435 
437 
438  if (key == 0)
441 
442  return true;
443  }
Pythia6Service * fPy6Service
tuple key
prepare the HTCondor submission files and eventually submit them
bool gen::Cascade2Hadronizer::residualDecay ( )

Definition at line 279 of file Cascade2Hadronizer.cc.

References gen::BaseHadronizer::event(), fPy6Service, GenParticle::GenParticle, mps_fire::i, SpecificationBuilder_cfi::parent(), isotrackTrainRegressor::pmom, gen::pycomp_(), gen::pydecy_(), gen::pyjets_local, and mps_update::status.

279  {
280  //-- grab Py6 instance
281  Pythia6Service::InstanceWrapper guard(fPy6Service);
282 
283  int NPartsBeforeDecays = pyjets_local.n;
284  int NPartsAfterDecays = event().get()->particles_size();
285  int barcode = NPartsAfterDecays;
286 
287  // JVY: well, in principle, it's not a 100% fair to go up to NPartsBeforeDecays,
288  // because Photos will attach gamma's to existing vertices, i.e. in the middle
289  // of the event rather than at the end; but this will only shift pointers down,
290  // so we'll be going again over a few "original" particle...
291  // in the alternative, we may go all the way up to the beginning of the event
292  // and re-check if anything remains to decay, that's fine even if it'll take
293  // some extra CPU...
294 
295  for (int ipart = NPartsAfterDecays; ipart > NPartsBeforeDecays; ipart--) {
296  HepMC::GenParticle* part = event().get()->barcode_to_particle(ipart);
297  int status = part->status();
298  if (status != 1)
299  continue; // check only "stable" particles,
300  // as some undecayed may still be marked as such
301  int pdgid = part->pdg_id();
302  int py6ptr = pycomp_(pdgid);
303 
304  if (pydat3.mdcy[0][py6ptr - 1] != 1)
305  continue; // particle is not expected to decay
306 
307  int py6id = HepPID::translatePDTtoPythia(pdgid);
308 
309  // first, will need to zero out, then fill up PYJETS
310  // I better do it directly (by hands) rather than via py1ent
311  // - to avoid (additional) mass smearing
312 
313  if (part->momentum().t() <= part->generated_mass()) {
314  continue; // e == m -> 0-momentum, nothing to decay...
315  }
316 
317  else {
318  pyjets.n = 0;
319 
320  for (int i = 0; i < 5; i++) {
321  pyjets.k[i][0] = 0;
322  pyjets.p[i][0] = 0.;
323  pyjets.v[i][0] = 0.;
324  }
325 
326  pyjets.k[0][0] = 1;
327  pyjets.k[1][0] = py6id;
328  pyjets.p[4][0] = part->generated_mass();
329  pyjets.p[3][0] = part->momentum().t();
330  pyjets.p[0][0] = part->momentum().x();
331  pyjets.p[1][0] = part->momentum().y();
332  pyjets.p[2][0] = part->momentum().z();
333  HepMC::GenVertex* prod_vtx = part->production_vertex();
334  if (!prod_vtx)
335  continue; // in principle, should never happen but...
336  pyjets.v[0][0] = prod_vtx->position().x();
337  pyjets.v[1][0] = prod_vtx->position().y();
338  pyjets.v[2][0] = prod_vtx->position().z();
339  pyjets.v[3][0] = prod_vtx->position().t();
340  pyjets.v[4][0] = 0.;
341  pyjets.n = 1;
342  pyjets.npad = pyjets_local.npad;
343  }
344 
345  //-- now call Py6 decay routine
346 
347  int parent = 1; // since we always pass to Py6 a single particle
348  pydecy_(parent);
349 
350  //-- now attach decay products to mother
351 
352  for (int iprt1 = 1; iprt1 < pyjets.n; iprt1++) {
353  part->set_status(2);
354 
355  HepMC::GenVertex* DecVtx = new HepMC::GenVertex(
356  HepMC::FourVector(pyjets.v[0][iprt1], pyjets.v[1][iprt1], pyjets.v[2][iprt1], pyjets.v[3][iprt1]));
357  DecVtx->add_particle_in(part); // this will cleanup end_vertex if exists, replace with the new one
358  // I presume (vtx) barcode will be given automatically
359 
360  HepMC::FourVector pmom(pyjets.p[0][iprt1], pyjets.p[1][iprt1], pyjets.p[2][iprt1], pyjets.p[3][iprt1]);
361 
362  int dstatus = 0;
363  if (pyjets.k[0][iprt1] >= 1 && pyjets.k[0][iprt1] <= 10)
364  dstatus = 1;
365  else if (pyjets.k[0][iprt1] >= 11 && pyjets.k[0][iprt1] <= 20)
366  dstatus = 2;
367  else if (pyjets.k[0][iprt1] >= 21 && pyjets.k[0][iprt1] <= 30)
368  dstatus = 3;
369  else if (pyjets.k[0][iprt1] >= 31 && pyjets.k[0][iprt1] <= 100)
370  dstatus = pyjets.k[0][iprt1];
371 
372  HepMC::GenParticle* daughter =
373  new HepMC::GenParticle(pmom, HepPID::translatePythiatoPDT(pyjets.k[1][iprt1]), dstatus);
374  barcode++;
375  daughter->suggest_barcode(barcode);
376  DecVtx->add_particle_out(daughter);
377 
378  int iprt2;
379  for (iprt2 = iprt1 + 1; iprt2 < pyjets.n; iprt2++) { // the pointer is shifted by -1, c++ style
380 
381  if (pyjets.k[2][iprt2] != parent) {
382  parent = pyjets.k[2][iprt2];
383  break; // another parent particle; reset & break the loop
384  }
385 
386  HepMC::FourVector pmomN(pyjets.p[0][iprt2], pyjets.p[1][iprt2], pyjets.p[2][iprt2], pyjets.p[3][iprt2]);
387 
388  dstatus = 0;
389  if (pyjets.k[0][iprt2] >= 1 && pyjets.k[0][iprt2] <= 10)
390  dstatus = 1;
391  else if (pyjets.k[0][iprt2] >= 11 && pyjets.k[0][iprt2] <= 20)
392  dstatus = 2;
393  else if (pyjets.k[0][iprt2] >= 21 && pyjets.k[0][iprt2] <= 30)
394  dstatus = 3;
395  else if (pyjets.k[0][iprt2] >= 31 && pyjets.k[0][iprt2] <= 100)
396  dstatus = pyjets.k[0][iprt2];
397 
398  HepMC::GenParticle* daughterN =
399  new HepMC::GenParticle(pmomN, HepPID::translatePythiatoPDT(pyjets.k[1][iprt2]), dstatus);
400  barcode++;
401  daughterN->suggest_barcode(barcode);
402  DecVtx->add_particle_out(daughterN);
403  } //-- end iprt2 loop
404 
405  iprt1 = iprt2 - 1; // reset counter such that it doesn't go over the same child more than once
406  // don't forget to offset back into c++ counting, as it's already +1 forward
407 
408  event().get()->add_vertex(DecVtx);
409  } //-- end iprt1 loop
410  } //-- end loop over decay products
411 
412  // now restore the very original Py6 event record
413 
414  if (pyjets_local.n != pyjets.n) {
415  // restore pyjets to its state as it was before external decays -
416  // might have been jammed by action above or by py1ent calls in EvtGen
417 
418  pyjets.n = pyjets_local.n;
419  pyjets.npad = pyjets_local.npad;
420  for (int ip = 0; ip < pyjets_local.n; ip++) {
421  for (int i = 0; i < 5; i++) {
422  pyjets.k[i][ip] = pyjets_local.k[i][ip];
423  pyjets.p[i][ip] = pyjets_local.p[i][ip];
424  pyjets.v[i][ip] = pyjets_local.v[i][ip];
425  }
426  }
427  }
428 
429  return true;
430  }
Pythia6Service * fPy6Service
list status
Definition: mps_update.py:107
static struct gen::@697 pyjets_local
void pydecy_(int &ip)
std::unique_ptr< HepMC::GenEvent > & event()
int pycomp_(int &)
part
Definition: HCALResponse.h:20
void gen::Cascade2Hadronizer::statistics ( )

Definition at line 602 of file Cascade2Hadronizer.cc.

References caeffic, call_caend(), fextCrossSection, fextCrossSectionError, gen::BaseHadronizer::runInfo(), GenRunInfoProduct::setExternalXSecLO(), GenRunInfoProduct::setExternalXSecNLO(), and GenRunInfoProduct::setInternalXSec().

602  {
604 
606 
607  if (!runInfo().internalXSec()) {
608  double sigma_CMS = 0.001 * caeffic.avgi;
609  double error_CMS = 0.001 * caeffic.sd;
610  runInfo().setInternalXSec(GenRunInfoProduct::XSec(sigma_CMS, error_CMS));
611  }
612 
613  //-- print out generated event summary
614  call_caend(2);
615 
616  //-- write out some information from Pythia to the screen
617  call_pystat(1);
618 
619  return;
620  }
void setInternalXSec(const XSec &xsec)
GenRunInfoProduct & runInfo()
void call_caend(int mode)
void setExternalXSecNLO(const XSec &xsec)
void setExternalXSecLO(const XSec &xsec)
#define caeffic

Member Data Documentation

double gen::Cascade2Hadronizer::fComEnergy
private

Definition at line 68 of file Cascade2Hadronizer.h.

Referenced by cascadePrintParameters(), and initializeForInternalPartons().

bool gen::Cascade2Hadronizer::fConvertToPDG
private

Definition at line 80 of file Cascade2Hadronizer.h.

Referenced by Cascade2Hadronizer(), and finalizeEvent().

bool gen::Cascade2Hadronizer::fDisplayPythiaBanner
private

Definition at line 77 of file Cascade2Hadronizer.h.

Referenced by Cascade2Hadronizer().

bool gen::Cascade2Hadronizer::fDisplayPythiaCards
private

Definition at line 78 of file Cascade2Hadronizer.h.

Referenced by Cascade2Hadronizer().

double gen::Cascade2Hadronizer::fextCrossSection
private

Definition at line 69 of file Cascade2Hadronizer.h.

Referenced by cascadePrintParameters(), and statistics().

double gen::Cascade2Hadronizer::fextCrossSectionError
private

Definition at line 70 of file Cascade2Hadronizer.h.

Referenced by cascadePrintParameters(), and statistics().

double gen::Cascade2Hadronizer::fFilterEfficiency
private

Definition at line 71 of file Cascade2Hadronizer.h.

Referenced by cascadePrintParameters().

bool gen::Cascade2Hadronizer::fHepMCVerbosity
private

Definition at line 74 of file Cascade2Hadronizer.h.

Referenced by finalizeEvent().

unsigned int gen::Cascade2Hadronizer::fMaxEventsToPrint
private

Definition at line 73 of file Cascade2Hadronizer.h.

Referenced by finalizeEvent().

edm::ParameterSet gen::Cascade2Hadronizer::fParameters
private

Definition at line 63 of file Cascade2Hadronizer.h.

Referenced by Cascade2Hadronizer(), and initializeForInternalPartons().

Pythia6Service* gen::Cascade2Hadronizer::fPy6Service
private
unsigned int gen::Cascade2Hadronizer::fPythiaListVerbosity
private

Definition at line 75 of file Cascade2Hadronizer.h.

Referenced by finalizeEvent().

const std::vector< std::string > gen::Cascade2Hadronizer::theSharedResources
staticprivate