ATLAS Offline Software
Loading...
Searching...
No Matches
Muon::SimpleSTgcClusterBuilderTool Class Reference

#include <SimpleSTgcClusterBuilderTool.h>

Inheritance diagram for Muon::SimpleSTgcClusterBuilderTool:
Collaboration diagram for Muon::SimpleSTgcClusterBuilderTool:

Public Member Functions

 SimpleSTgcClusterBuilderTool (const std::string &, const std::string &, const IInterface *)
 Default constructor.
virtual ~SimpleSTgcClusterBuilderTool ()=default
 Default destructor.
virtual StatusCode initialize () override
 standard initialize method
StatusCode getClusters (const EventContext &ctx, std::vector< Muon::sTgcPrepData > &&stripsVect, std::vector< std::unique_ptr< Muon::sTgcPrepData > > &clustersVect) const override
 DeclareInterfaceID (Muon::ISTgcClusterBuilderTool, 1, 0)
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

void dumpStrips (std::vector< Muon::sTgcPrepData > &stripsVect, std::vector< Muon::sTgcPrepData * > &clustersVect) const
 private functions
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

Gaudi::Property< double > m_chargeCut {this, "ChargeCut", 0.}
Gaudi::Property< unsigned int > m_maxHoleSize {this, "maxHoleSize", 0}
ServiceHandle< Muon::IMuonIdHelperSvcm_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}
SG::ReadCondHandleKey< NswErrorCalibDatam_uncertCalibKey
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 27 of file SimpleSTgcClusterBuilderTool.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

◆ SimpleSTgcClusterBuilderTool()

Muon::SimpleSTgcClusterBuilderTool::SimpleSTgcClusterBuilderTool ( const std::string & t,
const std::string & n,
const IInterface * p )

Default constructor.

Definition at line 15 of file SimpleSTgcClusterBuilderTool.cxx.

16: AthAlgTool(t,n,p) {}
AthAlgTool()
Default constructor:

◆ ~SimpleSTgcClusterBuilderTool()

virtual Muon::SimpleSTgcClusterBuilderTool::~SimpleSTgcClusterBuilderTool ( )
virtualdefault

Default destructor.

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 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ DeclareInterfaceID()

Muon::ISTgcClusterBuilderTool::DeclareInterfaceID ( Muon::ISTgcClusterBuilderTool ,
1 ,
0  )
inherited

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

◆ dumpStrips()

void SimpleSTgcClusterBuilderTool::dumpStrips ( std::vector< Muon::sTgcPrepData > & stripsVect,
std::vector< Muon::sTgcPrepData * > & clustersVect ) const
private

private functions

sort the strips if needed

Definition at line 127 of file SimpleSTgcClusterBuilderTool.cxx.

127 {
128 ATH_MSG_INFO("====> Dumping all strips: ");
129 for ( const auto& it : stripsVect ) {
130 Identifier stripId = it.identify();
131 ATH_MSG_INFO("Strip identifier: " << m_idHelperSvc->stgcIdHelper().show_to_string(stripId) );
132 }
133
134 ATH_MSG_INFO("Dumping all clusters: ");
135 for ( auto *it : clustersVect ) {
136 Identifier clusterId = it->identify();
137 ATH_MSG_INFO("***> New cluster identifier: " << m_idHelperSvc->stgcIdHelper().show_to_string(clusterId) );
138 ATH_MSG_INFO("Cluster size: " << it->rdoList().size() );
139 ATH_MSG_INFO("List of associated RDO's: ");
140 }
141}
#define ATH_MSG_INFO(x)
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc

◆ 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

◆ getClusters()

StatusCode Muon::SimpleSTgcClusterBuilderTool::getClusters ( const EventContext & ctx,
std::vector< Muon::sTgcPrepData > && stripsVect,
std::vector< std::unique_ptr< Muon::sTgcPrepData > > & clustersVect ) const
overridevirtual

Implements Muon::ISTgcClusterBuilderTool.

Definition at line 29 of file SimpleSTgcClusterBuilderTool.cxx.

