ATLAS Offline Software
Loading...
Searching...
No Matches
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
19
20void LUCID_DigiSettings::Initialize(IMessageSvc* msgSvc) {
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;
46}
47
49
50 std::map <std::string, parDouble>::iterator doubleMapIt = m_doubleMap.begin();
51 std::map <std::string, parInt>::iterator intMapIt = m_intMap.begin();
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
63 std::map <std::string, parDouble>::iterator doubleMapIt = m_doubleMap.begin();
64 std::map <std::string, parInt>::iterator intMapIt = m_intMap.begin();
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
119void 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
131void 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
143double 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
155int LUCID_DigiSettings::GetDigiParInt(const std::string& parname) {
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
167void 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
200void 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}
#define endmsg
std::map< std::string, parInt > m_intMap
void SetDigiParDouble(const std::string &, double)
void Initialize(IMessageSvc *msgSvc)
std::map< std::string, parDouble > m_doubleMap
void DefNewParameterDouble(std::string, const std::string &, double *, double, double)
int GetDigiParInt(const std::string &)
double GetDigiParDouble(const std::string &)
void OverwriteDigiParProperties(Gaudi::Algorithm *)
void DefNewParameterInt(std::string, const std::string &, int *, int, int)
void SetDigiParInt(const std::string &, int)