Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
PdspNoiseRemoval Class Reference

#include <PdspNoiseRemoval.h>

Inheritance diagram for PdspNoiseRemoval:
TpcDataTool

Public Member Functions

 PdspNoiseRemoval (fhicl::ParameterSet const &ps)
 
 ~PdspNoiseRemoval () override=default
 
DataMap updateMap (AdcChannelDataMap &acds) const override
 

Private Member Functions

std::vector< float > getMeanCorrection (const std::vector< unsigned int > &channels, const AdcChannelDataMap &datamap) const
 
std::vector< float > getMedianCorrection (const std::vector< unsigned int > &channels, const AdcChannelDataMap &datamap) const
 
void removeCoherent (const GroupChannelMap &ch_groups, AdcChannelDataMap &datamap) const
 
void removeHighFreq (AdcChannelDataMap &datamap) const
 
void fftFltInPlace (std::vector< float > &adc, const std::vector< float > &coeffs) const
 
std::vector< float > fftFlt (const std::vector< float > &adc, const std::vector< float > &coeffs) const
 
std::vector< boolroiMask (const AdcChannelData &adc) const
 
GroupChannelMap makeGroupsByOfflineChannels (size_t gsize, const std::vector< size_t > &gidx) const
 
GroupChannelMap makeGroupsByDAQChannels (size_t gsize, const std::vector< size_t > &gidx) const
 
GroupChannelMap makeGroupsByFEMBPlaneType (size_t gsize, const std::vector< size_t > &gidx) const
 
bool has (const std::vector< size_t > &v, size_t idx) const
 
- Private Member Functions inherited from TpcDataTool
virtual DataMap updateTpcData (TpcData &) const
 
virtual DataMap viewTpcData (const TpcData &) const
 
virtual int forwardTpcData () const
 
- Private Member Functions inherited from AdcChannelTool
virtual ~AdcChannelTool ()=default
 
virtual DataMap update (AdcChannelData &) const
 
virtual DataMap view (const AdcChannelData &acd) const
 
virtual DataMap viewMap (const AdcChannelDataMap &acds) const
 
virtual bool updateWithView () const
 
virtual bool viewWithUpdate () const
 
virtual DataMap beginEvent (const DuneEventInfo &) const
 
virtual DataMap endEvent (const DuneEventInfo &) const
 
virtual DataMap close (const DataMap *dmin=nullptr)
 

Static Private Member Functions

static size_t getDAQChan (size_t LAr_chan)
 
- Static Private Member Functions inherited from AdcChannelTool
static int interfaceNotImplemented ()
 

Private Attributes

int m_LogLevel
 
bool fRemoveHighFrequency
 
bool fRemoveCoherent
 
bool fCoherentOffline16
 
bool fCoherentDaq8
 
bool fCoherentDaq16
 
bool fCoherentFEMB128
 
std::vector< size_t > fCoherentOffline16Groups
 
std::vector< size_t > fCoherentDaq8Groups
 
std::vector< size_t > fCoherentDaq16Groups
 
std::vector< size_t > fCoherentFEMB128Groups
 
std::vector< float > fLowPassCoeffs
 
int fMode
 
bool fUseBasicROIForCNR
 
float fRoiStartThreshold
 
float fRoiEndThreshold
 
int fRoiPadLow
 
int fRoiPadHigh
 
float fCutoffFrequency
 
const geo::GeometryfGeometry
 
util::LArFFTfFFT
 

Additional Inherited Members

- Private Types inherited from AdcChannelTool
using Index = unsigned int
 

Detailed Description

Definition at line 53 of file PdspNoiseRemoval.h.

Constructor & Destructor Documentation

PdspNoiseRemoval::PdspNoiseRemoval ( fhicl::ParameterSet const &  ps)

Definition at line 56 of file PdspNoiseRemoval_tool.cc.

