The Gaudi Framework  v41r0 (bdbe7744)
Loading...
Searching...
No Matches
Gaudi::Example::TinyExperiment::GeneratorAlg Class Reference

Generator algorithm returning a set of random tracks. More...

Inheritance diagram for Gaudi::Example::TinyExperiment::GeneratorAlg:
Collaboration diagram for Gaudi::Example::TinyExperiment::GeneratorAlg:

Public Member Functions

 GeneratorAlg (const std::string &name, ISvcLocator *pSvcLocator)
MCTracks operator() (EventContext const &ctx) const override

Private Attributes

ServiceHandle< IRandomGenSvc > m_rndSvc
Gaudi::Property< unsigned int > m_nbTracksToGenerate { this, "NbTracksToGenerate", 10 }
Gaudi::Accumulators::AveragingCounter m_thetas { this, "Theta values" }

Detailed Description

Generator algorithm returning a set of random tracks.

Definition at line 26 of file GeneratorAlg.cpp.

Constructor & Destructor Documentation

◆ GeneratorAlg()

Gaudi::Example::TinyExperiment::GeneratorAlg::GeneratorAlg ( const std::string & name,
ISvcLocator * pSvcLocator )
inline

Definition at line 28 of file GeneratorAlg.cpp.

29 : Transformer( name, pSvcLocator, { "MCTracksLocation", "/Event/MCTracks" } ) {}
details::Transformer< Signature, Traits_, details::isLegacy< Traits_ > > Transformer

Member Function Documentation

◆ operator()()

MCTracks Gaudi::Example::TinyExperiment::GeneratorAlg::operator() ( EventContext const & ctx) const
inlineoverride

Definition at line 31 of file GeneratorAlg.cpp.

31 {
32 MCTracks tracks;
33 tracks.reserve( m_nbTracksToGenerate );
34 std::normal_distribution dist( 0.0f, (float)M_PI / 4 ); // µ, σ
35 auto engine = m_rndSvc->getEngine( ctx.evt() );
36 for ( unsigned int i = 0; i < m_nbTracksToGenerate; i++ ) {
37 auto theta = dist( engine );
38 m_thetas += theta;
39 tracks.emplace_back( theta );
40 }
41 return tracks;
42 };
Gaudi::Property< unsigned int > m_nbTracksToGenerate
ServiceHandle< IRandomGenSvc > m_rndSvc
Gaudi::Accumulators::AveragingCounter m_thetas
std::vector< MCTrack > MCTracks
Definition MCTrack.h:28

Member Data Documentation

◆ m_nbTracksToGenerate

Gaudi::Property<unsigned int> Gaudi::Example::TinyExperiment::GeneratorAlg::m_nbTracksToGenerate { this, "NbTracksToGenerate", 10 }
private

Definition at line 47 of file GeneratorAlg.cpp.

47{ this, "NbTracksToGenerate", 10 };

◆ m_rndSvc

ServiceHandle<IRandomGenSvc> Gaudi::Example::TinyExperiment::GeneratorAlg::m_rndSvc
private
Initial value:
{ this, "RandomGenSvc", "RandomGenSvc",
"A service providing a thread safe random number generator" }

Definition at line 45 of file GeneratorAlg.cpp.

45 { this, "RandomGenSvc", "RandomGenSvc",
46 "A service providing a thread safe random number generator" };

◆ m_thetas

Gaudi::Accumulators::AveragingCounter Gaudi::Example::TinyExperiment::GeneratorAlg::m_thetas { this, "Theta values" }
mutableprivate

Definition at line 48 of file GeneratorAlg.cpp.

48{ this, "Theta values" };

The documentation for this class was generated from the following file: