Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
dunedataprep
dunedataprep
DataPrep
Service
DuneDPhaseDeconvolutionService_service.cc
Go to the documentation of this file.
1
// DuneDPhaseDeconvolutionService_service.cc
2
3
#include "
DuneDPhaseDeconvolutionService.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/SignalShapingServiceDUNEDPhase.h
"
9
10
using
std::string
;
11
using
std::cout;
12
using
std::endl
;
13
14
//**********************************************************************
15
16
DuneDPhaseDeconvolutionService::
17
DuneDPhaseDeconvolutionService
(
fhicl::ParameterSet
const
& pset,
art::ActivityRegistry
&)
18
: m_LogLevel(1) {
19
const
string
myname =
"DuneDPhaseDeconvolutionService::ctor: "
;
20
pset.
get_if_present
<
int
>(
"LogLevel"
,
m_LogLevel
);
21
print
(cout, myname);
22
}
23
24
//**********************************************************************
25
26
int
DuneDPhaseDeconvolutionService::
27
update
(
detinfo::DetectorClocksData
const
&,
28
AdcChannelData
&
data
)
const
{
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.
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::SignalShapingServiceDUNEDPhase>
hsss;
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
}
64
65
//**********************************************************************
66
67
std::ostream&
DuneDPhaseDeconvolutionService::
68
print
(std::ostream& out,
std::string
prefix
)
const
{
69
out << prefix <<
"DuneDPhaseDeconvolutionService:"
<<
endl
;
70
out << prefix <<
" LogLevel: "
<<
m_LogLevel
<<
endl
;
71
return
out;
72
}
73
74
//**********************************************************************
75
76
DEFINE_ART_SERVICE_INTERFACE_IMPL
(
DuneDPhaseDeconvolutionService
,
AdcDeconvolutionService
)
77
78
//**********************************************************************
art::ServiceHandle< util::LArFFT >
util::SignalShapingServiceDUNEDPhase::GetDeconNorm
double GetDeconNorm() const override
Definition:
SignalShapingServiceDUNEDPhase_service.cc:476
submit_ppfxjobs.prefix
string prefix
Definition:
submit_ppfxjobs.py:128
AdcDeconvolutionService
Definition:
AdcDeconvolutionService.h:17
string
std::string string
Definition:
nybbler.cc:12
DuneDPhaseDeconvolutionService::m_LogLevel
int m_LogLevel
Definition:
DuneDPhaseDeconvolutionService.h:40
DuneDPhaseDeconvolutionService::print
std::ostream & print(std::ostream &out=std::cout, std::string prefix="") const
Definition:
DuneDPhaseDeconvolutionService_service.cc:68
AdcChannelData
Definition:
AdcChannelData.h:95
DuneDPhaseDeconvolutionService
Definition:
DuneDPhaseDeconvolutionService.h:26
ServiceHandle.h
util::LArFFT::FFTSize
int FFTSize() const
Definition:
LArFFT.h:69
cache_state.sam
sam
Definition:
cache_state.py:334
DuneDPhaseDeconvolutionService::update
int update(detinfo::DetectorClocksData const &clockData, AdcChannelData &data) const
Definition:
DuneDPhaseDeconvolutionService_service.cc:27
DuneDPhaseDeconvolutionService.h
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
DuneDPhaseDeconvolutionService::DuneDPhaseDeconvolutionService
DuneDPhaseDeconvolutionService(fhicl::ParameterSet const &pset, art::ActivityRegistry &)
Definition:
DuneDPhaseDeconvolutionService_service.cc:17
make_THn_beam_input.data
data
Definition:
make_THn_beam_input.py:80
AdcChannelData::channel
Channel channel() const
Definition:
AdcChannelData.h:199
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
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
DEFINE_ART_SERVICE_INTERFACE_IMPL
#define DEFINE_ART_SERVICE_INTERFACE_IMPL(svc, iface)
Definition:
ServiceDefinitionMacros.h:42
Generated by
1.8.11