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< HepMC3::GenEvent > getGenEvent3 ()
 
std::unique_ptr< GenEventInfoProductgetGenEventInfo ()
 
std::unique_ptr< GenEventInfoProduct3getGenEventInfo3 ()
 
virtual std::unique_ptr< GenLumiInfoHeadergetGenLumiInfoHeader () const
 
GenRunInfoProductgetGenRunInfo ()
 
std::unique_ptr< lhef::LHEEventgetLHEEvent ()
 
const std::shared_ptr< lhef::LHERunInfo > & getLHERunInfo () const
 
unsigned int getVHepMC ()
 
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 resetEvent3 (std::unique_ptr< HepMC3::GenEvent > event3)
 
void resetEventInfo (std::unique_ptr< GenEventInfoProduct > eventInfo)
 
void resetEventInfo3 (std::unique_ptr< GenEventInfoProduct3 > 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 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< HepMC3::GenEvent > & event3 ()
 
std::unique_ptr< GenEventInfoProduct > & eventInfo ()
 
std::unique_ptr< GenEventInfoProduct3 > & eventInfo3 ()
 
lhef::LHEEventlheEvent ()
 
lhef::LHERunInfolheRunInfo ()
 
GenRunInfoProductrunInfo ()
 
- Protected Attributes inherited from gen::BaseHadronizer
unsigned int ivhepmc = 2
 
std::string lheFile_
 
int randomIndex_
 

Detailed Description

Definition at line 27 of file HijingHadronizer.h.

Constructor & Destructor Documentation

◆ HijingHadronizer()

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

Definition at line 54 of file HijingHadronizer.cc.

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

◆ ~HijingHadronizer()

HijingHadronizer::~HijingHadronizer ( )
override

Definition at line 76 of file HijingHadronizer.cc.

76  {
77  // destructor
78 }

Member Function Documentation

◆ add_heavy_ion_rec()

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

Definition at line 84 of file HijingHadronizer.cc.

References evt, himain1, hiparnt, and phi0_.

Referenced by generatePartonsAndHadronize().

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

◆ build_hijing()

HepMC::GenParticle * HijingHadronizer::build_hijing ( int  index,
int  barcode 
)
private

Definition at line 107 of file HijingHadronizer.cc.

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

Referenced by get_particles().

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

◆ build_hijing_vertex()

HepMC::GenVertex * HijingHadronizer::build_hijing_vertex ( int  i,
int  id 
)
private

Definition at line 136 of file HijingHadronizer.cc.

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

Referenced by get_particles().

136  {
137  // build verteces for the hijing stored events
138  double x0 = himain2.vatt[0][i];
139  double y0 = himain2.vatt[1][i];
140  double x = x0 * cosphi0_ - y0 * sinphi0_;
141  double y = y0 * cosphi0_ + x0 * sinphi0_;
142  double z = himain2.vatt[2][i];
143  double t = himain2.vatt[3][i];
144 
145  HepMC::GenVertex* vertex = new HepMC::GenVertex(HepMC::FourVector(x, y, z, t), id);
146  return vertex;
147 }
#define himain2
Definition: HijingWrapper.h:52

◆ call_hijset()

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 242 of file HijingHadronizer.cc.

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

Referenced by initializeForInternalPartons().

243  {
244  float ef = efrm;
245  // initialize hydjet
246  frame.resize(4, ' ');
247  proj.resize(4, ' ');
248  targ.resize(4, ' ');
249  HIJSET(ef, frame.data(), proj.data(), targ.data(), iap, izp, iat, izt, frame.length(), proj.length(), targ.length());
250  return true;
251 }
#define HIJSET
Definition: HijingWrapper.h:23

◆ classname()

const char * HijingHadronizer::classname ( ) const

Definition at line 288 of file HijingHadronizer.cc.

288 { return "gen::HijingHadronizer"; }

◆ decay()

bool HijingHadronizer::decay ( )

Definition at line 280 of file HijingHadronizer.cc.

280 { return true; }

◆ declareSpecialSettings()

bool gen::HijingHadronizer::declareSpecialSettings ( const std::vector< std::string > &  )
inline

Definition at line 40 of file HijingHadronizer.h.

40 { return true; }

◆ declareStableParticles()

bool HijingHadronizer::declareStableParticles ( const std::vector< int > &  pdg)

Definition at line 268 of file HijingHadronizer.cc.

268 { return true; }

◆ doSetRandomEngine()

void HijingHadronizer::doSetRandomEngine ( CLHEP::HepRandomEngine *  v)
overrideprivatevirtual

Reimplemented from gen::BaseHadronizer.

Definition at line 81 of file HijingHadronizer.cc.

References hijRandomEngine, and gen::v.

81 { hijRandomEngine = v; }
double v[5][pyjets_maxn]
static CLHEP::HepRandomEngine * hijRandomEngine

◆ doSharedResources()

std::vector<std::string> const& gen::HijingHadronizer::doSharedResources ( ) const
inlineoverrideprivatevirtual

Reimplemented from gen::BaseHadronizer.

Definition at line 48 of file HijingHadronizer.h.

References theSharedResources.

48 { return theSharedResources; }
static const std::vector< std::string > theSharedResources

◆ finalizeEvent()

void HijingHadronizer::finalizeEvent ( )

Definition at line 284 of file HijingHadronizer.cc.

284 { return; }

◆ generatePartonsAndHadronize()

bool HijingHadronizer::generatePartonsAndHadronize ( )

Definition at line 149 of file HijingHadronizer.cc.

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

149  {
150  // generate single event
151  if (rotate_)
152  rotateEvtPlane();
153 
154  // generate a HIJING event
155 
156  float f_bmin = bmin_;
157  float f_bmax = bmax_;
158  HIJING(frame_.c_str(), f_bmin, f_bmax, frame_.length());
159 
160  // event information
163 
164  // evt->set_signal_process_id(pypars.msti[0]); // type of the process
165  // evt->set_event_scale(pypars.pari[16]); // Q^2
167 
168  event().reset(evt);
169 
170  return true;
171 }
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

◆ get_particles()

bool HijingHadronizer::get_particles ( HepMC::GenEvent evt)
private

Definition at line 174 of file HijingHadronizer.cc.

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

Referenced by generatePartonsAndHadronize().

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

◆ hadronize()

bool HijingHadronizer::hadronize ( )

Definition at line 278 of file HijingHadronizer.cc.

278 { return false; }

◆ initializeForExternalPartons()

bool gen::HijingHadronizer::initializeForExternalPartons ( )

◆ initializeForInternalPartons()

bool HijingHadronizer::initializeForInternalPartons ( )

Definition at line 254 of file HijingHadronizer.cc.

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

254  {
255  //initialize pythia5
256 
257  // std::string dumstr = "";
258  // call_pygive(dumstr);
259 
260  // initialize hijing
261  LogInfo("HIJINGinAction") << "##### Calling HIJSET(" << efrm_ << "," << frame_ << "," << proj_ << "," << targ_ << ","
262  << iap_ << "," << izp_ << "," << iat_ << "," << izt_ << ") ####";
264 
265  return true;
266 }
Log< level::Info, false > LogInfo
bool call_hijset(double efrm, std::string frame, std::string proj, std::string targ, int iap, int izp, int iat, int izt)

◆ readSettings()

bool gen::HijingHadronizer::readSettings ( int  )
inline

Definition at line 36 of file HijingHadronizer.h.

36 { return true; }

◆ residualDecay()

bool HijingHadronizer::residualDecay ( )

Definition at line 282 of file HijingHadronizer.cc.

282 { return true; }

◆ rotateEvtPlane()

void HijingHadronizer::rotateEvtPlane ( )
private

Definition at line 271 of file HijingHadronizer.cc.

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

Referenced by generatePartonsAndHadronize().

271  {
272  phi0_ = 2. * pi * gen::hijran_(nullptr) - pi;
273  sinphi0_ = sin(phi0_);
274  cosphi0_ = cos(phi0_);
275 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
float hijran_(int *)
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
static const double pi

◆ statistics()

void HijingHadronizer::statistics ( )

Definition at line 286 of file HijingHadronizer.cc.

286 { return; }

Member Data Documentation

◆ bmax_

double gen::HijingHadronizer::bmax_
private

Definition at line 61 of file HijingHadronizer.h.

Referenced by generatePartonsAndHadronize().

◆ bmin_

double gen::HijingHadronizer::bmin_
private

Definition at line 63 of file HijingHadronizer.h.

Referenced by generatePartonsAndHadronize().

◆ cosphi0_

double gen::HijingHadronizer::cosphi0_
private

Definition at line 79 of file HijingHadronizer.h.

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

◆ efrm_

double gen::HijingHadronizer::efrm_
private

Definition at line 65 of file HijingHadronizer.h.

Referenced by initializeForInternalPartons().

◆ evt

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

◆ frame_

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

Definition at line 66 of file HijingHadronizer.h.

Referenced by generatePartonsAndHadronize(), and initializeForInternalPartons().

◆ iap_

int gen::HijingHadronizer::iap_
private

Definition at line 69 of file HijingHadronizer.h.

Referenced by initializeForInternalPartons().

◆ iat_

int gen::HijingHadronizer::iat_
private

Definition at line 71 of file HijingHadronizer.h.

Referenced by initializeForInternalPartons().

◆ izp_

int gen::HijingHadronizer::izp_
private

Definition at line 70 of file HijingHadronizer.h.

Referenced by initializeForInternalPartons().

◆ izt_

int gen::HijingHadronizer::izt_
private

Definition at line 72 of file HijingHadronizer.h.

Referenced by initializeForInternalPartons().

◆ phi0_

double gen::HijingHadronizer::phi0_
private

Definition at line 77 of file HijingHadronizer.h.

Referenced by add_heavy_ion_rec(), and rotateEvtPlane().

◆ proj_

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

Definition at line 67 of file HijingHadronizer.h.

Referenced by initializeForInternalPartons().

◆ pset_

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

Definition at line 60 of file HijingHadronizer.h.

◆ rotate_

bool gen::HijingHadronizer::rotate_
private

Definition at line 80 of file HijingHadronizer.h.

Referenced by generatePartonsAndHadronize().

◆ sinphi0_

double gen::HijingHadronizer::sinphi0_
private

Definition at line 78 of file HijingHadronizer.h.

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

◆ targ_

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

Definition at line 68 of file HijingHadronizer.h.

Referenced by initializeForInternalPartons().

◆ theSharedResources

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

Definition at line 82 of file HijingHadronizer.h.

Referenced by doSharedResources().