52 dqmDir_(iConfig.getParameter<std::
string>(
"dqmDir")),
53 formula_(iConfig.getParameter<std::
string>(
"formula")),
54 min_entries_(iConfig.getParameter<unsigned int>(
"minEntries")),
55 interp_(
"interp", formula_.c_str(), 10.5, 25.) {
59 throw cms::Exception(
"PPSTimingCalibrationPCLHarvester") <<
"PoolDBService required";
62 interp_.SetParLimits(1, 9., 15.);
63 interp_.SetParLimits(2, 0.2, 2.5);
70 for (
auto it =
geom.beginSensor(); it !=
geom.endSensor(); ++it) {
92 for (
const auto& detid :
detids_) {
93 detid.channelName(ch_name);
94 const auto chid = detid.rawId();
96 (int)detid.arm(), (int)detid.station(), (int)detid.plane(), (int)detid.channel()};
99 edm::LogInfo(
"PPSTimingCalibrationPCLHarvester:dqmEndJob")
100 <<
"Failed to retrieve leading time monitor for channel (" << detid <<
").";
103 hists.
toT[chid] = iGetter.
get(
"tot_" + ch_name);
104 if (hists.
toT[chid] ==
nullptr) {
105 edm::LogInfo(
"PPSTimingCalibrationPCLHarvester:dqmEndJob")
106 <<
"Failed to retrieve time over threshold monitor for channel (" << detid <<
").";
111 edm::LogInfo(
"PPSTimingCalibrationPCLHarvester:dqmEndJob")
112 <<
"Failed to retrieve leading time vs. time over threshold monitor for channel (" << detid <<
").";
117 <<
"Not enough entries for channel (" << detid <<
"): " << hists.
leadingTimeVsToT[chid]->getEntries() <<
" < "
121 const double upper_tot_range = hists.
toT[chid]->getMean() + 2.5;
123 std::unique_ptr<TProfile> prof(hists.
leadingTimeVsToT[chid]->getTH2D()->ProfileX(
"_prof_x", 1, -1));
125 hists.
toT[chid]->getMean(),
128 const auto& res = prof->Fit(&
interp_,
"B+",
"", 10.4, upper_tot_range);
130 calib_params[
key] = {
132 calib_time[
key] = std::make_pair(0.1, 0.);
136 <<
"Fit did not converge for channel (" << detid <<
").";
152 desc.
add<
std::string>(
"dqmDir",
"AlCaReco/PPSTimingCalibrationPCL")
153 ->setComment(
"input path for the various DQM plots");
155 ->setComment(
"interpolation formula for the time walk component");
156 desc.
add<
unsigned int>(
"minEntries", 100)->setComment(
"minimal number of hits to extract calibration");
std::map< Key, std::pair< double, double > > TimingMap
PPSTimingCalibrationPCLHarvester(const edm::ParameterSet &)
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
virtual void setCurrentFolder(std::string const &fullpath)
edm::ESGetToken< CTPPSGeometry, VeryForwardRealGeometryRecord > geomEsToken_
#define DEFINE_FWK_MODULE(type)
const std::string dqmDir_
static void fillDescriptions(edm::ConfigurationDescriptions &)
MonitorMap leadingTimeVsToT
bool getData(T &iHolder) const
const unsigned int min_entries_
Helper structure for indexing calibration data.
virtual MonitorElement * get(std::string const &fullpath) const
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
tuple key
prepare the HTCondor submission files and eventually submit them
Hash writeOneIOV(const T &payload, Time_t time, const std::string &recordName)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
static bool check(unsigned int raw)
returns true if the raw ID is a PPS-timing one
Log< level::Info, false > LogInfo
void beginRun(const edm::Run &, const edm::EventSetup &) override
cond::Time_t currentTime() const
std::map< Key, std::vector< double > > ParametersMap
Detector ID class for CTPPS Timing Diamond detectors. Bits [19:31] : Assigend in CTPPSDetId Calss Bit...
Log< level::Warning, false > LogWarning
const std::string formula_
std::vector< CTPPSDiamondDetId > detids_