Given a set of recob hits, run DBscan to form 3D clusters.
264 cet::cpu_timer theClockTotal;
266 theClockTotal.start();
269 icarus::PhysCrateFragment physCrateFragment(fragment);
271 size_t nBoardsPerFragment = physCrateFragment.nBoards();
272 size_t nChannelsPerBoard = physCrateFragment.nChannelsPerBoard();
273 size_t nSamplesPerChannel = physCrateFragment.nSamplesPerChannel();
277 artdaq::detail::RawFragmentHeader::fragment_id_t fragmentID = fragment.fragmentID();
286 theClockTotal.stop();
315 for(
const auto& boardID : readoutIDVec)
322 std::cout <<
"*** COULD NOT FIND BOARD ***" << std::endl;
323 std::cout <<
" - boardID: " << std::hex << boardID <<
", board map size: " << readoutIDVec.size() <<
", nBoardsPerFragment: " << nBoardsPerFragment << std::endl;
331 boardIDVec[boardSlot] = boardID;
336 std::cout <<
" - # boards: " << boardIDVec.size() <<
", boards: ";
337 for(
const auto&
id : boardIDVec)
std::cout <<
id <<
" ";
342 const size_t maxChannelsPerFragment(576);
344 if (
fSelectVals.empty())
fSelectVals = icarus_signal_processing::ArrayBool(maxChannelsPerFragment, icarus_signal_processing::VectorBool(nSamplesPerChannel));
345 if (
fROIVals.empty())
fROIVals = icarus_signal_processing::ArrayBool(maxChannelsPerFragment, icarus_signal_processing::VectorBool(nSamplesPerChannel));
346 if (
fRawWaveforms.empty())
fRawWaveforms = icarus_signal_processing::ArrayFloat(maxChannelsPerFragment, icarus_signal_processing::VectorFloat(nSamplesPerChannel));
347 if (
fPedCorWaveforms.empty())
fPedCorWaveforms = icarus_signal_processing::ArrayFloat(maxChannelsPerFragment, icarus_signal_processing::VectorFloat(nSamplesPerChannel));
348 if (
fIntrinsicRMS.empty())
fIntrinsicRMS = icarus_signal_processing::ArrayFloat(maxChannelsPerFragment, icarus_signal_processing::VectorFloat(nSamplesPerChannel));
349 if (
fCorrectedMedians.empty())
fCorrectedMedians = icarus_signal_processing::ArrayFloat(maxChannelsPerFragment, icarus_signal_processing::VectorFloat(nSamplesPerChannel));
350 if (
fWaveLessCoherent.empty())
fWaveLessCoherent = icarus_signal_processing::ArrayFloat(maxChannelsPerFragment, icarus_signal_processing::VectorFloat(nSamplesPerChannel));
351 if (
fMorphedWaveforms.empty())
fMorphedWaveforms = icarus_signal_processing::ArrayFloat(maxChannelsPerFragment, icarus_signal_processing::VectorFloat(nSamplesPerChannel));
358 if (
fRangeBins.empty())
fRangeBins = icarus_signal_processing::VectorInt(maxChannelsPerFragment);
365 icarus_signal_processing::Denoiser1D denoiser;
366 icarus_signal_processing::WaveformTools<float> waveformTools;
368 cet::cpu_timer theClockPedestal;
370 theClockPedestal.start();
374 for(
size_t board = 0; board < boardIDVec.size(); board++)
377 if (board >= nBoardsPerFragment)
379 mf::LogInfo(
"TPCDecoderFilter1D") <<
" Asking for board beyond number in fragment, want board " << board <<
", maximum is " << nBoardsPerFragment << std::endl;
385 uint32_t boardSlot = physCrateFragment.DataTileHeader(board)->StatusReg_SlotID();
389 std::cout <<
"********************************************************************************" << std::endl;
390 std::cout <<
"FragmentID: " << std::hex << fragmentID <<
", Crate: " << crateName << std::dec <<
", boardID: " << boardIDVec[boardSlot] <<
", slot: " << boardSlot <<
"/" << nBoardsPerFragment <<
", size " << channelPlanePairVec.size() <<
"/" << nChannelsPerBoard <<
", ";
395 size_t boardOffset = nChannelsPerBoard * board;
398 const icarus::A2795DataBlock::data_t* dataBlock = physCrateFragment.BoardData(board);
401 for(
size_t chanIdx = 0; chanIdx < nChannelsPerBoard; chanIdx++)
404 size_t channelOnBoard = boardOffset + chanIdx;
406 icarus_signal_processing::VectorFloat& rawDataVec =
fRawWaveforms[channelOnBoard];
409 rawDataVec[
tick] = -dataBlock[chanIdx +
tick * nChannelsPerBoard];
411 icarus_signal_processing::VectorFloat& pedCorDataVec =
fPedCorWaveforms[channelOnBoard];
414 fChannelIDVec[channelOnBoard] = channelPlanePairVec[chanIdx].first;
417 unsigned int plane = channelPlanePairVec[chanIdx].second;
424 std::cout <<
"*** COMPLETELY SCREWUP YOU IMBECILE! plane is " << plane <<
" for chanIdx " << chanIdx << std::endl;
446 std::cout <<
"***** FOUND NO MATCH FOR TYPE: " <<
fFilterModeVec[plane] <<
", plane " << plane <<
" DURING INITIALIZATION OF FILTER FUNCTIONS IN TPCDecoderFilter1D" << std::endl;
451 waveformTools.getPedestalCorrectedWaveform(rawDataVec,
467 if (widVec.empty())
std::cout << channelPlanePairVec[chanIdx].first <<
"/" << chanIdx <<
"=" <<
fFullRMSVals[channelOnBoard] <<
" * ";
468 else std::cout <<
fChannelIDVec[channelOnBoard] <<
"-" << widVec[0].Cryostat <<
"/" << widVec[0].TPC <<
"/" << widVec[0].Plane <<
"/" << widVec[0].Wire <<
"=" <<
fFullRMSVals[channelOnBoard] <<
" * ";
504 if (nBoardsPerFragment < 9)
509 theClockPedestal.stop();
511 double pedestalTime = theClockPedestal.accumulated_real_time();
513 cet::cpu_timer theClockDenoise;
515 theClockDenoise.start();
536 theClockDenoise.stop();
538 double denoiseTime = theClockDenoise.accumulated_real_time();
540 theClockDenoise.start();
561 theClockDenoise.stop();
563 double cohPedSubTime = theClockDenoise.accumulated_real_time() - denoiseTime;
566 theClockTotal.stop();
568 double totalTime = theClockTotal.accumulated_real_time();
570 mf::LogDebug(
"TPCDecoderFilter1D") <<
" *totalTime: " << totalTime <<
", pedestal: " << pedestalTime <<
", noise: " << denoiseTime <<
", ped cor: " << cohPedSubTime << std::endl;
icarus_signal_processing::ArrayBool fSelectVals
std::vector< ChannelPlanePair > ChannelPlanePairVec
icarus_signal_processing::VectorFloat fPedestalVals
std::vector< std::string > fFilterModeVec
std::vector< float > fThreshold
std::vector< unsigned int > ReadoutIDVec
virtual const ReadoutIDVec & getReadoutBoardVec(const unsigned int) const =0
icarus_signal_processing::ArrayBool fROIVals
size_t fCoherentNoiseGrouping
icarus_signal_processing::FilterFunctionVec fFilterFunctionVec
std::vector< geo::WireID > ChannelToWire(raw::ChannelID_t const channel) const
Returns a list of wires connected to the specified TPC channel.
size_t fCoherentNoiseOffset
icarus_signal_processing::ArrayFloat fPedCorWaveforms
icarus_signal_processing::VectorFloat fTruncRMSVals
icarus_signal_processing::VectorInt fNumTruncBins
virtual const std::string & getCrateName(const unsigned int) const =0
virtual bool hasBoardID(const unsigned int) const =0
icarus_signal_processing::ArrayFloat fIntrinsicRMS
virtual const ChannelPlanePairVec & getChannelPlanePair(const unsigned int) const =0
icarus_signal_processing::ArrayFloat fWaveLessCoherent
tick_as<> tick
Tick number, represented by std::ptrdiff_t.
virtual bool hasFragmentID(const unsigned int) const =0
void fill(const art::PtrVector< recob::Hit > &hits, int only_plane)
const geo::Geometry * fGeometry
icarus_signal_processing::FFTFilterFunctionVec fFFTFilterFunctionVec
icarus_signal_processing::ArrayFloat fMorphedWaveforms
FragmentIDMap fFragmentIDMap
virtual unsigned int getBoardSlot(const unsigned int) const =0
icarus_signal_processing::ArrayFloat fRawWaveforms
icarus_signal_processing::VectorInt fChannelIDVec
icarus_signal_processing::ArrayFloat fCorrectedMedians
icarus_signal_processing::VectorInt fRangeBins
icarus_signal_processing::VectorFloat fFullRMSVals
size_t fStructuringElement
BEGIN_PROLOG could also be cout
const icarusDB::IICARUSChannelMap * fChannelMap
icarus_signal_processing::VectorFloat fThresholdVec
float fSigmaForTruncation