CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
gen::HijingHadronizer Class Reference

#include <HijingHadronizer.h>

Inheritance diagram for gen::HijingHadronizer:
gen::BaseHadronizer

Public Member Functions

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 ()
 
 HijingHadronizer (const edm::ParameterSet &)
 
bool initializeForExternalPartons ()
 
bool initializeForInternalPartons ()
 
bool readSettings (int)
 
bool residualDecay ()
 
void statistics ()
 
 ~HijingHadronizer () 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< GenEventInfoProductgetGenEventInfo ()
 
virtual std::unique_ptr< GenLumiInfoHeadergetGenLumiInfoHeader () 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 ()(false)
 

Private Member Functions

void add_heavy_ion_rec (HepMC::GenEvent *evt)
 
HepMC::GenParticle * build_hijing (int index, int barcode)
 
HepMC::GenVertex * build_hijing_vertex (int i, int id)
 
bool call_hijset (double efrm, std::string frame, std::string proj, std::string targ, int iap, int izp, int iat, int izt)
 
void doSetRandomEngine (CLHEP::HepRandomEngine *v) override
 
std::vector< std::string > const & doSharedResources () const override
 
bool get_particles (HepMC::GenEvent *evt)
 
void rotateEvtPlane ()
 

Private Attributes

double bmax_
 
double bmin_
 
double cosphi0_
 
double efrm_
 
HepMC::GenEventevt
 
std::string frame_
 
int iap_
 
int iat_
 
int izp_
 
int izt_
 
double phi0_
 
std::string proj_
 
edm::ParameterSet pset_
 
bool rotate_
 
double sinphi0_
 
std::string targ_
 

Static Private Attributes

static const std::vector< std::string > theSharedResources = {edm::SharedResourceNames::kPythia6}
 

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 27 of file HijingHadronizer.h.

Constructor & Destructor Documentation

HijingHadronizer::HijingHadronizer ( const edm::ParameterSet pset)

Definition at line 56 of file HijingHadronizer.cc.

57  : BaseHadronizer(pset),
58  evt(nullptr),
59  pset_(pset),
60  bmax_(pset.getParameter<double>("bMax")),
61  bmin_(pset.getParameter<double>("bMin")),
62  efrm_(pset.getParameter<double>("comEnergy")),
63  frame_(pset.getParameter<string>("frame")),
64  proj_(pset.getParameter<string>("proj")),
65  targ_(pset.getParameter<string>("targ")),
66  iap_(pset.getParameter<int>("iap")),
67  izp_(pset.getParameter<int>("izp")),
68  iat_(pset.getParameter<int>("iat")),
69  izt_(pset.getParameter<int>("izt")),
70  phi0_(0.),
71  sinphi0_(0.),
72  cosphi0_(1.),
73  rotate_(pset.getParameter<bool>("rotateEventPlane")) {
74  // Default constructor
75 }
T getParameter(std::string const &) const
HepMC::GenEvent * evt
BaseHadronizer(edm::ParameterSet const &ps)
edm::ParameterSet pset_
HijingHadronizer::~HijingHadronizer ( )
override

Definition at line 78 of file HijingHadronizer.cc.

78  {
79  // destructor
80 }

Member Function Documentation

void HijingHadronizer::add_heavy_ion_rec ( HepMC::GenEvent evt)
private

Definition at line 86 of file HijingHadronizer.cc.

References himain1, hiparnt, and phi0_.

Referenced by generatePartonsAndHadronize().

86  {
87  // heavy ion record in the final CMSSW Event
88  HepMC::HeavyIon* hi = new HepMC::HeavyIon(himain1.jatt, // Ncoll_hard/N of SubEvents
89  himain1.np, // Npart_proj
90  himain1.nt, // Npart_targ
91  himain1.n0 + himain1.n01 + himain1.n10 + himain1.n11, // Ncoll
92  0, // spectator_neutrons
93  0, // spectator_protons
94  himain1.n01, // N_Nwounded_collisions
95  himain1.n10, // Nwounded_N_collisions
96  himain1.n11, // Nwounded_Nwounded_collisions
97  //gsfs Changed from 19 to 18 (Fortran counts from 1 , not 0)
98  hiparnt.hint1[18], // impact_parameter in [fm]
99  phi0_, // event_plane_angle
100  0, // eccentricity
101  //gsfs Changed from 12 to 11 (Fortran counts from 1 , not 0)
102  hiparnt.hint1[11] // sigma_inel_NN
103  );
104  evt->set_heavy_ion(*hi);
105  delete hi;
106 }
#define hiparnt
Definition: HijingWrapper.h:62
#define himain1
Definition: HijingWrapper.h:43
HepMC::GenParticle * HijingHadronizer::build_hijing ( int  index,
int  barcode 
)
private

