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

#include <RpcClusterPreparator.h>

Inheritance diagram for TrigL2MuonSA::RpcClusterPreparator:
Collaboration diagram for TrigL2MuonSA::RpcClusterPreparator:

Public Types

typedef std::map< int, const Muon::RpcPrepData *, std::less< int > > pattern

Public Member Functions

 RpcClusterPreparator (const std::string &type, const std::string &name, const IInterface *parent)
virtual StatusCode initialize () override
StatusCode clusteringRPCs (const bool doMultiMuon, const std::vector< const Muon::RpcPrepDataCollection * > &rpcCols, const TrigRoiDescriptor *p_roids, const ToolHandle< ClusterPatFinder > *clusterPatFinder, TrigL2MuonSA::RpcLayerClusters &rpcLayerClusters) const
int buildPatterns (const bool doMultiMuon, const TrigRoiDescriptor *p_roids, const Muon::RpcPrepDataCollection *rpcCollection, std::map< Identifier, pattern > &digits) const
void buildClusters (const ToolHandle< ClusterPatFinder > *clusterPatFinder, std::map< Identifier, pattern > &digits, TrigL2MuonSA::RpcLayerClusters &rpcLayerClusters) const
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"}
ToolHandle< LVL1::ITrigT1MuonRecRoiToolm_recRPCRoiTool { this, "TrigT1RPCRecRoiTool", "LVL1::TrigT1RPCRecRoiTool/TrigT1RPCRecRoiTool"}
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 30 of file RpcClusterPreparator.h.

Member Typedef Documentation

◆ pattern

typedef std::map<int, const Muon::RpcPrepData*, std::less<int> > TrigL2MuonSA::RpcClusterPreparator::pattern

Definition at line 46 of file RpcClusterPreparator.h.

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ RpcClusterPreparator()

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

Definition at line 13 of file RpcClusterPreparator.cxx.

15 :
16 AthAlgTool(type,name,parent)
17{
18}
AthAlgTool()
Default constructor:

Member Function Documentation

◆ buildClusters()

void TrigL2MuonSA::RpcClusterPreparator::buildClusters ( const ToolHandle< ClusterPatFinder > * clusterPatFinder,
std::map< Identifier, pattern > & digits,
TrigL2MuonSA::RpcLayerClusters & rpcLayerClusters ) const

Definition at line 141 of file RpcClusterPreparator.cxx.

144{
145 // loop over existing patterns
146
147 std::map<Identifier, pattern >::iterator patt_it=digits.begin();
148
149 for(;patt_it!=digits.end();++patt_it){
150
151 Identifier panelId=(*patt_it).first; // this is the panel id
152
153 const bool measphi = m_idHelperSvc->rpcIdHelper().measuresPhi(panelId);
154 std::map<int, const Muon::RpcPrepData*, std::less<int> >::iterator dig_it=digits[panelId].begin();
155
156 std::vector<Identifier> theIDs;
157 int lastStrip=-999;
158 Amg::Vector3D globalPosition(0,0,0);
159 unsigned int count=0;
160
161 // get the ID from the first digit in collection
162 for(;dig_it!=digits[panelId].end();++dig_it){ // loop over patterns
163
164 const MuonGM::RpcReadoutElement* descriptor = (*dig_it).second->detectorElement();
165
166 const int doubletR = m_idHelperSvc->rpcIdHelper().doubletR((*dig_it).second->identify());
167 const int gasGap = m_idHelperSvc->rpcIdHelper().gasGap((*dig_it).second->identify());
168 const int stationEta = m_idHelperSvc->rpcIdHelper().stationEta((*dig_it).second->identify());
169 std::string stationName = m_idHelperSvc->rpcIdHelper().stationNameString(m_idHelperSvc->rpcIdHelper().stationName((*dig_it).second->identify()));
170
171 if(lastStrip==-999){ // first hit of a cluster..
172 lastStrip=(*dig_it).first;
173 theIDs.push_back((*dig_it).second->identify());
174 globalPosition+=descriptor->stripPos((*dig_it).second->identify());
175 ATH_MSG_DEBUG( ">> first hit of a cluster, id = " << lastStrip << ", RPChit x/y/z/ = " << descriptor->stripPos((*dig_it).second->identify()).x() << "/" << descriptor->stripPos((*dig_it).second->identify()).y() << "/" << descriptor->stripPos((*dig_it).second->identify()).z());
176
177 } else if(std::abs(lastStrip-(*dig_it).first)==1){ // still on the same cluster
178
179 lastStrip=(*dig_it).first;
180 theIDs.push_back((*dig_it).second->identify());
181 globalPosition+=descriptor->stripPos((*dig_it).second->identify());
182 ATH_MSG_DEBUG( " ... still on the same cluster, id = " << lastStrip << ", RPChit x/y/z/ = " << descriptor->stripPos((*dig_it).second->identify()).x() << "/" << descriptor->stripPos((*dig_it).second->identify()).y() << "/" << descriptor->stripPos((*dig_it).second->identify()).z());
183
184 } else { // close the cluster
185
186 globalPosition=globalPosition*(1/(float)theIDs.size());
187
188 ATH_MSG_DEBUG(" ... close the cluster ---> cluster at " << stationName << ", x/y/z = " << globalPosition.x() << "/" << globalPosition.y() << "/" << globalPosition.z());
189 (*clusterPatFinder)->addCluster(stationName, stationEta, measphi, gasGap, doubletR, globalPosition.x(), globalPosition.y(), globalPosition.z(), rpcLayerClusters);
190
191 // clear all the numbers and restart a new cluster
192 lastStrip=(*dig_it).first;
193 theIDs.clear();
194
195 theIDs.push_back((*dig_it).second->identify());
196 globalPosition=descriptor->stripPos((*dig_it).second->identify());
197 }
198
199
200 // if we are at the end, close the custer anyway and fill it with what we have found
201
202 if(count==digits[panelId].size()-1&&theIDs.size()>0){
203 globalPosition=globalPosition*(1/(float)theIDs.size());
204
205 //addCluster to PatFinder
206 ATH_MSG_DEBUG(" ... close the cluster ---> cluster at " << stationName << ", x/y/z = " << globalPosition.x() << "/" << globalPosition.y() << "/" << globalPosition.z());
207
208 (*clusterPatFinder)->addCluster(stationName, stationEta, measphi, gasGap, doubletR, globalPosition.x(), globalPosition.y(), globalPosition.z(), rpcLayerClusters);
209 }
210 count++;
211 }
212 }
213
214}
#define ATH_MSG_DEBUG(x)
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
int count(std::string s, const std::string &regx)
count how many occurances of a regx are in a string
Definition hcg.cxx:146
Eigen::Matrix< double, 3, 1 > Vector3D

