ATLAS Offline Software
Public Member Functions | Public Attributes | List of all members
Muon::MdtRdoToPrepDataToolMT::ConvCache Struct Reference

Helper struct to parse the event data around the tool. More...

#include <MdtRdoToPrepDataToolMT.h>

Collaboration diagram for Muon::MdtRdoToPrepDataToolMT::ConvCache:

Public Member Functions

 ConvCache (const Muon::IMuonIdHelperSvc *idHelperSvc)
 
MdtPrepDataCollectioncreateCollection (const Identifier &id)
 Creates a new MdtPrepDataCollection, if it's neccessary and also possible. More...
 
StatusCode finalize (MsgStream &msg)
 Copy the non-empty collections into the created prd container. More...
 

Public Attributes

Muon::MdtPrepDataContainerlegacyPrd {nullptr}
 
xAOD::MdtDriftCircleContainerxAODPrd {nullptr}
 
xAOD::MdtTwinDriftCircleContainerxAODTwinPrd {nullptr}
 
const Muon::IMuonIdHelperSvcm_idHelperSvc {nullptr}
 
const MuonGM::MuonDetectorManagerlegacyDetMgr {nullptr}
 Detector manager from the conditions store. More...
 
const MuonGMR4::MuonDetectorManagerr4DetMgr {nullptr}
 Detector manger from R4. More...
 
const ActsGeometryContextgctx {nullptr}
 Acts Geometry context. More...
 
const TwinTubeMaptwinTubeMap {nullptr}
 Pointer to the map having the mapping of twin tube pairs. More...
 
bool isValid {false}
 Flag set to indicate that the complete validation was successful. More...
 
std::vector< std::unique_ptr< MdtPrepDataCollection > > addedCols {}
 

Detailed Description

Helper struct to parse the event data around the tool.

Definition at line 65 of file MdtRdoToPrepDataToolMT.h.

Constructor & Destructor Documentation

◆ ConvCache()

Muon::MdtRdoToPrepDataToolMT::ConvCache::ConvCache ( const Muon::IMuonIdHelperSvc idHelperSvc)

Definition at line 52 of file MdtRdoToPrepDataToolMT.cxx.

52  :
53  m_idHelperSvc{idHelperSvc} {
55  }

Member Function Documentation

◆ createCollection()

MdtPrepDataCollection * Muon::MdtRdoToPrepDataToolMT::ConvCache::createCollection ( const Identifier id)

Creates a new MdtPrepDataCollection, if it's neccessary and also possible.

Nullptr is returned if the collection cannot be modified

Definition at line 57 of file MdtRdoToPrepDataToolMT.cxx.

57  {
58 
59  IdentifierHash mdtHashId = m_idHelperSvc->moduleHash(elementId);
60 
61  std::unique_ptr<MdtPrepDataCollection>& coll {addedCols[mdtHashId]};
62  if (!coll) {
63  coll = std::make_unique<MdtPrepDataCollection>(mdtHashId);
64  coll->setIdentifier(m_idHelperSvc->chamberId(elementId));
65  }
66  return coll.get();
67  }

◆ finalize()

StatusCode Muon::MdtRdoToPrepDataToolMT::ConvCache::finalize ( MsgStream &  msg)

Copy the non-empty collections into the created prd container.

Fill the prepdata objects just at this stage

The prepdata represents an actual drift circle

That method is kind of depreciated but needed for the Acts conversion test..

Invalid drift circles have a covariance as large as the inner radius assigned

Ordinary 1D circle

Definition at line 68 of file MdtRdoToPrepDataToolMT.cxx.

