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

#include <sTgcRdoToPrepDataToolMT.h>

Inheritance diagram for Muon::sTgcRdoToPrepDataToolMT:

Classes

struct  outputCache

Public Member Functions

virtual ~sTgcRdoToPrepDataToolMT ()=default
 Destructor.
virtual StatusCode initialize () override
 Standard AthAlgTool initialize method.
StatusCode decode (const EventContext &ctx, const std::vector< IdentifierHash > &idVect) const override
 Decode RDO to PRD
A vector of IdentifierHash are passed in, and the data corresponding to this list (i.e.
StatusCode decode (const EventContext &ctx, const std::vector< uint32_t > &robIds) const override
StatusCode provideEmptyContainer (const EventContext &ctx) const override

Protected Member Functions

StatusCode processCollection (const EventContext &ctx, outputCache &xAODcontainers, const STGC_RawDataCollection *rdoColl) const
outputCache setupOutputContainers (const EventContext &ctx) const
const STGC_RawDataContainergetRdoContainer (const EventContext &ctx) const
void processRDOContainer (const EventContext &ctx, outputCache &xAODcontainers, const std::vector< IdentifierHash > &idsToDecode) const

Protected Attributes

SG::ReadCondHandleKey< MuonGM::MuonDetectorManagerm_muDetMgrKey {this, "DetectorManagerKey", "MuonDetectorManager", "Key of input MuonDetectorManager condition data"}
ServiceHandle< Muon::IMuonIdHelperSvcm_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}
SG::ReadHandleKey< STGC_RawDataContainerm_rdoContainerKey {this, "InputCollection", "sTGCRDO", "RDO container to read"}
SG::WriteHandleKey< sTgcPrepDataContainerm_stgcPrepDataContainerKey {this, "OutputCollection", "STGC_Measurements", "Muon::sTgcPrepDataContainer to record"}
Gaudi::Property< bool > m_merge {this, "Merge", true}
ToolHandle< ISTgcClusterBuilderToolm_clusterBuilderTool {this,"ClusterBuilderTool","Muon::SimpleSTgcClusterBuilderTool/SimpleSTgcClusterBuilderTool"}
ToolHandle< INSWCalibToolm_calibTool {this,"NSWCalibTool", ""}
SG::UpdateHandleKey< sTgcPrepDataCollection_Cachem_prdContainerCacheKey {this, "PrdCacheKey", "", "Optional external cache for the sTGC PRD container"}
 This is the key for the cache for the sTGC PRD containers, can be empty.
SG::WriteHandleKey< xAOD::sTgcStripContainerm_xAODStripKey {this, "xAODStripKey", "", "If empty, do not produce xAOD, otherwise this is the key of the output xAOD MDT PRD container"}
SG::WriteHandleKey< xAOD::sTgcPadContainerm_xAODPadKey {this, "xAODPadKey", "", "If empty, do not produce xAOD, otherwise this is the key of the output xAOD MDT PRD container"}
SG::WriteHandleKey< xAOD::sTgcWireContainerm_xAODWireKey {this, "xAODWireKey", "", "If empty, do not produce xAOD, otherwise this is the key of the output xAOD MDT PRD container"}
Gaudi::Property< bool > m_useNewGeo
const MuonGMR4::MuonDetectorManagerm_detMgrR4 {nullptr}

Detailed Description

Definition at line 35 of file sTgcRdoToPrepDataToolMT.h.

Constructor & Destructor Documentation

◆ ~sTgcRdoToPrepDataToolMT()

virtual Muon::sTgcRdoToPrepDataToolMT::~sTgcRdoToPrepDataToolMT ( )
virtualdefault

Destructor.

Member Function Documentation

◆ decode() [1/2]

StatusCode Muon::sTgcRdoToPrepDataToolMT::decode ( const EventContext & ctx,
const std::vector< IdentifierHash > & idVect ) const
override

Decode RDO to PRD
A vector of IdentifierHash are passed in, and the data corresponding to this list (i.e.

in a Region of Interest) are converted.

