ATLAS Offline Software
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Muon::CscRdoToCscPrepDataToolMT Class Reference

This class is only used in a single-thread mode as CscRdoToCscPrepDataToolMT has the equivalent functions defined for a thread-safe setup. More...

#include <CscRdoToCscPrepDataToolMT.h>

Inheritance diagram for Muon::CscRdoToCscPrepDataToolMT:
Collaboration diagram for Muon::CscRdoToCscPrepDataToolMT:

Public Member Functions

 CscRdoToCscPrepDataToolMT (const std::string &type, const std::string &name, const IInterface *parent)
 
virtual ~CscRdoToCscPrepDataToolMT ()=default
 
virtual StatusCode initialize () override
 
virtual StatusCode decode (const EventContext &ctx, const std::vector< IdentifierHash > &givenIdhs) const override
 
virtual StatusCode decode (const EventContext &ctx, const std::vector< uint32_t > &robIDs) const override
 
virtual StatusCode provideEmptyContainer (const EventContext &ctx) const override
 

Protected Member Functions

StatusCode decodeImpl (Muon::CscStripPrepDataContainer *outputCollection, const CscRawDataContainer *rdoContainer, IdentifierHash givenHashId) const
 
StatusCode decodeImpl (Muon::CscStripPrepDataContainer *outputCollection, const CscRawDataContainer *rdoContainer) const
 

Protected Attributes

SG::ReadCondHandleKey< MuonGM::MuonDetectorManagerm_muDetMgrKey
 
ServiceHandle< Muon::IMuonIdHelperSvcm_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}
 
SG::WriteHandleKey< Muon::CscStripPrepDataContainerm_outputCollectionKey
 CscStripPrepRawData containers. More...
 
SG::ReadHandleKey< CscRawDataContainerm_rdoContainerKey {this, "RDOContainer", "CSCRDO", "CscRawDataContainer to retrieve"}
 
SG::UpdateHandleKey< CscStripPrepDataCollection_Cachem_prdContainerCacheKey
 This is the key for the cache for the CSC PRD containers, can be empty. More...
 
ToolHandle< ICscCalibToolm_cscCalibTool {this, "CscCalibTool", "CscCalibTool/CscCalibTool"}
 CSC Calibration tools. More...
 
ToolHandle< ICSC_RDO_Decoderm_cscRdoDecoderTool {this, "CscRdoDecoderTool", "Muon::CscRDO_Decoder/CscRDO_Decoder"}
 
ServiceHandle< CSCcablingSvcm_cabling {this, "CablingSvc", "CSCcablingSvc"}
 
Gaudi::Property< int > m_cscOffset {this, "CSCHashIdOffset", 22000}
 Identifier hash offset. More...
 
Gaudi::Property< bool > m_decodeData {this, "DecodeData", true}
 toggle on/off the decoding of CSC RDO into CscStripPrepData More...
 

Detailed Description

This class is only used in a single-thread mode as CscRdoToCscPrepDataToolMT has the equivalent functions defined for a thread-safe setup.

Definition at line 39 of file CscRdoToCscPrepDataToolMT.h.

Constructor & Destructor Documentation

◆ CscRdoToCscPrepDataToolMT()

CscRdoToCscPrepDataToolMT::CscRdoToCscPrepDataToolMT ( const std::string &  type,
const std::string &  name,
const IInterface *  parent 
)

Definition at line 21 of file CscRdoToCscPrepDataToolMT.cxx.

21  :
22  base_class(type, name, parent) {}

◆ ~CscRdoToCscPrepDataToolMT()

virtual Muon::CscRdoToCscPrepDataToolMT::~CscRdoToCscPrepDataToolMT ( )
virtualdefault

Member Function Documentation

◆ decode() [1/2]

StatusCode CscRdoToCscPrepDataToolMT::decode ( const EventContext &  ctx,
const std::vector< IdentifierHash > &  givenIdhs 
) const
overridevirtual

Recording the PRD container in StoreGate

Definition at line 63 of file CscRdoToCscPrepDataToolMT.cxx.

