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

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

#include <ViewCreatorMuonSuperROITool.h>

Inheritance diagram for ViewCreatorMuonSuperROITool:
Collaboration diagram for ViewCreatorMuonSuperROITool:

Public Member Functions

 ViewCreatorMuonSuperROITool (const std::string &type, const std::string &name, const IInterface *parent)
virtual ~ViewCreatorMuonSuperROITool ()=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

Detailed Description

Creates a new (super)-ROI combining windows centred on muons 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 bmumux tracking operations, beginning from muons.

Definition at line 25 of file ViewCreatorMuonSuperROITool.h.

Constructor & Destructor Documentation

◆ ViewCreatorMuonSuperROITool()

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

Definition at line 14 of file ViewCreatorMuonSuperROITool.cxx.

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

◆ ~ViewCreatorMuonSuperROITool()

virtual ViewCreatorMuonSuperROITool::~ViewCreatorMuonSuperROITool ( )
virtualdefault

Member Function Documentation

◆ attachROILinks()

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

Tool interface method.

Definition at line 28 of file ViewCreatorMuonSuperROITool.cxx.

29 {
30
31 // ===================================================================================== //
32 // Create output RoI collection
33
34 SG::WriteHandle<TrigRoiDescriptorCollection> roisWriteHandle = TrigCompositeUtils::createAndStoreNoAux(m_roisWriteHandleKey, ctx);
35 // ===================================================================================== //
36
37 // Only expect one object in container
38 ATH_MSG_DEBUG("In MuonSuperROITool - got decisions, size: " << decisions.size());
39
40
41 // Create SuperRoI to merge the RoIs from each muon
42 std::unique_ptr<TrigRoiDescriptor> superRoI = std::make_unique<TrigRoiDescriptor>();
43 superRoI->setComposite(true);
44 superRoI->manageConstituents(false);
45
46 // loop over decision objects
47 for (TrigCompositeUtils::Decision* decision : decisions) {
48 ATH_MSG_DEBUG(" Check decisions object ");
49
50 ATH_MSG_DEBUG("PRINTING DECISION");
51 ATH_MSG_DEBUG( *decision );
52
53
54 // find the iParticle for this decision
55 const std::vector<TrigCompositeUtils::LinkInfo<xAOD::IParticleContainer>> myFeature = TrigCompositeUtils::findLinks<xAOD::IParticleContainer>(decision, m_iParticleLinkName, TrigDefs::lastFeatureOfType);
56
57 // there should be only one
58 if (myFeature.size() != 1) {
59 ATH_MSG_ERROR("Did not find exactly one most-recent xAOD::IParticle '" << m_iParticleLinkName << "' for Decision object index " << decision->index()
60 << ", found " << myFeature.size());
61 return StatusCode::FAILURE;
62 }
63
64 ATH_CHECK(myFeature.at(0).isValid());
65
66 // find the muon
67 const ElementLink<xAOD::IParticleContainer> p4EL = myFeature.at(0).link;
68 const xAOD::Muon* muon = dynamic_cast< const xAOD::Muon*>(*p4EL); //get muon of this found object
69
70 if (!( muon && muon->primaryTrackParticle()) ) {
71 ATH_MSG_ERROR("NO PRIMARY muon from decision object! " << myFeature.at(0).link);
72 return StatusCode::FAILURE;
73 }
74
75 ATH_MSG_DEBUG("MUON -- pt=" << muon->pt() <<
76 " eta=" << muon->eta() <<
77 " phi=" << muon->phi() );
78
79
80 double muonEta{muon->eta()}, muonPhi{muon->phi()};
81
82 double etaMinus = muonEta - m_roiEtaWidth;
83 double etaPlus = muonEta + m_roiEtaWidth;
84
85 double phiMinus = CxxUtils::wrapToPi( muonPhi - m_roiPhiWidth );
86 double phiPlus = CxxUtils::wrapToPi( muonPhi + m_roiPhiWidth );
87
88 double muonZed=0.;
89
90 std::unique_ptr<TrigRoiDescriptor> newROI = nullptr;
91
92 if ( muon->primaryTrackParticle() ) {
93 muonZed = muon->primaryTrackParticle()->z0() + muon->primaryTrackParticle()->vz();
94
95 // create ROIs
96 ATH_MSG_DEBUG("Adding RoI to RoI container");
97 ATH_MSG_DEBUG( "eta " << muonEta << " +/-" << m_roiEtaWidth << " phi " << muonPhi << " +/- " << m_roiPhiWidth << " zed " << muonZed << " +/- " << m_roiZedWidth);
98
99
100 double zMinus = muonZed - m_roiZedWidth;
101 double zPlus = muonZed + m_roiZedWidth;
102
103 zMinus = zMinus < -225. ? -225. : zMinus;
104 zPlus = zPlus > 225. ? 225. : zPlus;
105
106 ATH_MSG_DEBUG( "eta- " << etaMinus << " eta+ " << etaPlus << " phi- " << phiMinus << " phi+ " << phiPlus << " zed- " << zMinus << " zed+ " << zPlus);
107
108 superRoI->push_back( new TrigRoiDescriptor( muonEta, etaMinus, etaPlus,
109 muonPhi, phiMinus, phiPlus,
110 muonZed, zMinus, zPlus ) );
111
112 superRoI->manageConstituents(true);
113
114 } else {
115 ATH_MSG_DEBUG("Adding RoI to RoI container");
116 ATH_MSG_DEBUG( "eta " << muonEta << " +/-" << m_roiEtaWidth << " phi " << muonPhi << " +/- " << m_roiPhiWidth);
117 ATH_MSG_DEBUG( "eta- " << etaMinus << " eta+ " << etaPlus << " phi- " << phiMinus << " phi+ " << phiPlus);
118
119 superRoI->push_back( new TrigRoiDescriptor( muonEta, etaMinus, etaPlus,
120 muonPhi, phiMinus, phiPlus) );
121
122 superRoI->manageConstituents(true);
123
124 }
125
126
127 } //end loop over decisions
128
129
130
131 roisWriteHandle->push_back(superRoI.release());
132 const ElementLink< TrigRoiDescriptorCollection > roiEL = ElementLink< TrigRoiDescriptorCollection >( *roisWriteHandle, 0, ctx );
133
134
135 for (TrigCompositeUtils::Decision* decision : decisions) {
136 decision->setObjectLink( TrigCompositeUtils::roiString(), roiEL );
137
138 ATH_MSG_DEBUG("PRINTING DECISION");
139 ATH_MSG_DEBUG( *decision );
140 }
141 return StatusCode::SUCCESS;
142}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_DEBUG(x)
Athena::TPCnvVers::Current TrigRoiDescriptor
Gaudi::Property< double > m_roiZedWidth
Gaudi::Property< double > m_roiEtaWidth
Gaudi::Property< std::string > m_iParticleLinkName
Gaudi::Property< double > m_roiPhiWidth
SG::WriteHandleKey< TrigRoiDescriptorCollection > m_roisWriteHandleKey
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()
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.
Muon_v1 Muon
Reference the current persistent version:

