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
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)
 
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_
 

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

Constructor & Destructor Documentation

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

Definition at line 34 of file HijingHadronizer.cc.

References edm::RandomNumberGenerator::getEngine(), and hijRandomEngine.

34  :
35  BaseHadronizer(pset),
36  evt(0),
37  pset_(pset),
38  bmax_(pset.getParameter<double>("bMax")),
39  bmin_(pset.getParameter<double>("bMin")),
40  efrm_(pset.getParameter<double>("comEnergy")),
41  frame_(pset.getParameter<string>("frame")),
42  proj_(pset.getParameter<string>("proj")),
43  targ_(pset.getParameter<string>("targ")),
44  iap_(pset.getParameter<int>("iap")),
45  izp_(pset.getParameter<int>("izp")),
46  iat_(pset.getParameter<int>("iat")),
47  izt_(pset.getParameter<int>("izt")),
48  phi0_(0.),
49  sinphi0_(0.),
50  cosphi0_(1.),
51  rotate_(pset.getParameter<bool>("rotateEventPlane"))
52 {
53  // Default constructor
55  hijRandomEngine = &(rng->getEngine());
56 
57 }
T getParameter(std::string const &) const
HepMC::GenEvent * evt
CLHEP::HepRandomEngine * hijRandomEngine
BaseHadronizer(edm::ParameterSet const &ps)
edm::ParameterSet pset_
virtual CLHEP::HepRandomEngine & getEngine() const =0
Use this to get the random number engine, this is the only function most users should call...
HijingHadronizer::~HijingHadronizer ( )
virtual

Definition at line 61 of file HijingHadronizer.cc.

62 {
63  // destructor
64 }

Member Function Documentation

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

Definition at line 67 of file HijingHadronizer.cc.

References himain1, hiparnt, and phi0_.

Referenced by generatePartonsAndHadronize().

68 {
69  // heavy ion record in the final CMSSW Event
70  HepMC::HeavyIon* hi = new HepMC::HeavyIon(
71  himain1.jatt, // Ncoll_hard/N of SubEvents
72  himain1.np, // Npart_proj
73  himain1.nt, // Npart_targ
74  himain1.n0+himain1.n01+himain1.n10+himain1.n11, // Ncoll
75  0, // spectator_neutrons
76  0, // spectator_protons
77  himain1.n01, // N_Nwounded_collisions
78  himain1.n10, // Nwounded_N_collisions
79  himain1.n11, // Nwounded_Nwounded_collisions
80  //gsfs Changed from 19 to 18 (Fortran counts from 1 , not 0)
81  hiparnt.hint1[18], // impact_parameter in [fm]
82  phi0_, // event_plane_angle
83  0, // eccentricity
84  //gsfs Changed from 12 to 11 (Fortran counts from 1 , not 0)
85  hiparnt.hint1[11] // sigma_inel_NN
86  );
87  evt->set_heavy_ion(*hi);
88  delete hi;
89 }
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 92 of file HijingHadronizer.cc.

References cosphi0_, configurableAnalysis::GenParticle, himain2, getHLTprescales::index, gen::p, sinphi0_, x, and detailsBasic3DVector::y.

Referenced by get_particles().

93 {
94  // Build particle object corresponding to index in hijing
95 
96  double x0 = himain2.patt[0][index];
97  double y0 = himain2.patt[1][index];
98 
99  double x = x0*cosphi0_-y0*sinphi0_;
100  double y = y0*cosphi0_+x0*sinphi0_;
101 
102  // Hijing gives V0's status=4, they need to have status=1 to be decayed in geant
103  // also change status=11 to status=2
104  if(himain2.katt[3][index]<=10 && himain2.katt[3][index]>0) himain2.katt[3][index]=1;
105  if(himain2.katt[3][index]<=20 && himain2.katt[3][index]>10) himain2.katt[3][index]=2;
106 
108  HepMC::FourVector(x, // px
109  y, // py
110  himain2.patt[2][index], // pz
111  himain2.patt[3][index]), // E
112  himain2.katt[0][index],// id
113  himain2.katt[3][index] // status
114  );
115  p->suggest_barcode(barcode);
116 
117  return p;
118 }
double p[5][pyjets_maxn]
#define himain2
Definition: HijingWrapper.h:42
Definition: DDAxes.h:10
HepMC::GenVertex * HijingHadronizer::build_hijing_vertex ( int  i,
int  id 
)
private

Definition at line 121 of file HijingHadronizer.cc.

References cosphi0_, himain2, i, sinphi0_, lumiQTWidget::t, x, detailsBasic3DVector::y, and detailsBasic3DVector::z.