57 : m_LogLevel(ps.get<int>("LogLevel")) {
58  const string myname = "PdspNoiseRemoval::ctor: ";
59 
60  fRemoveHighFrequency = ps.get<bool>("RemoveHighFrequency");
61  fRemoveCoherent = ps.get<bool>("RemoveCoherent");
62  fCutoffFrequency = ps.get<float>("CutoffFrequency");
63  fCoherentOffline16 = ps.get<bool>("CoherentOffline16");
64  fCoherentDaq8 = ps.get<bool>("CoherentDaq8");
65  fCoherentDaq16 = ps.get<bool>("CoherentDaq16");
66  fCoherentFEMB128 = ps.get<bool>("CoherentFEMB128");
67  fCoherentOffline16Groups = ps.get<std::vector<size_t>>("CoherentOffline16Groups");
68  fCoherentDaq8Groups = ps.get<std::vector<size_t>>("CoherentDaq8Groups");
69  fCoherentDaq16Groups = ps.get<std::vector<size_t>>("CoherentDaq16Groups");
70  fCoherentFEMB128Groups = ps.get<std::vector<size_t>>("CoherentFEMB128Groups");
71  fUseBasicROIForCNR = ps.get<bool>("UseBasicROIForCNR");
72  fRoiStartThreshold = ps.get<float>("RoiStartThreshold");
73  fRoiEndThreshold = ps.get<float>("RoiEndThreshold");
74  fRoiPadLow = ps.get<int>("RoiPadLow");
75  fRoiPadHigh = ps.get<int>("RoiPadHigh");
76 
79  if(ps.get<std::string>("CorrMode") == "mean") { fMode = 1; }
80  else if(ps.get<std::string>("CorrMode") == "median") { fMode = 2; }
81  else {
82  std::cout << "PdspNoiseRemoval WARNING: correction set to mean value." << std::endl;
83  fMode = 1;
84  }
85  auto const clockData = art::ServiceHandle<detinfo::DetectorClocksService const>()->DataForJob();
86  double binWidth = 1.0/(fFFT->FFTSize()*sampling_rate(clockData)*1.0e-6);
87  fLowPassCoeffs.resize(fFFT->FFTSize() / 2 + 1);
88  for(size_t i = 0; i < fLowPassCoeffs.size(); ++i) {
89  float f = binWidth * i;
90  fLowPassCoeffs[i] = 1.0 / sqrt(1.0 + pow(f/fCutoffFrequency, 8));
91  }
92 
93  if( m_LogLevel >= 1 ) {
94  cout << myname << " LogLevel: " << m_LogLevel << endl;
95  cout << myname << " RemoveHighFrequency: " << fRemoveHighFrequency << endl;
96  cout << myname << " RemoveCoherent: " << fRemoveCoherent << endl;
97  cout << myname << " CutoffFrequency: " << fCutoffFrequency << endl;
98  cout << myname << " CoherentOffline16: " << fCoherentOffline16 << endl;
99  cout << myname << " CoherentDaq8: " << fCoherentDaq8 << endl;
100  cout << myname << " CoherentDaq16: " << fCoherentDaq16 << endl;
101  cout << myname << " CoherentFEMB128: " << fCoherentFEMB128 << endl;
102  cout << myname << "CoherentOffline16Groups: [";
103  for(size_t i=0; i<fCoherentOffline16Groups.size(); i++) {
104  cout<< fCoherentOffline16Groups.at(i) <<", ";
105  }
106  cout << " ]" << endl;
107  cout << myname << "CoherentDaq8Groups: [";
108  for(size_t i=0; i<fCoherentDaq8Groups.size(); i++) {
109  cout<< fCoherentDaq8Groups.at(i) <<", ";
110  }
111  cout << " ]" << endl;
112  cout << myname << "CoherentDaq16Groups: [";
113  for(size_t i=0; i<fCoherentDaq16Groups.size(); i++) {
114  cout<< fCoherentDaq16Groups.at(i) <<", ";
115  }
116  cout << " ]" << endl;
117  cout << myname << "CoherentFEMB128Groups: [";
118  for(size_t i=0; i<fCoherentFEMB128Groups.size(); i++) {
119  cout<< fCoherentFEMB128Groups.at(i) <<", ";
120  }
121  cout << " ]" << endl;
122  cout << myname << " UseBasicROIForCNR: " << fUseBasicROIForCNR << endl;
123  cout << myname << " RoiStartThreshold: " << fRoiStartThreshold << endl;
124  cout << myname << " RoiEndThreshold: " << fRoiEndThreshold << endl;
125  cout << myname << " RoiPadLow: " << fRoiPadLow << endl;
126  cout << myname << " RoiPadHigh: " << fRoiPadHigh << endl;
127  }
128 }
std::vector< size_t > fCoherentDaq16Groups
const geo::Geometry * fGeometry
std::string string
Definition: nybbler.cc:12
std::vector< size_t > fCoherentFEMB128Groups
constexpr T pow(T x)
Definition: pow.h:72
util::LArFFT * fFFT
std::vector< float > fLowPassCoeffs
static constexpr double ps
Definition: Units.h:99
std::vector< size_t > fCoherentOffline16Groups
std::vector< size_t > fCoherentDaq8Groups
double sampling_rate(DetectorClocksData const &data)
Returns the period of the TPC readout electronics clock.
QTextStream & endl(QTextStream &s)
PdspNoiseRemoval::~PdspNoiseRemoval ( )
overridedefault

