43 StatusCode sc = s->registerObject( path, pObj );
44 if ( sc.
isFailure() ) { error() <<
"Unable to register object " << path << endmsg; }
55 error() <<
"Unable to retrieve run records service" <<
endmsg;
81 static int evtnum = 0;
82 static int runnum = 999;
91 evt->setEvent( ++evtnum );
92 evt->setRun( runnum );
93 evt->setTime(
Gaudi::Time( 1577836800 + evtnum, evtnum * 1
e6 ) );
97 error() <<
"Unable to register Event Header" <<
endmsg;
107 error() <<
"Unable to register Collision 0" <<
endmsg;
110 sc =
put(
eventSvc(),
"/Event/Collision_1", coll1 );
112 sc =
put(
eventSvc(),
"/Event/Collision_2", coll2 );
115 evt->addCollision( coll0 );
116 evt->addCollision( coll1 );
117 evt->addCollision( coll2 );
120 int n = (int)( rndmflat() * 100. );
122 for (
int i = 0; i < n; i++ ) {
124 double c = rndmgauss();
125 double b = rndmgauss();
126 double a = rndmgauss();
127 MyTrack* track =
new MyTrack(
float( a ),
float( b ),
float( c ) );
136 myTracks->
insert( track );
140 int m = (int)( rndmflat() * 100. ) + 1;
142 for (
int j = 0; j < m; j++ ) {
144 double c = rndmgauss();
145 double b = rndmgauss();
146 double a = rndmgauss();
147 MyVertex* vtx =
new MyVertex(
float( a ) / 100.0F,
float( b ) / 100.0F,
float( c ) / 100.0F );
161 myVertices->
insert( vtx );
165 int org = (int)( rndmflat() *
double( m ) );
167 ( *k )->setOriginVertex( orgVtx );
168 int dec1 = (int)( rndmflat() *
double( m ) );
169 int dec2 = (int)( rndmflat() *
double( m ) );
171 dec1 = ( tmp < dec2 ) ? tmp : dec2;
172 dec2 = ( tmp > dec2 ) ? tmp : dec2;
173 for (
int l = dec1; l < dec2; ++l ) {
175 ( *k )->addDecayVertex( decVtx );
180 sc =
put(
eventSvc(),
"/Event/MyTracks", myTracks );
182 sc =
put(
eventSvc(),
"/Event/Collision_0/MyVertices", myVertices );
HepRndm::Engine< HepJamesRandom > e6
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
#define DECLARE_COMPONENT(type)
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
A DataObject is the base class of any identifiable object on any data store.
SmartIF< IDataProviderSvc > & eventSvc() const
The standard event data service.
StatusCode initialize() override
the default (empty) implementation of IStateful::initialize() method
StatusCode finalize() override
the default (empty) implementation of IStateful::finalize() method
SmartIF< IRndmGenSvc > & randSvc() const
The standard RandomGen service, Return a pointer to the service if present.
SmartIF< IService > service(std::string_view name, const bool createIf=true, const bool quiet=false) const
Return a pointer to the service identified by name (or "type/name")
void set(int val)
Set value.
Essential information of the event used in examples It can be identified by "/Event".
void setEvent(Event *evt)
Access to event object.
Simple class that represents a vertex for testing purposes.
void setEvent(Event *evt)
Access to event object.
void addCollision(Collision *vtx)
Add collision.
void setMotherParticle(MyTrack *mother)
Set mother track.
Data provider interface definition.
StatusCode registerObject(std::string_view fullPath, DataObject *pObject)
Register object with the data store.
iterator begin()
Retrieve start iterator.
iterator end()
Retrieve terminating iterator.
const key_type & insert(const value_type val, const key_type &kval)
Insert entry to the container with a valid key.
seq_type::iterator iterator
Parameters for the flat random number generation within boundaries [minimum, maximum].
Parameters for the Gauss random number generation.
Random number accessor This small class encapsulates the use of the random number generator.
This class is used for returning status codes from appropriate routines.
constexpr static const auto SUCCESS
constexpr static const auto FAILURE
WriteAlg class for the RootIOExample.
StatusCode put(IDataProviderSvc *s, const std::string &path, DataObject *pObj)
Register data leaf.
StatusCode initialize() override
Initialize.
Gaudi::TestSuite::Counter * m_evtCount
Reference to event counter.
SmartIF< IDataProviderSvc > m_recordSvc
Reference to run records data service.
StatusCode finalize() override
Finalize.
StatusCode execute() override
Event callback.
WriteAlg(const std::string &name, ISvcLocator *pSvcLocator)
Constructor: A constructor of this form must be provided.
KeyedContainer< MyTrack > MyTrackVector
KeyedContainer< MyVertex > MyVertexVector