Parameters
requestedIdHashVectVector of hashes to convert i.e. the hashes of ROD collections in a 'Region of Interest'
Returns
selectedIdHashVect This is the subset of requestedIdVect which were actually found to contain data
(i.e. if you want you can use this vector of hashes to optimise the retrieval of data in subsequent steps.)

Definition at line 323 of file sTgcRdoToPrepDataToolMT.cxx.

324 {
325 ATH_MSG_DEBUG("Size of the input hash id vector: " << idVect.size());
326
327 outputCache outCache = setupOutputContainers(ctx);
328 if (!outCache.isValid) return StatusCode::FAILURE;
329
330 processRDOContainer(ctx, outCache, idVect);
331 return StatusCode::SUCCESS;
332}
#define ATH_MSG_DEBUG(x)
outputCache setupOutputContainers(const EventContext &ctx) const
void processRDOContainer(const EventContext &ctx, outputCache &xAODcontainers, const std::vector< IdentifierHash > &idsToDecode) const

◆ decode() [2/2]

StatusCode Muon::sTgcRdoToPrepDataToolMT::decode ( const EventContext & ctx,
const std::vector< uint32_t > & robIds ) const
override

Definition at line 336 of file sTgcRdoToPrepDataToolMT.cxx.

336 {
337 ATH_MSG_FATAL("ROB based decoding is not supported....");
338 return StatusCode::FAILURE;
339}
#define ATH_MSG_FATAL(x)

◆ getRdoContainer()

const STGC_RawDataContainer * Muon::sTgcRdoToPrepDataToolMT::getRdoContainer ( const EventContext & ctx) const
protected

Definition at line 280 of file sTgcRdoToPrepDataToolMT.cxx.

281{
282 auto rdoContainerHandle = SG::makeHandle(m_rdoContainerKey, ctx);
283 if(rdoContainerHandle.isValid()) {
284 ATH_MSG_DEBUG("STGC_getRdoContainer success");
285 return rdoContainerHandle.cptr();
286 }
287 ATH_MSG_WARNING("Retrieval of STGC_RawDataContainer failed !");
288
289 return nullptr;
290}
#define ATH_MSG_WARNING(x)
SG::ReadHandleKey< STGC_RawDataContainer > m_rdoContainerKey
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())

◆ initialize()

StatusCode Muon::sTgcRdoToPrepDataToolMT::initialize ( )
overridevirtual

Standard AthAlgTool initialize method.

Definition at line 24 of file sTgcRdoToPrepDataToolMT.cxx.

25{
26 ATH_MSG_DEBUG(" in initialize()");
27 ATH_CHECK( m_idHelperSvc.retrieve() );
28 // check if the initialization of the data container is success
30 ATH_CHECK(m_rdoContainerKey.initialize());
31 ATH_CHECK(m_muDetMgrKey.initialize());
32 ATH_CHECK(m_calibTool.retrieve());
33 ATH_CHECK(m_prdContainerCacheKey.initialize(!m_prdContainerCacheKey.key().empty()) );
34
35 if (m_useNewGeo) {
37 }
38
39 ATH_CHECK(m_xAODStripKey.initialize(!m_xAODStripKey.empty()));
40 ATH_CHECK(m_xAODWireKey.initialize(!m_xAODWireKey.empty()));
41 ATH_CHECK(m_xAODPadKey.initialize(!m_xAODPadKey.empty()));
42 return StatusCode::SUCCESS;
43}
#define ATH_CHECK
Evaluate an expression and check for errors.
ToolHandle< INSWCalibTool > m_calibTool
SG::WriteHandleKey< sTgcPrepDataContainer > m_stgcPrepDataContainerKey
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
SG::WriteHandleKey< xAOD::sTgcWireContainer > m_xAODWireKey
SG::UpdateHandleKey< sTgcPrepDataCollection_Cache > m_prdContainerCacheKey
This is the key for the cache for the sTGC PRD containers, can be empty.
const MuonGMR4::MuonDetectorManager * m_detMgrR4
SG::WriteHandleKey< xAOD::sTgcStripContainer > m_xAODStripKey
SG::WriteHandleKey< xAOD::sTgcPadContainer > m_xAODPadKey
SG::ReadCondHandleKey< MuonGM::MuonDetectorManager > m_muDetMgrKey
retrieve(aClass, aKey=None)
Definition PyKernel.py:110

◆ processCollection()

StatusCode Muon::sTgcRdoToPrepDataToolMT::processCollection ( const EventContext & ctx,
outputCache & xAODcontainers,
const STGC_RawDataCollection * rdoColl ) const
protected

Currently there's no 2D covariance yet

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

49 {
50
51 const sTgcIdHelper& id_helper = m_idHelperSvc->stgcIdHelper();
52 const IdentifierHash hash = rdoColl->identifyHash();
53
54 ATH_MSG_DEBUG(" ***************** Start of process STGC Collection with hash Id: " << hash);
55
56 auto stgcPrepDataContainer = xAODcontainers.prd;
57 // check if the collection already exists, otherwise add it
58 if ( stgcPrepDataContainer->indexFindPtr(hash) != nullptr ) {
59 ATH_MSG_DEBUG("In processCollection: collection already contained in the sTGC PrepData container");
60 return StatusCode::FAILURE;
61
62 }
63
64 // Get write handle for this collection
65 sTgcPrepDataContainer::IDC_WriteHandle lock = stgcPrepDataContainer->getWriteHandle( hash );
66 // Check if collection already exists (via the cache, i.e. in online trigger mode)
68 ATH_MSG_DEBUG("In processCollection: collection already available in the sTgc PrepData container (via cache)");
69 return StatusCode::SUCCESS;
70 }
71
72 // Make the PRD collection (will be added to container later
73 std::unique_ptr<sTgcPrepDataCollection> prdColl = std::make_unique<sTgcPrepDataCollection>(hash);
74
75 // set the offline identifier of the collection Id
76 IdContext context = id_helper.module_context();
77 Identifier moduleId;
78 int getId = id_helper.get_id(hash, moduleId, &context);
79 if ( getId != 0 ) {
80 ATH_MSG_ERROR("Could not convert the hash Id: " << hash << " to identifier");
81 } else {
82 prdColl->setIdentifier(moduleId);
83 }
84
85 // vectors to hold PRDs decoded for this RDO collection
86 std::vector<sTgcPrepData> sTgcStripPrds;
87 std::vector<sTgcPrepData> sTgcWirePrds;
88 std::vector<sTgcPrepData> sTgcPadPrds;
89 sTgcStripPrds.reserve(rdoColl->size());
90 sTgcPadPrds.reserve(rdoColl->size());
91 sTgcWirePrds.reserve(rdoColl->size());
92
93 // Count hits with negative charge, which indicates bad calibration
94
95
96 // MuonDetectorManager from the conditions store
97 const MuonGM::MuonDetectorManager* muonDetMgr{nullptr};
98 ATH_CHECK(SG::get(muonDetMgr,m_muDetMgrKey,ctx));
99 // convert the RDO collection to a PRD collection
100 for ( const STGC_RawData* rdo : * rdoColl) {
101
102 ATH_MSG_DEBUG("Adding a new sTgc PrepRawData");
103
104 const Identifier rdoId = rdo->identify();
105
106 std::vector<Identifier> rdoList{rdoId};
107
108 // get the local and global positions
109 const MuonGM::sTgcReadoutElement* detEl = muonDetMgr->getsTgcReadoutElement(rdoId);
110 Amg::Vector2D localPos{Amg::Vector2D::Zero()};
111
112 int channelType = id_helper.channelType(rdoId);
113 if (channelType < 0 || channelType > 2) {
114 ATH_MSG_ERROR("Unknown sTGC channel type");
115 return StatusCode::FAILURE;
116 }
117 if (!detEl->stripPosition(rdoId, localPos)) {
118 ATH_MSG_ERROR("Could not get the local strip position for "<<m_idHelperSvc->toString(rdoId));
119 return StatusCode::FAILURE;
120 }
121
122 // get the resolution from strip width
123 // to be fixed: for now do not set the resolution, it will be added in the next update
124 const int gasGap = id_helper.gasGap(rdoId);
125 const int channel = id_helper.channel(rdoId);
126
127 NSWCalib::CalibratedStrip calibStrip;
128 ATH_CHECK (m_calibTool->calibrateStrip(ctx, rdo, calibStrip));
129 int calibratedCharge = static_cast<int>(calibStrip.charge);
130 if (calibratedCharge < 0 && channelType == 1) { // we only want to protect against negatively charged strips and we should not lose wire or pad hits because of bad calibrations since charge does not matter for them in reco.
131 if (!hitNegativeCharge) {
132 ATH_MSG_DEBUG("One sTGC RDO or more, such as one with pdo = "<<rdo->charge() << " counts, corresponds to a negative charge (" << calibratedCharge << "). Skipping these RDOs");
133 hitNegativeCharge = true;
134 }
135 continue;
136 }
137
138 double width{0.};
139 if (channelType == sTgcIdHelper::sTgcChannelTypes::Pad) { // Pads
140 const MuonGM::MuonPadDesign* design = detEl->getPadDesign(rdoId);
141 if (!design) {
142 ATH_MSG_WARNING("Failed to get design for sTGC pad" );
143 } else {
144 width = design->channelWidth(localPos, true);
145 }
146 } else { // Strips and wires
147 const MuonGM::MuonChannelDesign* design = detEl->getDesign(rdoId);
148 if (!design) {
149 ATH_MSG_WARNING("Failed to get design for sTGC strip/wire" );
150 } else {
151 width = design->channelWidth();
152 }
153 }
154
155 const double resolution = width/ std::sqrt(12.);
156 auto cov = Amg::MatrixX(1,1);
157 cov.setIdentity();
158 (cov)(0,0) = resolution*resolution;
159
160 ATH_MSG_DEBUG("Adding a new STGC PRD, gasGap: " << gasGap << " channel: " << channel << " type: " << channelType << " resolution " << resolution );
161
162 if(m_merge) {
163 std::vector<sTgcPrepData>& sTgcPrds = channelType == sTgcIdHelper::Pad ? sTgcPadPrds :
164 (channelType == sTgcIdHelper::Strip ? sTgcStripPrds : sTgcWirePrds);
165
166 // check if the same RdoId is already present; keep the one with the smallest time
167 auto it = std::find_if(sTgcPrds.begin(), sTgcPrds.end(), [&rdoId](const sTgcPrepData& prd) {
168 return (prd.identify() == rdoId);
169 });
170 if (it == sTgcPrds.end()) {
171 sTgcPrds.emplace_back(rdoId, hash, std::move(localPos), std::move(rdoList), std::move(cov), detEl, calibratedCharge, calibStrip.time);
172 sTgcPrds.back().setAuthor(sTgcPrepData::Author::RdoToPrdConverter);
173 } else if (it->time() > calibStrip.time) {
174 *it = sTgcPrepData(rdoId, hash, std::move(localPos), std::move(rdoList), std::move(cov), detEl, calibratedCharge, calibStrip.time);
176 }
177
178 // TODO - add merging for xAOD
179
180 } else {
181 // if not merging just add the PRD to the collection
182 prdColl->push_back(std::make_unique<sTgcPrepData>(rdoId,
183 hash,
184 std::move(localPos),
185 std::move(rdoList),
186 std::move(cov),
187 detEl,
188 calibratedCharge,
189 calibStrip.time));
190 }
191 }
192
193 if(m_merge) {
194 // merge strip prds that fire closeby channels (not clusterizing wires and pads)
195 std::vector<std::unique_ptr<Muon::sTgcPrepData>> sTgcStripClusters;
196 ATH_CHECK(m_clusterBuilderTool->getClusters(ctx, std::move(sTgcStripPrds), sTgcStripClusters)); // Clusterize strips
197
198 for ( std::unique_ptr<Muon::sTgcPrepData>& it : sTgcStripClusters ) {
199 it->setHashAndIndex(prdColl->identifyHash(), prdColl->size());
200 prdColl->push_back(std::move(it));
201 }
202 for ( Muon::sTgcPrepData& prd : sTgcWirePrds ) {
203 prd.setHashAndIndex(prdColl->identifyHash(), prdColl->size());
204 prdColl->push_back(std::make_unique<sTgcPrepData>(std::move(prd)));
205 }
206 for (Muon::sTgcPrepData& prd : sTgcPadPrds ) {
207 prd.setHashAndIndex(prdColl->identifyHash(), prdColl->size());
208 prdColl->push_back(std::make_unique<sTgcPrepData>(std::move(prd)));
209 }
210 }
211 const bool convertXAOD = !m_xAODPadKey.empty() || !m_xAODStripKey.empty() ||
212 !m_xAODWireKey.empty();
213
214 if (convertXAOD) {
215 for (const Muon::sTgcPrepData* prd : *prdColl) {
216 const Identifier prdId = prd->identify();
217 const int gasGap = id_helper.gasGap(prdId);
218 const int channel = id_helper.channel(prdId);
219 const int chType = id_helper.channelType(prdId);
220 xAOD::sTgcMeasurement* outHit{nullptr};
221 ATH_MSG_VERBOSE("Convert "
222 <<m_idHelperSvc->toString(prdId)<<". "<<Amg::toString(prd->localPosition())
223 <<", cov: "<<prd->localCovariance()(0,0)
224 <<" global pos: "<<Amg::toString(prd->globalPosition()));
226 outHit = xAODcontainers.pad->push_back(std::make_unique<xAOD::sTgcPadHit>());
227 xAOD::MeasMatrix<2> lCov{xAOD::MeasMatrix<2>::Identity()};
228 lCov(1,1) = prd->localCovariance()(0,0);
230 // lCov(1,1) = prd->localCovariance()(1,1);
231 outHit->setMeasurement<2>(m_idHelperSvc->detElementHash(prdId),
232 xAOD::toStorage(Eigen::Rotation2D{-M_PI_2}*prd->localPosition()),
233 std::move(lCov));
235 outHit = xAODcontainers.wire->push_back(std::make_unique<xAOD::sTgcWireHit>());
237 auto stripHit = xAODcontainers.strip->push_back(std::make_unique<xAOD::sTgcStripCluster>());
238 stripHit->setStripCharges(prd->stripCharges());
239 stripHit->setStripNumbers(prd->stripNumbers());
240 stripHit->setStripTimes(prd->stripTimes());
241 outHit = stripHit;
242 }
243 if (!outHit) {
244 continue;
245 }
249 const double locPos = (chType == sTgcIdHelper::sTgcChannelTypes::Wire ? -1. : 1.) * prd->localPosition().x();
250 xAOD::MeasVector<1> lPos = locPos * xAOD::MeasVector<1>::UnitX();
251 xAOD::MeasMatrix<1> lCov{};
252 lCov(0,0) = prd->localCovariance()(0,0);
253 outHit->setMeasurement<1>(m_idHelperSvc->detElementHash(prdId),
254 std::move(lPos),
255 std::move(lCov));
256
257 }
258 outHit->setChannelNumber(channel);
259 outHit->setGasGap(gasGap);
260 outHit->setAuthor(prd->author());
261 outHit->setTime(prd->time());
262 outHit->setCharge(prd->charge());
263 outHit->setIdentifier(prdId.get_compact());
264 if (m_detMgrR4) {
265 outHit->setReadoutElement(m_detMgrR4->getsTgcReadoutElement(prdId));
266 }
267 }
268 }
269
270
271 // now add the collection to the container
272 ATH_CHECK( lock.addOrDelete(std::move( prdColl ) ) );
273 ATH_MSG_DEBUG("PRD hash " << hash << " has been moved to container");
274
275 return StatusCode::SUCCESS;
276}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_VERBOSE(x)
const double width
size_type size() const noexcept
Returns the number of elements in the collection.
bool OnlineAndPresentInAnotherView()
This method is to avoid calling an expensive operation in the offline case.
StatusCode addOrDelete(std::unique_ptr< T > ptr)
value_type get_compact() const
Get the compact id.
const sTgcReadoutElement * getsTgcReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
const MuonPadDesign * getPadDesign(const Identifier &id) const
returns the MuonChannelDesign class for the given identifier
virtual bool stripPosition(const Identifier &id, Amg::Vector2D &pos) const override final
strip position - should be renamed to channel position If the strip number is outside the range of va...
const MuonChannelDesign * getDesign(const Identifier &id) const
returns the MuonChannelDesign class for the given identifier
virtual int get_id(const IdentifierHash &hash_id, Identifier &id, const IdContext *context=0) const override
Create compact id from hash id (return == 0 for OK)
IdContext module_context() const
id for module
const IdentifierHash & identifyHash() const
ToolHandle< ISTgcClusterBuilderTool > m_clusterBuilderTool
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.
ConstMatrixMap< N > localCovariance() const
Returns the local covariance of the measurement.
void setIdentifier(const DetectorIdentType measId)
Sets the full Identifier 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 setChannelNumber(uint16_t channel)
Set the channel number of the measurement.
void setReadoutElement(const MuonGMR4::sTgcReadoutElement *readoutEle)
set the pointer to the sTgcReadoutElement
void setGasGap(uint8_t gap)
Set the associated gas gap of the measurement.
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Eigen::Matrix< double, 2, 1 > Vector2D
double resolution[nGasTypes][nParametersResolution]
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.
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
double channelWidth() const
calculate local channel width
double channelWidth(const Amg::Vector2D &pos, bool measPhi, bool preciseMeas=false) const
calculate local channel width

