ATLAS Offline Software
AtlasFieldMapCondAlg.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 // AtlasFieldMapCondAlg.h, (c) ATLAS Detector software
8 
9 #ifndef MAGFIELDSERVICES_ATLASFIELDMAPCONDALG_H
10 #define MAGFIELDSERVICES_ATLASFIELDMAPCONDALG_H
11 
12 // FrameWork includes
17 
19 
20 namespace MagField {
21 
23 {
24 public:
25  AtlasFieldMapCondAlg(const std::string& name, ISvcLocator* pSvcLocator);
27 
28  StatusCode start() override final;
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  bool solenoidOn() { return (m_mapSoleCurrent > 0.0); }
40  bool toroidOn() { return (m_mapToroCurrent > 0.0); }
41  // current associated with the map
42  double m_mapSoleCurrent{ 7730. };
43  double m_mapToroCurrent{ 20400. };
44  // field map names
45  std::string m_fullMapFilename{
46  "MagneticFieldMaps/bfieldmap_7730_20400_14m.root"
47  }; // all magnets on
48  std::string m_soleMapFilename{
49  "MagneticFieldMaps/bfieldmap_7730_0_14m.root"
50  }; // solenoid on / toroid off
51  std::string m_toroMapFilename{
52  "MagneticFieldMaps/bfieldmap_0_20400_14m.root"
53  }; // toroid on / solenoid off
54  // field map - pointer and event id range
55  std::unique_ptr<MagField::AtlasFieldMap> m_fieldMap;
56 
57  //"infinite in case we do not update from COOL"
59  EventIDRange()
60  }; // default range covers everything (run/event and timestamp)
61  };
62 
63  // get the field map
64  StatusCode updateFieldMap(const EventContext& ctx, Cache& cache) const;
65 
66  // get DCS currents to decide which field map file to read
67  StatusCode checkCurrentFromConditions(const EventContext& ctx,
68  double& soleCurrent,
69  double& toroCurrent,
70  EventIDRange& rangeDCS) const;
71 
73  Gaudi::Property<std::string> m_fullMapFilename{
74  this,
75  "FullMapFile",
76  "MagneticFieldMaps/bfieldmap_7730_20400_14m.root",
77  "File storing the full magnetic field map"
78  };
79  Gaudi::Property<std::string> m_soleMapFilename{
80  this,
81  "SoleMapFile",
82  "MagneticFieldMaps/bfieldmap_7730_0_14m.root",
83  "File storing the solenoid-only magnetic field map"
84  };
85  Gaudi::Property<std::string> m_toroMapFilename{
86  this,
87  "ToroMapFile",
88  "MagneticFieldMaps/bfieldmap_0_20400_14m.root",
89  "File storing the toroid-only magnetic field map"
90  };
92  Gaudi::Property<double> m_mapSoleCurrent{ this,
93  "MapSoleCurrent",
94  7730.,
95  "Nominal solenoid current (A)" };
96  Gaudi::Property<double> m_mapToroCurrent{ this,
97  "MapToroCurrent",
98  20400.,
99  "Nominal toroid current (A)" };
100 
101  // threshold below which currents are considered zero
102  Gaudi::Property<double> m_soleMinCurrent{
103  this,
104  "SoleMinCurrent",
105  1.0,
106  "Minimum solenoid current (A) for which solenoid is considered ON"
107  };
108  Gaudi::Property<double> m_toroMinCurrent{
109  this,
110  "ToroMinCurrent",
111  1.0,
112  "Minimum toroid current (A) for which toroid is considered ON"
113  };
114 
115  // flag to load map on start
116  Gaudi::Property<bool> m_loadMapOnStart{
117  this,
118  "LoadMapOnStart",
119  false,
120  "Load the magnetic field map at start"
121  };
122 
123  // flag to read magnet map filenames from COOL
124  Gaudi::Property<bool> m_useMapsFromCOOL{
125  this,
126  "UseMapsFromCOOL",
127  true,
128  "Get magnetic field map filenames from COOL"
129  };
130 
131  // COOL folder name containing field maps
132  // map input key
134  this,
135  "COOLMapsFolderName",
136  "/GLOBAL/BField/Maps",
137  "Name of the COOL folder containing field maps"
138  };
139 
140  // AtlasFieldMapCondObj - magnet field conditions object containing the map
141  // file names
143  this,
144  "AtlasFieldMapCondObj",
145  "fieldMapCondObj",
146  "Name of key for the Magnetic Field conditions object with the map file "
147  "names"
148  };
149 
150  // COOL folder name containing current information
151  // current input key
153  this,
154  "COOLCurrentsFolderName",
155  "/EXT/DCS/MAGNETS/SENSORDATA",
156  "Name of the COOL folder containing magnet currents"
157  };
158 
159 };
160 }
161 
162 #endif //> !MAGFIELDSERVICES_ATLASFIELDMAPCONDALG_H
MagField::AtlasFieldMapCondAlg::m_currInputKey
SG::ReadCondHandleKey< CondAttrListCollection > m_currInputKey
Definition: AtlasFieldMapCondAlg.h:152
MagField::AtlasFieldMapCondAlg::Cache::m_soleMapFilename
std::string m_soleMapFilename
Definition: AtlasFieldMapCondAlg.h:48
AtlasFieldMapCondObj.h
CondAttrListCollection.h
This file defines the class for a collection of AttributeLists where each one is associated with a ch...
MagField::AtlasFieldMapCondAlg::m_mapCondObjOutputKey
SG::WriteCondHandleKey< AtlasFieldMapCondObj > m_mapCondObjOutputKey
Definition: AtlasFieldMapCondAlg.h:142
MagField::AtlasFieldMapCondAlg::Cache
Definition: AtlasFieldMapCondAlg.h:38
MagField::AtlasFieldMapCondAlg::isReEntrant
virtual bool isReEntrant() const override final
Definition: AtlasFieldMapCondAlg.h:31
MagField::AtlasFieldMapCondAlg::Cache::m_fieldMap
std::unique_ptr< MagField::AtlasFieldMap > m_fieldMap
Definition: AtlasFieldMapCondAlg.h:55
WriteCondHandleKey.h
MagField::AtlasFieldMapCondAlg::Cache::toroidOn
bool toroidOn()
Definition: AtlasFieldMapCondAlg.h:40
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:562
MagField::AtlasFieldMapCondAlg::execute
StatusCode execute(const EventContext &ctx) const override final
Definition: AtlasFieldMapCondAlg.cxx:82
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
MagField::AtlasFieldMapCondAlg::Cache::m_mapToroCurrent
double m_mapToroCurrent
Definition: AtlasFieldMapCondAlg.h:43
MagField::AtlasFieldMapCondAlg::m_mapsInputKey
SG::ReadCondHandleKey< CondAttrListCollection > m_mapsInputKey
Definition: AtlasFieldMapCondAlg.h:133
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
MagField::AtlasFieldMapCondAlg::Cache::m_mapSoleCurrent
double m_mapSoleCurrent
Definition: AtlasFieldMapCondAlg.h:42
MagField
Local cache for magnetic field (based on MagFieldServices/AtlasFieldSvcTLS.h)
Definition: ForwardRegionFieldSvc.h:27
ReadCondHandleKey.h
AthReentrantAlgorithm.h
MagField::AtlasFieldMapCondAlg
Definition: AtlasFieldMapCondAlg.h:23
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
MagField::AtlasFieldMapCondAlg::Cache::m_mapCondObjOutputRange
EventIDRange m_mapCondObjOutputRange
Definition: AtlasFieldMapCondAlg.h:58
MagField::AtlasFieldMapCondAlg::checkCurrentFromConditions
StatusCode checkCurrentFromConditions(const EventContext &ctx, double &soleCurrent, double &toroCurrent, EventIDRange &rangeDCS) const
Definition: AtlasFieldMapCondAlg.cxx:427
MagField::AtlasFieldMapCondAlg::m_fullMapFilename
Gaudi::Property< std::string > m_fullMapFilename
map file names - if not read from cool
Definition: AtlasFieldMapCondAlg.h:73
SG::ReadCondHandleKey< CondAttrListCollection >
MagField::AtlasFieldMapCondAlg::m_soleMinCurrent
Gaudi::Property< double > m_soleMinCurrent
Definition: AtlasFieldMapCondAlg.h:102
MagField::AtlasFieldMapCondAlg::m_toroMapFilename
Gaudi::Property< std::string > m_toroMapFilename
Definition: AtlasFieldMapCondAlg.h:85
MagField::AtlasFieldMapCondAlg::m_loadMapOnStart
Gaudi::Property< bool > m_loadMapOnStart
Definition: AtlasFieldMapCondAlg.h:116
MagField::AtlasFieldMapCondAlg::Cache::m_toroMapFilename
std::string m_toroMapFilename
Definition: AtlasFieldMapCondAlg.h:51
MagField::AtlasFieldMapCondAlg::updateFieldMap
StatusCode updateFieldMap(const EventContext &ctx, Cache &cache) const
Definition: AtlasFieldMapCondAlg.cxx:131
MagField::AtlasFieldMapCondAlg::m_toroMinCurrent
Gaudi::Property< double > m_toroMinCurrent
Definition: AtlasFieldMapCondAlg.h:108
MagField::AtlasFieldMapCondAlg::Cache::m_fullMapFilename
std::string m_fullMapFilename
Definition: AtlasFieldMapCondAlg.h:45
MagField::AtlasFieldMapCondAlg::m_soleMapFilename
Gaudi::Property< std::string > m_soleMapFilename
Definition: AtlasFieldMapCondAlg.h:79
SG::WriteCondHandleKey< AtlasFieldMapCondObj >
MagField::AtlasFieldMapCondAlg::~AtlasFieldMapCondAlg
virtual ~AtlasFieldMapCondAlg()
MagField::AtlasFieldMapCondAlg::AtlasFieldMapCondAlg
AtlasFieldMapCondAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition: AtlasFieldMapCondAlg.cxx:33
MagField::AtlasFieldMapCondAlg::initialize
StatusCode initialize() override final
Definition: AtlasFieldMapCondAlg.cxx:41
MagField::AtlasFieldMapCondAlg::m_useMapsFromCOOL
Gaudi::Property< bool > m_useMapsFromCOOL
Definition: AtlasFieldMapCondAlg.h:124
MagField::AtlasFieldMapCondAlg::m_mapSoleCurrent
Gaudi::Property< double > m_mapSoleCurrent
nominal current for the maps
Definition: AtlasFieldMapCondAlg.h:92
MagField::AtlasFieldMapCondAlg::m_mapToroCurrent
Gaudi::Property< double > m_mapToroCurrent
Definition: AtlasFieldMapCondAlg.h:96
MagField::AtlasFieldMapCondAlg::Cache::solenoidOn
bool solenoidOn()
Definition: AtlasFieldMapCondAlg.h:39
MagField::AtlasFieldMapCondAlg::start
StatusCode start() override final
Definition: AtlasFieldMapCondAlg.cxx:69