Member Function Documentation

std::vector< float > PdspNoiseRemoval::fftFlt ( const std::vector< float > &  adc,
const std::vector< float > &  coeffs 
) const
private

Definition at line 194 of file PdspNoiseRemoval_tool.cc.

194  {
195  std::vector< TComplex > ch_spectrum(fFFT->FFTSize() / 2 + 1);
196  std::vector< float > ch_waveform(fFFT->FFTSize(), 0);
197  size_t n_samples = adc.size();
198  copyWaveform(adc, ch_waveform);
199  fFFT->DoFFT(ch_waveform, ch_spectrum);
200  for(size_t c = 0; c < coeffs.size(); ++c) {
201  ch_spectrum[c] *= coeffs[c];
202  }
203  fFFT->DoInvFFT(ch_spectrum, ch_waveform);
204  std::vector< float > flt_adc(n_samples);
205  std::copy(ch_waveform.begin(), ch_waveform.begin()+n_samples, flt_adc.begin());
206  return flt_adc;
207 }
util::LArFFT * fFFT
void DoFFT(std::vector< T > &input, std::vector< TComplex > &output)
Definition: LArFFT.h:98
void DoInvFFT(std::vector< TComplex > &input, std::vector< T > &output)
Definition: LArFFT.h:120
int FFTSize() const
Definition: LArFFT.h:69
T copy(T const &v)
void PdspNoiseRemoval::fftFltInPlace ( std::vector< float > &  adc,
const std::vector< float > &  coeffs 
) const
private

Definition at line 178 of file PdspNoiseRemoval_tool.cc.

178  {
179  const string myname = "PdspNoiseRemoval::fftFltInPlace: ";
180  std::vector< TComplex > ch_spectrum(fFFT->FFTSize() / 2 + 1);
181  std::vector< float > ch_waveform(fFFT->FFTSize(), 0);
182  size_t n_samples = adc.size();
183  if ( m_LogLevel >= 3 ) cout << myname << "N_ADC = " << adc.size() << ", N_WF = " << ch_waveform.size() << endl;
184  copyWaveform(adc, ch_waveform);
185  fFFT->DoFFT(ch_waveform, ch_spectrum);
186  for(size_t c = 0; c < coeffs.size(); ++c) {
187  ch_spectrum[c] *= coeffs[c];
188  }
189  fFFT->DoInvFFT(ch_spectrum, ch_waveform);
190  std::copy(ch_waveform.begin(), ch_waveform.begin()+n_samples, adc.begin());
191 }
util::LArFFT * fFFT
void DoFFT(std::vector< T > &input, std::vector< TComplex > &output)
Definition: LArFFT.h:98
void DoInvFFT(std::vector< TComplex > &input, std::vector< T > &output)
Definition: LArFFT.h:120
int FFTSize() const
Definition: LArFFT.h:69
T copy(T const &v)
QTextStream & endl(QTextStream &s)
size_t PdspNoiseRemoval::getDAQChan ( size_t  LAr_chan)
staticprivate