68  {
69  const MdtIdHelper& idHelper{m_idHelperSvc->mdtIdHelper()};
70 
71  for (unsigned int moduleHash =0; moduleHash < addedCols.size(); ++moduleHash) {
72  std::unique_ptr<MdtPrepDataCollection>& toInsert{addedCols[moduleHash]};
73  if (!toInsert || toInsert->empty()) continue;
74  if (xAODPrd) {
76  std::vector<const MdtPrepData*> sortMe{toInsert->begin(), toInsert->end()};
77  std::ranges::sort(sortMe, IdentifierByDetElSorter{m_idHelperSvc});
78  for (const MdtPrepData* prd : sortMe) {
79  const Identifier prdId{prd->identify()};
80  xAOD::MdtDriftCircle* dc{nullptr};
82  if (!xAODTwinPrd|| !twinTubeMap || twinTubeMap->twinId(prdId) == prdId ||
83  prd->dimension() == 1) {
84  dc = xAODPrd->push_back(std::make_unique<xAOD::MdtDriftCircle>());
85  } else {
86  dc = xAODTwinPrd->push_back(std::make_unique<xAOD::MdtTwinDriftCircle>());
87  }
89  dc->setIdentifier(prdId.get_compact());
90  dc->setTdc(prd->tdc());
91  dc->setAdc(prd->adc());
92  dc->setTube(idHelper.tube(prdId));
93  dc->setLayer(idHelper.tubeLayer(prdId));
94  dc->setStatus(prd->status());
95  if (r4DetMgr){
96  dc->setReadoutElement(r4DetMgr->getMdtReadoutElement(prdId));
97  }
98  const IdentifierHash detHash{m_idHelperSvc->detElementHash(prdId)};
99  float driftRadius{0.f}, driftCov{0.f};
100  if (prd->status() == MdtDriftCircleStatus::MdtStatusDriftTime) {
101  driftRadius = prd->localPosition().x();
102  driftCov = prd->localCovariance()(0,0);
103  } else {
105  const float maxR = r4DetMgr ? dc->readoutElement()->innerTubeRadius()
106  : prd->detectorElement()->innerTubeRadius();
107  driftCov = std::pow(maxR, 2);
108  }
110  if (dc->numDimensions() == 1) {
113  dc->setMeasurement<1>(detHash, std::move(locPos), std::move(locCov));
114  } else {
116  locCov(Trk::locR, Trk::locR) = prd->localCovariance()(Trk::locR, Trk::locR);
117  locCov(Trk::locZ, Trk::locZ) = prd->localCovariance()(Trk::locZ, Trk::locZ);
118  dc->setMeasurement<2>(detHash, xAOD::toStorage(prd->localPosition()), std::move(locCov));
119  auto* twinDC{static_cast<xAOD::MdtTwinDriftCircle*>(dc)};
120  auto* twinPRD{static_cast<const MdtTwinPrepData*>(prd)};
121  twinDC->setTwinAdc(twinPRD->adcTwin());
122  twinDC->setTwinTdc(twinPRD->tdcTwin());
123  const Identifier twinId = twinTubeMap->twinId(prdId);
124  twinDC->setTwinTube(idHelper.tube(twinId));
125  twinDC->setTwinLayer(idHelper.tubeLayer(twinId));
126  }
127  }
128  }
130  if (lock.addOrDelete(std::move(toInsert)).isFailure()) {
131  msg << MSG::ERROR << " Failed to add prep data collection " << moduleHash << endmsg;
132  return StatusCode::FAILURE;
133  }
134  }
135  if (xAODPrd) {
136  xAODPrd->lock();
137  }
138  if (xAODTwinPrd) {
139  xAODTwinPrd->lock();
140  }
141  return StatusCode::SUCCESS;
142  }

Member Data Documentation

◆ addedCols

std::vector<std::unique_ptr<MdtPrepDataCollection> > Muon::MdtRdoToPrepDataToolMT::ConvCache::addedCols {}

Definition at line 90 of file MdtRdoToPrepDataToolMT.h.

◆ gctx

const ActsGeometryContext* Muon::MdtRdoToPrepDataToolMT::ConvCache::gctx {nullptr}

Acts Geometry context.

Definition at line 84 of file MdtRdoToPrepDataToolMT.h.

◆ isValid

bool Muon::MdtRdoToPrepDataToolMT::ConvCache::isValid {false}

Flag set to indicate that the complete validation was successful.

Definition at line 89 of file MdtRdoToPrepDataToolMT.h.

◆ legacyDetMgr

const MuonGM::MuonDetectorManager* Muon::MdtRdoToPrepDataToolMT::ConvCache::legacyDetMgr {nullptr}

Detector manager from the conditions store.

Definition at line 80 of file MdtRdoToPrepDataToolMT.h.

◆ legacyPrd

Muon::MdtPrepDataContainer* Muon::MdtRdoToPrepDataToolMT::ConvCache::legacyPrd {nullptr}

Definition at line 74 of file MdtRdoToPrepDataToolMT.h.

◆ m_idHelperSvc

const Muon::IMuonIdHelperSvc* Muon::MdtRdoToPrepDataToolMT::ConvCache::m_idHelperSvc {nullptr}

Definition at line 78 of file MdtRdoToPrepDataToolMT.h.

◆ r4DetMgr

const MuonGMR4::MuonDetectorManager* Muon::MdtRdoToPrepDataToolMT::ConvCache::r4DetMgr {nullptr}

Detector manger from R4.

Definition at line 82 of file MdtRdoToPrepDataToolMT.h.

◆ twinTubeMap

const TwinTubeMap* Muon::MdtRdoToPrepDataToolMT::ConvCache::twinTubeMap {nullptr}

Pointer to the map having the mapping of twin tube pairs.

Definition at line 86 of file MdtRdoToPrepDataToolMT.h.

◆ xAODPrd

xAOD::MdtDriftCircleContainer* Muon::MdtRdoToPrepDataToolMT::ConvCache::xAODPrd {nullptr}

Definition at line 75 of file MdtRdoToPrepDataToolMT.h.

◆ xAODTwinPrd

xAOD::MdtTwinDriftCircleContainer* Muon::MdtRdoToPrepDataToolMT::ConvCache::xAODTwinPrd {nullptr}

Definition at line 76 of file MdtRdoToPrepDataToolMT.h.


The documentation for this struct was generated from the following files:
Muon::MdtRdoToPrepDataToolMT::ConvCache::m_idHelperSvc
const Muon::IMuonIdHelperSvc * m_idHelperSvc
Definition: MdtRdoToPrepDataToolMT.h:78
IdentifiableContainerMT::IDC_WriteHandle
friend class IDC_WriteHandle
Definition: IdentifiableContainerMT.h:140
IdentifiableContainerMT::getWriteHandle
IDC_WriteHandle getWriteHandle(IdentifierHash hash)
Definition: IdentifiableContainerMT.h:248
MuonR4::driftCov
double driftCov(const CalibratedSpacePoint &dcHit)
Definition: MdtSegmentSeedGenerator.cxx:22
xAOD::toStorage
MeasVector< N > toStorage(const AmgVector(N)&amgVec)
Converts the double precision of the AmgVector into the floating point storage precision of the MeasV...
Definition: MeasurementDefs.h:68
Muon::MdtRdoToPrepDataToolMT::ConvCache::xAODPrd
xAOD::MdtDriftCircleContainer * xAODPrd
Definition: MdtRdoToPrepDataToolMT.h:75
Muon::IMuonIdHelperSvc::moduleHash
virtual IdentifierHash moduleHash(const Identifier &id) const =0
Returns the module hash associated to an Identifier.
Muon::MdtRdoToPrepDataToolMT::ConvCache::r4DetMgr
const MuonGMR4::MuonDetectorManager * r4DetMgr
Detector manger from R4.
Definition: MdtRdoToPrepDataToolMT.h:82
Trk::locR
@ locR
Definition: ParamDefs.h:44
Muon::MdtRdoToPrepDataToolMT::ConvCache::xAODTwinPrd
xAOD::MdtTwinDriftCircleContainer * xAODTwinPrd
Definition: MdtRdoToPrepDataToolMT.h:76
Muon::MdtStatusDriftTime
@ MdtStatusDriftTime
The tube produced a vaild measurement.
Definition: MdtDriftCircleStatus.h:34
Trk::locZ
@ locZ
local cylindrical
Definition: ParamDefs.h:42
Muon::TwinTubeMap::twinId
Identifier twinId(const Identifier &channelId) const
Returns the Identifier of the mapped twin tube.
Definition: TwinTubeMap.cxx:19
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
Trk::driftRadius
@ driftRadius
trt, straws
Definition: ParamDefs.h:53
xAOD::MdtTwinDriftCircle_v1
Definition: MdtTwinDriftCircle_v1.h:12
MdtIdHelper
Definition: MdtIdHelper.h:61
Muon::IMuonIdHelperSvc::chamberId
virtual Identifier chamberId(const Identifier &id) const =0
create a chamber ID
xAOD::MeasVector
Eigen::Matrix< float, N, 1 > MeasVector
Abrivation of the Matrix & Covariance definitions.
Definition: MeasurementDefs.h:52
Muon::IMuonIdHelperSvc::mdtIdHelper
virtual const MdtIdHelper & mdtIdHelper() const =0
access to MdtIdHelper
Muon::MdtRdoToPrepDataToolMT::ConvCache::addedCols
std::vector< std::unique_ptr< MdtPrepDataCollection > > addedCols
Definition: MdtRdoToPrepDataToolMT.h:90
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
MuonIdHelper::module_hash_max
size_type module_hash_max() const
the maximum hash value
Definition: MuonIdHelper.cxx:748
Muon::MdtRdoToPrepDataToolMT::ConvCache::twinTubeMap
const TwinTubeMap * twinTubeMap
Pointer to the map having the mapping of twin tube pairs.
Definition: MdtRdoToPrepDataToolMT.h:86
Muon::MdtRdoToPrepDataToolMT::ConvCache::legacyPrd
Muon::MdtPrepDataContainer * legacyPrd
Definition: MdtRdoToPrepDataToolMT.h:74
xAOD::MdtTwinDriftCircle_v1::setTwinAdc
void setTwinAdc(int16_t adc)
Sets the ADC counts.
xAOD::MeasMatrix
Eigen::Matrix< float, N, N > MeasMatrix
Definition: MeasurementDefs.h:54
xAOD::MdtDriftCircle_v1
https://gitlab.cern.ch/atlas/athena/-/blob/master/MuonSpectrometer/MuonReconstruction/MuonRecEvent/Mu...
Definition: MdtDriftCircle_v1.h:21
pow
constexpr int pow(int base, int exp) noexcept
Definition: ap_fixedTest.cxx:15
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
Muon::IMuonIdHelperSvc::detElementHash
virtual IdentifierHash detElementHash(const Identifier &id) const =0
Returns the detector element hash associated to an Identifier.
Identifier
Definition: IdentifierFieldParser.cxx:14