153 art::ServiceHandle<geo::Geometry> geom;
156 art::ServiceHandle<util::LArFFT> fFFT;
157 int transformSize = fFFT->FFTSize();
160 art::ServiceHandle<util::SignalShapingServiceSBND> sss;
161 double DeconNorm = sss->GetDeconNorm();
164 std::unique_ptr<std::vector<recob::Wire> > wirecol(
new std::vector<recob::Wire>);
167 std::unique_ptr<art::Assns<raw::RawDigit,recob::Wire> > WireDigitAssn
168 (
new art::Assns<raw::RawDigit,recob::Wire>);
171 art::Handle< std::vector<raw::RawDigit> > digitVecHandle;
175 if (!digitVecHandle->size())
return;
176 mf::LogInfo(
"CalWireSBND") <<
"CalWireSBND:: digitVecHandle size is " << digitVecHandle->size();
179 art::Ptr<raw::RawDigit> digitVec0(digitVecHandle, 0);
181 unsigned int dataSize = digitVec0->Samples();
184 if( (
unsigned int)transformSize < dataSize){
185 mf::LogWarning(
"CalWireSBND")<<
"FFT size (" << transformSize <<
") "
186 <<
"is smaller than the data size (" << dataSize <<
") "
187 <<
"\nResizing the FFT now...";
188 fFFT->ReinitializeFFT(dataSize,fFFT->FFTOptions(),fFFT->FFTFitBins());
189 transformSize = fFFT->FFTSize();
190 mf::LogWarning(
"CalWireSBND")<<
"FFT size is now (" << transformSize <<
") "
191 <<
"and should be larger than the data size (" << dataSize <<
")";
194 mf::LogInfo(
"CalWireSBND") <<
"Data size is " << dataSize <<
" and transform size is " << transformSize;
197 mf::LogError(
"CalWireSBND")<<
"Set BaseSampleBins modulo dataSize= "<<dataSize;
205 std::vector<float> holder;
206 std::vector<short> rawadc(transformSize);
207 std::vector<TComplex> freqHolder(transformSize+1);
209 auto const clockData = art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(
evt);
212 wirecol->reserve(digitVecHandle->size());
213 for(
size_t rdIter = 0; rdIter < digitVecHandle->size(); ++rdIter){
217 art::Ptr<raw::RawDigit> digitVec(digitVecHandle, rdIter);
218 channel = digitVec->Channel();
225 holder.resize(transformSize, 0.);
231 float pdstl = digitVec->GetPedestal();
234 holder[
bin]=(rawadc[
bin]-pdstl);
237 for(
bin = dataSize;
bin < holder.size();
bin++){
245 sss->Deconvolute(clockData, channel, holder);
246 for(
bin = 0;
bin < holder.size(); ++
bin) holder[
bin]=holder[
bin]/DeconNorm;
249 holder.resize(dataSize,1
e-5);
261 fROITool->FindROIs( holder, channel, candROIVec);
269 std::vector<float> roiHolder;
270 for(
size_t i_holder=roiStart; i_holder<=roiStop; i_holder++){
271 roiHolder.push_back(holder[i_holder]);
273 roiVec.
add_range(roiStart, std::move(roiHolder));
281 throw cet::exception(
"CalWireSBND")
282 <<
"Can't associate wire #" << (wirecol->size() - 1)
283 <<
" with raw digit #" << digitVec.key() <<
"\n";
288 if(wirecol->size() == 0)
289 mf::LogWarning(
"CalWireSBND") <<
"No wires made for this event.";
bool fDoAdvBaselineSub
use interpolation-based baseline subtraction
bool fDoBaselineSub
subtract baseline to restore DC component post-deconvolution
std::unique_ptr< sbnd_tool::IROIFinder > fROITool
const datarange_t & add_range(size_type offset, ITER first, ITER last)
Adds a sequence of elements as a range with specified offset.
Class managing the creation of a new recob::Wire object.
constexpr details::BinObj< T > bin(T value)
Returns a wrapper to print the specified data in binary format.
void SubtractBaseline(std::vector< float > &holder)
bool CreateAssn(art::Event &evt, std::vector< T > const &a, art::Ptr< U > const &b, art::Assns< U, T > &assn, std::string a_instance, size_t index=UINT_MAX)
Creates a single one-to-one association.
int fBaseSampleBins
bin grouping size in "interpolate" method
std::string fDigitModuleLabel
module that made digits
std::pair< size_t, size_t > CandidateROI
void SubtractBaselineAdv(std::vector< float > &holder)
void Uncompress(const std::vector< short > &adc, std::vector< short > &uncompressed, raw::Compress_t compress)
Uncompresses a raw data buffer.
std::vector< CandidateROI > CandidateROIVec