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)
 Constructor to instantiate the cache.
 ~DataCache ()
 Overwrite the destructor to ensure that the xAOD containers are made.
DataCacheoperator= (DataCache &&other)=default
 Default move operator.
 DataCache (DataCache &&other)=default
 Default move constructor.
void translateAndSort (sTgcPrepDataCollection &coll)
 Sort the prepdata collection by the Identifier of the objects contained and then translate the prd objects into xAOD objects.
void translate (const sTgcPrepDataCollection &coll)
 Translate the prd objects conained in the collection to xAOD objects.

Public Attributes

StripCont_t strips {}
 Container to hold the translated xAOD strips.
WireCont_t wires {}
 Container to hold the translated xAOD wires.
PadCont_t pads {}
 Container to hold the translated xAOD pads.
SG::WriteHandle< sTgcPrepDataContainerprdWriteHandle {}
 Instantiated WriteHandle.
std::vector< std::unique_ptr< sTgcPrepDataCollection > > collections {}
 Prep data collections that will be appended to the container in store gate.
const MuonGMR4::MuonDetectorManagerdetMgr {nullptr}
 Pointer to the R4 detector manager.
bool isValid {false}
 Flag indicating whether the container is valid.

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 )

Constructor to instantiate the cache.

Parameters
hashMaxNumber of sTGC chambers (summarizing ML 1 + ML2)
keyThe writeHandleKey to fetch the container from StoreGate

Definition at line 24 of file sTgcRdoToPrepDataToolMT.cxx.

26 :
27 prdWriteHandle{key, ctx} {
28 collections.resize(hashMax);
29}
std::vector< std::unique_ptr< sTgcPrepDataCollection > > collections
Prep data collections that will be appended to the container in store gate.
SG::WriteHandle< sTgcPrepDataContainer > prdWriteHandle
Instantiated WriteHandle.

◆ ~DataCache()

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

Overwrite the destructor to ensure that the xAOD containers are made.

Definition at line 110 of file sTgcRdoToPrepDataToolMT.cxx.

110 {
111 if (!isValid) {
112 return;
113 }
114
115 for (std::size_t hash = 0; hash < collections.size(); ++hash) {
116 std::unique_ptr<sTgcPrepDataCollection>& coll = collections[hash];
117 if (!coll) {
118 continue;
119 }
121 if (lock.OnlineAndPresentInAnotherView()){
122 continue;
123 }
124
125 translateAndSort(*coll);
126
127 lock.addOrDelete(std::move(coll)).ignore();
128 }
129}
virtual void lock()=0
Interface to allow an object to lock itself when made const in SG.
void translateAndSort(sTgcPrepDataCollection &coll)
Sort the prepdata collection by the Identifier of the objects contained and then translate the prd ob...
bool isValid
Flag indicating whether the container is valid.

◆ DataCache() [2/2]

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

Default move constructor.

Member Function Documentation

◆ operator=()

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

Default move operator.

◆ translate()

void Muon::sTgcRdoToPrepDataToolMT::DataCache::translate ( const sTgcPrepDataCollection & coll)

Translate the prd objects conained in the collection to xAOD objects.

Parameters
collReference to the collection to process

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 45 of file sTgcRdoToPrepDataToolMT.cxx.

