10#include "GaudiKernel/MsgStream.h"
20 for (
int i=0;i<
NPLOTS;i++) {
28 ATH_MSG_INFO(
"Initialising this BeamHaloGeneratorAlg: " << name());
30 ATH_MSG_INFO(
"================ Generator Settings =================");
43 ATH_MSG_INFO(
"=====================================================");
64 const Int_t nbins_E = 60;
67 double logxmin = std::log10(
xmin);
68 double logxmax = std::log10(
xmax);
69 double binwidth = (logxmax-logxmin)/nbins_E;
70 Double_t xbins[nbins_E+1];
72 for (Int_t i=1;i<=nbins_E;i++) {
129 return StatusCode::FAILURE;
143 return StatusCode::SUCCESS;
150 const EventContext& ctx = Gaudi::Hive::currentContext();
164 auto weightContainer =
m_evt.weights();
165 if(weightContainer.size() != 5) {
166 ATH_MSG_WARNING(
"The number of weights for this event is not equal to 5.");
167 return StatusCode::SUCCESS;
169 double weight = weightContainer[0];
170 HepMC::FourVector primaryPosition(weightContainer[1],weightContainer[2],weightContainer[3],weightContainer[4]);
177 for (
auto hepmc_part:
m_evt) {
178 auto prodVertex = hepmc_part->production_vertex();
179 if(!prodVertex)
continue;
182 values[0] = prodVertex->position().perp()/1000.;
183 values[1] = hepmc_part->momentum().e()/1000.;
184 values[2] = hepmc_part->momentum().pz()/1000.;
185 values[3] = hepmc_part->momentum().perp()/1000.;
187 pdgId = hepmc_part->pdg_id();
if(pdgId<0) pdgId = -pdgId;
198 else if(pdgId == 13) {
207 return StatusCode::SUCCESS;
214 return StatusCode::SUCCESS;
221 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
bool msgLvl(const MSG::Level lvl) const
virtual StatusCode genInitialize()
For initializing the generator, if required.
BooleanProperty m_enableFlip
Flag for flipping event.
ServiceHandle< ITHistSvc > m_tHistSvc
A pointer to the THist service for validation plots.
DoubleProperty m_interfacePlane
The position of the interface plane in mm.
virtual StatusCode genFinalize()
For finalising the generator, if required.
StringProperty m_inputFile
Input file name.
BooleanProperty m_doMonitoringPlots
A flag to allow monitoring plots to be turned on or off.
StringProperty m_inputTypeStr
Input file type and therefore associated beam halo generator that should be used.
virtual StatusCode fillEvt(HepMC::GenEvent *evt)
Fill the GenEvent pointer with the contents of the GenEvent cache.
TH1F * m_validationPlots[NPLOTS]
An array of TH1F pointers for validation plots.
StringProperty m_bufferFileName
The name of the binary buffer file, needed for sampling from a converted file.
virtual StatusCode callGenerator()
Read one event from the selected input and convert it into GenEvent format.
FloatProperty m_flipProbability
Flip probability.
StringProperty m_randomStream
Name of the random number stream.
BeamHaloGenerator * m_beamHaloGenerator
A pointer to the beam halo generator.
StringArrayProperty m_generatorSettings
A vector of strings defining generator settings.
HepMC::GenEvent m_evt
An empty GenEvent to cache the generate output between callGenerator and fillEvt.
BooleanProperty m_enableSampling
Flag to enable or disable sampling.
BeamHaloGeneratorAlg(const std::string &name, ISvcLocator *svcLocator)
A class to provide conversion from a FLUKA format ASCII input record into HepMC format,...
const HepPDT::ParticleDataTable & particleTable() const
Get a particle data table.
GenModule(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
CLHEP::HepRandomEngine * getRandomEngine(const std::string &streamName, const EventContext &ctx) const
A class to provide conversion from a MARS format ASCII input record into HepMC format,...