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::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 ()
 
virtual ~HijingHadronizer ()
 
- 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

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

Detailed Description

Definition at line 28 of file HijingHadronizer.h.

Constructor & Destructor Documentation

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

Definition at line 60 of file HijingHadronizer.cc.

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

Definition at line 84 of file HijingHadronizer.cc.

85 {
86  // destructor
87 }

Member Function Documentation

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

Definition at line 98 of file HijingHadronizer.cc.

References himain1, hiparnt, and phi0_.

Referenced by generatePartonsAndHadronize().

99 {
100  // heavy ion record in the final CMSSW Event
101  HepMC::HeavyIon* hi = new HepMC::HeavyIon(
102  himain1.jatt, // Ncoll_hard/N of SubEvents
103  himain1.np, // Npart_proj
104  himain1.nt, // Npart_targ
105  himain1.n0+himain1.n01+himain1.n10+himain1.n11, // Ncoll
106  0, // spectator_neutrons
107  0, // spectator_protons
108  himain1.n01, // N_Nwounded_collisions
109  himain1.n10, // Nwounded_N_collisions
110  himain1.n11, // Nwounded_Nwounded_collisions
111  //gsfs Changed from 19 to 18 (Fortran counts from 1 , not 0)
112  hiparnt.hint1[18], // impact_parameter in [fm]
113  phi0_, // event_plane_angle
114  0, // eccentricity
115  //gsfs Changed from 12 to 11 (Fortran counts from 1 , not 0)
116  hiparnt.hint1[11] // sigma_inel_NN
117  );
118  evt->set_heavy_ion(*hi);
119  delete hi;
120 }
HepMC::GenEvent * evt
#define hiparnt
Definition: HijingWrapper.h:52
#define himain1
Definition: HijingWrapper.h:33
HepMC::GenParticle * HijingHadronizer::build_hijing ( int  index,
int  barcode 
)
private

Definition at line 123 of file HijingHadronizer.cc.

References cosphi0_, GenParticle::GenParticle, himain2, cmsHarvester::index, gen::p, sinphi0_, and x().

Referenced by get_particles().

124 {
125  // Build particle object corresponding to index in hijing
126 
127  double x0 = himain2.patt[0][index];
128  double y0 = himain2.patt[1][index];
129 
130  double x = x0*cosphi0_-y0*sinphi0_;
131  double y = y0*cosphi0_+x0*sinphi0_;
132 
133  // Hijing gives V0's status=4, they need to have status=1 to be decayed in geant
134  // also change status=11 to status=2
135  if(himain2.katt[3][index]<=10 && himain2.katt[3][index]>0) himain2.katt[3][index]=1;
136  if(himain2.katt[3][index]<=20 && himain2.katt[3][index]>10) himain2.katt[3][index]=2;
137 
139  HepMC::FourVector(x, // px
140  y, // py
141  himain2.patt[2][index], // pz
142  himain2.patt[3][index]), // E
143  himain2.katt[0][index],// id
144  himain2.katt[3][index] // status
145  );
146  p->suggest_barcode(barcode);
147 
148  return p;
149 }
double p[5][pyjets_maxn]
#define himain2
Definition: HijingWrapper.h:42
HepMC::GenVertex * HijingHadronizer::build_hijing_vertex ( int  i,
int  id 
)
private

Definition at line 152 of file HijingHadronizer.cc.

References cosphi0_, himain2, i, sinphi0_, lumiQTWidget::t, and x().

Referenced by get_particles().

153 {
154  // build verteces for the hijing stored events
155  double x0=himain2.vatt[0][i];
156  double y0=himain2.vatt[1][i];
157  double x = x0*cosphi0_-y0*sinphi0_;
158  double y = y0*cosphi0_+x0*sinphi0_;
159  double z=himain2.vatt[2][i];
160  double t=himain2.vatt[3][i];
161 
162  HepMC::GenVertex* vertex = new HepMC::GenVertex(HepMC::FourVector(x,y,z,t),id);
163  return vertex;
164 }
int i
Definition: DBlmapReader.cc:9
#define himain2
Definition: HijingWrapper.h:42
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 259 of file HijingHadronizer.cc.

References HIJSET.

Referenced by initializeForInternalPartons().

260 {
261 
262  float ef = efrm;
263  // initialize hydjet
264  HIJSET(ef,frame.data(),proj.data(),targ.data(),iap,izp,iat,izt,strlen(frame.data()),strlen(proj.data()),strlen(targ.data()));
265  return true;
266 }
#define HIJSET
Definition: HijingWrapper.h:13
const char * HijingHadronizer::classname ( ) const

Definition at line 321 of file HijingHadronizer.cc.

322 {
323  return "gen::HijingHadronizer";
324 }
bool HijingHadronizer::decay ( )

Definition at line 303 of file HijingHadronizer.cc.

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

Definition at line 41 of file HijingHadronizer.h.

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

Definition at line 284 of file HijingHadronizer.cc.

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

Reimplemented from gen::BaseHadronizer.

Definition at line 91 of file HijingHadronizer.cc.

References hijRandomEngine, and gen::v.

92 {
94 }
double v[5][pyjets_maxn]
static CLHEP::HepRandomEngine * hijRandomEngine
virtual std::vector<std::string> const& gen::HijingHadronizer::doSharedResources ( ) const
inlineoverrideprivatevirtual

