Reconfigure function called by fhicl constructor.
27 tmp.SetStamp(tmp.Stamp()-1, tmp.SubStamp());
30 bool UseDB =
p.get<
bool>(
"UseDB",
false);
31 bool UseFile =
p.get<
bool>(
"UseFile",
false);
32 std::string
fileName =
p.get<std::string>(
"FileName",
"");
41 float default_gain =
p.get<
float>(
"DefaultGain");
42 float default_gain_err =
p.get<
float>(
"DefaultGainErr");
43 float default_st =
p.get<
float>(
"DefaultShapingTime");
44 float default_st_err =
p.get<
float>(
"DefaultShapingTimeErr");
46 ElectronicsCalib defaultCalib(0);
48 defaultCalib.SetGain(default_gain);
49 defaultCalib.SetGainErr(default_gain_err);
50 defaultCalib.SetShapingTime(default_st);
51 defaultCalib.SetShapingTimeErr(default_st_err);
52 defaultCalib.SetExtraInfo(CalibrationExtraInfo(
"ElectronicsCalib"));
54 art::ServiceHandle<geo::Geometry const> geo;
56 for (; itW != geo->end_wire_id(); ++itW) {
58 defaultCalib.SetChannel(ch);
59 fData.AddOrReplaceRow(defaultCalib);
64 cet::search_path sp(
"FW_SEARCH_PATH");
65 std::string abs_fp = sp.find_file(fileName);
66 std::cout <<
"Using electronics calibrations from local file: "<<abs_fp<<
"\n";
67 std::ifstream
file(abs_fp);
69 throw cet::exception(
"SIOVElectronicsCalibProvider")
70 <<
"File "<<abs_fp<<
" is not found.";
74 ElectronicsCalib dp(0);
75 while (std::getline(
file, line)) {
76 size_t current_comma = line.find(
',');
78 float gain = std::stof( line.substr(current_comma+1, line.find(
',',current_comma+1)-(current_comma+1)) );
80 current_comma = line.find(
',',current_comma+1);
81 float gain_err = std::stof( line.substr(current_comma+1, line.find(
',',current_comma+1)-(current_comma+1)) );
83 current_comma = line.find(
',',current_comma+1);
84 float shaping_time = std::stof( line.substr(current_comma+1, line.find(
',',current_comma+1)-(current_comma+1)) );
86 current_comma = line.find(
',',current_comma+1);
87 float shaping_time_err = std::stof( line.substr(current_comma+1) );
89 CalibrationExtraInfo
info(
"ElectronicsCalib");
93 dp.SetGainErr(gain_err);
94 dp.SetShapingTime(shaping_time);
95 dp.SetShapingTimeErr(shaping_time_err);
96 dp.SetExtraInfo(
info);
98 fData.AddOrReplaceRow(dp);
102 std::cout <<
"Using electronics calibrations from conditions database"<<std::endl;
virtual void Reconfigure(fhicl::ParameterSet const &p)
Configure using fhicl::ParameterSet.
Base forward iterator browsing all wire IDs in the detector.
std::uint32_t DBChannelID_t
DataSource::ds fDataSource
services TFileService fileName
static IOVTimeStamp MaxTimeStamp()
Snapshot< ElectronicsCalib > fData
BEGIN_PROLOG could also be cout