 |
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;
62 return StatusCode::SUCCESS;
72 (std::abs(
re->stationEta()) == 7 &&
m_idHelperSvc->stationNameString(
re->identify()) ==
"BML")) {
73 return m_idHelperSvc->rpcIdHelper().elementID(
re->stationName(),
re->stationEta(),
re->stationPhi(), 1);
76 return m_idHelperSvc->mdtIdHelper().elementID(
re->stationName(),
re->stationEta(),
re->stationPhi());
80 return re->identify();
86 ATH_MSG_DEBUG(
"Loading of the A line parameters deactivated");
87 return StatusCode::SUCCESS;
93 ATH_MSG_INFO(
"Load the alignment of "<<readoutEles.size()<<
" detector elements");
95 const GeoAlignableTransform* alignTrans =
re->alignableTransform();
98 <<
" has no alignable transform.");
101 std::shared_ptr<const Amg::Transform3D>&
cached = alignDeltas[alignTrans];
104 <<
" has been cached before. ");
105 techTransforms[
re->detectorType()].insert(alignTrans);
110 ALineContainer::const_iterator aLineItr = aLineContainer->find(stationId);
111 if (aLineItr == aLineContainer->end()) {
113 <<
". Used "<<
m_idHelperSvc->toString(stationId)<<
" as station Identifier");
117 cached = std::make_shared<Amg::Transform3D>(aLineItr->delta());
118 techTransforms[
re->detectorType()].insert(alignTrans);
120 return StatusCode::SUCCESS;
126 return StatusCode::SUCCESS;
128 std::unique_ptr<MdtAlignmentStore> internAlign = std::make_unique<MdtAlignmentStore>(
m_idHelperSvc.get());
133 asBuiltCont = readHandle.cptr();
137 bLines = readHandle.cptr();
140 for (
auto itr = idHelper.module_begin(); itr != idHelper.module_end(); ++itr) {
144 BLineContainer::const_iterator itr = bLines->find(stationId);
145 if (itr != bLines->end()) bline = &(*itr);
149 MdtAsBuiltContainer::const_iterator itr = asBuiltCont->find(stationId);
150 if (itr != asBuiltCont->end()) asBuilt = &(*itr);
152 if (asBuilt || bline) internAlign->
storeDistortion(stationId, bline, asBuilt);
155 store.internalAlignment = std::move(internAlign);
156 return StatusCode::SUCCESS;
161 return StatusCode::SUCCESS;
163 std::unique_ptr<MmAlignmentStore> internAlign = std::make_unique<MmAlignmentStore>();
170 internAlign->
asBuiltPars = readHandle->microMegaData;
179 BLineContainer::const_iterator itr = readHandle->find(stationId);
180 if (itr != readHandle->end()) internAlign->
cacheBLine(
re->identify(), *itr);
183 store.internalAlignment = std::move(internAlign);
184 return StatusCode::SUCCESS;
189 return StatusCode::SUCCESS;
191 std::unique_ptr<sTgcAlignmentStore> internalAlign = std::make_unique<sTgcAlignmentStore>();
203 BLineContainer::const_iterator itr = readHandle->find(stationId);
204 if (itr != readHandle->end()) internalAlign->
cacheBLine(
re->identify(), *itr);
207 store.internalAlignment = std::move(internalAlign);
208 return StatusCode::SUCCESS;
243 return StatusCode::SUCCESS;
249 unsigned int memBeforeAlign = GeoPerfUtils::getMem();
254 unsigned int numAligned{0};
260 if (writeHandle.isValid()) {
262 <<
" are still valid.");
265 std::unique_ptr<ActsTrk::DetectorAlignStore> writeCdo = std::make_unique<ActsTrk::DetectorAlignStore>(subDet);
267 const std::set<const GeoAlignableTransform*>& toStore = techTransforms[subDet];
269 for (
const GeoAlignableTransform* alignable : toStore) {
270 const std::shared_ptr<const Amg::Transform3D>&
cached = alignDeltas[alignable];
287 if (
re->detectorType() == subDet) {
298 numAligned+=
re->storeAlignedTransforms(*writeCdo);
303 ATH_CHECK(writeHandle.record(std::move(writeCdo)));
306 ATH_MSG_VERBOSE(
"Only "<<numAligned<<
" out of "<<readoutEles.size()<<
" were picked up by the alignment cutalg");
308 techTransforms.clear();
310 GeoClearAbsPosAction whipeTreeTop{};
315 unsigned int memAfterAlign = GeoPerfUtils::getMem();
316 ATH_MSG_INFO(
"Caching of the alignment parameters required "<<(memAfterAlign - memBeforeAlign) / 1024<<
" MB of memory");
317 return StatusCode::SUCCESS;
320 #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.
SG::ReadCondHandleKey< sTGCAsBuiltData > m_readsTgcAsBuiltKey
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 sTGCAsBuiltData * asBuiltPars
Pointer to the collection of passivation parameters if the project is not AthSimulation.
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
The ReadoutGeomCnvAlg converts the Run4 Readout geometry build from the GeoModelXML into the legacy M...
void cacheBLine(const Identifier &detElId, const BLinePar &bline)
Caches the micromega BLine parameter.
unsigned int getNumTreeTops() const override final
Declaration of the readout element getters & setter function as described above.
@ 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
Class holding the sTGC as built conditions data and applying it. The model consists of four parameter...
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-the tree top GeoModel volume.
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
Gaudi::Property< bool > m_applyMdtAsBuilt
void addDependency(const EventIDRange &range)