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

#include <MmDataPreparator.h>

Inheritance diagram for TrigL2MuonSA::MmDataPreparator:
Collaboration diagram for TrigL2MuonSA::MmDataPreparator:

Public Member Functions

 MmDataPreparator (const std::string &type, const std::string &name, const IInterface *parent)
virtual StatusCode initialize () override
StatusCode prepareData (const EventContext &ctx, const TrigRoiDescriptor *p_roids, TrigL2MuonSA::MmHits &mmHits) const
void setRoIBasedDataAccess (bool use_RoIBasedDataAccess)
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

ToolHandle< IRegSelToolm_regionSelector
SG::ReadHandleKey< Muon::MMPrepDataContainerm_mmPrepContainerKey
bool m_use_RoIBasedDataAccess = false
ServiceHandle< Muon::IMuonIdHelperSvcm_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}
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 21 of file MmDataPreparator.h.

Member Typedef Documentation

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ MmDataPreparator()

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

Definition at line 7 of file MmDataPreparator.cxx.

9 :
10 AthAlgTool(type,name,parent),
11 m_regionSelector("RegSelTool/RegSelTool_MM",this)
12{
14}
AthAlgTool()
Default constructor:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
ToolHandle< IRegSelTool > m_regionSelector

Member Function Documentation

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

◆ 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::MmDataPreparator::initialize ( )
overridevirtual

Definition at line 16 of file MmDataPreparator.cxx.

17{
18
19 // Locate RegionSelector
20 ATH_CHECK( m_regionSelector.retrieve() );
21 ATH_MSG_DEBUG("Retrieved service RegionSelector");
22
23 ATH_CHECK(m_idHelperSvc.retrieve());
24 ATH_MSG_DEBUG("Retrieved " << m_idHelperSvc);
25
27
28 return StatusCode::SUCCESS;
29}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x)
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
SG::ReadHandleKey< Muon::MMPrepDataContainer > m_mmPrepContainerKey

◆ 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::MmDataPreparator::prepareData ( const EventContext & ctx,
const TrigRoiDescriptor * p_roids,
TrigL2MuonSA::MmHits & mmHits ) const

Definition at line 31 of file MmDataPreparator.cxx.