◆ processRDOContainer()

void Muon::sTgcRdoToPrepDataToolMT::processRDOContainer ( const EventContext & ctx,
outputCache & xAODcontainers,
const std::vector< IdentifierHash > & idsToDecode ) const
protected

Definition at line 294 of file sTgcRdoToPrepDataToolMT.cxx.

297{
298 ATH_MSG_DEBUG("In processRDOContainer");
299 const STGC_RawDataContainer* rdoContainer = getRdoContainer(ctx);
300 if (!rdoContainer) return;
301
302 // run in unseeded mode
303 for (const STGC_RawDataCollection* rdoColl : *rdoContainer) {
304 if (rdoColl->empty()) continue;
305 ATH_MSG_DEBUG("New RDO collection with " << rdoColl->size() << "STGC Hits");
306
307 const IdentifierHash hash = rdoColl->identifyHash();
308
309 // check if we actually want to decode this RDO collection
310 if(!idsToDecode.empty() and std::find(idsToDecode.begin(), idsToDecode.end(), hash)==idsToDecode.end()) {
311 ATH_MSG_DEBUG("Hash ID " << hash << " not in input list, ignore");
312 continue;
313 } else ATH_MSG_DEBUG("Going to decode " << hash);
314
315 if(processCollection(ctx, xAODcontainers, rdoColl).isFailure()) {
316 ATH_MSG_DEBUG("processCsm returns a bad StatusCode - keep going for new data collections in this event");
317 }
318 }
319}
StatusCode processCollection(const EventContext &ctx, outputCache &xAODcontainers, const STGC_RawDataCollection *rdoColl) const
const STGC_RawDataContainer * getRdoContainer(const EventContext &ctx) const

◆ provideEmptyContainer()

StatusCode Muon::sTgcRdoToPrepDataToolMT::provideEmptyContainer ( const EventContext & ctx) const
override

Definition at line 340 of file sTgcRdoToPrepDataToolMT.cxx.

340 {
341 return setupOutputContainers(ctx).isValid ? StatusCode::SUCCESS : StatusCode::FAILURE;
342}

◆ setupOutputContainers()

sTgcRdoToPrepDataToolMT::outputCache sTgcRdoToPrepDataToolMT::setupOutputContainers ( const EventContext & ctx) const
protected

use the cache to get the container

Definition at line 346 of file sTgcRdoToPrepDataToolMT.cxx.

346 {
347 outputCache containers;
348 if (!m_xAODStripKey.empty()) {
349 containers.strip = SG::WriteHandle<xAOD::sTgcStripContainer>{m_xAODStripKey, ctx};
350 if (!containers.strip.record(std::make_unique<xAOD::sTgcStripContainer>(),
351 std::make_unique<xAOD::sTgcStripAuxContainer>()).isSuccess()){
352 ATH_MSG_FATAL("Failed to record "<<m_xAODStripKey.fullKey());
353 return containers;
354 }
355 }
356 if (!m_xAODPadKey.empty()) {
357 containers.pad = SG::WriteHandle<xAOD::sTgcPadContainer>{m_xAODPadKey, ctx};
358 if (!containers.pad.record(std::make_unique<xAOD::sTgcPadContainer>(),
359 std::make_unique<xAOD::sTgcPadAuxContainer>()).isSuccess()){
360 ATH_MSG_FATAL("Failed to record "<<m_xAODPadKey.fullKey());
361 return containers;
362 }
363 }
364 if (!m_xAODWireKey.empty()) {
365 containers.wire = SG::WriteHandle<xAOD::sTgcWireContainer>{m_xAODWireKey, ctx};
366 if (!containers.wire.record(std::make_unique<xAOD::sTgcWireContainer>(),
367 std::make_unique<xAOD::sTgcWireAuxContainer>()).isSuccess()){
368 ATH_MSG_FATAL("Failed to record "<<m_xAODWireKey.fullKey());
369 return containers;
370 }
371 }
372
373 containers.prd = SG::WriteHandle<Muon::sTgcPrepDataContainer>(m_stgcPrepDataContainerKey, ctx);
374 if(m_prdContainerCacheKey.key().empty()) {
375 // No external cache, just record the container
376 const int hashMax = m_idHelperSvc->stgcIdHelper().module_hash_max();
377 if (!containers.prd.record(std::make_unique<Muon::sTgcPrepDataContainer>(hashMax)).isSuccess()){
378 ATH_MSG_FATAL("Faile to record "<<m_stgcPrepDataContainerKey.fullKey());
379 return containers;
380 }
381 } else {
383 SG::UpdateHandle<sTgcPrepDataCollection_Cache> update(m_prdContainerCacheKey, ctx);
384 if (!update.isValid()) {
385 ATH_MSG_FATAL("Invalid UpdateHandle " << m_prdContainerCacheKey.key());
386 return containers;
387 }
388 if (!containers.prd.record(std::make_unique<Muon::sTgcPrepDataContainer>(update.ptr())).isSuccess()) {
389 ATH_MSG_FATAL("Failed to record "<<m_stgcPrepDataContainerKey.fullKey()
390 <<" from "<<m_prdContainerCacheKey.fullKey());
391 return containers;
392 }
393 }
394 containers.isValid = true;
395 return containers;
396}
SG::WriteHandle< Muon::sTgcPrepDataContainer > prd