63  {
64  // WARNING : Trigger Part is not finished.
65  unsigned int sizeVectorRequested = givenIdhs.size();
66  ATH_MSG_DEBUG("decode for " << sizeVectorRequested << " offline collections called");
67 
68 
71 
72  // Caching of PRD container
73  if (m_prdContainerCacheKey.key().empty()) {
74  // without the cache we just record the container
75  ATH_CHECK(outputHandle.record(std::make_unique<Muon::CscStripPrepDataContainer>(m_idHelperSvc->cscIdHelper().module_hash_max())));
76  ATH_MSG_DEBUG("Created container " << m_outputCollectionKey.key());
77  } else {
78  // use the cache to get the container
80  if (!update.isValid()) {
81  ATH_MSG_FATAL("Invalid UpdateHandle " << m_prdContainerCacheKey.key());
82  return StatusCode::FAILURE;
83  }
84  ATH_CHECK(outputHandle.record(std::make_unique<Muon::CscStripPrepDataContainer>(update.ptr())));
85  ATH_MSG_DEBUG("Created container using cache for " << m_prdContainerCacheKey.key());
86  }
87  // Pass the container from the handle
89 
90  // retrieve the pointer to the RDO container
91  // this will just get the pointer from memory if the container is already recorded in SG
92  // or
93  // will activate the TP converter for reading from pool root the RDO container and recording it in SG
94 
95  auto rdoContainerHandle = SG::makeHandle(m_rdoContainerKey, ctx);
96  if (!rdoContainerHandle.isValid()) {
97  ATH_MSG_WARNING("No CSC RDO container in StoreGate!");
98  return StatusCode::SUCCESS;
99  }
100  const CscRawDataContainer* rdoContainer = rdoContainerHandle.cptr();
101 
102  ATH_MSG_DEBUG("Retrieved " << rdoContainer->size() << " CSC RDOs.");
103  // here the RDO container is in SG and its pointer rdoContainer is initialised
104  // decoding
105  if (sizeVectorRequested) {
106  // seeded decoding
107  for (unsigned int i = 0; i < sizeVectorRequested; ++i) {
108  if (decodeImpl(outputCollection, rdoContainer, givenIdhs[i]).isFailure()) {
109  ATH_MSG_ERROR("Unable to decode CSC RDO " << i << "th into CSC PrepRawData");
110  return StatusCode::FAILURE;
111  }
112  }
113  } else {
114  // unseeded decoding
115  if (decodeImpl(outputCollection, rdoContainer).isFailure()) {
116  ATH_MSG_ERROR("Unable to decode CSC RDO ");
117  return StatusCode::FAILURE;
118  }
119  }
120 
121  return StatusCode::SUCCESS;
122 }

◆ decode() [2/2]

StatusCode CscRdoToCscPrepDataToolMT::decode ( const EventContext &  ctx,
const std::vector< uint32_t > &  robIDs 
) const
overridevirtual

Definition at line 38 of file CscRdoToCscPrepDataToolMT.cxx.

38  {
39  ATH_MSG_FATAL("ROB based decoding is not supported....");
40  return StatusCode::FAILURE;
41 }

◆ decodeImpl() [1/2]

StatusCode CscRdoToCscPrepDataToolMT::decodeImpl ( Muon::CscStripPrepDataContainer outputCollection,
const CscRawDataContainer rdoContainer 
) const
protected

new CscPrepRawData

Definition at line 288 of file CscRdoToCscPrepDataToolMT.cxx.

289  {
290  typedef CscRawDataContainer::const_iterator collection_iterator;
291 
292  IdContext cscContext = m_idHelperSvc->cscIdHelper().module_context();
294  const MuonGM::MuonDetectorManager* muDetMgr = muDetMgrHandle.cptr();
295 
296  // if CSC decoding is switched off stop here
297  if (!m_decodeData) {
298  ATH_MSG_DEBUG("Stored empty container. "
299  << "Decoding CSC RDO into CSC PrepRawData is switched off");
300  return StatusCode::SUCCESS;
301  }
302  ATH_MSG_DEBUG("Decoding CSC RDO into CSC PrepRawData");
303 
304  collection_iterator rdoColl = rdoContainer->begin();
305  collection_iterator lastRdoColl = rdoContainer->end();
306  std::vector<float> charges;
307  charges.reserve(4);
308  std::vector<uint16_t> samples;
309  samples.reserve(4);
310 
311  IdentifierHash cscHashId;
312  for (; rdoColl != lastRdoColl; ++rdoColl) {
313  if (!(*rdoColl)->empty()) {
314  ATH_MSG_DEBUG(" Number of RawData in this rdo " << (*rdoColl)->size());
315 
316  const CscRawDataCollection* cscCollection = *rdoColl;
317  unsigned int samplingTime = cscCollection->rate();
318  unsigned int numSamples = cscCollection->numSamples();
319  bool samplingPhase = cscCollection->samplingPhase();
320 
321  if (int(samplingTime) != int(m_cscCalibTool->getSamplingTime())) {
322  ATH_MSG_WARNING(" CSC sampling time from Collection is NOT consistant to calibTool parameter!!!!!!! ");
323  }
324  // For each Rdo, loop over RawData, converter RawData to PrepRawData
325  // Retrieve/create PrepRawData collection, and insert PrepRawData into collection
326  CscRawDataCollection::const_iterator itD = cscCollection->begin();
327  CscRawDataCollection::const_iterator itD_e = cscCollection->end();
328 
329  // Each RDO Collection goes into a PRD Collection, but we need to know what hash the PRD container is
330  // and this is determined by the stationID, no the RDO hash ID
331  ATH_MSG_DEBUG("CSC RDO ID " << (*rdoColl)->identify() << " with hashID " << (*rdoColl)->identifyHash());
332  // Just use the first iterator entry as stationID does not change between data inside a single container
333  Identifier stationId = m_cscRdoDecoderTool->stationIdentifier((const CscRawData*)(*itD), &m_idHelperSvc->cscIdHelper());
334  if (m_idHelperSvc->cscIdHelper().get_hash(stationId, cscHashId, &cscContext)) {
335  ATH_MSG_WARNING("Unable to get CSC digiti collection hash id "
336  << "context begin_index = " << cscContext.begin_index()
337  << " context end_index = " << cscContext.end_index() << " the identifier is ");
338  stationId.show();
339  }
340 
341  ATH_MSG_DEBUG("Create CSC PRD Collection with hash " << cscHashId);
342  std::unique_ptr<CscStripPrepDataCollection> collection = nullptr;
343  CscStripPrepDataContainer::IDC_WriteHandle lock = outputCollection->getWriteHandle(cscHashId);
344  if (lock.alreadyPresent()) {
345  ATH_MSG_DEBUG("CSC PRD collection already exist with collection hash = " << cscHashId << " collection filling is skipped!");
346  continue;
347  } else {
348  ATH_MSG_DEBUG("CSC PRD collection does not exist - creating a new one with hash = " << cscHashId);
349  collection = std::make_unique<CscStripPrepDataCollection>(cscHashId);
350  collection->setIdentifier(stationId);
351  }
352 
353  // This loops over the RDO data, decodes and puts into the PRD collection
354  for (; itD != itD_e; ++itD) {
355  const CscRawData* data = (*itD);
356  uint16_t width = data->width();
357  uint16_t totalSamples = (data->samples()).size();
358  uint32_t hashOffset = data->hashId();
359 
360  ATH_MSG_DEBUG("DecodeAll*Size of online cluster in this RawData: "
361  << " Width = " << width << " Samples = " << totalSamples << " stationId : " << stationId
362  << " hashOffset : " << hashOffset);
363 
364  for (unsigned int j = 0; j < width; ++j) {
365  const Identifier channelId = m_cscRdoDecoderTool->channelIdentifier(data, &m_idHelperSvc->cscIdHelper(), j);
366  ATH_MSG_DEBUG("DecodeAll**LOOP over width " << j << " " << channelId);
367 
368  const CscReadoutElement* descriptor = muDetMgr->getCscReadoutElement(channelId);
369  // calculate local positions on the strip planes
370  if (!descriptor) {
371  ATH_MSG_WARNING("Invalid descriptor for " << m_idHelperSvc->cscIdHelper().show_to_string(channelId)
372  << " Skipping channel ");
373  continue;
374  } else if (!descriptor->containsId(channelId)) {
375  ATH_MSG_WARNING("Identifier from the cabling service <"
376  << m_idHelperSvc->cscIdHelper().show_to_string(channelId)
377  << "> inconsistent with the geometry of detector element <"
378  << m_idHelperSvc->cscIdHelper().show_to_string(descriptor->identify()) << "> =>>ignore this hit");
379  continue;
380  }
381 
382  float timeOfFirstSample = 0.0;
383  bool extractSamples = data->samples(j, numSamples, samples);
384  if (!extractSamples) {
385  ATH_MSG_WARNING("Unable to extract samples for strip " << j << " Online Cluster width = " << width
386  << " for number of Samples = " << numSamples
387  << " continuing ...");
388  continue;
389  }
390 
391  IdentifierHash stripHash;
392  if (m_idHelperSvc->cscIdHelper().get_channel_hash(channelId, stripHash)) {
393  ATH_MSG_WARNING("Unable to get CSC strip hash id");
394  channelId.show();
395  }
396 
397  Identifier channelIdFromHash;
398  m_idHelperSvc->cscIdHelper().get_id(stripHash, channelIdFromHash, &cscContext);
399 
400  bool adctocharge = m_cscCalibTool->adcToCharge(samples, stripHash, charges);
401  if (!adctocharge) {
402  ATH_MSG_WARNING(" CSC conversion ADC to Charge failed "
403  << "CSC PrepData not build ... skipping ");
404  continue;
405  }
406  if (samples.size() >= 4)
407  ATH_MSG_DEBUG("DecodeAll*** ADC: "
408  << m_idHelperSvc->cscIdHelper().show_to_string(channelId) << " " << (int)stripHash << " "
409  << m_idHelperSvc->cscIdHelper().show_to_string(channelIdFromHash) << " " << samples[0] << " "
410  << samples[1] << " " << samples[2] << " " << samples[3] << " Charges: "
411  << " " << charges[0] << " " << charges[1] << " " << charges[2] << " " << charges[3]);
412  if (m_idHelperSvc->cscIdHelper().get_hash(stationId, cscHashId, &cscContext)) {
413  ATH_MSG_WARNING("Unable to get CSC hash id from CSC RDO collection "
414  << "context begin_index = " << cscContext.begin_index()
415  << " context end_index = " << cscContext.end_index() << " the identifier is ");
416  stationId.show();
417  }
418 
419  // Check if this strip is already decoded.. Then we don't have to decode it again
420  bool IsThisStripDecoded = 0;
421  for (CscStripPrepDataCollection::const_iterator idig = collection->begin(); idig != collection->end(); ++idig) {
422  const CscStripPrepData& dig = **idig;
423  Identifier did = dig.identify();
424  if (did == channelId) {
425  IsThisStripDecoded = 1;
426  break;
427  }
428  }
429  if (IsThisStripDecoded) continue;
430 
431  int measuresPhi = m_idHelperSvc->cscIdHelper().measuresPhi(channelId);
432 
433  Amg::Vector2D localWirePos1(descriptor->xCoordinateInTrackingFrame(channelId), 0.);
434 
435  int chamberLayer = m_idHelperSvc->cscIdHelper().chamberLayer(channelId);
436  float stripWidth = descriptor->cathodeReadoutPitch(chamberLayer, measuresPhi);
437  double errPos = stripWidth / sqrt(12.0);
438 
439  AmgSymMatrix(2) covariance;
440  covariance.setIdentity();
441  covariance *= errPos * errPos;
442  auto errClusterPos = Amg::MatrixX(covariance);
443 
445  CscStripPrepData* newPrepData = new CscStripPrepData(channelId, cscHashId, localWirePos1, std::move(errClusterPos),
446  descriptor, charges, timeOfFirstSample, samplingTime);
447 
448  if (samplingPhase) newPrepData->set_samplingPhase();
449  newPrepData->setHashAndIndex(collection->identifyHash(), collection->size());
450  collection->push_back(newPrepData);
451  }
452  }
453  // Record the container after looping through all the RDO data in this RDO collection
454  StatusCode status_lock = lock.addOrDelete(std::move(collection));
455  if (status_lock.isFailure()) {
456  ATH_MSG_ERROR("Could not insert CscStripPrepdataCollection into CscStripPrepdataContainer...");
457  return StatusCode::FAILURE;
458  }
459  }
460  }
461  return StatusCode::SUCCESS;
462 }

◆ decodeImpl() [2/2]

StatusCode CscRdoToCscPrepDataToolMT::decodeImpl ( Muon::CscStripPrepDataContainer outputCollection,
const CscRawDataContainer rdoContainer,
IdentifierHash  givenHashId 
) const
protected

create the CSC RDO decoder

new CscStripPrepRawData

Definition at line 124 of file CscRdoToCscPrepDataToolMT.cxx.

126  {
127  IdContext cscContext = m_idHelperSvc->cscIdHelper().module_context();
129  const MuonGM::MuonDetectorManager* muDetMgr = muDetMgrHandle.cptr();
130 
131  // if CSC decoding is switched off stop here
132  if (!m_decodeData) {
133  ATH_MSG_DEBUG("Stored empty container; Decoding CSC RDO into CSC PrepRawData is switched off");
134  return StatusCode::SUCCESS;
135  }
136 
137  // These collections can be empty for the trigger
138  if (!outputCollection || outputCollection->empty()) {
139  ATH_MSG_DEBUG("Stored empty collection.");
140  return StatusCode::SUCCESS;
141  }
142 
143  ATH_MSG_DEBUG("Decoding CSC RDO into CSC PrepRawData");
145  //**********************************************
146  // retrieve specific collection for the givenID
147  uint16_t idColl = 0xffff;
148  m_cabling->hash2CollectionId(givenHashId, idColl);
149  const CscRawDataCollection* rawCollection = rdoContainer->indexFindPtr(idColl);
150  if (nullptr == rawCollection) {
151  ATH_MSG_DEBUG("Specific CSC RDO collection retrieving failed for collection hash = " << idColl);
152  return StatusCode::SUCCESS;
153  }
154 
155  ATH_MSG_DEBUG("Retrieved " << rawCollection->size() << " CSC RDOs.");
156  // return if the input raw collection is empty (can happen for seeded decoding in trigger)
157  if (rawCollection->empty()) return StatusCode::SUCCESS;
158 
159  //************************************************
160  IdentifierHash cscHashId;
161 
162  unsigned int samplingTime = rawCollection->rate();
163  unsigned int numSamples = rawCollection->numSamples();
164  bool samplingPhase = rawCollection->samplingPhase();
165  std::vector<float> charges;
166  charges.reserve(4);
167  std::vector<uint16_t> samples;
168  samples.reserve(4);
169 
170  if (int(samplingTime) != int(m_cscCalibTool->getSamplingTime())) {
171  ATH_MSG_WARNING(" CSC sampling time from Collection is NOT consistant to calibTool parameter!!!!!!! ");
172  }
173 
174  // For each Rdo, loop over RawData, converter RawData to PrepRawData
175  // Retrieve/create PrepRawData collection, and insert PrepRawData into collection
176  CscRawDataCollection::const_iterator itD = rawCollection->begin();
177  CscRawDataCollection::const_iterator itD_e = rawCollection->end();
178 
179  // Each RDO Collection goes into a PRD Collection, but we need to know what hash the PRD container is
180  // and this is determined by the stationID, no the RDO hash ID
181  ATH_MSG_DEBUG("CSC RDO ID " << rawCollection->identify() << " with hashID " << rawCollection->identifyHash());
182  // Just use the first iterator entry as stationID does not change between data inside a single container
183  Identifier stationId = m_cscRdoDecoderTool->stationIdentifier((const CscRawData*)(*itD), &m_idHelperSvc->cscIdHelper());
184  if (m_idHelperSvc->cscIdHelper().get_hash(stationId, cscHashId, &cscContext)) {
185  ATH_MSG_WARNING("Unable to get CSC digiti collection hash id "
186  << "context begin_index = " << cscContext.begin_index() << " context end_index = " << cscContext.end_index()
187  << " the identifier is ");
188  stationId.show();
189  }
190  ATH_MSG_DEBUG("Create CSC PRD Collection with hash " << cscHashId << " (givenHashId is " << givenHashId << ")");
191  std::unique_ptr<CscStripPrepDataCollection> collection = nullptr;
192  CscStripPrepDataContainer::IDC_WriteHandle lock = outputCollection->getWriteHandle(cscHashId);
193  // Note that if the hash check above works, we should never reach this step where the lock is present
194  if (lock.alreadyPresent()) {
195  ATH_MSG_DEBUG("CSC PRD collection already exist with collection hash = " << cscHashId << " collection filling is skipped!");
196  return StatusCode::SUCCESS;
197  } else {
198  ATH_MSG_DEBUG("CSC PRD collection does not exist - creating a new one with hash = " << cscHashId);
199  collection = std::make_unique<CscStripPrepDataCollection>(cscHashId);
200  collection->setIdentifier(stationId);
201  }
202 
203  for (; itD != itD_e; ++itD) {
204  const CscRawData* data = (*itD);
205  uint16_t width = data->width();
206  uint16_t totalSamples = (data->samples()).size();
207  uint32_t hashOffset = data->hashId();
208 
209  ATH_MSG_DEBUG(" Size of online cluster in this RawData: "
210  << " Width = " << width << " Samples = " << totalSamples << " stationId : " << stationId
211  << " hashOffset : " << hashOffset);
212 
213  for (unsigned int j = 0; j < width; ++j) {
214  const Identifier channelId = m_cscRdoDecoderTool->channelIdentifier(data, &m_idHelperSvc->cscIdHelper(), j);
215  ATH_MSG_DEBUG(" LOOP over width " << j << " " << channelId);
216 
217  const CscReadoutElement* descriptor = muDetMgr->getCscReadoutElement(channelId);
218  // calculate local positions on the strip planes
219  if (!descriptor) {
220  ATH_MSG_WARNING("Invalid descriptor for " << m_idHelperSvc->cscIdHelper().show_to_string(channelId)
221  << " Skipping channel ");
222  continue;
223  } else if (!descriptor->containsId(channelId)) {
224  ATH_MSG_WARNING("Identifier from the cabling service <"
225  << m_idHelperSvc->cscIdHelper().show_to_string(channelId)
226  << "> inconsistent with the geometry of detector element <"
227  << m_idHelperSvc->cscIdHelper().show_to_string(descriptor->identify()) << "> =>>ignore this hit");
228  continue;
229  }
230 
231  float timeOfFirstSample = 0.0;
232  bool extractSamples = data->samples(j, numSamples, samples);
233  if (!extractSamples) {
234  ATH_MSG_WARNING("Unable to extract samples for strip " << j << " Online Cluster width = " << width
235  << " for number of Samples = " << numSamples << " continuing ...");
236  continue;
237  }
238 
239  IdentifierHash stripHash;
240  if (m_idHelperSvc->cscIdHelper().get_channel_hash(channelId, stripHash)) {
241  ATH_MSG_WARNING("Unable to get CSC strip hash id");
242  channelId.show();
243  }
244 
245  bool adctocharge = m_cscCalibTool->adcToCharge(samples, stripHash, charges);
246  if (!adctocharge) {
247  ATH_MSG_WARNING(" CSC conversion ADC to Charge failed "
248  << "CSC PrepData not build ... skipping ");
249  continue;
250  }
251  if (samples.size() >= 4)
252  ATH_MSG_DEBUG("ADC: " << m_idHelperSvc->cscIdHelper().show_to_string(channelId) << " " << samples[0] << " " << samples[1]
253  << " " << samples[2] << " " << samples[3] << " Charges: "
254  << " " << charges[0] << " " << charges[1] << " " << charges[2] << " " << charges[3]);
255 
256  int measuresPhi = m_idHelperSvc->cscIdHelper().measuresPhi(channelId);
257 
258  Amg::Vector2D localWirePos1(descriptor->xCoordinateInTrackingFrame(channelId), 0.);
259 
260  int chamberLayer = m_idHelperSvc->cscIdHelper().chamberLayer(channelId);
261  float stripWidth = descriptor->cathodeReadoutPitch(chamberLayer, measuresPhi);
262  double errPos = stripWidth / sqrt(12.0);
263 
264  AmgSymMatrix(2) covariance;
265  covariance.setIdentity();
266  covariance *= errPos * errPos;
267  Amg::MatrixX errClusterPos = Amg::MatrixX(covariance);
268 
270  CscStripPrepData* newPrepData = new CscStripPrepData(channelId, cscHashId, localWirePos1, std::move(errClusterPos), descriptor,
271  charges, timeOfFirstSample, samplingTime);
272 
273  if (samplingPhase) newPrepData->set_samplingPhase();
274  newPrepData->setHashAndIndex(collection->identifyHash(), collection->size());
275  collection->push_back(newPrepData);
276  }
277  }
278  // Record the container
279  StatusCode status_lock = lock.addOrDelete(std::move(collection));
280  if (status_lock.isFailure()) {
281  ATH_MSG_ERROR("Could not insert CscStripPrepdataCollection into CscStripPrepdataContainer...");
282  return StatusCode::FAILURE;
283  }
284  return StatusCode::SUCCESS;
285 }

