 |
ATLAS Offline Software
|
#include <MdtRdoToPrepDataToolMT.h>
|
void | printPrepDataImpl (const Muon::MdtPrepDataContainer *mdtPrepDataContainer) const |
|
Muon::MdtDriftCircleStatus | getMdtTwinPosition (const MdtDigit &prompt_digit, const MdtDigit &twin_digit, double &radius, double &errRadius, double &zTwin, double &errZTwin, bool &twinIsPrompt) const |
| method to get the twin tube 2nd coordinate More...
|
|
StatusCode | processCsm (const EventContext &ctx, ConvCache &mdtPrepDataContainer, const MdtCsm *rdoColl) const |
|
StatusCode | processCsmTwin (const EventContext &ctx, ConvCache &mdtPrepDataContainer, const MdtCsm *rdoColll) const |
|
std::unique_ptr< MdtPrepData > | createPrepData (const MdtCalibInput &calibInput, const MdtCalibOutput &calibOutput, ConvCache &cache) const |
| Creates the PRD object. More...
|
|
ConvCache | setupMdtPrepDataContainer (const EventContext &ctx) const |
| Creates the prep data container to be written. More...
|
|
const MdtCsmContainer * | getRdoContainer (const EventContext &ctx) const |
| Loads the input RDO container from StoreGate. More...
|
|
void | processPRDHashes (const EventContext &ctx, ConvCache &mdtPrepDataContainer, const std::vector< IdentifierHash > &chamberHashInRobs) const |
|
bool | handlePRDHash (const EventContext &ctx, ConvCache &mdtPrepDataContainer, IdentifierHash rdoHash) const |
|
void | initDeadChannels (const MuonGM::MdtReadoutElement *mydetEl) |
|
|
ServiceHandle< Muon::IMuonIdHelperSvc > | m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"} |
|
ToolHandle< IMdtCalibrationTool > | m_calibrationTool {this, "CalibrationTool", "MdtCalibrationTool"} |
| MDT calibration service. More...
|
|
Gaudi::Property< bool > | m_useNewGeo |
|
const MuonGMR4::MuonDetectorManager * | m_detMgrR4 {nullptr} |
|
SG::ReadHandleKey< ActsGeometryContext > | m_geoCtxKey {this, "AlignmentKey", "ActsAlignment", "Stored alignment"} |
|
SG::WriteHandleKey< Muon::MdtPrepDataContainer > | m_mdtPrepDataContainerKey {this, "OutputCollection", "MDT_DriftCircles"} |
| MdtPrepRawData containers. More...
|
|
SG::ReadHandleKey< MdtCsmContainer > | m_rdoContainerKey {this, "RDOContainer", "MDTCSM"} |
|
Gaudi::Property< int > | m_adcCut |
| member variables for algorithm properties: More...
|
|
Gaudi::Property< bool > | m_calibratePrepData {this, "CalibratePrepData", true} |
| toggle on/off calibration of MdtPrepData More...
|
|
Gaudi::Property< bool > | m_decodeData {this, "DecodeData", true} |
| toggle on/off the decoding of MDT RDO into MdtPrepData More...
|
|
bool | m_sortPrepData = false |
| Toggle on/off the sorting of the MdtPrepData. More...
|
|
ToolHandle< Muon::IMDT_RDO_Decoder > | m_mdtDecoder {this, "Decoder", "Muon::MdtRDO_Decoder/MdtRDO_Decoder"} |
|
bool | m_BMGpresent {false} |
|
int | m_BMGid {-1} |
|
Gaudi::Property< bool > | m_useTwin {this, "UseTwin", true} |
|
Gaudi::Property< bool > | m_discardSecondaryHitTwin {this, "DiscardSecondaryHitTwin", false} |
|
SG::ReadCondHandleKey< TwinTubeMap > | m_twinTubeKey {this, "TwinTubeKey", "MdtTwinTubeMap"} |
|
std::unordered_set< Identifier > | m_DeadChannels {} |
|
SG::ReadCondHandleKey< MuonMDT_CablingMap > | m_readKey {this, "ReadKey", "MuonMDT_CablingMap", "Key of MuonMDT_CablingMap"} |
|
SG::ReadCondHandleKey< MuonGM::MuonDetectorManager > | m_muDetMgrKey |
|
SG::UpdateHandleKey< MdtPrepDataCollection_Cache > | m_prdContainerCacheKey |
| This is the key for the cache for the MDT PRD containers, can be empty. More...
|
|
SG::WriteHandleKey< xAOD::MdtDriftCircleContainer > | m_xAODKey {this, "xAODKey", "", "If empty, do not produce xAOD, otherwise this is the key of the output xAOD MDT PRD container"} |
|
SG::WriteHandleKey< xAOD::MdtTwinDriftCircleContainer > | m_xAODTwinKey {this, "xAODTwinKey", "", "If empty, do not produce xAOD, otherwise this is the key of the output xAOD MDT PRD container"} |
|
Tool to produce MDT PRDs
Definition at line 40 of file MdtRdoToPrepDataToolMT.h.
◆ ~MdtRdoToPrepDataToolMT()
virtual Muon::MdtRdoToPrepDataToolMT::~MdtRdoToPrepDataToolMT |
( |
| ) |
|
|
virtualdefault |
◆ createPrepData()
Creates the PRD object.
Test by how much do we break frozen Tier0
Definition at line 292 of file MdtRdoToPrepDataToolMT.cxx.
298 <<
", adc: "<<calibInput.
adc()<<
" vs. "<<
m_adcCut<<
", calibration bailed out "
304 if (!cache.legacyDetMgr) {
307 descriptor = cache.legacyDetMgr->getMdtReadoutElement(calibInput.
identify());
310 <<std::endl<<calibInput<<std::endl<<calibOutput);
319 (
cov)(0, 0) = sigR * sigR;
322 return std::make_unique<MdtPrepData>(calibInput.
identify(),
◆ decode() [1/2]
StatusCode Muon::MdtRdoToPrepDataToolMT::decode |
( |
const EventContext & |
ctx, |
|
|
const std::vector< IdentifierHash > & |
idVect |
|
) |
| const |
|
overridevirtual |
Decode method - declared in Muon::IMuonRdoToPrepDataTool.
Construct the hashes from the existing RDOs
Definition at line 258 of file MdtRdoToPrepDataToolMT.cxx.
261 ATH_MSG_DEBUG(
"decodeMdtRDO for " << idVect.size() <<
" offline collections called");
265 if (!mdtPrepDataContainer.isValid) {
266 return StatusCode::FAILURE;
271 ATH_MSG_DEBUG(
"Stored empty container. Decoding MDT RDO into MDT PrepRawData is switched off");
272 return StatusCode::SUCCESS;
275 if (!idVect.empty()) {
279 std::vector<IdentifierHash> rdoHashes{};
281 if (!rdoContainer || rdoContainer->
empty())
return StatusCode::SUCCESS;
282 rdoHashes.reserve(rdoContainer->
size());
283 for (
const MdtCsm* csm : *rdoContainer) rdoHashes.push_back(csm->identifyHash());
287 ATH_CHECK(mdtPrepDataContainer.finalize(msgStream()));
289 return StatusCode::SUCCESS;
◆ decode() [2/2]
StatusCode Muon::MdtRdoToPrepDataToolMT::decode |
( |
const EventContext & |
ctx, |
|
|
const std::vector< uint32_t > & |
robIds |
|
) |
| const |
|
overridevirtual |
◆ getMdtTwinPosition()
method to get the twin tube 2nd coordinate
◆ getRdoContainer()
Loads the input RDO container from StoreGate.
Definition at line 216 of file MdtRdoToPrepDataToolMT.cxx.
218 if (rdoContainerHandle.isValid()) {
220 return rdoContainerHandle.cptr();
◆ handlePRDHash()
bool Muon::MdtRdoToPrepDataToolMT::handlePRDHash |
( |
const EventContext & |
ctx, |
|
|
ConvCache & |
mdtPrepDataContainer, |
|
|
IdentifierHash |
rdoHash |
|
) |
| const |
|
protected |
Definition at line 237 of file MdtRdoToPrepDataToolMT.cxx.
242 if (rdoContainer->empty()) {
246 const MdtCsm* rdoColl = rdoContainer->indexFindPtr(rdoHash);
248 ATH_MSG_DEBUG(
"The rdo container does not have the hash " << rdoHash);
251 if (
processCsm(ctx, mdtPrepDataContainer, rdoColl).isFailure()) {
◆ initDeadChannels()
Definition at line 549 of file MdtRdoToPrepDataToolMT.cxx.
550 PVConstLink cv = mydetEl->getMaterialGeom();
551 int nGrandchildren = cv->getNChildVols();
552 if (nGrandchildren <= 0)
return;
554 std::vector<int> tubes;
555 geoGetIds([&](
int id) { tubes.push_back(
id); }, &*cv);
563 int want_id =
layer * maxNTubesPerLayer +
tube;
564 if (
it != tubes.end() && *
it == want_id) {
567 it = std::lower_bound(tubes.begin(), tubes.end(), want_id);
568 if (
it != tubes.end() && *
it == want_id) {
◆ initialize()
StatusCode Muon::MdtRdoToPrepDataToolMT::initialize |
( |
| ) |
|
|
overridevirtual |
standard Athena-Algorithm method
Definition at line 153 of file MdtRdoToPrepDataToolMT.cxx.
172 ATH_MSG_INFO(
"Processing configuration for layouts with BMG chambers.");
174 for (
int phi = 6;
phi < 8;
phi++) {
175 for (
int eta = 1;
eta < 4;
eta++) {
178 for (
int roe = 1; roe <= (muDetMgr->
getMuonStation(
"BMG",
side * eta, phi))->nMuonReadoutElements();
188 std::vector<const MuonGMR4::MdtReadoutElement*> mdtRE =
m_detMgrR4->getAllMdtReadoutElements();
193 for (
const IdentifierHash& dead :
re->getParameters().removedTubes) {
207 return StatusCode::SUCCESS;
◆ printPrepDataImpl()
◆ processCsm()
StatusCode Muon::MdtRdoToPrepDataToolMT::processCsm |
( |
const EventContext & |
ctx, |
|
|
ConvCache & |
mdtPrepDataContainer, |
|
|
const MdtCsm * |
rdoColl |
|
) |
| const |
|
protected |
MDT hit context
Definition at line 331 of file MdtRdoToPrepDataToolMT.cxx.
335 if (cache.twinTubeMap->isTwinTubeLayer(rdoColl->
identify())) {
349 << mrodId <<
" / " << csmId);
355 for (
const MdtAmtHit* amtHit : *rdoColl) {
360 std::unique_ptr<MdtDigit> newDigit{
m_mdtDecoder->getDigit(ctx, *amtHit, subdetId, mrodId, csmId)};
362 ATH_MSG_WARNING(
"Found issue MDT RDO decoder for subdetId/mrodId/csmId "
363 << subdetId <<
"/" << mrodId <<
"/" << csmId <<
" amtHit channelId/tdcId =" << amtHit->channelId() <<
"/"
375 if (!driftCircleColl) {
384 << driftCircleColl->identifyHash());
389 newDigit->setAdc(newDigit->adc() / 4);
390 newDigit->setTdc(newDigit->tdc() / 4);
396 std::unique_ptr<MdtPrepData> newPrepData =
createPrepData(calibIn, calibResult, cache);
400 if (driftCircleColl->size()) {
401 MdtPrepData* prevPrd = driftCircleColl->at(driftCircleColl->size()-1);
403 std::stringstream sstr{};
405 <<
" **** "<<
print(*prevPrd)<<std::endl
406 <<
" **** "<<
print(*newPrepData));
410 (*prevPrd) = std::move(*newPrepData);
411 prevPrd->setHashAndIndex(driftCircleColl->identifyHash(), driftCircleColl->size()-1);
417 newPrepData->setHashAndIndex(driftCircleColl->identifyHash(), driftCircleColl->size());
418 driftCircleColl->push_back(std::move(newPrepData));
420 return StatusCode::SUCCESS;
◆ processCsmTwin()
StatusCode Muon::MdtRdoToPrepDataToolMT::processCsmTwin |
( |
const EventContext & |
ctx, |
|
|
ConvCache & |
mdtPrepDataContainer, |
|
|
const MdtCsm * |
rdoColll |
|
) |
| const |
|
protected |
MDT hit context
Create new PrepData
check for the twin tube id
Definition at line 422 of file MdtRdoToPrepDataToolMT.cxx.
425 ATH_MSG_DEBUG(
" Number of AmtHit in this Csm " << rdoColl->size());
429 uint16_t subdetId = rdoColl->SubDetId();
430 uint16_t mrodId = rdoColl->MrodId();
433 <<
" / " << rdoColl->MrodId() <<
" / " << rdoColl->CsmId());
437 std::map<Identifier, std::array<std::unique_ptr<MdtDigit>, 2>> mdtDigitColl{};
439 for (
const MdtAmtHit* amtHit : *rdoColl) {
440 std::unique_ptr<MdtDigit> newDigit{
m_mdtDecoder->getDigit(ctx, *amtHit, subdetId, mrodId, csmId)};
444 << subdetId <<
"/" << mrodId <<
"/" << csmId <<
" amtHit channelId/tdcId =" << amtHit->channelId() <<
"/"
448 std::array<std::unique_ptr<MdtDigit>, 2> & moveTo = mdtDigitColl[newDigit->identify()];
450 moveTo[0] = std::move(newDigit);
452 moveTo[1] = std::move(newDigit);
454 ATH_MSG_VERBOSE(
" TWIN TUBES: found a tertiary hit in a twin tube in one RdoCollection for "
455 <<
m_idHelperSvc->toString(newDigit->identify()) <<
" with adc = " << newDigit->adc()
456 <<
" tdc = " << newDigit->tdc());
460 auto convertTwins = [
this, &cache, &ctx](std::unique_ptr<MdtDigit>
digit,
461 std::unique_ptr<MdtDigit> digit2) {
462 if (!
digit ||
digit->isMasked() || !cache.legacyDetMgr) {
468 if (!digit2 || digit2->isMasked()) {
471 <<
", hash: "<< driftCircleColl->identifyHash());
479 std::unique_ptr<MdtPrepData> newPrepData =
createPrepData(mdtCalibIn, mdtCalibOut, cache);
480 if (!newPrepData)
return;
482 newPrepData->setHashAndIndex(driftCircleColl->identifyHash(), driftCircleColl->size());
483 driftCircleColl->push_back(std::move(newPrepData));
487 <<
", tdc: "<<
digit->tdc()<<
", adc: "<<
digit->adc()<<
" -- "
489 <<
", tdc: "<<digit2->tdc()<<
", adc: "<<digit2->adc());
496 updateClosestApproachTwin(mdtCalib1st);
497 updateClosestApproachTwin(mdtCalib2nd);
500 std::move(mdtCalib1st),
501 std::move(mdtCalib2nd));
507 cov(0, 1) =
cov(1, 0) = 0;
510 auto twin_newPrepData = std::make_unique<MdtTwinPrepData>(twinCalib.
primaryID(),
524 <<
"local pos center tube w/ TWIN INFO "<<
Amg::toString(twinCalib.
locZ() * Amg::Vector3D::UnitZ(), 2)<<std::endl
527 twin_newPrepData->setHashAndIndex(driftCircleColl->identifyHash(), driftCircleColl->size());
528 driftCircleColl->push_back(std::move(twin_newPrepData));
532 for (
auto &[
id, digits] : mdtDigitColl) {
534 const Identifier twinId = cache.twinTubeMap->twinId(
id);
537 std::array<std::unique_ptr<MdtDigit>, 2>& twinDigits = mdtDigitColl[twinId];
539 convertTwins(std::move(digits[0]), std::move(twinDigits[0]));
541 convertTwins(std::move(digits[1]), std::move(twinDigits[1]));
543 convertTwins(std::move(digits[0]),
nullptr);
544 convertTwins(std::move(digits[1]),
nullptr);
547 return StatusCode::SUCCESS;
◆ processPRDHashes()
void Muon::MdtRdoToPrepDataToolMT::processPRDHashes |
( |
const EventContext & |
ctx, |
|
|
ConvCache & |
mdtPrepDataContainer, |
|
|
const std::vector< IdentifierHash > & |
chamberHashInRobs |
|
) |
| const |
|
protected |
◆ provideEmptyContainer()
StatusCode Muon::MdtRdoToPrepDataToolMT::provideEmptyContainer |
( |
const EventContext & |
ctx | ) |
const |
|
overridevirtual |
◆ setupMdtPrepDataContainer()
Creates the prep data container to be written.
Retrieve the Geometry context if activated
Retrieve the legacy detector mananger if activated
Definition at line 580 of file MdtRdoToPrepDataToolMT.cxx.
589 if (
status.isFailure() || !handle.isValid()) {
594 cache.legacyPrd = handle.ptr();
603 if (
status.isFailure() || !handle.isValid()) {
609 cache.legacyPrd = handle.ptr();
613 if (!writeHandle.recordNonConst(std::make_unique<xAOD::MdtTwinDriftCircleContainer>(),
614 std::make_unique<xAOD::MdtTwinDriftCircleAuxContainer>()).isSuccess() ||
615 !writeHandle.isValid()) {
619 cache.xAODTwinPrd = writeHandle.ptr();
623 if (!writeHandle.recordNonConst(std::make_unique<xAOD::MdtDriftCircleContainer>(),
624 std::make_unique<xAOD::MdtDriftCircleAuxContainer>()).isSuccess() ||
625 !writeHandle.isValid()) {
629 cache.xAODPrd = writeHandle.ptr();
634 if (!readHandle.isPresent()) {
638 cache.gctx = readHandle.cptr();
643 if (!detMgrHandle.isValid()) {
647 cache.legacyDetMgr = detMgrHandle.cptr();
651 if (!twinTubeHandle.isValid()) {
655 cache.twinTubeMap = twinTubeHandle.cptr();
659 cache.isValid =
true;
◆ m_adcCut
Gaudi::Property<int> Muon::MdtRdoToPrepDataToolMT::m_adcCut |
|
protected |
Initial value:{this, "AdcCut", 50,
"Minimal cut on the adc to convert it into a prepdata object"}
member variables for algorithm properties:
Definition at line 136 of file MdtRdoToPrepDataToolMT.h.
◆ m_BMGid
int Muon::MdtRdoToPrepDataToolMT::m_BMGid {-1} |
|
protected |
◆ m_BMGpresent
bool Muon::MdtRdoToPrepDataToolMT::m_BMGpresent {false} |
|
protected |
◆ m_calibratePrepData
Gaudi::Property<bool> Muon::MdtRdoToPrepDataToolMT::m_calibratePrepData {this, "CalibratePrepData", true} |
|
protected |
◆ m_calibrationTool
◆ m_DeadChannels
std::unordered_set<Identifier> Muon::MdtRdoToPrepDataToolMT::m_DeadChannels {} |
|
protected |
◆ m_decodeData
Gaudi::Property<bool> Muon::MdtRdoToPrepDataToolMT::m_decodeData {this, "DecodeData", true} |
|
protected |
◆ m_detMgrR4
◆ m_discardSecondaryHitTwin
Gaudi::Property<bool> Muon::MdtRdoToPrepDataToolMT::m_discardSecondaryHitTwin {this, "DiscardSecondaryHitTwin", false} |
|
protected |
◆ m_geoCtxKey
◆ m_idHelperSvc
◆ m_mdtDecoder
◆ m_mdtPrepDataContainerKey
◆ m_muDetMgrKey
Initial value:{this, "DetectorManagerKey", "MuonDetectorManager",
"Key of input MuonDetectorManager condition data"}
Definition at line 159 of file MdtRdoToPrepDataToolMT.h.
◆ m_prdContainerCacheKey
Initial value:{this, "MdtPrdContainerCacheKey", "",
"Optional external cache for the MDT PRD container"}
This is the key for the cache for the MDT PRD containers, can be empty.
Definition at line 162 of file MdtRdoToPrepDataToolMT.h.
◆ m_rdoContainerKey
◆ m_readKey
◆ m_sortPrepData
bool Muon::MdtRdoToPrepDataToolMT::m_sortPrepData = false |
|
protected |
◆ m_twinTubeKey
◆ m_useNewGeo
Gaudi::Property<bool> Muon::MdtRdoToPrepDataToolMT::m_useNewGeo |
|
protected |
Initial value:{this, "UseR4DetMgr", false,
"Switch between the legacy and the new geometry"}
Definition at line 122 of file MdtRdoToPrepDataToolMT.h.
◆ m_useTwin
Gaudi::Property<bool> Muon::MdtRdoToPrepDataToolMT::m_useTwin {this, "UseTwin", true} |
|
protected |
◆ m_xAODKey
◆ m_xAODTwinKey
The documentation for this class was generated from the following files:
def retrieve(aClass, aKey=None)
JetConstituentVector::iterator iterator
uint16_t CsmId() const
Returns the CSM online id (online identifier inside a MROD)
int getNLayers() const
Returns the number of tube layers inside the multilayer.
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
MDT RDO's : data from a single channel of an AMT Atlas Muon TDC.
double innerTubeRadius() const
Returns the inner tube radius excluding the aluminium walls.
Eigen::Matrix< double, 2, 1 > Vector2D
MuonPrepDataCollection< MdtPrepData > MdtPrepDataCollection
Identifier identify() const
Returns the CSM offline identifier (chamber offline id)
size_t size() const
Duplicate of fullSize for backwards compatability.
uint16_t SubDetId() const
Returns the sub-detector Id.
This container provides acces to the MDT RDOs.
#define ATH_MSG_VERBOSE(x)
MDT RDOs : Chamber Service Module, container of AmtHits of a single Mdt chamber.
bool empty() const
Test if the key is blank.
double uncertPrimaryR() const
@ MdtStatusDriftTime
The tube produced a vaild measurement.
bool empty() const
return true if container is empty
uint16_t MrodId() const
Returns the MROD id from the CSM header.
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
::StatusCode StatusCode
StatusCode definition for legacy code.
int getMultilayer() const
Returns the multilayer represented by the readout element.
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
MdtDriftCircleStatus status() const
Status of the calibration.
Identifier twinID() const
StatusCode initialize(bool used=true)
MdtDriftCircleStatus primaryStatus() const
double driftRadiusUncert() const
Returns the uncertainty on the drift radius.
const MuonStation * getMuonStation(const std::string &stName, int eta, int phi) const
void geoGetIds(FUNCTION f, const GeoGraphNode *node, int depthLimit=1)
Template helper for running the visitor.
Amg::Vector3D tubePos(const Identifier &id) const
Returns the global position of the given tube.
The MuonDetectorManager stores the transient representation of the Muon Spectrometer geometry and pro...
void sort(typename std::reverse_iterator< DataModel_detail::iterator< DVL > > beg, typename std::reverse_iterator< DataModel_detail::iterator< DVL > > end, const Compare &comp)
Specialization of sort for DataVector/List.
#define ATH_MSG_WARNING(x)
const boost::regex re(r_e)
Identifier identify() const override final
Returns the ATLAS Identifier of the MuonReadOutElement.
std::string print(const MuPatSegment &)
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
@ MdtStatusUnDefined
Undefined.
double primaryDriftR() const
Identifier primaryID() const
int getNtubesperlayer() const
Returns the number of tubes in each tube layer.
constexpr int pow(int base, int exp) noexcept
double driftRadius() const
Returns the drift radius of the calibrated object.
Identifier parentID(const Identifier &id) const
get parent id from channel id