34{
35
36 ATH_MSG_DEBUG("MmDataPreparator::prepareData() was called.");
37
38 mmHits.clear();
39
40 std::vector<const Muon::MMPrepDataCollection*> mmCols;
41 std::vector<IdentifierHash> mmHashList;
42 std::vector<IdentifierHash> mmHashList_cache;
43
44 // Get MM container
45 if(m_mmPrepContainerKey.empty()) {
46 ATH_MSG_INFO("no mmPrepContainerKey");
47 return StatusCode::SUCCESS;
48 }
49 auto mmPrepContainerHandle = SG::makeHandle(m_mmPrepContainerKey, ctx);
50 if (!mmPrepContainerHandle.isValid()) {
51 ATH_MSG_ERROR("Cannot retrieve MM PRD Container key: " << m_mmPrepContainerKey.key());
52 return StatusCode::FAILURE;
53 } else {
54 ATH_MSG_DEBUG("MM PRD Container retrieved with key: " << m_mmPrepContainerKey.key());
55 }
56 const Muon::MMPrepDataContainer* mmPrds = mmPrepContainerHandle.cptr();
57
59 // ATH_MSG_ERROR("RoI based data access is not available yet");
60
61 ATH_MSG_DEBUG("Use RoI based data access");
62 const IRoiDescriptor* iroi = static_cast<const IRoiDescriptor*> (p_roids);
63 if (iroi) m_regionSelector->lookup(ctx)->HashIDList(*iroi, mmHashList);
64 else {
65 TrigRoiDescriptor fullscan_roi( true );
66 m_regionSelector->lookup(ctx)->HashIDList(fullscan_roi, mmHashList);
67 }
68 ATH_MSG_DEBUG("mmHashList.size()=" << mmHashList.size());
69
70 std::vector<uint32_t> mmRobList;
71 m_regionSelector->lookup(ctx)->ROBIDList(*iroi, mmRobList);
72
73 if (!mmHashList.empty()) {
74
75 // Get MM collections
76 for(const IdentifierHash& id : mmHashList) {
77
78 const auto* MMcoll = mmPrds->indexFindPtr(id);
79
80 if( MMcoll == nullptr ) {
81 continue;
82 }
83
84 if( MMcoll->size() == 0) {
85 ATH_MSG_DEBUG("Empty MM list");
86 continue;
87 }
88
89 mmHashList_cache.push_back(id);
90 mmCols.push_back(MMcoll);
91 }
92 }
93
94 }
95 else {
96 ATH_MSG_DEBUG("Use full data access");
97
98 // Get MM collections
99 for(const auto mmcoll : *mmPrds) {
100 mmCols.push_back(mmcoll);
101 }
102
103 }
104
105
106 for( const Muon::MMPrepDataCollection* mm : mmCols ){
107
108 mmHits.reserve( mmHits.size() + mm->size() );
109 for( const Muon::MMPrepData* prd : *mm ) {
110
111 // save MM hit data in MmHitData
112 TrigL2MuonSA::MmHitData lutDigit;
113
114 lutDigit.eta = prd->globalPosition().eta();
115 lutDigit.phi = prd->globalPosition().phi();
116 lutDigit.r = prd->globalPosition().perp();
117 lutDigit.z = prd->globalPosition().z();
118 lutDigit.stationEta = m_idHelperSvc->mmIdHelper().stationEta(prd->identify());
119 lutDigit.stationPhi = m_idHelperSvc->mmIdHelper().stationPhi(prd->identify());
120 lutDigit.stationName = m_idHelperSvc->mmIdHelper().stationName(prd->identify());
121 lutDigit.ResidualR = 999;
122 lutDigit.ResidualPhi = 999;
123 lutDigit.isOutlier = 0;
124 lutDigit.layerNumber = m_idHelperSvc->mmIdHelper().gasGap(prd->identify())-1 + 4*(m_idHelperSvc->mmIdHelper().multilayer(prd->identify())-1);
125 mmHits.push_back(lutDigit);
126
127 ATH_MSG_DEBUG("MmDataPreparator: global eta/phi/r/z station eta/phi/name channel/layer " << lutDigit.eta << "/" << lutDigit.phi << "/" << lutDigit.r << "/" << lutDigit.z << " " << lutDigit.stationEta << "/" << lutDigit.stationPhi << "/" << lutDigit.stationName << " " << m_idHelperSvc->mmIdHelper().channel(prd->identify()) << "/" << lutDigit.layerNumber);
128
129 }
130 }
131
132 return StatusCode::SUCCESS;
133
134}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
Athena::TPCnvVers::Current TrigRoiDescriptor
virtual const T * indexFindPtr(IdentifierHash hashId) const override final
return pointer on the found entry or null if out of range using hashed index - fast version,...
unsigned int layerNumber
Definition MmData.h:41
MuonPrepDataCollection< MMPrepData > MMPrepDataCollection
MuonPrepDataContainerT< MMPrepData > MMPrepDataContainer
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::MmDataPreparator::setRoIBasedDataAccess ( bool use_RoIBasedDataAccess)
inline

Definition at line 35 of file MmDataPreparator.h.

35{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::MmDataPreparator::m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}
private

Definition at line 46 of file MmDataPreparator.h.

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

◆ m_mmPrepContainerKey

SG::ReadHandleKey<Muon::MMPrepDataContainer> TrigL2MuonSA::MmDataPreparator::m_mmPrepContainerKey
private
Initial value:
{
this, "MmPrepDataContainer", "MM_Measurements", "Name of the MMContainer to read in"}

Definition at line 41 of file MmDataPreparator.h.

41 {
42 this, "MmPrepDataContainer", "MM_Measurements", "Name of the MMContainer to read in"};

◆ m_regionSelector

ToolHandle<IRegSelTool> TrigL2MuonSA::MmDataPreparator::m_regionSelector
private

Definition at line 39 of file MmDataPreparator.h.

◆ m_use_RoIBasedDataAccess

bool TrigL2MuonSA::MmDataPreparator::m_use_RoIBasedDataAccess = false
private

Definition at line 44 of file MmDataPreparator.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: