ATLAS Offline Software
Loading...
Searching...
No Matches
MuonR4::TgcDigitToPrepDataCnvTool Class Reference

Conversion tool from Tgc digits -> Tgc xAOD uncalibrated measurements. More...

#include <TgcDigitToPrepDataCnvTool.h>

Inheritance diagram for MuonR4::TgcDigitToPrepDataCnvTool:
Collaboration diagram for MuonR4::TgcDigitToPrepDataCnvTool:

Public Member Functions

StatusCode initialize () override final
StatusCode decode (const EventContext &ctx, const std::vector< IdentifierHash > &idVect) const override final
StatusCode decode (const EventContext &ctx, const std::vector< uint32_t > &robIds) const override final
 not implemented...
StatusCode provideEmptyContainer (const EventContext &ctx) const override final

Private Attributes

ServiceHandle< Muon::IMuonIdHelperSvcm_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}
SG::ReadHandleKey< TgcDigitContainerm_readKey {this, "ReadKey", "TGC_DIGITS", "Digit container to retrieve"}
SG::WriteHandleKey< xAOD::TgcStripContainerm_writeKey {this, "WriteKey", "xTgcStrips", "Output container"}
Gaudi::Property< bool > m_convertAllBCs {this, "convertAllBCs", true}
 Convert hits from all bunch crossings.
const MuonGMR4::MuonDetectorManagerm_detMgr {}

Detailed Description

Conversion tool from Tgc digits -> Tgc xAOD uncalibrated measurements.

The tool shall be seen as a placeholder for the actual RDO -> prepdata conversion tool used in Phase-II which does not exist yet.

Definition at line 25 of file TgcDigitToPrepDataCnvTool.h.

Member Function Documentation

◆ decode() [1/2]

StatusCode MuonR4::TgcDigitToPrepDataCnvTool::decode ( const EventContext & ctx,
const std::vector< IdentifierHash > & idVect ) const
finaloverride

Definition at line 39 of file TgcDigitToPrepDataCnvTool.cxx.