Definition at line 396 of file PdspNoiseRemoval_tool.cc.

396  {
397  // Get channel map
399  size_t apa = channelMap->APAFromOfflineChannel(LAr_chan);
400  size_t wib = channelMap->WIBFromOfflineChannel(LAr_chan);
401  size_t femb = channelMap->FEMBFromOfflineChannel(LAr_chan);
402  size_t fembChan = channelMap->FEMBChannelFromOfflineChannel(LAr_chan);
403  size_t DaqChan = 2560*apa + 512* wib + 128* femb + fembChan; //does not depend on RCE or FELIX
404  return DaqChan;
405 }
unsigned int FEMBChannelFromOfflineChannel(unsigned int offlineChannel) const
Returns FEMB channel.
unsigned int APAFromOfflineChannel(unsigned int offlineChannel) const
Returns APA/crate.
unsigned int WIBFromOfflineChannel(unsigned int offlineChannel) const
Returns WIB/slot.
unsigned int FEMBFromOfflineChannel(unsigned int offlineChannel) const
Returns FEMB/fiber.
std::vector< float > PdspNoiseRemoval::getMeanCorrection ( const std::vector< unsigned int > &  channels,
const AdcChannelDataMap datamap 
) const
private

Definition at line 294 of file PdspNoiseRemoval_tool.cc.

294  {
295  size_t n_samples = datamap.begin()->second.samples.size();
296  std::vector<size_t> ch_averaged(n_samples, 0);
297  std::vector<float> correction(n_samples, 0);
298  for(unsigned int ch : channels) {
299  auto iacd = datamap.find(ch);
300  if(iacd == datamap.end()) continue;
301  const AdcChannelData & acd = iacd->second;
302  if(acd.samples.size()>n_samples) {
303  ch_averaged.resize(acd.samples.size(), 0.);
304  correction.resize(acd.samples.size(), 0.);
305  }
306  if(fUseBasicROIForCNR) {
307  auto mask = roiMask(acd);
308  for(size_t s = 0; s < acd.samples.size(); ++s) {
309  if (!mask[s]) { continue; }
310  AdcFlag flag = (acd.flags.size()!=0 && s<acd.flags.size()) ? acd.flags[s] : AdcGood;
311  if(flag != AdcGood) { continue; }
312  correction[s] += acd.samples[s];
313  ch_averaged[s]++;
314  }
315  }
316  else {
317  for(size_t s = 0; s < acd.samples.size(); ++s) {
318  if(acd.signal[s]) { continue; }
319  AdcFlag flag = (acd.flags.size()!=0 && s<acd.flags.size()) ? acd.flags[s] : AdcGood;
320  if(flag != AdcGood) { continue; }
321  correction[s] += acd.samples[s];
322  ch_averaged[s]++;
323  }
324  }
325  }
326  for(size_t s = 0; s < correction.size(); ++s) {
327  if(ch_averaged[s] > 0) {
328  correction[s] /= ch_averaged[s];
329  }
330  }
331  return correction;
332 }
short AdcFlag
Definition: AdcTypes.h:29
std::vector< bool > roiMask(const AdcChannelData &adc) const
const AdcFlag AdcGood
Definition: AdcTypes.h:32
AdcFilterVector signal
static QCString * s
Definition: config.cpp:1042
AdcSignalVector samples
AdcFlagVector flags
std::vector< float > PdspNoiseRemoval::getMedianCorrection ( const std::vector< unsigned int > &  channels,
const AdcChannelDataMap datamap 
) const
private

