ATLAS Offline Software
Loading...
Searching...
No Matches
Muon::sTgcRdoToPrepDataToolMT::DataCache Struct Reference

Data cache to hold the translated prd & xAOD containers. More...

#include <sTgcRdoToPrepDataToolMT.h>

Collaboration diagram for Muon::sTgcRdoToPrepDataToolMT::DataCache:

Public Types

using StripCont_t
using WireCont_t
using PadCont_t

Public Member Functions

 DataCache (const std::size_t hashMax, const PrdKey_t &key, const EventContext &ctx)
 ~DataCache ()
DataCacheoperator= (DataCache &&other)=default
 DataCache (DataCache &&other)=default
void translateAndSort (sTgcPrepDataCollection &coll)

Public Attributes

StripCont_t strips {}
WireCont_t wires {}
PadCont_t pads {}
SG::WriteHandle< sTgcPrepDataContainerprdWriteHandle {}
std::vector< std::unique_ptr< sTgcPrepDataCollection > > collections {}
const MuonGMR4::MuonDetectorManagerdetMgr {nullptr}
bool isValid {false}

Detailed Description

Data cache to hold the translated prd & xAOD containers.

Definition at line 64 of file sTgcRdoToPrepDataToolMT.h.

Member Typedef Documentation

◆ PadCont_t

◆ StripCont_t

Initial value:
sTgcStripContainer_v1 sTgcStripContainer
sTgcStripAuxContainer_v1 sTgcStripAuxContainer

Definition at line 65 of file sTgcRdoToPrepDataToolMT.h.

◆ WireCont_t

Initial value:
sTgcWireContainer_v1 sTgcWireContainer
sTgcWireAuxContainer_v1 sTgcWireAuxContainer

Definition at line 67 of file sTgcRdoToPrepDataToolMT.h.

Constructor & Destructor Documentation

◆ DataCache() [1/2]

Muon::sTgcRdoToPrepDataToolMT::DataCache::DataCache ( const std::size_t hashMax,
const PrdKey_t & key,
const EventContext & ctx )

Definition at line 24 of file sTgcRdoToPrepDataToolMT.cxx.

26 :
27 prdWriteHandle{key, ctx}{
28
29 collections.resize(hashMax);
30
31}
std::vector< std::unique_ptr< sTgcPrepDataCollection > > collections
SG::WriteHandle< sTgcPrepDataContainer > prdWriteHandle

◆ ~DataCache()

Muon::sTgcRdoToPrepDataToolMT::DataCache::~DataCache ( )

Definition at line 105 of file sTgcRdoToPrepDataToolMT.cxx.

105 {
106 if (!isValid) {
107 return;
108 }
109
110 for (std::size_t hash = 0; hash < collections.size(); ++hash) {
111 std::unique_ptr<sTgcPrepDataCollection>& coll = collections[hash];
112 if (!coll) {
113 continue;
114 }
116 if (lock.OnlineAndPresentInAnotherView()){
117 continue;
118 }
119
120 translateAndSort(*coll);
121
122 lock.addOrDelete(std::move(coll)).ignore();
123 }
124}
virtual void lock()=0
Interface to allow an object to lock itself when made const in SG.
void translateAndSort(sTgcPrepDataCollection &coll)

◆ DataCache() [2/2]

Muon::sTgcRdoToPrepDataToolMT::DataCache::DataCache ( DataCache && other)
default

Member Function Documentation

◆ operator=()

DataCache & Muon::sTgcRdoToPrepDataToolMT::DataCache::operator= ( DataCache && other)
default

◆ translateAndSort()

void Muon::sTgcRdoToPrepDataToolMT::DataCache::translateAndSort ( sTgcPrepDataCollection & coll)

Calculate the eta covariance from the geometry for now for

In the R4 layout both phi & eta measurements are expressed on the same surface. However, the rotation from eta -> phi is clockwise --> minus sign in prd creation

Definition at line 33 of file sTgcRdoToPrepDataToolMT.cxx.

