Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
dunedataprep
dunedataprep
DataPrep
Service
DuneDeconvolutionService_service.cc
Go to the documentation of this file.
1
// DuneDeconvolutionService_service.cc
2
3
#include "
DuneDeconvolutionService.h
"
4
#include <iostream>
5
#include "
art/Framework/Services/Registry/ServiceHandle.h
"
6
#include "
art/Framework/Services/Registry/ServiceDefinitionMacros.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
16
DuneDeconvolutionService::
17
DuneDeconvolutionService
(
fhicl::ParameterSet
const
& pset,
art::ActivityRegistry
&)
18
: m_LogLevel(1) {
19
const
string
myname =
"DuneDeconvolutionService::ctor: "
;
20
pset.
get_if_present
<
int
>(
"LogLevel"
,
m_LogLevel
);
21
print
(cout, myname);
22
}
23
24
//**********************************************************************
25
26
int
DuneDeconvolutionService::
27
update
(
detinfo::DetectorClocksData
const
& clockData,
28
AdcChannelData
&
data
)
const
{
29
const
string
myname =
"DuneDeconvolutionService::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.
36
art::ServiceHandle<util::LArFFT>
hFFT;
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.
53
art::ServiceHandle<util::SignalShapingServiceDUNE>
hsss;
54
if
(
m_LogLevel
>= 3 ) cout << myname <<
" Deconvoluting."
<<
endl
;
55
hsss->
Deconvolute
(clockData, 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
}
64
65
//**********************************************************************
66
67
std::ostream&
DuneDeconvolutionService::
68
print
(std::ostream& out,
std::string
prefix
)
const
{
69
out << prefix <<
"DuneDeconvolutionService:"
<<
endl
;
70
out << prefix <<
" LogLevel: "
<<
m_LogLevel
<<
endl
;
71
return
out;
72
}
73
74
//**********************************************************************
75
76
DEFINE_ART_SERVICE_INTERFACE_IMPL
(
DuneDeconvolutionService
,
AdcDeconvolutionService
)
77
78
//**********************************************************************
util::SignalShapingServiceDUNE::Deconvolute
void Deconvolute(detinfo::DetectorClocksData const &clockData, Channel channel, std::vector< T > &func) const
Definition:
SignalShapingServiceDUNE.h:225
art::ServiceHandle< util::LArFFT >
DuneDeconvolutionService::DuneDeconvolutionService
DuneDeconvolutionService(fhicl::ParameterSet const &pset, art::ActivityRegistry &)
Definition:
DuneDeconvolutionService_service.cc:17
submit_ppfxjobs.prefix
string prefix
Definition:
submit_ppfxjobs.py:128
AdcDeconvolutionService
Definition:
AdcDeconvolutionService.h:17
string
std::string string
Definition:
nybbler.cc:12
DuneDeconvolutionService::print
std::ostream & print(std::ostream &out=std::cout, std::string prefix="") const
Definition:
DuneDeconvolutionService_service.cc:68
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
DuneDeconvolutionService::update
int update(detinfo::DetectorClocksData const &clockData, AdcChannelData &data) const
Definition:
DuneDeconvolutionService_service.cc:27
DuneDeconvolutionService.h
cache_state.sam
sam
Definition:
cache_state.py:334
geo::vect::norm
auto norm(Vector const &v)
Return norm of the specified vector.
Definition:
geo_vectors_utils.h:997
make_THn_beam_input.data
data
Definition:
make_THn_beam_input.py:80
AdcChannelData::channel
Channel channel() const
Definition:
AdcChannelData.h:199
DuneDeconvolutionService
Definition:
DuneDeconvolutionService.h:26
detinfo::DetectorClocksData
Contains all timing reference information for the detector.
Definition:
DetectorClocksData.h:283
art::ActivityRegistry
Definition:
ActivityRegistry.h:52
AdcChannel
unsigned int AdcChannel
Definition:
AdcTypes.h:50
fhicl::ParameterSet::get_if_present
std::optional< T > get_if_present(std::string const &key) const
Definition:
ParameterSet.h:224
LArFFT.h
ServiceDefinitionMacros.h
AdcSignalVector
std::vector< AdcSignal > AdcSignalVector
Definition:
AdcTypes.h:22
DuneDeconvolutionService::m_LogLevel
int m_LogLevel
Definition:
DuneDeconvolutionService.h:40
util::SignalShapingServiceDUNE::GetDeconNorm
double GetDeconNorm() const override
Definition:
SignalShapingServiceDUNE_service.cc:369
AdcChannelData::samples
AdcSignalVector samples
Definition:
AdcChannelData.h:131
endl
QTextStream & endl(QTextStream &s)
Definition:
qtextstream.cpp:2030
fhicl::ParameterSet
Definition:
ParameterSet.h:36
DEFINE_ART_SERVICE_INTERFACE_IMPL
#define DEFINE_ART_SERVICE_INTERFACE_IMPL(svc, iface)
Definition:
ServiceDefinitionMacros.h:42
Generated by
1.8.11