Reimplemented from gen::BaseHadronizer.

Definition at line 50 of file HijingHadronizer.h.

References theSharedResources.

50 { return theSharedResources; }
static const std::vector< std::string > theSharedResources
void HijingHadronizer::finalizeEvent ( )

Definition at line 313 of file HijingHadronizer.cc.

313  {
314  return;
315 }
bool HijingHadronizer::generatePartonsAndHadronize ( )

Definition at line 166 of file HijingHadronizer.cc.

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

167 {
168  // generate single event
169  if(rotate_) rotateEvtPlane();
170 
171  // generate a HIJING event
172 
173  float f_bmin = bmin_;
174  float f_bmax = bmax_;
175  HIJING(frame_.data(), f_bmin, f_bmax, strlen(frame_.data()));
176 
177  // event information
178  HepMC::GenEvent *evt = new HepMC::GenEvent();
179  get_particles(evt);
180 
181  // evt->set_signal_process_id(pypars.msti[0]); // type of the process
182  // evt->set_event_scale(pypars.pari[16]); // Q^2
183  add_heavy_ion_rec(evt);
184 
185  event().reset(evt);
186 
187  return true;
188 }
HepMC::GenEvent * evt
std::auto_ptr< HepMC::GenEvent > & event()
void add_heavy_ion_rec(HepMC::GenEvent *evt)
bool get_particles(HepMC::GenEvent *evt)
#define HIJING
Definition: HijingWrapper.h:18
bool HijingHadronizer::get_particles ( HepMC::GenEvent *  evt)
private

Definition at line 191 of file HijingHadronizer.cc.

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

Referenced by generatePartonsAndHadronize().

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

Definition at line 298 of file HijingHadronizer.cc.

299 {
300  return false;
301 }
bool gen::HijingHadronizer::initializeForExternalPartons ( )
bool HijingHadronizer::initializeForInternalPartons ( )

Definition at line 269 of file HijingHadronizer.cc.

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

269  {
270 
271  //initialize pythia5
272 
273  // std::string dumstr = "";
274  // call_pygive(dumstr);
275 
276  // initialize hijing
277  LogInfo("HIJINGinAction") << "##### Calling HIJSET(" << efrm_ << "," <<frame_<<","<<proj_<<","<<targ_<<","<<iap_<<","<<izp_<<","<<iat_<<","<<izt_<<") ####";
279 
280  return true;
281 
282 }
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 37 of file HijingHadronizer.h.

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

Definition at line 308 of file HijingHadronizer.cc.

309 {
310  return true;
311 }
void HijingHadronizer::rotateEvtPlane ( )
private

Definition at line 290 of file HijingHadronizer.cc.

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

Referenced by generatePartonsAndHadronize().

290  {
291 
292  phi0_ = 2.*pi*gen::hijran_(0) - pi;
293  sinphi0_ = sin(phi0_);
294  cosphi0_ = cos(phi0_);
295 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
const Double_t pi
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
float hijran_(int *)
void HijingHadronizer::statistics ( )

Definition at line 317 of file HijingHadronizer.cc.

317  {
318  return;
319 }

Member Data Documentation

double gen::HijingHadronizer::bmax_
private

Definition at line 63 of file HijingHadronizer.h.

Referenced by generatePartonsAndHadronize().

double gen::HijingHadronizer::bmin_
private

Definition at line 65 of file HijingHadronizer.h.

Referenced by generatePartonsAndHadronize().

double gen::HijingHadronizer::cosphi0_
private

Definition at line 81 of file HijingHadronizer.h.

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

double gen::HijingHadronizer::efrm_
private

Definition at line 67 of file HijingHadronizer.h.

Referenced by initializeForInternalPartons().

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

Definition at line 61 of file HijingHadronizer.h.

Referenced by generatePartonsAndHadronize().

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

Definition at line 68 of file HijingHadronizer.h.

Referenced by generatePartonsAndHadronize(), and initializeForInternalPartons().

int gen::HijingHadronizer::iap_
private

Definition at line 71 of file HijingHadronizer.h.

Referenced by initializeForInternalPartons().

int gen::HijingHadronizer::iat_
private

Definition at line 73 of file HijingHadronizer.h.

Referenced by initializeForInternalPartons().

int gen::HijingHadronizer::izp_
private

Definition at line 72 of file HijingHadronizer.h.

Referenced by initializeForInternalPartons().

int gen::HijingHadronizer::izt_
private

Definition at line 74 of file HijingHadronizer.h.

Referenced by initializeForInternalPartons().

double gen::HijingHadronizer::phi0_
private

Definition at line 79 of file HijingHadronizer.h.

Referenced by add_heavy_ion_rec(), and rotateEvtPlane().

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

Definition at line 69 of file HijingHadronizer.h.

Referenced by initializeForInternalPartons().

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

Definition at line 62 of file HijingHadronizer.h.

bool gen::HijingHadronizer::rotate_
private

Definition at line 82 of file HijingHadronizer.h.

Referenced by generatePartonsAndHadronize().

double gen::HijingHadronizer::sinphi0_
private

Definition at line 80 of file HijingHadronizer.h.

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

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

Definition at line 70 of file HijingHadronizer.h.

Referenced by initializeForInternalPartons().

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

Definition at line 84 of file HijingHadronizer.h.

Referenced by doSharedResources().