40 {
41 const TgcDigitContainer* digitContainer{nullptr};
42 ATH_CHECK(SG::get(digitContainer, m_readKey, ctx));
43
44 SG::WriteHandle writeHandle{m_writeKey, ctx};
45 ATH_CHECK(writeHandle.record(std::make_unique<xAOD::TgcStripContainer>(),
46 std::make_unique<xAOD::TgcStripAuxContainer>()));
47
48 const TgcIdHelper& idHelper{m_idHelperSvc->tgcIdHelper()};
49 for (const TgcDigitCollection* coll : *digitContainer) {
50 if (!idVect.empty() && !Acts::rangeContainsValue(idVect, coll->identifierHash())) {
51 ATH_MSG_VERBOSE("Do not encode measurements from "<<
52 m_idHelperSvc->toStringChamber(coll->identify()));
53 continue;
54 }
55 const MuonGMR4::TgcReadoutElement* reEle = m_detMgr->getTgcReadoutElement(coll->identify());
56 const std::size_t nPrdBefore = writeHandle->size();
57 for (const TgcDigit* digit : *coll) {
58 // Check whether the same channel has been fired but under different BC tag
59 xAOD::TgcStripContainer::iterator sameHitOtherBC =
60 std::find_if(writeHandle->begin() + nPrdBefore, writeHandle->end(), [digit](const xAOD::TgcStrip* prd) {
61 return prd->identify() == digit->identify();
62 });
63 const std::uint16_t bcTag = translateBC(digit->bcTag());
65 continue;
66 }
67 if (sameHitOtherBC != writeHandle->end()) {
68 xAOD::TgcStrip* updateMe{*sameHitOtherBC};
69 updateMe->setBcBitMap(updateMe->bcBitMap() | bcTag);
70 continue;
71 }
72 xAOD::TgcStrip* newStrip = writeHandle->push_back(std::make_unique<xAOD::TgcStrip>());
73
74 newStrip->setBcBitMap(bcTag);
75 newStrip->setChannelNumber(idHelper.channel(digit->identify()));
76 newStrip->setGasGap(idHelper.gasGap(digit->identify()));
77 newStrip->setMeasuresPhi(idHelper.measuresPhi(digit->identify()));
78 newStrip->setReadoutElement(reEle);
79
80
81 const Amg::Vector3D measPos = reEle->sensorLayout(newStrip->layerHash())
82 ->localStripPosition(newStrip->channelNumber(),
83 newStrip->measuresPhi());
84 xAOD::MeasVector<1> locPos{xAOD::MeasVector<1>::Zero()};
85 xAOD::MeasMatrix<1> locCov{xAOD::MeasVector<1>::Identity()};
86
87 if (newStrip->measuresPhi()) {
88 locPos[0] = measPos[1];
89 const auto& radDesign = reEle->stripLayout(newStrip->measurementHash());
90 locCov(0,0) = Acts::square(radDesign.stripPitch(newStrip->channelNumber())) / 12.;
91 } else {
92 locPos[0] = measPos[0];
93 const auto& wireDesign = reEle->wireGangLayout(newStrip->measurementHash());
94 locCov(0,0) = Acts::square(wireDesign.stripPitch() *
95 wireDesign.numWiresInGroup(newStrip->channelNumber())) / 12.;
96 }
97
98 ATH_MSG_VERBOSE("Convert new "<<m_idHelperSvc->toString(newStrip->identify())
99 <<" @ "<<Amg::toString(measPos)<<" 1D: "<<locPos[0]
100 <<" with covariance "<<locCov(0,0));
101 newStrip->setMeasurement(reEle->identHash(), locPos, locCov);
102 }
103 }
104 ATH_MSG_DEBUG("Recorded in total "<<writeHandle->size()<<" measurements.");
105 return StatusCode::SUCCESS;
106 }
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_DEBUG(x)
unsigned bcTag(unsigned bcBitMap)
DataModel_detail::iterator< DataVector > iterator
Definition DataVector.h:842
IdentifierHash identHash() const
Returns the hash of the readout element which is identical to the detector element hash provided by t...
const StripLayerPtr & sensorLayout(const IdentifierHash &hash) const
Returns the pointer to the strip layer associated with the gas gap.
const RadialStripDesign & stripLayout(const IdentifierHash &layHash) const
Returns access to the strip design of the given gasGap [1-3] If the gap does not have strips an excep...
const WireGroupDesign & wireGangLayout(const IdentifierHash &layHash) const
Returns access to the wire group design of the given gasGap [1-3] If the gap does not have a wires an...
Gaudi::Property< bool > m_convertAllBCs
Convert hits from all bunch crossings.
const MuonGMR4::MuonDetectorManager * m_detMgr
SG::ReadHandleKey< TgcDigitContainer > m_readKey
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
SG::WriteHandleKey< xAOD::TgcStripContainer > m_writeKey
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
int channel(const Identifier &id) const override
int gasGap(const Identifier &id) const override
get the hashes
bool measuresPhi(const Identifier &id) const override
const Identifier & identify() const
Returns the Athena identifier of the measurement.
void setReadoutElement(const MuonGMR4::TgcReadoutElement *readoutEle)
set the pointer to the TgcReadoutElement
std::uint16_t channelNumber() const
Strip or wire group number of the Tgc strip measurement.
void setChannelNumber(std::uint16_t chan)
Set the strip or wire group number of the measurement.
void setMeasuresPhi(std::uint8_t measPhi)
Set the measures phi flag of the measurement to true /false.
void setGasGap(uint8_t gapNum)
Set the gas gap number of the measurement [1-N].
IdentifierHash measurementHash() const override final
Returns the hash of the measurement channel.
IdentifierHash layerHash() const override final
Returns the hash of the associated layer (Needed for surface retrieval).
std::uint8_t bcBitMap() const
Returns the bcBitMap of this PRD bit2 for Previous BC, bit1 for Current BC, bit0 for Next BC.
void setBcBitMap(std::uint8_t bitMap)
Set the bunch crossing-id map.
std::uint8_t measuresPhi() const override final
Does the object belong to an eta or a phi measurement (si /no).
void setMeasurement(const DetectorIDHashType idHash, MeasVector< N > locPos, MeasMatrix< N > locCov)
Sets IdentifierHash, local position and local covariance of the measurement.
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
Eigen::Matrix< double, 3, 1 > Vector3D
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
Eigen::Matrix< float, N, N > MeasMatrix
Eigen::Matrix< float, N, 1 > MeasVector
Abrivation of the Matrix & Covariance definitions.
TgcStrip_v1 TgcStrip
Definition TgcStripFwd.h:9

