ATLAS Offline Software
AtlasFieldCacheCondAlg.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // AtlasFieldCacheCondAlg.h, (c) ATLAS Detector software
8 
9 #ifndef MAGFIELDSERVICES_ATLASFIELDCACHECONDALG_H
10 #define MAGFIELDSERVICES_ATLASFIELDCACHECONDALG_H
11 
12 // FrameWork includes
17 
20 
21 namespace MagField {
22 
24 {
25 public:
26  AtlasFieldCacheCondAlg(const std::string& name, ISvcLocator* pSvcLocator);
28 
29  StatusCode initialize() override final;
30  StatusCode execute(const EventContext& ctx) const override final;
31  virtual bool isReEntrant() const override final { return false; }
32 
33 private:
34  /*
35  * Cache of the variables to be updated before we write the conditions object
36  */
37  struct Cache
38  {
39  float m_solenoidCurrent{ 0 }; // solenoid current in ampere
40  float m_toroidCurrent{ 0 }; // toroid current in ampere
41  double m_solScaleFactor{ 1 }; // solenoid current scale factor
42  double m_torScaleFactor{ 1 }; // toroid current scale factor
43 
44  //"infinite in case we do not update from DCS" - full run/event range
45  EventIDRange m_condObjOutputRange{ EventIDRange(
46  EventIDBase(0, 0),
47  EventIDBase(EventIDBase::UNDEFNUM - 1, EventIDBase::UNDEFEVT - 1)) };
48  };
49  StatusCode updateCurrentFromConditions(const EventContext& ctx,
50  Cache& cache) const;
51  StatusCode updateCurrentFromParameters(const EventContext& ctx,
52  Cache& cache) const;
53  void scaleField(Cache& cache, const MagField::AtlasFieldMap* fieldMap) const;
54 
55  // threshold below which currents are considered zero
56  Gaudi::Property<double> m_soleMinCurrent{
57  this,
58  "SoleMinCurrent",
59  1.0,
60  "Minimum solenoid current (A) for which solenoid is considered ON"
61  };
62  Gaudi::Property<double> m_toroMinCurrent{
63  this,
64  "ToroMinCurrent",
65  1.0,
66  "Minimum toroid current (A) for which toroid is considered ON"
67  };
68 
69  // flag to use magnet current from DCS in COOL
70  Gaudi::Property<bool> m_useDCS{
71  this,
72  "UseDCS",
73  false,
74  "Get magnet currents from DCS through ConditionsSvc"
75  };
76 
77  // flag to skip current rescale and use map currents as they are
78  Gaudi::Property<bool> m_lockMapCurrents{
79  this,
80  "LockMapCurrents",
81  false,
82  "Skip current rescale and use map currents as they are"
83  };
84 
85  // COOL folder name containing current information
86  // current input key
88  this,
89  "COOLCurrentsFolderName",
90  "/EXT/DCS/MAGNETS/SENSORDATA",
91  "Name of the COOL folder containing magnet currents"
92  };
93 
94  // AtlasFieldMapCondObj - read handle to access magnet field conditions object
95  // containing the map file names
97  this,
98  "AtlasFieldMapCondObj",
99  "fieldMapCondObj",
100  "Name of key for the Magnetic Field conditions object with the map file "
101  "names"
102  };
103 
104  // AtlasFieldCacheCondObj - magnet field conditions object containing the
105  // current scale factors
107  this,
108  "AtlasFieldCacheCondObj",
109  "fieldCondObj",
110  "Name of the key for the Magnetic Field conditions object with currents "
111  "for scaling"
112  };
113 
114  // actual current if DCS is not in use
115  Gaudi::Property<double> m_useSoleCurrent{ this,
116  "UseSoleCurrent",
117  7730.,
118  "Set actual solenoid current (A)" };
119  Gaudi::Property<double> m_useToroCurrent{ this,
120  "UseToroCurrent",
121  20400.,
122  "Set actual toroid current (A)" };
123 };
124 }
125 
126 #endif //> !MAGFIELDSERVICES_ATLASFIELDCACHECONDALG_H
MagField::AtlasFieldCacheCondAlg::scaleField
void scaleField(Cache &cache, const MagField::AtlasFieldMap *fieldMap) const
Definition: AtlasFieldCacheCondAlg.cxx:286
AtlasFieldMapCondObj.h
CondAttrListCollection.h
This file defines the class for a collection of AttributeLists where each one is associated with a ch...
MagField::AtlasFieldCacheCondAlg
Definition: AtlasFieldCacheCondAlg.h:24
AtlasFieldCacheCondObj.h
MagField::AtlasFieldCacheCondAlg::m_toroMinCurrent
Gaudi::Property< double > m_toroMinCurrent
Definition: AtlasFieldCacheCondAlg.h:62
WriteCondHandleKey.h
MagField::AtlasFieldCacheCondAlg::m_lockMapCurrents
Gaudi::Property< bool > m_lockMapCurrents
Definition: AtlasFieldCacheCondAlg.h:78
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:562
MagField::AtlasFieldCacheCondAlg::m_currInputKey
SG::ReadCondHandleKey< CondAttrListCollection > m_currInputKey
Definition: AtlasFieldCacheCondAlg.h:87
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
MagField::AtlasFieldCacheCondAlg::m_useDCS
Gaudi::Property< bool > m_useDCS
Definition: AtlasFieldCacheCondAlg.h:70
MagField::AtlasFieldCacheCondAlg::m_mapCondObjInputKey
SG::ReadCondHandleKey< AtlasFieldMapCondObj > m_mapCondObjInputKey
Definition: AtlasFieldCacheCondAlg.h:96
MagField::AtlasFieldCacheCondAlg::m_useToroCurrent
Gaudi::Property< double > m_useToroCurrent
Definition: AtlasFieldCacheCondAlg.h:119
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
MagField::AtlasFieldCacheCondAlg::m_soleMinCurrent
Gaudi::Property< double > m_soleMinCurrent
Definition: AtlasFieldCacheCondAlg.h:56
MagField::AtlasFieldCacheCondAlg::m_useSoleCurrent
Gaudi::Property< double > m_useSoleCurrent
Definition: AtlasFieldCacheCondAlg.h:115
MagField
Local cache for magnetic field (based on MagFieldServices/AtlasFieldSvcTLS.h)
Definition: ForwardRegionFieldSvc.h:27
ReadCondHandleKey.h
AthReentrantAlgorithm.h
MagField::AtlasFieldCacheCondAlg::Cache::m_solenoidCurrent
float m_solenoidCurrent
Definition: AtlasFieldCacheCondAlg.h:39
MagField::AtlasFieldCacheCondAlg::execute
StatusCode execute(const EventContext &ctx) const override final
Definition: AtlasFieldCacheCondAlg.cxx:61
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
MagField::AtlasFieldMap
Map for magnetic field.
Definition: AtlasFieldMap.h:39
MagField::AtlasFieldCacheCondAlg::m_condObjOutputKey
SG::WriteCondHandleKey< AtlasFieldCacheCondObj > m_condObjOutputKey
Definition: AtlasFieldCacheCondAlg.h:106
SG::ReadCondHandleKey< CondAttrListCollection >
MagField::AtlasFieldCacheCondAlg::initialize
StatusCode initialize() override final
Definition: AtlasFieldCacheCondAlg.cxx:35
MagField::AtlasFieldCacheCondAlg::updateCurrentFromParameters
StatusCode updateCurrentFromParameters(const EventContext &ctx, Cache &cache) const
Definition: AtlasFieldCacheCondAlg.cxx:250
MagField::AtlasFieldCacheCondAlg::~AtlasFieldCacheCondAlg
virtual ~AtlasFieldCacheCondAlg()
MagField::AtlasFieldCacheCondAlg::AtlasFieldCacheCondAlg
AtlasFieldCacheCondAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition: AtlasFieldCacheCondAlg.cxx:26
MagField::AtlasFieldCacheCondAlg::Cache::m_condObjOutputRange
EventIDRange m_condObjOutputRange
Definition: AtlasFieldCacheCondAlg.h:45
SG::WriteCondHandleKey< AtlasFieldCacheCondObj >
MagField::AtlasFieldCacheCondAlg::isReEntrant
virtual bool isReEntrant() const override final
Definition: AtlasFieldCacheCondAlg.h:31
MagField::AtlasFieldCacheCondAlg::Cache
Definition: AtlasFieldCacheCondAlg.h:38
MagField::AtlasFieldCacheCondAlg::updateCurrentFromConditions
StatusCode updateCurrentFromConditions(const EventContext &ctx, Cache &cache) const
Definition: AtlasFieldCacheCondAlg.cxx:139
MagField::AtlasFieldCacheCondAlg::Cache::m_torScaleFactor
double m_torScaleFactor
Definition: AtlasFieldCacheCondAlg.h:42
MagField::AtlasFieldCacheCondAlg::Cache::m_solScaleFactor
double m_solScaleFactor
Definition: AtlasFieldCacheCondAlg.h:41
MagField::AtlasFieldCacheCondAlg::Cache::m_toroidCurrent
float m_toroidCurrent
Definition: AtlasFieldCacheCondAlg.h:40