ATLAS Offline Software
LUCID_DigiSettings.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 #include "GaudiKernel/Algorithm.h"
7 #include "GaudiKernel/MsgStream.h"
8 #include <iostream>
9 #include <utility>
10 
11 
13  m_msgSvc(nullptr),
14  m_parValueNotSetByUserDouble(10.0e39),
15  m_parValueNotSetByUserInt (32767) {
16 
18 }
19 
21 
22  m_msgSvc = msgSvc;
23 
24  MsgStream log(m_msgSvc, "LUCID_DigiSettings::initialize");
25 
26  log << MSG::INFO << "Initializing" << endmsg;
27 
29 }
30 
32 
33  MsgStream log(m_msgSvc, "LUCID_DigiSettings::SetDefaultValues");
34 
35  DefNewParameterInt ("Number of LUCID tubes" , "numTubes" , &m_numTubes , 1, 100);
36  DefNewParameterInt ("QDC channels per photo-electron", "qdcChannelsPerPE" , &m_qdcChannelsPerPE , 1 , 100);
37  DefNewParameterDouble("QDC FED NoiseFactor" , "qdcFedNoiseFactor", &m_qdcFedNoiseFactor, 1., 50.);
38  DefNewParameterDouble("TDC PMT NoiseFactor" , "tdcPmtNoiseFactor", &m_tdcPmtNoiseFactor, 1., 50.);
39  DefNewParameterDouble("TDC FED NoiseFactor" , "tdcFedNoiseFactor", &m_tdcFedNoiseFactor, 1., 50.);
40 
41  m_numTubes = 40;
42  m_qdcChannelsPerPE = 10;
43  m_qdcFedNoiseFactor = 3.0;
44  m_tdcPmtNoiseFactor = 2.8;
45  m_tdcFedNoiseFactor = 0.8;
46 }
47 
49 
52 
53  for (; doubleMapIt != m_doubleMap.end(); ++doubleMapIt) alg->declareProperty(std::string("Overwrite_") + doubleMapIt->first, doubleMapIt->second.overwriteVal);
54  for (; intMapIt != m_intMap.end() ; ++intMapIt ) alg->declareProperty(std::string("Overwrite_") + intMapIt->first , intMapIt->second.overwriteVal);
55 }
56 
58 
59  MsgStream log(m_msgSvc, "LUCID_DigiSettings");
60 
61  log << MSG::INFO << " OverwriteDigiParValues " << endmsg;
62 
65 
66  if (doubleMapIt->second.overwriteVal != m_parValueNotSetByUserDouble) {
67 
68  for (; doubleMapIt != m_doubleMap.end(); ++doubleMapIt) {
69 
70  if (doubleMapIt->second.overwriteVal > doubleMapIt->second.low &&
71  doubleMapIt->second.overwriteVal < doubleMapIt->second.high) {
72 
73  *(doubleMapIt->second.par) = doubleMapIt->second.overwriteVal;
74 
75  log << MSG::INFO << " Overwriting: "
76  << doubleMapIt->second.parDescription << " to : "
77  << doubleMapIt->second.overwriteVal << endmsg;
78  }
79  }
80  }
81 
82  if (intMapIt->second.overwriteVal != m_parValueNotSetByUserInt) {
83 
84  for (; intMapIt != m_intMap.end(); ++intMapIt) {
85 
86  if (intMapIt->second.overwriteVal > intMapIt->second.low &&
87  intMapIt->second.overwriteVal < intMapIt->second.high) {
88 
89  *(intMapIt->second.par) = intMapIt->second.overwriteVal;
90 
91  log << MSG::INFO << " Overwriting: "
92  << intMapIt->second.parDescription << " to : "
93  << intMapIt->second.overwriteVal << endmsg;
94  }
95  }
96  }
97 }
98 
100 
101  MsgStream log(m_msgSvc, "LUCID_DigiSettings::Print");
102 
103  std::map <std::string, parDouble>::const_iterator doubleMapIt = m_doubleMap.begin();
104  std::map <std::string, parInt>::const_iterator intMapIt = m_intMap.begin();
105 
106  log << MSG::INFO << "===================== Doubles ======================" << endmsg;
107 
108  for (; doubleMapIt != m_doubleMap.end(); ++doubleMapIt)
109  log << MSG::INFO << doubleMapIt->second.parDescription << ": " << *(doubleMapIt->second.par) <<endmsg;
110 
111  log << MSG::INFO << "===================== Integers ======================" << endmsg;
112 
113  for (; intMapIt != m_intMap.end(); ++intMapIt)
114  log << MSG::INFO << intMapIt->second.parDescription << ": " << *(intMapIt->second.par) << endmsg;
115 
116  log << MSG::INFO << "=====================================================" << endmsg;
117 }
118 
119 void LUCID_DigiSettings::SetDigiParDouble(const std::string& parname, double parval) {
120 
121  if (!m_doubleMap.count(parname))
122  if (!m_intMap.count(parname)) {
123  MsgStream log(m_msgSvc, "LUCID_DigiSettings::SetDigiParDouble");
124  log << MSG::FATAL << " LUCID_DigiSettings: parameter does not exist: " << parname << endmsg;
125  std::abort();
126  }
127 
128  m_doubleMap[parname].par = &parval;
129 }
130 
131 void LUCID_DigiSettings::SetDigiParInt(const std::string& parname, int parval) {
132 
133  if (!m_doubleMap.count(parname))
134  if (!m_intMap.count(parname)) {
135  MsgStream log(m_msgSvc, "LUCID_DigiSettings::SetDigiParInt");
136  log << MSG::FATAL << " LUCID_DigiSettings: parameter does not exist: " << parname << endmsg;
137  std::abort();
138  }
139 
140  m_intMap[parname].par = &parval;
141 }
142 
143 double LUCID_DigiSettings::GetDigiParDouble(const std::string& parname) {
144 
145  if (!m_doubleMap.count(parname))
146  if (!m_intMap.count(parname)) {
147  MsgStream log(m_msgSvc, "LUCID_DigiSettings::GetDigiParDouble");
148  log << MSG::FATAL << " LUCID_DigiSettings: parameter does not exist: " << parname << endmsg;
149  std::abort();
150  }
151 
152  return *m_doubleMap[parname].par;
153 }
154 
156 
157  if (!m_doubleMap.count(parname))
158  if (!m_intMap.count(parname)) {
159  MsgStream log(m_msgSvc, "LUCID_DigiSettings::GetDigiParInt");
160  log << MSG::FATAL << " LUCID_DigiSettings: parameter does not exist: " << parname << endmsg;
161  std::abort();
162  }
163 
164  return *m_intMap[parname].par;
165 }
166 
167 void LUCID_DigiSettings::DefNewParameterDouble(std::string parDescription,
168  const std::string& parname,
169  double* par,
170  double low,
171  double high) {
172 
173  if (low > high) {
174  MsgStream log(m_msgSvc, "LUCID_DigiSettings::DefNewParameterDouble");
175  log << MSG::FATAL << " Swap the boundaries on the range " << parname << endmsg;
176  std::abort();
177  }
178  if (m_doubleMap.count(parname)) {
179  MsgStream log(m_msgSvc, "LUCID_DigiSettings::DefNewParameterDouble");
180  log << MSG::FATAL << " More than one parameter with that name " << parname << endmsg;
181  std::abort();
182  }
183  if (m_intMap.count (parname)) {
184  MsgStream log(m_msgSvc, "LUCID_DigiSettings::DefNewParameterDouble");
185  log << MSG::FATAL << " More than one parameter with that name " << parname << endmsg;
186  std::abort();
187  }
188 
189  parDouble parD;
190 
191  parD.parDescription = std::move(parDescription);
192  parD.par = par;
193  parD.low = low;
194  parD.high = high;
196 
197  m_doubleMap[parname] = std::move(parD);
198 }
199 
200 void LUCID_DigiSettings::DefNewParameterInt(std::string parDescription,
201  const std::string& parname,
202  int* par,
203  int low,
204  int high) {
205 
206  if (low > high) {
207  MsgStream log(m_msgSvc, "LUCID_DigiSettings::DefNewParameterInt");
208  log << MSG::FATAL << " Swap the boundaries on the range " << parname << endmsg;
209  std::abort();
210  }
211  if (m_doubleMap.count(parname)) {
212  MsgStream log(m_msgSvc, "LUCID_DigiSettings::DefNewParameterInt");
213  log << MSG::FATAL << " More than one parameter with that name " << parname << endmsg;
214  std::abort();
215  }
216  if (m_intMap.count (parname)) {
217  MsgStream log(m_msgSvc, "LUCID_DigiSettings::DefNewParameterInt");
218  log << MSG::FATAL << " More than one parameter with that name " << parname << endmsg;
219  std::abort();
220  }
221 
222  parInt parI;
223 
224  parI.parDescription = std::move(parDescription);
225  parI.par = par;
226  parI.low = low;
227  parI.high = high;
229 
230  m_intMap[parname] = std::move(parI);
231 }
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
LUCID_DigiSettings::OverwriteDigiParValues
void OverwriteDigiParValues()
Definition: LUCID_DigiSettings.cxx:57
LUCID_DigiSettings::DefNewParameterInt
void DefNewParameterInt(std::string, const std::string &, int *, int, int)
Definition: LUCID_DigiSettings.cxx:200
LUCID_DigiSettings::Initialize
void Initialize(IMessageSvc *msgSvc)
Definition: LUCID_DigiSettings.cxx:20
LUCID_DigiSettings::GetDigiParInt
int GetDigiParInt(const std::string &)
Definition: LUCID_DigiSettings.cxx:155
python.Constants.FATAL
int FATAL
Definition: Control/AthenaCommon/python/Constants.py:18
LUCID_DigiSettings::m_tdcPmtNoiseFactor
double m_tdcPmtNoiseFactor
Definition: LUCID_DigiSettings.h:44
LUCID_DigiSettings::parInt::low
int low
Definition: LUCID_DigiSettings.h:66
python.CreateTierZeroArgdict.parname
parname
Definition: CreateTierZeroArgdict.py:194
LUCID_DigiSettings::SetDefaultValues
void SetDefaultValues()
Definition: LUCID_DigiSettings.cxx:31
LUCID_DigiSettings::DefNewParameterDouble
void DefNewParameterDouble(std::string, const std::string &, double *, double, double)
Definition: LUCID_DigiSettings.cxx:167
LUCID_DigiSettings::parDouble::par
double * par
Definition: LUCID_DigiSettings.h:56
LUCID_DigiSettings::parDouble::high
double high
Definition: LUCID_DigiSettings.h:58
LUCID_DigiSettings::m_msgSvc
IMessageSvc * m_msgSvc
Definition: LUCID_DigiSettings.h:39
LUCID_DigiSettings::m_parValueNotSetByUserDouble
double m_parValueNotSetByUserDouble
Definition: LUCID_DigiSettings.h:47
LUCID_DigiSettings::LUCID_DigiSettings
LUCID_DigiSettings()
Definition: LUCID_DigiSettings.cxx:12
LUCID_DigiSettings::parDouble::overwriteVal
double overwriteVal
Definition: LUCID_DigiSettings.h:59
LUCID_DigiSettings::SetDigiParInt
void SetDigiParInt(const std::string &, int)
Definition: LUCID_DigiSettings.cxx:131
LUCID_DigiSettings::m_parValueNotSetByUserInt
int m_parValueNotSetByUserInt
Definition: LUCID_DigiSettings.h:48
LUCID_DigiSettings::parInt::parDescription
std::string parDescription
Definition: LUCID_DigiSettings.h:64
LUCID_DigiSettings::parDouble
Definition: LUCID_DigiSettings.h:53
LUCID_DigiSettings::m_qdcFedNoiseFactor
double m_qdcFedNoiseFactor
Definition: LUCID_DigiSettings.h:43
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition: StdJOSetup.py:36
LUCID_DigiSettings::m_numTubes
int m_numTubes
Definition: LUCID_DigiSettings.h:41
LUCID_DigiSettings.h
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
LUCID_DigiSettings::parInt::overwriteVal
int overwriteVal
Definition: LUCID_DigiSettings.h:68
LUCID_DigiSettings::Print
void Print() const
Definition: LUCID_DigiSettings.cxx:99
LUCID_DigiSettings::m_doubleMap
std::map< std::string, parDouble > m_doubleMap
Definition: LUCID_DigiSettings.h:71
LUCID_DigiSettings::SetDigiParDouble
void SetDigiParDouble(const std::string &, double)
Definition: LUCID_DigiSettings.cxx:119
LUCID_DigiSettings::parInt
Definition: LUCID_DigiSettings.h:62
createCoolChannelIdFile.par
par
Definition: createCoolChannelIdFile.py:28
RegSelToolConfig.alg
alg
Definition: RegSelToolConfig.py:332
LUCID_DigiSettings::parInt::par
int * par
Definition: LUCID_DigiSettings.h:65
LUCID_DigiSettings::parDouble::parDescription
std::string parDescription
Definition: LUCID_DigiSettings.h:55
LUCID_DigiSettings::m_tdcFedNoiseFactor
double m_tdcFedNoiseFactor
Definition: LUCID_DigiSettings.h:45
python.Constants.INFO
int INFO
Definition: Control/AthenaCommon/python/Constants.py:15
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
LUCID_DigiSettings::m_qdcChannelsPerPE
int m_qdcChannelsPerPE
Definition: LUCID_DigiSettings.h:42
LUCID_DigiSettings::parDouble::low
double low
Definition: LUCID_DigiSettings.h:57
LUCID_DigiSettings::parInt::high
int high
Definition: LUCID_DigiSettings.h:67
LUCID_DigiSettings::GetDigiParDouble
double GetDigiParDouble(const std::string &)
Definition: LUCID_DigiSettings.cxx:143
LUCID_DigiSettings::OverwriteDigiParProperties
void OverwriteDigiParProperties(Gaudi::Algorithm *)
Definition: LUCID_DigiSettings.cxx:48
LUCID_DigiSettings::m_intMap
std::map< std::string, parInt > m_intMap
Definition: LUCID_DigiSettings.h:72