Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
dunedataprep
dunedataprep
DataPrep
Service
MultiChannelNoiseRemovalService_service.cc
Go to the documentation of this file.
1
// MultiChannelNoiseRemovalService_service.cc
2
3
#include "
MultiChannelNoiseRemovalService.h
"
4
#include "
dunecore/DuneInterface/Service/AdcChannelNoiseRemovalService.h
"
5
#include <iostream>
6
#include "
art/Framework/Services/Registry/ServiceHandle.h
"
7
#include "
art/Framework/Services/Registry/ServiceDefinitionMacros.h
"
8
9
using
std::cout;
10
using
std::endl
;
11
using
std::ostream;
12
using
std::string
;
13
using
art::ServiceHandle
;
14
15
//**********************************************************************
16
17
MultiChannelNoiseRemovalService::
18
MultiChannelNoiseRemovalService
(
fhicl::ParameterSet
const
& pset,
art::ActivityRegistry
&)
19
: m_LogLevel(1) {
20
const
string
myname =
"MultiChannelNoiseRemovalService::ctor: "
;
21
pset.
get_if_present
<
int
>(
"LogLevel"
,
m_LogLevel
);
22
// Get service.
23
m_pAdcChannelNoiseRemovalService
= &*
ServiceHandle<AdcChannelNoiseRemovalService>
();
24
print
(cout, myname);
25
}
26
27
//**********************************************************************
28
29
int
MultiChannelNoiseRemovalService::update
(
AdcChannelDataMap
& datamap)
const
{
30
const
string
myname =
"MultiChannelNoiseRemovalService:update: "
;
31
if
(
m_pAdcChannelNoiseRemovalService
==
nullptr
) {
32
cout << myname <<
"ERROR: AdcChannelNoiseRemovalService not found."
<<
endl
;
33
return
1;
34
}
35
if
(
m_LogLevel
>= 2 ) cout << myname <<
"Updating "
<< datamap.size() <<
" channel"
36
<< (datamap.size()!=1 ?
""
:
"s"
) <<
"."
<<
endl
;
37
int
rstat = 0;
38
for
( AdcChannelDataMap::value_type& chdata : datamap ) {
39
AdcChannelData
&
data
= chdata.second;
40
if
(
m_pAdcChannelNoiseRemovalService
->
update
(data) ) ++rstat;
41
}
42
if
( rstat != 0 ) cout << myname <<
"WARNING: Update failed for "
<< rstat <<
" of "
43
<< datamap.size() <<
" channel"
<< (rstat!=1 ?
""
:
"s"
) <<
"."
<<
endl
;
44
return
0;
45
}
46
47
//**********************************************************************
48
49
ostream&
MultiChannelNoiseRemovalService::
50
print
(ostream& out,
string
prefix
)
const
{
51
out << prefix <<
"MultiChannelNoiseRemovalService:"
<<
endl
;
52
out << prefix <<
" LogLevel: "
<<
m_LogLevel
<<
endl
;
53
return
out;
54
}
55
56
//**********************************************************************
57
58
DEFINE_ART_SERVICE_INTERFACE_IMPL
(
MultiChannelNoiseRemovalService
,
AdcNoiseRemovalService
)
59
60
//**********************************************************************
art::ServiceHandle
Definition:
ServiceHandle.h:37
MultiChannelNoiseRemovalService
Definition:
MultiChannelNoiseRemovalService.h:20
AdcNoiseRemovalService
Definition:
AdcNoiseRemovalService.h:16
submit_ppfxjobs.prefix
string prefix
Definition:
submit_ppfxjobs.py:128
string
std::string string
Definition:
nybbler.cc:12
AdcChannelData
Definition:
AdcChannelData.h:95
MultiChannelNoiseRemovalService.h
ServiceHandle.h
MultiChannelNoiseRemovalService::m_pAdcChannelNoiseRemovalService
const AdcChannelNoiseRemovalService * m_pAdcChannelNoiseRemovalService
Definition:
MultiChannelNoiseRemovalService.h:36
MultiChannelNoiseRemovalService::print
std::ostream & print(std::ostream &out=std::cout, std::string prefix="") const
Definition:
MultiChannelNoiseRemovalService_service.cc:50
MultiChannelNoiseRemovalService::MultiChannelNoiseRemovalService
MultiChannelNoiseRemovalService(fhicl::ParameterSet const &pset, art::ActivityRegistry &)
Definition:
MultiChannelNoiseRemovalService_service.cc:18
make_THn_beam_input.data
data
Definition:
make_THn_beam_input.py:80
AdcChannelNoiseRemovalService.h
art::ActivityRegistry
Definition:
ActivityRegistry.h:52
MultiChannelNoiseRemovalService::m_LogLevel
int m_LogLevel
Definition:
MultiChannelNoiseRemovalService.h:33
fhicl::ParameterSet::get_if_present
std::optional< T > get_if_present(std::string const &key) const
Definition:
ParameterSet.h:224
MultiChannelNoiseRemovalService::update
int update(AdcChannelDataMap &datamap) const
Definition:
MultiChannelNoiseRemovalService_service.cc:29
AdcChannelNoiseRemovalService::update
virtual int update(AdcChannelData &data) const =0
ServiceDefinitionMacros.h
AdcChannelDataMap
std::map< AdcChannel, AdcChannelData > AdcChannelDataMap
Definition:
AdcChannelData.h:378
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