Referenced by get_particles().

122 {
123  // build verteces for the hijing stored events
124  double x0=himain2.vatt[0][i];
125  double y0=himain2.vatt[1][i];
126  double x = x0*cosphi0_-y0*sinphi0_;
127  double y = y0*cosphi0_+x0*sinphi0_;
128  double z=himain2.vatt[2][i];
129  double t=himain2.vatt[3][i];
130 
131  HepMC::GenVertex* vertex = new HepMC::GenVertex(HepMC::FourVector(x,y,z,t),id);
132  return vertex;
133 }
int i
Definition: DBlmapReader.cc:9
float float float z
#define himain2
Definition: HijingWrapper.h:42
Definition: DDAxes.h:10
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 228 of file HijingHadronizer.cc.

References HIJSET.

Referenced by initializeForInternalPartons().

229 {
230 
231  float ef = efrm;
232  // initialize hydjet
233  HIJSET(ef,frame.data(),proj.data(),targ.data(),iap,izp,iat,izt,strlen(frame.data()),strlen(proj.data()),strlen(targ.data()));
234  return true;
235 }
#define HIJSET
Definition: HijingWrapper.h:13
const char * HijingHadronizer::classname ( ) const

Definition at line 292 of file HijingHadronizer.cc.

293 {
294  return "gen::HijingHadronizer";
295 }
bool HijingHadronizer::decay ( )

Definition at line 274 of file HijingHadronizer.cc.

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

Definition at line 40 of file HijingHadronizer.h.

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

Definition at line 255 of file HijingHadronizer.cc.

256 {
257  return true;
258 }
void HijingHadronizer::finalizeEvent ( )

Definition at line 284 of file HijingHadronizer.cc.

284  {
285  return;
286 }
bool HijingHadronizer::generatePartonsAndHadronize ( )

Definition at line 135 of file HijingHadronizer.cc.

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

136 {
137  // generate single event
138  if(rotate_) rotateEvtPlane();
139 
140  // generate a HIJING event
141 
142  float f_bmin = bmin_;
143  float f_bmax = bmax_;
144  HIJING(frame_.data(), f_bmin, f_bmax, strlen(frame_.data()));
145 
146  // event information
147  HepMC::GenEvent *evt = new HepMC::GenEvent();
148  get_particles(evt);
149 
150  // evt->set_signal_process_id(pypars.msti[0]); // type of the process
151  // evt->set_event_scale(pypars.pari[16]); // Q^2
152  add_heavy_ion_rec(evt);
153 
154  event().reset(evt);
155 
156  return true;
157 }
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 160 of file HijingHadronizer.cc.

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

Referenced by generatePartonsAndHadronize().

161 {
162  HepMC::GenVertex* vertice;
163 
164  vector<HepMC::GenParticle*> particles;
165  vector<int> mother_ids;
166  vector<HepMC::GenVertex*> prods;
167 
168  vertice = new HepMC::GenVertex(HepMC::FourVector(0,0,0,0),0);
169  evt->add_vertex(vertice);
170  if(!evt->signal_process_vertex()) evt->set_signal_process_vertex(vertice);
171 
172  const unsigned int knumpart = himain1.natt;
173 
174  for (unsigned int ipart = 0; ipart<knumpart; ipart++) {
175 
176  int mid = himain2.katt[2][ipart] - 1; // careful of fortan to c++ array index
177 
178  particles.push_back(build_hijing(ipart,ipart+1));
179  prods.push_back(build_hijing_vertex(ipart,0));
180  mother_ids.push_back(mid);
181  LogDebug("DecayChain")<<"Mother index : "<<mid;
182  }
183 
184  LogDebug("Hijing")<<"Number of particles in vector "<<particles.size();
185 
186  for (unsigned int ipart = 0; ipart<particles.size(); ipart++) {
187  HepMC::GenParticle* part = particles[ipart];
188 
189  int mid = mother_ids[ipart];
190  LogDebug("DecayChain")<<"Particle "<<ipart;
191  LogDebug("DecayChain")<<"Mother's ID "<<mid;
192  LogDebug("DecayChain")<<"Particle's PDG ID "<<part->pdg_id();
193 
194  // remove zero pT particles from list, protection for fastJet against pt=0 jets
195  if(part->status()==1&&sqrt(part->momentum().px()*part->momentum().px()+part->momentum().py()*part->momentum().py())==0)
196  continue;
197 
198  if(mid <= 0){
199  vertice->add_particle_out(part);
200  continue;
201  }
202 
203  if(mid > 0){
204  HepMC::GenParticle* mother = particles[mid];
205  LogDebug("DecayChain")<<"Mother's PDG ID "<<mother->pdg_id();
206  HepMC::GenVertex* prod_vertex = mother->end_vertex();
207  if(!prod_vertex){
208  prod_vertex = prods[ipart];
209  prod_vertex->add_particle_in(mother);
210 
211  evt->add_vertex(prod_vertex);
212  prods[ipart]=0; // mark to protect deletion
213 
214  }
215  prod_vertex->add_particle_out(part);
216  }
217  }
218 
219  // cleanup vertices not assigned to evt
220  for (unsigned int i = 0; i<prods.size(); i++) {
221  if(prods[i]) delete prods[i];
222  }
223 
224  return true;
225 }
#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 269 of file HijingHadronizer.cc.

