ATLAS Offline Software
Loading...
Searching...
No Matches
TrigL2MuonSA::TgcDataPreparator Class Reference

#include <TgcDataPreparator.h>

Inheritance diagram for TrigL2MuonSA::TgcDataPreparator:
Collaboration diagram for TrigL2MuonSA::TgcDataPreparator:

Classes

struct  tgcRawData

Public Member Functions

virtual StatusCode initialize () override
StatusCode prepareData (const EventContext &ctx, const xAOD::MuonRoI *p_roi, TrigL2MuonSA::TgcHits &tgcHits) const
void setRoIBasedDataAccess (bool use_RoIBasedDataAccess)
 AthAlgTool (const std::string &type, const std::string &name, const IInterface *parent)
 Constructor with parameters:
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

ServiceHandle< Muon::IMuonIdHelperSvcm_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}
TrigL2MuonSA::TgcDataPreparatorOptions m_options {}
TrigL2MuonSA::RecMuonRoIUtils m_recMuonRoIUtils {}
SG::ReadHandleKey< Muon::TgcPrepDataContainerm_tgcContainerKey
bool m_use_RoIBasedDataAccess = false
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Definition at line 29 of file TgcDataPreparator.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Member Function Documentation

◆ AthAlgTool()

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

Constructor with parameters:

Definition at line 31 of file AthAlgTool.cxx.

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ initialize()

StatusCode TrigL2MuonSA::TgcDataPreparator::initialize ( )
overridevirtual

Definition at line 13 of file TgcDataPreparator.cxx.

14{
15 ATH_CHECK(m_idHelperSvc.retrieve());
16
17 ATH_CHECK(m_tgcContainerKey.initialize());
18
19 return StatusCode::SUCCESS;
20}
#define ATH_CHECK
Evaluate an expression and check for errors.
SG::ReadHandleKey< Muon::TgcPrepDataContainer > m_tgcContainerKey
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ msg()

MsgStream & AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ prepareData()

StatusCode TrigL2MuonSA::TgcDataPreparator::prepareData ( const EventContext & ctx,
const xAOD::MuonRoI * p_roi,
TrigL2MuonSA::TgcHits & tgcHits ) const

Definition at line 25 of file TgcDataPreparator.cxx.

