ATLAS Offline Software
Loading...
Searching...
No Matches
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
7
8#include <string>
9#include <ios>
10#include <algorithm>
11
13 const std::string& name,
14 const IInterface* parent)
15 : TBEventStreamerTool(type,name,parent),
17{
18 declareInterface<TBEventStreamerTool>(this);
19 m_acceptTypes.resize(1,"Physics");
20 declareProperty("AcceptedTypes",m_acceptTypes);
21}
22
25
27// Initialize //
29
31{
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
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}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_FATAL(x)
#define ATH_MSG_DEBUG(x)
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
ServiceHandle< StoreGateSvc > & evtStore()
virtual StatusCode accept() override
virtual StatusCode initializeTool() override
std::vector< std::string > m_acceptTypes
TBEventInfoStreamerTool(const std::string &type, const std::string &name, const IInterface *parent)
int getEventType() const
Definition TBEventInfo.h:71
TBEventStreamerTool(const std::string &name, const std::string &type, const IInterface *parent)