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

Creates a new (super)-ROI combining windows centred on HitDV seed jets passing eta/pt selection criteria, extracted from a single decision object (which would normally link the FSRoI). More...

#include <ViewCreatorDVROITool.h>

Inheritance diagram for ViewCreatorDVROITool:
Collaboration diagram for ViewCreatorDVROITool:

Public Member Functions

 ViewCreatorDVROITool (const std::string &type, const std::string &name, const IInterface *parent)
virtual ~ViewCreatorDVROITool ()=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_featureLinkName
Gaudi::Property< double > m_roiEtaWidth
Gaudi::Property< double > m_roiPhiWidth
Gaudi::Property< double > m_roiZWidth

Detailed Description

Creates a new (super)-ROI combining windows centred on HitDV seed jets passing eta/pt selection criteria, extracted from a single decision object (which would normally link the FSRoI).

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.

This tool is mainly intended to create a view for fast tracking preselection operations, beginning from the jets used for pure calorimeter-based preselection.

Definition at line 27 of file ViewCreatorDVROITool.h.

Constructor & Destructor Documentation

◆ ViewCreatorDVROITool()

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

Definition at line 13 of file ViewCreatorDVROITool.cxx.

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

◆ ~ViewCreatorDVROITool()

virtual ViewCreatorDVROITool::~ViewCreatorDVROITool ( )
virtualdefault

Member Function Documentation

◆ attachROILinks()

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

Tool interface method.

Definition at line 27 of file ViewCreatorDVROITool.cxx.

29{
30 ATH_MSG_DEBUG("ViewCreatorDVROITool::attachROILinks");
31 // ===================================================================================== //
32 // ===================================================================================== //
33 // Create output RoI collection
34
35 SG::WriteHandle<TrigRoiDescriptorCollection> roisWriteHandle = TrigCompositeUtils::createAndStoreNoAux(m_roisWriteHandleKey, ctx);
36 // ===================================================================================== //
37 ATH_MSG_DEBUG("Create output RoI collection");
38
39 // Only expect one object in container
40 if(decisions.size()!=1) {
41 ATH_MSG_DEBUG("Did not find exactly one decision object in decision container containing " << decisions.size() << " decisions");
42 }
43
44 for (TrigCompositeUtils::Decision* outputDecision : decisions) {
45
46 ATH_MSG_DEBUG("Loop over decisions");
47
48 const std::vector< TrigCompositeUtils::LinkInfo<xAOD::TrigCompositeContainer> > dvSeedLinks = TrigCompositeUtils::findLinks< xAOD::TrigCompositeContainer >(outputDecision, TrigCompositeUtils::featureString(), TrigDefs::lastFeatureOfType);
49
50 if (dvSeedLinks.size() != 1) {
51 ATH_MSG_DEBUG("Did not find exactly one most-recent " << m_featureLinkName << " for Decision object index "
52 << outputDecision->index() << ", found " << dvSeedLinks.size());
53 }
54
55 for (const auto& dvLink : dvSeedLinks) {
56 // This is needed to merge the RoIs from each dv
57 std::unique_ptr<TrigRoiDescriptor> superRoI = std::make_unique<TrigRoiDescriptor>();
58 superRoI->setComposite(true);
59 superRoI->manageConstituents(true);
60
61 if(!dvLink.link.isValid()) {
62 ATH_MSG_DEBUG("Received invalid hitDV link from decision object! " << m_featureLinkName << " : " << dvLink.link);
63 continue;
64 }
65
66 ATH_MSG_DEBUG(" --- Find Link");
67 const xAOD::TrigCompositeContainer* dvCont = static_cast<const xAOD::TrigCompositeContainer*> ( (*dvLink.link)->container() );
68 ATH_MSG_DEBUG(" --- Found " << dvCont->size() << " presel DV seeds linked from decision object.");
69 ATH_MSG_DEBUG(" ");
70
71 static const SG::ConstAccessor<float> hitDV_seed_etaAcc("hitDV_seed_eta");
72 static const SG::ConstAccessor<float> hitDV_seed_phiAcc("hitDV_seed_phi");
73 for(const xAOD::TrigComposite* dv : *dvCont) {
74 if ( !(hitDV_seed_etaAcc.isAvailable( *dv ) &&
75 hitDV_seed_etaAcc.isAvailable( *dv ) ) ) continue;
76
77 float dvEta = hitDV_seed_etaAcc( *dv );
78 float dvPhi = hitDV_seed_phiAcc( *dv );
79
80 ATH_MSG_DEBUG( "DV seed eta = " << dvEta <<
81 " phi = " << dvPhi );
82
83 // create ROIs
84 ATH_MSG_DEBUG("Adding RoI to RoI container");
85 ATH_MSG_DEBUG( " ** Imposing Z constraint while building RoI" );
86 double etaMinus = dvEta - m_roiEtaWidth;
87 double etaPlus = dvEta + m_roiEtaWidth;
88
89 double phiMinus = CxxUtils::wrapToPi( dvPhi - m_roiPhiWidth );
90 double phiPlus = CxxUtils::wrapToPi( dvPhi + m_roiPhiWidth );
91
92 // Should retrieve beamspot offset from somewhere
93 double zMinus = -1. * m_roiZWidth;
94 double zPlus = m_roiZWidth;
95
96 std::unique_ptr<TrigRoiDescriptor> newROI =
97 std::make_unique<TrigRoiDescriptor>( dvEta, etaMinus, etaPlus,
98 dvPhi, phiMinus, phiPlus,
99 0.,zMinus,zPlus );
100
101 superRoI->push_back( newROI.release() );
102 }
103
104
105 roisWriteHandle->push_back(superRoI.release());
106 const ElementLink< TrigRoiDescriptorCollection > roiEL = ElementLink< TrigRoiDescriptorCollection >( *roisWriteHandle, roisWriteHandle->size() - 1, ctx );
107 outputDecision->setObjectLink( TrigCompositeUtils::roiString(), roiEL );
108
109 ATH_MSG_DEBUG("PRINTING DECISION");
110 ATH_MSG_DEBUG( *outputDecision );
111 }
112 }
113
114 ATH_MSG_DEBUG("return StatusCode::SUCCESS");
115 return StatusCode::SUCCESS;
116}
#define ATH_MSG_DEBUG(x)
size_type size() const noexcept
Returns the number of elements in the collection.
Gaudi::Property< double > m_roiPhiWidth
Gaudi::Property< double > m_roiZWidth
SG::WriteHandleKey< TrigRoiDescriptorCollection > m_roisWriteHandleKey
Gaudi::Property< std::string > m_featureLinkName
Gaudi::Property< double > m_roiEtaWidth
T wrapToPi(T phi)
Wrap angle in radians to [-pi, pi].
Definition phihelper.h:24
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()
const std::string & featureString()
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.
TrigCompositeContainer_v1 TrigCompositeContainer
Declare the latest version of the container.
TrigComposite_v1 TrigComposite
Declare the latest version of the class.

