22 #include "cetlib_except/exception.h" 94 produces< std::vector<recob::Wire> >(
fSpillName);
95 produces<art::Assns<raw::RawDigit, recob::Wire>>(
fSpillName);
106 std::vector<unsigned short> uin; std::vector<unsigned short> vin;
107 std::vector<unsigned short> zin;
113 uin = p.
get< std::vector<unsigned short> > (
"PlaneROIPad");
124 if( pos!=std::string::npos ) {
149 int transformSize = fFFT->
FFTSize();
156 std::unique_ptr<std::vector<recob::Wire> > wirecol(
new std::vector<recob::Wire>);
158 std::unique_ptr<art::Assns<raw::RawDigit,recob::Wire> > WireDigitAssn
163 auto digitVecHandle = evt.
getHandle< std::vector<raw::RawDigit> >(itag1);
165 if (!digitVecHandle->size())
return;
166 mf::LogInfo(
"CalWireDUNE35t") <<
"CalWireDUNE35t:: digitVecHandle size is " << digitVecHandle->size();
171 unsigned int dataSize = digitVec0->
Samples();
175 int readoutwindowsize = detProp.ReadOutWindowSize();
176 if (
int(dataSize) != readoutwindowsize){
178 <<
"ReadOutWindowSize "<<readoutwindowsize<<
" does not match data size "<<dataSize<<
". Please set services.DetectorPropertiesService.NumberTimeSamples and services.DetectorPropertiesService.ReadOutWindowSize in fcl file to "<<dataSize;
186 std::vector<float> holder;
187 std::vector<short> rawadc(transformSize);
188 std::vector<TComplex> freqHolder(transformSize+1);
191 wirecol->reserve(digitVecHandle->size());
192 for(
size_t rdIter = 0; rdIter < digitVecHandle->size(); ++rdIter){
201 holder.resize(transformSize);
209 for(bin = 0; bin < dataSize; ++
bin)
213 for (bin = dataSize;bin<holder.size();bin++){
219 for(bin = 0; bin < holder.size(); ++
bin) holder[bin]=holder[bin]/DeconNorm;
222 holder.resize(dataSize,1
e-5);
229 for(bin = 0; bin < holder.size(); ++
bin) holder[bin]-=average;
237 std::vector<std::pair<unsigned int, unsigned int>> holderInfo;
238 std::vector<std::pair<unsigned int, unsigned int>> rois;
243 unsigned int roiStart = 0;
244 for(bin = 0; bin < dataSize; ++
bin) {
245 double SigVal = holder[
bin];
246 if (SigVal > max) max = SigVal;
250 if (SigVal < deconNoise){
251 rois.push_back(std::make_pair(roiStart, bin));
257 rois.push_back(std::make_pair(roiStart, dataSize-1));
270 if(rois.size() == 0)
continue;
272 for(
unsigned int ii = 0; ii < rois.size(); ++ii) {
276 rois[ii].first = low;
279 if(high >= dataSize) high = dataSize-1;
280 rois[ii].second = high;
284 if(rois.size() >= 1) {
287 for (
unsigned int ii = 0; ii<rois.size();ii++){
288 unsigned int roiStart = rois[ii].first;
289 unsigned int roiEnd = rois[ii].second;
292 unsigned int jj=ii+1;
295 if(rois[jj].first <= roiEnd ) {
296 roiEnd = rois[jj].second;
306 std::vector<float> sigTemp;
307 for(
unsigned int kk = roiStart; kk < roiEnd; ++kk) {
308 sigTemp.push_back(holder[kk]);
329 <<
"Can't associate wire #" << (wirecol->size() - 1)
330 <<
" with raw digit #" << digitVec.
key();
334 if(wirecol->size() == 0)
335 mf::LogWarning(
"CalWireDUNE35t") <<
"No wires made for this event.";
349 for (
unsigned int bin = 0;
bin < holder.size();
bin++){
351 if (holder[
bin] < min) min = holder[
bin];
355 TH1F *
h1 =
new TH1F(
"h1",
"h1",nbin,min,
max);
356 for (
unsigned int bin = 0;
bin < holder.size();
bin++){
357 h1->Fill(holder[
bin]);
359 float ped = h1->GetMaximum();
360 float ave=0,ncount = 0;
361 for (
unsigned int bin = 0;
bin < holder.size();
bin++){
362 if (fabs(holder[
bin]-ped)<2){
367 if (ncount==0) ncount=1;
375 for (
unsigned int bin = 0;
bin < holder.size();
bin++){
float GetPedestal() const
void Deconvolute(detinfo::DetectorClocksData const &clockData, Channel channel, std::vector< T > &func) const
const ADCvector_t & ADCs() const
Reference to the compressed ADC count vector.
void produce(art::Event &evt)
ULong64_t Samples() const
Number of samples in the uncompressed ADC data.
unsigned short fPreROIPad
ROI padding.
Handle< PROD > getHandle(SelectorBase const &) const
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
bool BadChannel(uint32_t channel) const
Helper functions to create a wire.
EDProducer(fhicl::ParameterSet const &pset)
ChannelID_t Channel() const
DAQ channel this raw data was read from.
const datarange_t & add_range(size_type offset, ITER first, ITER last)
Adds a sequence of elements as a range with specified offset.
unsigned short fPostROIPad
ROI padding.
void reconfigure(fhicl::ParameterSet const &p)
Class managing the creation of a new recob::Wire object.
double GetDeconNoise(Channel channel) const override
Service to provide microboone-specific signal shaping for simulation (convolution) and reconstruction...
creation of calibrated signals on wires
art framework interface to geometry description
int fPostsample
number of postsample bins
constexpr ChannelID_t InvalidChannelID
ID of an invalid channel.
#define DEFINE_ART_MODULE(klass)
key_type key() const noexcept
T get(std::string const &key) const
ProductID put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
bool CreateAssn(PRODUCER const &prod, art::Event &evt, std::vector< T > const &a, art::Ptr< U > const &b, art::Assns< U, T > &assn, std::string a_instance, size_t indx=UINT_MAX)
Creates a single one-to-one association.
static int max(int a, int b)
CalWireDUNE35t(fhicl::ParameterSet const &pset)
raw::Compress_t Compression() const
Compression algorithm used to store the ADC counts.
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
double fSigThrFact
Signal shreshold factor.
void SubtractBaseline(std::vector< float > &holder)
QTextStream & bin(QTextStream &s)
virtual ~CalWireDUNE35t()
Declaration of basic channel signal object.
int fDoBaselineSub
number of postsample bins
unsigned int ChannelID_t
Type representing the ID of a readout channel.
void Uncompress(const std::vector< short > &adc, std::vector< short > &uncompressed, raw::Compress_t compress)
Uncompresses a raw data buffer.
std::string fDigitModuleLabel
constants
double GetDeconNorm() const override
QTextStream & endl(QTextStream &s)