ATLAS Offline Software
Loading...
Searching...
No Matches
MagField::AtlasFieldCacheCondAlg Class Reference

#include <AtlasFieldCacheCondAlg.h>

Inheritance diagram for MagField::AtlasFieldCacheCondAlg:
Collaboration diagram for MagField::AtlasFieldCacheCondAlg:

Classes

struct  Cache

Public Member Functions

 AtlasFieldCacheCondAlg (const std::string &name, ISvcLocator *pSvcLocator)
virtual ~AtlasFieldCacheCondAlg ()
StatusCode initialize () override final
StatusCode execute (const EventContext &ctx) const override final
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 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
 Get filter decision:
virtual void setFilterPassed (bool state, const EventContext &ctx) const
 Set filter decision:
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

typedef ServiceHandle< StoreGateSvc > StoreGateSvc_t

Private Member Functions

StatusCode updateCurrentFromConditions (const EventContext &ctx, Cache &cache) const
StatusCode updateCurrentFromParameters (const EventContext &ctx, Cache &cache) const
void scaleField (Cache &cache, const MagField::AtlasFieldMap *fieldMap) const
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

Gaudi::Property< double > m_soleMinCurrent
Gaudi::Property< double > m_toroMinCurrent
Gaudi::Property< bool > m_useDCS
Gaudi::Property< bool > m_lockMapCurrents
SG::ReadCondHandleKey< CondAttrListCollection > m_currInputKey
SG::ReadCondHandleKey< AtlasFieldMapCondObj > m_mapCondObjInputKey
SG::WriteCondHandleKey< AtlasFieldCacheCondObj > m_condObjOutputKey
Gaudi::Property< double > m_useSoleCurrent
Gaudi::Property< double > m_useToroCurrent
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 23 of file AtlasFieldCacheCondAlg.h.

Member Typedef Documentation

◆ StoreGateSvc_t

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

Definition at line 376 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ AtlasFieldCacheCondAlg()

AtlasFieldCacheCondAlg::AtlasFieldCacheCondAlg ( const std::string & name,
ISvcLocator * pSvcLocator )

Definition at line 22 of file AtlasFieldCacheCondAlg.cxx.

25 : AthCondAlgorithm(name, pSvcLocator)
26{}

◆ ~AtlasFieldCacheCondAlg()

AtlasFieldCacheCondAlg::~AtlasFieldCacheCondAlg ( )
virtualdefault

Member Function Documentation

◆ 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 AtlasFieldCacheCondAlg::execute ( const EventContext & ctx) const
finaloverride

Definition at line 57 of file AtlasFieldCacheCondAlg.cxx.

58{
59
60 ATH_MSG_DEBUG("execute: entering");
61
62 // Check if output conditions object with field cache object is still valid,
63 // if not replace it with new current scale factors
64 SG::WriteCondHandle<AtlasFieldCacheCondObj> writeHandle{ m_condObjOutputKey,
65 ctx };
66 if (writeHandle.isValid()) {
67 ATH_MSG_DEBUG("execute: CondHandle "
68 << writeHandle.fullKey() << " is already valid. "
69 << " May happen if multiple concurrent events are being "
70 "processed out of order.");
71 return StatusCode::SUCCESS;
72 }
73
74 // This will need to be filled before we construct the condition object
75 Cache cache{};
76
77 if (m_useDCS) {
79 } else {
81 }
82
83 // Must read map cond object to get previously created map
84 SG::ReadCondHandle<AtlasFieldMapCondObj> mapReadHandle{ m_mapCondObjInputKey,
85 ctx };
86 const AtlasFieldMapCondObj* mapCondObj{ *mapReadHandle };
87 if (mapCondObj == nullptr) {
88 ATH_MSG_ERROR("execute: Could not access conditions map for key: "
89 << m_mapCondObjInputKey.fullKey());
90 return StatusCode::FAILURE;
91 }
92
93 // simple pointer to the map, to be give to the AtlasFieldCacheCondObj, used
94 // for the cache field map access
95 const MagField::AtlasFieldMap* fieldMap = mapCondObj->fieldMap();
96
97 // calculate the scale factors
98 if (!m_lockMapCurrents) {
99 scaleField(cache, fieldMap);
100 }
101
102 // save current scale factor in conditions object
103 auto fieldCondObj = std::make_unique<AtlasFieldCacheCondObj>();
104
105 // initialize cond obj with current scale factors and the field svc (needed to
106 // setup cache)
107 fieldCondObj->initialize(
108 cache.m_solScaleFactor, cache.m_torScaleFactor, fieldMap);
109
110 // Record in conditions store the conditions object with scale factors and map
111 // pointer for cache
112 if (writeHandle.record(cache.m_condObjOutputRange, std::move(fieldCondObj))
113 .isFailure()) {
115 "execute: Could not record AtlasFieldCacheCondObj object with "
116 << writeHandle.key() << " with EventRange " << cache.m_condObjOutputRange
117 << " into Conditions Store");
118 return StatusCode::FAILURE;
119 }
120
122 "execute: initialized AtlasFieldCacheCondObj and cache with SFs - sol/tor "
123 << cache.m_solScaleFactor << "/" << cache.m_torScaleFactor
124 << ", EventRange " << cache.m_condObjOutputRange);
125 if (fieldMap) {
126 ATH_MSG_INFO("execute: solenoid zone id " << fieldMap->solenoidZoneId());
127 } else {
128 ATH_MSG_INFO("execute: no map read (currents == 0");
129 }
130
131 return StatusCode::SUCCESS;
132}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_ERROR(x,...)
#define ATH_MSG_INFO(x,...)
const MagField::AtlasFieldMap * fieldMap() const
void scaleField(Cache &cache, const MagField::AtlasFieldMap *fieldMap) const
SG::WriteCondHandleKey< AtlasFieldCacheCondObj > m_condObjOutputKey
StatusCode updateCurrentFromConditions(const EventContext &ctx, Cache &cache) const
StatusCode updateCurrentFromParameters(const EventContext &ctx, Cache &cache) const
Gaudi::Property< bool > m_lockMapCurrents
SG::ReadCondHandleKey< AtlasFieldMapCondObj > m_mapCondObjInputKey
const std::string & key() const
StatusCode record(const EventIDRange &range, T *t)
record handle, with explicit range DEPRECATED
const DataObjID & fullKey() const
const IIntersectionCache * cache() const
Retrieve the associated cache block, if it exists.

◆ 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 & AthCommonAlgorithm< 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 89 of file AthCommonAlgorithm.cxx.

54{
55 // If we didn't find any symlinks to add, just return the collection
56 // from the base class. Otherwise, return the extended collection.
57 if (!m_extendedExtraObjects.empty()) {
59 }
61}
Common base class for algorithms.

◆ filterPassed()

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

Get filter decision:

Definition at line 93 of file AthCommonAlgorithm.h.

93 {
94 return execState( ctx ).filterPassed();
95 }
virtual bool filterPassed(const EventContext &ctx) const
Get filter decision:

◆ initialize()

StatusCode AtlasFieldCacheCondAlg::initialize ( )
finaloverride

Definition at line 31 of file AtlasFieldCacheCondAlg.cxx.

32{
33 // Read Handle for the current
35
36 // Read handle for the field map cond object
37 ATH_CHECK(m_mapCondObjInputKey.initialize());
38
39 // Output handle for scale factors/cache
40 ATH_CHECK(m_condObjOutputKey.initialize());
41
42 ATH_MSG_DEBUG("Initialize: Key " << m_condObjOutputKey.fullKey()
43 << " has been succesfully registered ");
44
45 ATH_MSG_INFO("Initialize: Will update current from " <<
46 (m_useDCS ? "conditions" : "parameters"));
47
48 ATH_MSG_INFO("Initialize: useDCS, useSoleCurrent, useToroCurrent. "
49 << (int)m_useDCS << ", " << m_useSoleCurrent << ", "
50 << m_useToroCurrent << " LockMapCurrents "
51 << (int)m_lockMapCurrents);
52
53 return StatusCode::SUCCESS;
54}
Gaudi::Property< double > m_useSoleCurrent
Gaudi::Property< double > m_useToroCurrent
SG::ReadCondHandleKey< CondAttrListCollection > m_currInputKey

◆ 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()

virtual bool AthCommonAlgorithm< Gaudi::Algorithm >::isClonable ( ) const
inlineoverridevirtualinherited

Specify if the algorithm is clonable.

Only relevant for non-reentrant algorithms. Actual number of clones needs to be set via the "Cardinality" property.

Reimplemented in AFP_DigiTop, AlgB, AlgT, BCM_Digitization, CscDigitBuilder, CscDigitToCscRDO, G4AtlasAlg, G4RunAlg, HGTD_Digitization, HiveAlgBase, InDet::GNNSeedingTrackMaker, InDet::SCT_Clusterization, InDet::SiSPGNNTrackMaker, InDet::SiSPSeededTrackFinder, InDet::SiTrackerSpacePointFinder, ISF::SimKernelMT, ITk::StripDigitization, ITkPixelCablingAlg, ITkStripCablingAlg, LArHitEMapMaker, LArTTL1Maker, LUCID_DigiTop, LVL1::L1TopoSimulation, MergeCalibHits, MergeGenericMuonSimHitColl, MergeHijingPars, MergeMcEventCollection, MergeTrackRecordCollection, MergeTruthJets, MergeTruthParticles, MuonDigitizer, PileUpMTAlg, PixelDigitization, RoIBResultToxAOD, SCT_ByteStreamErrorsTestAlg, SCT_CablingCondAlgFromCoraCool, SCT_CablingCondAlgFromText, SCT_ConditionsParameterTestAlg, SCT_ConditionsSummaryTestAlg, SCT_ConfigurationConditionsTestAlg, SCT_Digitization, SCT_FlaggedConditionTestAlg, SCT_LinkMaskingTestAlg, SCT_MajorityConditionsTestAlg, SCT_ModuleVetoTestAlg, SCT_MonitorConditionsTestAlg, SCT_PrepDataToxAOD, SCT_RawDataToxAOD, SCT_ReadCalibChipDataTestAlg, SCT_ReadCalibDataTestAlg, SCT_RODVetoTestAlg, SCT_SensorsTestAlg, SCT_SiliconConditionsTestAlg, SCT_StripVetoTestAlg, SCT_TdaqEnabledTestAlg, SCT_TestCablingAlg, SCTEventFlagWriter, SCTRawDataProvider, SCTSiLorentzAngleTestAlg, SCTSiPropertiesTestAlg, SGInputLoader, Simulation::BeamEffectsAlg, TileHitVecToCnt, TileMuonFitter, TilePulseForTileMuonReceiver, TileRawChannelMaker, TRTDigitization, and ZDC_DigiTop.

Definition at line 68 of file AthCommonAlgorithm.h.

68 {
69 return true;
70 }

◆ 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; }

◆ 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 368 of file AthCommonDataStore.h.

369 {
370 h.renounce();
372 }
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 352 of file AthCommonDataStore.h.

352 {
354 }

◆ scaleField()

void AtlasFieldCacheCondAlg::scaleField ( Cache & cache,
const MagField::AtlasFieldMap * fieldMap ) const
private

Definition at line 282 of file AtlasFieldCacheCondAlg.cxx.

285{
286 // Calculate the scale factor for solenoid and toroid.
287
288 // We have one piece of information coming from the map.
289 // Do we have a map including both Toroid/Solenoid or only one.
290 // The values are typically the nominal value for the map
291 // or 0.
292 bool mapHasToroid = fieldMap && (fieldMap->toroidCurrent()>0);
293 bool mapHasSolenoid = fieldMap && (fieldMap->solenoidCurrent()>0);
294
295 // Then we have the info we get on the actual current we have
296 // So we might need to scale the map with it.
297 // Set the SF for the solenoid
298 if (cache.m_solenoidCurrent > 0.0) {
299 if (mapHasSolenoid &&
300 std::abs(cache.m_solenoidCurrent / fieldMap->solenoidCurrent() - 1.0) >
301 0.001) {
302 cache.m_solScaleFactor =
303 cache.m_solenoidCurrent / fieldMap->solenoidCurrent();
304 }
305 ATH_MSG_INFO("scaleField: Solenoid field scale factor "
306 << cache.m_solScaleFactor
307 << ". Desired current and map current: "
308 << cache.m_solenoidCurrent << ","
309 << (fieldMap ? fieldMap->solenoidCurrent() : 0));
310 } else {
311 // No SF set, set it to 0 - current was set to zero either here or for the
312 // map, or the map was not read in
313 cache.m_solScaleFactor = 0;
314 ATH_MSG_INFO("scaleField: Solenoid field scale factor "
315 << cache.m_solScaleFactor
316 << ". Desired current and map current: "
317 << cache.m_solenoidCurrent << ","
318 << ((fieldMap) ? fieldMap->solenoidCurrent() : 0));
319 }
320
321
322 // Set the SF for the toroid
323 if (cache.m_toroidCurrent > 0.0) {
324 if (mapHasToroid &&
325 std::abs(cache.m_toroidCurrent / fieldMap->toroidCurrent() - 1.0) >
326 0.001) {
327 // scale the field in all zones except for the solenoid zone
328 cache.m_torScaleFactor =
329 cache.m_toroidCurrent / fieldMap->toroidCurrent();
330 }
331 ATH_MSG_INFO("scaleField: Toroid field scale factor "
332 << cache.m_torScaleFactor
333 << ". Desired current and map current: "
334 << cache.m_toroidCurrent << ","
335 << (fieldMap ? fieldMap->toroidCurrent() : 0));
336 } else {
337 cache.m_torScaleFactor = 0;
338 ATH_MSG_INFO("scaleField: Toroid field scale factor "
339 << cache.m_torScaleFactor
340 << ". Desired current and map current: "
341 << cache.m_toroidCurrent << ","
342 << ((fieldMap) ? fieldMap->toroidCurrent() : 0));
343 }
344 // If the map was toroid only set both to the toroid
345 // the 0s in the solenoid should be covered by the map
346 if (mapHasToroid && !mapHasSolenoid) {
347 cache.m_solScaleFactor = cache.m_torScaleFactor;
348 }
349 // if the map is solenoid only set both to the solenoid
350 // the 0s in the toroid should be covered by the map
351 if (!mapHasToroid && mapHasSolenoid) {
352 cache.m_torScaleFactor = cache.m_solScaleFactor;
353 }
354}
float toroidCurrent() const
float solenoidCurrent() const

◆ setFilterPassed()

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

Set filter decision:

Definition at line 99 of file AthCommonAlgorithm.h.

99 {
101 }
virtual void setFilterPassed(bool state, const EventContext &ctx) const
Set filter decision:

◆ sysExecute()

StatusCode AthCommonAlgorithm< 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.

Reimplemented in AthAnalysisAlgorithm.

Definition at line 80 of file AthCommonAlgorithm.cxx.

41{
42 return BaseAlg::sysExecute (ctx);
43}

◆ sysInitialize()

StatusCode AthCommonAlgorithm< 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 AthAnalysisAlgorithm, AthHistogramAlgorithm, HypoBase, InputMakerBase, and PyAthena::Alg.

Definition at line 60 of file AthCommonAlgorithm.cxx.

71 {
73
74 if (sc.isFailure()) {
75 return sc;
76 }
77
78 ServiceHandle<ICondSvc> cs("CondSvc",name());
79 for (auto h : outputHandles()) {
80 if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
81 // do this inside the loop so we don't create the CondSvc until needed
82 if ( cs.retrieve().isFailure() ) {
83 ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
85 }
86 if (cs->regHandle(this,*h).isFailure()) {
88 ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
89 << " with CondSvc");
90 }
91 }
92 }
93 return sc;
94}
#define ATH_MSG_WARNING(x,...)
virtual StatusCode sysInitialize() override
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.

◆ updateCurrentFromConditions()

StatusCode AtlasFieldCacheCondAlg::updateCurrentFromConditions ( const EventContext & ctx,
Cache & cache ) const
private

Definition at line 135 of file AtlasFieldCacheCondAlg.cxx.

138{
139
140 // readin current value
141 SG::ReadCondHandle<CondAttrListCollection> readHandle{ m_currInputKey, ctx };
142 const CondAttrListCollection* attrListColl{ *readHandle };
143 if (attrListColl == nullptr) {
144 ATH_MSG_ERROR("updateCurrentFromConditions: Failed to retrieve "
145 "CondAttributeListCollection with key "
146 << m_currInputKey.key());
147 return StatusCode::FAILURE;
148 }
149
150 // Get the validitiy range
151 EventIDRange rangeW;
152 if (!readHandle.range(rangeW)) {
154 "updateCurrentFromConditions: Failed to retrieve validity range for "
155 << readHandle.key());
156 return StatusCode::FAILURE;
157 }
158 cache.m_condObjOutputRange = rangeW;
159 ATH_MSG_INFO("UpdateCurrentFromConditions: Range of input/output is "
160 << cache.m_condObjOutputRange);
161
162 // get magnet currents from DCS
163 double solcur{ 0. };
164 double torcur{ 0. };
165 bool gotsol{ false };
166 bool gottor{ false };
167
168 /*
169 * due to inconsistencies between CONDBR2 and OFLP200/COMP200 (the former
170 * includes channel names in the /EXT/DCS/MAGNETS/SENSORDATA folder, the
171 * latter don't), we try to read currents in both ways
172 */
173 bool hasChanNames{ false };
174 ATH_MSG_INFO("UpdateCurrentFromConditions: Attempt 1 at reading currents "
175 "from DCS (using channel name)");
176 for (CondAttrListCollection::const_iterator itr = attrListColl->begin();
177 itr != attrListColl->end();
178 ++itr) {
179 const std::string& name = attrListColl->chanName(itr->first);
180 ATH_MSG_INFO("UpdateCurrentFromConditions: Trying to read from DCS: "
181 "[channel name, index, value] "
182 << name << " , " << itr->first << " , "
183 << itr->second["value"].data<float>());
184 if (name.compare("") != 0) {
185 hasChanNames = true;
186 }
187 if (name.compare("CentralSol_Current") == 0) {
188 // channel 1 is solenoid current
189 solcur = itr->second["value"].data<float>();
190 gotsol = true;
191 } else if (name.compare("Toroids_Current") == 0) {
192 // channel 3 is toroid current
193 torcur = itr->second["value"].data<float>();
194 gottor = true;
195 }
196 }
197 if (!hasChanNames) {
198 ATH_MSG_INFO("UpdateCurrentFromConditions: Attempt 2 at reading currents "
199 "from DCS (using channel index)");
200 // in no channel is named, try again using channel index instead
201 for (CondAttrListCollection::const_iterator itr = attrListColl->begin();
202 itr != attrListColl->end();
203 ++itr) {
204
205 if (itr->first == 1) {
206 // channel 1 is solenoid current
207 solcur = itr->second["value"].data<float>();
208 gotsol = true;
209 } else if (itr->first == 3) {
210 // channel 3 is toroid current
211 torcur = itr->second["value"].data<float>();
212 gottor = true;
213 }
214 }
215 }
216 if (!gotsol || !gottor) {
217 if (!gotsol)
218 ATH_MSG_ERROR("UpdateCurrentFromConditions: Missing solenoid current in "
219 "DCS information");
220 if (!gottor)
221 ATH_MSG_ERROR("UpdateCurrentFromConditions: Missing toroid current in "
222 "DCS information");
223 return StatusCode::FAILURE;
224 }
225
226 ATH_MSG_INFO("UpdateCurrentFromConditions: Currents read from DCS - solenoid "
227 << solcur << " toroid " << torcur);
228
229 // round to zero if close to zero
230 if (solcur < m_soleMinCurrent) {
231 solcur = 0.0;
232 ATH_MSG_INFO("UpdateCurrentFromConditions: Solenoid is off");
233 }
234 if (torcur < m_toroMinCurrent) {
235 torcur = 0.0;
236 ATH_MSG_INFO("UpdateCurrentFromConditions: Toroids are off");
237 }
238
239 cache.m_solenoidCurrent = solcur;
240 cache.m_toroidCurrent = torcur;
241
242 return StatusCode::SUCCESS;
243}
#define ATH_MSG_FATAL(x,...)
const_iterator end() const
const_iterator begin() const
Access to Chan/AttributeList pairs via iterators.
const std::string & chanName(ChanNum chanNum) const
find name for particular channel
ChanAttrListMap::const_iterator const_iterator
Gaudi::Property< double > m_soleMinCurrent
Gaudi::Property< double > m_toroMinCurrent
bool range(EventIDRange &r)
const std::string & key() const

◆ updateCurrentFromParameters()

StatusCode AtlasFieldCacheCondAlg::updateCurrentFromParameters ( const EventContext & ctx,
Cache & cache ) const
private

Definition at line 246 of file AtlasFieldCacheCondAlg.cxx.

249{
250
251 // take the current values from JobOptions
252 double solcur{ m_useSoleCurrent };
253 double torcur{ m_useToroCurrent };
254 if (solcur < m_soleMinCurrent) {
255 solcur = 0.0;
256 ATH_MSG_INFO("updateCurrentFromParameters: Solenoid is off");
257 }
258 if (torcur < m_toroMinCurrent) {
259 torcur = 0.0;
260 ATH_MSG_INFO("updateCurrentFromParameters: Toroids are off");
261 }
262 cache.m_solenoidCurrent = solcur;
263 cache.m_toroidCurrent = torcur;
264
265 // in case of reading from DB or from FILE, the EventID range is always the
266 // current run
267 EventIDBase start, stop;
268 start.set_run_number(ctx.eventID().run_number());
269 start.set_lumi_block(0);
270 stop.set_run_number(ctx.eventID().run_number() + 1);
271 stop.set_lumi_block(0);
272 cache.m_condObjOutputRange = EventIDRange(start, stop);
273
274 ATH_MSG_INFO("updateCurrentFromParameters: Update from job options: Range of "
275 "input/output is "
276 << cache.m_condObjOutputRange);
277
278 return StatusCode::SUCCESS;
279}

◆ updateVHKA()

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

Definition at line 298 of file AthCommonDataStore.h.

298 {
299 for (auto &a : m_vhka) {
301 for (auto k : keys) {
302 k->setOwner(this);
303 }
304 }
305 }

Member Data Documentation

◆ m_condObjOutputKey

SG::WriteCondHandleKey<AtlasFieldCacheCondObj> MagField::AtlasFieldCacheCondAlg::m_condObjOutputKey
private
Initial value:
{
this,
"AtlasFieldCacheCondObj",
"fieldCondObj",
"Name of the key for the Magnetic Field conditions object with currents "
"for scaling"
}

Definition at line 105 of file AtlasFieldCacheCondAlg.h.

105 {
106 this,
107 "AtlasFieldCacheCondObj",
108 "fieldCondObj",
109 "Name of the key for the Magnetic Field conditions object with currents "
110 "for scaling"
111 };

◆ m_currInputKey

SG::ReadCondHandleKey<CondAttrListCollection> MagField::AtlasFieldCacheCondAlg::m_currInputKey
private
Initial value:
{
this,
"COOLCurrentsFolderName",
"/EXT/DCS/MAGNETS/SENSORDATA",
"Name of the COOL folder containing magnet currents"
}

Definition at line 86 of file AtlasFieldCacheCondAlg.h.

86 {
87 this,
88 "COOLCurrentsFolderName",
89 "/EXT/DCS/MAGNETS/SENSORDATA",
90 "Name of the COOL folder containing magnet currents"
91 };

◆ m_detStore

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

Pointer to StoreGate (detector store by default).

Definition at line 381 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 378 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

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

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

Empty if no symlinks were found.

Definition at line 108 of file AthCommonAlgorithm.h.

◆ m_lockMapCurrents

Gaudi::Property<bool> MagField::AtlasFieldCacheCondAlg::m_lockMapCurrents
private
Initial value:
{
this,
"LockMapCurrents",
false,
"Skip current rescale and use map currents as they are"
}

Definition at line 77 of file AtlasFieldCacheCondAlg.h.

77 {
78 this,
79 "LockMapCurrents",
80 false,
81 "Skip current rescale and use map currents as they are"
82 };

◆ m_mapCondObjInputKey

SG::ReadCondHandleKey<AtlasFieldMapCondObj> MagField::AtlasFieldCacheCondAlg::m_mapCondObjInputKey
private
Initial value:
{
this,
"AtlasFieldMapCondObj",
"fieldMapCondObj",
"Name of key for the Magnetic Field conditions object with the map file "
"names"
}

Definition at line 95 of file AtlasFieldCacheCondAlg.h.

95 {
96 this,
97 "AtlasFieldMapCondObj",
98 "fieldMapCondObj",
99 "Name of key for the Magnetic Field conditions object with the map file "
100 "names"
101 };

◆ m_soleMinCurrent

Gaudi::Property<double> MagField::AtlasFieldCacheCondAlg::m_soleMinCurrent
private
Initial value:
{
this,
"SoleMinCurrent",
1.0,
"Minimum solenoid current (A) for which solenoid is considered ON"
}

Definition at line 55 of file AtlasFieldCacheCondAlg.h.

55 {
56 this,
57 "SoleMinCurrent",
58 1.0,
59 "Minimum solenoid current (A) for which solenoid is considered ON"
60 };

◆ m_toroMinCurrent

Gaudi::Property<double> MagField::AtlasFieldCacheCondAlg::m_toroMinCurrent
private
Initial value:
{
this,
"ToroMinCurrent",
1.0,
"Minimum toroid current (A) for which toroid is considered ON"
}

Definition at line 61 of file AtlasFieldCacheCondAlg.h.

61 {
62 this,
63 "ToroMinCurrent",
64 1.0,
65 "Minimum toroid current (A) for which toroid is considered ON"
66 };

◆ m_useDCS

Gaudi::Property<bool> MagField::AtlasFieldCacheCondAlg::m_useDCS
private
Initial value:
{
this,
"UseDCS",
false,
"Get magnet currents from DCS through ConditionsSvc"
}

Definition at line 69 of file AtlasFieldCacheCondAlg.h.

69 {
70 this,
71 "UseDCS",
72 false,
73 "Get magnet currents from DCS through ConditionsSvc"
74 };

◆ m_useSoleCurrent

Gaudi::Property<double> MagField::AtlasFieldCacheCondAlg::m_useSoleCurrent
private
Initial value:
{ this,
"UseSoleCurrent",
7730.,
"Set actual solenoid current (A)" }

Definition at line 114 of file AtlasFieldCacheCondAlg.h.

114 { this,
115 "UseSoleCurrent",
116 7730.,
117 "Set actual solenoid current (A)" };

◆ m_useToroCurrent

Gaudi::Property<double> MagField::AtlasFieldCacheCondAlg::m_useToroCurrent
private
Initial value:
{ this,
"UseToroCurrent",
20400.,
"Set actual toroid current (A)" }

Definition at line 118 of file AtlasFieldCacheCondAlg.h.

118 { this,
119 "UseToroCurrent",
120 20400.,
121 "Set actual toroid current (A)" };

◆ m_varHandleArraysDeclared

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

Definition at line 387 of file AthCommonDataStore.h.

◆ m_vhka

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

Definition at line 386 of file AthCommonDataStore.h.


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