19 #include "cetlib_except/exception.h" 23 #include "TPolyLine.h" 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();
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);
198 hitHeight.SetPoint(0, hitParams.hitCenter, baseline);
199 hitHeight.SetPoint(1, hitParams.hitCenter, hitParams.hitHeight + baseline);
201 hitHeight.Draw(
"same");
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)
Declaration of signal hit object.
A collection of drawable 2-D objects.
Singleton to hold the current art::Event for the event display.
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()
T get(std::string const &key) const
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
Declaration of basic channel signal object.
std::vector< art::InputTag > fHitLabels
module labels that produced hits
unsigned int ChannelID_t
Type representing the ID of a readout channel.
raw::ChannelID_t Channel() const
ID of the readout channel the hit was extracted from.
cet::coded_exception< error, detail::translate > exception
Event finding and building.