17 #include "art/Framework/Core/ModuleMacros.h"
18 #include "art/Framework/Principal/Event.h"
19 #include "art/Framework/Core/EDProducer.h"
20 #include "art/Framework/Services/Registry/ServiceHandle.h"
21 #include "canvas/Persistency/Common/FindOneP.h"
22 #include "messagefacility/MessageLogger/MessageLogger.h"
37 explicit TTHitFinder(fhicl::ParameterSet
const& pset);
58 fCalDataModuleLabel = pset.get< std::string >(
"CalDataModuleLabel");
59 fMinSigPeakInd = pset.get<
float >(
"MinSigPeakInd");
60 fMinSigPeakCol = pset.get<
float >(
"MinSigPeakCol");
61 fMinSigTailInd = pset.get<
float >(
"MinSigTailInd",-99);
62 fMinSigTailCol = pset.get<
float >(
"MinSigTailCol",-99);
63 fIndWidth = pset.get<
int >(
"IndWidth", 3);
64 fColWidth = pset.get<
int >(
"ColWidth", 3);
68 mf::LogWarning(
"TTHitFinder") <<
"IndWidth must be 1 at minimum. Resetting width to one time tick";
72 mf::LogWarning(
"TTHitFinder") <<
"ColWidth must be 1 at minimum. Resetting width to one time tick";
95 art::Handle< std::vector<recob::Wire> > wireVecHandle;
97 std::vector<recob::Wire>
const& wireVec(*wireVecHandle);
100 art::FindOneP<raw::RawDigit> WireToRawDigits
103 art::ServiceHandle<geo::Geometry const> geom;
106 float threshold_peak = 0;
107 float threshold_tail = -99;
111 for(
unsigned int wireIter = 0; wireIter < wireVec.size(); wireIter++) {
114 art::Ptr<recob::Wire> wire(wireVecHandle, wireIter);
115 art::Ptr<raw::RawDigit>
const& rawdigits = WireToRawDigits.at(wireIter);
117 std::vector<float> signal(wire->Signal());
118 std::vector<float>::iterator timeIter;
119 geo::WireID wire_id = (geom->ChannelToWire(wire->Channel())).at(0);
136 float half_width = ((float)width-1)/2.;
141 for(timeIter = signal.begin(); timeIter < signal.end(); timeIter++){
145 if(width%2==1) peak_val = *timeIter;
146 else if(width%2==0) peak_val = 0.5 * (*timeIter + *(timeIter+1));
149 if(peak_val < threshold_peak)
continue;
152 if( time_bin-half_width < 0 )
continue;
153 if( time_bin+half_width > signal.size() )
continue;
156 int begin_tail_tick = std::floor(time_bin-half_width);
157 float totalCharge =
getTotalCharge(&signal[begin_tail_tick],width,threshold_tail);
158 if(totalCharge==-999) {
159 MF_LOG_DEBUG(
"TTHitFinder") <<
"Rejecting would be hit at (plane,wire,time_bin,first_bin,last_bin)=("
160 << wire_id.
Plane <<
"," << wire_id.
Wire <<
"," << time_bin <<
"," << begin_tail_tick <<
"," << begin_tail_tick+width-1 <<
"): "
161 << signal.at(time_bin-1) <<
" "
162 << signal.at(time_bin) <<
" "
163 << signal.at(time_bin+1);
169 float hit_time = time_bin;
170 if(width%2==0) hit_time = time_bin+0.5;
174 end_tick = hit_time + width;
197 else if(wire_id.
Plane==1)
199 else if(wire_id.
Plane==2)
204 MF_LOG_DEBUG(
"TTHitFinder") <<
"Finished wire " << wire_id.
Wire <<
" (plane " << wire_id.
Plane <<
")"
205 <<
"\tTotal hits (U,V,Y)= ("
206 << hitCollection_U.
size() <<
","
207 << hitCollection_V.
size() <<
","
208 << hitCollection_Y.
size() <<
")";
213 mf::LogInfo(
"TTHitFinder") <<
"Total TTHitFinder hits (U,V,Y)=("
214 << hitCollection_U.
size() <<
","
215 << hitCollection_V.
size() <<
","
216 << hitCollection_Y.
size() <<
")";
227 float totalCharge = 0;
229 if(signal_vector[
tick] < threshold){
233 totalCharge += signal_vector[
tick];
int fColWidth
Induction wire hit width (in time ticks)
float fMinSigTailInd
Collection wire signal height threshold at peak.
float fMinSigPeakCol
Induction wire signal height threshold at peak.
Definition of basic raw digits.
WireID_t Wire
Index of the wire within its plane.
static void declare_products(art::ProducesCollector &collector, std::string instance_name="", bool doWireAssns=true, bool doRawDigitAssns=true)
Declares the hit products we are going to fill.
int TDCtick_t
Type representing a TDC tick.
Class managing the creation of a new recob::Hit object.
Helper functions to create a hit.
A class handling a collection of hits and its associations.
Signal from induction planes.
enum geo::_plane_sigtype SigType_t
tick_as<> tick
Tick number, represented by std::ptrdiff_t.
void emplace_back(recob::Hit &&hit, art::Ptr< recob::Wire > const &wire=art::Ptr< recob::Wire >(), art::Ptr< raw::RawDigit > const &digits=art::Ptr< raw::RawDigit >())
Adds the specified hit to the data collection.
PlaneID_t Plane
Index of the plane within its TPC.
float fMinSigTailCol
Induction wire signal height threshold outside peak.
Definition of data types for geometry description.
void put_into(art::Event &)
Moves the data into an event.
std::string fCalDataModuleLabel
size_t size() const
Returns the number of hits currently in the collection.
float fMinSigPeakInd
Input caldata module name.
Declaration of basic channel signal object.
void produce(art::Event &evt) override
int fIndWidth
Collection wire signal height threshold outside peak.
TTHitFinder(fhicl::ParameterSet const &pset)
recob::Hit && move()
Prepares the constructed hit to be moved away.
art framework interface to geometry description
float getTotalCharge(const float *, int, float)
Collection wire hit width (in time ticks)
Signal from collection planes.