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
Gaudi::Property< bool > m_isBhh

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 if (m_isBhh) {
82 muonEta = 0.;
83 muonPhi = CxxUtils::wrapToPi( muon->phi() + M_PI );
84 }
85
86 double etaMinus = muonEta - m_roiEtaWidth;
87 double etaPlus = muonEta + m_roiEtaWidth;
88
89 double phiMinus = CxxUtils::wrapToPi( muonPhi - m_roiPhiWidth );
90 double phiPlus = CxxUtils::wrapToPi( muonPhi + m_roiPhiWidth );
91
92 double muonZed=0.;
93
94 std::unique_ptr<TrigRoiDescriptor> newROI = nullptr;
95
96 if ( muon->primaryTrackParticle() ) {
97 muonZed = muon->primaryTrackParticle()->z0() + muon->primaryTrackParticle()->vz();
98
99 // create ROIs
100 ATH_MSG_DEBUG("Adding RoI to RoI container");
101 ATH_MSG_DEBUG( "eta " << muonEta << " +/-" << m_roiEtaWidth << " phi " << muonPhi << " +/- " << m_roiPhiWidth << " zed " << muonZed << " +/- " << m_roiZedWidth);
102
103
104 double zMinus = muonZed - m_roiZedWidth;
105 double zPlus = muonZed + m_roiZedWidth;
106
107 zMinus = zMinus < -225. ? -225. : zMinus;
108 zPlus = zPlus > 225. ? 225. : zPlus;
109
110 ATH_MSG_DEBUG( "eta- " << etaMinus << " eta+ " << etaPlus << " phi- " << phiMinus << " phi+ " << phiPlus << " zed- " << zMinus << " zed+ " << zPlus);
111
112 superRoI->push_back( new TrigRoiDescriptor( muonEta, etaMinus, etaPlus,
113 muonPhi, phiMinus, phiPlus,
114 muonZed, zMinus, zPlus ) );
115
116 superRoI->manageConstituents(true);
117
118 } else {
119 ATH_MSG_DEBUG("Adding RoI to RoI container");
120 ATH_MSG_DEBUG( "eta " << muonEta << " +/-" << m_roiEtaWidth << " phi " << muonPhi << " +/- " << m_roiPhiWidth);
121 ATH_MSG_DEBUG( "eta- " << etaMinus << " eta+ " << etaPlus << " phi- " << phiMinus << " phi+ " << phiPlus);
122
123 superRoI->push_back( new TrigRoiDescriptor( muonEta, etaMinus, etaPlus,
124 muonPhi, phiMinus, phiPlus) );
125
126 superRoI->manageConstituents(true);
127
128 }
129
130
131 } //end loop over decisions
132
133
134
135 roisWriteHandle->push_back(superRoI.release());
136 const ElementLink< TrigRoiDescriptorCollection > roiEL = ElementLink< TrigRoiDescriptorCollection >( *roisWriteHandle, 0, ctx );
137
138
139 for (TrigCompositeUtils::Decision* decision : decisions) {
140 decision->setObjectLink( TrigCompositeUtils::roiString(), roiEL );
141
142 ATH_MSG_DEBUG("PRINTING DECISION");
143 ATH_MSG_DEBUG( *decision );
144 }
145 return StatusCode::SUCCESS;
146}
#define M_PI
#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_isBhh

Gaudi::Property< bool > ViewCreatorMuonSuperROITool::m_isBhh
Initial value:
{this,"isBhh",false,
"true for HLT_muX_bBhh chains"}

Definition at line 69 of file ViewCreatorMuonSuperROITool.h.

69 {this,"isBhh",false,
70 "true for HLT_muX_bBhh chains"};

◆ 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: