ATLAS Offline Software
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
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. More...
 
virtual ~TgcPrepDataReplicationTool3BCtoAllBC ()=default
 Destructor. More...
 
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 {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}
 
SG::ReadHandleKeyArray< TgcPrepDataContainerm_3BCKeys {this, "BC3Keys", {"dummy", "dummy", "dummy"}}
 
SG::WriteHandleKey< TgcPrepDataContainerm_AllBCKey {this, "AllBCKey", "TGC_MeasurementsAllBCs"}
 

Detailed Description

Definition at line 18 of file TgcPrepDataReplicationTool3BCtoAllBC.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private
Enumerator
BC_PREVIOUS 
BC_CURRENT 
BC_NEXT 
BC_ALL 
BC_NUM 

Definition at line 35 of file TgcPrepDataReplicationTool3BCtoAllBC.h.

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.

15  : 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 42 of file TgcPrepDataReplicationTool3BCtoAllBC.cxx.

42  {
43 
44  SG::WriteHandle<TgcPrepDataContainer> tgcPrepDataContainerAll(m_AllBCKey, ctx);
45  ATH_CHECK(tgcPrepDataContainerAll.record(std::make_unique<TgcPrepDataContainer>(m_idHelperSvc->tgcIdHelper().module_hash_max()) ));
46 
47  auto tgc3BCs = m_3BCKeys.makeHandles(ctx);
48 
49  // convert
50  int ibc{0};
51  for (SG::ReadHandle<TgcPrepDataContainer>& handle : m_3BCKeys.makeHandles(ctx)) {
52  uint16_t bcBitMap = 0;
53  if (ibc == BC_PREVIOUS) bcBitMap = TgcPrepData::BCBIT_PREVIOUS;
54  else if (ibc == BC_CURRENT) bcBitMap = TgcPrepData::BCBIT_CURRENT;
55  else if (ibc == BC_NEXT) bcBitMap = TgcPrepData::BCBIT_NEXT;
56  ++ibc;
57 
58  if(!handle.isValid()) {
59  ATH_MSG_FATAL("Cannot retrieve " << handle.key());
60  return StatusCode::FAILURE;
61  }
62  for (const Muon::TgcPrepDataCollection* coll : *handle) {
63 
64  for (const Muon::TgcPrepData* to_copy : *coll) {
65  const Identifier channelId = to_copy->identify();
66  const Identifier elementId = m_idHelperSvc->tgcIdHelper().elementID(channelId);
67 
68  Muon::TgcPrepDataCollection* collection = Muon::IDC_Helper::getCollection<TgcPrepDataContainer, TgcIdHelper>
69  (elementId, tgcPrepDataContainerAll.ptr(), m_idHelperSvc->tgcIdHelper(), msg());
70 
71  Muon::TgcPrepDataCollection::iterator duplicateInAllBCs =
72  std::find_if(collection->begin(),collection->end(),[&channelId](const TgcPrepData* duplicate){
73  return channelId == duplicate->identify();
74  });
75  if(duplicateInAllBCs != collection->end()) {
76  TgcPrepData *prd = *duplicateInAllBCs;
77  prd->setBcBitMap(prd->getBcBitMap() | bcBitMap);
78  } else {
80  newPrepData->setHashAndIndex(collection->identifyHash(), collection->size());
81  collection->push_back(newPrepData);
82  }
83  }
84  }
85  }
86 
87  return StatusCode::SUCCESS;
88 }

◆ initialize()

StatusCode Muon::TgcPrepDataReplicationTool3BCtoAllBC::initialize ( )
overridevirtual

Definition at line 18 of file TgcPrepDataReplicationTool3BCtoAllBC.cxx.

19 {
21  ATH_CHECK(m_idHelperSvc.retrieve());
22 
23  for(int ibc = 0; ibc < BC_ALL; ibc++) {
24  std::ostringstream location;
25  location << "TGC_Measurements"
26  << (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 
34  return StatusCode::SUCCESS;
35 }

◆ replicate()

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

Definition at line 37 of file TgcPrepDataReplicationTool3BCtoAllBC.cxx.

38 {
39  return convert3BCtoAllBC(ctx);
40 }

Member Data Documentation

◆ m_3BCKeys

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

Definition at line 39 of file TgcPrepDataReplicationTool3BCtoAllBC.h.

◆ m_AllBCKey

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

Definition at line 40 of file TgcPrepDataReplicationTool3BCtoAllBC.h.

◆ m_idHelperSvc

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

Definition at line 37 of file TgcPrepDataReplicationTool3BCtoAllBC.h.


The documentation for this class was generated from the following files:
Muon::TgcPrepDataReplicationTool3BCtoAllBC::BC_CURRENT
@ BC_CURRENT
Definition: TgcPrepDataReplicationTool3BCtoAllBC.h:35
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
Trk::PrepRawDataType::TgcPrepData
@ TgcPrepData
Muon::TgcPrepDataReplicationTool3BCtoAllBC::BC_ALL
@ BC_ALL
Definition: TgcPrepDataReplicationTool3BCtoAllBC.h:35
Muon::TgcPrepDataReplicationTool3BCtoAllBC::BC_PREVIOUS
@ BC_PREVIOUS
Definition: TgcPrepDataReplicationTool3BCtoAllBC.h:35
Muon::TgcPrepData::BCBIT_PREVIOUS
@ BCBIT_PREVIOUS
Definition: TgcPrepData.h:97
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
initialize
void initialize()
Definition: run_EoverP.cxx:894
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
Muon::TgcPrepDataReplicationTool3BCtoAllBC::BC_NUM
@ BC_NUM
Definition: TgcPrepDataReplicationTool3BCtoAllBC.h:35
Muon::TgcPrepData::BCBIT_CURRENT
@ BCBIT_CURRENT
Definition: TgcPrepData.h:97
Muon::TgcPrepDataReplicationTool3BCtoAllBC::m_AllBCKey
SG::WriteHandleKey< TgcPrepDataContainer > m_AllBCKey
Definition: TgcPrepDataReplicationTool3BCtoAllBC.h:40
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
Muon::MuonPrepDataCollection::identifyHash
virtual IdentifierHash identifyHash() const override final
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:88
DataModel_detail::iterator
(Non-const) Iterator class for DataVector/DataList.
Definition: DVLIterator.h:184
Trk::PrepRawData::setHashAndIndex
void setHashAndIndex(unsigned short collHash, unsigned short objIndex)
TEMP for testing: might make some classes friends later ...
beamspotman.n
n
Definition: beamspotman.py:731
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
Muon::TgcPrepData::BCBIT_NEXT
@ BCBIT_NEXT
Definition: TgcPrepData.h:97
Muon::MuonPrepDataCollection
Template to hold collections of MuonPrepRawData objects.
Definition: MuonPrepDataCollection.h:46
CaloCondBlobAlgs_fillNoiseFromASCII.channelId
channelId
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:122
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
Muon::TgcPrepDataReplicationToolAllBCto3BC::makeTgcPrepData
static TgcPrepData * makeTgcPrepData(const TgcPrepData *to_copy, uint16_t bcBitMap)
Make new TgcPrepData.
Definition: TgcPrepDataReplicationToolAllBCto3BC.cxx:90
Muon::TgcPrepDataReplicationTool3BCtoAllBC::BC_NEXT
@ BC_NEXT
Definition: TgcPrepDataReplicationTool3BCtoAllBC.h:35
Muon::TgcPrepDataReplicationTool3BCtoAllBC::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: TgcPrepDataReplicationTool3BCtoAllBC.h:37
Muon::TgcPrepDataReplicationTool3BCtoAllBC::m_3BCKeys
SG::ReadHandleKeyArray< TgcPrepDataContainer > m_3BCKeys
Definition: TgcPrepDataReplicationTool3BCtoAllBC.h:39
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
Muon::TgcPrepData
Class to represent TGC measurements.
Definition: TgcPrepData.h:32
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
Muon::TgcPrepDataReplicationTool3BCtoAllBC::convert3BCtoAllBC
StatusCode convert3BCtoAllBC(const EventContext &ctx) const
Definition: TgcPrepDataReplicationTool3BCtoAllBC.cxx:42
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
Identifier
Definition: IdentifierFieldParser.cxx:14