31 {
32
33 ATH_MSG_DEBUG("Size of the input vector: " << stripsVect.size());
34
35 if (stripsVect.empty()) return StatusCode::SUCCESS;
36
37
38 // define the identifier hash
39 Identifier chanId = stripsVect.at(0).identify();
40 IdentifierHash hash = m_idHelperSvc->moduleHash(chanId);
41
42 double resolution = Amg::error(stripsVect.at(0).localCovariance(), Trk::locX);
43 bool isStrip = ( m_idHelperSvc->stgcIdHelper().channelType(chanId) == sTgcIdHelper::Strip );
44 ATH_MSG_DEBUG(" channelType " << m_idHelperSvc->stgcIdHelper().channelType(chanId));
45 ATH_MSG_DEBUG(" isStrip: " << isStrip << "Single channel resolution: " << resolution);
46
47 SG::ReadCondHandle<NswErrorCalibData> errorCalibDB{m_uncertCalibKey, ctx};
48 if (!errorCalibDB.isValid()) {
49 ATH_MSG_FATAL("Failed to retrieve the parameterized errors "<<m_uncertCalibKey.fullKey());
50 return StatusCode::FAILURE;
51 }
52
53 Muon::STgcClusterBuilderCommon stgcClusterCommon(m_idHelperSvc->stgcIdHelper(), **errorCalibDB);
54 std::array<std::vector<Muon::sTgcPrepData>, 8> stgcPrdsPerLayer = stgcClusterCommon.sortSTGCPrdPerLayer(std::move(stripsVect));
55
56 for (std::vector<Muon::sTgcPrepData>& layPrds : stgcPrdsPerLayer) {
57 // Get the strip clusters of the layer.
58 std::vector<std::vector<Muon::sTgcPrepData>> layerClusters = stgcClusterCommon.findStripCluster(std::move(layPrds),
60
61 // Loop on the clusters of that gap
62 for (const std::vector<Muon::sTgcPrepData>& cluster: layerClusters) {
63 if (cluster.empty()) continue;
64
65 // Calculate the cluster position and error using the weighted average
66 std::optional<Muon::STgcClusterPosition> optClusterPos = stgcClusterCommon.weightedAverage(cluster, resolution, isStrip);
67 if (!optClusterPos) {
68 if (msgLvl(MSG::VERBOSE)) {
69 std::stringstream sstr{};
70 for (const Muon::sTgcPrepData& prd : cluster) {
71 sstr << m_idHelperSvc->toString(prd.identify())
72 << ", local pos: "<< Amg::toString(prd.localPosition(), 2)
73 << "), charge: " << prd.charge() << ", time: " << static_cast<int>(prd.time())
74 << std::endl;
75 }
76 ATH_MSG_VERBOSE("Reject invalid cluster..." << std::endl << std::endl << sstr.str());
77 }
78 continue;
79 }
80
81 Identifier clusterId = (*optClusterPos).getClusterId();
82 double posY = cluster[0].localPosition().y();
83 Amg::Vector2D localPosition((*optClusterPos).getMeanPosition(), posY);
84 auto covN = Amg::MatrixX(1,1);
85 covN(0,0) = (*optClusterPos).getErrorSquared();
86
87 std::vector<Identifier> rdoList;
88 std::vector<int> elementsCharge;
89 std::vector<short int> elementsTime;
90 std::vector<uint16_t> elementsChannel;
91 for (const Muon::sTgcPrepData& prd : cluster ) {
92 rdoList.push_back(prd.identify());
93 elementsCharge.push_back(prd.charge());
94 elementsChannel.push_back(m_idHelperSvc->stgcIdHelper().channel(prd.identify()));
95 elementsTime.push_back(prd.time());
96 }
97
98 // memory allocated dynamically for the PrepRawData is managed by Event Store in the converters
99 ATH_MSG_DEBUG("error on cluster " << std::sqrt((covN)(0,0)));
100
101 std::unique_ptr<sTgcPrepData> prdN = std::make_unique<sTgcPrepData>(
102 clusterId,
103 hash,
104 std::move(localPosition),
105 std::move(rdoList),
106 std::move(covN),
107 cluster.at(0).detectorElement(),
108 std::accumulate(elementsCharge.begin(), elementsCharge.end(), 0),
109 (short int)0,
110 std::move(elementsChannel),
111 std::move(elementsTime),
112 std::move(elementsCharge));
113
115 clustersVect.push_back(std::move(prdN));
116 }
117 }
118
119 ATH_MSG_DEBUG("Size of the output cluster vector: " << clustersVect.size());
120
121 return StatusCode::SUCCESS;
122}
#define ATH_MSG_FATAL(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_DEBUG(x)
bool msgLvl(const MSG::Level lvl) const
SG::ReadCondHandleKey< NswErrorCalibData > m_uncertCalibKey
Gaudi::Property< unsigned int > m_maxHoleSize
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
double error(const Amg::MatrixX &mat, int index)
return diagonal error of the matrix caller should ensure the matrix is symmetric and the index is in ...
Eigen::Matrix< double, 2, 1 > Vector2D
double resolution[nGasTypes][nParametersResolution]
@ locX
Definition ParamDefs.h:37

◆ initialize()

StatusCode Muon::SimpleSTgcClusterBuilderTool::initialize ( )
overridevirtual

standard initialize method

Definition at line 20 of file SimpleSTgcClusterBuilderTool.cxx.

20 {
21 ATH_CHECK( m_idHelperSvc.retrieve() );
22 ATH_CHECK(m_uncertCalibKey.initialize());
23 return StatusCode::SUCCESS;
24}
#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_chargeCut

Gaudi::Property<double> Muon::SimpleSTgcClusterBuilderTool::m_chargeCut {this, "ChargeCut", 0.}
private

Definition at line 46 of file SimpleSTgcClusterBuilderTool.h.

46{this, "ChargeCut", 0.};

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

Definition at line 49 of file SimpleSTgcClusterBuilderTool.h.

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

◆ m_maxHoleSize

Gaudi::Property<unsigned int> Muon::SimpleSTgcClusterBuilderTool::m_maxHoleSize {this, "maxHoleSize", 0}
private

Definition at line 47 of file SimpleSTgcClusterBuilderTool.h.

47{this, "maxHoleSize", 0};

◆ m_uncertCalibKey

SG::ReadCondHandleKey<NswErrorCalibData> Muon::SimpleSTgcClusterBuilderTool::m_uncertCalibKey
private
Initial value:
{this, "ErrorCalibKey", "NswUncertData",
"Key of the parametrized NSW uncertainties"}

Definition at line 51 of file SimpleSTgcClusterBuilderTool.h.

51 {this, "ErrorCalibKey", "NswUncertData",
52 "Key of the parametrized NSW uncertainties"};

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