41 std::vector<CTPPSDiamondDetId>
detids_;
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()};
97 hists.leadingTime[chid] = iGetter.
get(
"t_" + ch_name);
98 if (
hists.leadingTime[chid] ==
nullptr) {
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 <<
").";
109 hists.leadingTimeVsToT[chid] = iGetter.
get(
"tvstot_" + ch_name);
110 if (
hists.leadingTimeVsToT[chid] ==
nullptr) {
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));
124 interp_.SetParameters(
hists.leadingTime[chid]->getRMS(),
125 hists.toT[chid]->getMean(),
127 hists.leadingTime[chid]->getMean() -
hists.leadingTime[chid]->getRMS());
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 <<
").";
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");