Definition at line 109 of file HijingHadronizer.cc.

References cosphi0_, GenParticle::GenParticle, himain2, gen::p, and sinphi0_.

Referenced by get_particles().

109  {
110  // Build particle object corresponding to index in hijing
111 
112  double x0 = himain2.patt[0][index];
113  double y0 = himain2.patt[1][index];
114 
115  double x = x0 * cosphi0_ - y0 * sinphi0_;
116  double y = y0 * cosphi0_ + x0 * sinphi0_;
117 
118  // Hijing gives V0's status=4, they need to have status=1 to be decayed in geant
119  // also change status=11 to status=2
120  if (himain2.katt[3][index] <= 10 && himain2.katt[3][index] > 0)
121  himain2.katt[3][index] = 1;
122  if (himain2.katt[3][index] <= 20 && himain2.katt[3][index] > 10)
123  himain2.katt[3][index] = 2;
124 
125  HepMC::GenParticle* p = new HepMC::GenParticle(HepMC::FourVector(x, // px
126  y, // py
127  himain2.patt[2][index], // pz
128  himain2.patt[3][index]), // E
129  himain2.katt[0][index], // id
130  himain2.katt[3][index] // status
131  );
132  p->suggest_barcode(barcode);
133 
134  return p;
135 }
double p[5][pyjets_maxn]
#define himain2
Definition: HijingWrapper.h:52
HepMC::GenVertex * HijingHadronizer::build_hijing_vertex ( int  i,
int  id 
)
private

Definition at line 138 of file HijingHadronizer.cc.

References cosphi0_, himain2, mps_fire::i, sinphi0_, OrderedSet::t, and bphysicsOniaDQM_cfi::vertex.

Referenced by get_particles().

138  {
139  // build verteces for the hijing stored events
140  double x0 = himain2.vatt[0][i];
141  double y0 = himain2.vatt[1][i];
142  double x = x0 * cosphi0_ - y0 * sinphi0_;
143  double y = y0 * cosphi0_ + x0 * sinphi0_;
144  double z = himain2.vatt[2][i];
145  double t = himain2.vatt[3][i];
146 
147  HepMC::GenVertex* vertex = new HepMC::GenVertex(HepMC::FourVector(x, y, z, t), id);
148  return vertex;
149 }
#define himain2
Definition: HijingWrapper.h:52
bool HijingHadronizer::call_hijset ( double  efrm,
std::string  frame,
std::string  proj,
std::string  targ,
int  iap,
int  izp,
int  iat,
int  izt 
)
private

Definition at line 244 of file HijingHadronizer.cc.

References HIJSET, amptDefault_cfi::iap, amptDefault_cfi::iat, amptDefault_cfi::izp, and amptDefault_cfi::izt.

Referenced by initializeForInternalPartons().

245  {
246  float ef = efrm;
247  // initialize hydjet
248  HIJSET(ef,
249  frame.data(),
250  proj.data(),
251  targ.data(),
252  iap,
253  izp,
254  iat,
255  izt,
256  strlen(frame.data()),
257  strlen(proj.data()),
258  strlen(targ.data()));
259  return true;
260 }
#define HIJSET
Definition: HijingWrapper.h:23
const char * HijingHadronizer::classname ( ) const

Definition at line 297 of file HijingHadronizer.cc.

297 { return "gen::HijingHadronizer"; }
bool HijingHadronizer::decay ( )

Definition at line 289 of file HijingHadronizer.cc.

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

Definition at line 40 of file HijingHadronizer.h.

References data-class-funcs::classname, myMessageLogger_cff::statistics, and findQualityFiles::v.

40 { return true; }
bool HijingHadronizer::declareStableParticles ( const std::vector< int > &  pdg)

Definition at line 277 of file HijingHadronizer.cc.

277 { return true; }
void HijingHadronizer::doSetRandomEngine ( CLHEP::HepRandomEngine *  v)
overrideprivatevirtual

Reimplemented from gen::BaseHadronizer.

Definition at line 83 of file HijingHadronizer.cc.

References hijRandomEngine, and gen::v.

83 { hijRandomEngine = v; }
double v[5][pyjets_maxn]
static CLHEP::HepRandomEngine * hijRandomEngine
std::vector<std::string> const& gen::HijingHadronizer::doSharedResources ( ) const
inlineoverrideprivatevirtual
void HijingHadronizer::finalizeEvent ( )

Definition at line 293 of file HijingHadronizer.cc.

293 { return; }
bool HijingHadronizer::generatePartonsAndHadronize ( )

