27 #include <boost/property_tree/json_parser.hpp>
28 #include <boost/property_tree/ptree.hpp>
30 namespace pt = boost::property_tree;
61 : filename_(iConfig.getParameter<edm::FileInPath>(
"calibrationFile").
fullPath()),
62 subdetector_((
DetectorType)iConfig.getParameter<unsigned int>(
"subDetector")) {
64 findingRecord<PPSTimingCalibrationRcd>();
92 pt::ptree mother_node;
101 key.
db = (int)strtol(par.first.data(),
nullptr, 10);
104 key.
sampic = board.second.get<
int>(
"sampic");
105 key.
channel = board.second.get<
int>(
"channel");
106 double timeOffset = board.second.get<
double>(
"time_offset");
107 double timePrecision = board.second.get<
double>(
"time_precision");
109 time_info[
key] = {timeOffset, timePrecision};
113 std::vector<double>
values;
117 values.emplace_back(std::stod(param.second.data(),
nullptr));
123 return std::make_unique<PPSTimingCalibration>(
formula,
params, time_info);
127 pt::ptree mother_node;
136 key.
db = par.second.get<
int>(
"sector");
139 key.
sampic = st.second.get<
int>(
"station");
142 key.
channel = pl.second.get<
int>(
"plane");
145 key.
cell = ch.second.get<
int>(
"channel");
146 double timeOffset = ch.second.get<
double>(
"time_offset");
147 double timePrecision = ch.second.get<
double>(
"time_precision");
148 time_info[
key] = {timeOffset, timePrecision};
150 std::vector<double>
values;
152 values.emplace_back(std::stod(param.second.data(),
nullptr));
158 return std::make_unique<PPSTimingCalibration>(
formula,
params, time_info);
164 ->setComment(
"file with SAMPIC calibrations, ADC and INL; if empty or corrupted, no calibration will be applied");
166 ->
setComment(
"type of sub-detector for which the calibrations are provided");
168 descriptions.
add(
"ppsTimingCalibrationESSource", desc);
std::map< Key, std::pair< double, double > > TimingMap
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
void setComment(std::string const &value)
PPSTimingCalibrationESSource(const edm::ParameterSet &)
static const IOVSyncValue & endOfTime()
void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &) override
std::pair< Time_t, Time_t > ValidityInterval
EventSetup record for TOTEM/PPS timing calibration information.
ESProducts< std::remove_reference_t< TArgs >...> products(TArgs &&...args)
std::unique_ptr< PPSTimingCalibration > parsePPSDiamondJsonFile() const
Extract calibration data from JSON file (PPS horizontal diamond)
Container::value_type value_type
static const IOVSyncValue & beginOfTime()
Helper structure for indexing calibration data.
tuple key
prepare the HTCondor submission files and eventually submit them
edm::ESProducts< std::unique_ptr< PPSTimingCalibration > > produce(const PPSTimingCalibrationRcd &)
DetectorType subdetector_
ParameterDescriptionBase * add(U const &iLabel, T const &value)
#define DEFINE_FWK_EVENTSETUP_SOURCE(type)
const std::string filename_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::map< Key, std::vector< double > > ParametersMap
std::unique_ptr< PPSTimingCalibration > parseTotemUFSDJsonFile() const
Extract calibration data from JSON file (TOTEM vertical)
static void fillDescriptions(edm::ConfigurationDescriptions &)