105 std::unique_ptr<std::vector<Hit> > hitCol (
new std::vector<Hit> );
108 std::unique_ptr< art::Assns<rec::Hit, raw::RawDigit> >
109 hitDigAssns(new::art::Assns<rec::Hit, raw::RawDigit>);
116 for (
size_t ird = 0; ird < rdCol->size(); ++ ird)
118 auto const& rd = (*rdCol)[ird];
131 MF_LOG_WARNING(
"CompressedHitFinder") <<
" Ununderstood compression mode: " << rd.Compression() <<
" Not making hits.";
146 int nBlocks = adc[1];
147 int zerosuppressedindex = nBlocks*2 + 2;
148 float pos[3] = {0,0,0};
150 float chanposx = pos[0];
152 int t0adcblockhist = 0;
154 for (
int iBlock=0; iBlock<nBlocks; ++iBlock)
160 unsigned int begT = adc[2+iBlock];
161 int blocksize = adc[2+nBlocks+iBlock];
164 throw cet::exception(
"CompressedHitFinder") <<
"Negative or zero block size in compressed data.";
166 unsigned int endT = begT + blocksize;
175 for(
int jInBlock = 0; jInBlock < blocksize; ++jInBlock)
177 ULong64_t
t = adc[2+iBlock]+jInBlock;
178 int a = adc[zerosuppressedindex];
179 zerosuppressedindex++;
182 if (t0adcblockhist == 0)
186 int deltat = t - t0adcblockhist;
187 if (deltat < fAvgPulseLongHist->GetNbinsX())
211 int zsi2 = zerosuppressedindex;
212 for (
int kInBlock=jInBlock+1; kInBlock<blocksize; ++kInBlock)
224 adcmax = TMath::Max(adcmax,a);
228 if ( splithit || jInBlock == (blocksize - 1))
233 hitRMS = TMath::Sqrt(hitSumSq/hitSig - hitTime*hitTime);
237 hitTime = 0.5*(begT + endT);
240 if (hitRMS == 0) hitRMS =
fMinRMS;
244 if (chanposx < fGeo->TPCXCent())
246 pos[0] = chanposx + driftdistance;
250 pos[0] = chanposx - driftdistance;
261 hitCol->emplace_back(newHit);
266 hitDigAssns->addSingle(hitPtr,digPtr);
std::vector< ADC_t > ADCvector_t
int ZeroSuppression(gar::raw::ADCvector_t &adc, gar::raw::ADC_t zerothreshold, size_t ticksbefore_in, size_t ticksafter_in)
float fHitFracADCNewHit
threshold below which if the ADC falls below multiplied by adcmax, to start a new hit ...
float fHitFracADCRise
fraction ADC must rise back from the minimum to start a new hit
std::string fRawDigitLabel
label to find the right raw digits
TH1D * fAvgPulseShortHist
Zero Suppression algorithm.
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
ProductID put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
float fMinRMS
minimum RMS to report in case only one tick has signal on it
int fTicksBefore
zero-suppression ticks before. Only used if raw waveforms are not zero-suppressed and we must do it ...
int fTicksAfter
zero-suppression ticks after. Only used if raw waveforms are not zero-suppressed and we must do it ...
const detinfo::DetectorProperties * fDetProp
detector properties
#define MF_LOG_WARNING(category)
int fADCThreshold
zero-suppression threshold (in case the raw digits need to be zero-suppressed)
float fHitMaxLen
maximum length of a hit in X, in cm
virtual double DriftVelocity(double efield=0., double temperature=0., bool cmPerns=true) const =0
void ChannelToPosition(unsigned int const channel, float *const worldLoc) const
const geo::GeometryCore * fGeo
pointer to the geometry
cet::coded_exception< error, detail::translate > exception
virtual double TPCTick2Time(double tick) const =0
Given TPC time-tick (waveform index), returns electronics clock [ns].
const gar::detinfo::DetectorClocks * fTime
electronics clock