The Gaudi Framework
master (57817a18)
Toggle main menu visibility
Loading...
Searching...
No Matches
Event.h
Go to the documentation of this file.
1
/***********************************************************************************\
2
* (c) Copyright 1998-2024 CERN for the benefit of the LHCb and ATLAS collaborations *
3
* *
4
* This software is distributed under the terms of the Apache version 2 licence, *
5
* copied verbatim in the file "LICENSE". *
6
* *
7
* In applying this licence, CERN does not waive the privileges and immunities *
8
* granted to it by virtue of its status as an Intergovernmental Organization *
9
* or submit itself to any jurisdiction. *
10
\***********************************************************************************/
11
#pragma once
12
13
#include <
GaudiKernel/DataObject.h
>
14
#include <
GaudiKernel/Kernel.h
>
15
#include <
GaudiKernel/SmartRefVector.h
>
16
#include <
GaudiKernel/StreamBuffer.h
>
17
#include <
GaudiKernel/Time.h
>
18
#include <iostream>
19
20
namespace
Gaudi
{
21
namespace
TestSuite
{
22
23
class
Collision
;
24
25
// CLID definition
26
static
const
CLID
& CLID_Event = 1110;
27
36
37
class
GAUDI_API
Event
:
public
DataObject
{
38
39
public
:
41
Event
();
42
44
const
CLID
&
clID
()
const override
{
return
classID
(); }
45
static
const
CLID
&
classID
() {
return
CLID_Event; }
46
48
int
event
()
const
{
return
m_event
; }
50
void
setEvent
(
int
value ) {
m_event
= value; }
51
53
int
run
()
const
{
return
m_run
; }
55
void
setRun
(
int
value ) {
m_run
= value; }
56
58
const
Gaudi::Time
&
time
()
const
{
return
m_time
; }
60
void
setTime
(
const
Gaudi::Time
& value ) {
m_time
= value; }
61
63
const
SmartRefVector<Collision>
& collisions()
const
;
64
66
void
addCollision(
Collision
* vtx );
67
69
void
removeCollision(
Collision
* vtx );
70
72
virtual
StreamBuffer
& serialize(
StreamBuffer
& s )
const
;
74
virtual
StreamBuffer
& serialize(
StreamBuffer
& s );
75
77
std::ostream& fillStream( std::ostream& s )
const override
;
78
79
private
:
81
int
m_event
{ 0 };
83
int
m_run
{ 0 };
85
Gaudi::Time
m_time
;
86
88
SmartRefVector<Collision>
m_collisions
;
89
};
90
}
// namespace TestSuite
91
}
// namespace Gaudi
92
93
#include "
Collision.h
"
94
95
namespace
Gaudi
{
96
namespace
TestSuite {
97
98
//
99
// Inline code must be outside the class definition
100
//
101
103
inline
StreamBuffer
&
Event::serialize
(
StreamBuffer
& s )
const
{
104
return
s <<
m_event
<<
m_run
<<
m_time
<<
m_collisions
(
this
);
105
}
106
108
inline
StreamBuffer
&
Event::serialize
(
StreamBuffer
& s ) {
109
return
s >>
m_event
>>
m_run
>>
m_time
>>
m_collisions
(
this
);
110
}
111
113
inline
std::ostream&
Event::fillStream
( std::ostream& s )
const
{
114
return
s <<
"class Event :"
115
<<
"\n Event number = "
<< std::setw( 12 ) <<
m_event
<<
"\n Run number = "
<< std::setw( 12 )
116
<<
m_run
<<
"\n Time = "
<<
m_time
;
117
}
118
120
inline
const
SmartRefVector<Collision>
&
Event::collisions
()
const
{
return
m_collisions
; }
121
123
inline
void
Event::addCollision
(
Collision
* c ) {
m_collisions
.push_back(
SmartRef<Collision>
( c ) ); }
124
126
inline
void
Event::removeCollision
(
Collision
* c ) {
127
for
(
auto
i =
m_collisions
.begin(); i !=
m_collisions
.end(); ++i ) {
128
if
( i->target() == c ) {
129
m_collisions
.erase( i );
130
return
;
131
}
132
}
133
}
134
136
inline
std::ostream&
operator<<
( std::ostream& s,
const
Event
& obj ) {
return
obj.
fillStream
( s ); }
137
}
// namespace TestSuite
138
}
// namespace Gaudi
CLID
unsigned int CLID
Class ID definition.
Definition
ClassID.h:16
Collision.h
DataObject.h
Kernel.h
GAUDI_API
#define GAUDI_API
Definition
Kernel.h:49
SmartRefVector.h
StreamBuffer.h
Time.h
DataObject::DataObject
DataObject()
Standard Constructor.
Definition
DataObject.cpp:23
Gaudi::TestSuite::Collision
Definition
Collision.h:26
Gaudi::TestSuite::Event
Essential information of the event used in examples It can be identified by "/Event".
Definition
Event.h:37
Gaudi::TestSuite::Event::addCollision
void addCollision(Collision *vtx)
Add collision.
Definition
Event.h:123
Gaudi::TestSuite::Event::m_run
int m_run
Run number.
Definition
Event.h:83
Gaudi::TestSuite::Event::setRun
void setRun(int value)
Update run number.
Definition
Event.h:55
Gaudi::TestSuite::Event::collisions
const SmartRefVector< Collision > & collisions() const
Access to collisions.
Definition
Event.h:120
Gaudi::TestSuite::Event::time
const Gaudi::Time & time() const
Retrieve reference to event time stamp.
Definition
Event.h:58
Gaudi::TestSuite::Event::setTime
void setTime(const Gaudi::Time &value)
Update reference to event time stamp.
Definition
Event.h:60
Gaudi::TestSuite::Event::m_time
Gaudi::Time m_time
Time stamp.
Definition
Event.h:85
Gaudi::TestSuite::Event::Event
Event()
Constructors.
Definition
Event.cpp:15
Gaudi::TestSuite::Event::m_collisions
SmartRefVector< Collision > m_collisions
Vector of collisions this object belongs to.
Definition
Event.h:88
Gaudi::TestSuite::Event::fillStream
std::ostream & fillStream(std::ostream &s) const override
Fill the output stream (ASCII).
Definition
Event.h:113
Gaudi::TestSuite::Event::clID
const CLID & clID() const override
Retrieve reference to class definition structure.
Definition
Event.h:44
Gaudi::TestSuite::Event::event
int event() const
Retrieve event number.
Definition
Event.h:48
Gaudi::TestSuite::Event::run
int run() const
Retrieve run number.
Definition
Event.h:53
Gaudi::TestSuite::Event::serialize
virtual StreamBuffer & serialize(StreamBuffer &s) const
Serialize the object for writing.
Definition
Event.h:103
Gaudi::TestSuite::Event::m_event
int m_event
Event number.
Definition
Event.h:81
Gaudi::TestSuite::Event::removeCollision
void removeCollision(Collision *vtx)
Remove collision.
Definition
Event.h:126
Gaudi::TestSuite::Event::setEvent
void setEvent(int value)
Update event number.
Definition
Event.h:50
Gaudi::TestSuite::Event::classID
static const CLID & classID()
Definition
Event.h:45
Gaudi::Time
Based on seal::Time.
Definition
Time.h:232
SmartRef
Kernel objects: SmartRef.
Definition
SmartRef.h:64
SmartRefVector
Kernel objects: SmartRefVector.
Definition
SmartRefVector.h:66
StreamBuffer
The stream buffer is a small object collecting object data.
Definition
StreamBuffer.h:48
Gaudi::TestSuite
Definition
ConditionAccessorHolder.h:21
Gaudi::TestSuite::operator<<
std::ostream & operator<<(std::ostream &s, const Event &obj)
Output operator (ASCII).
Definition
Event.h:136
Gaudi
This file provides a Grammar for the type Gaudi::Accumulators::Axis It allows to use that type from p...
Definition
__init__.py:1
GaudiTestSuite
include
GaudiTestSuite
Event.h
Generated on
for The Gaudi Framework by
1.17.0