ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigHypothesis
TrigLongLivedParticlesHypo
src
MuonClusterHypoTool.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3
4
* Trigger Hypo Tool, that is aimed at triggering clusters of muon RoIs
5
* author Michael Schott <michael.louis.schott@cern.ch>
6
*/
7
#include "
MuonClusterHypoTool.h
"
8
9
#include <cmath>
10
#include <algorithm>
11
#include <sstream>
12
#include <string>
13
14
#include "GaudiKernel/MsgStream.h"
15
#include "GaudiKernel/StatusCode.h"
16
#include "GaudiKernel/ITHistSvc.h"
17
#include "GaudiKernel/PhysicalConstants.h"
18
19
#include "
TrigCompositeUtils/TrigCompositeUtils.h
"
20
#include "
TrigCompositeUtils/HLTIdentifier.h
"
21
#include "
TrigCompositeUtils/Combinators.h
"
22
#include "
StoreGate/ReadHandleKey.h
"
23
#include "
StoreGate/WriteHandleKey.h
"
24
25
#include "
xAODTrigger/TrigComposite.h
"
26
#include "
xAODTrigger/TrigCompositeContainer.h
"
27
#include "
xAODTrigger/TrigCompositeAuxContainer.h
"
28
29
#include "
AthenaMonitoringKernel/Monitored.h
"
30
31
using namespace
TrigCompositeUtils
;
32
33
MuonClusterHypoTool::MuonClusterHypoTool
(
const
std::string&
type
,
34
const
std::string& name,
35
const
IInterface* parent )
36
:
AthAlgTool
(
type
, name, parent ),
37
m_decisionId
(
HLT
::
Identifier
::fromToolName( name ) ) {}
38
39
StatusCode
MuonClusterHypoTool::initialize
()
40
{
41
if
( !
m_monTool
.empty() )
ATH_CHECK
(
m_monTool
.retrieve() );
42
43
ATH_MSG_INFO
(
"Initialization completed successfully:"
);
44
ATH_MSG_INFO
(
"Tool configured for chain/id: "
<<
m_decisionId
);
45
46
return
StatusCode::SUCCESS;
47
}
48
49
MuonClusterHypoTool::~MuonClusterHypoTool
() {}
50
51
StatusCode
MuonClusterHypoTool::decide
(
DecisionInfo
& input )
const
52
{
53
auto
monNumberRoI =
Monitored::Scalar<int>
(
"numberRoI"
, -99 );
54
55
auto
monEtaClust =
Monitored::Scalar<float>
(
"etaClust"
, -99 );
56
auto
monPhiClust =
Monitored::Scalar<float>
(
"phiClust"
, -99 );
57
auto
monEtaClustPass =
Monitored::Scalar<float>
(
"etaClustPass"
, -99 );
58
auto
monPhiClustPass =
Monitored::Scalar<float>
(
"phiClustPass"
, -99 );
59
60
auto
monNumRoIB =
Monitored::Scalar<int>
(
"nRoIBarrel"
, -99 );
61
auto
monNumRoIE =
Monitored::Scalar<int>
(
"nRoIEndcap"
, -99 );
62
auto
monNumRoIBPass =
Monitored::Scalar<int>
(
"nRoIBarrelPass"
, -99 );
63
auto
monNumRoIEPass =
Monitored::Scalar<int>
(
"nRoIEndcapPass"
, -99 );
64
65
auto
result =
Monitored::Scalar<Bool_t>
(
"result"
,
false
);
66
auto
chainActive =
Monitored::Scalar<Bool_t>
(
"chainActive"
,
false
);
67
68
auto
t1 =
Monitored::Timer
(
"TIME_HypoTool"
);
// microseconds
69
auto
t2 =
Monitored::Timer
(
"TIME_HypoTool_GetCluster"
);
70
auto
t3 =
Monitored::Timer
(
"TIME_HypoTool_Selection"
);
71
72
auto
monitorIt =
Monitored::Group
(
m_monTool
, monNumberRoI, monEtaClust, monPhiClust,
73
monNumRoIB, monNumRoIE, monEtaClustPass, monPhiClustPass,
74
result, monNumRoIBPass, monNumRoIEPass, chainActive,
75
t1, t2, t3 );
76
77
const
xAOD::TrigCompositeContainer
*compCont = input.Composites;
78
TrigCompositeUtils::DecisionIDContainer
prev = input.activeChainIDs;
79
80
// Exctracting MuonClusterRoI info
81
ATH_MSG_DEBUG
(
"Found "
<< compCont->
size
() <<
" TrigComposite objects"
);
82
83
int
numberRoI = 0;
84
float
etaClust = -99;
85
float
phiClust = -99;
86
87
bool
foundMuonRoICluster =
false
;
88
89
t2.start();
90
for
(
const
xAOD::TrigComposite
*compObj : *compCont) {
91
ATH_MSG_DEBUG
(
"TrigComposite ptr = "
<< compObj);
92
ATH_MSG_DEBUG
(
"Found object named Cluster : "
<< (compObj->name()==
"Cluster"
?
"yes"
:
"no"
));
93
if
(compObj->name() ==
"Cluster"
) {
94
foundMuonRoICluster =
true
;
95
//if we can't access all the variables necessary for the trigger hypothesis,
96
//return FAILURE, because it means the variables are missing
97
if
(!compObj->getDetail(
"nRoIs"
, numberRoI)) {
return
StatusCode::FAILURE; }
98
if
(!compObj->getDetail(
"ClusterEta"
, etaClust)) {
return
StatusCode::FAILURE; }
99
if
(!compObj->getDetail(
"ClusterPhi"
, phiClust)) {
return
StatusCode::FAILURE; }
100
}
101
}
102
t2.stop();
103
if
( !foundMuonRoICluster ) {
return
StatusCode::FAILURE;}
104
105
// Updating Monitoring values
106
monNumberRoI = numberRoI;
107
monEtaClust = etaClust;
108
monPhiClust = phiClust;
109
110
// Monitor ALL muonRoICluster multiplicities
111
if
(fabs(etaClust)<
m_etaMid
){
112
monNumRoIB = numberRoI;
113
}
else
if
((fabs(etaClust)>=
m_etaMid
&& fabs(etaClust)<=
m_etaMax
)){
114
monNumRoIE = numberRoI;
115
}
116
117
// Bool as to whether we passed.
118
result =
false
;
119
120
// acceptAll can be enabled for testing
121
if
(
m_acceptAll
) {
122
t3.start();
123
result =
true
;
124
ATH_MSG_DEBUG
(
"Accept property is set: taking all the events"
);
125
t3.stop();
126
127
}
else
{
128
129
t3.start();
130
result =
true
;
//set result to true in case of errors for safety
131
132
ATH_MSG_DEBUG
(
"Cluster has "
<< numberRoI <<
" muon RoIs, at (eta, phi) = ("
<< etaClust <<
", "
<< phiClust <<
")"
);
133
134
// Cut on number of RoIs in the cluster
135
if
(fabs(etaClust)<=
m_etaMax
) {
136
137
if
(fabs(etaClust)<
m_etaMid
&& numberRoI >=
m_nRoIBarrel
) {
138
139
ATH_MSG_DEBUG
(
"Cluster passes barrel selection > "
<<
m_nRoIBarrel
<<
" RoIs"
);
140
141
// monitored variables
142
monNumRoIBPass = numberRoI;
143
monEtaClustPass = etaClust;
144
monPhiClustPass = phiClust;
145
result =
true
;
146
147
}
else
if
((fabs(etaClust)>=
m_etaMid
&& fabs(etaClust)<=
m_etaMax
) && numberRoI >=
m_nRoIEndCap
) {
148
149
ATH_MSG_DEBUG
(
"Cluster passes endcap selection > "
<<
m_nRoIEndCap
<<
" RoIs"
);
150
151
// monitored variables
152
monNumRoIEPass = numberRoI;
153
monEtaClustPass = etaClust;
154
monPhiClustPass = phiClust;
155
result =
true
;
156
157
}
else
{
158
ATH_MSG_DEBUG
(
"Cluster does not satisfy all the conditions... event not accepted"
);
159
result =
false
;
160
}
161
162
}
else
{
163
ATH_MSG_DEBUG
(
"Cluster location past maximum permitted eta... event not accepted"
);
164
result =
false
;
165
}
166
167
t3.stop();
168
169
}
170
171
ATH_MSG_DEBUG
(
"Writing out active chains:"
);
172
for
(
DecisionID
activeChain : prev)
173
{
174
ATH_MSG_DEBUG
(
HLT::Identifier
( activeChain ) );
175
}
176
177
// Checking if this HypoTool's chain is active in this event...
178
chainActive = prev.count(
m_decisionId
.numeric()) > 0;
179
if
( (prev.count(
m_decisionId
.numeric()) > 0 ) )
180
{
181
// If it's active, then check selection. ie nothing should pass if its not active.
182
if
( result ) {
183
addDecisionID
(
m_decisionId
.numeric(), input.decision );
184
ATH_MSG_DEBUG
(
"event accepted"
);
185
186
return
StatusCode::SUCCESS;
187
}
188
else
{
189
return
StatusCode::SUCCESS;
190
}
191
}
else
{
192
return
StatusCode::SUCCESS;
193
}
194
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
Monitored.h
Header file to be included by clients of the Monitored infrastructure.
MuonClusterHypoTool.h
ReadHandleKey.h
Property holding a SG store/key/clid from which a ReadHandle is made.
WriteHandleKey.h
Property holding a SG store/key/clid from which a WriteHandle is made.
TrigCompositeAuxContainer.h
TrigCompositeContainer.h
Combinators.h
HLTIdentifier.h
TrigCompositeUtils.h
TrigComposite.h
AthAlgTool::AthAlgTool
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Definition
AthAlgTool.cxx:16
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
HLT::Identifier
Definition
TrigCompositeUtils/TrigCompositeUtils/HLTIdentifier.h:19
Monitored::Group
Group of local monitoring quantities and retain correlation when filling histograms
Definition
MonitoredGroup.h:53
Monitored::Scalar
Declare a monitored scalar variable.
Definition
MonitoredScalar.h:34
Monitored::Timer
A monitored timer.
Definition
MonitoredTimer.h:32
MuonClusterHypoTool::decide
StatusCode decide(DecisionInfo &input) const
Definition
MuonClusterHypoTool.cxx:51
MuonClusterHypoTool::m_nRoIEndCap
Gaudi::Property< int > m_nRoIEndCap
Definition
MuonClusterHypoTool.h:53
MuonClusterHypoTool::initialize
StatusCode initialize()
Definition
MuonClusterHypoTool.cxx:39
MuonClusterHypoTool::~MuonClusterHypoTool
~MuonClusterHypoTool()
Definition
MuonClusterHypoTool.cxx:49
MuonClusterHypoTool::m_monTool
ToolHandle< GenericMonitoringTool > m_monTool
Definition
MuonClusterHypoTool.h:51
MuonClusterHypoTool::m_etaMax
Gaudi::Property< float > m_etaMax
Definition
MuonClusterHypoTool.h:55
MuonClusterHypoTool::m_etaMid
Gaudi::Property< float > m_etaMid
Definition
MuonClusterHypoTool.h:56
MuonClusterHypoTool::m_acceptAll
Gaudi::Property< bool > m_acceptAll
Definition
MuonClusterHypoTool.h:52
MuonClusterHypoTool::MuonClusterHypoTool
MuonClusterHypoTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition
MuonClusterHypoTool.cxx:33
MuonClusterHypoTool::m_decisionId
HLT::Identifier m_decisionId
Definition
MuonClusterHypoTool.h:50
MuonClusterHypoTool::m_nRoIBarrel
Gaudi::Property< int > m_nRoIBarrel
Definition
MuonClusterHypoTool.h:54
HLT
It used to be useful piece of code for replacing actual SG with other store of similar functionality ...
Definition
HLTResultReader.h:26
Identifier
Definition
IdentifierFieldParser.cxx:14
TrigCompositeUtils
Definition
TrigComposite.h:19
TrigCompositeUtils::DecisionID
unsigned int DecisionID
Definition
TrigComposite_v1.h:27
TrigCompositeUtils::DecisionIDContainer
std::set< DecisionID > DecisionIDContainer
Definition
TrigComposite_v1.h:28
TrigCompositeUtils::addDecisionID
void addDecisionID(DecisionID id, Decision *d)
Appends the decision (given as ID) to the decision object.
Definition
TrigCompositeUtilsRoot.cxx:59
xAOD::TrigCompositeContainer
TrigCompositeContainer_v1 TrigCompositeContainer
Declare the latest version of the container.
Definition
TrigCompositeContainer.h:17
xAOD::TrigComposite
TrigComposite_v1 TrigComposite
Declare the latest version of the class.
Definition
TrigComposite.h:16
MuonClusterHypoTool::DecisionInfo
Definition
MuonClusterHypoTool.h:40
type
Generated on
for ATLAS Offline Software by
1.17.0