91 for (
size_t imod = 0; imod < recoOpt->
fHitLabels.size(); ++imod) {
96 event->getByLabel(which, hitVecHandle);
102 for (
size_t hitIdx = 0; hitIdx < hitVecHandle->size(); hitIdx++) {
110 <<
" failed with message:\n" 114 if (hitPtrVec.
empty())
continue;
117 std::sort(hitPtrVec.
begin(), hitPtrVec.
end(), [](
const auto&
left,
const auto&
right) {
118 return left->PeakTime() <
right->PeakTime();
123 std::vector<float> wireDataVec;
126 if (wireAssnsVec.isValid() && wireAssnsVec.size() > 0) {
127 auto hwafp = wireAssnsVec.at(0).front();
128 if (!hwafp.isNull() && hwafp.isAvailable()) { wireDataVec = hwafp->Signal(); }
140 for (
const auto&
hit : hitPtrVec) {
142 if (
hit->PeakTime() - 3. *
hit->RMS() > lastEndTick) {
143 if (!roiHitParamsVec.empty()) hitParamsVec.push_back(roiHitParamsVec);
144 roiHitParamsVec.clear();
147 HitParams_t hitParams;
149 hitParams.hitCenter =
hit->PeakTime();
150 hitParams.hitSigma =
hit->RMS();
151 hitParams.hitHeight =
hit->PeakAmplitude();
152 hitParams.hitStart =
hit->StartTick();
153 hitParams.hitEnd =
hit->EndTick();
155 lastEndTick = hitParams.hitEnd;
157 roiHitParamsVec.emplace_back(hitParams);
162 if (!roiHitParamsVec.empty()) hitParamsVec.push_back(roiHitParamsVec);
166 for (
const auto& roiHitParamsVec : hitParamsVec) {
168 double roiStart = roiHitParamsVec.front().hitStart;
169 double roiStop = roiHitParamsVec.back().hitEnd;
171 std::string funcString =
"gaus(0)";
172 std::string funcName = Form(
"hitshape_%05zu_c%02zu",
size_t(channel), roiCount++);
174 for (
size_t idx = 1; idx < roiHitParamsVec.size(); idx++)
180 if (
fFloatBaseline && !wireDataVec.empty()) baseline = wireDataVec.at(roiStart);
185 std::make_unique<TF1>(funcName.c_str(), funcString.c_str(), roiStart, roiStop));
191 for (
const auto& hitParams : roiHitParamsVec) {
192 hitFunc.SetParameter(idx + 0, hitParams.hitHeight);
193 hitFunc.SetParameter(idx + 1, hitParams.hitCenter);
194 hitFunc.SetParameter(idx + 2, hitParams.hitSigma);
196 TPolyLine& hitHeight = view2D.
AddPolyLine(2, kBlack, 1, 1);
198 hitHeight.SetPoint(0, hitParams.hitCenter, baseline);
199 hitHeight.SetPoint(1, hitParams.hitCenter, hitParams.hitHeight + baseline);
201 hitHeight.Draw(
"same");
203 TPolyLine& hitSigma = view2D.
AddPolyLine(2, kGray, 1, 1);
206 0, hitParams.hitCenter - hitParams.hitSigma, 0.6 * hitParams.hitHeight + baseline);
208 1, hitParams.hitCenter + hitParams.hitSigma, 0.6 * hitParams.hitHeight + baseline);
210 hitSigma.Draw(
"same");
215 hitFunc.Draw(
"same");
const art::Event * GetEvent() const
constexpr auto const & right(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
TPolyLine & AddPolyLine(int n, int c, int w, int s)
int TDCtick_t
Type representing a TDC tick.
void push_back(Ptr< U > const &p)
decltype(auto) constexpr to_string(T &&obj)
ADL-aware version of std::to_string.
static EventHolder * Instance()
Detector simulation of raw signals on wires.
constexpr auto const & left(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
std::vector< art::InputTag > fHitLabels
module labels that produced hits
cet::coded_exception< error, detail::translate > exception
Event finding and building.