ATLAS Offline Software
Loading...
Searching...
No Matches
MuonR4::GeomAlignCondAlg Class Reference

#include <GeomAlignCondAlg.h>

Inheritance diagram for MuonR4::GeomAlignCondAlg:

Public Member Functions

virtual ~GeomAlignCondAlg ()=default
virtual StatusCode initialize () override
virtual StatusCode execute (const EventContext &ctx) const override
virtual bool isReEntrant () const override
 Avoid scheduling algorithm multiple times.
virtual StatusCode sysInitialize () override
 Override sysInitialize.
virtual bool isClonable () const override
 Specify if the algorithm is clonable.
virtual unsigned int cardinality () const override
 Cardinality (Maximum number of clones that can exist) special value 0 means that algorithm is reentrant.
virtual StatusCode sysExecute (const EventContext &ctx) override
 Execute an algorithm.
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies.
virtual bool filterPassed (const EventContext &ctx) const
virtual void setFilterPassed (bool state, const EventContext &ctx) const
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

using deltaMap = std::unordered_map<const GeoAlignableTransform*, std::shared_ptr<const Amg::Transform3D>>
 Association map of the GeoAlignableTransforms with the rigid alignment transformations.
using alignTechMap = std::map<ActsTrk::DetectorType, std::set<const GeoAlignableTransform*>>
 Association map of the GeoAlignable transforms with the detector technologies.
typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

Identifier alignmentId (const MuonGMR4::MuonReadoutElement *reElement) const
 Returns the Identifier serving as key to find the alignment parameters connected with the readout element.
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 transformations and the technology map to connect mutually moving detectors.
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 into the tracking alignment object of the RawGeomAlignmentStore.
StatusCode loadMmDeformPars (const EventContext &ctx, ActsTrk::DetectorAlignStore &store) const
StatusCode loadStgcDeformPars (const EventContext &ctx, ActsTrk::DetectorAlignStore &store) const
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 dependency of the writeHandle.
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

std::vector< ActsTrk::DetectorTypem_techs {}
SG::ReadCondHandleKey< ALineContainerm_readKeyALines
SG::ReadCondHandleKey< BLineContainerm_readKeyBLines
SG::ReadCondHandleKey< MdtAsBuiltContainerm_readMdtAsBuiltKey
SG::ReadCondHandleKey< NswAsBuiltDbDatam_readNswAsBuiltKey
SG::ReadCondHandleKey< sTGCAsBuiltDatam_readsTgcAsBuiltKey
SG::ReadCondHandleKey< NswPassivationDbDatam_readNswPassivKey
SG::WriteCondHandleKeyArray< ActsTrk::DetectorAlignStorem_writeKeys
Gaudi::Property< std::string > m_keyToken
ServiceHandle< Muon::IMuonIdHelperSvcm_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}
const MuonGMR4::MuonDetectorManagerm_detMgr {nullptr}
Gaudi::Property< bool > m_applyMmPassivation {this, "applyMmPassivation", false}
Gaudi::Property< bool > m_applyNswAsBuilt
Gaudi::Property< bool > m_applyMdtAsBuilt
Gaudi::Property< bool > m_applyALines {this, "applyALines", false}
 Apply translations and rotations to align the Muon stations.
Gaudi::Property< bool > m_applyBLines {this, "applyBLines", false}
 Apply the chamber deformation model (Mdts + Nsw)
Gaudi::Property< bool > m_fillAlignStoreCache {this, "FillAlignCache", false}
 Flag toggling whether the alignment store shall be filled with the transforms or not.
Gaudi::Property< bool > m_fillGeoAlignStore {this, "FillGeoAlignStore", true}
 Flag toggling whether the GeoAlignmentStore shall be filled.
DataObjIDColl m_extendedExtraObjects
 Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Definition at line 30 of file GeomAlignCondAlg.h.

Member Typedef Documentation

◆ alignTechMap

using MuonR4::GeomAlignCondAlg::alignTechMap = std::map<ActsTrk::DetectorType, std::set<const GeoAlignableTransform*>>
private

Association map of the GeoAlignable transforms with the detector technologies.

Definition at line 45 of file GeomAlignCondAlg.h.

◆ deltaMap

using MuonR4::GeomAlignCondAlg::deltaMap = std::unordered_map<const GeoAlignableTransform*, std::shared_ptr<const Amg::Transform3D>>
private

Association map of the GeoAlignableTransforms with the rigid alignment transformations.

Definition at line 43 of file GeomAlignCondAlg.h.

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ ~GeomAlignCondAlg()

virtual MuonR4::GeomAlignCondAlg::~GeomAlignCondAlg ( )
virtualdefault

Member Function Documentation

◆ alignmentId()

Identifier MuonR4::GeomAlignCondAlg::alignmentId ( const MuonGMR4::MuonReadoutElement * reElement) const
private

Returns the Identifier serving as key to find the alignment parameters connected with the readout element.

The BML eta 7 stations have their own alignment.

The rest shares the same alignmnet constants with the Mdts

For the NSW, the alignment parameters are stored under the same key as the RE

Definition at line 55 of file GeomAlignCondAlg.cxx.

55 {
56 if (re->detectorType() == ActsTrk::DetectorType::Mdt ||
57 re->detectorType() == ActsTrk::DetectorType::Tgc) {
58 return m_idHelperSvc->chamberId(re->identify());
59 } else if (re->detectorType() == ActsTrk::DetectorType::Rpc) {
61 if (!m_idHelperSvc->hasMDT() ||
62 (std::abs(re->stationEta()) == 7 && m_idHelperSvc->stationNameString(re->identify()) == "BML")) {
63 return m_idHelperSvc->rpcIdHelper().elementID(re->stationName(), re->stationEta(), re->stationPhi(), 1);
65 } else {
66 return m_idHelperSvc->mdtIdHelper().elementID(re->stationName(), re->stationEta(), re->stationPhi());
67 }
68 }
70 return re->identify();
71}
const boost::regex re(r_e)
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
@ Tgc
Resitive Plate Chambers.
@ Rpc
Monitored Drift Tubes.
@ Mdt
MuonSpectrometer.

◆ cardinality()

unsigned int AthCommonReentrantAlgorithm< Gaudi::Algorithm >::cardinality ( ) const
overridevirtualinherited

Cardinality (Maximum number of clones that can exist) special value 0 means that algorithm is reentrant.

Override this to return 0 for reentrant algorithms.

Definition at line 75 of file AthCommonReentrantAlgorithm.cxx.

64{
65 return 0;
66}

◆ declareDependencies()

StatusCode MuonR4::GeomAlignCondAlg::declareDependencies ( const EventContext & ctx,
ActsTrk::DetectorType detType,
SG::WriteCondHandle< ActsTrk::DetectorAlignStore > & writeHandle ) const
private

Loads the corresponding ReadCondHandles from the Conditions store and adds their IOVs to the dependency of the writeHandle.

Definition at line 193 of file GeomAlignCondAlg.cxx.

195 {
197 if (m_applyALines) {
198 SG::ReadCondHandle depHandle{m_readKeyALines, ctx};
199 ATH_CHECK(depHandle.isValid());
200 writeHandle.addDependency(depHandle);
201 }
202 const bool issTGC = detType == ActsTrk::DetectorType::sTgc;
203 const bool isMm = detType == ActsTrk::DetectorType::Mm;
204 const bool isMdt = detType == ActsTrk::DetectorType::Mdt;
205
206 if (m_applyBLines&& (issTGC || isMm || isMdt)) {
207 SG::ReadCondHandle depHandle{m_readKeyBLines, ctx};
208 ATH_CHECK(depHandle.isValid());
209 writeHandle.addDependency(depHandle);
210 }
211 if (m_applyMdtAsBuilt && isMdt) {
212 SG::ReadCondHandle depHandle{m_readMdtAsBuiltKey, ctx};
213 ATH_CHECK(depHandle.isValid());
214 writeHandle.addDependency(depHandle);
215 }
217 SG::ReadCondHandle depHandle{m_readNswPassivKey, ctx};
218 ATH_CHECK(depHandle.isValid());
219 writeHandle.addDependency(depHandle);
220 }
221 if (m_applyNswAsBuilt && isMm) {
222 SG::ReadCondHandle depHandle{m_readNswAsBuiltKey, ctx};
223 ATH_CHECK(depHandle.isValid());
224 writeHandle.addDependency(depHandle);
225 }
226 if(m_applyNswAsBuilt && issTGC && !m_readsTgcAsBuiltKey.empty()){
227 SG::ReadCondHandle depHandle{m_readsTgcAsBuiltKey, ctx};
228 ATH_CHECK(depHandle.isValid());
229 writeHandle.addDependency(depHandle);
230 }
231 return StatusCode::SUCCESS;
232}
#define ATH_CHECK
Evaluate an expression and check for errors.
static EventIDRange infiniteTime()
Produces an EventIDRange that is inifinite in Time and invalid in RunLumi.
Gaudi::Property< bool > m_applyALines
Apply translations and rotations to align the Muon stations.
SG::ReadCondHandleKey< MdtAsBuiltContainer > m_readMdtAsBuiltKey
SG::ReadCondHandleKey< sTGCAsBuiltData > m_readsTgcAsBuiltKey
SG::ReadCondHandleKey< BLineContainer > m_readKeyBLines
Gaudi::Property< bool > m_applyMmPassivation
Gaudi::Property< bool > m_applyMdtAsBuilt
Gaudi::Property< bool > m_applyBLines
Apply the chamber deformation model (Mdts + Nsw)
SG::ReadCondHandleKey< NswPassivationDbData > m_readNswPassivKey
SG::ReadCondHandleKey< NswAsBuiltDbData > m_readNswAsBuiltKey
Gaudi::Property< bool > m_applyNswAsBuilt
SG::ReadCondHandleKey< ALineContainer > m_readKeyALines
void addDependency(const EventIDRange &range)
@ Mm
Maybe not needed in the migration.
@ sTgc
Micromegas (NSW)

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ execute()

