10 #include <type_traits>
17 struct is_container : std::false_type { };
20 struct is_container<std::vector<T> > : std::true_type { };
25 const std::string delim = is_container<T>()?
"":
" ";
26 const std::string
LF = is_container<T>()?
"":
"\n";
27 for (
size_t i{};
i!=
v.size();++
i){
36 operator >> (std::istream & in, std::vector<std::vector<float>> &
v){
37 std::istream::sentry
s(in);
40 constexpr
size_t bufferSize=500;
42 in.getline(
buffer, bufferSize-1,
'\n');
44 std::istringstream is(
buffer);
46 v.emplace_back(std::istream_iterator<float>(is),std::istream_iterator<float>());
47 in.getline(
buffer, bufferSize-1,
'\n');
48 std::istringstream is2(
buffer);
49 v.emplace_back(std::istream_iterator<float>(is2),std::istream_iterator<float>());
50 in.getline(
buffer, bufferSize-1,
'\n');
51 std::istringstream is3(
buffer);
52 v.emplace_back(std::istream_iterator<float>(is3),std::istream_iterator<float>());
59 std::istream::sentry
s(in);
62 constexpr
size_t bufferSize=500;
63 char buffer[bufferSize]={};
64 in.getline(
buffer, bufferSize-1,
'\n');
65 if (
buffer[0] ==
'#') in.getline(
buffer, bufferSize-1,
'\n');
67 std::istringstream iss(
s);
68 v.assign(std::istream_iterator<T>(iss), std::istream_iterator<T>());
70 throw std::runtime_error(
"error on streaming input to PixelModuleData");
80 const std::string
LF{
"\n"};
83 out<<
"#defaultBarrelAnalogThreshold"<<
LF;
84 out<<
c.m_defaultBarrelAnalogThreshold;
85 out<<
"#defaultEndcapAnalogThreshold"<<
LF;
86 out<<
c.m_defaultEndcapAnalogThreshold;
87 out<<
"#defaultDBMAnalogThreshold"<<
LF;
88 out<<
c.m_defaultDBMAnalogThreshold;
90 out<<
"#defaultBarrelAnalogThresholdSigma"<<
LF;
91 out<<
c.m_defaultBarrelAnalogThresholdSigma;
92 out<<
"#defaultEndcapAnalogThresholdSigma"<<
LF;
93 out<<
c.m_defaultEndcapAnalogThresholdSigma;
94 out<<
"#defaultDBMAnalogThresholdSigma"<<
LF;
95 out<<
c.m_defaultDBMAnalogThresholdSigma;
97 out<<
"#defaultBarrelAnalogThresholdNoise"<<
LF;
98 out<<
c.m_defaultBarrelAnalogThresholdNoise;
99 out<<
"#defaultEndcapAnalogThresholdNoise"<<
LF;
100 out<<
c.m_defaultEndcapAnalogThresholdNoise;
101 out<<
"#defaultDBMAnalogThresholdNoise"<<
LF;
102 out<<
c.m_defaultDBMAnalogThresholdNoise;
104 out<<
"#defaultBarrelInTimeThreshold"<<
LF;
105 out<<
c.m_defaultBarrelInTimeThreshold;
106 out<<
"#defaultEndcapInTimeThreshold"<<
LF;
107 out<<
c.m_defaultEndcapInTimeThreshold;
108 out<<
"#defaultDBMInTimeThreshold"<<
LF;
109 out<<
c.m_defaultDBMInTimeThreshold;
111 out<<
"#barrelToTThreshold"<<
LF;
112 out<<
c.m_barrelToTThreshold;
113 out<<
"#endcapToTThreshold"<<
LF;
114 out<<
c.m_endcapToTThreshold;
115 out<<
"#DBMToTThreshold"<<
LF;
116 out<<
c.m_DBMToTThreshold;
118 out<<
"#barrelCrossTalk"<<
LF;
119 out<<
c.m_barrelCrossTalk;
120 out<<
"#endcapCrossTalk"<<
LF;
121 out<<
c.m_endcapCrossTalk;
122 out<<
"#DBMCrossTalk"<<
LF;
123 out<<
c.m_DBMCrossTalk;
125 out<<
"#barrelThermalNoise"<<
LF;
126 out<<
c.m_barrelThermalNoise;
127 out<<
"#endcapThermalNoise"<<
LF;
128 out<<
c.m_endcapThermalNoise;
129 out<<
"#DBMThermalNoise"<<
LF;
130 out<<
c.m_DBMThermalNoise;
132 out<<
"#barrelNoiseOccupancy"<<
LF;
133 out<<
c.m_barrelNoiseOccupancy;
134 out<<
"#endcapNoiseOccupancy"<<
LF;
135 out<<
c.m_endcapNoiseOccupancy;
136 out<<
"#DBMNoiseOccupancy"<<
LF;
137 out<<
c.m_DBMNoiseOccupancy;
139 out<<
"#barrelDisableProbability"<<
LF;
140 out<<
c.m_barrelDisableProbability;
141 out<<
"#endcapDisableProbability"<<
LF;
142 out<<
c.m_endcapDisableProbability;
143 out<<
"#DBMDisableProbability"<<
LF;
144 out<<
c.m_DBMDisableProbability;
146 out<<
"#barrelNoiseShape"<<
LF;
147 out<<
c.m_barrelNoiseShape;
148 out<<
"#endcapNoiseShape"<<
LF;
149 out<<
c.m_endcapNoiseShape;
150 out<<
"#DBMNoiseShape"<<
LF;
151 out<<
c.m_DBMNoiseShape;
153 out<<
"#FEI3BarrelLatency"<<
LF;
154 out<<
c.m_FEI3BarrelLatency;
155 out<<
"#FEI3EndcapLatency"<<
LF;
156 out<<
c.m_FEI3EndcapLatency;
158 out<<
"#FEI3BarrelTimingSimTune"<<
LF;
159 out<<
c.m_FEI3BarrelTimingSimTune;
160 out<<
"#FEI3EndcapTimingSimTune"<<
LF;
161 out<<
c.m_FEI3EndcapTimingSimTune;
170 out<<
"#doLinearExtrapolation"<<
LF;
171 out<<
c.m_doLinearExtrapolation<<
LF;
173 out<<
"#biasVoltage"<<
LF;
176 out<<
"#fluenceLayer"<<
LF;
177 out<<
c.m_fluenceLayer;
178 out<<
"#radSimFluenceMapList"<<
LF;
179 out<<
c.m_radSimFluenceMapList;
181 out<<
"#fluenceLayer3D"<<
LF;
182 out<<
c.m_fluenceLayer3D;
183 out<<
"#radSimFluenceMapList3D"<<
LF;
184 out<<
c.m_radSimFluenceMapList3D;
186 out<<
"#cablingMapToFile"<<
LF;
187 out<<
c.m_cablingMapToFile<<
LF;
188 out<<
"#cablingMapFileName"<<
LF;
189 out<<
c.m_cablingMapFileName;
197 [[maybe_unused]] std::vector<float> ignoreFloatVec;
198 [[maybe_unused]] std::vector<double> ignoreDoubleVec;
199 [[maybe_unused]] std::vector<double> ignoreIntVec;
200 [[maybe_unused]] std::vector<bool> ignoreBoolVec;
201 [[maybe_unused]]
float ignoreFloat{};
202 [[maybe_unused]]
bool ignoreBool{};
203 [[maybe_unused]]
double ignoreDouble{};
204 [[maybe_unused]]
int ignoreInt{};
205 [[maybe_unused]] std::string ignoreString{};
206 std::istream::sentry
s(in);
211 in.ignore(100,
'\n');
234 in>>
c.m_defaultBarrelAnalogThreshold;
236 in>>
c.m_defaultEndcapAnalogThreshold;
238 in>>
c.m_defaultDBMAnalogThreshold;
241 in>>
c.m_defaultBarrelAnalogThresholdSigma;
243 in>>
c.m_defaultEndcapAnalogThresholdSigma;
245 in>>
c.m_defaultDBMAnalogThresholdSigma;
248 in>>
c.m_defaultBarrelAnalogThresholdNoise;
250 in>>
c.m_defaultEndcapAnalogThresholdNoise;
252 in>>
c.m_defaultDBMAnalogThresholdNoise;
255 in>>
c.m_defaultBarrelInTimeThreshold;
257 in>>
c.m_defaultEndcapInTimeThreshold;
259 in>>
c.m_defaultDBMInTimeThreshold;
262 in>>
c.m_barrelToTThreshold;
264 in>>
c.m_endcapToTThreshold;
266 in>>
c.m_DBMToTThreshold;
269 in>>
c.m_barrelCrossTalk;
271 in>>
c.m_endcapCrossTalk;
273 in>>
c.m_DBMCrossTalk;
276 in>>
c.m_barrelThermalNoise;
278 in>>
c.m_endcapThermalNoise;
280 in>>
c.m_DBMThermalNoise;
283 in>>
c.m_barrelNoiseOccupancy;
285 in>>
c.m_endcapNoiseOccupancy;
287 in>>
c.m_DBMNoiseOccupancy;
290 in>>
c.m_barrelDisableProbability;
292 in>>
c.m_endcapDisableProbability;
294 in>>
c.m_DBMDisableProbability;
297 in>>
c.m_barrelNoiseShape;
299 in>>
c.m_endcapNoiseShape;
301 in>>
c.m_DBMNoiseShape;
304 in>>
c.m_FEI3BarrelLatency;
306 in>>
c.m_FEI3EndcapLatency;
319 in>>
c.m_FEI3BarrelTimingSimTune;
321 in>>
c.m_FEI3EndcapTimingSimTune;
344 in>>
c.m_doLinearExtrapolation;
366 in>>
c.m_fluenceLayer;
368 in>>
c.m_radSimFluenceMapList;
371 in>>
c.m_fluenceLayer3D;
373 in>>
c.m_radSimFluenceMapList3D;
376 in>>
c.m_cablingMapToFile;
378 in>>
c.m_cablingMapFileName;
407 std::istream *
i =
f.m_is;
409 std::vector<std::string> lBuffer;
410 std::string multiline =
"";
411 std::vector<std::string> mapsPath_list;
412 std::vector<std::string> mapsPath_list3D;
413 while (getline(*
i,sline)) {
414 if (!sline.empty()) {
415 if (sline.find(
"//")==std::string::npos) {
416 if (sline.find(
"{{")!=std::string::npos && sline.find(
"}")!=std::string::npos) {
419 else if (sline.find(
"{")!=std::string::npos && sline.find(
"}}")!=std::string::npos) {
421 lBuffer.push_back(multiline);
423 else if (sline.find(
"{")!=std::string::npos && sline.find(
"}")!=std::string::npos) {
425 lBuffer.push_back(sline);
427 else if (sline.find(
"{")!=std::string::npos) {
430 else if (sline.find(
"}")!=std::string::npos) {
432 lBuffer.push_back(multiline);
443 std::vector<bool> ignoreBoolVec;
444 ignoreBoolVec = getParameter<bool>(
"FEI3BarrelHitDuplication", lBuffer);
445 auto ignoreIntVec = getParameter<int>(
"FEI3BarrelSmallHitToT", lBuffer);
451 std::vector<double> ignoreDoubleVec{};
452 ignoreDoubleVec = getParameter<double>(
"BarrelLorentzAngleCorr", lBuffer);
457 ignoreBoolVec = getParameter<bool>(
"FEI3EndcapHitDuplication", lBuffer);
458 ignoreIntVec = getParameter<int>(
"FEI3EndcapSmallHitToT", lBuffer);
464 ignoreDoubleVec = getParameter<double>(
"EndcapLorentzAngleCorr", lBuffer);
467 getParameter<float>(
"PixelNoiseShape", lBuffer),
468 getParameter<float>(
"PixelNoiseShape", lBuffer)});
490 std::vector<std::string> barrelFluenceFile =
getParameterString(
"BarrelRadiationFile", lBuffer);
491 for (
const auto & fluence : barrelFluenceFile) {
497 getParameter<float>(
"PixelNoiseShape", lBuffer),
498 getParameter<float>(
"PixelNoiseShape", lBuffer)});
506 getParameter<float>(
"BLayerNoiseShape", lBuffer),
507 getParameter<float>(
"PixelNoiseShape", lBuffer),
508 getParameter<float>(
"PixelNoiseShape", lBuffer)});
511 getParameter<float>(
"IBLNoiseShape", lBuffer),
512 getParameter<float>(
"IBLNoiseShape", lBuffer)});
516 std::vector<std::string> barrel3DFluenceFile =
getParameterString(
"3DRadiationFile", lBuffer);
517 for (
const auto & fluence3D : barrel3DFluenceFile) {