Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
dunedataprep
dunedataprep
DataPrep
Tool
VintageDeconvoluter_tool.cc
Go to the documentation of this file.
1
// VintageDeconvoluter_tool.cc
2
3
#include "
VintageDeconvoluter.h
"
4
#include <iostream>
5
#include "
art/Framework/Services/Registry/ServiceHandle.h
"
6
#include "
lardata/DetectorInfoServices/DetectorClocksService.h
"
7
#include "
lardata/Utilities/LArFFT.h
"
8
#include "
dunecore/Utilities/SignalShapingServiceDUNE.h
"
9
10
using
std::string
;
11
using
std::cout;
12
using
std::endl
;
13
14
//**********************************************************************
15
// Class methods.
16
//**********************************************************************
17
18
VintageDeconvoluter::VintageDeconvoluter
(
fhicl::ParameterSet
const
&
ps
)
19
: m_LogLevel(ps.
get
<
int
>(
"LogLevel"
)) {
20
const
string
myname =
"VintageDeconvoluter::ctor: "
;
21
if
(
m_LogLevel
>= 1 ) {
22
cout << myname <<
"Parameters:"
<<
endl
;
23
cout << myname <<
" LogLevel: "
<<
m_LogLevel
<<
endl
;
24
art::ServiceHandle<util::SignalShapingServiceDUNE>
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
VintageDeconvoluter::update
(
AdcChannelData
& acd)
const
{
34
const
string
myname =
"VintageDeconvoluter::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::SignalShapingServiceDUNE>
hsss;
61
if
(
m_LogLevel
>= 3 ) cout << myname <<
" Deconvoluting."
<<
endl
;
62
auto
const
clockData =
art::ServiceHandle<detinfo::DetectorClocksService>
()->DataForJob();
63
hsss->
Deconvolute
(clockData, chan, samples);
64
if
( pad ) samples.resize(nsam);
65
if
(
m_LogLevel
>= 3 ) cout << myname <<
" Normalizing."
<<
endl
;
66
float
dnorm = hsss->
GetDeconNorm
();
67
float
norm
= dnorm > 0.0 ? 1.0/dnorm : 1.0;
68
if
(
m_LogLevel
>= 3 ) cout << myname <<
" Scale factor: "
<< norm <<
endl
;
69
for
(
float
&
sam
: samples )
sam
*=
norm
;
70
acd.
sampleUnit
=
"Q_{dco}"
;
71
acd.
sampleNoise
= hsss->
GetDeconNoise
(chan);
72
// Done.
73
return
ret;
74
}
75
76
//**********************************************************************
77
78
DEFINE_ART_CLASS_TOOL
(
VintageDeconvoluter
)
util::SignalShapingServiceDUNE::Deconvolute
void Deconvolute(detinfo::DetectorClocksData const &clockData, Channel channel, std::vector< T > &func) const
Definition:
SignalShapingServiceDUNE.h:225
art::ServiceHandle< util::SignalShapingServiceDUNE >
DEFINE_ART_CLASS_TOOL
#define DEFINE_ART_CLASS_TOOL(tool)
Definition:
ToolMacros.h:42
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
VintageDeconvoluter::m_LogLevel
int m_LogLevel
Definition:
VintageDeconvoluter.h:34
VintageDeconvoluter::VintageDeconvoluter
VintageDeconvoluter(fhicl::ParameterSet const &ps)
Definition:
VintageDeconvoluter_tool.cc:18
util::SignalShapingServiceDUNE::GetDeconNoise
double GetDeconNoise(Channel channel) const override
Definition:
SignalShapingServiceDUNE_service.cc:332
AdcChannelData
Definition:
AdcChannelData.h:95
SignalShapingServiceDUNE.h
Service to provide microboone-specific signal shaping for simulation (convolution) and reconstruction...
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
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
LArFFT.h
VintageDeconvoluter::update
DataMap update(AdcChannelData &acd) const override
Definition:
VintageDeconvoluter_tool.cc:33
DetectorClocksService.h
VintageDeconvoluter.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
util::SignalShapingServiceDUNE::GetDeconNorm
double GetDeconNorm() const override
Definition:
SignalShapingServiceDUNE_service.cc:369
VintageDeconvoluter
Definition:
VintageDeconvoluter.h:21
DataMap
Definition:
DataMap.h:43
AdcChannelData::samples
AdcSignalVector samples
Definition:
AdcChannelData.h:131
endl
QTextStream & endl(QTextStream &s)
Definition:
qtextstream.cpp:2030
fhicl::ParameterSet
Definition:
ParameterSet.h:36
Generated by
1.8.11