Member Data Documentation

◆ m_calibTool

ToolHandle<INSWCalibTool> Muon::sTgcRdoToPrepDataToolMT::m_calibTool {this,"NSWCalibTool", ""}
protected

Definition at line 87 of file sTgcRdoToPrepDataToolMT.h.

87{this,"NSWCalibTool", ""};

◆ m_clusterBuilderTool

ToolHandle<ISTgcClusterBuilderTool> Muon::sTgcRdoToPrepDataToolMT::m_clusterBuilderTool {this,"ClusterBuilderTool","Muon::SimpleSTgcClusterBuilderTool/SimpleSTgcClusterBuilderTool"}
protected

Definition at line 86 of file sTgcRdoToPrepDataToolMT.h.

86{this,"ClusterBuilderTool","Muon::SimpleSTgcClusterBuilderTool/SimpleSTgcClusterBuilderTool"};

◆ m_detMgrR4

const MuonGMR4::MuonDetectorManager* Muon::sTgcRdoToPrepDataToolMT::m_detMgrR4 {nullptr}
protected

Definition at line 100 of file sTgcRdoToPrepDataToolMT.h.

100{nullptr};

◆ m_idHelperSvc

ServiceHandle<Muon::IMuonIdHelperSvc> Muon::sTgcRdoToPrepDataToolMT::m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}
protected

Definition at line 79 of file sTgcRdoToPrepDataToolMT.h.

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

◆ m_merge

Gaudi::Property<bool> Muon::sTgcRdoToPrepDataToolMT::m_merge {this, "Merge", true}
protected

Definition at line 84 of file sTgcRdoToPrepDataToolMT.h.

84{this, "Merge", true}; // merge Prds

◆ m_muDetMgrKey

SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> Muon::sTgcRdoToPrepDataToolMT::m_muDetMgrKey {this, "DetectorManagerKey", "MuonDetectorManager", "Key of input MuonDetectorManager condition data"}
protected

Definition at line 77 of file sTgcRdoToPrepDataToolMT.h.

77{this, "DetectorManagerKey", "MuonDetectorManager", "Key of input MuonDetectorManager condition data"};

◆ m_prdContainerCacheKey

SG::UpdateHandleKey<sTgcPrepDataCollection_Cache> Muon::sTgcRdoToPrepDataToolMT::m_prdContainerCacheKey {this, "PrdCacheKey", "", "Optional external cache for the sTGC PRD container"}
protected

This is the key for the cache for the sTGC PRD containers, can be empty.

Definition at line 90 of file sTgcRdoToPrepDataToolMT.h.

90{this, "PrdCacheKey", "", "Optional external cache for the sTGC PRD container"};