◆ decode() [2/2]

StatusCode MuonR4::TgcDigitToPrepDataCnvTool::decode ( const EventContext & ctx,
const std::vector< uint32_t > & robIds ) const
finaloverride

not implemented...

Definition at line 107 of file TgcDigitToPrepDataCnvTool.cxx.

108 {
109 ATH_MSG_ERROR("Decoding with ROBs not implemented.");
110 return StatusCode::FAILURE;
111 }
#define ATH_MSG_ERROR(x)

◆ initialize()

StatusCode MuonR4::TgcDigitToPrepDataCnvTool::initialize ( )
finaloverride

Definition at line 32 of file TgcDigitToPrepDataCnvTool.cxx.

32 {
33 ATH_CHECK(m_idHelperSvc.retrieve());
34 ATH_CHECK(m_readKey.initialize());
35 ATH_CHECK(m_writeKey.initialize());
36 ATH_CHECK(detStore()->retrieve(m_detMgr));
37 return StatusCode::SUCCESS;
38 }

◆ provideEmptyContainer()

StatusCode MuonR4::TgcDigitToPrepDataCnvTool::provideEmptyContainer ( const EventContext & ctx) const
finaloverride

Definition at line 112 of file TgcDigitToPrepDataCnvTool.cxx.

112 {
113 SG::WriteHandle writeHandle{m_writeKey, ctx};
114 ATH_CHECK(writeHandle.record(std::make_unique<xAOD::TgcStripContainer>(),
115 std::make_unique<xAOD::TgcStripAuxContainer>()));
116 return StatusCode::SUCCESS;
117 }

Member Data Documentation

◆ m_convertAllBCs

Gaudi::Property<bool> MuonR4::TgcDigitToPrepDataCnvTool::m_convertAllBCs {this, "convertAllBCs", true}
private

Convert hits from all bunch crossings.

If false only the current BC is converted

Definition at line 48 of file TgcDigitToPrepDataCnvTool.h.

48{this, "convertAllBCs", true};

◆ m_detMgr

const MuonGMR4::MuonDetectorManager* MuonR4::TgcDigitToPrepDataCnvTool::m_detMgr {}
private

Definition at line 50 of file TgcDigitToPrepDataCnvTool.h.

50{};

◆ m_idHelperSvc

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

Definition at line 40 of file TgcDigitToPrepDataCnvTool.h.

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

◆ m_readKey

SG::ReadHandleKey<TgcDigitContainer> MuonR4::TgcDigitToPrepDataCnvTool::m_readKey {this, "ReadKey", "TGC_DIGITS", "Digit container to retrieve"}
private

Definition at line 42 of file TgcDigitToPrepDataCnvTool.h.

42{this, "ReadKey", "TGC_DIGITS", "Digit container to retrieve"};

◆ m_writeKey

SG::WriteHandleKey<xAOD::TgcStripContainer> MuonR4::TgcDigitToPrepDataCnvTool::m_writeKey {this, "WriteKey", "xTgcStrips", "Output container"}
private

Definition at line 44 of file TgcDigitToPrepDataCnvTool.h.

44{this, "WriteKey", "xTgcStrips", "Output container"};

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