33 {
34 if (!detMgr) {
35 return;
36 }
37 std::sort(coll.begin(), coll.end(),[](const sTgcPrepData*a, const sTgcPrepData* b){
38 return a->identify() < b->identify();
39 });
40 const IMuonIdHelperSvc* idHelperSvc = detMgr->idHelperSvc();
41
42 const sTgcIdHelper& id_helper = idHelperSvc->stgcIdHelper();
43 for (const sTgcPrepData* prd : coll) {
44 const Identifier prdId = prd->identify();
45 const int gasGap = id_helper.gasGap(prdId);
46 const int channel = id_helper.channel(prdId);
47 const int chType = id_helper.channelType(prdId);
48 xAOD::sTgcMeasurement* outHit{nullptr};
50 if (!pads.hasHandle()) {
51 continue;
52 }
53 xAOD::MeasMatrix<2> lCov{xAOD::MeasMatrix<2>::Identity()};
54 lCov(1,1) = prd->localCovariance()(0,0);
56 const MuonGMR4::sTgcReadoutElement* readoutEle = detMgr->getsTgcReadoutElement(prdId);
57 lCov(0,0) = Acts::square(0.5* readoutEle->padHeight(readoutEle->measurementHash(prdId)));
58
59 //skip for now measurements with zero covariance
60 if (lCov.determinant() == 0) {
61 continue;
62 }
63 outHit = pads->push_back(std::make_unique<xAOD::sTgcPadHit>());
64 outHit->setMeasurement<2>(idHelperSvc->detElementHash(prdId),
65 xAOD::toStorage(Eigen::Rotation2D{-M_PI_2}*prd->localPosition()),
66 std::move(lCov));
68 if (!wires.hasHandle()){
69 continue;
70 }
71 outHit = wires->push_back(std::make_unique<xAOD::sTgcWireHit>());
73 if (!strips.hasHandle()) {
74 continue;
75 }
76 auto stripHit = strips->push_back(std::make_unique<xAOD::sTgcStripCluster>());
77 stripHit->setStripCharges(prd->stripCharges());
78 stripHit->setStripNumbers(prd->stripNumbers());
79 stripHit->setStripTimes(prd->stripTimes());
80 outHit = stripHit;
81 }
82 if (!outHit) {
83 continue;
84 }
88 const double locPos = (chType == sTgcIdHelper::sTgcChannelTypes::Wire ? -1. : 1.) * prd->localPosition().x();
89 xAOD::MeasVector<1> lPos = locPos * xAOD::MeasVector<1>::UnitX();
91 lCov(0,0) = prd->localCovariance()(0,0);
92 outHit->setMeasurement<1>(idHelperSvc->detElementHash(prdId),
93 std::move(lPos),
94 std::move(lCov));
95
96 }
97 outHit->setChannelNumber(channel);
98 outHit->setGasGap(gasGap);
99 outHit->setAuthor(prd->author());
100 outHit->setTime(prd->time());
101 outHit->setCharge(prd->charge());
102 outHit->setReadoutElement(detMgr->getsTgcReadoutElement(prdId));
103 }
104}
static Double_t a
IdentifierHash measurementHash(const Identifier &measId) const override final
Constructs the identifier hash from the full measurement Identifier.
double padHeight(const IdentifierHash &measHash) const
Returns the height of all the pads that are not adjacent to the bottom edge of the trapezoid active a...
int channelType(const Identifier &id) const
int channel(const Identifier &id) const override
int gasGap(const Identifier &id) const override
get the hashes
void setMeasurement(const DetectorIDHashType idHash, MeasVector< N > locPos, MeasMatrix< N > locCov)
Sets IdentifierHash, local position and local covariance of the measurement.
void setChannelNumber(std::uint16_t channel)
Set the channel number of the measurement.
void setTime(short int t)
: Set the calibrated time of the wire measurement
void setAuthor(Author a)
Set the author of the producing algorithm.
void setCharge(int q)
: Set the collected charge on the wire
void setReadoutElement(const MuonGMR4::sTgcReadoutElement *readoutEle)
set the pointer to the sTgcReadoutElement
void setGasGap(std::uint8_t gap)
Set the associated gas gap of the measurement.
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
Eigen::Matrix< float, N, N > MeasMatrix
Eigen::Matrix< float, N, 1 > MeasVector
Abrivation of the Matrix & Covariance definitions.
MeasVector< N > toStorage(const AmgVector(N)&amgVec)
Converts the double precision of the AmgVector into the floating point storage precision of the MeasV...
sTgcMeasurement_v1 sTgcMeasurement
const MuonGMR4::MuonDetectorManager * detMgr

Member Data Documentation

◆ collections

std::vector<std::unique_ptr<sTgcPrepDataCollection> > Muon::sTgcRdoToPrepDataToolMT::DataCache::collections {}

Definition at line 81 of file sTgcRdoToPrepDataToolMT.h.

81{};

◆ detMgr

const MuonGMR4::MuonDetectorManager* Muon::sTgcRdoToPrepDataToolMT::DataCache::detMgr {nullptr}

Definition at line 83 of file sTgcRdoToPrepDataToolMT.h.

83{nullptr};

◆ isValid

bool Muon::sTgcRdoToPrepDataToolMT::DataCache::isValid {false}

Definition at line 85 of file sTgcRdoToPrepDataToolMT.h.

85{false};

◆ pads

PadCont_t Muon::sTgcRdoToPrepDataToolMT::DataCache::pads {}

Definition at line 73 of file sTgcRdoToPrepDataToolMT.h.

73{};

◆ prdWriteHandle

SG::WriteHandle<sTgcPrepDataContainer> Muon::sTgcRdoToPrepDataToolMT::DataCache::prdWriteHandle {}

Definition at line 79 of file sTgcRdoToPrepDataToolMT.h.

79{};

◆ strips

StripCont_t Muon::sTgcRdoToPrepDataToolMT::DataCache::strips {}

Definition at line 71 of file sTgcRdoToPrepDataToolMT.h.

71{};

◆ wires

WireCont_t Muon::sTgcRdoToPrepDataToolMT::DataCache::wires {}

Definition at line 72 of file sTgcRdoToPrepDataToolMT.h.

72{};

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