◆ initialize()

StatusCode CscRdoToCscPrepDataToolMT::initialize ( )
overridevirtual

Definition at line 25 of file CscRdoToCscPrepDataToolMT.cxx.

25  {
26  ATH_CHECK(m_cscCalibTool.retrieve());
27  ATH_CHECK(m_cscRdoDecoderTool.retrieve());
28  ATH_CHECK(m_idHelperSvc.retrieve());
29  ATH_CHECK(m_cabling.retrieve());
30  // check if initializing of DataHandle objects success
32  ATH_CHECK(m_outputCollectionKey.initialize());
34  ATH_CHECK(m_prdContainerCacheKey.initialize(!m_prdContainerCacheKey.key().empty()));
35  return StatusCode::SUCCESS;
36 }

◆ provideEmptyContainer()

StatusCode CscRdoToCscPrepDataToolMT::provideEmptyContainer ( const EventContext &  ctx) const
overridevirtual

Recording the PRD container in StoreGate

Definition at line 42 of file CscRdoToCscPrepDataToolMT.cxx.

42  {
45 
46  // Caching of PRD container
47  if (m_prdContainerCacheKey.key().empty()) {
48  // without the cache we just record the container
49  ATH_CHECK(outputHandle.record(std::make_unique<Muon::CscStripPrepDataContainer>(m_idHelperSvc->cscIdHelper().module_hash_max())));
50  ATH_MSG_DEBUG("Created container " << m_outputCollectionKey.key());
51  } else {
52  // use the cache to get the container
54  if (!update.isValid()) {
55  ATH_MSG_FATAL("Invalid UpdateHandle " << m_prdContainerCacheKey.key());
56  return StatusCode::FAILURE;
57  }
58  ATH_CHECK(outputHandle.record(std::make_unique<Muon::CscStripPrepDataContainer>(update.ptr())));
59  ATH_MSG_DEBUG("Created container using cache for " << m_prdContainerCacheKey.key());
60  }
61  return StatusCode::SUCCESS;
62 }

