ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
TestBeam
TBRec
src
TBEventInfoStreamerTool.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
TBEventInfoStreamerTool.h
"
6
#include "
TBEvent/TBEventInfo.h
"
7
8
#include <string>
9
#include <ios>
10
#include <algorithm>
11
12
TBEventInfoStreamerTool::TBEventInfoStreamerTool
(
const
std::string&
type
,
13
const
std::string& name,
14
const
IInterface* parent)
15
:
TBEventStreamerTool
(
type
,name,parent),
16
m_selected_events
(0)
17
{
18
declareInterface<TBEventStreamerTool>(
this
);
19
m_acceptTypes
.resize(1,
"Physics"
);
20
declareProperty
(
"AcceptedTypes"
,
m_acceptTypes
);
21
}
22
23
TBEventInfoStreamerTool::~TBEventInfoStreamerTool
()
24
{ }
25
27
// Initialize //
29
30
StatusCode
TBEventInfoStreamerTool::initializeTool
()
31
{
32
m_selected_events
= 0;
33
34
for
(
unsigned
int
i=0; i<
m_acceptTypes
.size(); i++ )
35
{
36
if
(
m_acceptTypes
[i] ==
"Physics"
)
37
{
38
m_acceptCodes
.push_back(1);
39
}
40
else
if
(
m_acceptTypes
[i] ==
"Special"
)
41
{
42
m_acceptCodes
.push_back(0);
43
}
44
else
if
(
m_acceptTypes
[i] ==
"f/e_Calibration"
)
45
{
46
m_acceptCodes
.push_back(2);
47
}
48
else
if
(
m_acceptTypes
[i] ==
"Random"
)
49
{
50
m_acceptCodes
.push_back(3);
51
}
52
else
if
(
m_acceptTypes
[i] ==
"BPC_Calibration"
)
53
{
54
m_acceptCodes
.push_back(4);
55
}
56
else
57
{
58
ATH_MSG_FATAL
(
"Detector event type not existing "
<<
m_acceptTypes
);
59
ATH_MSG_FATAL
(
"Possible types are: Special, Physics, f/e_calibration, Random, BPC_Calibration"
);
60
return
StatusCode::FAILURE;
61
}
62
63
}
64
65
if
(
m_acceptCodes
.size()==0) {
66
ATH_MSG_ERROR
(
"No detector event type specified! Please specify at least one in the JobOptions"
);
67
ATH_MSG_ERROR
(
"Possible types are: Special, Physics, f/e_Calibration, Random, BPC_Calibration"
);
68
}
69
else
{
70
for
(
unsigned
int
i=0; i<
m_acceptCodes
.size(); i++ )
71
{
72
ATH_MSG_DEBUG
(
"Detector event code found "
<<
m_acceptCodes
[i] );
73
}
74
}
75
76
return
StatusCode::SUCCESS;
77
}
78
80
// Accept/Reject //
82
83
StatusCode
TBEventInfoStreamerTool::accept
()
84
{
85
// retrieve Event Info
86
const
TBEventInfo
* theEventInfo;
87
ATH_CHECK
(
evtStore
()->retrieve(theEventInfo,
"TBEventInfo"
) );
88
89
int
evtType = theEventInfo->
getEventType
();
90
ATH_MSG_DEBUG
(
"Event Type found "
<< evtType );
91
92
return
(std::find(
m_acceptCodes
.begin(),
m_acceptCodes
.end(),evtType) !=
93
m_acceptCodes
.end())
94
? StatusCode::SUCCESS
95
: StatusCode::FAILURE;
96
97
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x,...)
Definition
AthMsgStreamMacros.h:43
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x,...)
Definition
AthMsgStreamMacros.h:47
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x,...)
Definition
AthMsgStreamMacros.h:48
TBEventInfoStreamerTool.h
TBEventInfo.h
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition
AthCommonDataStore.h:145
AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
Definition
AthCommonDataStore.h:85
TBEventInfoStreamerTool::accept
virtual StatusCode accept() override
Definition
TBEventInfoStreamerTool.cxx:83
TBEventInfoStreamerTool::initializeTool
virtual StatusCode initializeTool() override
Definition
TBEventInfoStreamerTool.cxx:30
TBEventInfoStreamerTool::m_acceptTypes
std::vector< std::string > m_acceptTypes
Definition
TBEventInfoStreamerTool.h:31
TBEventInfoStreamerTool::TBEventInfoStreamerTool
TBEventInfoStreamerTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition
TBEventInfoStreamerTool.cxx:12
TBEventInfoStreamerTool::m_selected_events
int m_selected_events
Definition
TBEventInfoStreamerTool.h:33
TBEventInfoStreamerTool::m_acceptCodes
std::vector< int > m_acceptCodes
Definition
TBEventInfoStreamerTool.h:30
TBEventInfoStreamerTool::~TBEventInfoStreamerTool
virtual ~TBEventInfoStreamerTool()
Definition
TBEventInfoStreamerTool.cxx:23
TBEventInfo
Definition
TBEventInfo.h:27
TBEventInfo::getEventType
int getEventType() const
Definition
TBEventInfo.h:71
TBEventStreamerTool::TBEventStreamerTool
TBEventStreamerTool(const std::string &name, const std::string &type, const IInterface *parent)
Definition
TBEventStreamerTool.cxx:8
type
Generated on
for ATLAS Offline Software by
1.17.0