ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigHypothesis
TrigLongLivedParticlesHypo
src
TrigVSIHypoTool.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
TrigVSIHypoTool.h
"
6
7
#include "
TrigCompositeUtils/HLTIdentifier.h
"
8
#include "
AthenaMonitoringKernel/Monitored.h
"
9
#include "
AthContainers/ConstAccessor.h
"
10
11
#include <array>
12
13
using namespace
TrigCompositeUtils
;
14
15
TrigVSIHypoTool::TrigVSIHypoTool
(
const
std::string&
type
,
const
std::string& name,
const
IInterface* parent )
16
:
AthAlgTool
(
type
, name, parent ),
17
m_decisionId
(
HLT
::
Identifier
::fromToolName( name ) ) {}
18
19
StatusCode
TrigVSIHypoTool::initialize
() {
20
return
StatusCode::SUCCESS;
21
}
22
23
StatusCode
TrigVSIHypoTool::decide
(
eventVtxInfo
& vtxinfo )
const
{
24
if
( vtxinfo.
previousDecisionIDs
.count(
m_decisionId
.numeric() ) == 0 ) {
25
ATH_MSG_DEBUG
(
"Already rejected"
);
26
return
StatusCode::SUCCESS;
27
}
28
29
bool
passNTrkCut =
false
;
30
bool
passRCut =
false
;
31
bool
passPtCut =
false
;
32
bool
passChi2Cut =
false
;
33
bool
passMassCut =
false
;
34
35
bool
passSelection =
false
;
36
37
static
const
SG::ConstAccessor<float>
vsi_massAcc (
"vsi_mass"
);
38
static
const
SG::ConstAccessor<float>
vsi_pTAcc (
"vsi_pT"
);
39
40
for
(
auto
vertex : vtxinfo.
vertices
) {
41
passNTrkCut =
false
;
42
passRCut =
false
;
43
passPtCut =
false
;
44
passChi2Cut =
false
;
45
passMassCut =
false
;
46
47
if
( vertex ==
nullptr
)
continue
;
48
const
size_t
ntrk = vertex->nTrackParticles();
49
const
float
pT = vsi_pTAcc.
withDefault
(*vertex, 0);
50
const
float
chi2
= vertex->chiSquared();
51
const
float
mass = vsi_massAcc.
withDefault
(*vertex, 0);
52
53
const
float
x_ = vertex->position().x();
54
const
float
y_ = vertex->position().y();
55
const
float
r
= std::sqrt(x_*x_+y_*y_);
56
57
if
( ntrk >=
m_minNTrks
58
&& (ntrk <=
m_maxNTrks
||
m_maxNTrks
<=
m_minNTrks
)
59
) passNTrkCut =
true
;
60
61
if
(
r
>=
m_minR
62
&&
r
<=
m_maxR
63
) passRCut =
true
;
64
65
if
( pT >
m_minPt
66
&& pT <
m_maxPt
67
) passPtCut =
true
;
68
69
if
(
chi2
<
m_maxChi2
70
) passChi2Cut =
true
;
71
72
if
( mass >
m_minMass
73
&& mass <
m_maxMass
74
) passMassCut =
true
;
75
76
std::array<bool,5> decisions{ passNTrkCut, passRCut, passPtCut, passChi2Cut, passMassCut };
77
78
if
(
m_logicAnd
) {
79
passSelection = std::all_of( decisions.begin(), decisions.end(), [](
bool
k ){return k;} );
80
}
else
{
81
passSelection = std::any_of( decisions.begin(), decisions.end(), [](
bool
k ){return k;} );
82
}
83
84
if
(passSelection)
break
;
85
}
86
87
if
( !passSelection ) {
88
return
StatusCode::SUCCESS;
89
}
else
{
90
addDecisionID
(
m_decisionId
.numeric(), vtxinfo.
decision
);
91
ATH_MSG_DEBUG
(
"REGTEST event accepted"
);
92
}
93
94
return
StatusCode::SUCCESS;
95
}
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x,...)
Definition
AthMsgStreamMacros.h:43
ConstAccessor.h
Helper class to provide constant type-safe access to aux data.
Monitored.h
Header file to be included by clients of the Monitored infrastructure.
HLTIdentifier.h
TrigVSIHypoTool.h
AthAlgTool::AthAlgTool
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Definition
AthAlgTool.cxx:16
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition
ConstAccessor.h:55
SG::ConstAccessor::withDefault
const_reference_type withDefault(const ELT &e, const T &deflt) const
Fetch the variable for one element, as a const reference, with a default.
TrigVSIHypoTool::decide
StatusCode decide(eventVtxInfo &decisions) const
Definition
TrigVSIHypoTool.cxx:23
TrigVSIHypoTool::initialize
virtual StatusCode initialize() override
Definition
TrigVSIHypoTool.cxx:19
TrigVSIHypoTool::m_maxPt
Gaudi::Property< float > m_maxPt
Definition
TrigVSIHypoTool.h:42
TrigVSIHypoTool::m_minNTrks
Gaudi::Property< float > m_minNTrks
Definition
TrigVSIHypoTool.h:37
TrigVSIHypoTool::m_minMass
Gaudi::Property< float > m_minMass
Definition
TrigVSIHypoTool.h:44
TrigVSIHypoTool::m_decisionId
HLT::Identifier m_decisionId
Definition
TrigVSIHypoTool.h:36
TrigVSIHypoTool::m_logicAnd
Gaudi::Property< bool > m_logicAnd
Definition
TrigVSIHypoTool.h:46
TrigVSIHypoTool::m_minPt
Gaudi::Property< float > m_minPt
Definition
TrigVSIHypoTool.h:41
TrigVSIHypoTool::m_maxNTrks
Gaudi::Property< float > m_maxNTrks
Definition
TrigVSIHypoTool.h:38
TrigVSIHypoTool::m_maxMass
Gaudi::Property< float > m_maxMass
Definition
TrigVSIHypoTool.h:45
TrigVSIHypoTool::m_maxR
Gaudi::Property< float > m_maxR
Definition
TrigVSIHypoTool.h:40
TrigVSIHypoTool::TrigVSIHypoTool
TrigVSIHypoTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition
TrigVSIHypoTool.cxx:15
TrigVSIHypoTool::m_minR
Gaudi::Property< float > m_minR
Definition
TrigVSIHypoTool.h:39
TrigVSIHypoTool::m_maxChi2
Gaudi::Property< float > m_maxChi2
Definition
TrigVSIHypoTool.h:43
chi2
double chi2(TH1 *h0, TH1 *h1)
Definition
comparitor.cxx:525
r
int r
Definition
globals.cxx:22
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::addDecisionID
void addDecisionID(DecisionID id, Decision *d)
Appends the decision (given as ID) to the decision object.
Definition
TrigCompositeUtilsRoot.cxx:59
type
TrigVSIHypoTool::eventVtxInfo
Definition
TrigVSIHypoTool.h:26
TrigVSIHypoTool::eventVtxInfo::vertices
std::vector< const xAOD::Vertex * > vertices
Definition
TrigVSIHypoTool.h:28
TrigVSIHypoTool::eventVtxInfo::decision
TrigCompositeUtils::Decision * decision
Definition
TrigVSIHypoTool.h:27
TrigVSIHypoTool::eventVtxInfo::previousDecisionIDs
const TrigCompositeUtils::DecisionIDContainer previousDecisionIDs
Definition
TrigVSIHypoTool.h:29
Generated on
for ATLAS Offline Software by
1.17.0