◆ buildPatterns()

int TrigL2MuonSA::RpcClusterPreparator::buildPatterns ( const bool doMultiMuon,
const TrigRoiDescriptor * p_roids,
const Muon::RpcPrepDataCollection * rpcCollection,
std::map< Identifier, pattern > & digits ) const

Definition at line 63 of file RpcClusterPreparator.cxx.

67{
68 ATH_MSG_DEBUG("start building patterns of RPC hits for clustering");
69 float deta_thr = 0.1;
70 float dphi_thr = 0.1;
71 float dynamic_add = 0.02;
72 if(doMultiMuon){
73 ATH_MSG_DEBUG("# dynamic search window of RPC");
74 double RoiPhiMin(0);
75 double RoiPhiMax(0);
76 double RoiEtaMin(0);
77 double RoiEtaMax(0);
78 if( !m_recRPCRoiTool->RoIsize(p_roids->roiWord(), RoiEtaMin, RoiEtaMax, RoiPhiMin, RoiPhiMax).isSuccess() ){
79 ATH_MSG_WARNING( "Problem in roiWord decording" );
80 }
81 ATH_MSG_DEBUG( " ... RoI Phi min = " << RoiPhiMin << " RoI Phi max = " << RoiPhiMax << " RoI Eta min = " << RoiEtaMin << " RoI Eta max = " << RoiEtaMax );
82 deta_thr = std::abs( RoiEtaMax - RoiEtaMin )/2. + dynamic_add;
83 dphi_thr = std::abs( std::acos( std::cos( RoiPhiMax - RoiPhiMin ) ) )/2. + dynamic_add;
84 ATH_MSG_DEBUG( "## deta/dphi threshold = " << deta_thr << "/" << dphi_thr);
85 }
86
87 // here we loop over the digits in the collection and fill the patterns
88 Identifier eleId=rpcCollection->identify();
89 // loop over digits in collection
90 ATH_MSG_DEBUG("# select RPC hits around RoI");
91 for( const Muon::RpcPrepData* rpcDigit : *rpcCollection ){
92 const Identifier id=rpcDigit->identify();
93 const int nstrip = m_idHelperSvc->rpcIdHelper().strip(id);
94 const int doubletZ = m_idHelperSvc->rpcIdHelper().doubletZ(id);
95 const int doubletPhi = m_idHelperSvc->rpcIdHelper().doubletPhi(id);
96 const int gasGap = m_idHelperSvc->rpcIdHelper().gasGap(id);
97 const bool measPhi = m_idHelperSvc->rpcIdHelper().measuresPhi(id);
98
99 //select RPC hits around RoI
100 const Amg::Vector3D globalpos = rpcDigit->globalPosition();
101 const double hitx=globalpos.x();
102 const double hity=globalpos.y();
103 const double hitz=globalpos.z();
104
105 const float r2 = hitx*hitx+hity*hity;
106 float phi = std::atan2(hity,hitx);
107 const float l = std::sqrt(hitz*hitz+r2);
108 const float tan = std::sqrt( (l-hitz)/(l+hitz) );
109 const float eta = -std::log(tan);
110 const float deta = std::abs(p_roids->eta() - eta);
111 const float dphi = std::abs(CxxUtils::wrapToPi(p_roids->phi() - phi));
112
113 ATH_MSG_DEBUG( " ... RPC hit deta/dphi frm RoI = " << deta << "/" << dphi << ", x/y/z = " << hitx << "/" << hity << "/" << hitz);
114
115 // use Id of first strip to identify a panel.
116 Identifier panelId=m_idHelperSvc->rpcIdHelper().channelID(eleId,doubletZ,doubletPhi,gasGap,measPhi,1);
117
118 if ( deta<deta_thr && dphi<dphi_thr){
119 if(digits.find(panelId)==digits.end()){ // first hit on this panel
120 pattern newPatt;
121 newPatt[nstrip]=rpcDigit;
122 digits[panelId]=newPatt;
123
124 } else { // use existing pattern
125
126 if(digits[panelId].find(nstrip)==digits[panelId].end()){ // no hits on this strip before
127 digits[panelId][nstrip]=rpcDigit;
128 } else if(digits[panelId][nstrip]->time()> rpcDigit->time()){
129 digits[panelId][nstrip]=rpcDigit; // if more than one digit, keep only the one with lowest time
130 }
131 }
132 }
133 }
134
135 return digits.size();
136}
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_MSG_WARNING(x)
virtual Identifier identify() const override final
virtual double phi() const override final
Methods to retrieve data members.
virtual double eta() const override final
ToolHandle< LVL1::ITrigT1MuonRecRoiTool > m_recRPCRoiTool
std::map< int, const Muon::RpcPrepData *, std::less< int > > pattern
virtual unsigned int roiWord() const override final
std::string find(const std::string &s)
return a remapped string
Definition hcg.cxx:138
time(flags, cells_name, *args, **kw)
T wrapToPi(T phi)
Wrap angle in radians to [-pi, pi].
Definition phihelper.h:24
l
Printing final latex table to .tex output file.