◆ m_rdoContainerKey

SG::ReadHandleKey<STGC_RawDataContainer> Muon::sTgcRdoToPrepDataToolMT::m_rdoContainerKey {this, "InputCollection", "sTGCRDO", "RDO container to read"}
protected

Definition at line 82 of file sTgcRdoToPrepDataToolMT.h.

82{this, "InputCollection", "sTGCRDO", "RDO container to read"};

◆ m_stgcPrepDataContainerKey

SG::WriteHandleKey<sTgcPrepDataContainer> Muon::sTgcRdoToPrepDataToolMT::m_stgcPrepDataContainerKey {this, "OutputCollection", "STGC_Measurements", "Muon::sTgcPrepDataContainer to record"}
protected

Definition at line 83 of file sTgcRdoToPrepDataToolMT.h.

83{this, "OutputCollection", "STGC_Measurements", "Muon::sTgcPrepDataContainer to record"};

◆ m_useNewGeo

Gaudi::Property<bool> Muon::sTgcRdoToPrepDataToolMT::m_useNewGeo
protected
Initial value:
{this, "UseR4DetMgr", false,
"Switch between the legacy and the new geometry"}

Definition at line 97 of file sTgcRdoToPrepDataToolMT.h.

97 {this, "UseR4DetMgr", false,
98 "Switch between the legacy and the new geometry"};

◆ m_xAODPadKey

SG::WriteHandleKey<xAOD::sTgcPadContainer> Muon::sTgcRdoToPrepDataToolMT::m_xAODPadKey {this, "xAODPadKey", "", "If empty, do not produce xAOD, otherwise this is the key of the output xAOD MDT PRD container"}
protected

Definition at line 94 of file sTgcRdoToPrepDataToolMT.h.

94{this, "xAODPadKey", "", "If empty, do not produce xAOD, otherwise this is the key of the output xAOD MDT PRD container"};

◆ m_xAODStripKey

SG::WriteHandleKey<xAOD::sTgcStripContainer> Muon::sTgcRdoToPrepDataToolMT::m_xAODStripKey {this, "xAODStripKey", "", "If empty, do not produce xAOD, otherwise this is the key of the output xAOD MDT PRD container"}
protected

Definition at line 93 of file sTgcRdoToPrepDataToolMT.h.

93{this, "xAODStripKey", "", "If empty, do not produce xAOD, otherwise this is the key of the output xAOD MDT PRD container"};

◆ m_xAODWireKey

SG::WriteHandleKey<xAOD::sTgcWireContainer> Muon::sTgcRdoToPrepDataToolMT::m_xAODWireKey {this, "xAODWireKey", "", "If empty, do not produce xAOD, otherwise this is the key of the output xAOD MDT PRD container"}
protected

Definition at line 95 of file sTgcRdoToPrepDataToolMT.h.

95{this, "xAODWireKey", "", "If empty, do not produce xAOD, otherwise this is the key of the output xAOD MDT PRD container"};

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