|
ATLAS Offline Software
|
Go to the documentation of this file.
15 #include "CLHEP/Random/RandPoisson.h"
24 m_htgPileupProfile(NULL),
26 m_htgPileupEvents(NULL),
40 ATH_MSG_INFO(
"In MultiParticleGunPileup::genInitialize" );
49 m_htgPileupProfile =
new TH1D(
"pileupProfile",
"input pileupProfile", 100, 0., 100. );
50 m_htgPileupMu =
new TH1D(
"generatedMu",
"generated pileup mu", 100, 0., 100. );
51 m_htgPileupEvents =
new TH1D(
"generatedEvents",
"generated pileup events", 100, 0., 100. );
66 ATH_MSG_INFO(
"Generate varying minbias collisions per event according to given pileup profile");
72 for (std::vector<float>::const_iterator itr=
m_multbcid.begin();
74 ATH_MSG_INFO(
"Bunch crossing BCID " << ibc <<
" mu multiplier " << *itr);
81 return StatusCode::SUCCESS;
86 const EventContext& ctx = Gaudi::Hive::currentContext();
87 CLHEP::HepRandomEngine* rndmEngine = this->
getRandomEngine(
"ParticleGun", ctx);
97 for (std::vector<float>::const_iterator bcitr=
m_multbcid.begin();
101 const int nevtraw=CLHEP::RandPoisson::shoot(muval);
103 const int nevt=(
float)nevtraw*(*bcitr);
105 for (
int ievt=0;ievt<nevt;++ievt) {
106 ATH_MSG_DEBUG(
"Request generation of event " << ievt <<
" of " << nevt
107 <<
" for BCID " <<
bcid);
110 HepMC::GenEvent*
evt=
new HepMC::GenEvent();
111 evt->weights().push_back(1.0);
117 std::cout << ievt <<
" DEBUG0," <<
p.m_pid <<
", " <<
p.m_mom.E()<<
", " <<
p.m_mom.Pt()<<
", " <<
p.m_mom.M() << std::endl;
118 std::cout << ievt <<
" DEBUG1 (px,py,pz,E) = (" <<
p.m_mom.Px()<<
", " <<
p.m_mom.Py()<<
", " <<
p.m_mom.Pz()<<
", " <<
p.m_mom.E() <<
")" << std::endl;
119 std::cout << ievt <<
" DEBUG2 (eta,phi,pt,m) = ()" <<
p.m_mom.Eta()<<
", " <<
p.m_mom.Phi()<<
", " <<
p.m_mom.Pt()<<
", " <<
p.m_mom.M() <<
")" << std::endl;
120 std::cout << ievt <<
" DEBUG3 (x,y,z,t) = ()" <<
p.m_pos.X()<<
", " <<
p.m_pos.Y()<<
", " <<
p.m_pos.Z()<<
", " <<
p.m_pos.T() <<
")" << std::endl;
123 HepMC::FourVector
pos(
p.m_pos.X(),
p.m_pos.Y(),
p.m_pos.Z(),
p.m_pos.T());
127 HepMC::FourVector
mom(
p.m_mom.Px(),
p.m_mom.Py(),
p.m_mom.Pz(),
p.m_mom.E());
130 gp->set_pdg_id(
p.m_pid);
131 gp->set_momentum(
mom);
133 gp->set_generated_mass(
p.m_mass);
134 gv->add_particle_out(gp);
149 " pileup events in buffer");
150 return StatusCode::SUCCESS;
157 for (
int i=1;
i<nbuf;++
i) {
167 return StatusCode::SUCCESS;
179 return StatusCode::SUCCESS;
HepMC::GenVertex * GenVertexPtr
JetConstituentVector::iterator iterator
virtual StatusCode fillEvt(HepMC::GenEvent *event)
For filling the HepMC event object.
virtual StatusCode genInitialize()
For initializing the generator, if required.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
int signal_process_id(const GenEvent &e)
virtual StatusCode callGenerator()
For calling the generator on each iteration of the event loop.
bool accumulate(AccumulateMap &map, std::vector< module_t > const &modules, FPGATrackSimMatrixAccumulator const &acc)
Accumulates an accumulator (e.g.
GenParticle * GenParticlePtr
std::vector< HepMC::GenEvent * > m_evts
std::vector< double > m_pileupProfileIntegral
std::vector< float > m_multbcid
void fillBarcodesAttribute(GenEvent *)
int nPileupEvents(CLHEP::HepRandomEngine *rndmEngine)
CLHEP::HepRandomEngine * getRandomEngine(const std::string &streamName, const EventContext &ctx) const
std::unique_ptr< TFile > m_file
description: this is a custom writer for the old-school drivers that don't use an actual writer
Base class for common behaviour of generator interfaces.
MultiParticleGunPileup(const std::string &name, ISvcLocator *pSvcLocator)
GenVertexPtr newGenVertexPtr(const HepMC::FourVector &pos=HepMC::FourVector(0.0, 0.0, 0.0, 0.0), const int i=0)
::StatusCode StatusCode
StatusCode definition for legacy code.
~MultiParticleGunPileup()
std::vector< SampledParticle > shoot()
virtual StatusCode genFinalize()
For finalising the generator, if required.
setEventNumber setTimeStamp bcid
std::vector< int > m_pileupProfile
GenParticlePtr newGenParticlePtr(const HepMC::FourVector &mom=HepMC::FourVector(0.0, 0.0, 0.0, 0.0), int pid=0, int status=0)
TH1D * m_htgPileupProfile
void set_signal_process_id(GenEvent *e, const int i)
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space
ParticleSampler * m_partSampler