Member Data Documentation

◆ m_cabling

ServiceHandle<CSCcablingSvc> Muon::CscRdoToCscPrepDataToolMT::m_cabling {this, "CablingSvc", "CSCcablingSvc"}
protected

Definition at line 79 of file CscRdoToCscPrepDataToolMT.h.

◆ m_cscCalibTool

ToolHandle<ICscCalibTool> Muon::CscRdoToCscPrepDataToolMT::m_cscCalibTool {this, "CscCalibTool", "CscCalibTool/CscCalibTool"}
protected

CSC Calibration tools.

Definition at line 76 of file CscRdoToCscPrepDataToolMT.h.

◆ m_cscOffset

Gaudi::Property<int> Muon::CscRdoToCscPrepDataToolMT::m_cscOffset {this, "CSCHashIdOffset", 22000}
protected

Identifier hash offset.

Definition at line 81 of file CscRdoToCscPrepDataToolMT.h.

◆ m_cscRdoDecoderTool

ToolHandle<ICSC_RDO_Decoder> Muon::CscRdoToCscPrepDataToolMT::m_cscRdoDecoderTool {this, "CscRdoDecoderTool", "Muon::CscRDO_Decoder/CscRDO_Decoder"}
protected

Definition at line 77 of file CscRdoToCscPrepDataToolMT.h.