28{
29 float roi_eta = p_roi->eta();
30 float roi_phi = p_roi->phi();
31 if (roi_phi < 0) roi_phi += 2.0 * M_PI;
32
33 //const Muon::TgcPrepDataContainer* tgcPrepContainer = 0;
34 const Muon::TgcPrepDataContainer* tgcPrepContainer;
35 int gasGap;
36 int channel;
37
38 const bool isLowPt = m_recMuonRoIUtils.isLowPt(p_roi);
39
40 // Select the eta cut based on ROI Pt.
41 const double mid_eta_test = (isLowPt) ? m_options.roadParameters().deltaEtaAtMiddleForLowPt()
42 : m_options.roadParameters().deltaEtaAtMiddleForHighPt();
43 const double inn_eta_test = (isLowPt) ? m_options.roadParameters().deltaEtaAtInnerForLowPt()
44 : m_options.roadParameters().deltaEtaAtInnerForHighPt();
45 const double mid_phi_test = m_options.roadParameters().deltaPhiAtMiddle();
46 const double inn_phi_test = m_options.roadParameters().deltaPhiAtInner();
47
48 auto tgcContainerHandle = SG::makeHandle(m_tgcContainerKey, ctx);
49 tgcPrepContainer = tgcContainerHandle.cptr();
50 if (!tgcContainerHandle.isValid()) {
51 ATH_MSG_ERROR("Could not retrieve PrepDataContainer key:" << m_tgcContainerKey.key());
52 return StatusCode::FAILURE;
53 } else {
54 ATH_MSG_DEBUG("Retrieved PrepDataContainer: " << tgcPrepContainer->numberOfCollections());
55 }
56
57 //Find closest wires in Middle
58 float min_dphi_wire=1000.;
59 float second_dphi_wire=1000.;
60 std::vector<float> ov_dphi;
61 ov_dphi.clear();
62 for( const Muon::TgcPrepDataCollection* wi : *tgcPrepContainer ) { // loop over collections
63 if( !wi ) continue;
64 for( const Muon::TgcPrepData* cwi : *wi ){ // loop over data in the collection
65 if( !cwi ) continue;
66 const Muon::TgcPrepData& prepDataWi = *cwi;
67 if (!m_idHelperSvc->tgcIdHelper().isStrip(prepDataWi.identify())) {//wire
68 int stationNumWi = m_idHelperSvc->tgcIdHelper().stationRegion(prepDataWi.identify())-1;
69 if (stationNumWi==-1) stationNumWi=3;
70 if (stationNumWi<3 && std::abs(prepDataWi.globalPosition().eta() - roi_eta) < mid_eta_test ) {
71 const float dphi = std::acos(std::cos(prepDataWi.globalPosition().phi()-roi_phi));
72 bool overlap=false;
73 for (unsigned int ov=0;ov<ov_dphi.size();ov++)
74 if (std::abs(dphi-ov_dphi[ov])<1e-5) overlap=true;
75 if (overlap) continue;
76 ov_dphi.push_back(dphi);
77 if (dphi<second_dphi_wire){
78 second_dphi_wire=dphi;
79 }
80 if (dphi<min_dphi_wire) {
81 second_dphi_wire=min_dphi_wire;
82 min_dphi_wire=dphi;
83 }
84 }
85 }
86 }
87 }
88
89 //Check if there are enough number of hits
90 int num_min_hits=0;
91 int num_second_hits=0;
92 for( const Muon::TgcPrepDataCollection* hit : *tgcPrepContainer ) { // loop over collections
93 if( !hit ) continue;
94 for( const Muon::TgcPrepData* chit : *hit ){ // loop over data in the collection
95 if( !chit ) continue;
96 const Muon::TgcPrepData& prepDataHit = *chit;
97 if (!m_idHelperSvc->tgcIdHelper().isStrip(prepDataHit.identify())) {//strip
98 int stationNumHit = m_idHelperSvc->tgcIdHelper().stationRegion(prepDataHit.identify())-1;
99 if (stationNumHit==-1) stationNumHit=3;
100 if (stationNumHit<3 && std::abs(prepDataHit.globalPosition().eta() - roi_eta) < mid_eta_test ) {
101 const float dphi = std::acos(std::cos(prepDataHit.globalPosition().phi()-roi_phi));
102 if (std::abs(dphi-min_dphi_wire)<1e-5) num_min_hits++;
103 if (std::abs(dphi-second_dphi_wire)<1e-5) num_second_hits++;
104 }
105 }
106 }
107 }
108
109 float dphi_wire=min_dphi_wire;
110 bool useDefault=false;
111 if (num_min_hits<5) {
112 if (num_second_hits>5) dphi_wire=second_dphi_wire;
113 else useDefault=true;
114 }
115
116 for( const Muon::TgcPrepDataCollection* col : *tgcPrepContainer ) { // loop over collections
117 if( !col ) continue;
118 for( const Muon::TgcPrepData* cit : *col ){ // loop over data in the collection
119 if( !cit ) continue;
120 const Muon::TgcPrepData& prepData = *cit;
121
122 bool isInRoad = false;
123 int stationNum = m_idHelperSvc->tgcIdHelper().stationRegion(prepData.identify())-1;
124 if (stationNum==-1) stationNum=3;
125 if (m_idHelperSvc->tgcIdHelper().isStrip(prepData.identify())) {
126 double dphi = std::abs(prepData.globalPosition().phi() - roi_phi);
127 if( dphi > M_PI*2 ) dphi = dphi - M_PI*2;
128 if( dphi > M_PI ) dphi = M_PI*2 - dphi;
129 // For strips, apply phi cut
130 if ( stationNum < 3 && dphi < mid_phi_test ) { isInRoad = true; }
131 else if( stationNum == 3 && dphi < inn_phi_test ) { isInRoad = true; }
132 }
133 else {
134 // For wires, apply eta cut.
135 const float dphi = std::acos(std::cos(prepData.globalPosition().phi()-roi_phi));
136 if ( stationNum < 3 && std::abs(prepData.globalPosition().eta() - roi_eta) < mid_eta_test ) {
137 if (useDefault) isInRoad = true;//default
138 else if (std::abs(dphi-dphi_wire)<1e-5) isInRoad = true;//for close-by muon
139 }
140 else if( stationNum == 3 && std::abs(prepData.globalPosition().eta() - roi_eta) < inn_eta_test ) { isInRoad = true; }
141 }
142 if( ! isInRoad ) continue;
143
144 const MuonGM::TgcReadoutElement* tgcReadout = prepData.detectorElement();
145 gasGap = m_idHelperSvc->tgcIdHelper().gasGap(prepData.identify());
146 channel = m_idHelperSvc->tgcIdHelper().channel(prepData.identify());
147
148 TrigL2MuonSA::TgcHitData lutDigit;
149
150 lutDigit.eta = prepData.globalPosition().eta();
151 lutDigit.phi = prepData.globalPosition().phi();
152 lutDigit.r = prepData.globalPosition().perp();
153 lutDigit.z = prepData.globalPosition().z();
154 lutDigit.sta = stationNum;
155 lutDigit.isStrip = m_idHelperSvc->tgcIdHelper().isStrip(prepData.identify());
156 if(m_idHelperSvc->tgcIdHelper().isStrip(prepData.identify())){
157 lutDigit.width = tgcReadout->stripWidth(gasGap, channel);
158 }
159 else{
160 lutDigit.width = tgcReadout->gangRadialLength(gasGap, channel);
161 }
162 lutDigit.bcTag = 2;
163 lutDigit.inRoad = false;
164
165
166 tgcHits.push_back(lutDigit);
167
168 }
169 }
170
171 return StatusCode::SUCCESS;
172}
#define M_PI
#define ATH_MSG_ERROR(x)
#define ATH_MSG_DEBUG(x)
virtual size_t numberOfCollections() const override final
return number of collections
double stripWidth(int gasGap, int strip) const
Returns the width of a given strip in the gasGap i.
double gangRadialLength(int gasGap, int gang) const
Returns the length of the wire gang along the radial direction [pitch x N_{wire}^{gang}...
virtual const Amg::Vector3D & globalPosition() const override final
Returns the global position.
virtual const MuonGM::TgcReadoutElement * detectorElement() const override final
Returns the detector element corresponding to this PRD The pointer will be zero if the det el is not ...
TrigL2MuonSA::RecMuonRoIUtils m_recMuonRoIUtils
TrigL2MuonSA::TgcDataPreparatorOptions m_options
Identifier identify() const
return the identifier
float eta() const
The pseudorapidity ( ) of the muon candidate.
float phi() const
The azimuthal angle ( ) of the muon candidate.
MuonPrepDataCollection< TgcPrepData > TgcPrepDataCollection
MuonPrepDataContainerT< TgcPrepData > TgcPrepDataContainer
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ setRoIBasedDataAccess()

void TrigL2MuonSA::TgcDataPreparator::setRoIBasedDataAccess ( bool use_RoIBasedDataAccess)
inline

Definition at line 50 of file TgcDataPreparator.h.

50{ m_use_RoIBasedDataAccess = use_RoIBasedDataAccess; };

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_idHelperSvc

ServiceHandle<Muon::IMuonIdHelperSvc> TrigL2MuonSA::TgcDataPreparator::m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}
private

Definition at line 54 of file TgcDataPreparator.h.

54{this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};

◆ m_options

TrigL2MuonSA::TgcDataPreparatorOptions TrigL2MuonSA::TgcDataPreparator::m_options {}
private

Definition at line 57 of file TgcDataPreparator.h.

57{};

◆ m_recMuonRoIUtils

TrigL2MuonSA::RecMuonRoIUtils TrigL2MuonSA::TgcDataPreparator::m_recMuonRoIUtils {}
private

Definition at line 60 of file TgcDataPreparator.h.

60{};

◆ m_tgcContainerKey

SG::ReadHandleKey<Muon::TgcPrepDataContainer> TrigL2MuonSA::TgcDataPreparator::m_tgcContainerKey
private
Initial value:
{
this, "TGCPrepDataContainer", "TGC_Measurements", "Name of the TGCContainer to read in"}

Definition at line 62 of file TgcDataPreparator.h.

62 {
63 this, "TGCPrepDataContainer", "TGC_Measurements", "Name of the TGCContainer to read in"};

◆ m_use_RoIBasedDataAccess

bool TrigL2MuonSA::TgcDataPreparator::m_use_RoIBasedDataAccess = false
private

Definition at line 65 of file TgcDataPreparator.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


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