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 | 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 ()
 
- 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)
 
virtual bool select (HepMC::GenEvent *) const
 
void setEDMEvent (edm::Event &event)
 
void setLHEEvent (lhef::LHEEvent *event)
 
void setLHERunInfo (lhef::LHERunInfo *runInfo)
 
void setRandomEngine (CLHEP::HepRandomEngine *v)
 
std::vector< std::string > const & sharedResources () const
 
 ~BaseHadronizer ()
 

Private Member Functions

virtual void doSetRandomEngine (CLHEP::HepRandomEngine *v) override
 
virtual 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::auto_ptr< HepMC::GenEvent > & event ()
 
std::auto_ptr
< GenEventInfoProduct > & 
eventInfo ()
 
lhef::LHEEventlheEvent ()
 
lhef::LHERunInfolheRunInfo ()
 
GenRunInfoProductrunInfo ()
 

Detailed Description

Definition at line 24 of file Cascade2Hadronizer.h.

Constructor & Destructor Documentation

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

Definition at line 86 of file Cascade2Hadronizer.cc.

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

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

Definition at line 130 of file Cascade2Hadronizer.cc.

References fPy6Service.

130  {
131  if(fPy6Service != 0) delete fPy6Service;
132  }
Pythia6Service * fPy6Service

Member Function Documentation

void gen::Cascade2Hadronizer::cascadePrintParameters ( )

Definition at line 734 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().

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

Definition at line 634 of file Cascade2Hadronizer.cc.

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

Referenced by initializeForInternalPartons().

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

628  {
629  return "gen::Cascade2Hadronizer";
630  }
bool gen::Cascade2Hadronizer::decay ( )

Definition at line 276 of file Cascade2Hadronizer.cc.

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

Definition at line 40 of file Cascade2Hadronizer.h.

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

Definition at line 522 of file Cascade2Hadronizer.cc.

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

522  {
523  vector<int> pdg = _pdg;
524  for(size_t i=0; i<pdg.size(); i++){
525  int PyID = HepPID::translatePDTtoPythia(pdg[i]);
526  int pyCode = pycomp_( PyID );
527 
528  if(pyCode > 0){
529  ostringstream pyCard ;
530  pyCard << "MDCY(" << pyCode << ",1)=0";
531  //-- cout << "pdg= " << pdg[i] << " " << pyCard.str() << endl;
532 
533  call_pygive(pyCard.str());
534  }
535  }
536 
537  return true;
538  }
int i
Definition: DBlmapReader.cc:9
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 134 of file Cascade2Hadronizer.cc.

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

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

Reimplemented from gen::BaseHadronizer.

Definition at line 54 of file Cascade2Hadronizer.h.

References theSharedResources.

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

Definition at line 154 of file Cascade2Hadronizer.cc.

References i, gen::pyjets_local, and mathSSE::return().

Referenced by generatePartonsAndHadronize().

154  {
155 
156  pyjets_local.n = pyjets.n;
157  pyjets_local.npad = pyjets.npad;
158 
159  for(int ip=0; ip<pyjets_maxn; ip++){
160  for(int i=0; i<5; i++){
161  pyjets_local.k[i][ip] = pyjets.k[i][ip];
162  pyjets_local.p[i][ip] = pyjets.p[i][ip];
163  pyjets_local.v[i][ip] = pyjets.v[i][ip];
164  }
165  }
166  return ;
167  }
int i
Definition: DBlmapReader.cc:9
return((rh^lh)&mask)
static struct gen::@489 pyjets_local
void gen::Cascade2Hadronizer::finalizeEvent ( )

Definition at line 169 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.

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

Definition at line 139 of file Cascade2Hadronizer.cc.

References i, and gen::pyjets_local.

Referenced by Cascade2Hadronizer(), and generatePartonsAndHadronize().

139  {
140 
141  pyjets_local.n = 0 ;
142  pyjets_local.npad = 0 ;
143 
144  for(int ip=0; ip<pyjets_maxn; ip++){
145  for(int i=0; i<5; i++){
146  pyjets_local.k[i][ip] = 0;
147  pyjets_local.p[i][ip] = 0.;
148  pyjets_local.v[i][ip] = 0.;
149  }
150  }
151  return;
152  }
int i
Definition: DBlmapReader.cc:9
static struct gen::@489 pyjets_local
bool gen::Cascade2Hadronizer::generatePartonsAndHadronize ( )

Definition at line 247 of file Cascade2Hadronizer.cc.

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

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

Definition at line 243 of file Cascade2Hadronizer.cc.

243  {
244  return false;
245  }
void gen::Cascade2Hadronizer::imposeProperTime ( )
private

Definition at line 540 of file Cascade2Hadronizer.cc.

References funct::abs(), gen::FortranInstance::call(), gen::BaseHadronizer::event(), fPy6Service, cmsBatch::log, gen::pycomp_(), pydat1, gen::pyr_(), mathSSE::sqrt(), lumiQTWidget::t, vbegin, vend, and x().

Referenced by finalizeEvent().

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

Definition at line 445 of file Cascade2Hadronizer.cc.

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

