27#include "CLHEP/Vector/LorentzVector.h"
29#include "reportingUtils.h"
30#include "starlightconstants.h"
31#include "starlightparticlecodes.h"
39 static const std::string starlight_stream =
"STARLIGHT";
58 ATH_MSG_INFO(
"===> January 20 2011 STARLIGHT INTERFACE VERSION. \n" );
69 return StatusCode::FAILURE;
85 ATH_MSG_INFO(
"===> dumping starlight events to lhef format. \n" );
89 return StatusCode::SUCCESS;
99 const EventContext& ctx = Gaudi::Hive::currentContext();
115 int numberofTracks =
m_event->getParticles()->size();
116 int numberOfVertices = 1;
119 <<
" with " << numberOfVertices <<
" vertices "
120 <<
" and " << numberofTracks <<
" tracks" );
122 <<
" with " << numberofTracks <<
" tracks" );
125 std::vector<starlightParticle>::const_iterator part =
126 (
m_event->getParticles())->begin();
127 for (part =
m_event->getParticles()->begin();
128 part !=
m_event->getParticles()->end(); ++part, ++ipart) {
130 << starlightParticleCodes::jetsetToGeant((*part).getCharge() * (*part).getPdgCode()) <<
" "
131 << (*part).GetPx() <<
" " << (*part).GetPy() <<
" "<< (*part).GetPz()
132 <<
" " <<
m_events <<
" " << ipart <<
" " << 0 <<
" "
133 << (*part).getCharge() * (*part).getPdgCode() );
138 return StatusCode::SUCCESS;
146 return StatusCode::SUCCESS;
160 evt->add_vertex( v1 );
165 std::vector<starlightParticle>::const_iterator part =
166 (
m_event->getParticles())->begin();
170 for (part =
m_event->getParticles()->begin();
171 part !=
m_event->getParticles()->end(); ++part, ++ipart)
173 int pid = (*part).getPdgCode();
174 int charge = (*part).getCharge();
176 int pidsign = pid/std::abs(pid);
179 if( chsign != pidsign && chsign != 0) pid = -pid;
181 double px = (*part).GetPx();
182 double py = (*part).GetPy();
183 double pz = (*part).GetPz();
184 double e = (*part).GetE();
186 if(std::abs(pid)==13) {
188 e = std::sqrt(px*px + py*py + pz*pz + mass*mass);
191 if(std::abs(pid)==22) {
192 e = std::sqrt(px*px + py*py + pz*pz);
226 double e = sqrt(px_tot*px_tot + py_tot*py_tot + pz_tot*pz_tot + mass*mass);
227 v1->add_particle_out(
234 return StatusCode::SUCCESS;
241 std::string lheFilename =
"events.lhe";
242 std::ofstream lheStream;
243 lheStream.open(lheFilename.c_str(), std::ofstream::trunc);
249 lheStream <<
"<LesHouchesEvents version=\"1.0\">\n";
250 lheStream <<
"<!--\n";
251 lheStream <<
"File generated using Starlight \n";
252 lheStream <<
"-->\n";
254 float beam_energy=0.;
258 else beam_energy = 2.51e+03;
260 lheStream <<
"<init>\n";
261 lheStream <<
" 13 -13 "<<beam_energy<<
" "<<beam_energy<<
" 0 0 0 0 3 1\n";
262 lheStream <<
" 1.000000e+00 0.000000e+00 1.000000e+00 9999\n";
263 lheStream <<
"</init>\n";
266 std::unique_ptr<upcEvent> uevent(
new upcEvent);
269 lheStream <<
"<event>\n";
276 CLHEP::HepLorentzVector photon_system(0);
278 std::vector<starlightParticle>::const_iterator part = (uevent->getParticles())->begin();
279 for (part = uevent->getParticles()->begin(); part != uevent->getParticles()->end(); ++part, ++ipart)
281 CLHEP::HepLorentzVector particle_sl((*part).GetPx(), (*part).GetPy(), (*part).GetPz(), (*part).GetE());
282 photon_system += particle_sl;
283 ptscale += std::sqrt((*part).GetPx()*(*part).GetPx() + (*part).GetPy()*(*part).GetPy());
291 ptscale /=
static_cast<float> (ipart);
293 lheStream <<
" 4 9999 1.000000e+00 "<<ptscale<<
" 7.297e-03 2.569093e-01\n";
296 lheStream <<
" -11 -1 0 0 0 0 0.0000000000e+00 0.0000000000e+00 "
297 << photon_system.m()/2.*std::exp(photon_system.rapidity())<<
" "
298 <<photon_system.m()/2.*std::exp(photon_system.rapidity())
299 <<
" 0.0000000000e+00 0. 9.\n";
300 lheStream <<
" 11 -1 0 0 0 0 0.0000000000e+00 0.0000000000e+00 "
301 << -photon_system.m()/2.*std::exp(-photon_system.rapidity())<<
" "
302 <<photon_system.m()/2.*std::exp(-photon_system.rapidity())
303 <<
" 0.0000000000e+00 0. 9.\n";
307 lheStream <<
" 22 -1 0 0 0 0 0.0000000000e+00 0.0000000000e+00 "
308 << photon_system.m()/2.*std::exp(photon_system.rapidity())<<
" "
309 <<photon_system.m()/2.*std::exp(photon_system.rapidity())
310 <<
" 0.0000000000e+00 0. 9.\n";
311 lheStream <<
" 22 -1 0 0 0 0 0.0000000000e+00 0.0000000000e+00 "
312 << -photon_system.m()/2.*std::exp(-photon_system.rapidity())<<
" "
313 <<photon_system.m()/2.*std::exp(-photon_system.rapidity())
314 <<
" 0.0000000000e+00 0. 9.\n";
317 for (part = uevent->getParticles()->begin(); part != uevent->getParticles()->end(); ++part, ++ipart)
319 int pid = (*part).getPdgCode();
320 int charge = (*part).getCharge();
322 int pidsign = pid/std::abs(pid);
324 if( chsign != pidsign ) pid = -pid;
326 double px = (*part).GetPx();
327 double py = (*part).GetPy();
328 double pz = (*part).GetPz();
329 double e = (*part).GetE();
330 double mass = (*part).getMass();
335 lheStream << pid<<
" 1 1 2 0 0 "<<px<<
" "<<py<<
" "<<pz<<
" "<<e<<
" "<<mass<<
" 0. 9.\n";
338 lheStream <<
"</event>\n";
342 lheStream <<
"</LesHouchesEvents>";
358 "problems initializing input parameters. cannot initialize starlight.";
365 ATH_MSG_WARNING(
"problems initializing input parameters. cannot initialize starlight. " );
381 std::string myparam = mystring.
piece<std::string>(1);
382 if (myparam ==
"beam1Z")
386 else if (myparam ==
"beam1A")
390 else if (myparam ==
"beam2Z")
394 else if (myparam ==
"beam2A")
398 else if (myparam ==
"beam1Gamma")
402 else if (myparam ==
"beam2Gamma")
406 else if (myparam ==
"maxW")
410 else if (myparam ==
"minW")
414 else if (myparam ==
"nmbWBins")
418 else if (myparam ==
"maxRapidity")
422 else if (myparam ==
"nmbRapidityBins")
426 else if (myparam ==
"accCutPt")
430 else if (myparam ==
"minPt")
434 else if (myparam ==
"maxPt")
438 else if (myparam ==
"accCutEta")
442 else if (myparam ==
"minEta")
446 else if (myparam ==
"maxEta")
450 else if (myparam ==
"productionMode")
454 else if (myparam ==
"axionMass")
458 else if (myparam ==
"nmbEventsTot")
462 else if (myparam ==
"prodParticleId")
466 else if (myparam ==
"randomSeed")
470 else if (myparam ==
"outputFormat")
474 else if (myparam ==
"beamBreakupMode")
478 else if (myparam ==
"interferenceEnabled")
482 else if (myparam ==
"interferenceStrength")
486 else if (myparam ==
"coherentProduction")
490 else if (myparam ==
"incoherentFactor")
494 else if (myparam ==
"maxPtInterference")
498 else if (myparam ==
"nmbPtBinsInterference")
502 else if (myparam ==
"xsecMethod")
506 else if (myparam ==
"nThreads")
510 else if (myparam ==
"pythFullRec")
516 ATH_MSG_ERROR(
" ERROR in STARLIGHT INITIALIZATION PARAMETERS "
517 << myparam <<
" is an invalid parameter !" );
522 std::ofstream configFile;
525 configFile <<
"BEAM_1_Z = " <<
m_beam1Z << std::endl;
526 configFile <<
"BEAM_1_A = " <<
m_beam1A << std::endl;
527 configFile <<
"BEAM_2_Z = " <<
m_beam2Z << std::endl;
528 configFile <<
"BEAM_2_A = " <<
m_beam2A << std::endl;
529 configFile <<
"BEAM_1_GAMMA = " <<
m_beam1Gamma << std::endl;
530 configFile <<
"BEAM_2_GAMMA = " <<
m_beam2Gamma << std::endl;
531 configFile <<
"W_MAX = " <<
m_maxW << std::endl;
532 configFile <<
"W_MIN = " <<
m_minW << std::endl;
533 configFile <<
"W_N_BINS = " <<
m_nmbWBins << std::endl;
536 configFile <<
"CUT_PT = " <<
m_accCutPt << std::endl;
537 configFile <<
"PT_MIN = " <<
m_minPt << std::endl;
538 configFile <<
"PT_MAX = " <<
m_maxPt << std::endl;
539 configFile <<
"CUT_ETA = " <<
m_accCutEta << std::endl;
540 configFile <<
"ETA_MIN = " <<
m_minEta << std::endl;
541 configFile <<
"ETA_MAX = " <<
m_maxEta << std::endl;
543 configFile <<
"AXION_MASS = " <<
m_axionMass << std::endl;
546 configFile <<
"RND_SEED = " <<
m_randomSeed << std::endl;
554 configFile <<
"XSEC_METHOD = " <<
m_xsecMethod << std::endl;
555 configFile <<
"N_THREADS = " <<
m_nThreads << std::endl;
556 configFile <<
"PYTHIA_FULL_EVENTRECORD = " <<
m_pythFullRec << std::endl;
#define ATH_MSG_WARNING(x)
double charge(const T &p)
ATLAS-specific HepMC functions.
std::vector< std::string > CommandVector
std::pair< std::vector< unsigned int >, bool > res
GenModule(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
IntegerProperty m_randomSeed
Seed for random number engine.
double m_interferenceStrength
unsigned int m_nmbRapidityBins
int m_nmbPtBinsInterference
UnsignedIntegerProperty m_maxevents
virtual StatusCode fillEvt(HepMC::GenEvent *evt)
For filling the HepMC event object.
double m_incoherentFactor
BooleanProperty m_lheOutput
Starlight_i(const std::string &name, ISvcLocator *pSvcLocator)
StringArrayProperty m_InitializeVector
bool prepare_params_file()
BooleanProperty m_doTauolappLheFormat
unsigned int m_nmbEventsTot
virtual StatusCode callGenerator()
For calling the generator on each iteration of the event loop.
inputParameters m_inputParameters
virtual StatusCode genFinalize()
For finalising the generator, if required.
std::shared_ptr< randomGenerator > m_randomGenerator
StringProperty m_configFileName
bool m_coherentProduction
BooleanProperty m_suppressVMdecay
virtual StatusCode genInitialize()
For initializing the generator, if required.
bool m_interferenceEnabled
double m_maxPtInterference
Utility object for parsing a string into tokens and returning them as a variety of types.
T piece(size_t num) const
Templated function to get the num'th token as any numeric type.
void calculateSeedsMC21(long *seeds, const std::string &algName, uint64_t ev, uint64_t run, uint64_t offset=0)
Set the random seed using a string (e.g.
HepMC::GenVertex * GenVertexPtr
GenVertexPtr newGenVertexPtr(const HepMC::FourVector &pos=HepMC::FourVector(0.0, 0.0, 0.0, 0.0), const int i=0)
GenParticlePtr newGenParticlePtr(const HepMC::FourVector &mom=HepMC::FourVector(0.0, 0.0, 0.0, 0.0), int pid=0, int status=0)
void GeVToMeV(HepMC::GenEvent *evt)