Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
dunedataprep
dunedataprep
DataPrep
Tool
PddpVintageDeconvoluter_tool.cc
Go to the documentation of this file.
1
// PddpVintageDeconvoluter_tool.cc
2
3
#include "
PddpVintageDeconvoluter.h
"
4
#include <iostream>
5
#include "
art/Framework/Services/Registry/ServiceHandle.h
"
6
#include "
lardata/Utilities/LArFFT.h
"
7
//#include "dunecore/Utilities/SignalShapingServiceDUNE.h"
8
#include "
dunecore/Utilities/SignalShapingServiceDUNEDPhase.h
"
9
10
using
std::string
;
11
using
std::cout;
12
using
std::endl
;
13
14
//**********************************************************************
15
// Class methods.
16
//**********************************************************************
17
18
PddpVintageDeconvoluter::PddpVintageDeconvoluter
(
fhicl::ParameterSet
const
&
ps
)
19
: m_LogLevel(ps.
get
<
int
>(
"LogLevel"
)) {
20
const
string
myname =
"PddpVintageDeconvoluter::ctor: "
;
21
if
(
m_LogLevel
>= 1 ) {
22
cout << myname <<
"Parameters:"
<<
endl
;
23
cout << myname <<
" LogLevel: "
<<
m_LogLevel
<<
endl
;
24
art::ServiceHandle<util::SignalShapingServiceDUNEDPhase>
hsss;
25
float
dnorm = hsss->
GetDeconNorm
();
26
float
norm
= dnorm > 0.0 ? 1.0/dnorm : 1.0;
27
cout << myname <<
"Normalization factor: "
<< norm <<
endl
;
28
}
29
}
30
31
//**********************************************************************
32
33
DataMap
PddpVintageDeconvoluter::update
(
AdcChannelData
& acd)
const
{
34
const
string
myname =
"PddpVintageDeconvoluter::view: "
;
35
DataMap
ret;
36
AdcChannel
chan = acd.
channel
();
37
AdcSignalVector
& samples = acd.
samples
;
38
unsigned
int
nsam = samples.size();
39
if
(
m_LogLevel
>= 2 ) cout << myname <<
"Deconvoluting channel "
<< chan
40
<<
" with "
<< nsam <<
" samples."
<<
endl
;
41
// Fetch the FFT size.
42
art::ServiceHandle<util::LArFFT>
hFFT;
43
unsigned
int
fftsize = hFFT->
FFTSize
();
44
if
( nsam > fftsize ) {
45
cout << myname <<
"ERROR: Data has too many ticks for FFT: "
46
<< nsam <<
" > "
<< fftsize <<
"."
<<
endl
;
47
return
ret.
setStatus
(1);
48
}
49
// Pad the data to the FFT size.
50
bool
pad = fftsize > nsam;
51
if
( pad ) {
52
if
(
m_LogLevel
>= 3 ) cout << myname <<
" Padding sample vector to "
<< fftsize <<
endl
;
53
samples.resize(fftsize);
54
for
(
unsigned
int
isam=nsam; isam<fftsize; ++isam ) {
55
//samples[isam] = samples[isam-nsam];
56
samples[isam] = 0;
57
}
58
}
59
// Deconvolute.
60
art::ServiceHandle<util::SignalShapingServiceDUNEDPhase>
hsss;
61
if
(
m_LogLevel
>= 3 ) cout << myname <<
" Deconvoluting."
<<
endl
;
62
hsss->
Deconvolute
(chan, samples);
63
if
( pad ) samples.resize(nsam);
64
if
(
m_LogLevel
>= 3 ) cout << myname <<
" Normalizing."
<<
endl
;
65
float
dnorm = hsss->
GetDeconNorm
();
66
float
norm
= dnorm > 0.0 ? 1.0/dnorm : 1.0;
67
if
(
m_LogLevel
>= 3 ) cout << myname <<
" Scale factor: "
<< norm <<
endl
;
68
for
(
float
&
sam
: samples )
sam
*=
norm
;
69
acd.
sampleUnit
=
"Q_{dco}"
;
70
acd.
sampleNoise
= hsss->
GetDeconNoise
(chan);
71
// Done.
72
return
ret;
73
}
74
75
//**********************************************************************
76
77
DEFINE_ART_CLASS_TOOL
(
PddpVintageDeconvoluter
)
art::ServiceHandle< util::SignalShapingServiceDUNEDPhase >
DEFINE_ART_CLASS_TOOL
#define DEFINE_ART_CLASS_TOOL(tool)
Definition:
ToolMacros.h:42
util::SignalShapingServiceDUNEDPhase::GetDeconNorm
double GetDeconNorm() const override
Definition:
SignalShapingServiceDUNEDPhase_service.cc:476
PddpVintageDeconvoluter
Definition:
PddpVintageDeconvoluter.h:21
DataMap::setStatus
DataMap & setStatus(int stat)
Definition:
DataMap.h:130
string
std::string string
Definition:
nybbler.cc:12
AdcChannelData::sampleUnit
Name sampleUnit
Definition:
AdcChannelData.h:133
PddpVintageDeconvoluter::m_LogLevel
int m_LogLevel
Definition:
PddpVintageDeconvoluter.h:34
PddpVintageDeconvoluter::PddpVintageDeconvoluter
PddpVintageDeconvoluter(fhicl::ParameterSet const &ps)
Definition:
PddpVintageDeconvoluter_tool.cc:18
AdcChannelData
Definition:
AdcChannelData.h:95
PddpVintageDeconvoluter::update
DataMap update(AdcChannelData &acd) const override
Definition:
PddpVintageDeconvoluter_tool.cc:33
util::SignalShapingServiceDUNEDPhase::GetDeconNoise
double GetDeconNoise(Channel channel) const override
Definition:
SignalShapingServiceDUNEDPhase_service.cc:271
ServiceHandle.h
util::LArFFT::FFTSize
int FFTSize() const
Definition:
LArFFT.h:69
AdcChannelData::sampleNoise
AdcSignal sampleNoise
Definition:
AdcChannelData.h:134
cache_state.sam
sam
Definition:
cache_state.py:334
genie::units::ps
static constexpr double ps
Definition:
Units.h:99
SignalShapingServiceDUNEDPhase.h
Service to provide DUNE dual-phase signal shaping for simulation (convolution) and reconstruction (de...
geo::vect::norm
auto norm(Vector const &v)
Return norm of the specified vector.
Definition:
geo_vectors_utils.h:997
keras_to_tensorflow.int
int
Definition:
keras_to_tensorflow.py:69
AdcChannelData::channel
Channel channel() const
Definition:
AdcChannelData.h:199
AdcChannel
unsigned int AdcChannel
Definition:
AdcTypes.h:50
PddpVintageDeconvoluter.h
LArFFT.h
AdcSignalVector
std::vector< AdcSignal > AdcSignalVector
Definition:
AdcTypes.h:22
art::get
auto const & get(AssnsNode< L, R, D > const &r)
Definition:
AssnsNode.h:115
DataMap
Definition:
DataMap.h:43
AdcChannelData::samples
AdcSignalVector samples
Definition:
AdcChannelData.h:131
endl
QTextStream & endl(QTextStream &s)
Definition:
qtextstream.cpp:2030
util::SignalShapingServiceDUNEDPhase::Deconvolute
void Deconvolute(unsigned int channel, std::vector< T > &func) const
Definition:
SignalShapingServiceDUNEDPhase.h:180
fhicl::ParameterSet
Definition:
ParameterSet.h:36
Generated by
1.8.11