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

#include <TgcPrepDataReplicationToolAllBCto3BC.h>

Inheritance diagram for Muon::TgcPrepDataReplicationToolAllBCto3BC:
Collaboration diagram for Muon::TgcPrepDataReplicationToolAllBCto3BC:

Public Member Functions

 TgcPrepDataReplicationToolAllBCto3BC (const std::string &t, const std::string &n, const IInterface *p)
 Constructor.
virtual ~TgcPrepDataReplicationToolAllBCto3BC ()=default
 Destructor.
virtual StatusCode initialize () override
virtual StatusCode replicate (const EventContext &ctx) const override

Static Public Member Functions

static TgcPrepDatamakeTgcPrepData (const TgcPrepData *to_copy, uint16_t bcBitMap)
 Make new TgcPrepData.

Private Types

enum  {
  BC_PREVIOUS = 0 , BC_CURRENT , BC_NEXT , BC_ALL ,
  BC_NUM
}

Private Member Functions

StatusCode convertAllBCto3BC (const EventContext &ctx) const

Private Attributes

ServiceHandle< Muon::IMuonIdHelperSvcm_idHelperSvc
SG::WriteHandleKeyArray< TgcPrepDataContainerm_3BCKeys
SG::ReadHandleKey< TgcPrepDataContainerm_AllBCKey

Detailed Description

Definition at line 16 of file TgcPrepDataReplicationToolAllBCto3BC.h.

Member Enumeration Documentation

◆ anonymous enum

Constructor & Destructor Documentation

◆ TgcPrepDataReplicationToolAllBCto3BC()

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

Constructor.

Definition at line 12 of file TgcPrepDataReplicationToolAllBCto3BC.cxx.

16 : base_class(t, n, p) {}

◆ ~TgcPrepDataReplicationToolAllBCto3BC()

virtual Muon::TgcPrepDataReplicationToolAllBCto3BC::~TgcPrepDataReplicationToolAllBCto3BC ( )
virtualdefault

Destructor.

Member Function Documentation

◆ convertAllBCto3BC()

StatusCode Muon::TgcPrepDataReplicationToolAllBCto3BC::convertAllBCto3BC ( const EventContext & ctx) const
private

Definition at line 40 of file TgcPrepDataReplicationToolAllBCto3BC.cxx.

41 {
42
43 SG::ReadHandle<TgcPrepDataContainer> tgcAll{m_AllBCKey, ctx};
44
45 if (!tgcAll.isValid()) {
46 ATH_MSG_FATAL("Cannot retrieve TGC_MeasurementsAllBCs");
47 return StatusCode::FAILURE;
48 }
49
50 // convert
51 auto tgc3BCHandles = m_3BCKeys.makeHandles(ctx);
52 for (int ibc = 0; ibc < BC_ALL; ibc++) {
53 tgc3BCHandles.at(ibc) = std::make_unique<TgcPrepDataContainer>(
54 m_idHelperSvc->tgcIdHelper().module_hash_max());
55 }
56
57 for (const Muon::TgcPrepDataCollection* coll : *tgcAll) {
58 for (const Muon::TgcPrepData* to_copy : *coll) {
59
60 uint16_t bcBitMap = to_copy->getBcBitMap();
61 std::array<uint16_t, BC_NUM> hasBC{0};
62 if (bcBitMap & TgcPrepData::BCBIT_PREVIOUS) {
64 }
65 if (bcBitMap & TgcPrepData::BCBIT_CURRENT) {
67 }
68 if (bcBitMap & TgcPrepData::BCBIT_NEXT) {
70 }
71
72 const Identifier channelId = to_copy->identify();
73 const Identifier elementId =
74 m_idHelperSvc->tgcIdHelper().elementID(channelId);
75 std::array<Muon::TgcPrepDataCollection*, BC_ALL> collections{};
76 for (int ibc = 0; ibc < BC_ALL; ibc++) {
77 collections[ibc] =
78 Muon::IDC_Helper::getCollection<TgcPrepDataContainer,
79 TgcIdHelper>(
80 elementId, tgc3BCHandles[ibc].ptr(),
81 m_idHelperSvc->tgcIdHelper(), msg());
82
83 if (!hasBC[ibc]) {
84 continue;
85 }
86 Muon::TgcPrepData* newPrepData =
87 makeTgcPrepData(to_copy, hasBC[ibc]);
88 newPrepData->setHashAndIndex(collections[ibc]->identifyHash(),
89 collections[ibc]->size());
90 collections[ibc]->push_back(newPrepData);
91 }
92 }
93 }
94
95 return StatusCode::SUCCESS;
96}
#define ATH_MSG_FATAL(x)
static TgcPrepData * makeTgcPrepData(const TgcPrepData *to_copy, uint16_t bcBitMap)
Make new TgcPrepData.
SG::WriteHandleKeyArray< TgcPrepDataContainer > m_3BCKeys
virtual bool isValid() override final
Can the handle be successfully dereferenced?
void setHashAndIndex(unsigned short collHash, unsigned short objIndex)
TEMP for testing: might make some classes friends later ...
MuonPrepDataCollection< TgcPrepData > TgcPrepDataCollection
MuonPrepDataContainerT< TgcPrepData > TgcPrepDataContainer
setWord1 uint16_t
MsgStream & msg
Definition testRead.cxx:32

