|
ATLAS Offline Software
|
Go to the documentation of this file.
8 #include <GeoModelKernel/GeoPerfUtils.h>
9 #include <GeoModelKernel/GeoClearAbsPosAction.h>
15 #define CREATE_READHANDLE(CONT_TYPE, KEY) \
16 SG::ReadCondHandle<CONT_TYPE> readHandle{KEY, ctx}; \
17 if (!readHandle.isValid()) { \
18 ATH_MSG_FATAL(__FILE__<<":"<<__LINE__ \
19 <<" Failed to load "<<KEY.fullKey()); \
20 return StatusCode::FAILURE; \
37 ATH_MSG_FATAL(
"The detector manager does not contain any elements");
38 return StatusCode::FAILURE;
59 return StatusCode::SUCCESS;
69 (std::abs(
re->stationEta()) == 7 &&
m_idHelperSvc->stationNameString(
re->identify()) ==
"BML")) {
70 return m_idHelperSvc->rpcIdHelper().elementID(
re->stationName(),
re->stationEta(),
re->stationPhi(), 1);
73 return m_idHelperSvc->mdtIdHelper().elementID(
re->stationName(),
re->stationEta(),
re->stationPhi());
77 return re->identify();
83 ATH_MSG_DEBUG(
"Loading of the A line parameters deactivated");
84 return StatusCode::SUCCESS;
90 ATH_MSG_INFO(
"Load the alignment of "<<readoutEles.size()<<
" detector elements");
92 const GeoAlignableTransform* alignTrans =
re->alignableTransform();
95 <<
" has no alignable transform.");
98 std::shared_ptr<const Amg::Transform3D>&
cached = alignDeltas[alignTrans];
101 <<
" has been cached before. ");
102 techTransforms[
re->detectorType()].insert(alignTrans);
107 ALineContainer::const_iterator aLineItr = aLineContainer->find(stationId);
108 if (aLineItr == aLineContainer->end()) {
110 <<
". Used "<<
m_idHelperSvc->toString(stationId)<<
" as station Identifier");
114 cached = std::make_shared<Amg::Transform3D>(aLineItr->delta());
115 techTransforms[
re->detectorType()].insert(alignTrans);
117 return StatusCode::SUCCESS;
123 return StatusCode::SUCCESS;
125 std::unique_ptr<MdtAlignmentStore> internAlign = std::make_unique<MdtAlignmentStore>(
m_idHelperSvc.get());
130 asBuiltCont = readHandle.cptr();
134 bLines = readHandle.cptr();
137 for (
auto itr = idHelper.module_begin(); itr != idHelper.module_end(); ++itr) {
138 const Identifier& stationId{*itr};
141 BLineContainer::const_iterator itr = bLines->find(stationId);
142 if (itr != bLines->end()) bline = &(*itr);
146 MdtAsBuiltContainer::const_iterator itr = asBuiltCont->find(stationId);
147 if (itr != asBuiltCont->end()) asBuilt = &(*itr);
149 if (asBuilt || bline) internAlign->
storeDistortion(stationId, bline, asBuilt);
152 store.internalAlignment = std::move(internAlign);
153 return StatusCode::SUCCESS;
158 return StatusCode::SUCCESS;
160 std::unique_ptr<MmAlignmentStore> internAlign = std::make_unique<MmAlignmentStore>();
167 internAlign->
asBuiltPars = readHandle->microMegaData;
176 BLineContainer::const_iterator itr = readHandle->find(stationId);
177 if (itr != readHandle->end()) internAlign->
cacheBLine(
re->identify(), *itr);
180 store.internalAlignment = std::move(internAlign);
181 return StatusCode::SUCCESS;
187 return StatusCode::SUCCESS;
189 std::unique_ptr<sTgcAlignmentStore> internalAlign = std::make_unique<sTgcAlignmentStore>();
201 BLineContainer::const_iterator itr = readHandle->find(stationId);
202 if (itr != readHandle->end()) internalAlign->
cacheBLine(
re->identify(), *itr);
205 store.internalAlignment = std::move(internalAlign);
206 return StatusCode::SUCCESS;
236 return StatusCode::SUCCESS;
242 unsigned int memBeforeAlign = GeoPerfUtils::getMem();
247 unsigned int numAligned{0};
253 if (writeHandle.isValid()) {
255 <<
" are still valid.");
258 std::unique_ptr<ActsTrk::DetectorAlignStore> writeCdo = std::make_unique<ActsTrk::DetectorAlignStore>(subDet);
260 const std::set<const GeoAlignableTransform*>& toStore = techTransforms[subDet];
262 for (
const GeoAlignableTransform* alignable : toStore) {
263 const std::shared_ptr<const Amg::Transform3D>&
cached = alignDeltas[alignable];
280 if (
re->detectorType() == subDet) {
291 numAligned+=
re->storeAlignedTransforms(*writeCdo);
296 ATH_CHECK(writeHandle.record(std::move(writeCdo)));
299 ATH_MSG_VERBOSE(
"Only "<<numAligned<<
" out of "<<readoutEles.size()<<
" were picked up by the alignment cutalg");
301 techTransforms.clear();
303 GeoClearAbsPosAction whipeTreeTop{};
308 unsigned int memAfterAlign = GeoPerfUtils::getMem();
309 ATH_MSG_INFO(
"Caching of the alignment parameters required "<<(memAfterAlign - memBeforeAlign) / 1024<<
" MB of memory");
310 return StatusCode::SUCCESS;
313 #undef CREATE_READHANDLE
virtual StatusCode execute(const EventContext &ctx) const override
def retrieve(aClass, aKey=None)
Gaudi::Property< bool > m_fillGeoAlignStore
Flag toggling whether the GeoAlignmentStore shall be filled.
std::vector< ActsTrk::DetectorType > getDetectorTypes() const
Returns a list of all detector types.
StatusCode loadDeltas(const EventContext &ctx, deltaMap &alignDeltas, alignTechMap &techTransforms) const
Loads the ALineContainer from the conditions store and fills the deltaMap with the A-Line delta trans...
std::string find(const std::string &s)
return a remapped string
std::shared_ptr< GeoAlignmentStore > geoModelAlignment
Store containing the aligned GeoModel nodes.
DetectorType
Simple enum to Identify the Type of the ACTS sub detector.
StatusCode declareDependencies(const EventContext &ctx, ActsTrk::DetectorType detType, SG::WriteCondHandle< ActsTrk::DetectorAlignStore > &writeHandle) const
Loads the corresponding ReadCondHandles from the Conditions store and adds their IOVs to the dependen...
@ Tgc
Resitive Plate Chambers.
The MuonReadoutElement is an abstract class representing the geometry representing the muon detector.
std::vector< const MuonReadoutElement * > getAllReadoutElements() const
Returns the list of all detector elements.
#define ATH_MSG_VERBOSE(x)
Gaudi::Property< bool > m_applyBLines
Apply the chamber deformation model (Mdts + Nsw)
bool empty() const
Test if the key is blank.
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
An algorithm that can be simultaneously executed in multiple threads.
Gaudi::Property< bool > m_fillAlignStoreCache
Flag toggling whether the alignment store shall be filled with the transforms or not.
Identifier alignmentId(const MuonGMR4::MuonReadoutElement *reElement) const
Returns the Identifier serving as key to find the alignment parameters connected with the readout ele...
void storeDistortion(const Identifier &detElId, const BLinePar *bline, const MdtAsBuiltPar *asBuilt)
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
SG::ReadCondHandleKey< NswAsBuiltDbData > m_readNswAsBuiltKey
void cacheBLine(const Identifier &detElId, const BLinePar &bline)
Caches the micromega BLine parameter.
unsigned int getNumTreeTops() const override final
Access specifically the individual readout element technologies.
@ Mm
Maybe not needed in the migration.
::StatusCode StatusCode
StatusCode definition for legacy code.
SG::ReadCondHandleKey< MdtAsBuiltContainer > m_readMdtAsBuiltKey
Eigen::Affine3d Transform3D
const MuonGMR4::MuonDetectorManager * m_detMgr
SG::WriteCondHandleKeyArray< ActsTrk::DetectorAlignStore > m_writeKeys
SG::ReadCondHandleKey< NswPassivationDbData > m_readNswPassivKey
std::unordered_map< const GeoAlignableTransform *, std::shared_ptr< const Amg::Transform3D > > deltaMap
Association map of the GeoAlignableTransforms with the rigid alignment transformations.
std::set< ALinePar, std::less<> > ALineContainer
Gaudi::Property< bool > m_applyMmPassivation
Gaudi::Property< bool > m_applyNswAsBuilt
std::vector< ActsTrk::DetectorType > m_techs
std::map< ActsTrk::DetectorType, std::set< const GeoAlignableTransform * > > alignTechMap
Association map of the GeoAlignable transforms with the detector technologies.
std::set< MdtAsBuiltPar, std::less<> > MdtAsBuiltContainer
PVConstLink getTreeTop(unsigned int i) const override final
Returns the i-th top node of the MuonSystem trees.
std::string to_string(const DetectorType &type)
StatusCode initialize(bool used=true)
def cached(func)
Decorator to cache function return value.
virtual StatusCode initialize() override
StatusCode loadStgcDeformPars(const EventContext &ctx, ActsTrk::DetectorAlignStore &store) const
Container classifier the MDT as-built parameters See parameter description in http://atlas-muon-align...
#define ATH_MSG_WARNING(x)
void cacheBLine(const Identifier &detElId, const BLinePar &bline)
Caches the micromega BLine parameter.
const boost::regex re(r_e)
#define CREATE_READHANDLE(CONT_TYPE, KEY)
@ Rpc
Monitored Drift Tubes.
ActsMuonAlignCondAlg(const std::string &name, ISvcLocator *pSvcLocator)
StatusCode loadMdtDeformPars(const EventContext &ctx, ActsTrk::DetectorAlignStore &store) const
Loads the BLine container and the Mdt-as built parameters from the Conditions store and stores them i...
SG::ReadCondHandleKey< BLineContainer > m_readKeyBLines
const NswPassivationDbData * passivation
Passivation is subdivided into several PCBs Ship the complete container with the alignment store.
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
static EventIDRange infiniteTime()
Produces an EventIDRange that is inifinite in Time and invalid in RunLumi.
std::set< BLinePar, std::less<> > BLineContainer
StatusCode loadMmDeformPars(const EventContext &ctx, ActsTrk::DetectorAlignStore &store) const
Gaudi::Property< std::string > m_keyToken
Gaudi::Property< bool > m_applyALines
Apply translations and rotations to align the Muon stations.
SG::ReadCondHandleKey< ALineContainer > m_readKeyALines
sTgcAsBuiltPtr asBuiltPars
Gaudi::Property< bool > m_applyMdtAsBuilt
void addDependency(const EventIDRange &range)