Definition at line 333 of file PdspNoiseRemoval_tool.cc.

333  {
334  size_t n_samples = datamap.begin()->second.samples.size();
335  std::vector< std::vector<float> > samples(n_samples);
336  for(unsigned int ch : channels) {
337  auto iacd = datamap.find(ch);
338  if(iacd == datamap.end()) continue;
339  const AdcChannelData & acd = iacd->second;
340  if(acd.samples.size()>n_samples) samples.resize(acd.samples.size());
341  if(fUseBasicROIForCNR) {
342  auto mask = roiMask(acd);
343  for(size_t s = 0; s < acd.samples.size(); ++s) {
344  if (!mask[s]) { continue; }
345  AdcFlag flag = (acd.flags.size()!=0 && s<acd.flags.size()) ? acd.flags[s] : AdcGood;
346  if(flag != AdcGood) { continue; }
347  samples[s].push_back(acd.samples[s]);
348  }
349  }
350  else {
351  for(size_t s = 0; s < acd.samples.size(); ++s) {
352  if(acd.signal[s]) { continue; }
353  AdcFlag flag = (acd.flags.size()!=0 && s<acd.flags.size()) ? acd.flags[s] : AdcGood;
354  if(flag != AdcGood) { continue; }
355  samples[s].push_back(acd.samples[s]);
356  }
357  }
358  }
359  std::vector<float> correction(samples.size());
360  for(size_t s = 0; s < samples.size(); ++s) {
361  size_t n = samples[s].size();
362  if(n < 2) { correction[s] = 0; continue; }
363  std::sort(samples[s].begin(), samples[s].end());
364  if((n % 2) == 0) { correction[s] = 0.5 * (samples[s][n/2] + samples[s][(n/2)-1]); }
365  else { correction[s] = samples[s][(n-1)/2]; }
366  }
367  return correction;
368 }
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
short AdcFlag
Definition: AdcTypes.h:29
std::vector< bool > roiMask(const AdcChannelData &adc) const
const AdcFlag AdcGood
Definition: AdcTypes.h:32
std::void_t< T > n
AdcFilterVector signal
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Definition: StdUtils.h:72
static QCString * s
Definition: config.cpp:1042
AdcSignalVector samples
AdcFlagVector flags
bool PdspNoiseRemoval::has ( const std::vector< size_t > &  v,
size_t  idx 
) const
inlineprivate

Definition at line 104 of file PdspNoiseRemoval.h.

104  {
105  for (auto c : v) if (c == idx) return true;
106  return false;
107  }
GroupChannelMap PdspNoiseRemoval::makeGroupsByDAQChannels ( size_t  gsize,
const std::vector< size_t > &  gidx 
) const
private

Definition at line 224 of file PdspNoiseRemoval_tool.cc.

224  {
225  GroupChannelMap groups;
226  auto const & chStatus = art::ServiceHandle< lariov::ChannelStatusService >()->GetProvider();
227  const unsigned int nchan = fGeometry->Nchannels();
228  for(unsigned int ch = 0; ch < nchan; ++ch) {
229  size_t g = getDAQChan(ch) / gsize;
230  if(gidx.empty() || has(gidx, g)) {
231  if(chStatus.IsPresent(ch) && !chStatus.IsBad(ch) && !chStatus.IsNoisy(ch)) {
232  groups[g].push_back(ch);
233  }
234  }
235  }
236  return groups;
237 }
const geo::Geometry * fGeometry
static constexpr double g
Definition: Units.h:144
unsigned int Nchannels() const
Returns the number of TPC readout channels in the detector.
bool has(const std::vector< size_t > &v, size_t idx) const
std::unordered_map< unsigned int, std::vector< unsigned int > > GroupChannelMap
static size_t getDAQChan(size_t LAr_chan)
GroupChannelMap PdspNoiseRemoval::makeGroupsByFEMBPlaneType ( size_t  gsize,
const std::vector< size_t > &  gidx 
) const
private

