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

#include <Legacy35tZeroSuppressService.h>

Inheritance diagram for Legacy35tZeroSuppressService:
AdcSuppressService

Public Member Functions

 Legacy35tZeroSuppressService (fhicl::ParameterSet const &pset, art::ActivityRegistry &)
 
 Legacy35tZeroSuppressService (float aAdcThreshold, unsigned int aTickRange, unsigned int aMinTickGap, bool aSuppressStickyBits)
 
int filter (const AdcCountVector &sigs, Channel chan, AdcPedestal ped, AdcFilterVector &keep) const
 
std::ostream & print (std::ostream &out=std::cout, std::string prefix="") const
 
- Public Member Functions inherited from AdcSuppressService
virtual ~AdcSuppressService ()=default
 
int filter (AdcCountSelection &acs)
 

Private Attributes

float m_AdcThreshold
 
unsigned int m_TickRange
 
unsigned int m_MinTickGap
 
bool m_SuppressStickyBits
 

Additional Inherited Members

- Public Types inherited from AdcSuppressService
typedef unsigned int Channel
 

Detailed Description

Definition at line 36 of file Legacy35tZeroSuppressService.h.

Constructor & Destructor Documentation

Legacy35tZeroSuppressService::Legacy35tZeroSuppressService ( fhicl::ParameterSet const &  pset,
art::ActivityRegistry  
)
Legacy35tZeroSuppressService::Legacy35tZeroSuppressService ( float  aAdcThreshold,
unsigned int  aTickRange,
unsigned int  aMinTickGap,
bool  aSuppressStickyBits 
)

Member Function Documentation

int Legacy35tZeroSuppressService::filter ( const AdcCountVector sigs,
Channel  chan,
AdcPedestal  ped,
AdcFilterVector keep 
) const
virtual

Implements AdcSuppressService.

Definition at line 49 of file Legacy35tZeroSuppressService_service.cc.

49  {
50  const unsigned int nsig = sigs.size();
51  keep.clear();
52  keep.resize(nsig, false);
53  if ( nsig == 0 ) return 0;
54  AdcCodeHelper ach(64);
55  for ( unsigned int isig=0; isig<nsig; ++isig ) {
56  AdcCount rawsig = sigs[isig];
57  AdcSignal pedsig = ach.subtract(ped, rawsig);
58  if ( m_SuppressStickyBits ) {
59  if ( ach.hasStickyBits(rawsig) && ach.isSmall(pedsig) ) {
60  std::cout << "Legacy35tZeroSuppressService::filter: Suppressing sticky ADC value " << pedsig
61  << " (raw=" << rawsig << ", ped=" << ped << ")" << endl;
62  pedsig = 0.0;
63  }
64  }
65  if ( fabs(pedsig) > m_AdcThreshold ) {
66  Index isig1 = 0;
67  if ( m_TickRange < isig ) isig1 = isig - m_TickRange;
68  Index isig2 = isig + m_TickRange;
69  if ( isig2 > nsig ) isig2 = nsig;
70  for ( Index jsig=isig1; jsig<=isig2; ++jsig ) keep[jsig] = true;
71  }
72  }
73  // Make gaps between unsupressed blocks < MinTickGap.
74  bool inGap = false;
75  unsigned int jsig1 = 0; // Start of gap.
76  unsigned int jsig2 = 0; // End of gap.
77  for ( unsigned int isig=0; isig<nsig; ++isig ) {
78  // End of a gap;
79  if ( inGap && (isig+1==nsig || keep[isig]) ) {
80  inGap = false;
81  if ( (jsig2 - jsig1 + 1) < m_MinTickGap ) {
82  for ( unsigned int jsig=jsig1; jsig<=jsig2; ++jsig ) {
83  keep[jsig] = true;
84  }
85  }
86  // In a gap.
87  } else if ( inGap ) {
88  jsig2 = isig;
89  // Start of gap.
90  } else if ( !inGap && !keep[isig] ) {
91  inGap = true;
92  jsig1 = isig;
93  jsig2 = jsig1;
94  }
95  }
96  return 0;
97 }
float AdcSignal
Definition: AdcTypes.h:21
unsigned int Index
short AdcCount
Definition: AdcTypes.h:18
QTextStream & endl(QTextStream &s)
ostream & Legacy35tZeroSuppressService::print ( std::ostream &  out = std::cout,
std::string  prefix = "" 
) const
virtual

Implements AdcSuppressService.

Definition at line 101 of file Legacy35tZeroSuppressService_service.cc.

101  {
102  out << prefix << "Legacy35tZeroSuppressService:" << endl;
103  out << prefix << " AdcThreshold: " << m_AdcThreshold << endl;
104  out << prefix << " MinTickGap: " << m_MinTickGap << endl;
105  out << prefix << " TickRange: " << m_TickRange << endl;
106  out << prefix << " SuppressStickyBits: " << sbool(m_SuppressStickyBits);
107  return out;
108 }
QTextStream & endl(QTextStream &s)

Member Data Documentation

float Legacy35tZeroSuppressService::m_AdcThreshold
private

Definition at line 59 of file Legacy35tZeroSuppressService.h.

unsigned int Legacy35tZeroSuppressService::m_MinTickGap
private

Definition at line 61 of file Legacy35tZeroSuppressService.h.

bool Legacy35tZeroSuppressService::m_SuppressStickyBits
private

Definition at line 62 of file Legacy35tZeroSuppressService.h.

unsigned int Legacy35tZeroSuppressService::m_TickRange
private

Definition at line 60 of file Legacy35tZeroSuppressService.h.


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