Definition at line 151 of file HijingHadronizer.cc.

References add_heavy_ion_rec(), bmax_, bmin_, gen::BaseHadronizer::event(), evt, frame_, get_particles(), HIJING, rotate_, and rotateEvtPlane().

151  {
152  // generate single event
153  if (rotate_)
154  rotateEvtPlane();
155 
156  // generate a HIJING event
157 
158  float f_bmin = bmin_;
159  float f_bmax = bmax_;
160  HIJING(frame_.data(), f_bmin, f_bmax, strlen(frame_.data()));
161 
162  // event information
164  get_particles(evt);
165 
166  // evt->set_signal_process_id(pypars.msti[0]); // type of the process
167  // evt->set_event_scale(pypars.pari[16]); // Q^2
168  add_heavy_ion_rec(evt);
169 
170  event().reset(evt);
171 
172  return true;
173 }
HepMC::GenEvent * evt
void add_heavy_ion_rec(HepMC::GenEvent *evt)
std::unique_ptr< HepMC::GenEvent > & event()
bool get_particles(HepMC::GenEvent *evt)
#define HIJING
Definition: HijingWrapper.h:28
bool HijingHadronizer::get_particles ( HepMC::GenEvent evt)
private

Definition at line 176 of file HijingHadronizer.cc.

References build_hijing(), build_hijing_vertex(), GenParticle::GenParticle, himain1, himain2, mps_fire::i, LogDebug, ecalTrigSettings_cff::particles, and mathSSE::sqrt().

Referenced by generatePartonsAndHadronize().

176  {
177  HepMC::GenVertex* vertice;
178 
179  vector<HepMC::GenParticle*> particles;
180  vector<int> mother_ids;
181  vector<HepMC::GenVertex*> prods;
182 
183  vertice = new HepMC::GenVertex(HepMC::FourVector(0, 0, 0, 0), 0);
184  evt->add_vertex(vertice);
185  if (!evt->signal_process_vertex())
186  evt->set_signal_process_vertex(vertice);
187 
188  const unsigned int knumpart = himain1.natt;
189 
190  for (unsigned int ipart = 0; ipart < knumpart; ipart++) {
191  int mid = himain2.katt[2][ipart] - 1; // careful of fortan to c++ array index
192 
193  particles.push_back(build_hijing(ipart, ipart + 1));
194  prods.push_back(build_hijing_vertex(ipart, 0));
195  mother_ids.push_back(mid);
196  LogDebug("DecayChain") << "Mother index : " << mid;
197  }
198 
199  LogDebug("Hijing") << "Number of particles in vector " << particles.size();
200 
201  for (unsigned int ipart = 0; ipart < particles.size(); ipart++) {
202  HepMC::GenParticle* part = particles[ipart];
203 
204  int mid = mother_ids[ipart];
205  LogDebug("DecayChain") << "Particle " << ipart;
206  LogDebug("DecayChain") << "Mother's ID " << mid;
207  LogDebug("DecayChain") << "Particle's PDG ID " << part->pdg_id();
208 
209  // remove zero pT particles from list, protection for fastJet against pt=0 jets
210  if (part->status() == 1 &&
211  sqrt(part->momentum().px() * part->momentum().px() + part->momentum().py() * part->momentum().py()) == 0)
212  continue;
213 
214  if (mid <= 0) {
215  vertice->add_particle_out(part);
216  continue;
217  }
218 
219  if (mid > 0) {
220  HepMC::GenParticle* mother = particles[mid];
221  LogDebug("DecayChain") << "Mother's PDG ID " << mother->pdg_id();
222  HepMC::GenVertex* prod_vertex = mother->end_vertex();
223  if (!prod_vertex) {
224  prod_vertex = prods[ipart];
225  prod_vertex->add_particle_in(mother);
226 
227  evt->add_vertex(prod_vertex);
228  prods[ipart] = nullptr; // mark to protect deletion
229  }
230  prod_vertex->add_particle_out(part);
231  }
232  }
233 
234  // cleanup vertices not assigned to evt
235  for (unsigned int i = 0; i < prods.size(); i++) {
236  if (prods[i])
237  delete prods[i];
238  }
239 
240  return true;
241 }
#define LogDebug(id)
HepMC::GenParticle * build_hijing(int index, int barcode)
T sqrt(T t)
Definition: SSEVec.h:19
#define himain2
Definition: HijingWrapper.h:52
HepMC::GenVertex * build_hijing_vertex(int i, int id)
part
Definition: HCALResponse.h:20
#define himain1
Definition: HijingWrapper.h:43
bool HijingHadronizer::hadronize ( )