Definition at line 240 of file PdspNoiseRemoval_tool.cc.

240  {
241  // Get channel map
243  GroupChannelMap groups;
244  auto const & chStatus = art::ServiceHandle< lariov::ChannelStatusService >()->GetProvider();
245  const unsigned int nchan = fGeometry->Nchannels();
246  for(unsigned int ch = 0; ch < nchan; ++ch) {
247  //size_t g = ch / gsize;
248  size_t g = getDAQChan(ch) / gsize;
249  size_t plane = channelMap->PlaneFromOfflineChannel(ch);
250  if(gidx.empty() || has(gidx, g) ) {
251  if(chStatus.IsPresent(ch) && !chStatus.IsBad(ch) && !chStatus.IsNoisy(ch)) {
252  switch (plane) {
253  case 0: groups[3*g].push_back(ch);
254  break;
255  case 1: groups[3*g+1].push_back(ch);
256  break;
257  case 2: groups[3*g+2].push_back(ch);
258  break;
259  }
260  }
261  }
262  }
263  return groups;
264 }
const geo::Geometry * fGeometry
static constexpr double g
Definition: Units.h:144
unsigned int Nchannels() const
Returns the number of TPC readout channels in the detector.
bool has(const std::vector< size_t > &v, size_t idx) const
unsigned int PlaneFromOfflineChannel(unsigned int offlineChannel) const
Returns plane.
std::unordered_map< unsigned int, std::vector< unsigned int > > GroupChannelMap
static size_t getDAQChan(size_t LAr_chan)
GroupChannelMap PdspNoiseRemoval::makeGroupsByOfflineChannels ( size_t  gsize,
const std::vector< size_t > &  gidx 
) const
private

Definition at line 210 of file PdspNoiseRemoval_tool.cc.

210  {
211  GroupChannelMap groups;
212  auto const & chStatus = art::ServiceHandle< lariov::ChannelStatusService >()->GetProvider();
213  const unsigned int nchan = fGeometry->Nchannels();
214  for(unsigned int ch = 0; ch < nchan; ++ch) {
215  size_t g = ch / gsize;
216  if(gidx.empty() || has(gidx, g)) {
217  if(chStatus.IsPresent(ch) && !chStatus.IsBad(ch) && !chStatus.IsNoisy(ch)) { groups[g].push_back(ch); }
218  }
219  }
220  return groups;
221 }
const geo::Geometry * fGeometry
static constexpr double g
Definition: Units.h:144
unsigned int Nchannels() const
Returns the number of TPC readout channels in the detector.
bool has(const std::vector< size_t > &v, size_t idx) const
std::unordered_map< unsigned int, std::vector< unsigned int > > GroupChannelMap
void PdspNoiseRemoval::removeCoherent ( const GroupChannelMap ch_groups,
AdcChannelDataMap datamap 
) const
private

Definition at line 267 of file PdspNoiseRemoval_tool.cc.

267  {
268  if(datamap.empty()) return;
269  //PdspNoiseRemoval *th = const_cast <PdspNoiseRemoval *> (this);
270  //size_t n_samples = datamap.begin()->second.samples.size();
271  for(const auto & entry : ch_groups) {
272  const auto & channels = entry.second;
273  std::vector<float> correction;
274  if(fMode == 1) { // mean
275  correction = getMeanCorrection(channels, datamap);
276  }
277  else if(fMode == 2) { // median
278  correction = getMedianCorrection(channels, datamap);
279  }
280  for(unsigned int ch : channels) {
281  auto iacd = datamap.find(ch);
282  if(iacd == datamap.end()) continue;
283  AdcChannelData & acd = iacd->second;
284  if(acd.samples.size() == 0) continue;
285  if(acd.samples.size() > correction.size()) correction.resize(acd.samples.size(), 0.);
286  for(size_t s = 0; s < acd.samples.size(); ++s) {
287  acd.samples[s] -= correction[s];
288  }
289  }
290  }
291 }
QList< Entry > entry
std::vector< float > getMedianCorrection(const std::vector< unsigned int > &channels, const AdcChannelDataMap &datamap) const
std::vector< float > getMeanCorrection(const std::vector< unsigned int > &channels, const AdcChannelDataMap &datamap) const
static QCString * s
Definition: config.cpp:1042
AdcSignalVector samples
void PdspNoiseRemoval::removeHighFreq ( AdcChannelDataMap datamap) const
private

