|
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()
Muon::MdtRdoToPrepDataToolMT::MdtRdoToPrepDataToolMT |
( |
const std::string & |
t, |
|
|
const std::string & |
n, |
|
|
const IInterface * |
p |
|
) |
| |
◆ ~MdtRdoToPrepDataToolMT()
virtual Muon::MdtRdoToPrepDataToolMT::~MdtRdoToPrepDataToolMT |
( |
| ) |
|
|
virtualdefault |
◆ createPrepData()
Creates the PRD object.
Test by how much do we break frozen Tier0
Definition at line 290 of file MdtRdoToPrepDataToolMT.cxx.
296 <<
", adc: "<<calibInput.
adc()<<
" vs. "<<
m_adcCut<<
", calibration bailed out "
302 if (!cache.legacyDetMgr) {
305 descriptor = cache.legacyDetMgr->getMdtReadoutElement(calibInput.
identify());
308 <<std::endl<<calibInput<<std::endl<<calibOutput);
317 (
cov)(0, 0) = sigR * sigR;
320 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 256 of file MdtRdoToPrepDataToolMT.cxx.
259 ATH_MSG_DEBUG(
"decodeMdtRDO for " << idVect.size() <<
" offline collections called");
263 if (!mdtPrepDataContainer.isValid) {
264 return StatusCode::FAILURE;
269 ATH_MSG_DEBUG(
"Stored empty container. Decoding MDT RDO into MDT PrepRawData is switched off");
270 return StatusCode::SUCCESS;
273 if (!idVect.empty()) {
277 std::vector<IdentifierHash> rdoHashes{};
279 if (!rdoContainer || rdoContainer->
empty())
return StatusCode::SUCCESS;
280 rdoHashes.reserve(rdoContainer->
size());
281 for (
const MdtCsm* csm : *rdoContainer) rdoHashes.push_back(csm->identifyHash());
285 ATH_CHECK(mdtPrepDataContainer.finalize(msgStream()));
287 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 214 of file MdtRdoToPrepDataToolMT.cxx.
216 if (rdoContainerHandle.isValid()) {
218 return rdoContainerHandle.cptr();
◆ handlePRDHash()
bool Muon::MdtRdoToPrepDataToolMT::handlePRDHash |
( |
const EventContext & |
ctx, |
|
|
ConvCache & |
mdtPrepDataContainer, |
|
|
IdentifierHash |
rdoHash |
|
) |
| const |
|
protected |
Definition at line 235 of file MdtRdoToPrepDataToolMT.cxx.
240 if (rdoContainer->empty()) {
244 const MdtCsm* rdoColl = rdoContainer->indexFindPtr(rdoHash);
246 ATH_MSG_DEBUG(
"The rdo container does not have the hash " << rdoHash);
249 if (
processCsm(ctx, mdtPrepDataContainer, rdoColl).isFailure()) {
◆ initDeadChannels()
Definition at line 528 of file MdtRdoToPrepDataToolMT.cxx.
529 PVConstLink cv = mydetEl->getMaterialGeom();
530 int nGrandchildren = cv->getNChildVols();
531 if (nGrandchildren <= 0)
return;
533 std::vector<int> tubes;
534 geoGetIds([&](
int id) { tubes.push_back(
id); }, &*cv);
542 int want_id =
layer * maxNTubesPerLayer +
tube;
543 if (
it != tubes.end() && *
it == want_id) {
546 it = std::lower_bound(tubes.begin(), tubes.end(), want_id);
547 if (
it != tubes.end() && *
it == want_id) {
◆ initialize()
StatusCode Muon::MdtRdoToPrepDataToolMT::initialize |
( |
| ) |
|
|
overridevirtual |
standard Athena-Algorithm method
Definition at line 147 of file MdtRdoToPrepDataToolMT.cxx.
166 ATH_MSG_INFO(
"Processing configuration for layouts with BMG chambers.");
168 for (
int phi = 6;
phi < 8;
phi++) {
169 for (
int eta = 1;
eta < 4;
eta++) {
172 for (
int roe = 1; roe <= (muDetMgr->
getMuonStation(
"BMG",
side * eta, phi))->nMuonReadoutElements();
182 std::vector<const MuonGMR4::MdtReadoutElement*> mdtRE =
m_detMgrR4->getAllMdtReadoutElements();
187 for (
const IdentifierHash& dead :
re->getParameters().removedTubes) {
201 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 329 of file MdtRdoToPrepDataToolMT.cxx.
333 if (cache.twinTubeMap->isTwinTubeLayer(rdoColl->
identify())) {
347 << mrodId <<
" / " << csmId);
352 for (
const MdtAmtHit* amtHit : *rdoColl) {
357 std::unique_ptr<MdtDigit> newDigit{
m_mdtDecoder->getDigit(ctx, *amtHit, subdetId, mrodId, csmId)};
359 ATH_MSG_WARNING(
"Found issue MDT RDO decoder for subdetId/mrodId/csmId "
360 << subdetId <<
"/" << mrodId <<
"/" << csmId <<
" amtHit channelId/tdcId =" << amtHit->channelId() <<
"/"
372 if (!driftCircleColl) {
381 << driftCircleColl->identifyHash());
386 newDigit->setAdc(newDigit->adc() / 4);
387 newDigit->setTdc(newDigit->tdc() / 4);
393 std::unique_ptr<MdtPrepData> newPrepData =
createPrepData(calibIn, calibResult, cache);
395 newPrepData->setHashAndIndex(driftCircleColl->identifyHash(), driftCircleColl->size());
396 driftCircleColl->push_back(std::move(newPrepData));
399 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 401 of file MdtRdoToPrepDataToolMT.cxx.
404 ATH_MSG_DEBUG(
" Number of AmtHit in this Csm " << rdoColl->size());
408 uint16_t subdetId = rdoColl->SubDetId();
409 uint16_t mrodId = rdoColl->MrodId();
412 <<
" / " << rdoColl->MrodId() <<
" / " << rdoColl->CsmId());
416 std::map<Identifier, std::array<std::unique_ptr<MdtDigit>, 2>> mdtDigitColl{};
418 for (
const MdtAmtHit* amtHit : *rdoColl) {
419 std::unique_ptr<MdtDigit> newDigit{
m_mdtDecoder->getDigit(ctx, *amtHit, subdetId, mrodId, csmId)};
423 << subdetId <<
"/" << mrodId <<
"/" << csmId <<
" amtHit channelId/tdcId =" << amtHit->channelId() <<
"/"
427 std::array<std::unique_ptr<MdtDigit>, 2> & moveTo = mdtDigitColl[newDigit->identify()];
429 moveTo[0] = std::move(newDigit);
431 moveTo[1] = std::move(newDigit);
433 ATH_MSG_VERBOSE(
" TWIN TUBES: found a tertiary hit in a twin tube in one RdoCollection for "
434 <<
m_idHelperSvc->toString(newDigit->identify()) <<
" with adc = " << newDigit->adc()
435 <<
" tdc = " << newDigit->tdc());
439 auto convertTwins = [
this, &cache, &ctx](std::unique_ptr<MdtDigit>
digit,
440 std::unique_ptr<MdtDigit> digit2) {
441 if (!
digit ||
digit->isMasked() || !cache.legacyDetMgr) {
447 if (!digit2 || digit2->isMasked()) {
450 <<
", hash: "<< driftCircleColl->identifyHash());
458 std::unique_ptr<MdtPrepData> newPrepData =
createPrepData(mdtCalibIn, mdtCalibOut, cache);
459 if (!newPrepData)
return;
461 newPrepData->setHashAndIndex(driftCircleColl->identifyHash(), driftCircleColl->size());
462 driftCircleColl->push_back(std::move(newPrepData));
466 <<
", tdc: "<<
digit->tdc()<<
", adc: "<<
digit->adc()<<
" -- "
468 <<
", tdc: "<<digit2->tdc()<<
", adc: "<<digit2->adc());
475 updateClosestApproachTwin(mdtCalib1st);
476 updateClosestApproachTwin(mdtCalib2nd);
479 std::move(mdtCalib1st),
480 std::move(mdtCalib2nd));
486 cov(0, 1) =
cov(1, 0) = 0;
489 auto twin_newPrepData = std::make_unique<MdtTwinPrepData>(twinCalib.
primaryID(),
503 <<
"local pos center tube w/ TWIN INFO "<<
Amg::toString(twinCalib.
locZ() * Amg::Vector3D::UnitZ(), 2)<<std::endl
506 twin_newPrepData->setHashAndIndex(driftCircleColl->identifyHash(), driftCircleColl->size());
507 driftCircleColl->push_back(std::move(twin_newPrepData));
511 for (
auto &[
id, digits] : mdtDigitColl) {
513 const Identifier twinId = cache.twinTubeMap->twinId(
id);
516 std::array<std::unique_ptr<MdtDigit>, 2>& twinDigits = mdtDigitColl[twinId];
518 convertTwins(std::move(digits[0]), std::move(twinDigits[0]));
520 convertTwins(std::move(digits[1]), std::move(twinDigits[1]));
522 convertTwins(std::move(digits[0]),
nullptr);
523 convertTwins(std::move(digits[1]),
nullptr);
526 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 559 of file MdtRdoToPrepDataToolMT.cxx.
568 if (
status.isFailure() || !handle.isValid()) {
573 cache.legacyPrd = handle.ptr();
582 if (
status.isFailure() || !handle.isValid()) {
588 cache.legacyPrd = handle.ptr();
592 if (!writeHandle.recordNonConst(std::make_unique<xAOD::MdtTwinDriftCircleContainer>(),
593 std::make_unique<xAOD::MdtTwinDriftCircleAuxContainer>()).isSuccess() ||
594 !writeHandle.isValid()) {
598 cache.xAODTwinPrd = writeHandle.ptr();
602 if (!writeHandle.recordNonConst(std::make_unique<xAOD::MdtDriftCircleContainer>(),
603 std::make_unique<xAOD::MdtDriftCircleAuxContainer>()).isSuccess() ||
604 !writeHandle.isValid()) {
608 cache.xAODPrd = writeHandle.ptr();
613 if (!readHandle.isPresent()) {
617 cache.gctx = readHandle.cptr();
622 if (!detMgrHandle.isValid()) {
626 cache.legacyDetMgr = detMgrHandle.cptr();
630 if (!twinTubeHandle.isValid()) {
634 cache.twinTubeMap = twinTubeHandle.cptr();
638 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.
::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.
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