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

Creates a new ROI centred on one or more xAOD::TrigEMCluster contained nominally within a L1 ROI. More...

#include <ViewCreatorCentredOnClusterROITool.h>

Inheritance diagram for ViewCreatorCentredOnClusterROITool:
Collaboration diagram for ViewCreatorCentredOnClusterROITool:

Public Member Functions

 ViewCreatorCentredOnClusterROITool (const std::string &type, const std::string &name, const IInterface *parent)
virtual ~ViewCreatorCentredOnClusterROITool ()=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_clusterLinkName
Gaudi::Property< bool > m_allowMultipleClusters
Gaudi::Property< double > m_roiEtaWidth
Gaudi::Property< double > m_roiPhiWidth
Gaudi::Property< double > m_roiZedWidth

Detailed Description

Creates a new ROI centred on one or more xAOD::TrigEMCluster contained nominally within a L1 ROI.

By default the highest ET cluster is used (should there be multiple). Alternatively with AllowMultipleClusters, a superROI may be formed if multiple clusters are reconstructed inside the (L1) ROI.

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.

Definition at line 26 of file ViewCreatorCentredOnClusterROITool.h.

Constructor & Destructor Documentation

◆ ViewCreatorCentredOnClusterROITool()

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

Definition at line 12 of file ViewCreatorCentredOnClusterROITool.cxx.

13 : base_class(type, name, parent)
14 {}

◆ ~ViewCreatorCentredOnClusterROITool()

virtual ViewCreatorCentredOnClusterROITool::~ViewCreatorCentredOnClusterROITool ( )
virtualdefault

Member Function Documentation

◆ attachROILinks()

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

Tool interface method.

should really use some z position from somewhere, since we might be using this function after some tracking, so to always assume that z=0 is maybe not ideal

Definition at line 23 of file ViewCreatorCentredOnClusterROITool.cxx.

23 {
24 SG::WriteHandle<TrigRoiDescriptorCollection> roisWriteHandle = createAndStoreNoAux(m_roisWriteHandleKey, ctx);
25
26 for ( Decision* outputDecision : decisions ) {
27 const std::vector<LinkInfo<xAOD::TrigEMClusterContainer>> myClusters = findLinks<xAOD::TrigEMClusterContainer>(outputDecision, m_clusterLinkName, TrigDefs::lastFeatureOfType);
28
29 if (myClusters.size() == 0) {
30 ATH_MSG_ERROR("Found zero xAOD::TrigEMClusters '" << m_clusterLinkName << "' for Decision object index " << outputDecision->index());
31 return StatusCode::FAILURE;
32 }
33
34 ATH_MSG_DEBUG("This merged Decision Object has " << myClusters.size() << " TrigEMClusters in its history from a previous Step."
35 << " AllowMultipleClusters=" << (m_allowMultipleClusters ? "TRUE" : "FALSE"));
36
37 // In NOT m_allowMultipleClusters mode, we centre on the highest et
38 size_t singleClusterIndex = 0;
39 if (!m_allowMultipleClusters && myClusters.size() > 1) {
40 float maxEt = 0;
41 for (const LinkInfo<xAOD::TrigEMClusterContainer>& myCluster : myClusters) {
42 ATH_CHECK(myCluster.isValid());
43 ATH_MSG_VERBOSE("- The TrigEMCluster at index " << myCluster.link.index() << " has Et " << (*myCluster.link)->et() << " MeV.");
44 if ((*myCluster.link)->et() > maxEt) {
45 maxEt = (*myCluster.link)->et();
46 singleClusterIndex = myCluster.link.index();
47 }
48 }
49 ATH_MSG_DEBUG("The TrigEMCluster at index " << singleClusterIndex << " will be used as the centre of the FTF ROI, as this one has the highest ET (" << maxEt << " MeV).");
50 }
51
52 // In m_allowMultipleClusters mode, they are all collected into a SuperRoI
54 TrigRoiDescriptor* superRoI = new TrigRoiDescriptor();
55 superRoI->setComposite(true);
56 superRoI->manageConstituents(true);
57 roisWriteHandle->push_back(superRoI);
58 }
59
60 for (const LinkInfo<xAOD::TrigEMClusterContainer>& myCluster : myClusters) {
61 ATH_CHECK(myCluster.isValid());
62 if (!m_allowMultipleClusters && myCluster.link.index() != singleClusterIndex) {
63 continue;
64 }
65
66 const xAOD::TrigEMCluster* c = *(myCluster.link);
67
68 const double reta = c->eta();
69 const double retap = reta + m_roiEtaWidth;
70 const double retam = reta - m_roiEtaWidth;
71 const double rphi = c->phi();
72 const double rphip = rphi + m_roiPhiWidth;
73 const double rphim = rphi - m_roiPhiWidth;
74
75 ATH_MSG_DEBUG( " New ROI for xAOD::TrigEMCluster ET="<< c->et()
76 << " eta="<< c->eta() << " +- " << m_roiEtaWidth
77 << " phi="<< c->phi() << " +- " << m_roiPhiWidth );
78
79 if ( m_roiZedWidth==0 ) {
80 std::unique_ptr<TrigRoiDescriptor> roi = std::make_unique<TrigRoiDescriptor>(reta, retam, retap, rphi, rphim, rphip);
82 roisWriteHandle->back()->push_back( roi.release() ); // Note: manageConstituents=true, superRoI will handle deletion of roi
83 } else {
84 roisWriteHandle->push_back( roi.release() ); // Note: roi now owned by roisWriteHandle
85 }
86 }
87 else {
90 const double rzed = 0;
91 const double rzedm = rzed - m_roiZedWidth;
92 const double rzedp = rzed + m_roiZedWidth;
93
94 std::unique_ptr<TrigRoiDescriptor> roi = std::make_unique<TrigRoiDescriptor>(reta, retam, retap, rphi, rphim, rphip, rzed, rzedm, rzedp );
96 roisWriteHandle->back()->push_back( roi.release() ); // Note: manageConstituents=true, superRoI will handle deletion of roi
97 } else {
98 roisWriteHandle->push_back( roi.release() ); // Note: roi now owned by roisWriteHandle
99 }
100 }
101
102
103 }
104
105 // Link this ROI into the navigation. It will be used to spawn the Event View for this Decision Object.
106 const ElementLink<TrigRoiDescriptorCollection> roiEL = ElementLink<TrigRoiDescriptorCollection>(*roisWriteHandle, roisWriteHandle->size() - 1, ctx);
107 outputDecision->setObjectLink(roiString(), roiEL);
108
109 }
110
111 return StatusCode::SUCCESS;
112}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_DEBUG(x)
float et(const xAOD::jFexSRJetRoI *j)
Athena::TPCnvVers::Current TrigRoiDescriptor
bool manageConstituents() const
always manage constituents ???
void setComposite(bool b=true)
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()
void findLinks(const Decision *start, const std::string &linkName, std::vector< LinkInfo< T > > &links, unsigned int behaviour=TrigDefs::allFeaturesOfType, std::set< const xAOD::TrigComposite * > *fullyExploredFrom=nullptr)
search back the TC links for the object of type T linked to the one of TC (recursively) Populates pro...
static const unsigned int lastFeatureOfType
Run 3 "enum". Only return the final feature along each route through the navigation.
TrigEMCluster_v1 TrigEMCluster
Define the latest version of the trigger EM cluster class.

