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

#include <Dune35tZeroSuppressService.h>

Inheritance diagram for Dune35tZeroSuppressService:
AdcSuppressService

Public Types

typedef unsigned int Index
 
- Public Types inherited from AdcSuppressService
typedef unsigned int Channel
 

Public Member Functions

 Dune35tZeroSuppressService (AdcCount ts, AdcCount tl, AdcCount td, Index ns, Index nl, Index nd, Index nt)
 
 Dune35tZeroSuppressService (fhicl::ParameterSet const &pset, art::ActivityRegistry &)
 
int filter (const AdcCountVector &sigs, Channel chan, AdcPedestal ped, AdcFilterVector &keep) const
 
std::ostream & print (std::ostream &out=std::cout, std::string prefix="") const
 
void setDebug (int dbg)
 
- Public Member Functions inherited from AdcSuppressService
virtual ~AdcSuppressService ()=default
 
int filter (AdcCountSelection &acs)
 

Private Attributes

AdcCount m_ts
 
AdcCount m_tl
 
AdcCount m_td
 
Index m_ns
 
Index m_nl
 
Index m_nd
 
Index m_nt
 
int m_LogLevel
 

Detailed Description

Definition at line 30 of file Dune35tZeroSuppressService.h.

Member Typedef Documentation

typedef unsigned int Dune35tZeroSuppressService::Index

Definition at line 34 of file Dune35tZeroSuppressService.h.

Constructor & Destructor Documentation

Dune35tZeroSuppressService::Dune35tZeroSuppressService ( AdcCount  ts,
AdcCount  tl,
AdcCount  td,
Index  ns,
Index  nl,
Index  nd,
Index  nt 
)
Dune35tZeroSuppressService::Dune35tZeroSuppressService ( fhicl::ParameterSet const &  pset,
art::ActivityRegistry  
)

Member Function Documentation

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

Implements AdcSuppressService.

Definition at line 102 of file Dune35tZeroSuppressService_service.cc.

