17 #include "GaudiKernel/MsgStream.h"
18 #include "CLHEP/Random/RandFlat.h"
26 #include "CRMChepevt.h"
28 #include "CRMCinterface.h"
32 static std::string epos_rndm_stream =
"EPOS_INIT";
33 static CLHEP::HepRandomEngine* p_rndmEngine{};
38 return CLHEP::RandFlat::shoot(p_rndmEngine);
48 void crmc_set_f_(
int &
nEvents,
double &beamMomentum,
double &targetMomentum,
int &primaryParticle,
int &targetParticle);
51 void crmc_f_(
int &iout,
int &ievent,
int &nParticles,
double &impactParam,
int &partPdg,
52 double &partPx,
double &partPy,
double &partPz,
double &partEnergy,
double &partMass,
int &outstat );
55 void crmc_xsection_f_(
double &xsigtot,
double &xsigine,
double &xsigela,
double &xsigdd,
56 double &xsigsd,
double &xsloela,
double &xsigtotaa,
double &xsigineaa,
double &xsigelaaa);
64 epos_rndm_stream =
"EPOS_INIT";
103 ATH_MSG_INFO(
"signal_rocess_id 101-ND, 105-DD, 102-CD, 103 AB->XB, 104 AB->AX \n");
106 const long *sip = p_rndmEngine->getSeeds();
107 long int si1 = sip[0];
109 int iSeed = si1%1000000000;
116 epos_rndm_stream =
"EPOS";
120 return StatusCode::SUCCESS;
130 const EventContext& ctx = Gaudi::Hive::currentContext();
132 p_rndmEngine->setSeeds(seeds, 0);
135 const long *
s = p_rndmEngine->getSeeds();
144 double impactParameter = -1.0;
150 return StatusCode::SUCCESS;
158 std::cout <<
"MetaData: generator = Epos " << std::endl;
161 double xsigtot, xsigine, xsigela, xsigdd, xsigsd, xsloela, xsigtotaa, xsigineaa, xsigelaaa;
162 xsigtot = xsigine = xsigela = xsigdd = xsigsd = xsloela = xsigtotaa = xsigineaa = xsigelaaa = 0.0;
164 crmc_xsection_f_(xsigtot, xsigine, xsigela, xsigdd, xsigsd, xsloela, xsigtotaa, xsigineaa, xsigelaaa);
167 std::cout <<
"MetaData: cross-section (nb) = " << xsigtot << std::endl;
169 std::cout <<
"MetaData: cross-section inelastic (cut + projectile diffraction)[nb] = " << xsigine << std::endl;
171 std::cout <<
"MetaData: cross-section elastic (includes target diffraction)[nb] = " << xsigela << std::endl;
173 std::cout <<
"MetaData: cross-section dd (nb) = " << xsigdd << std::endl;
175 std::cout <<
"MetaData: cross-section sd (nb) = " << xsigsd << std::endl;
179 return StatusCode::SUCCESS;
185 CRMChepevt<HepMC::GenParticlePtr, HepMC::GenVertexPtr, HepMC::FourVector, HepMC::GenEvent> hepevtconverter;
187 hepevtconverter.convert(*
evt);
191 evt->weights().push_back(1.0);
192 m_runinfo = std::make_shared<HepMC3::GenRunInfo>();
193 std::vector<std::string>
names = {
"Default"};
194 m_runinfo->set_weight_names(
names);
195 evt->set_run_info(m_runinfo);
198 hepevtconverter.convert();
201 for (
auto&
v: hepevtconverter.vertices())
evt->add_vertex(
v);
202 if (hepevtconverter.beams().size() == 2)
evt->set_beam_particles(hepevtconverter.beams()[0],hepevtconverter.beams()[1]);
203 if (hepevtconverter.beams().size() == 1)
evt->set_beam_particles(hepevtconverter.beams()[0],
nullptr);
206 evt->weights().push_back(1.0);
210 std::vector<HepMC::GenParticlePtr> beams;
213 if (
p->status() == 4) {
218 if (beams.size() >= 2) {
219 evt->set_beam_particles(beams[0], beams[1]);
221 ATH_MSG_INFO(
"EPOS event has only " << beams.size() <<
" beam particles" );
227 HepMC::GenHeavyIonPtr ion= std::make_shared<HepMC::GenHeavyIon>();
228 ion->Ncoll_hard=cevt_.kohevt;
229 ion->Npart_proj=cevt_.npjevt;
230 ion->Npart_targ=cevt_.ntgevt;
231 ion->Ncoll=cevt_.kolevt;
232 ion->spectator_neutrons=cevt_.npnevt + cevt_.ntnevt;
233 ion->spectator_protons=cevt_.nppevt + cevt_.ntpevt;
234 ion->N_Nwounded_collisions=-1;
235 ion->Nwounded_N_collisions=-1;
236 ion->Nwounded_Nwounded_collisions=-1;
237 ion->impact_parameter= cevt_.bimevt;
238 ion->event_plane_angle=cevt_.phievt;
239 ion->eccentricity=-1;
240 ion->sigma_inel_NN=1e9*hadr5_.sigine;
242 HepMC::HeavyIon ion(cevt_.kohevt,
246 cevt_.npnevt + cevt_.ntnevt,
247 cevt_.nppevt + cevt_.ntpevt,
257 evt->set_heavy_ion(ion);
262 switch (
int(c2evt_.typevt))
264 case 1: sig_id = 101;
break;
265 case -1: sig_id = 101;
break;
266 case 2: sig_id = 105;
break;
267 case -2: sig_id = 105;
break;
268 case 3: sig_id = 102;
break;
269 case -3: sig_id = 102;
break;
270 case 4: sig_id = 103;
break;
271 case -4: sig_id = 104;
break;
272 default:
ATH_MSG_INFO(
"Signal ID not recognised for setting HEPEVT \n");
277 double xsigtot, xsigine, xsigela, xsigdd, xsigsd, xsloela, xsigtotaa, xsigineaa, xsigelaaa;
278 xsigtot = xsigine = xsigela = xsigdd = xsigsd = xsloela = xsigtotaa = xsigineaa = xsigelaaa = 0.0;
279 crmc_xsection_f_(xsigtot, xsigine, xsigela, xsigdd, xsigsd, xsloela, xsigtotaa, xsigineaa, xsigelaaa);
282 std::shared_ptr<HepMC3::GenCrossSection>
xsec = std::make_shared<HepMC3::GenCrossSection>();
283 xsec->set_cross_section(xsigine, 0.0);
285 HepMC::GenCrossSection
xsec;
286 xsec.set_cross_section(xsigine, 0.0);
290 return StatusCode::SUCCESS;