ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigSteer
DecisionHandling
src
ViewCreatorCentredOnIParticleROITool.cxx
Go to the documentation of this file.
1
2
/*
3
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
4
*/
5
6
#include "
TrigSteeringEvent/TrigRoiDescriptorCollection.h
"
7
#include "
AthViews/ViewHelper.h
"
8
#include "
ViewCreatorCentredOnIParticleROITool.h
"
9
#include "
xAODMuon/Muon.h
"
10
#include "
xAODMuon/MuonContainer.h
"
11
#include "
xAODTrigMissingET/TrigMissingETContainer.h
"
12
13
using namespace
TrigCompositeUtils
;
14
15
ViewCreatorCentredOnIParticleROITool::ViewCreatorCentredOnIParticleROITool
(
const
std::string&
type
,
const
std::string& name,
const
IInterface* parent)
16
: base_class(
type
, name, parent)
17
{}
18
19
20
StatusCode
ViewCreatorCentredOnIParticleROITool::initialize
() {
21
ATH_CHECK
(
m_roisWriteHandleKey
.initialize());
22
return
StatusCode::SUCCESS;
23
}
24
25
26
StatusCode
ViewCreatorCentredOnIParticleROITool::attachROILinks
(
TrigCompositeUtils::DecisionContainer
& decisions,
const
EventContext& ctx)
const
{
27
SG::WriteHandle<TrigRoiDescriptorCollection>
roisWriteHandle =
createAndStoreNoAux
(
m_roisWriteHandleKey
, ctx);
28
29
for
(
Decision
* outputDecision : decisions ) {
30
31
std::set<const Decision*> cache;
32
std::vector<SG::sgkey_t> keys;
33
std::vector<uint32_t> clids;
34
std::vector<Decision::index_type> indices;
35
std::vector<const Decision*> sources;
36
typelessFindLinks
(outputDecision,
m_iParticleLinkName
, keys, clids, indices, sources,
TrigDefs::lastFeatureOfType
, &cache);
37
38
//expect only one link per decision
39
if
(keys.size()!=1){
40
ATH_MSG_ERROR
(
"Did not find exactly one object having searched for a link named '"
<<
m_iParticleLinkName
<<
"'. Found "
<<keys.size()<<
" instead"
);
41
return
StatusCode::FAILURE;
42
}
43
44
//first check if we've found a MET feature, and attach a FS RoI if so
45
if
( clids.at(0) ==
ClassID_traits<xAOD::TrigMissingETContainer>::ID
()){
46
ATH_MSG_DEBUG
(
"Encountered a MET feature in the CentredOnIParticle ROITool. Cannot centre an ROI on this. Attaching a FullScan RoI"
);
47
roisWriteHandle->push_back(
new
TrigRoiDescriptor
(
RoiDescriptor::FULLSCAN
) );
48
const
ElementLink<TrigRoiDescriptorCollection>
roiEL =
ElementLink<TrigRoiDescriptorCollection>
(*roisWriteHandle, roisWriteHandle->size() - 1, ctx);
49
outputDecision->setObjectLink(
roiString
(), roiEL);
50
continue
;
51
}
52
53
//If not MET, we should have an IParticle
54
const
ElementLink<xAOD::IParticleContainer>
p4EL(keys.at(0), indices.at(0), ctx);
55
ATH_CHECK
(p4EL.
isValid
());
56
57
const
double
reta = (*p4EL)->eta();
58
const
double
retap = reta +
m_roiEtaWidth
;
59
const
double
retam = reta -
m_roiEtaWidth
;
60
const
double
rphi = (*p4EL)->phi();
61
const
double
rphip = rphi +
m_roiPhiWidth
;
62
const
double
rphim = rphi -
m_roiPhiWidth
;
63
64
TrigRoiDescriptor
*newROI =
nullptr
;
65
66
if
(
m_roiZedWidth
>= 0 ) {
67
68
const
xAOD::Muon
* muon =
dynamic_cast<
const
xAOD::Muon
*
>
(*p4EL);
//get muon of this found object
69
double
zed0 = 0.0;
//initialization
70
71
bool
update_z_width =
true
;
72
73
if
(
m_useZedPosition
) {
74
if
( muon && muon->trackParticle(xAOD::Muon::TrackParticleType::Primary) ) {
75
zed0 = muon->trackParticle(xAOD::Muon::TrackParticleType::Primary)->z0();
76
if
(
m_useBeamspot
) zed0 += muon->trackParticle(xAOD::Muon::TrackParticleType::Primary)->vz();
77
}
78
else
update_z_width =
false
;
79
}
80
81
if
( update_z_width ) {
82
83
double
zed0p = zed0 +
m_roiZedWidth
;
// in mm
84
double
zed0m = zed0 -
m_roiZedWidth
;
// in mm
85
86
if
(
m_roiZedSinThetaFlag
) {
88
double
cosheta = std::cosh( (*p4EL)->eta() );
89
zed0p = zed0 +
m_roiZedWidth
*cosheta;
// in mm
90
zed0m = zed0 -
m_roiZedWidth
*cosheta;
// in mm
91
}
92
93
ATH_MSG_DEBUG
(
"New ROI for xAOD::Particle ET="
<< (*p4EL)->p4().Et()
94
<<
" eta="
<< (*p4EL)->eta() <<
" +- "
<<
m_roiEtaWidth
95
<<
" phi="
<< (*p4EL)->phi() <<
" +- "
<<
m_roiPhiWidth
96
<<
" zed0="
<< zed0 <<
" +- "
<<
m_roiZedWidth
);
97
98
newROI =
new
TrigRoiDescriptor
( reta, retam, retap,
99
rphi, rphim, rphip,
100
zed0, zed0m, zed0p );
101
}
102
else
{
103
newROI =
new
TrigRoiDescriptor
( reta, retam, retap,
104
rphi, rphim, rphip);
105
}
106
}
107
else
{
108
newROI =
new
TrigRoiDescriptor
( reta, retam, retap,
109
rphi, rphim, rphip);
110
}
111
112
roisWriteHandle->push_back( newROI );
113
114
const
ElementLink<TrigRoiDescriptorCollection>
roiEL =
ElementLink<TrigRoiDescriptorCollection>
(*roisWriteHandle, roisWriteHandle->size() - 1, ctx);
115
116
outputDecision->setObjectLink(
roiString
(), roiEL);
117
}
118
119
return
StatusCode::SUCCESS;
120
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
MuonContainer.h
Muon.h
TrigMissingETContainer.h
TrigRoiDescriptorCollection.h
TrigRoiDescriptor
Athena::TPCnvVers::Current TrigRoiDescriptor
Definition
TrigSteeringEventTPCnv.cxx:68
ViewCreatorCentredOnIParticleROITool.h
ViewHelper.h
ElementLink
ElementLink implementation for ROOT usage.
Definition
A/AthLinks/ElementLink.h:40
ElementLink::isValid
bool isValid() const
Check if the element can be found.
RoiDescriptor::FULLSCAN
static constexpr bool FULLSCAN
convenient
Definition
RoiDescriptor.h:46
SG::WriteHandle
Definition
StoreGate/StoreGate/WriteHandle.h:73
TrigRoiDescriptor
nope - should be used for standalone also, perhaps need to protect the class def bits ifndef XAOD_ANA...
Definition
TrigRoiDescriptor.h:48
ViewCreatorCentredOnIParticleROITool::m_roisWriteHandleKey
SG::WriteHandleKey< TrigRoiDescriptorCollection > m_roisWriteHandleKey
Definition
ViewCreatorCentredOnIParticleROITool.h:38
ViewCreatorCentredOnIParticleROITool::m_useZedPosition
Gaudi::Property< bool > m_useZedPosition
Definition
ViewCreatorCentredOnIParticleROITool.h:56
ViewCreatorCentredOnIParticleROITool::m_roiZedSinThetaFlag
Gaudi::Property< double > m_roiZedSinThetaFlag
Definition
ViewCreatorCentredOnIParticleROITool.h:53
ViewCreatorCentredOnIParticleROITool::m_roiZedWidth
Gaudi::Property< double > m_roiZedWidth
Definition
ViewCreatorCentredOnIParticleROITool.h:50
ViewCreatorCentredOnIParticleROITool::m_roiEtaWidth
Gaudi::Property< double > m_roiEtaWidth
Definition
ViewCreatorCentredOnIParticleROITool.h:44
ViewCreatorCentredOnIParticleROITool::attachROILinks
virtual StatusCode attachROILinks(TrigCompositeUtils::DecisionContainer &decisions, const EventContext &ctx) const override
Tool interface method.
Definition
ViewCreatorCentredOnIParticleROITool.cxx:26
ViewCreatorCentredOnIParticleROITool::ViewCreatorCentredOnIParticleROITool
ViewCreatorCentredOnIParticleROITool(const std::string &type, const std::string &name, const IInterface *parent)
Definition
ViewCreatorCentredOnIParticleROITool.cxx:15
ViewCreatorCentredOnIParticleROITool::m_useBeamspot
Gaudi::Property< bool > m_useBeamspot
Definition
ViewCreatorCentredOnIParticleROITool.h:59
ViewCreatorCentredOnIParticleROITool::m_roiPhiWidth
Gaudi::Property< double > m_roiPhiWidth
Definition
ViewCreatorCentredOnIParticleROITool.h:47
ViewCreatorCentredOnIParticleROITool::m_iParticleLinkName
Gaudi::Property< std::string > m_iParticleLinkName
Definition
ViewCreatorCentredOnIParticleROITool.h:41
ViewCreatorCentredOnIParticleROITool::initialize
virtual StatusCode initialize() override
Definition
ViewCreatorCentredOnIParticleROITool.cxx:20
TrigCompositeUtils
Definition
TrigComposite.h:19
TrigCompositeUtils::createAndStoreNoAux
SG::WriteHandle< CONT > createAndStoreNoAux(const SG::WriteHandleKey< CONT > &key, const EventContext &ctx)
Creates and right away records the Container CONT with the key.
TrigCompositeUtils::Decision
xAOD::TrigComposite Decision
Definition
TrigComposite.h:20
TrigCompositeUtils::roiString
const std::string & roiString()
Definition
TrigCompositeUtils.h:420
TrigCompositeUtils::typelessFindLinks
bool typelessFindLinks(const Decision *start, const std::string &linkName, std::vector< sgkey_t > &keyVec, std::vector< CLID > &clidVec, std::vector< Decision::index_type > &indexVec, std::vector< const Decision * > &sourceVec, const unsigned int behaviour, std::set< const Decision * > *fullyExploredFrom)
search back the TC links for the object of type T linked to the one of TC (recursively) Returns the l...
Definition
TrigCompositeUtilsRoot.cxx:603
TrigCompositeUtils::DecisionContainer
xAOD::TrigCompositeContainer DecisionContainer
Definition
TrigCompositeContainer.h:21
TrigDefs::lastFeatureOfType
static const unsigned int lastFeatureOfType
Run 3 "enum". Only return the final feature along each route through the navigation.
Definition
TrigEvent/TrigDecisionInterface/TrigDecisionInterface/Conditions.h:68
xAOD::Muon
Muon_v1 Muon
Reference the current persistent version:
Definition
Event/xAOD/xAODMuon/xAODMuon/Muon.h:13
ClassID_traits::ID
static constexpr CLID ID()
Definition
Control/AthenaKernel/AthenaKernel/ClassID_traits.h:44
type
Generated on
for ATLAS Offline Software by
1.17.0