102  {
103  const string myname = "ZeroSuppress35t::filter: ";
104  if ( m_LogLevel >= 2 ) cout << myname << "Filtering channel " << chan << " with tick count " << sigs.size() << endl;
105  bool m_skipStuck = false;
106  AdcCount m_ts = 0;
107  unsigned int nsig = sigs.size();
108  keep.clear();
109  keep.resize(nsig, false);
110  // Loop over signals.
111  SigState state = OUT;
112  unsigned int nlow = 0;
113  for ( unsigned int isig=0; isig<nsig; ++isig ) {
114  AdcCount sig = sigs[isig];
115  // Evaluate a running signal sum of the preceding m_nl signals.
116  RunningSum rs(sigs, ped, isig, m_ns, m_ts, m_skipStuck);
117  AdcCount asigsum = std::abs(rs.sigsum);
118  if ( m_LogLevel >= 3 ) cout << myname << setw(6) << isig << setw(6) << sig << setw(5) << sstate(state) << endl;
119  // Last tick is outside a signal.
120  if ( state == OUT || state == END ) {
121  // If this tick is above TL, we are in the live region of a signal.
122  // Keep the NL preceding signals.
123  AdcCount sumthresh = m_tl*rs.count;
124  bool keepit = asigsum > sumthresh;
125  if ( m_LogLevel >= 3 ) cout << myname << " RS sum/thresh=" << setw(3) << rs.sigsum << "/" << setw(3) << sumthresh << endl;
126  if ( keepit ) {
127  if ( m_LogLevel == 2 ) cout << myname << setw(6) << isig << ": RS sum/thresh=" << setw(3) << rs.sigsum
128  << "/" << setw(3) << sumthresh << endl;
129  state = LIVE;
130  unsigned int jsig1 = 0;
131  if ( isig > m_nl ) jsig1 = isig - m_nl;
132  unsigned int jsig2 = isig;
133  for ( unsigned int jsig=jsig1; jsig<jsig2; ++jsig) {
134  keep[jsig] = true;
135  }
136  } else {
137  state = OUT;
138  }
139  } else {
140  // Last tick is is in the live region of a signal.
141  AdcCount sumthresh = m_td*rs.count;
142  if ( m_LogLevel >= 3 ) cout << myname << " RS sum/thresh=" << setw(3) << rs.sigsum << "/" << setw(3) << sumthresh << endl;
143  if ( state == LIVE ) {
144  // If this tick is below TD, we are in the dead region of a signal.
145  if ( asigsum <= sumthresh ) {
146  state = DEAD;
147  nlow = 1;
148  }
149  // Last tick is is in the dead region of a signal.
150  } else if ( state == DEAD ) {
151  // If signal is above TD, we are back in the live region.
152  if ( asigsum > sumthresh ) {
153  state = LIVE;
154  nlow = 0;
155  // If this is the ND'th consecutive signal in the dead region, we
156  // have reached the end of the signal.
157  // Keep this signal and a tail.
158  } else if ( ++nlow >= m_nd ) {
159  state = END;
160  nlow = 0;
161  // Protect the tail.
162  unsigned int jsig1 = isig + 1;
163  unsigned int jsig2 = jsig1 + m_nt;
164  if ( jsig2 > nsig ) jsig2 = nsig;
165  for ( unsigned int jsig=jsig1; jsig<jsig2; ++jsig) {
166  keep[jsig] = true;
167  }
168  }
169  } else {
170  assert(false);
171  }
172  }
173  if ( state != OUT ) keep[isig] = true;
174  }
175  return 0;
176 }
T abs(T value)
Q_EXPORT QTSManip setw(int w)
Definition: qtextstream.h:331
short AdcCount
Definition: AdcTypes.h:18
QTextStream & endl(QTextStream &s)
ostream & Dune35tZeroSuppressService::print ( std::ostream &  out = std::cout,
std::string  prefix = "" 
) const
virtual

Implements AdcSuppressService.

Definition at line 180 of file Dune35tZeroSuppressService_service.cc.

180  {
181  out << prefix << " TS = " << m_ts << endl;
182  out << prefix << " TL = " << m_tl << endl;
183  out << prefix << " TD = " << m_td << endl;
184  out << prefix << " NS = " << m_ns << endl;
185  out << prefix << " NL = " << m_nl << endl;
186  out << prefix << " ND = " << m_nd << endl;
187  out << prefix << " NT = " << m_nt << endl;
188  out << prefix << "LogLevel: " << m_LogLevel << endl;
189  return out;
190 }
QTextStream & endl(QTextStream &s)
void Dune35tZeroSuppressService::setDebug ( int  dbg)

Definition at line 194 of file Dune35tZeroSuppressService_service.cc.

194  {
195  m_LogLevel = dbg;
196 }
bool dbg

Member Data Documentation

int Dune35tZeroSuppressService::m_LogLevel
private

Definition at line 61 of file Dune35tZeroSuppressService.h.

Index Dune35tZeroSuppressService::m_nd
private

Definition at line 59 of file Dune35tZeroSuppressService.h.

Index Dune35tZeroSuppressService::m_nl
private

Definition at line 58 of file Dune35tZeroSuppressService.h.

Index Dune35tZeroSuppressService::m_ns
private

Definition at line 57 of file Dune35tZeroSuppressService.h.

Index Dune35tZeroSuppressService::m_nt
private

Definition at line 60 of file Dune35tZeroSuppressService.h.

AdcCount Dune35tZeroSuppressService::m_td
private

Definition at line 56 of file Dune35tZeroSuppressService.h.

AdcCount Dune35tZeroSuppressService::m_tl
private

Definition at line 55 of file Dune35tZeroSuppressService.h.

AdcCount Dune35tZeroSuppressService::m_ts
private

Definition at line 54 of file Dune35tZeroSuppressService.h.


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