Definition at line 167 of file PdspNoiseRemoval_tool.cc.

168 {
169  auto const & chStatus = art::ServiceHandle< lariov::ChannelStatusService >()->GetProvider();
170  for(auto & entry : datamap) {
171  if ( chStatus.IsPresent(entry.first) && !chStatus.IsNoisy(entry.first) && entry.second.samples.size() ) {
172  fftFltInPlace(entry.second.samples, fLowPassCoeffs);
173  }
174  }
175 }
QList< Entry > entry
QCollection::Item first()
Definition: qglist.cpp:807
void fftFltInPlace(std::vector< float > &adc, const std::vector< float > &coeffs) const
std::vector< float > fLowPassCoeffs
std::vector< bool > PdspNoiseRemoval::roiMask ( const AdcChannelData adc) const
private

Definition at line 371 of file PdspNoiseRemoval_tool.cc.

371  {
372  std::vector<bool> mask(acd.samples.size(), true);
373  if ( acd.samples.size() == 0 ) return mask;
374  auto acd_flt = fftFlt(acd.samples, fLowPassCoeffs);
375  bool inroi = false;
376  for (int i = 0; i < (int)acd_flt.size(); ++i) {
377  auto sig = acd_flt[i];
378  if (inroi){
379  if (sig > fRoiEndThreshold || sig < -1.0*fRoiEndThreshold) { mask[i] = false; }
380  else {
381  for (int p = 0; p <= fRoiPadHigh; ++p) { if ((i + p) < (int)mask.size()) { mask[i + p] = false; } }
382  inroi = false;
383  }
384  }
385  else {
386  if (sig > fRoiStartThreshold || sig < -1.0*fRoiStartThreshold) {
387  for (int p = fRoiPadLow; p >= 0; --p) { if (i - p >= 0) { mask[i - p] = false; } }
388  inroi = true;
389  }
390  }
391  }
392  return mask;
393 }
std::vector< float > fftFlt(const std::vector< float > &adc, const std::vector< float > &coeffs) const
p
Definition: test.py:223
std::vector< float > fLowPassCoeffs
DataMap PdspNoiseRemoval::updateMap ( AdcChannelDataMap acds) const
overridevirtual

Reimplemented from AdcChannelTool.

Definition at line 131 of file PdspNoiseRemoval_tool.cc.

131  {
132  const string myname = "PdspNoiseRemoval::updateMap: ";
133  if( updateWithView() ) return viewMap(acds);
134  DataMap ret(0);
135  if (acds.size() == 0) {
136  std::cout << myname << "WARNING: No channels found." << std::endl;
137  ret.setStatus(1);
138  return ret;
139  }
140 
142  removeHighFreq(acds);
143  }
144  if(fRemoveCoherent) {
145  if(fCoherentOffline16) {
147  removeCoherent(ch_groups, acds);
148  }
149  if(fCoherentFEMB128) {
150  auto ch_groups = makeGroupsByFEMBPlaneType(128, fCoherentFEMB128Groups);
151  removeCoherent(ch_groups, acds);
152  }
153  if(fCoherentDaq16) {
154  auto ch_groups = makeGroupsByDAQChannels(16, fCoherentDaq16Groups);
155  removeCoherent(ch_groups, acds);
156  }
157  if(fCoherentDaq8) {
158  auto ch_groups = makeGroupsByDAQChannels(8, fCoherentDaq8Groups);
159  removeCoherent(ch_groups, acds);
160  }
161  }
162  ret.setStatus(0);
163  return ret;
164 }
std::vector< size_t > fCoherentDaq16Groups
void removeCoherent(const GroupChannelMap &ch_groups, AdcChannelDataMap &datamap) const
virtual DataMap viewMap(const AdcChannelDataMap &acds) const
std::vector< size_t > fCoherentFEMB128Groups
void removeHighFreq(AdcChannelDataMap &datamap) const
GroupChannelMap makeGroupsByOfflineChannels(size_t gsize, const std::vector< size_t > &gidx) const
GroupChannelMap makeGroupsByFEMBPlaneType(size_t gsize, const std::vector< size_t > &gidx) const
virtual bool updateWithView() const
GroupChannelMap makeGroupsByDAQChannels(size_t gsize, const std::vector< size_t > &gidx) const
std::vector< size_t > fCoherentOffline16Groups
std::vector< size_t > fCoherentDaq8Groups
QTextStream & endl(QTextStream &s)

