ATLAS Offline Software
HVHelper.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef LARG4_EC_HVHELPER_H
6 #define LARG4_EC_HVHELPER_H
7 
8 #include <stdio.h>
9 #include <stdexcept>
10 
12 #include "AthenaKernel/Units.h"
13 
15 
16 #include "G4ThreeVector.hh"
17 #include "globals.hh"
18 
19 #include <memory>
20 
21 namespace LArG4 { namespace EC {
22 
23 class HVHelper : public AthMessaging
24 {
25  protected:
26  static constexpr G4int s_NofAtlasSide = 2;
27  static constexpr G4int s_NofEtaSection = 9;
28  static constexpr G4int s_NofElectrodeSide = 2;
29  static constexpr G4int s_NofElectrodesOut = 768;
30 
31  static const G4double s_EtaLimit[s_NofEtaSection + 1];
32 
34 
36  const LArWheelCalculator *lwc(void) const { return m_calculator; }
37 
38  const G4double m_WheelShift;
39  const G4int m_NofPhiSections;
40 
41  const G4int m_EtaMin, m_EtaMax;
42 
44  const LArWheelCalculator *calc,
45  const G4String &version
46  );
47  void AcquireMaps(const G4String &version, G4bool from_DB);
48  void GetMapFromDB(void);
49  virtual void ReadMapFromFile(const G4String &version) = 0;
50  FILE * OpenFileAndCheckVersion(const G4String &version);
51 
52  G4int GetEtaSection(const G4ThreeVector &p) const;
53 
54  virtual G4int GetPhiSection(
55  G4int, G4int, G4int, G4int
56  ) const = 0;
57 
58  public:
60  G4double phi, G4int compartment, G4int eta_bin
61  ) const;
62 
63  G4double GetVoltage(const G4ThreeVector& p) const;
64 
65  virtual G4double GetVoltage(const G4ThreeVector&, G4int, G4int) const;
66  virtual G4double GetVoltage(
67  const G4ThreeVector&, const std::pair<G4int, G4int> &
68  ) const;
69 
70  static std::unique_ptr<const HVHelper> CreateHelper(
71  const LArWheelCalculator *calc,
72  const G4String &version,
73  G4bool fromDB
74  );
75 
76  virtual ~HVHelper() {}
77 };
78 
79 class HVHelperV00 : public HVHelper // This serves map versions 00 and 01
80 {
81  private:
83  G4int StartPhi(G4int side, G4int eta, G4int ele) const
84  {
85  return m_StartPhi[(side*s_NofEtaSection + eta)*s_NofElectrodeSide + ele];
86  }
87 
88  void SetStartPhi(G4int value, G4int side, G4int eta, G4int ele)
89  {
91  }
92 
94 
95  void ReadMapFromFile(const G4String &version) override final;
96 
97  virtual G4int GetPhiSection(
98  G4int, G4int, G4int, G4int
99  ) const override final;
100 
101  public:
103  const LArWheelCalculator *calc,
104  const G4String &version,
105  G4bool fromDB
106  ) : HVHelper(calc, version)
107  , m_NumberOfElectrodesInPhiSection(lwc()->GetNumberOfFans() / m_NofPhiSections)
108  {
110  }
111 };
112 
113 class HVHelperV02 : public HVHelper // This serves map versions 02 and above
114 {
115  private:
116  void ReadMapFromFile(const G4String &version) override final;
117 
118  virtual G4int GetPhiSection(
119  G4int, G4int, G4int, G4int
120  ) const override final;
121 
122  public:
124  const LArWheelCalculator *calc,
125  const G4String &version,
126  G4bool fromDB
128 };
129 
130 }} // namespaces
131 
132 #endif // LARG4_EC_HVHELPER_H
LArG4::EC::HVHelperV00::m_NumberOfElectrodesInPhiSection
const G4int m_NumberOfElectrodesInPhiSection
Definition: HVHelper.h:93
LArG4::EC::HVHelper::GetVoltage
virtual G4double GetVoltage(const G4ThreeVector &, G4int, G4int) const
LArG4::EC::HVHelperV00::HVHelperV00
HVHelperV00(const LArWheelCalculator *calc, const G4String &version, G4bool fromDB)
Definition: HVHelper.h:102
LArG4::EC::HVHelper::m_EtaMax
const G4int m_EtaMax
Definition: HVHelper.h:41
LArG4::EC::HVHelper::m_EtaMin
const G4int m_EtaMin
Definition: HVHelper.h:41
LArG4::EC::HVHelper::m_calculator
const LArWheelCalculator * m_calculator
Definition: HVHelper.h:35
LArG4::EC::HVHelper::s_NofElectrodesOut
static constexpr G4int s_NofElectrodesOut
Definition: HVHelper.h:29
LArG4::EC::HVHelper::GetPhiSection
virtual G4int GetPhiSection(G4int, G4int, G4int, G4int) const =0
LArG4::EC::HVHelper::m_NofPhiSections
const G4int m_NofPhiSections
Definition: HVHelper.h:39
LArG4::EC::HVHelperV02::HVHelperV02
HVHelperV02(const LArWheelCalculator *calc, const G4String &version, G4bool fromDB)
Definition: HVHelper.h:123
LArG4::EC::HVHelper::OpenFileAndCheckVersion
FILE * OpenFileAndCheckVersion(const G4String &version)
LArG4::EC::HVHelper::ReadMapFromFile
virtual void ReadMapFromFile(const G4String &version)=0
athena.value
value
Definition: athena.py:124
LArG4::EC::HVHelper::GetMapFromDB
void GetMapFromDB(void)
LArG4::EC::HVHelperV02
Definition: HVHelper.h:114
LArG4::EC::HVHelper::s_NofAtlasSide
static constexpr G4int s_NofAtlasSide
Definition: HVHelper.h:26
LArG4::EC::HVHelper::~HVHelper
virtual ~HVHelper()
Definition: HVHelper.h:76
LArG4
Definition: LArWheelCalculatorEnums.h:8
LArG4::EC::HVHelperV02::ReadMapFromFile
void ReadMapFromFile(const G4String &version) override final
LArG4::EC::HVHelper::m_WheelShift
const G4double m_WheelShift
Definition: HVHelper.h:38
TRT::Hit::side
@ side
Definition: HitInfo.h:83
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
LArG4::EC::HVHelper::HVHelper
HVHelper(const LArWheelCalculator *calc, const G4String &version)
LArG4::EC::HVHelperV00::ReadMapFromFile
void ReadMapFromFile(const G4String &version) override final
LArG4::EC::HVHelperV00::m_StartPhi
G4int m_StartPhi[s_NofAtlasSide *s_NofEtaSection *s_NofElectrodeSide]
Definition: HVHelper.h:82
LArG4::EC::HVHelper::GetVoltage
virtual G4double GetVoltage(const G4ThreeVector &, const std::pair< G4int, G4int > &) const
LArG4::EC::HVHelperV00::GetPhiSection
virtual G4int GetPhiSection(G4int, G4int, G4int, G4int) const override final
LArG4::EC::HVHelperV00::SetStartPhi
void SetStartPhi(G4int value, G4int side, G4int eta, G4int ele)
Definition: HVHelper.h:88
LArG4::EC::HVHelper
Definition: HVHelper.h:24
LArG4::EC::HVHelper::GetVoltageBarrett
G4double GetVoltageBarrett(G4double phi, G4int compartment, G4int eta_bin) const
AthMessaging
Class to provide easy MsgStream access and capabilities.
Definition: AthMessaging.h:55
LArG4::EC::HVHelperV00::StartPhi
G4int StartPhi(G4int side, G4int eta, G4int ele) const
Definition: HVHelper.h:83
LArWheelCalculator
Definition: LArWheelCalculator.h:60
plotBeamSpotCompare.fromDB
bool fromDB
Definition: plotBeamSpotCompare.py:115
doL1CaloHVCorrections.eta_bin
eta_bin
Definition: doL1CaloHVCorrections.py:368
LArG4::EC::HVHelper::CreateHelper
static std::unique_ptr< const HVHelper > CreateHelper(const LArWheelCalculator *calc, const G4String &version, G4bool fromDB)
LArG4::EC::HVHelperV00
Definition: HVHelper.h:80
LArG4::EC::HVHelper::m_Values
G4double m_Values[s_NofAtlasSide][s_NofEtaSection][s_NofElectrodeSide][s_NofElectrodesOut]
Definition: HVHelper.h:33
Units.h
Wrapper to avoid constant divisions when using units.
get_generator_info.version
version
Definition: get_generator_info.py:33
AthMessaging.h
LArG4::EC::HVHelper::GetVoltage
G4double GetVoltage(const G4ThreeVector &p) const
LArG4::EC::HVHelper::s_EtaLimit
static const G4double s_EtaLimit[s_NofEtaSection+1]
Definition: HVHelper.h:31
TRT_PAI_gasdata::EC
const float EC[NC]
Energy levels for Carbon.
Definition: TRT_PAI_gasdata.h:241
LArG4::EC::HVHelperV02::GetPhiSection
virtual G4int GetPhiSection(G4int, G4int, G4int, G4int) const override final
beamspotnt.calc
calc
Definition: bin/beamspotnt.py:1252
LArG4::EC::HVHelper::lwc
const LArWheelCalculator * lwc(void) const
Definition: HVHelper.h:36
LArG4::EC::HVHelper::GetEtaSection
G4int GetEtaSection(const G4ThreeVector &p) const
LArG4::EC::HVHelper::AcquireMaps
void AcquireMaps(const G4String &version, G4bool from_DB)
LArG4::EC::HVHelper::s_NofElectrodeSide
static constexpr G4int s_NofElectrodeSide
Definition: HVHelper.h:28
LArG4::EC::HVHelper::s_NofEtaSection
static constexpr G4int s_NofEtaSection
Definition: HVHelper.h:27
LArWheelCalculator.h