CMS 3D CMS Logo

ReggeGribovPartonMCHadronizer.cc
Go to the documentation of this file.
1 #include <iostream>
2 #include <cmath>
3 #include <string>
4 
9 
10 #include "CLHEP/Random/RandomEngine.h"
11 
12 #include <HepMC/GenCrossSection.h>
13 #include <HepMC/GenEvent.h>
14 #include <HepMC/GenVertex.h>
15 #include <HepMC/GenParticle.h>
16 #include <HepMC/HeavyIon.h>
17 #include <HepMC/PdfInfo.h>
18 #include <HepMC/Units.h>
19 
27 
30 
32 
34 
35 using namespace edm;
36 using namespace std;
37 using namespace gen;
38 
41 
43 
44 static CLHEP::HepRandomEngine* reggeGribovRandomEngine;
45 
46 extern "C"
47 {
48  float gen::rangen_()
49  {
50  float a = float(reggeGribovRandomEngine->flat());
51  return a;
52  }
53 
54  double gen::drangen_(int *idummy)
55  {
56  double a = reggeGribovRandomEngine->flat();
57  return a;
58  }
59 }
60 
61 ReggeGribovPartonMCHadronizer::ReggeGribovPartonMCHadronizer(const ParameterSet &pset) :
62  BaseHadronizer(pset),
63  pset_(pset),
64  m_BeamMomentum(pset.getParameter<double>("beammomentum")),
65  m_TargetMomentum(pset.getParameter<double>("targetmomentum")),
66  m_BeamID(pset.getParameter<int>("beamid")),
67  m_TargetID(pset.getParameter<int>("targetid")),
68  m_HEModel(pset.getParameter<int>("model")),
69  m_bMin(pset.getParameter<double>("bmin")),
70  m_bMax(pset.getParameter<double>("bmax")),
71  m_ParamFileName(pset.getUntrackedParameter<string>("paramFileName")),
72  m_SkipNuclFrag(pset.getParameter<bool>("skipNuclFrag")),
73  m_NEvent(0),
74  m_NParticles(0),
75  m_ImpactParameter(0.),
76  m_IsInitialized(false)
77 {
78  int nevet = 1; //needed for CS
79  int noTables = 0; //don't calculate tables
80  int LHEoutput = 0; //no lhe
81  int dummySeed = 123;
82  char dummyName[] = "dummy";
84  m_TargetID,m_HEModel,noTables,LHEoutput,dummyName,
85  m_ParamFileName.fullPath().c_str());
86 
87  //additionally initialise tables
89 
90  //change impact paramter
91  nucl2_.bminim = float(m_bMin);
92  nucl2_.bmaxim = float(m_bMax);
93 }
94 
95 
96 //_____________________________________________________________________
98 {
99  // destructor
100 }
101 
102 
103 //_____________________________________________________________________
105 {
107 }
108 
109 
110 //_____________________________________________________________________
112 {
113  int iout=0,ievent=0;
115  m_PartID[0],m_PartPx[0],m_PartPy[0],m_PartPz[0],
117  LogDebug("ReggeGribovPartonMCInterface") << "event generated" << endl;
118 
119  const bool isHeavyIon = (m_TargetID + m_BeamID > 2);
120 
121  if(isHeavyIon)
122  conv.set_trust_beam_particles(false);
123 
125 
126  HepMC::GenEvent* evt = conv.read_next_event();
127 
128  evt->set_event_number(m_NEvent++);
129  int sig_id = -1;
130  switch (int(c2evt_.typevt)) // if negative typevt mini plasma was created by event (except -4)
131  {
132  case 0: break; //unknown for qgsjetII
133  case 1: sig_id = 101; break;
134  case -1: sig_id = 101; break;
135  case 2: sig_id = 105; break;
136  case -2: sig_id = 105; break;
137  case 3: sig_id = 102; break;
138  case -3: sig_id = 102; break;
139  case 4: sig_id = 103; break;
140  case -4: sig_id = 104; break;
141  default: LogDebug("ReggeGribovPartonMCInterface") << "Signal ID not recognised for setting HEPEVT" << endl;
142  }
143  evt->set_signal_process_id(sig_id); //an integer ID uniquely specifying the signal process (i.e. MSUB in Pythia)
144 
145 #ifdef HEPMC_HAS_CROSS_SECTION
146  // set cross section information for this event
147  HepMC::GenCrossSection theCrossSection;
148  theCrossSection.set_cross_section(double(hadr5_.sigineaa)*1e9); //required in pB
149  evt->set_cross_section(theCrossSection);
150 #endif
151 
152  if (isHeavyIon) //other than pp
153  {
154  HepMC::HeavyIon ion(cevt_.kohevt, // Number of hard scatterings
155  cevt_.npjevt, // Number of projectile participants
156  cevt_.ntgevt, // Number of target participants
157  cevt_.kolevt, // Number of NN (nucleon-nucleon) collisions
158  cevt_.npnevt + cevt_.ntnevt, // Number of spectator neutrons
159  cevt_.nppevt + cevt_.ntpevt, // Number of spectator protons
160  -1, // Number of N-Nwounded collisions
161  -1, // Number of Nwounded-N collisons
162  -1, // Number of Nwounded-Nwounded collisions
163  cevt_.bimevt, // Impact Parameter(fm) of collision
164  cevt_.phievt, // Azimuthal angle of event plane
165  c2evt_.fglevt, // eccentricity of participating nucleons
166  hadr5_.sigine*1e9); // nucleon-nucleon inelastic (in pB)
167  evt->set_heavy_ion(ion);
168  }
169 
170 
171  event().reset(evt);
172  //evt->print();
173  //EPOS::EPOS_Wrapper::print_hepcom();
174 
175  return true;
176 }
177 
178 //_____________________________________________________________________
180 {
181  return false;
182 }
183 
185 {
186  return true;
187 }
188 
190 {
191  return true;
192 }
193 
195  return;
196 }
197 
199  return;
200 }
201 
203 {
204  return "gen::ReggeGribovPartonMCHadronizer";
205 }
206 
208 {
209  return true;
210  }
211 
213 {
214  if (!m_IsInitialized) {
215  //use set parameters to init models
216  crmc_init_f_();
217  m_IsInitialized = true;
218  }
219  return true;
220 }
221 
223 {
224  //epos
225  string path_fnii(FileInPath("GeneratorInterface/ReggeGribovPartonMCInterface/data/epos.initl").fullPath());
226  string path_fnie(FileInPath("GeneratorInterface/ReggeGribovPartonMCInterface/data/epos.iniev").fullPath());
227  string path_fnrj(FileInPath("GeneratorInterface/ReggeGribovPartonMCInterface/data/epos.inirj").fullPath());
228  string path_fncs(FileInPath("GeneratorInterface/ReggeGribovPartonMCInterface/data/epos.inics").fullPath());
229 
230  if (path_fnii.length() >= 500) LogError("ReggeGribovPartonMCInterface") << "table path too long" << endl;
231  else nfname_.nfnii = path_fnii.length();
232  if (path_fnie.length() >= 500) LogError("ReggeGribovPartonMCInterface") << "table path too long" << endl;
233  else nfname_.nfnie = path_fnie.length();
234  if (path_fnrj.length() >= 500) LogError("ReggeGribovPartonMCInterface") << "table path too long" << endl;
235  else nfname_.nfnrj = path_fnrj.length();
236  if (path_fncs.length() >= 500) LogError("ReggeGribovPartonMCInterface") << "table path too long" << endl;
237  else nfname_.nfncs = path_fncs.length();
238 
239  strcpy(fname_.fnii, path_fnii.c_str());
240  strcpy(fname_.fnie, path_fnie.c_str());
241  strcpy(fname_.fnrj, path_fnrj.c_str());
242  strcpy(fname_.fncs, path_fncs.c_str());
243 
244  //qgsjet
245  string path_fndat(FileInPath("GeneratorInterface/ReggeGribovPartonMCInterface/data/qgsjet.dat").fullPath());
246  string path_fnncs(FileInPath("GeneratorInterface/ReggeGribovPartonMCInterface/data/qgsjet.ncs").fullPath());
247 
248  if (path_fndat.length() >= 500) LogError("ReggeGribovPartonMCInterface") << "table path too long" << endl;
249  else qgsnfname_.nfndat = path_fndat.length();
250  if (path_fnncs.length() >= 500) LogError("ReggeGribovPartonMCInterface") << "table path too long" << endl;
251  else qgsnfname_.nfnncs = path_fnncs.length();
252 
253  strcpy(qgsfname_.fndat, path_fndat.c_str());
254  strcpy(qgsfname_.fnncs, path_fnncs.c_str());
255 
256  qgsfname_.ifdat=1; //option to overwrite the normal path
257  qgsfname_.ifncs=2;
258 
259  //qgsjetII
260  string path_fniidat(FileInPath("GeneratorInterface/ReggeGribovPartonMCInterface/data/qgsdat-II-04.lzma").fullPath());
261  string path_fniincs(FileInPath("GeneratorInterface/ReggeGribovPartonMCInterface/data/sectnu-II-04").fullPath());
262 
263  if (path_fniidat.length() >= 500) LogError("ReggeGribovPartonMCInterface") << "table path too long" << endl;
264  else qgsiinfname_.nfniidat = path_fniidat.length();
265  if (path_fniincs.length() >= 500) LogError("ReggeGribovPartonMCInterface") << "table path too long" << endl;
266  else qgsiinfname_.nfniincs = path_fniincs.length();
267 
268  strcpy(qgsiifname_.fniidat, path_fniidat.c_str());
269  strcpy(qgsiifname_.fniincs, path_fniincs.c_str());
270 
271  qgsiifname_.ifiidat=1; //option to overwrite the normal path
272  qgsiifname_.ifiincs=2;
273 
274  return true;
275 }
#define LogDebug(id)
struct @601 qgsfname_
struct @604 qgsiinfname_
void set_skip_nuclear_fragments(bool b=true)
!!MODIFICATION
Definition: IO_EPOS.h:86
struct @596 cevt_
struct @602 qgsnfname_
struct @599 fname_
struct @600 nfname_
void crmc_f_(int &, int &, int &, double &, int &, double &, double &, double &, double &, double &, int &)
double v[5][pyjets_maxn]
std::auto_ptr< HepMC::GenEvent > & event()
bool declareStableParticles(const std::vector< int > &)
struct @595 hadr5_
void crmc_init_f_()
struct @597 c2evt_
void set_trust_beam_particles(bool b=true)
Definition: IO_EPOS.h:82
virtual void doSetRandomEngine(CLHEP::HepRandomEngine *v) override
double drangen_(int *)
static CLHEP::HepRandomEngine * reggeGribovRandomEngine
EPOS::IO_EPOS conv
struct @603 qgsiifname_
HLT enums.
double a
Definition: hdecay.h:121
struct @598 nucl2_
std::string fullPath() const
Definition: FileInPath.cc:184
void crmc_set_f_(int &, int &, double &, double &, int &, int &, int &, int &, int &, const char *, const char *)