45 {
46 const IMuonIdHelperSvc* idHelperSvc = detMgr->idHelperSvc();
47 const sTgcIdHelper& id_helper = idHelperSvc->stgcIdHelper();
48 for (const sTgcPrepData* prd : coll) {
49 const Identifier prdId = prd->identify();
50 const int gasGap = id_helper.gasGap(prdId);
51 const int channel = id_helper.channel(prdId);
52 const int chType = id_helper.channelType(prdId);
53 xAOD::sTgcMeasurement* outHit{nullptr};
55 if (!pads.hasHandle()) {
56 continue;
57 }
58 xAOD::MeasMatrix<2> lCov{xAOD::MeasMatrix<2>::Identity()};
59 lCov(1,1) = prd->localCovariance()(0,0);
61 const MuonGMR4::sTgcReadoutElement* readoutEle = detMgr->getsTgcReadoutElement(prdId);
62 lCov(0,0) = Acts::square(0.5* readoutEle->padHeight(readoutEle->measurementHash(prdId)));
63
64 //skip for now measurements with zero covariance
65 if (lCov.determinant() == 0) {
66 continue;
67 }
68 outHit = pads->push_back(std::make_unique<xAOD::sTgcPadHit>());
69 outHit->setMeasurement<2>(idHelperSvc->detElementHash(prdId),
70 xAOD::toStorage(Eigen::Rotation2D{-M_PI_2}*prd->localPosition()),
71 std::move(lCov));
73 if (!wires.hasHandle()){
74 continue;
75 }
76 outHit = wires->push_back(std::make_unique<xAOD::sTgcWireHit>());
78 if (!strips.hasHandle()) {
79 continue;
80 }
81 auto stripHit = strips->push_back(std::make_unique<xAOD::sTgcStripCluster>());
82 stripHit->setStripCharges(prd->stripCharges());
83 stripHit->setStripNumbers(prd->stripNumbers());
84 stripHit->setStripTimes(prd->stripTimes());
85 outHit = stripHit;
86 }
87 if (!outHit) {
88 continue;
89 }
93 const double locPos = (chType == sTgcIdHelper::sTgcChannelTypes::Wire ? -1. : 1.) * prd->localPosition().x();
94 xAOD::MeasVector<1> lPos = locPos * xAOD::MeasVector<1>::UnitX();
96 lCov(0,0) = prd->localCovariance()(0,0);
97 outHit->setMeasurement<1>(idHelperSvc->detElementHash(prdId),
98 std::move(lPos),
99 std::move(lCov));
100
101 }
102 outHit->setChannelNumber(channel);
103 outHit->setGasGap(gasGap);
104 outHit->setAuthor(prd->author());
105 outHit->setTime(prd->time());
106 outHit->setCharge(prd->charge());
107 outHit->setReadoutElement(detMgr->getsTgcReadoutElement(prdId));
108 }
109}
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.
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
PadCont_t pads
Container to hold the translated xAOD pads.
const MuonGMR4::MuonDetectorManager * detMgr
Pointer to the R4 detector manager.
WireCont_t wires
Container to hold the translated xAOD wires.
StripCont_t strips
Container to hold the translated xAOD strips.

◆ translateAndSort()

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

Sort the prepdata collection by the Identifier of the objects contained and then translate the prd objects into xAOD objects.

Parameters
collReference to the collection to process

update the index otherwise the persitification is not happy...

Definition at line 31 of file sTgcRdoToPrepDataToolMT.cxx.

31 {
32 if (!detMgr) {
33 return;
34 }
35 std::sort(coll.begin(), coll.end(),[](const sTgcPrepData*a, const sTgcPrepData* b){
36 return a->identify() < b->identify();
37 });
39 std::size_t idx{0};
40 for (sTgcPrepData* prd : coll) {
41 prd->setHashAndIndex(coll.identifyHash(), idx++);
42 }
43 translate(coll);
44}
static Double_t a
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
void translate(const sTgcPrepDataCollection &coll)
Translate the prd objects conained in the collection to xAOD objects.

Member Data Documentation

◆ collections

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

Prep data collections that will be appended to the container in store gate.

Definition at line 87 of file sTgcRdoToPrepDataToolMT.h.

87{};

◆ detMgr

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

Pointer to the R4 detector manager.

Definition at line 89 of file sTgcRdoToPrepDataToolMT.h.

89{nullptr};

◆ isValid

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

Flag indicating whether the container is valid.

Definition at line 91 of file sTgcRdoToPrepDataToolMT.h.

91{false};

◆ pads

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

Container to hold the translated xAOD pads.

Definition at line 76 of file sTgcRdoToPrepDataToolMT.h.

76{};

◆ prdWriteHandle

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

Instantiated WriteHandle.

Definition at line 85 of file sTgcRdoToPrepDataToolMT.h.

85{};

◆ strips

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

Container to hold the translated xAOD strips.

Definition at line 72 of file sTgcRdoToPrepDataToolMT.h.

72{};

◆ wires

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

Container to hold the translated xAOD wires.

Definition at line 74 of file sTgcRdoToPrepDataToolMT.h.

74{};

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