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

#include <TgcPrepDataReplicationTool3BCtoAllBC.h>

Inheritance diagram for Muon::TgcPrepDataReplicationTool3BCtoAllBC:
Collaboration diagram for Muon::TgcPrepDataReplicationTool3BCtoAllBC:

Public Member Functions

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

Private Types

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

Private Member Functions

StatusCode convert3BCtoAllBC (const EventContext &ctx) const

Private Attributes

ServiceHandle< Muon::IMuonIdHelperSvcm_idHelperSvc
SG::ReadHandleKeyArray< TgcPrepDataContainerm_3BCKeys
SG::WriteHandleKey< TgcPrepDataContainerm_AllBCKey

Detailed Description

Definition at line 16 of file TgcPrepDataReplicationTool3BCtoAllBC.h.

Member Enumeration Documentation

◆ anonymous enum

Constructor & Destructor Documentation

◆ TgcPrepDataReplicationTool3BCtoAllBC()

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

Constructor.

Definition at line 13 of file TgcPrepDataReplicationTool3BCtoAllBC.cxx.

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

◆ ~TgcPrepDataReplicationTool3BCtoAllBC()

virtual Muon::TgcPrepDataReplicationTool3BCtoAllBC::~TgcPrepDataReplicationTool3BCtoAllBC ( )
virtualdefault

Destructor.

Member Function Documentation

◆ convert3BCtoAllBC()

StatusCode Muon::TgcPrepDataReplicationTool3BCtoAllBC::convert3BCtoAllBC ( const EventContext & ctx) const
private

Definition at line 41 of file TgcPrepDataReplicationTool3BCtoAllBC.cxx.

42 {
43
44 SG::WriteHandle<TgcPrepDataContainer> tgcPrepDataContainerAll(m_AllBCKey,
45 ctx);
47 tgcPrepDataContainerAll.record(std::make_unique<TgcPrepDataContainer>(
48 m_idHelperSvc->tgcIdHelper().module_hash_max())));
49
50 auto tgc3BCs = m_3BCKeys.makeHandles(ctx);
51
52 // convert
53 int ibc{0};
54 for (SG::ReadHandle<TgcPrepDataContainer>& handle :
55 m_3BCKeys.makeHandles(ctx)) {
56 uint16_t bcBitMap = 0;
57 if (ibc == BC_PREVIOUS) {
59 } else if (ibc == BC_CURRENT) {
61 } else if (ibc == BC_NEXT) {
62 bcBitMap = TgcPrepData::BCBIT_NEXT;
63 }
64 ++ibc;
65
66 if (!handle.isValid()) {
67 ATH_MSG_FATAL("Cannot retrieve " << handle.key());
68 return StatusCode::FAILURE;
69 }
70 for (const Muon::TgcPrepDataCollection* coll : *handle) {
71
72 for (const Muon::TgcPrepData* to_copy : *coll) {
73 const Identifier channelId = to_copy->identify();
74 const Identifier elementId =
75 m_idHelperSvc->tgcIdHelper().elementID(channelId);
76
77 Muon::TgcPrepDataCollection* collection =
78 Muon::IDC_Helper::getCollection<TgcPrepDataContainer,
79 TgcIdHelper>(
80 elementId, tgcPrepDataContainerAll.ptr(),
81 m_idHelperSvc->tgcIdHelper(), msg());
82
84 std::find_if(collection->begin(), collection->end(),
85 [&channelId](const TgcPrepData* duplicate) {
86 return channelId == duplicate->identify();
87 });
88 if (duplicateInAllBCs != collection->end()) {
89 TgcPrepData* prd = *duplicateInAllBCs;
90 prd->setBcBitMap(prd->getBcBitMap() | bcBitMap);
91 } else {
92 Muon::TgcPrepData* newPrepData =
94 to_copy, bcBitMap);
95 newPrepData->setHashAndIndex(collection->identifyHash(),
96 collection->size());
97 collection->push_back(newPrepData);
98 }
99 }
100 }
101 }
102
103 return StatusCode::SUCCESS;
104}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_FATAL(x)
value_type push_back(value_type pElem)
DataModel_detail::iterator< DataVector > iterator
Definition DataVector.h:842
const_iterator end() const noexcept
const_iterator begin() const noexcept
size_type size() const noexcept
virtual IdentifierHash identifyHash() const override final
SG::WriteHandleKey< TgcPrepDataContainer > m_AllBCKey
SG::ReadHandleKeyArray< TgcPrepDataContainer > m_3BCKeys
static TgcPrepData * makeTgcPrepData(const TgcPrepData *to_copy, uint16_t bcBitMap)
Make new TgcPrepData.
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::TgcPrepDataReplicationTool3BCtoAllBC::initialize ( )
overridevirtual

Definition at line 20 of file TgcPrepDataReplicationTool3BCtoAllBC.cxx.

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

◆ replicate()

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

Definition at line 36 of file TgcPrepDataReplicationTool3BCtoAllBC.cxx.

37 {
38 return convert3BCtoAllBC(ctx);
39}
StatusCode convert3BCtoAllBC(const EventContext &ctx) const

Member Data Documentation

◆ m_3BCKeys

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

Definition at line 38 of file TgcPrepDataReplicationTool3BCtoAllBC.h.

38 {
39 this, "BC3Keys", {"dummy", "dummy", "dummy"}};

◆ m_AllBCKey

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

Definition at line 40 of file TgcPrepDataReplicationTool3BCtoAllBC.h.

40 {
41 this, "AllBCKey", "TGC_MeasurementsAllBCs"};

◆ m_idHelperSvc

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

Definition at line 35 of file TgcPrepDataReplicationTool3BCtoAllBC.h.

35 {
36 this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};

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