Definition at line 449 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(), i, pythia6PrintParameters(), gen::Pythia6Service::setCSAParams(), gen::Pythia6Service::setGeneralParams(), gen::Pythia6Service::setPYUPDAParams(), and gen::Pythia6Service::setSLHAParams().

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

Definition at line 797 of file Cascade2Hadronizer.cc.

References gather_cfg::cout, and pydat1.

Referenced by initializeForInternalPartons().

797  {
798 
799  cout<<""<<endl;
800  cout<<"----------------------------------"<<endl;
801  cout<<"---- Pythia6 Parameters ----"<<endl;
802  cout<<"----------------------------------"<<endl;
803  cout<<""<<endl;
804 
805  cout<<"charm mass: "<<pydat2.pmas[0][3]<<" GeV (default value = 1.5 GeV)"<<endl;
806  cout<<"bottom mass: "<<pydat2.pmas[0][4]<<" GeV (default value = 4.8 GeV)"<<endl;
807  cout<<"Higgs mass: "<<pydat2.pmas[0][24]<<" GeV (default value = 115 GeV)"<<endl;
808 
809  cout<<"lambda QCD: "<<pydat1.paru[111]<<" GeV (default value = 0.25 GeV)"<<endl;
810 
811  cout<<"alphas behaviour: "<<pydat1.mstu[110]<<" (default value = 1)"<<endl;
812  cout<<"nr of flavours wrt lambda QCD: "<<pydat1.mstu[111]<<" (default value = 5)"<<endl;
813  cout<<"min nr of flavours for alphas: "<<pydat1.mstu[112]<<" (default value = 3)"<<endl;
814  cout<<"max nr of flavours for alphas: "<<pydat1.mstu[113]<<" (default value = 5)"<<endl;
815 
816  cout<<"maximum angle settings: "<<pydat1.mstj[47]<<" (default value = 0)"<<endl;
817 
818  cout<<""<<endl;
819  }
#define pydat1
tuple cout
Definition: gather_cfg.py:121
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 
434  //-- grab Py6 instance
435  Pythia6Service::InstanceWrapper guard(fPy6Service);
436 
438 
439  if (key == 0) fPy6Service->setCSAParams();
441 
442  return true;
443  }
Pythia6Service * fPy6Service
string key
FastSim: produces sample of signal events, overlayed with premixed minbias events.
bool gen::Cascade2Hadronizer::residualDecay ( )

Definition at line 280 of file Cascade2Hadronizer.cc.

References gen::BaseHadronizer::event(), fPy6Service, GenParticle::GenParticle, i, dbtoconf::parent, gen::pycomp_(), gen::pydecy_(), gen::pyjets_local, and ntuplemaker::status.

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

Definition at line 607 of file Cascade2Hadronizer.cc.

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

607  {
608 
610 
612 
613  if(!runInfo().internalXSec()){
614  double sigma_CMS = 0.001 * caeffic.avgi;
615  double error_CMS = 0.001 * caeffic.sd;
616  runInfo().setInternalXSec(GenRunInfoProduct::XSec(sigma_CMS,error_CMS));
617  }
618 
619  //-- print out generated event summary
620  call_caend(2);
621 
622  //-- write out some information from Pythia to the screen
623  call_pystat(1);
624 
625  return;
626  }
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 70 of file Cascade2Hadronizer.h.

Referenced by cascadePrintParameters(), and initializeForInternalPartons().

bool gen::Cascade2Hadronizer::fConvertToPDG
private

Definition at line 82 of file Cascade2Hadronizer.h.

Referenced by Cascade2Hadronizer(), and finalizeEvent().

bool gen::Cascade2Hadronizer::fDisplayPythiaBanner
private

Definition at line 79 of file Cascade2Hadronizer.h.

Referenced by Cascade2Hadronizer().

bool gen::Cascade2Hadronizer::fDisplayPythiaCards
private

Definition at line 80 of file Cascade2Hadronizer.h.

Referenced by Cascade2Hadronizer().

double gen::Cascade2Hadronizer::fextCrossSection
private

Definition at line 71 of file Cascade2Hadronizer.h.

Referenced by cascadePrintParameters(), and statistics().

double gen::Cascade2Hadronizer::fextCrossSectionError
private

Definition at line 72 of file Cascade2Hadronizer.h.

Referenced by cascadePrintParameters(), and statistics().

double gen::Cascade2Hadronizer::fFilterEfficiency
private

Definition at line 73 of file Cascade2Hadronizer.h.

Referenced by cascadePrintParameters().

bool gen::Cascade2Hadronizer::fHepMCVerbosity
private

Definition at line 76 of file Cascade2Hadronizer.h.

Referenced by finalizeEvent().

unsigned int gen::Cascade2Hadronizer::fMaxEventsToPrint
private

Definition at line 75 of file Cascade2Hadronizer.h.

Referenced by finalizeEvent().

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

Definition at line 66 of file Cascade2Hadronizer.h.

Referenced by Cascade2Hadronizer(), and initializeForInternalPartons().

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

Definition at line 77 of file Cascade2Hadronizer.h.

Referenced by finalizeEvent().

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