ATLAS Offline Software
Loading...
Searching...
No Matches
ViewCreatorCentredOnClusterROITool.cxx
Go to the documentation of this file.
1
2/*
3Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
4*/
5
9
10using namespace TrigCompositeUtils;
11
12ViewCreatorCentredOnClusterROITool::ViewCreatorCentredOnClusterROITool(const std::string& type, const std::string& name, const IInterface* parent)
13 : base_class(type, name, parent)
14 {}
15
16
18 ATH_CHECK(m_roisWriteHandleKey.initialize());
19 return StatusCode::SUCCESS;
20}
21
22
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)
nope - should be used for standalone also, perhaps need to protect the class def bits ifndef XAOD_ANA...
ViewCreatorCentredOnClusterROITool(const std::string &type, const std::string &name, const IInterface *parent)
virtual StatusCode attachROILinks(TrigCompositeUtils::DecisionContainer &decisions, const EventContext &ctx) const override
Tool interface method.
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.
Helper to keep a Decision object, ElementLink and ActiveState (with respect to some requested ChainGr...
Definition LinkInfo.h:22