◆ clusteringRPCs()

StatusCode TrigL2MuonSA::RpcClusterPreparator::clusteringRPCs ( const bool doMultiMuon,
const std::vector< const Muon::RpcPrepDataCollection * > & rpcCols,
const TrigRoiDescriptor * p_roids,
const ToolHandle< ClusterPatFinder > * clusterPatFinder,
TrigL2MuonSA::RpcLayerClusters & rpcLayerClusters ) const

Definition at line 35 of file RpcClusterPreparator.cxx.

40{
41
42 // pattern : map<int, Muon::RpcPrepData*, less<int>>
43 std::map<Identifier,pattern> digits;
44 digits.clear();
45
46 for( const Muon::RpcPrepDataCollection* theCollection : rpcCols ){
47
48 if(theCollection->size()>0){
49 // build the patterns
50 if(buildPatterns(doMultiMuon, p_roids, theCollection, digits)){
51 buildClusters(clusterPatFinder, digits, rpcLayerClusters);
52 }
53 }
54 //clear map at each collection
55 digits.clear();
56 }
57 return StatusCode::SUCCESS;
58}
void buildClusters(const ToolHandle< ClusterPatFinder > *clusterPatFinder, std::map< Identifier, pattern > &digits, TrigL2MuonSA::RpcLayerClusters &rpcLayerClusters) const
int buildPatterns(const bool doMultiMuon, const TrigRoiDescriptor *p_roids, const Muon::RpcPrepDataCollection *rpcCollection, std::map< Identifier, pattern > &digits) const
MuonPrepDataCollection< RpcPrepData > RpcPrepDataCollection

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

Definition at line 23 of file RpcClusterPreparator.cxx.

24{
25 ATH_CHECK(m_idHelperSvc.retrieve());
26 ATH_MSG_DEBUG("Retrieved " << m_idHelperSvc);
27 ATH_CHECK( m_recRPCRoiTool.retrieve() );
28
29
30 return StatusCode::SUCCESS;
31}
#define ATH_CHECK
Evaluate an expression and check for errors.

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

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

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

Definition at line 57 of file RpcClusterPreparator.h.

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

◆ m_recRPCRoiTool

ToolHandle<LVL1::ITrigT1MuonRecRoiTool> TrigL2MuonSA::RpcClusterPreparator::m_recRPCRoiTool { this, "TrigT1RPCRecRoiTool", "LVL1::TrigT1RPCRecRoiTool/TrigT1RPCRecRoiTool"}
private

Definition at line 58 of file RpcClusterPreparator.h.

58{ this, "TrigT1RPCRecRoiTool", "LVL1::TrigT1RPCRecRoiTool/TrigT1RPCRecRoiTool"};

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