270 {
271  return false;
272 }
bool gen::HijingHadronizer::initializeForExternalPartons ( )
bool HijingHadronizer::initializeForInternalPartons ( )

Definition at line 238 of file HijingHadronizer.cc.

References call_hijset(), gen::call_pygive(), efrm_, frame_, iap_, iat_, izp_, izt_, proj_, AlCaHLTBitMon_QueryRunRegistry::string, and targ_.

238  {
239 
240  //initialize pythia5
241 
242  if(0){
243  std::string dumstr = "";
244  call_pygive(dumstr);
245  }
246 
247  // initialize hijing
248  LogInfo("HIJINGinAction") << "##### Calling HIJSET(" << efrm_ << "," <<frame_<<","<<proj_<<","<<targ_<<","<<iap_<<","<<izp_<<","<<iat_<<","<<izt_<<") ####";
250 
251  return true;
252 
253 }
bool call_pygive(const std::string &line)
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 279 of file HijingHadronizer.cc.

280 {
281  return true;
282 }
void HijingHadronizer::rotateEvtPlane ( )
private

Definition at line 261 of file HijingHadronizer.cc.

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

Referenced by generatePartonsAndHadronize().

261  {
262 
263  phi0_ = 2.*pi*gen::hijran_(0) - pi;
264  sinphi0_ = sin(phi0_);
265  cosphi0_ = cos(phi0_);
266 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
double pi
float hijran_(int *)
void HijingHadronizer::statistics ( )

Definition at line 288 of file HijingHadronizer.cc.

288  {
289  return;
290 }

Member Data Documentation

double gen::HijingHadronizer::bmax_
private

Definition at line 59 of file HijingHadronizer.h.

Referenced by generatePartonsAndHadronize().

double gen::HijingHadronizer::bmin_
private

Definition at line 61 of file HijingHadronizer.h.

Referenced by generatePartonsAndHadronize().

double gen::HijingHadronizer::cosphi0_
private

Definition at line 77 of file HijingHadronizer.h.

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

double gen::HijingHadronizer::efrm_
private

Definition at line 63 of file HijingHadronizer.h.

Referenced by initializeForInternalPartons().

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

Definition at line 57 of file HijingHadronizer.h.

Referenced by generatePartonsAndHadronize().

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

Definition at line 64 of file HijingHadronizer.h.

Referenced by generatePartonsAndHadronize(), and initializeForInternalPartons().

int gen::HijingHadronizer::iap_
private

Definition at line 67 of file HijingHadronizer.h.

Referenced by initializeForInternalPartons().

int gen::HijingHadronizer::iat_
private

Definition at line 69 of file HijingHadronizer.h.

Referenced by initializeForInternalPartons().

int gen::HijingHadronizer::izp_
private

Definition at line 68 of file HijingHadronizer.h.

Referenced by initializeForInternalPartons().

int gen::HijingHadronizer::izt_
private

Definition at line 70 of file HijingHadronizer.h.

Referenced by initializeForInternalPartons().

double gen::HijingHadronizer::phi0_
private

Definition at line 75 of file HijingHadronizer.h.

Referenced by add_heavy_ion_rec(), and rotateEvtPlane().

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

Definition at line 65 of file HijingHadronizer.h.

Referenced by initializeForInternalPartons().

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

Definition at line 58 of file HijingHadronizer.h.

bool gen::HijingHadronizer::rotate_
private

Definition at line 78 of file HijingHadronizer.h.

Referenced by generatePartonsAndHadronize().

double gen::HijingHadronizer::sinphi0_
private

Definition at line 76 of file HijingHadronizer.h.

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

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

Definition at line 66 of file HijingHadronizer.h.

Referenced by initializeForInternalPartons().