◆ m_decodeData

Gaudi::Property<bool> Muon::CscRdoToCscPrepDataToolMT::m_decodeData {this, "DecodeData", true}
protected

toggle on/off the decoding of CSC RDO into CscStripPrepData

Definition at line 83 of file CscRdoToCscPrepDataToolMT.h.

◆ m_idHelperSvc

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

Definition at line 62 of file CscRdoToCscPrepDataToolMT.h.

◆ m_muDetMgrKey

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

Definition at line 59 of file CscRdoToCscPrepDataToolMT.h.

◆ m_outputCollectionKey

SG::WriteHandleKey<Muon::CscStripPrepDataContainer> Muon::CscRdoToCscPrepDataToolMT::m_outputCollectionKey
protected
Initial value:
{this, "OutputCollection", "CSC_Measurements",
"Muon::CscStripPrepDataContainer to record"}

CscStripPrepRawData containers.

Definition at line 65 of file CscRdoToCscPrepDataToolMT.h.

◆ m_prdContainerCacheKey

SG::UpdateHandleKey<CscStripPrepDataCollection_Cache> Muon::CscRdoToCscPrepDataToolMT::m_prdContainerCacheKey
protected
Initial value:
{this, "CscStripPrdContainerCacheKey", "" ,
"Optional external cache for the CSC RDO container"}

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

Definition at line 71 of file CscRdoToCscPrepDataToolMT.h.

◆ m_rdoContainerKey

SG::ReadHandleKey<CscRawDataContainer> Muon::CscRdoToCscPrepDataToolMT::m_rdoContainerKey {this, "RDOContainer", "CSCRDO", "CscRawDataContainer to retrieve"}
protected

Definition at line 68 of file CscRdoToCscPrepDataToolMT.h.