StatusCode MuonR4::GeomAlignCondAlg::execute ( const EventContext & ctx) const
overridevirtual

Create the condition handles

Append the alignable transformations to the conditions object

Propagate the cache throughout the geometry

Cache all transforms at the creation of this conditions object

The geoModel constants are no longer needed.

Ensure that the rigid transformations of the detector elements are applied

There's no need to cache the delta parameters longer

Whipe the GeoModelCache

Definition at line 234 of file GeomAlignCondAlg.cxx.

234 {
235 deltaMap alignDeltas{};
236 alignTechMap techTransforms{};
237 const unsigned memBeforeAlign = GeoPerfUtils::getMem();
238 ATH_CHECK(loadDeltas(ctx, alignDeltas, techTransforms));
239
241 for (std::size_t det =0 ; det < m_techs.size(); ++det) {
242 const SG::WriteCondHandleKey<ActsTrk::DetectorAlignStore>& key = m_writeKeys[det];
243 const ActsTrk::DetectorType subDet = m_techs[det];
244
245 SG::WriteCondHandle<ActsTrk::DetectorAlignStore> writeHandle{key, ctx};
246 if (writeHandle.isValid()) {
247 ATH_MSG_VERBOSE("The alignment constants for "<<ActsTrk::to_string(subDet)
248 <<" are still valid.");
249 continue;
250 }
251 auto writeCdo = std::make_unique<ActsTrk::DetectorAlignStore>(subDet);
252
253 const std::set<const GeoAlignableTransform*>& toStore = techTransforms[subDet];
255 for (const GeoAlignableTransform* alignable : toStore) {
256 const std::shared_ptr<const Amg::Transform3D>& cached = alignDeltas[alignable];
257 if (!cached) continue;
258 writeCdo->geoModelAlignment->setDelta(alignable, alignDeltas[alignable]);
259 }
260 writeCdo->geoModelAlignment->lockDelta();
261 if (subDet == ActsTrk::DetectorType::Mdt) {
262 ATH_CHECK(loadMdtDeformPars(ctx,*writeCdo));
263 } else if (subDet == ActsTrk::DetectorType::Mm) {
264 ATH_CHECK(loadMmDeformPars(ctx, *writeCdo));
265 } else if (subDet == ActsTrk::DetectorType::sTgc) {
266 ATH_CHECK(loadStgcDeformPars(ctx, *writeCdo));
267 }
269 ATH_CHECK(declareDependencies(ctx, subDet, writeHandle));
272 unsigned numAligned{0};
273 std::ranges::for_each(m_detMgr->getAllReadoutElements(subDet),
274 [&](const MuonGMR4::MuonReadoutElement* re) {
275 numAligned += re->storeAlignedTransforms(*writeCdo);
276 });
278 writeCdo->geoModelAlignment.reset();
279 ATH_MSG_DEBUG("Populated the alignment store "<<to_string(subDet)<<" with "<<numAligned<<" transforms");
280 } else if (m_fillGeoAlignStore) {
282 std::ranges::for_each(m_detMgr->getAllReadoutElements(subDet),
283 [&](const MuonReadoutElement* re){
284 const Amg::Transform3D& detTrf{re->getMaterialGeom()->getAbsoluteTransform(writeCdo->geoModelAlignment.get())};
285 ATH_MSG_VERBOSE("Detector element "<<m_idHelperSvc->toStringDetEl(re->identify())<<" is located at "
286 <<Amg::toString(detTrf));
287 });
289 writeCdo->geoModelAlignment->getDeltas()->clear();
290 writeCdo->geoModelAlignment->lockPosCache();
291 }
292 ATH_CHECK(writeHandle.record(std::move(writeCdo)));
293 }
294
295 alignDeltas.clear();
296 techTransforms.clear();
298 GeoClearAbsPosAction whipeTreeTop{};
299 for (unsigned treeTop = 0 ; treeTop < m_detMgr->getNumTreeTops(); ++treeTop) {
300 m_detMgr->getTreeTop(treeTop)->exec(&whipeTreeTop);
301 }
302
303 const unsigned memAfterAlign = GeoPerfUtils::getMem();
304 ATH_MSG_INFO("Caching of the alignment parameters required "<<(memAfterAlign - memBeforeAlign) / 1024<<" MB of memory");
305 return StatusCode::SUCCESS;
306}
#define ATH_MSG_INFO(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_DEBUG(x)
std::unordered_map< const GeoAlignableTransform *, std::shared_ptr< const Amg::Transform3D > > deltaMap
Association map of the GeoAlignableTransforms with the rigid alignment transformations.
StatusCode loadMmDeformPars(const EventContext &ctx, ActsTrk::DetectorAlignStore &store) const
const MuonGMR4::MuonDetectorManager * m_detMgr
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...
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.
SG::WriteCondHandleKeyArray< ActsTrk::DetectorAlignStore > m_writeKeys
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...
Gaudi::Property< bool > m_fillAlignStoreCache
Flag toggling whether the alignment store shall be filled with the transforms or not.
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...
StatusCode loadStgcDeformPars(const EventContext &ctx, ActsTrk::DetectorAlignStore &store) const
Gaudi::Property< bool > m_fillGeoAlignStore
Flag toggling whether the GeoAlignmentStore shall be filled.
StatusCode record(const EventIDRange &range, T *t)
record handle, with explicit range DEPRECATED
std::string to_string(const DetectorType &type)
DetectorType
Simple enum to Identify the Type of the ACTS sub detector.
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
std::string to_string(const SectorProjector proj)
cached(func)
Decorator to cache function return value.
Definition cached.py:6

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ extraOutputDeps()

const DataObjIDColl & AthCommonReentrantAlgorithm< Gaudi::Algorithm >::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

This list is extended to include symlinks implied by inheritance relations.

Definition at line 94 of file AthCommonReentrantAlgorithm.cxx.

90{
91 // If we didn't find any symlinks to add, just return the collection
92 // from the base class. Otherwise, return the extended collection.
93 if (!m_extendedExtraObjects.empty()) {
95 }
97}
An algorithm that can be simultaneously executed in multiple threads.

◆ filterPassed()

virtual bool AthCommonReentrantAlgorithm< Gaudi::Algorithm >::filterPassed ( const EventContext & ctx) const
inlinevirtualinherited

Definition at line 96 of file AthCommonReentrantAlgorithm.h.

96 {
97 return execState( ctx ).filterPassed();
98 }
virtual bool filterPassed(const EventContext &ctx) const

◆ initialize()

StatusCode MuonR4::GeomAlignCondAlg::initialize ( )
overridevirtual

Definition at line 17 of file GeomAlignCondAlg.cxx.

17 {
18
24 ATH_CHECK(m_idHelperSvc.retrieve());
26 m_techs = m_detMgr->getDetectorTypes();
27 if (m_techs.empty()) {
28 ATH_MSG_FATAL("The detector manager does not contain any elements");
29 return StatusCode::FAILURE;
30 }
31 auto hasDetector = [this](const ActsTrk::DetectorType d) -> bool {
32 return Acts::rangeContainsValue(m_techs, d);
33 };
35 hasDetector(ActsTrk::DetectorType::Mm) ||
36 hasDetector(ActsTrk::DetectorType::sTgc));
39 hasDetector(ActsTrk::DetectorType::sTgc));
41
42
43
44 for (const ActsTrk::DetectorType det : m_techs) {
45 m_writeKeys.emplace_back(ActsTrk::to_string(det) + m_keyToken);
46 ATH_MSG_INFO("Register new alignment container "<<m_writeKeys.back().fullKey());
47 }
48 ATH_MSG_INFO("Switched options "<<m_fillAlignStoreCache<<", "<<", "<<m_applyALines<<", "
49 <<m_applyBLines<<", "<<m_applyMdtAsBuilt<<", "
51 ATH_CHECK(m_writeKeys.initialize());
52 return StatusCode::SUCCESS;
53}
#define ATH_MSG_FATAL(x)
const ServiceHandle< StoreGateSvc > & detStore() const
Gaudi::Property< std::string > m_keyToken
retrieve(aClass, aKey=None)
Definition PyKernel.py:110

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ isClonable()

◆ isReEntrant()

virtual bool AthCondAlgorithm::isReEntrant ( ) const
inlineoverridevirtualinherited

Avoid scheduling algorithm multiple times.

With multiple concurrent events, conditions objects often expire simultaneously for all slots. To avoid that the scheduler runs the CondAlg in each slot, we declare it as "non-reentrant". This ensures that the conditions objects are only created once.

In case a particular CondAlg should behave differently, it can override this method again and return true.

See also
ATEAM-836

Definition at line 39 of file AthCondAlgorithm.h.

39{ return false; }

◆ loadDeltas()

StatusCode MuonR4::GeomAlignCondAlg::loadDeltas ( const EventContext & ctx,
deltaMap & alignDeltas,
alignTechMap & techTransforms ) const
private

Loads the ALineContainer from the conditions store and fills the deltaMap with the A-Line delta transformations and the technology map to connect mutually moving detectors.

Construct the identifier to search for the proper Aline transformation

Store the alignable transformation

Definition at line 72 of file GeomAlignCondAlg.cxx.

74 {
75 if (m_readKeyALines.empty()) {
76 ATH_MSG_DEBUG("Loading of the A line parameters deactivated");
77 return StatusCode::SUCCESS;
78 }
79 const ALineContainer* aLineContainer{};
80 ATH_CHECK(SG::get(aLineContainer, m_readKeyALines, ctx));
81 std::vector<const MuonReadoutElement*> readoutEles = m_detMgr->getAllReadoutElements();
82 ATH_MSG_INFO("Load the alignment of "<<readoutEles.size()<<" detector elements");
83 for (const MuonReadoutElement* re : readoutEles) {
84 const GeoAlignableTransform* alignTrans = re->alignableTransform();
85 if (!alignTrans) {
86 ATH_MSG_WARNING("The readout element "<<m_idHelperSvc->toStringDetEl(re->identify())
87 <<" has no alignable transform.");
88 continue;
89 }
90 std::shared_ptr<const Amg::Transform3D>& cached = alignDeltas[alignTrans];
91 if (cached) {
92 ATH_MSG_DEBUG("The alignable transformation for "<<m_idHelperSvc->toStringChamber(re->identify())
93 <<" has been cached before. ");
94 techTransforms[re->detectorType()].insert(alignTrans);
95 continue;
96 }
98 const Identifier stationId = alignmentId(re);
99 ALineContainer::const_iterator aLineItr = aLineContainer->find(stationId);
100 if (aLineItr == aLineContainer->end()) {
101 ATH_MSG_VERBOSE("No Alines were stored for "<<m_idHelperSvc->toString(re->identify())
102 <<". Used "<<m_idHelperSvc->toString(stationId)<<" as station Identifier");
103 continue;
104 }
106 cached = std::make_shared<Amg::Transform3D>(aLineItr->delta());
107 techTransforms[re->detectorType()].insert(alignTrans);
108 }
109 return StatusCode::SUCCESS;
110}
#define ATH_MSG_WARNING(x)
std::set< ALinePar, std::less<> > ALineContainer
Identifier alignmentId(const MuonGMR4::MuonReadoutElement *reElement) const
Returns the Identifier serving as key to find the alignment parameters connected with the readout ele...
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.

◆ loadMdtDeformPars()

StatusCode MuonR4::GeomAlignCondAlg::loadMdtDeformPars ( const EventContext & ctx,
ActsTrk::DetectorAlignStore & store ) const
private

Loads the BLine container and the Mdt-as built parameters from the Conditions store and stores them into the tracking alignment object of the RawGeomAlignmentStore.

Definition at line 111 of file GeomAlignCondAlg.cxx.

112 {
113
115 return StatusCode::SUCCESS;
116 }
117 auto internAlign = std::make_unique<MdtAlignmentStore>(m_idHelperSvc.get());
118 const MdtAsBuiltContainer* asBuiltCont{nullptr};
119 const BLineContainer* bLines{nullptr};
120
121 ATH_CHECK(SG::get(asBuiltCont, m_readMdtAsBuiltKey, ctx));
122 ATH_CHECK(SG::get(bLines, m_readKeyBLines, ctx));
123
124 const MdtIdHelper& idHelper{m_idHelperSvc->mdtIdHelper()};
125 for (auto itr = idHelper.module_begin(); itr != idHelper.module_end(); ++itr) {
126 const Identifier& stationId{*itr};
127 const BLinePar* bline{nullptr};
128 if (bLines) {
129 BLineContainer::const_iterator itr = bLines->find(stationId);
130 if (itr != bLines->end()) bline = &(*itr);
131 }
132 const MdtAsBuiltPar* asBuilt{nullptr};
133 if (asBuiltCont) {
134 MdtAsBuiltContainer::const_iterator itr = asBuiltCont->find(stationId);
135 if (itr != asBuiltCont->end()) asBuilt = &(*itr);
136 }
137 if (asBuilt || bline) {
138 internAlign->storeDistortion(stationId, bline, asBuilt);
139 }
140 }
141 // Down cast the alignment pointer
142 store.internalAlignment = std::move(internAlign);
143 return StatusCode::SUCCESS;
144}
std::set< MdtAsBuiltPar, std::less<> > MdtAsBuiltContainer
std::set< BLinePar, std::less<> > BLineContainer
const_id_iterator module_end() const
const_id_iterator module_begin() const
Iterators over full set of ids.
TestStore store
Definition TestStore.cxx:23

◆ loadMmDeformPars()

StatusCode MuonR4::GeomAlignCondAlg::loadMmDeformPars ( const EventContext & ctx,
ActsTrk::DetectorAlignStore & store ) const
private

Definition at line 145 of file GeomAlignCondAlg.cxx.

146 {
148 return StatusCode::SUCCESS;
149 }
150 auto internAlign = std::make_unique<MmAlignmentStore>();
151 const NswAsBuiltDbData* asBuiltPars{};
152 ATH_CHECK(SG::get(internAlign->passivation, m_readNswPassivKey, ctx));
153 ATH_CHECK(SG::get(asBuiltPars, m_readNswAsBuiltKey, ctx));
154 if (asBuiltPars) {
155 internAlign->asBuiltPars = asBuiltPars->microMegaData;
156 }
157 const BLineContainer* bLines{};
158 ATH_CHECK(SG::get(bLines, m_readKeyBLines, ctx));
159 if (bLines) {
160 for (const MmReadoutElement* re : m_detMgr->getAllMmReadoutElements()){
161 const Identifier stationId = alignmentId(re);
162 BLineContainer::const_iterator itr = bLines->find(stationId);
163 if (itr != bLines->end()) {
164 internAlign->cacheBLine(re->identify(), *itr);
165 }
166 }
167 }
168 store.internalAlignment = std::move(internAlign);
169 return StatusCode::SUCCESS;
170}
MmAsBuiltPtr microMegaData

◆ loadStgcDeformPars()

StatusCode MuonR4::GeomAlignCondAlg::loadStgcDeformPars ( const EventContext & ctx,
ActsTrk::DetectorAlignStore & store ) const
private

Definition at line 171 of file GeomAlignCondAlg.cxx.

172 {
174 return StatusCode::SUCCESS;
175 }
176 auto internAlign = std::make_unique<sTgcAlignmentStore>();
177 ATH_CHECK(SG::get(internAlign->asBuiltPars, m_readsTgcAsBuiltKey, ctx));
178 const BLineContainer* bLines{};
179 ATH_CHECK(SG::get(bLines, m_readKeyBLines, ctx));
180 if (bLines) {
181 for (const sTgcReadoutElement* re : m_detMgr->getAllsTgcReadoutElements()) {
182 const Identifier stationId = alignmentId(re);
183 BLineContainer::const_iterator itr = bLines->find(stationId);
184 if (itr != bLines->end()) {
185 internAlign->cacheBLine(re->identify(), *itr);
186 }
187 }
188 }
189 store.internalAlignment = std::move(internAlign);
190 return StatusCode::SUCCESS;
191}

◆ msg()

MsgStream & AthCommonMsg< Gaudi::Algorithm >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< Gaudi::Algorithm >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ setFilterPassed()

virtual void AthCommonReentrantAlgorithm< Gaudi::Algorithm >::setFilterPassed ( bool state,
const EventContext & ctx ) const
inlinevirtualinherited

Definition at line 100 of file AthCommonReentrantAlgorithm.h.

100 {
102 }
virtual void setFilterPassed(bool state, const EventContext &ctx) const

◆ sysExecute()

StatusCode AthCommonReentrantAlgorithm< Gaudi::Algorithm >::sysExecute ( const EventContext & ctx)
overridevirtualinherited

Execute an algorithm.

We override this in order to work around an issue with the Algorithm base class storing the event context in a member variable that can cause crashes in MT jobs.

Definition at line 85 of file AthCommonReentrantAlgorithm.cxx.

77{
78 return BaseAlg::sysExecute (ctx);
79}

◆ sysInitialize()

StatusCode AthCommonReentrantAlgorithm< Gaudi::Algorithm >::sysInitialize ( )
overridevirtualinherited

Override sysInitialize.

Override sysInitialize from the base class.

Loop through all output handles, and if they're WriteCondHandles, automatically register them and this Algorithm with the CondSvc

Scan through all outputHandles, and if they're WriteCondHandles, register them with the CondSvc

Reimplemented from AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >.

Reimplemented in HypoBase, and InputMakerBase.

Definition at line 61 of file AthCommonReentrantAlgorithm.cxx.

107 {
109
110 if (sc.isFailure()) {
111 return sc;
112 }
113
114 ServiceHandle<ICondSvc> cs("CondSvc",name());
115 for (auto h : outputHandles()) {
116 if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
117 // do this inside the loop so we don't create the CondSvc until needed
118 if ( cs.retrieve().isFailure() ) {
119 ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
120 return StatusCode::SUCCESS;
121 }
122 if (cs->regHandle(this,*h).isFailure()) {
124 ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
125 << " with CondSvc");
126 }
127 }
128 }
129 return sc;
130}
#define ATH_MSG_ERROR(x)
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }

Member Data Documentation

◆ m_applyALines

Gaudi::Property<bool> MuonR4::GeomAlignCondAlg::m_applyALines {this, "applyALines", false}
private

Apply translations and rotations to align the Muon stations.

Definition at line 102 of file GeomAlignCondAlg.h.

102{this, "applyALines", false};

◆ m_applyBLines

Gaudi::Property<bool> MuonR4::GeomAlignCondAlg::m_applyBLines {this, "applyBLines", false}
private

Apply the chamber deformation model (Mdts + Nsw)

Definition at line 104 of file GeomAlignCondAlg.h.

104{this, "applyBLines", false};

◆ m_applyMdtAsBuilt

Gaudi::Property<bool> MuonR4::GeomAlignCondAlg::m_applyMdtAsBuilt
private
Initial value:
{this, "applyMdtAsBuilt", false,
"Toggles the application of the Mdt as-built parameters"}

Definition at line 99 of file GeomAlignCondAlg.h.

99 {this, "applyMdtAsBuilt", false,
100 "Toggles the application of the Mdt as-built parameters"};

◆ m_applyMmPassivation

Gaudi::Property<bool> MuonR4::GeomAlignCondAlg::m_applyMmPassivation {this, "applyMmPassivation", false}
private

Definition at line 94 of file GeomAlignCondAlg.h.

94{this, "applyMmPassivation", false};

◆ m_applyNswAsBuilt

Gaudi::Property<bool> MuonR4::GeomAlignCondAlg::m_applyNswAsBuilt
private
Initial value:
{this, "applyNswAsBuilt", false,
"Toggles the application of the Nsw as-built parameters"}

Definition at line 96 of file GeomAlignCondAlg.h.

96 {this, "applyNswAsBuilt", false,
97 "Toggles the application of the Nsw as-built parameters"};

◆ m_detMgr

const MuonGMR4::MuonDetectorManager* MuonR4::GeomAlignCondAlg::m_detMgr {nullptr}
private

Definition at line 92 of file GeomAlignCondAlg.h.

92{nullptr};

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

DataObjIDColl AthCommonReentrantAlgorithm< Gaudi::Algorithm >::m_extendedExtraObjects
privateinherited

Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.

Empty if no symlinks were found.

Definition at line 114 of file AthCommonReentrantAlgorithm.h.

◆ m_fillAlignStoreCache

Gaudi::Property<bool> MuonR4::GeomAlignCondAlg::m_fillAlignStoreCache {this, "FillAlignCache", false}
private

Flag toggling whether the alignment store shall be filled with the transforms or not.

Definition at line 106 of file GeomAlignCondAlg.h.

106{this, "FillAlignCache", false};

◆ m_fillGeoAlignStore

Gaudi::Property<bool> MuonR4::GeomAlignCondAlg::m_fillGeoAlignStore {this, "FillGeoAlignStore", true}
private

Flag toggling whether the GeoAlignmentStore shall be filled.

Definition at line 108 of file GeomAlignCondAlg.h.

108{this, "FillGeoAlignStore", true};

◆ m_idHelperSvc

ServiceHandle<Muon::IMuonIdHelperSvc> MuonR4::GeomAlignCondAlg::m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}
private

Definition at line 90 of file GeomAlignCondAlg.h.

90{this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};

◆ m_keyToken

Gaudi::Property<std::string> MuonR4::GeomAlignCondAlg::m_keyToken
private
Initial value:
{this, "CondKeyToken","ActsAlignContainer",
"Common name token of all written alignment objects (e.g.) MdtActsAlignContainer"}

Definition at line 87 of file GeomAlignCondAlg.h.

87 {this, "CondKeyToken","ActsAlignContainer",
88 "Common name token of all written alignment objects (e.g.) MdtActsAlignContainer"};

◆ m_readKeyALines

SG::ReadCondHandleKey<ALineContainer> MuonR4::GeomAlignCondAlg::m_readKeyALines
private
Initial value:
{this, "ReadKeyALines", "ALineContainer",
"Key of the ALine container created from the DB"}

Definition at line 70 of file GeomAlignCondAlg.h.

70 {this, "ReadKeyALines", "ALineContainer",
71 "Key of the ALine container created from the DB"};

◆ m_readKeyBLines

SG::ReadCondHandleKey<BLineContainer> MuonR4::GeomAlignCondAlg::m_readKeyBLines
private
Initial value:
{this, "ReadKeyBLines", "BLineContainer",
"Key of the BLine container created from the DB"}

Definition at line 73 of file GeomAlignCondAlg.h.

73 {this, "ReadKeyBLines", "BLineContainer",
74 "Key of the BLine container created from the DB"};

◆ m_readMdtAsBuiltKey

SG::ReadCondHandleKey<MdtAsBuiltContainer> MuonR4::GeomAlignCondAlg::m_readMdtAsBuiltKey
private
Initial value:
{this, "ReadMdtAsBuiltKey", "MdtAsBuiltContainer",
"Key of output muon alignment MDT/AsBuilt condition data"}

Definition at line 76 of file GeomAlignCondAlg.h.

76 {this, "ReadMdtAsBuiltKey", "MdtAsBuiltContainer",
77 "Key of output muon alignment MDT/AsBuilt condition data"};

◆ m_readNswAsBuiltKey

SG::ReadCondHandleKey<NswAsBuiltDbData> MuonR4::GeomAlignCondAlg::m_readNswAsBuiltKey
private
Initial value:
{this, "ReadNswAsBuiltKey", "NswAsBuiltDbData",
"Key of NswAsBuiltDbData object containing conditions data for NSW as-built params!"}

Definition at line 78 of file GeomAlignCondAlg.h.

78 {this, "ReadNswAsBuiltKey", "NswAsBuiltDbData",
79 "Key of NswAsBuiltDbData object containing conditions data for NSW as-built params!"};

◆ m_readNswPassivKey

SG::ReadCondHandleKey<NswPassivationDbData> MuonR4::GeomAlignCondAlg::m_readNswPassivKey
private
Initial value:
{this, "dMmPassivationKey", "NswPassivationDbData",
"Key of NswPassivationDbData object containing passivation data for MMs"}

Definition at line 82 of file GeomAlignCondAlg.h.

82 {this, "dMmPassivationKey", "NswPassivationDbData",
83 "Key of NswPassivationDbData object containing passivation data for MMs"};

◆ m_readsTgcAsBuiltKey

SG::ReadCondHandleKey<sTGCAsBuiltData> MuonR4::GeomAlignCondAlg::m_readsTgcAsBuiltKey
private
Initial value:
{this, "ReadsTgcAsBuiltKey", "",
"Key of sTGCAsBuiltDbData object containing conditions data for sTgc as-built params!"}

Definition at line 80 of file GeomAlignCondAlg.h.

80 {this, "ReadsTgcAsBuiltKey", "",
81 "Key of sTGCAsBuiltDbData object containing conditions data for sTgc as-built params!"};

◆ m_techs

std::vector<ActsTrk::DetectorType> MuonR4::GeomAlignCondAlg::m_techs {}
private

Definition at line 68 of file GeomAlignCondAlg.h.

68{};

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.

◆ m_writeKeys

SG::WriteCondHandleKeyArray<ActsTrk::DetectorAlignStore> MuonR4::GeomAlignCondAlg::m_writeKeys
private
Initial value:
{this, "WriteKeys", {},
"Keys of the alignment technologies"}

Definition at line 85 of file GeomAlignCondAlg.h.

85 {this, "WriteKeys", {},
86 "Keys of the alignment technologies"};

The documentation for this class was generated from the following files: