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

#include <DuneDPhaseDeconvolutionService.h>

Inheritance diagram for DuneDPhaseDeconvolutionService:
AdcDeconvolutionService

Public Member Functions

 DuneDPhaseDeconvolutionService (fhicl::ParameterSet const &pset, art::ActivityRegistry &)
 
int update (detinfo::DetectorClocksData const &clockData, AdcChannelData &data) const
 
std::ostream & print (std::ostream &out=std::cout, std::string prefix="") const
 
- Public Member Functions inherited from AdcDeconvolutionService
virtual ~AdcDeconvolutionService ()=default
 

Private Attributes

int m_LogLevel
 

Detailed Description

Definition at line 26 of file DuneDPhaseDeconvolutionService.h.

Constructor & Destructor Documentation

DuneDPhaseDeconvolutionService::DuneDPhaseDeconvolutionService ( fhicl::ParameterSet const &  pset,
art::ActivityRegistry  
)

Definition at line 17 of file DuneDPhaseDeconvolutionService_service.cc.

18 : m_LogLevel(1) {
19  const string myname = "DuneDPhaseDeconvolutionService::ctor: ";
20  pset.get_if_present<int>("LogLevel", m_LogLevel);
21  print(cout, myname);
22 }
std::ostream & print(std::ostream &out=std::cout, std::string prefix="") const

Member Function Documentation

std::ostream & DuneDPhaseDeconvolutionService::print ( std::ostream &  out = std::cout,
std::string  prefix = "" 
) const
virtual

Implements AdcDeconvolutionService.

Definition at line 68 of file DuneDPhaseDeconvolutionService_service.cc.

68  {
69  out << prefix << "DuneDPhaseDeconvolutionService:" << endl;
70  out << prefix << " LogLevel: " << m_LogLevel << endl;
71  return out;
72 }
QTextStream & endl(QTextStream &s)
int DuneDPhaseDeconvolutionService::update ( detinfo::DetectorClocksData const &  clockData,
AdcChannelData data 
) const
virtual

Implements AdcDeconvolutionService.

Definition at line 27 of file DuneDPhaseDeconvolutionService_service.cc.

28  {
29  const string myname = "DuneDPhaseDeconvolutionService::update: ";
30  AdcChannel chan = data.channel();
31  AdcSignalVector& samples = data.samples;
32  unsigned int nsam = samples.size();
33  if ( m_LogLevel >= 2 ) cout << myname << "Deconvoluting channel " << chan
34  << " with " << nsam << " samples." << endl;
35  // Fetch the FFT size.
37  unsigned int fftsize = hFFT->FFTSize();
38  if ( nsam > fftsize ) {
39  cout << myname << "ERROR: Data has too many ticks for FFT: "
40  << nsam << " > " << fftsize << "." << endl;
41  return 1;
42  }
43  // Pad the data to the FFT size.
44  bool pad = fftsize > nsam;
45  if ( pad ) {
46  if ( m_LogLevel >= 3 ) cout << myname << " Padding sample vector to " << fftsize << endl;
47  samples.resize(fftsize);
48  for ( unsigned int isam=nsam; isam<fftsize; ++isam ) {
49  samples[isam] = samples[isam-nsam];
50  }
51  }
52  // Deconvolute.
54  if ( m_LogLevel >= 3 ) cout << myname << " Deconvoluting." << endl;
55  hsss->Deconvolute(chan, samples);
56  if ( pad ) samples.resize(nsam);
57  if ( m_LogLevel >= 3 ) cout << myname << " Normalizing." << endl;
58  float norm = 1.0/hsss->GetDeconNorm();
59  if ( m_LogLevel >= 3 ) cout << myname << " Scale factor: " << norm << endl;
60  for ( float& sam : samples ) sam *= norm;
61  // Done.
62  return 0;
63 }
int FFTSize() const
Definition: LArFFT.h:69
auto norm(Vector const &v)
Return norm of the specified vector.
Channel channel() const
unsigned int AdcChannel
Definition: AdcTypes.h:50
std::vector< AdcSignal > AdcSignalVector
Definition: AdcTypes.h:22
AdcSignalVector samples
QTextStream & endl(QTextStream &s)
void Deconvolute(unsigned int channel, std::vector< T > &func) const

Member Data Documentation

int DuneDPhaseDeconvolutionService::m_LogLevel
private

Definition at line 40 of file DuneDPhaseDeconvolutionService.h.


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