20 #include "cetlib_except/exception.h" 86 produces< std::vector<recob::Wire> >(
fSpillName);
87 produces<art::Assns<raw::RawDigit, recob::Wire>>(
fSpillName);
98 std::vector<unsigned short> uin;
104 uin = p.
get< std::vector<unsigned short> > (
"PlaneROIPad");
112 if( pos!=std::string::npos ) {
137 int transformSize = fFFT->
FFTSize();
144 std::unique_ptr<std::vector<recob::Wire> > wirecol(
new std::vector<recob::Wire>);
146 std::unique_ptr<art::Assns<raw::RawDigit,recob::Wire> > WireDigitAssn
151 auto digitVecHandle = evt.
getHandle< std::vector<raw::RawDigit> >(itag1);
154 if (digitVecHandle->size())
156 mf::LogInfo(
"CalWireDUNEDPhase") <<
"CalWireDUNEDPhase:: digitVecHandle size is " << digitVecHandle->size();
161 unsigned int dataSize = digitVec0->
Samples();
164 int readoutwindowsize = detProp.ReadOutWindowSize();
165 if (
int(dataSize) != readoutwindowsize){
167 <<
"ReadOutWindowSize "<<readoutwindowsize<<
" does not match data size "<<dataSize<<
". Please set services.DetectorPropertiesService.NumberTimeSamples and services.DetectorPropertiesService.ReadOutWindowSize in fcl file to "<<dataSize;
175 std::vector<float> holder;
176 std::vector<short> rawadc(transformSize);
177 std::vector<TComplex> freqHolder(transformSize+1);
180 wirecol->reserve(digitVecHandle->size());
181 for(
size_t rdIter = 0; rdIter < digitVecHandle->size(); ++rdIter){
190 holder.resize(transformSize);
196 for(bin = 0; bin < dataSize; ++
bin)
199 for (bin = dataSize;bin<holder.size();bin++){
205 for(bin = 0; bin < holder.size(); ++
bin) holder[bin]=holder[bin]/DeconNorm;
208 holder.resize(dataSize,1
e-5);
215 for(bin = 0; bin < holder.size(); ++
bin) holder[bin]-=average;
222 std::vector<std::pair<unsigned int, unsigned int>> holderInfo;
223 std::vector<std::pair<unsigned int, unsigned int>> rois;
228 unsigned int roiStart = 0;
229 for(bin = 0; bin < dataSize; ++
bin) {
230 double SigVal = holder[
bin];
231 if (SigVal > max) max = SigVal;
235 if (SigVal < deconNoise){
236 rois.push_back(std::make_pair(roiStart, bin));
242 rois.push_back(std::make_pair(roiStart, dataSize-1));
255 if(rois.size() == 0)
continue;
257 for(
unsigned int ii = 0; ii < rois.size(); ++ii) {
261 rois[ii].first = low;
264 if(high >= dataSize) high = dataSize-1;
265 rois[ii].second = high;
269 if(rois.size() >= 1) {
272 for (
unsigned int ii = 0; ii<rois.size();ii++){
273 unsigned int roiStart = rois[ii].first;
274 unsigned int roiEnd = rois[ii].second;
277 unsigned int jj=ii+1;
280 if(rois[jj].first <= roiEnd ) {
281 roiEnd = rois[jj].second;
291 std::vector<float> sigTemp;
292 for(
unsigned int kk = roiStart; kk < roiEnd; ++kk) {
293 sigTemp.push_back(holder[kk]);
322 <<
"Can't associate wire #" << (wirecol->size() - 1)
323 <<
" with raw digit #" << digitVec.
key();
327 if(wirecol->size() == 0)
328 mf::LogWarning(
"CalWireDUNEDPhase") <<
"No wires made for this event.";
344 for (
unsigned int bin = 0;
bin < holder.size();
bin++){
346 if (holder[
bin] < min) min = holder[
bin];
350 TH1F *
h1 =
new TH1F(
"h1",
"h1",nbin,min,
max);
351 for (
unsigned int bin = 0;
bin < holder.size();
bin++){
352 h1->Fill(holder[
bin]);
354 float ped = h1->GetMaximum();
355 float ave=0,ncount = 0;
356 for (
unsigned int bin = 0;
bin < holder.size();
bin++){
357 if (fabs(holder[
bin]-ped)<2){
362 if (ncount==0) ncount=1;
364 for (
unsigned int bin = 0;
bin < holder.size();
bin++){
float GetPedestal() const
const ADCvector_t & ADCs() const
Reference to the compressed ADC count vector.
ULong64_t Samples() const
Number of samples in the uncompressed ADC data.
double GetDeconNorm() const override
double fSigThrFact
Signal shreshold factor.
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.
Class managing the creation of a new recob::Wire object.
creation of calibrated signals on wires
double GetDeconNoise(Channel channel) const override
constexpr ChannelID_t InvalidChannelID
ID of an invalid channel.
#define DEFINE_ART_MODULE(klass)
std::string fDigitModuleLabel
constants
key_type key() const noexcept
T get(std::string const &key) const
ProductID put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
int fDoBaselineSub
number of postsample bins
int fPostsample
number of postsample bins
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)
Service to provide DUNE dual-phase signal shaping for simulation (convolution) and reconstruction (de...
void reconfigure(fhicl::ParameterSet const &p)
raw::Compress_t Compression() const
Compression algorithm used to store the ADC counts.
virtual ~CalWireDUNEDPhase()
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
unsigned short fPostROIPad
ROI padding.
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
QTextStream & bin(QTextStream &s)
unsigned short fPreROIPad
ROI padding.
Declaration of basic channel signal object.
void SubtractBaseline(std::vector< float > &holder)
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.
CalWireDUNEDPhase(fhicl::ParameterSet const &pset)
void Deconvolute(unsigned int channel, std::vector< T > &func) const
void produce(art::Event &evt)