◆ initialize()

StatusCode ViewCreatorMuonSuperROITool::initialize ( )
overridevirtual

Definition at line 21 of file ViewCreatorMuonSuperROITool.cxx.

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

Member Data Documentation

◆ m_iParticleLinkName

Gaudi::Property< std::string > ViewCreatorMuonSuperROITool::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 48 of file ViewCreatorMuonSuperROITool.h.

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

◆ m_roiEtaWidth

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

Definition at line 59 of file ViewCreatorMuonSuperROITool.h.

59 {this,"RoIEtaWidth",0.5,
60 "Extent of the ROI in eta from its centre"};

◆ m_roiPhiWidth

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

Definition at line 62 of file ViewCreatorMuonSuperROITool.h.

62 {this,"RoIPhiWidth",0.5,
63 "Extent of the ROI in phi from its centre"};

◆ m_roisWriteHandleKey

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

Definition at line 41 of file ViewCreatorMuonSuperROITool.h.

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

◆ m_roiZedWidth

Gaudi::Property< double > ViewCreatorMuonSuperROITool::m_roiZedWidth
Initial value:
{this,"RoIZedWidth",50.0,
"Z Half Width in mm"}

Definition at line 66 of file ViewCreatorMuonSuperROITool.h.

66 {this,"RoIZedWidth",50.0,
67 "Z Half Width in mm"};

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