Definition at line 287 of file HijingHadronizer.cc.

287 { return false; }
bool gen::HijingHadronizer::initializeForExternalPartons ( )
bool HijingHadronizer::initializeForInternalPartons ( )

Definition at line 263 of file HijingHadronizer.cc.

References call_hijset(), efrm_, frame_, iap_, iat_, izp_, izt_, proj_, and targ_.

263  {
264  //initialize pythia5
265 
266  // std::string dumstr = "";
267  // call_pygive(dumstr);
268 
269  // initialize hijing
270  LogInfo("HIJINGinAction") << "##### Calling HIJSET(" << efrm_ << "," << frame_ << "," << proj_ << "," << targ_ << ","
271  << iap_ << "," << izp_ << "," << iat_ << "," << izt_ << ") ####";
273 
274  return true;
275 }
bool call_hijset(double efrm, std::string frame, std::string proj, std::string targ, int iap, int izp, int iat, int izt)
bool gen::HijingHadronizer::readSettings ( int  )
inline

Definition at line 36 of file HijingHadronizer.h.

36 { return true; }
bool HijingHadronizer::residualDecay ( )

Definition at line 291 of file HijingHadronizer.cc.

291 { return true; }
void HijingHadronizer::rotateEvtPlane ( )
private

Definition at line 280 of file HijingHadronizer.cc.

References funct::cos(), cosphi0_, gen::hijran_(), phi0_, pi, funct::sin(), and sinphi0_.

Referenced by generatePartonsAndHadronize().

280  {
281  phi0_ = 2. * pi * gen::hijran_(nullptr) - pi;
282  sinphi0_ = sin(phi0_);
283  cosphi0_ = cos(phi0_);
284 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
static const double pi
float hijran_(int *)
void HijingHadronizer::statistics ( )

Definition at line 295 of file HijingHadronizer.cc.

295 { return; }

Member Data Documentation

double gen::HijingHadronizer::bmax_
private

Definition at line 61 of file HijingHadronizer.h.

Referenced by generatePartonsAndHadronize().

double gen::HijingHadronizer::bmin_
private

Definition at line 63 of file HijingHadronizer.h.

Referenced by generatePartonsAndHadronize().

double gen::HijingHadronizer::cosphi0_
private

Definition at line 79 of file HijingHadronizer.h.

Referenced by build_hijing(), build_hijing_vertex(), and rotateEvtPlane().

double gen::HijingHadronizer::efrm_
private

Definition at line 65 of file HijingHadronizer.h.

Referenced by initializeForInternalPartons().

HepMC::GenEvent* gen::HijingHadronizer::evt
private

Definition at line 59 of file HijingHadronizer.h.

Referenced by generatePartonsAndHadronize().

std::string gen::HijingHadronizer::frame_
private

Definition at line 66 of file HijingHadronizer.h.

Referenced by generatePartonsAndHadronize(), and initializeForInternalPartons().

int gen::HijingHadronizer::iap_
private

Definition at line 69 of file HijingHadronizer.h.

Referenced by initializeForInternalPartons().

int gen::HijingHadronizer::iat_
private

Definition at line 71 of file HijingHadronizer.h.

Referenced by initializeForInternalPartons().

int gen::HijingHadronizer::izp_
private

Definition at line 70 of file HijingHadronizer.h.

Referenced by initializeForInternalPartons().

int gen::HijingHadronizer::izt_
private

Definition at line 72 of file HijingHadronizer.h.

Referenced by initializeForInternalPartons().

double gen::HijingHadronizer::phi0_
private

Definition at line 77 of file HijingHadronizer.h.

Referenced by add_heavy_ion_rec(), and rotateEvtPlane().

std::string gen::HijingHadronizer::proj_
private

Definition at line 67 of file HijingHadronizer.h.

Referenced by initializeForInternalPartons().

edm::ParameterSet gen::HijingHadronizer::pset_
private

Definition at line 60 of file HijingHadronizer.h.

bool gen::HijingHadronizer::rotate_
private

Definition at line 80 of file HijingHadronizer.h.

Referenced by generatePartonsAndHadronize().

double gen::HijingHadronizer::sinphi0_
private

Definition at line 78 of file HijingHadronizer.h.

Referenced by build_hijing(), build_hijing_vertex(), and rotateEvtPlane().

std::string gen::HijingHadronizer::targ_
private

Definition at line 68 of file HijingHadronizer.h.

Referenced by initializeForInternalPartons().

const std::vector< std::string > HijingHadronizer::theSharedResources = {edm::SharedResourceNames::kPythia6}
staticprivate

Definition at line 82 of file HijingHadronizer.h.