◆ initialize()

StatusCode Muon::TgcPrepDataReplicationToolAllBCto3BC::initialize ( )
overridevirtual

Definition at line 19 of file TgcPrepDataReplicationToolAllBCto3BC.cxx.

19 {
20 ATH_CHECK(m_idHelperSvc.retrieve());
21
22 for (int ibc = 0; ibc < BC_ALL; ibc++) {
23 std::ostringstream location;
24 location << "TGC_Measurements" << (ibc == BC_PREVIOUS ? "PriorBC" : "")
25 << (ibc == BC_NEXT ? "NextBC" : "");
26 m_3BCKeys.at(ibc) = location.str();
27 }
28
29 ATH_CHECK(m_3BCKeys.initialize());
30 ATH_CHECK(m_AllBCKey.initialize());
31
32 return StatusCode::SUCCESS;
33}
#define ATH_CHECK
Evaluate an expression and check for errors.

◆ makeTgcPrepData()

Muon::TgcPrepData * Muon::TgcPrepDataReplicationToolAllBCto3BC::makeTgcPrepData ( const TgcPrepData * to_copy,
uint16_t bcBitMap )
static

Make new TgcPrepData.

Definition at line 98 of file TgcPrepDataReplicationToolAllBCto3BC.cxx.

99 {
100 Identifier channelId = to_copy->identify();
101 IdentifierHash tgcHashId = to_copy->collectionHash();
102 const std::vector<Identifier>& identifierList = to_copy->rdoList();
103 const Amg::MatrixX& newErrHitPos{to_copy->localCovariance()};
104 const MuonGM::TgcReadoutElement* descriptor = to_copy->detectorElement();
105 Muon::TgcPrepData* newPrepData =
106 new TgcPrepData(channelId, tgcHashId, to_copy->localPosition(),
107 identifierList, newErrHitPos, descriptor);
108 newPrepData->setBcBitMap(bcBitMap);
109
110 return newPrepData;
111}
void setBcBitMap(const uint16_t)
set the bcBitMap for this PRD
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.

◆ replicate()

StatusCode Muon::TgcPrepDataReplicationToolAllBCto3BC::replicate ( const EventContext & ctx) const
overridevirtual

Definition at line 35 of file TgcPrepDataReplicationToolAllBCto3BC.cxx.

36 {
37 return convertAllBCto3BC(ctx);
38}
StatusCode convertAllBCto3BC(const EventContext &ctx) const

Member Data Documentation

◆ m_3BCKeys

SG::WriteHandleKeyArray<TgcPrepDataContainer> Muon::TgcPrepDataReplicationToolAllBCto3BC::m_3BCKeys
private
Initial value:
{
this, "BC3Keys", {"dummy", "dummy", "dummy"}}

Definition at line 43 of file TgcPrepDataReplicationToolAllBCto3BC.h.

43 {
44 this, "BC3Keys", {"dummy", "dummy", "dummy"}};

◆ m_AllBCKey

SG::ReadHandleKey<TgcPrepDataContainer> Muon::TgcPrepDataReplicationToolAllBCto3BC::m_AllBCKey
private
Initial value:
{
this, "AllBCKey", "TGC_MeasurementsAllBCs"}

Definition at line 45 of file TgcPrepDataReplicationToolAllBCto3BC.h.

45 {
46 this, "AllBCKey", "TGC_MeasurementsAllBCs"};

◆ m_idHelperSvc

ServiceHandle<Muon::IMuonIdHelperSvc> Muon::TgcPrepDataReplicationToolAllBCto3BC::m_idHelperSvc
private
Initial value:
{
this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}

Definition at line 40 of file TgcPrepDataReplicationToolAllBCto3BC.h.

40 {
41 this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};

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