◆ initialize()

StatusCode ViewCreatorCentredOnClusterROITool::initialize ( )
overridevirtual

Definition at line 17 of file ViewCreatorCentredOnClusterROITool.cxx.

17 {
18 ATH_CHECK(m_roisWriteHandleKey.initialize());
19 return StatusCode::SUCCESS;
20}

Member Data Documentation

◆ m_allowMultipleClusters

Gaudi::Property< bool > ViewCreatorCentredOnClusterROITool::m_allowMultipleClusters
Initial value:
{this, "AllowMultipleClusters", true,
"If true, the tool will not take the highest energy cluster. Instead it will add them all to a superRoI"}

Definition at line 46 of file ViewCreatorCentredOnClusterROITool.h.

46 {this, "AllowMultipleClusters", true,
47 "If true, the tool will not take the highest energy cluster. Instead it will add them all to a superRoI"};

◆ m_clusterLinkName

Gaudi::Property< std::string > ViewCreatorCentredOnClusterROITool::m_clusterLinkName
Initial value:
{this,"ClusterLinkName","feature",
"Name of linked Cluster object to centre the new ROI on. Normally the 'feature' from the previous Step."}

Definition at line 43 of file ViewCreatorCentredOnClusterROITool.h.

43 {this,"ClusterLinkName","feature",
44 "Name of linked Cluster object to centre the new ROI on. Normally the 'feature' from the previous Step."};

◆ m_roiEtaWidth

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

Definition at line 49 of file ViewCreatorCentredOnClusterROITool.h.

49 {this,"RoIEtaWidth",0.05,
50 "Extent of the ROI in eta from its centre"};

◆ m_roiPhiWidth

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

Definition at line 52 of file ViewCreatorCentredOnClusterROITool.h.

52 {this,"RoIPhiWidth",0.05,
53 "Extent of the ROI in phi from its centre"};

◆ m_roisWriteHandleKey

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

Definition at line 40 of file ViewCreatorCentredOnClusterROITool.h.

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

◆ m_roiZedWidth

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

Definition at line 55 of file ViewCreatorCentredOnClusterROITool.h.

55 {this,"RoIZedWidth",0.0,
56 "Extent of the ROI in zed from its centre"};

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