◆ initialize()

StatusCode ViewCreatorDVROITool::initialize ( )
overridevirtual

Definition at line 20 of file ViewCreatorDVROITool.cxx.

20 {
21 ATH_CHECK( m_roisWriteHandleKey.initialize() );
22
23 return StatusCode::SUCCESS;
24}
#define ATH_CHECK
Evaluate an expression and check for errors.

Member Data Documentation

◆ m_featureLinkName

Gaudi::Property< std::string > ViewCreatorDVROITool::m_featureLinkName
Initial value:
{this,"FeatureLinkName","HitDVSeedLink",
"The name of the decoration holding the list of jets used for preselection"}

Definition at line 45 of file ViewCreatorDVROITool.h.

45 {this,"FeatureLinkName","HitDVSeedLink",
46 "The name of the decoration holding the list of jets used for preselection"};

◆ m_roiEtaWidth

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

Definition at line 48 of file ViewCreatorDVROITool.h.

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

◆ m_roiPhiWidth

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

Definition at line 51 of file ViewCreatorDVROITool.h.

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

◆ m_roisWriteHandleKey

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

Definition at line 42 of file ViewCreatorDVROITool.h.

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

◆ m_roiZWidth

Gaudi::Property< double > ViewCreatorDVROITool::m_roiZWidth
Initial value:
{this,"RoIZWidth",1500.0,
"Z Half Width in mm"}

Definition at line 55 of file ViewCreatorDVROITool.h.

55 {this,"RoIZWidth",1500.0,
56 "Z Half Width in mm"};

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