ATLAS Offline Software
Loading...
Searching...
No Matches
ViewCreatorCentredOnIParticleROITool Class Reference

Creates a new ROI centred on an object deriving from xAOD::IParticle. More...

#include <ViewCreatorCentredOnIParticleROITool.h>

Inheritance diagram for ViewCreatorCentredOnIParticleROITool:
Collaboration diagram for ViewCreatorCentredOnIParticleROITool:

Public Member Functions

 ViewCreatorCentredOnIParticleROITool (const std::string &type, const std::string &name, const IInterface *parent)
virtual ~ViewCreatorCentredOnIParticleROITool ()=default
virtual StatusCode initialize () override
virtual StatusCode attachROILinks (TrigCompositeUtils::DecisionContainer &decisions, const EventContext &ctx) const override
 Tool interface method.

Public Attributes

SG::WriteHandleKey< TrigRoiDescriptorCollectionm_roisWriteHandleKey
Gaudi::Property< std::string > m_iParticleLinkName
Gaudi::Property< double > m_roiEtaWidth
Gaudi::Property< double > m_roiPhiWidth
Gaudi::Property< double > m_roiZedWidth
Gaudi::Property< double > m_roiZedSinThetaFlag
Gaudi::Property< bool > m_useZedPosition
Gaudi::Property< bool > m_useBeamspot

Detailed Description

Creates a new ROI centred on an object deriving from xAOD::IParticle.

Stores this new ROI in the output container, and links it to the Decision Object

The new EventView spawned by the parent EventViewCreatorAlgorithm of this tool will process in this new ROI.

In the majority of cases, this tool will be used to create the new ROI centred on the "feature" from the previous Step.

Definition at line 24 of file ViewCreatorCentredOnIParticleROITool.h.

Constructor & Destructor Documentation

◆ ViewCreatorCentredOnIParticleROITool()

ViewCreatorCentredOnIParticleROITool::ViewCreatorCentredOnIParticleROITool ( const std::string & type,
const std::string & name,
const IInterface * parent )

Definition at line 15 of file ViewCreatorCentredOnIParticleROITool.cxx.

16 : base_class(type, name, parent)
17 {}

◆ ~ViewCreatorCentredOnIParticleROITool()

virtual ViewCreatorCentredOnIParticleROITool::~ViewCreatorCentredOnIParticleROITool ( )
virtualdefault

Member Function Documentation

◆ attachROILinks()

StatusCode ViewCreatorCentredOnIParticleROITool::attachROILinks ( TrigCompositeUtils::DecisionContainer & decisions,
const EventContext & ctx ) const
overridevirtual

Tool interface method.

1/sin(theta) = cosh( eta )

Definition at line 26 of file ViewCreatorCentredOnIParticleROITool.cxx.

26 {
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
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->primaryTrackParticle() ) {
75 zed0 = muon->primaryTrackParticle()->z0();
76 if ( m_useBeamspot ) zed0 += muon->primaryTrackParticle()->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}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_DEBUG(x)
Athena::TPCnvVers::Current TrigRoiDescriptor
static constexpr bool FULLSCAN
convenient
SG::WriteHandleKey< TrigRoiDescriptorCollection > m_roisWriteHandleKey
SG::WriteHandle< CONT > createAndStoreNoAux(const SG::WriteHandleKey< CONT > &key, const EventContext &ctx)
Creates and right away records the Container CONT with the key.
const std::string & roiString()
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...
static const unsigned int lastFeatureOfType
Run 3 "enum". Only return the final feature along each route through the navigation.
std::pair< long int, long int > indices
Muon_v1 Muon
Reference the current persistent version:

◆ initialize()

StatusCode ViewCreatorCentredOnIParticleROITool::initialize ( )
overridevirtual

Definition at line 20 of file ViewCreatorCentredOnIParticleROITool.cxx.

20 {
21 ATH_CHECK(m_roisWriteHandleKey.initialize());
22 return StatusCode::SUCCESS;
23}

Member Data Documentation

◆ m_iParticleLinkName

Gaudi::Property< std::string > ViewCreatorCentredOnIParticleROITool::m_iParticleLinkName
Initial value:
{this,"IParticleLinkName","feature",
"Name of linked IParticle object to centre the new ROI on. Normally the 'feature' from the previous Step."}

Definition at line 41 of file ViewCreatorCentredOnIParticleROITool.h.

41 {this,"IParticleLinkName","feature",
42 "Name of linked IParticle object to centre the new ROI on. Normally the 'feature' from the previous Step."};

◆ m_roiEtaWidth

Gaudi::Property< double > ViewCreatorCentredOnIParticleROITool::m_roiEtaWidth
Initial value:
{this,"RoIEtaWidth",0.1,
"Extent of the ROI in eta from its centre"}

Definition at line 44 of file ViewCreatorCentredOnIParticleROITool.h.

44 {this,"RoIEtaWidth",0.1,
45 "Extent of the ROI in eta from its centre"};

◆ m_roiPhiWidth

Gaudi::Property< double > ViewCreatorCentredOnIParticleROITool::m_roiPhiWidth
Initial value:
{this,"RoIPhiWidth",0.1,
"Extent of the ROI in phi from its centre"}

Definition at line 47 of file ViewCreatorCentredOnIParticleROITool.h.

47 {this,"RoIPhiWidth",0.1,
48 "Extent of the ROI in phi from its centre"};

◆ m_roisWriteHandleKey

SG::WriteHandleKey< TrigRoiDescriptorCollection > ViewCreatorCentredOnIParticleROITool::m_roisWriteHandleKey
Initial value:
{this,"RoisWriteHandleKey","",
"Name of the ROI collection produced by this tool."}

Definition at line 38 of file ViewCreatorCentredOnIParticleROITool.h.

38 {this,"RoisWriteHandleKey","",
39 "Name of the ROI collection produced by this tool."};

◆ m_roiZedSinThetaFlag

Gaudi::Property< double > ViewCreatorCentredOnIParticleROITool::m_roiZedSinThetaFlag
Initial value:
{this,"RoIZedSinThetaFlag", false,
"use a delta zed/sin\theta width rather than just a zed width"}

Definition at line 53 of file ViewCreatorCentredOnIParticleROITool.h.

53 {this,"RoIZedSinThetaFlag", false,
54 "use a delta zed/sin\theta width rather than just a zed width"};

◆ m_roiZedWidth

Gaudi::Property< double > ViewCreatorCentredOnIParticleROITool::m_roiZedWidth
Initial value:
{this,"RoIZedWidth",-999,
"Extent of the ROI in zed from its centre"}

Definition at line 50 of file ViewCreatorCentredOnIParticleROITool.h.

50 {this,"RoIZedWidth",-999,
51 "Extent of the ROI in zed from its centre"};

◆ m_useBeamspot

Gaudi::Property< bool > ViewCreatorCentredOnIParticleROITool::m_useBeamspot
Initial value:
{this,"UseBeamSpot", true,
"correct for the pointlessly adjusted average beamspot z"}

Definition at line 59 of file ViewCreatorCentredOnIParticleROITool.h.

59 {this,"UseBeamSpot", true,
60 "correct for the pointlessly adjusted average beamspot z"};

◆ m_useZedPosition

Gaudi::Property< bool > ViewCreatorCentredOnIParticleROITool::m_useZedPosition
Initial value:
{this,"UseZedPosition", true,
"use IParticle z position"}

Definition at line 56 of file ViewCreatorCentredOnIParticleROITool.h.

56 {this,"UseZedPosition", true,
57 "use IParticle z position"};

The documentation for this class was generated from the following files: