ATLAS Offline Software
TestBeam
TBRec
src
TBBeamQuality.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
//#####################################################
6
//# #
7
//# File : TBBeamQuality.cxx #
8
//# Package: TBRec #
9
//# #
10
//# Author : Marco Bieri <mbieri@sfu.ca> #
11
//# #
12
//# Last Modified: Feb 7/2005 #
13
//#####################################################
14
15
16
#include "
TBBeamQuality.h
"
17
#include "
TBBeamQualityTool.h
"
18
#include "
TBEvent/TBEventInfo.h
"
19
20
21
TBBeamQuality::TBBeamQuality
(
const
std::string&
name
,
22
ISvcLocator* pService)
23
:
AthAlgorithm
(
name
,pService)
24
{
//properties
25
declareProperty
(
"BQParticles"
,
m_bqparticle
=std::vector<std::string>(1,
"noselect"
));
26
declareProperty
(
"BQToolNames"
,
m_bqtools
);
27
}
//properties
28
29
TBBeamQuality::~TBBeamQuality
()
30
{ }
31
32
/*--------------- INITIALIZE ---------------*/
33
34
StatusCode
TBBeamQuality::initialize
()
35
{
//init
36
// message service
37
ATH_MSG_DEBUG
(
"Initialize"
);
38
39
ATH_CHECK
(
m_bqtools
.retrieve() );
40
41
// check tools
42
if
(
m_bqtools
.size() == 0 ) {
43
ATH_MSG_ERROR
(
"TBBeamQuality: No Tools found"
);
44
return
StatusCode::FAILURE;
45
}
else
{
46
for
(
unsigned
int
i
= 0;
i
<
m_bqtools
.size(); ++
i
) {
47
m_bqacceptCounter
[
m_bqtools
[
i
]] = 0;
48
m_bqrejectCounter
[
m_bqtools
[
i
]] = 0;
49
m_bqtotalCounter
[
m_bqtools
[
i
]] =0;
50
}
51
}
52
53
// print out list of tools
54
ATH_MSG_INFO
(
" "
);
55
ATH_MSG_INFO
(
" TBBeamQuality: List of Tools:"
);
56
ATH_MSG_INFO
(
"-----------------------------------"
);
57
58
for
(ToolHandle<TBBeamQualityTool>&
tool
:
m_bqtools
)
59
{
60
ATH_MSG_INFO
61
(
" Tool Name: "
62
<<
tool
->name()
63
<<
" Tool Type: "
64
<<
tool
->type() );
65
}
66
return
StatusCode::SUCCESS;
67
}
//init
68
69
/*---------------EXECUTE---------------*/
70
StatusCode
TBBeamQuality::execute
()
71
{
// execute
72
ATH_MSG_DEBUG
(
"Execute"
);
73
74
if
(
m_bqparticle
[0]==
"noselect"
) {
//obtain particle type
75
// determining particel type
76
const
TBEventInfo
* eventInfo;
77
StatusCode
sc
=
evtStore
()->retrieve(eventInfo);
78
if
(
sc
.isFailure())
79
{
80
ATH_MSG_ERROR
(
"TBBeamQuality Algo Tool: Could not retrieve event info"
);
81
}
82
std::string
particle
=eventInfo->
getBeamParticle
();
83
m_bqparticle
=std::vector<std::string>(1,
particle
);
84
ATH_MSG_INFO
(
"Beam Quality selected default particle: "
<<
m_bqparticle
[0]);
85
}
86
87
// invoke tools
88
89
// setting event to success
90
bool
successFlag =
true
;
91
for
(ToolHandle<TBBeamQualityTool>&
tool
:
m_bqtools
)
92
{
93
m_bqtotalCounter
[
tool
]++;
94
if
(
tool
->accept(
m_bqparticle
) == StatusCode::SUCCESS )
95
{
96
m_bqacceptCounter
[
tool
]++;
97
}
98
else
99
{
100
m_bqrejectCounter
[
tool
]++;
101
successFlag =
false
;
102
break
;
103
}
104
}
105
106
setFilterPassed(successFlag);
107
return
StatusCode::SUCCESS;
108
}
//execute
109
110
/*---------------FINALIZE---------------*/
111
StatusCode
TBBeamQuality::finalize
()
112
{
//finalize
113
// print summary
114
ATH_MSG_INFO
115
(
"************ Beam Quality Tool ************"
);
116
for
(ToolHandle<TBBeamQualityTool>&
tool
:
m_bqtools
)
117
{
118
ATH_MSG_INFO
119
(
tool
->name() <<
" : "
120
<<
"(Total/Accept/Rejected)"
121
<<
" ("
122
<<
m_bqtotalCounter
[
tool
] <<
"/"
123
<<
m_bqacceptCounter
[
tool
] <<
"/"
124
<<
m_bqrejectCounter
[
tool
]
125
<<
")"
);
126
}
127
return
StatusCode::SUCCESS;
128
}
//finalize
129
130
131
TBBeamQuality::initialize
virtual StatusCode initialize() override
Definition:
TBBeamQuality.cxx:34
Trk::ParticleSwitcher::particle
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
Definition:
ParticleHypothesis.h:76
TBBeamQuality::m_bqacceptCounter
std::map< ToolHandle< TBBeamQualityTool >, unsigned int > m_bqacceptCounter
Definition:
TBBeamQuality.h:48
TBBeamQuality::m_bqtools
ToolHandleArray< TBBeamQualityTool > m_bqtools
Definition:
TBBeamQuality.h:45
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition:
AthMsgStreamMacros.h:31
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition:
AthCommonDataStore.h:145
AthenaPoolTestRead.sc
sc
Definition:
AthenaPoolTestRead.py:27
AthCommonDataStore< AthCommonMsg< Algorithm > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition:
AthCommonDataStore.h:85
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition:
AthMsgStreamMacros.h:33
lumiFormat.i
int i
Definition:
lumiFormat.py:85
TBEventInfo::getBeamParticle
const std::string & getBeamParticle() const
Definition:
TBEventInfo.h:69
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition:
PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition:
AthMsgStreamMacros.h:29
TBBeamQuality::m_bqtotalCounter
std::map< ToolHandle< TBBeamQualityTool >, unsigned int > m_bqtotalCounter
Definition:
TBBeamQuality.h:50
ATH_CHECK
#define ATH_CHECK
Definition:
AthCheckMacros.h:40
AthAlgorithm
Definition:
AthAlgorithm.h:47
name
std::string name
Definition:
Control/AthContainers/Root/debug.cxx:221
AtlCoolConsole.tool
tool
Definition:
AtlCoolConsole.py:453
TBBeamQualityTool.h
TBBeamQuality::finalize
virtual StatusCode finalize() override
Definition:
TBBeamQuality.cxx:111
TBEventInfo
Definition:
TBEventInfo.h:27
TBBeamQuality::~TBBeamQuality
virtual ~TBBeamQuality()
Definition:
TBBeamQuality.cxx:29
TBEventInfo.h
TBBeamQuality::TBBeamQuality
TBBeamQuality(const std::string &name, ISvcLocator *pService)
Definition:
TBBeamQuality.cxx:21
TBBeamQuality::m_bqrejectCounter
std::map< ToolHandle< TBBeamQualityTool >, unsigned int > m_bqrejectCounter
Definition:
TBBeamQuality.h:49
TBBeamQuality::execute
virtual StatusCode execute() override
Definition:
TBBeamQuality.cxx:70
TBBeamQuality.h
TBBeamQuality::m_bqparticle
std::vector< std::string > m_bqparticle
Definition:
TBBeamQuality.h:42
Generated on Thu Nov 7 2024 21:27:10 for ATLAS Offline Software by
1.8.18