The documentation for this class was generated from the following files:
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
Muon::MuonPrepDataContainer
Template for Muon PRD containers (which are basically collections of MuonPrepDataCollections).
Definition: MuonPrepDataContainer.h:42
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
Amg::MatrixX
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Definition: EventPrimitives.h:27
CscRawDataCollection::identify
uint16_t identify() const
access methods
Definition: CscRawDataCollection.h:107
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
MuonGM::CscReadoutElement::containsId
virtual bool containsId(const Identifier &id) const override
Definition: CscReadoutElement.cxx:718
Muon::CscRdoToCscPrepDataToolMT::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: CscRdoToCscPrepDataToolMT.h:62
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
Amg::Vector2D
Eigen::Matrix< double, 2, 1 > Vector2D
Definition: GeoPrimitives.h:48
IdContext::end_index
size_type end_index() const
Definition: IdContext.h:46
CSV_InDetExporter.new
new
Definition: CSV_InDetExporter.py:145
IdentifiableContainerMT::size
size_t size() const
Duplicate of fullSize for backwards compatability.
Definition: IdentifiableContainerMT.h:206
MuonGM::CscReadoutElement::xCoordinateInTrackingFrame
double xCoordinateInTrackingFrame(const Identifier &id) const
Definition: CscReadoutElement.cxx:462
CscRawDataCollection::samplingPhase
bool samplingPhase() const
Definition: CscRawDataCollection.h:117
IdentifiableContainerMT::IDC_WriteHandle::alreadyPresent
bool alreadyPresent()
Definition: IdentifiableContainerMT.h:59
MuonGM::CscReadoutElement
Definition: CscReadoutElement.h:56
Muon::MuonPrepDataCollection::setIdentifier
virtual void setIdentifier(Identifier id)
AmgSymMatrix
#define AmgSymMatrix(dim)
Definition: EventPrimitives.h:50
Muon::CscRdoToCscPrepDataToolMT::m_cscCalibTool
ToolHandle< ICscCalibTool > m_cscCalibTool
CSC Calibration tools.
Definition: CscRdoToCscPrepDataToolMT.h:76
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:270
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
Muon::CscStripPrepData
Class representing the raw data of one CSC strip (for clusters look at Muon::CscPrepData).
Definition: CscStripPrepData.h:40
IdContext::begin_index
size_type begin_index() const
Definition: IdContext.h:45
CscRawDataCollection::identifyHash
IdentifierHash identifyHash() const
Returns the OFFLINE identifier hash for this collection.
Definition: CscRawDataCollection.h:110
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:93
lumiFormat.i
int i
Definition: lumiFormat.py:85
MuonGM::MuonDetectorManager::getCscReadoutElement
const CscReadoutElement * getCscReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
Definition: MuonDetDescr/MuonReadoutGeometry/src/MuonDetectorManager.cxx:225
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
Muon::CscRdoToCscPrepDataToolMT::decodeImpl
StatusCode decodeImpl(Muon::CscStripPrepDataContainer *outputCollection, const CscRawDataContainer *rdoContainer, IdentifierHash givenHashId) const
Definition: CscRdoToCscPrepDataToolMT.cxx:124
Muon::CscRdoToCscPrepDataToolMT::m_cabling
ServiceHandle< CSCcablingSvc > m_cabling
Definition: CscRdoToCscPrepDataToolMT.h:79
IdentifiableContainerMT::IDC_WriteHandle
Definition: IdentifiableContainerMT.h:34
test_pyathena.parent
parent
Definition: test_pyathena.py:15
Muon::CscRdoToCscPrepDataToolMT::m_rdoContainerKey
SG::ReadHandleKey< CscRawDataContainer > m_rdoContainerKey
Definition: CscRdoToCscPrepDataToolMT.h:68
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
IdentifiableContainerMT::end
const_iterator end() const
return const_iterator for end of container
Definition: IdentifiableContainerMT.h:239
IdentifiableContainerMT::const_iterator
Definition: IdentifiableContainerMT.h:79
IdentifiableContainerMT::begin
const_iterator begin() const
return const_iterator for first entry
Definition: IdentifiableContainerMT.h:233
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
CaloCondBlobAlgs_fillNoiseFromASCII.channelId
channelId
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:122
CscRawDataCollection
Collection of CSC Raw Hits, arranged according to CSC Detector Elements Author: Ketevi A.
Definition: CscRawDataCollection.h:24
CscRawDataCollection::numSamples
uint16_t numSamples() const
Definition: CscRawDataCollection.cxx:8
Muon::CscRdoToCscPrepDataToolMT::m_decodeData
Gaudi::Property< bool > m_decodeData
toggle on/off the decoding of CSC RDO into CscStripPrepData
Definition: CscRdoToCscPrepDataToolMT.h:83
postInclude.outputCollection
outputCollection
Definition: postInclude.SortInput.py:27
Trk::PrepRawData::identify
Identifier identify() const
return the identifier
Amg
Definition of ATLAS Math & Geometry primitives (Amg)
Definition: AmgStringHelpers.h:19
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
SG::UpdateHandle
Definition: UpdateHandle.h:94
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
IdentifiableContainerMT::indexFindPtr
virtual const T * indexFindPtr(IdentifierHash hashId) const override final
return pointer on the found entry or null if out of range using hashed index - fast version,...
Definition: IdentifiableContainerMT.h:289
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
CscRawData
Class to hold the electronic output for a single CSC readout channel: n sampling ADC data + the addre...
Definition: CscRawData.h:21
Base_Fragment.width
width
Definition: Sherpa_i/share/common/Base_Fragment.py:59
MuonGM::MuonDetectorManager
The MuonDetectorManager stores the transient representation of the Muon Spectrometer geometry and pro...
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonDetectorManager.h:50
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
MuonGM::MuonReadoutElement::identify
Identifier identify() const override final
Returns the ATLAS Identifier of the MuonReadOutElement.
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonReadoutElement.h:184
CscRawDataContainer
This container provides access to collections of CSC RDOs and a mechanism for recording them.
Definition: CscRawDataContainer.h:23
if
if(febId1==febId2)
Definition: LArRodBlockPhysicsV0.cxx:567
Muon::CscRdoToCscPrepDataToolMT::m_outputCollectionKey
SG::WriteHandleKey< Muon::CscStripPrepDataContainer > m_outputCollectionKey
CscStripPrepRawData containers.
Definition: CscRdoToCscPrepDataToolMT.h:65
IdContext
This class saves the "context" of an expanded identifier (ExpandedIdentifier) for compact or hash ver...
Definition: IdContext.h:26
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
Muon::CscRdoToCscPrepDataToolMT::m_muDetMgrKey
SG::ReadCondHandleKey< MuonGM::MuonDetectorManager > m_muDetMgrKey
Definition: CscRdoToCscPrepDataToolMT.h:59
WriteBchToCool.update
update
Definition: WriteBchToCool.py:67
DataVector::empty
bool empty() const noexcept
Returns true if the collection is empty.
CscRawDataCollection::rate
uint8_t rate() const
the rate could be 25 or 50 ns
Definition: CscRawDataCollection.cxx:24
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
Muon::CscRdoToCscPrepDataToolMT::m_cscRdoDecoderTool
ToolHandle< ICSC_RDO_Decoder > m_cscRdoDecoderTool
Definition: CscRdoToCscPrepDataToolMT.h:77
Muon::CscRdoToCscPrepDataToolMT::m_prdContainerCacheKey
SG::UpdateHandleKey< CscStripPrepDataCollection_Cache > m_prdContainerCacheKey
This is the key for the cache for the CSC PRD containers, can be empty.
Definition: CscRdoToCscPrepDataToolMT.h:71
Identifier
Definition: IdentifierFieldParser.cxx:14
MuonGM::CscReadoutElement::cathodeReadoutPitch
double cathodeReadoutPitch(int chLayer, int measuresPhi) const
Definition: CscReadoutElement.cxx:147