ATLAS Offline Software
RegSelTool.cxx
Go to the documentation of this file.
1 
14 #include "RegSelLUT/RegSelSiLUT.h"
15 
16 #include "RegSelTool.h"
17 
18 
19 
21 RegSelTool::RegSelTool( const std::string& type, const std::string& name, const IInterface* parent )
22  : base_class( type, name, parent ),
23  m_initialised(false),
24  m_dumpTable(false),
25  m_rpcflag(false)
26 {
28  declareProperty( "WriteTable", m_dumpTable, "write out maps to files for debugging" );
29  declareProperty( "Initialised", m_initialised=false, "flag to determine whether the corresponding subsystem is initilised" );
30 }
31 
32 
35 
36 
38  if ( !m_initialised ) return nullptr;
40  return (*table_handle)->payload();
41 }
42 
43 
44 
46  ATH_MSG_DEBUG( "Initialising RegSelTool " << name() << "\ttable: " << m_tableKey );
47  if ( !m_initialised ) {
48  ATH_MSG_WARNING( "Lookup table will not be initialised " << name() << "\tkey " << m_tableKey );
49  }
50  ATH_CHECK( m_tableKey.initialize(m_initialised) );
51  if ( name().find( "RPC") != std::string::npos ) m_rpcflag = true;
52  return StatusCode::SUCCESS;
53 }
54 
55 
56 
57 
58 void RegSelTool::cleanup( std::vector<IdentifierHash>& idvec ) const {
59  for ( size_t i=idvec.size() ; i-- ; ) idvec[i] = IdentifierHash( ((unsigned)idvec[i]) & 0xfff );
61 }
62 
63 
64 
65 
67 
69 
71 
72 void RegSelTool::HashIDList( const IRoiDescriptor& roi, std::vector<IdentifierHash>& idlist ) const {
73 
74  if ( !m_initialised ) return;
75 
76  if ( roi.composite() ) {
77  idlist.clear();
78  for ( unsigned iroi=roi.size() ; iroi-- ; ) HashIDList( *(roi.at(iroi)), idlist );
79  if ( roi.size()>1 ) RegSelSiLUT::removeDuplicates( idlist );
80  return;
81  }
82 
83  const IRegSelLUT* lookuptable = lookup();
84  if ( lookuptable ) lookuptable->HashIDList( roi, idlist );
85  if ( m_rpcflag ) cleanup( idlist );
86 
87 }
88 
89 
90 
92 
93 void RegSelTool::HashIDList( long layer, const IRoiDescriptor& roi, std::vector<IdentifierHash>& idlist ) const {
94 
95  if ( !m_initialised ) return;
96 
97  if ( roi.composite() ) {
98  idlist.clear();
99  for ( unsigned iroi=roi.size() ; iroi-- ; ) HashIDList( layer, *(roi.at(iroi)), idlist );
100  if ( roi.size()>1 ) RegSelSiLUT::removeDuplicates( idlist );
101  return;
102  }
103 
104  const IRegSelLUT* lookuptable = lookup();
105  if ( lookuptable ) lookuptable->HashIDList( layer, roi, idlist );
106  if ( m_rpcflag ) cleanup( idlist );
107 
108 }
109 
110 
111 
112 
113 
114 
116 
118 
120 
121 void RegSelTool::ROBIDList( const IRoiDescriptor& roi, std::vector<uint32_t>& roblist ) const {
122 
123  if ( !m_initialised ) return;
124 
125  if ( roi.composite() ) {
126  roblist.clear();
127  for ( unsigned iroi=roi.size() ; iroi-- ; ) ROBIDList( *(roi.at(iroi)), roblist );
129  return;
130  }
131 
132  const IRegSelLUT* lookuptable = lookup();
133  if ( lookuptable ) lookuptable->ROBIDList( roi, roblist );
134 
135 }
136 
137 
138 
140 
141 void RegSelTool::ROBIDList( long layer, const IRoiDescriptor& roi, std::vector<uint32_t>& roblist ) const {
142 
143  if ( !m_initialised ) return;
144 
145  if ( roi.composite() ) {
146  roblist.clear();
147  for ( unsigned iroi=roi.size() ; iroi-- ; ) ROBIDList( layer, *(roi.at(iroi)), roblist );
149  return;
150  }
151 
152  const IRegSelLUT* lookuptable = lookup();
153  if ( lookuptable ) lookuptable->ROBIDList( layer, roi, roblist );
154 
155 }
156 
157 
158 
RegSelTool::RegSelTool
RegSelTool(const std::string &type, const std::string &name, const IInterface *parent)
Standard constructor for tool (obviously).
Definition: RegSelTool.cxx:21
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
RegSelTool::m_tableKey
SG::ReadCondHandleKey< IRegSelLUTCondData > m_tableKey
Definition: RegSelTool.h:88
RegSelTool::initialize
virtual StatusCode initialize() override
@method initialize, loads lookup tables for retrieve Identifier Hash and ROBID
Definition: RegSelTool.cxx:45
RegSelTool::m_initialised
bool m_initialised
Flag to determine whether it has yet been initialised.
Definition: RegSelTool.h:83
IRoiDescriptor::size
virtual unsigned size() const =0
number of constituents
RegSelSiLUT.h
emacs: this is -*- c++ -*-
RegSelTool::m_rpcflag
bool m_rpcflag
flag to avoid the need for a separate rpc lookup table class FixMe: this flag may be replaced by cust...
Definition: RegSelTool.h:96
RegSelTool.h
RegSelTool::~RegSelTool
virtual ~RegSelTool() override
Destructor.
Definition: RegSelTool.cxx:34
lumiFormat.i
int i
Definition: lumiFormat.py:92
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
IRoiDescriptor
Describes the API of the Region of Ineterest geometry.
Definition: IRoiDescriptor.h:23
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
IRegSelLUT
Definition: IRegSelLUT.h:25
RegSelTool::HashIDList
void HashIDList(const IRoiDescriptor &roi, std::vector< IdentifierHash > &idlist) const override
IRegSlTool interface ...
Definition: RegSelTool.cxx:72
RegSelTool::cleanup
void cleanup(std::vector< IdentifierHash > &idvec) const
Definition: RegSelTool.cxx:58
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
DetDescrDictionaryDict::idvec
DataVector< Identifier > idvec
Definition: DetDescrDictionaryDict.h:14
RegSelTool::m_dumpTable
BooleanProperty m_dumpTable
Flag to dump loaded table in data file.
Definition: RegSelTool.h:86
RegSelTool::ROBIDList
void ROBIDList(const IRoiDescriptor &roi, std::vector< uint32_t > &roblist) const override
ROB id access methods.
Definition: RegSelTool.cxx:121
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
IRegSelLUT::HashIDList
virtual void HashIDList(const IRoiDescriptor &roi, std::vector< IdentifierHash > &idlist) const =0
IdentifierHash methods.
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
RegSelSiLUT::removeDuplicates
static void removeDuplicates(std::vector< T > &vec)
useful for removing duplicates if required ...
Definition: RegSelSiLUT.h:222
IRegSelLUT::ROBIDList
virtual void ROBIDList(const IRoiDescriptor &roi, std::vector< uint32_t > &roblist) const =0
Rob identifier methods methods.
IdentifierHash
Definition: IdentifierHash.h:38
IRoiDescriptor::at
virtual const IRoiDescriptor * at(int i) const =0
find an RoiDescriptor constituent
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
RegSelTool::lookup
const IRegSelLUT * lookup() const
@method lookup, actually retrieve the lookup table as conditions data - might combine with handle()
Definition: RegSelTool.cxx:37
IRoiDescriptor::composite
virtual bool composite() const =0
Super RoI access methods.