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 float gen::rangen_() {
48  float a = float(reggeGribovRandomEngine->flat());
49  return a;
50 }
51 
52 double gen::drangen_(int* idummy) {
53  double a = reggeGribovRandomEngine->flat();
54  return a;
55 }
56 }
57 
58 ReggeGribovPartonMCHadronizer::ReggeGribovPartonMCHadronizer(const ParameterSet& pset)
60  pset_(pset),
61  m_BeamMomentum(pset.getParameter<double>("beammomentum")),
62  m_TargetMomentum(pset.getParameter<double>("targetmomentum")),
63  m_BeamID(pset.getParameter<int>("beamid")),
64  m_TargetID(pset.getParameter<int>("targetid")),
65  m_HEModel(pset.getParameter<int>("model")),
66  m_bMin(pset.getParameter<double>("bmin")),
67  m_bMax(pset.getParameter<double>("bmax")),
68  m_ParamFileName(pset.getUntrackedParameter<string>("paramFileName")),
69  m_SkipNuclFrag(pset.getParameter<bool>("skipNuclFrag")),
70  m_NEvent(0),
71  m_NParticles(0),
72  m_ImpactParameter(0.),
73  m_IsInitialized(false) {
74  int nevet = 1; //needed for CS
75  int noTables = 0; //don't calculate tables
76  int LHEoutput = 0; //no lhe
77  int dummySeed = 123;
78  char dummyName[] = "dummy";
79  crmc_set_f_(nevet,
80  dummySeed,
83  m_BeamID,
84  m_TargetID,
85  m_HEModel,
86  noTables,
87  LHEoutput,
88  dummyName,
89  m_ParamFileName.fullPath().c_str());
90 
91  //additionally initialise tables
93 
94  //change impact paramter
95  nucl2_.bminim = float(m_bMin);
96  nucl2_.bmaxim = float(m_bMax);
97 }
98 
99 //_____________________________________________________________________
101  // destructor
102 }
103 
104 //_____________________________________________________________________
106 
107 //_____________________________________________________________________
109  int iout = 0, ievent = 0;
110  crmc_f_(iout,
111  ievent,
112  m_NParticles,
114  m_PartID[0],
115  m_PartPx[0],
116  m_PartPy[0],
117  m_PartPz[0],
118  m_PartEnergy[0],
119  m_PartMass[0],
120  m_PartStatus[0]);
121  LogDebug("ReggeGribovPartonMCInterface") << "event generated" << endl;
122 
123  const bool isHeavyIon = (m_TargetID + m_BeamID > 2);
124 
125  if (isHeavyIon)
127 
129 
130  HepMC::GenEvent* evt = conv.read_next_event();
131 
132  evt->set_event_number(m_NEvent++);
133  int sig_id = -1;
134  switch (int(c2evt_.typevt)) // if negative typevt mini plasma was created by event (except -4)
135  {
136  case 0:
137  break; //unknown for qgsjetII
138  case 1:
139  sig_id = 101;
140  break;
141  case -1:
142  sig_id = 101;
143  break;
144  case 2:
145  sig_id = 105;
146  break;
147  case -2:
148  sig_id = 105;
149  break;
150  case 3:
151  sig_id = 102;
152  break;
153  case -3:
154  sig_id = 102;
155  break;
156  case 4:
157  sig_id = 103;
158  break;
159  case -4:
160  sig_id = 104;
161  break;
162  default:
163  LogDebug("ReggeGribovPartonMCInterface") << "Signal ID not recognised for setting HEPEVT" << endl;
164  }
165  evt->set_signal_process_id(sig_id); //an integer ID uniquely specifying the signal process (i.e. MSUB in Pythia)
166 
167 #ifdef HEPMC_HAS_CROSS_SECTION
168  // set cross section information for this event
169  HepMC::GenCrossSection theCrossSection;
170  theCrossSection.set_cross_section(double(hadr5_.sigineaa) * 1e9); //required in pB
171  evt->set_cross_section(theCrossSection);
172 #endif
173 
174  if (isHeavyIon) //other than pp
175  {
176  HepMC::HeavyIon ion(cevt_.kohevt, // Number of hard scatterings
177  cevt_.npjevt, // Number of projectile participants
178  cevt_.ntgevt, // Number of target participants
179  cevt_.kolevt, // Number of NN (nucleon-nucleon) collisions
180  cevt_.npnevt + cevt_.ntnevt, // Number of spectator neutrons
181  cevt_.nppevt + cevt_.ntpevt, // Number of spectator protons
182  -1, // Number of N-Nwounded collisions
183  -1, // Number of Nwounded-N collisons
184  -1, // Number of Nwounded-Nwounded collisions
185  cevt_.bimevt, // Impact Parameter(fm) of collision
186  cevt_.phievt, // Azimuthal angle of event plane
187  c2evt_.fglevt, // eccentricity of participating nucleons
188  hadr5_.sigine * 1e9); // nucleon-nucleon inelastic (in pB)
189  evt->set_heavy_ion(ion);
190  }
191 
192  event().reset(evt);
193  //evt->print();
194  //EPOS::EPOS_Wrapper::print_hepcom();
195 
196  return true;
197 }
198 
199 //_____________________________________________________________________
201 
203 
205 
207 
209 
210 const char* ReggeGribovPartonMCHadronizer::classname() const { return "gen::ReggeGribovPartonMCHadronizer"; }
211 
212 bool ReggeGribovPartonMCHadronizer::declareStableParticles(const std::vector<int>&) { return true; }
213 
215  if (!m_IsInitialized) {
216  //use set parameters to init models
217  crmc_init_f_();
218  m_IsInitialized = true;
219  }
220  return true;
221 }
222 
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)
231  LogError("ReggeGribovPartonMCInterface") << "table path too long" << endl;
232  else
233  nfname_.nfnii = path_fnii.length();
234  if (path_fnie.length() >= 500)
235  LogError("ReggeGribovPartonMCInterface") << "table path too long" << endl;
236  else
237  nfname_.nfnie = path_fnie.length();
238  if (path_fnrj.length() >= 500)
239  LogError("ReggeGribovPartonMCInterface") << "table path too long" << endl;
240  else
241  nfname_.nfnrj = path_fnrj.length();
242  if (path_fncs.length() >= 500)
243  LogError("ReggeGribovPartonMCInterface") << "table path too long" << endl;
244  else
245  nfname_.nfncs = path_fncs.length();
246 
247  strcpy(fname_.fnii, path_fnii.c_str());
248  strcpy(fname_.fnie, path_fnie.c_str());
249  strcpy(fname_.fnrj, path_fnrj.c_str());
250  strcpy(fname_.fncs, path_fncs.c_str());
251 
252  //qgsjet
253  string path_fndat(FileInPath("GeneratorInterface/ReggeGribovPartonMCInterface/data/qgsjet.dat").fullPath());
254  string path_fnncs(FileInPath("GeneratorInterface/ReggeGribovPartonMCInterface/data/qgsjet.ncs").fullPath());
255 
256  if (path_fndat.length() >= 500)
257  LogError("ReggeGribovPartonMCInterface") << "table path too long" << endl;
258  else
259  qgsnfname_.nfndat = path_fndat.length();
260  if (path_fnncs.length() >= 500)
261  LogError("ReggeGribovPartonMCInterface") << "table path too long" << endl;
262  else
263  qgsnfname_.nfnncs = path_fnncs.length();
264 
265  strcpy(qgsfname_.fndat, path_fndat.c_str());
266  strcpy(qgsfname_.fnncs, path_fnncs.c_str());
267 
268  qgsfname_.ifdat = 1; //option to overwrite the normal path
269  qgsfname_.ifncs = 2;
270 
271  //qgsjetII
272  string path_fniidat(FileInPath("GeneratorInterface/ReggeGribovPartonMCInterface/data/qgsdat-II-04.lzma").fullPath());
273  string path_fniincs(FileInPath("GeneratorInterface/ReggeGribovPartonMCInterface/data/sectnu-II-04").fullPath());
274 
275  if (path_fniidat.length() >= 500)
276  LogError("ReggeGribovPartonMCInterface") << "table path too long" << endl;
277  else
278  qgsiinfname_.nfniidat = path_fniidat.length();
279  if (path_fniincs.length() >= 500)
280  LogError("ReggeGribovPartonMCInterface") << "table path too long" << endl;
281  else
282  qgsiinfname_.nfniincs = path_fniincs.length();
283 
284  strcpy(qgsiifname_.fniidat, path_fniidat.c_str());
285  strcpy(qgsiifname_.fniincs, path_fniincs.c_str());
286 
287  qgsiifname_.ifiidat = 1; //option to overwrite the normal path
288  qgsiifname_.ifiincs = 2;
289 
290  return true;
291 }
electrons_cff.bool
bool
Definition: electrons_cff.py:393
gen::ReggeGribovPartonMCHadronizer::m_PartPz
double m_PartPz[99990]
Definition: ReggeGribovPartonMCHadronizer.h:220
gen::ReggeGribovPartonMCHadronizer::m_PartID
int m_PartID[99990]
Definition: ReggeGribovPartonMCHadronizer.h:217
MessageLogger.h
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
funct::false
false
Definition: Factorize.h:29
gen::ReggeGribovPartonMCHadronizer::statistics
void statistics()
Definition: ReggeGribovPartonMCHadronizer.cc:208
crmc_f_
void crmc_f_(int &, int &, int &, double &, int &, double &, double &, double &, double &, double &, int &)
qgsiifname_
struct @750 qgsiifname_
EDProducer.h
reggeGribovRandomEngine
static CLHEP::HepRandomEngine * reggeGribovRandomEngine
Definition: ReggeGribovPartonMCHadronizer.cc:44
gen::ReggeGribovPartonMCHadronizer::m_bMax
double m_bMax
Definition: ReggeGribovPartonMCHadronizer.h:210
gen::ReggeGribovPartonMCHadronizer::m_ImpactParameter
double m_ImpactParameter
Definition: ReggeGribovPartonMCHadronizer.h:216
ESHandle.h
crmc_init_f_
void crmc_init_f_()
gen::drangen_
double drangen_(int *)
Definition: ReggeGribovPartonMCHadronizer.cc:52
gen::ReggeGribovPartonMCHadronizer::m_PartPx
double m_PartPx[99990]
Definition: ReggeGribovPartonMCHadronizer.h:218
contentValuesFiles.fullPath
fullPath
Definition: contentValuesFiles.py:64
edm
HLT enums.
Definition: AlignableModifier.h:19
gen::ReggeGribovPartonMCHadronizer::m_NEvent
int m_NEvent
Definition: ReggeGribovPartonMCHadronizer.h:213
gen::ReggeGribovPartonMCHadronizer::initializeTablePaths
bool initializeTablePaths()
Definition: ReggeGribovPartonMCHadronizer.cc:223
gen::ReggeGribovPartonMCHadronizer::declareStableParticles
bool declareStableParticles(const std::vector< int > &)
Definition: ReggeGribovPartonMCHadronizer.cc:212
gen::ReggeGribovPartonMCHadronizer::m_SkipNuclFrag
bool m_SkipNuclFrag
Definition: ReggeGribovPartonMCHadronizer.h:212
qgsnfname_
struct @749 qgsnfname_
EPOS::IO_EPOS::set_skip_nuclear_fragments
void set_skip_nuclear_fragments(bool b=true)
!!MODIFICATION
Definition: IO_EPOS.h:74
gen::BaseHadronizer
Definition: BaseHadronizer.h:46
GenRunInfoProduct.h
gen::ReggeGribovPartonMCHadronizer::finalizeEvent
void finalizeEvent()
Definition: ReggeGribovPartonMCHadronizer.cc:206
crmc_set_f_
void crmc_set_f_(int &, int &, double &, double &, int &, int &, int &, int &, int &, const char *, const char *)
HepMC::GenEvent
Definition: hepmc_rootio.cc:9
gen::ReggeGribovPartonMCHadronizer::m_ParamFileName
edm::FileInPath m_ParamFileName
Definition: ReggeGribovPartonMCHadronizer.h:211
gen::ReggeGribovPartonMCHadronizer::hadronize
bool hadronize()
Definition: ReggeGribovPartonMCHadronizer.cc:200
edm::FileInPath
Definition: FileInPath.h:64
MakerMacros.h
gen::ReggeGribovPartonMCHadronizer::~ReggeGribovPartonMCHadronizer
~ReggeGribovPartonMCHadronizer() override
Definition: ReggeGribovPartonMCHadronizer.cc:100
hadr5_
struct @742 hadr5_
Run.h
gen::ReggeGribovPartonMCHadronizer::m_NParticles
int m_NParticles
Definition: ReggeGribovPartonMCHadronizer.h:215
gen::ReggeGribovPartonMCHadronizer::m_PartEnergy
double m_PartEnergy[99990]
Definition: ReggeGribovPartonMCHadronizer.h:221
EPOS_Wrapper.h
gen::rangen_
float rangen_()
Definition: ReggeGribovPartonMCHadronizer.cc:47
gen
Definition: PythiaDecays.h:13
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
gen::ReggeGribovPartonMCHadronizer::doSetRandomEngine
void doSetRandomEngine(CLHEP::HepRandomEngine *v) override
Definition: ReggeGribovPartonMCHadronizer.cc:105
hcal_dqm_sourceclient-live_cfg.isHeavyIon
isHeavyIon
Definition: hcal_dqm_sourceclient-live_cfg.py:88
qgsiinfname_
struct @751 qgsiinfname_
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:223
edm::ParameterSet
Definition: ParameterSet.h:47
a
double a
Definition: hdecay.h:119
GenEventInfoProduct.h
nucl2_
struct @745 nucl2_
Event.h
gen::ReggeGribovPartonMCHadronizer::m_PartMass
double m_PartMass[99990]
Definition: ReggeGribovPartonMCHadronizer.h:222
gen::v
double v[5][pyjets_maxn]
Definition: Cascade2Hadronizer.cc:76
EPOS::IO_EPOS
Definition: IO_EPOS.h:20
createfilelist.int
int
Definition: createfilelist.py:10
gen::ReggeGribovPartonMCHadronizer::residualDecay
bool residualDecay()
Definition: ReggeGribovPartonMCHadronizer.cc:204
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
fname_
struct @746 fname_
gen::ReggeGribovPartonMCHadronizer::m_bMin
double m_bMin
Definition: ReggeGribovPartonMCHadronizer.h:209
nfname_
struct @747 nfname_
cevt_
struct @743 cevt_
gen::ReggeGribovPartonMCHadronizer::decay
bool decay()
Definition: ReggeGribovPartonMCHadronizer.cc:202
qgsfname_
struct @748 qgsfname_
gen::ReggeGribovPartonMCHadronizer::initializeForInternalPartons
bool initializeForInternalPartons()
Definition: ReggeGribovPartonMCHadronizer.cc:214
IO_EPOS.h
gen::ReggeGribovPartonMCHadronizer::m_TargetMomentum
double m_TargetMomentum
Definition: ReggeGribovPartonMCHadronizer.h:205
ReggeGribovPartonMCHadronizer.h
std
Definition: JetResolutionObject.h:76
gen::BaseHadronizer::event
std::unique_ptr< HepMC::GenEvent > & event()
Definition: BaseHadronizer.h:86
gen::ReggeGribovPartonMCHadronizer::generatePartonsAndHadronize
bool generatePartonsAndHadronize()
Definition: ReggeGribovPartonMCHadronizer.cc:108
Frameworkfwd.h
EPOS::IO_EPOS::set_trust_beam_particles
void set_trust_beam_particles(bool b=true)
Definition: IO_EPOS.h:71
gen::ReggeGribovPartonMCHadronizer::m_BeamMomentum
double m_BeamMomentum
Definition: ReggeGribovPartonMCHadronizer.h:204
ParameterSet.h
c2evt_
struct @744 c2evt_
gen::ReggeGribovPartonMCHadronizer::m_HEModel
int m_HEModel
Definition: ReggeGribovPartonMCHadronizer.h:208
HepMCProduct.h
gen::ReggeGribovPartonMCHadronizer::classname
const char * classname() const
Definition: ReggeGribovPartonMCHadronizer.cc:210
gen::ReggeGribovPartonMCHadronizer::m_PartPy
double m_PartPy[99990]
Definition: ReggeGribovPartonMCHadronizer.h:219
gen::ReggeGribovPartonMCHadronizer::m_IsInitialized
bool m_IsInitialized
Definition: ReggeGribovPartonMCHadronizer.h:225
edm::FileInPath::fullPath
std::string fullPath() const
Definition: FileInPath.cc:163
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
gen::ReggeGribovPartonMCHadronizer::m_TargetID
int m_TargetID
Definition: ReggeGribovPartonMCHadronizer.h:207
gen::ReggeGribovPartonMCHadronizer::m_BeamID
int m_BeamID
Definition: ReggeGribovPartonMCHadronizer.h:206
conv
EPOS::IO_EPOS conv
Definition: ReggeGribovPartonMCHadronizer.cc:42
gen::ReggeGribovPartonMCHadronizer::m_PartStatus
int m_PartStatus[99990]
Definition: ReggeGribovPartonMCHadronizer.h:223