Member Data Documentation

bool PdspNoiseRemoval::fCoherentDaq16
private

Definition at line 65 of file PdspNoiseRemoval.h.

std::vector< size_t > PdspNoiseRemoval::fCoherentDaq16Groups
private

Definition at line 68 of file PdspNoiseRemoval.h.

bool PdspNoiseRemoval::fCoherentDaq8
private

Definition at line 65 of file PdspNoiseRemoval.h.

std::vector< size_t > PdspNoiseRemoval::fCoherentDaq8Groups
private

Definition at line 67 of file PdspNoiseRemoval.h.

bool PdspNoiseRemoval::fCoherentFEMB128
private

Definition at line 65 of file PdspNoiseRemoval.h.

std::vector< size_t > PdspNoiseRemoval::fCoherentFEMB128Groups
private

Definition at line 69 of file PdspNoiseRemoval.h.

bool PdspNoiseRemoval::fCoherentOffline16
private

Definition at line 65 of file PdspNoiseRemoval.h.

std::vector< size_t > PdspNoiseRemoval::fCoherentOffline16Groups
private

Definition at line 66 of file PdspNoiseRemoval.h.

float PdspNoiseRemoval::fCutoffFrequency
private

Definition at line 77 of file PdspNoiseRemoval.h.

util::LArFFT* PdspNoiseRemoval::fFFT
mutableprivate

Definition at line 81 of file PdspNoiseRemoval.h.

const geo::Geometry* PdspNoiseRemoval::fGeometry
private

Definition at line 80 of file PdspNoiseRemoval.h.

std::vector< float > PdspNoiseRemoval::fLowPassCoeffs
private

Definition at line 70 of file PdspNoiseRemoval.h.

int PdspNoiseRemoval::fMode
private

Definition at line 71 of file PdspNoiseRemoval.h.

bool PdspNoiseRemoval::fRemoveCoherent
private

Definition at line 64 of file PdspNoiseRemoval.h.

bool PdspNoiseRemoval::fRemoveHighFrequency
private

Definition at line 64 of file PdspNoiseRemoval.h.

float PdspNoiseRemoval::fRoiEndThreshold
private

Definition at line 74 of file PdspNoiseRemoval.h.

int PdspNoiseRemoval::fRoiPadHigh
private

Definition at line 76 of file PdspNoiseRemoval.h.

int PdspNoiseRemoval::fRoiPadLow
private

Definition at line 75 of file PdspNoiseRemoval.h.

float PdspNoiseRemoval::fRoiStartThreshold
private

Definition at line 73 of file PdspNoiseRemoval.h.

bool PdspNoiseRemoval::fUseBasicROIForCNR
private

Definition at line 72 of file PdspNoiseRemoval.h.

int PdspNoiseRemoval::m_LogLevel
private

Definition at line 63 of file PdspNoiseRemoval.h.


The documentation for this class was generated from the following files: