Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
duneprototypes
duneprototypes
Protodune
dualphase
test
recobWireCheck_module.cc
Go to the documentation of this file.
1
////////////////////////////////////////////////////////////////////////
2
// Class: recobWireCheck
3
// Plugin Type: analyzer (art v3_02_06)
4
// File: recobWireCheck_module.cc
5
//
6
// Generated at Thu Oct 3 14:07:32 2019 by Vyacheslav Galymov using cetskelgen
7
// from cetlib version v3_07_02.
8
//
9
// Get some statistics on recob::Wire objects built by DataPrep
10
//
11
////////////////////////////////////////////////////////////////////////
12
#include <iostream>
13
14
#include "
art/Framework/Core/EDAnalyzer.h
"
15
#include "
art/Framework/Core/ModuleMacros.h
"
16
#include "
art/Framework/Principal/Event.h
"
17
#include "
art/Framework/Principal/Handle.h
"
18
#include "
art/Framework/Principal/Run.h
"
19
#include "
art/Framework/Principal/SubRun.h
"
20
#include "
canvas/Utilities/InputTag.h
"
21
#include "
fhiclcpp/ParameterSet.h
"
22
#include "
messagefacility/MessageLogger/MessageLogger.h
"
23
24
#include "art_root_io/TFileService.h"
25
26
#include "
lardataobj/RawData/raw.h
"
27
//#include "lardataobj/RawData/RawDigit.h"
28
#include "
lardataobj/RecoBase/Wire.h
"
29
30
#include <TTree.h>
31
32
33
#include <algorithm>
34
35
namespace
pddp
{
36
class
recobWireCheck
;
37
}
38
39
40
class
pddp::recobWireCheck
:
public
art::EDAnalyzer
{
41
public
:
42
explicit
recobWireCheck
(
fhicl::ParameterSet
const
&
p
);
43
// The compiler-generated destructor is fine for non-base
44
// classes without bare pointers or other resource use.
45
46
// Plugins should not be copied or assigned.
47
recobWireCheck
(
recobWireCheck
const
&) =
delete
;
48
recobWireCheck
(
recobWireCheck
&&) =
delete
;
49
recobWireCheck
&
operator=
(
recobWireCheck
const
&) =
delete
;
50
recobWireCheck
&
operator=
(
recobWireCheck
&&) =
delete
;
51
52
// Required functions.
53
void
analyze
(
art::Event
const
&
e
)
override
;
54
55
// Selected optional functions.
56
void
beginJob
()
override
;
57
void
endJob
()
override
;
58
59
private
:
60
61
// Declare member data here.
62
int
fLogLevel
;
63
std::string
fInputLabel
;
64
65
//
66
TTree *
fTree
;
67
68
float
fAdcMax
;
69
float
fAdcSum
;
70
unsigned
fChanId
;
71
unsigned
fTicks
;
72
int
fStartTick
;
73
int
fEndTick
;
74
//int fMaxTick;
75
};
76
77
78
pddp::recobWireCheck::recobWireCheck
(
fhicl::ParameterSet
const
&
p
)
79
:
EDAnalyzer
{p},
80
fLogLevel
(
p
.get<
int
>(
"LogLevel"
) ),
81
fInputLabel
(
p
.get<
std::string
>(
"InputLabel"
) )
82
{
83
// Call appropriate consumes<>() for any products to be retrieved by this module.
84
//fWireToken = consumes< std::vector<recob::Wire> >(fInputLabel);
85
}
86
87
//
88
void
pddp::recobWireCheck::analyze
(
art::Event
const
&
e
)
89
{
90
//auto const& wireHandle = e.getValidHandle(fWireToken);
91
auto
wireHandle = e.
getHandle
< std::vector<recob::Wire> >(
fInputLabel
);
92
if
( !wireHandle )
93
{
94
std::cerr<<
"Product "
<<
fInputLabel
<<
" was not found\n"
;
95
}
96
97
for
(
size_t
wireIter = 0; wireIter < wireHandle->size(); wireIter++)
98
{
99
art::Ptr<recob::Wire>
wire(wireHandle, wireIter);
100
fChanId
= wire->
Channel
();
101
const
recob::Wire::RegionsOfInterest_t
& signals = wire->
SignalROI
();
102
103
if
(
fLogLevel
>= 2 ) {
104
std::cout<<
"Channel "
<<
fChanId
<<
" has number of ROIs "
<<signals.
n_ranges
()<<
std::endl
;
105
}
106
107
// loop over regions of interest
108
for
(
const
auto
& range : signals.
get_ranges
())
109
{
110
fStartTick
= range.begin_index();
111
fEndTick
= range.end_index();
112
fTicks
= range.size();
113
114
fAdcMax
= -9999;
//*(std::max_element( range.begin(), range.end() ));
115
fAdcSum
= 0;
116
for
(
float
adc
: range.data() )
117
{
118
fAdcSum
+=
adc
;
119
if
(
adc
>
fAdcMax
)
fAdcMax
=
adc
;
120
}
121
122
//
123
fTree
->Fill();
124
}
125
}
126
}
127
128
void
pddp::recobWireCheck::beginJob
()
129
{
130
art::ServiceHandle<art::TFileService>
tfs;
131
fTree
= tfs->make<TTree>(
"recobWireTree"
,
"recobWire summary tree"
);
132
fTree
->Branch(
"fChanId"
, &
fChanId
,
"fChanId/i"
);
133
fTree
->Branch(
"fTicks"
, &
fTicks
,
"fTicks/i"
);
134
fTree
->Branch(
"fStartTick"
, &
fStartTick
,
"fStartTick/I"
);
135
fTree
->Branch(
"fEndTick"
, &
fEndTick
,
"fEndTick/I"
);
136
fTree
->Branch(
"fAdcMax"
, &
fAdcMax
,
"fAdcMax/F"
);
137
fTree
->Branch(
"fAdcSum"
, &
fAdcSum
,
"fAdcSum/F"
);
138
}
139
140
void
pddp::recobWireCheck::endJob
()
141
{
142
// Implementation of optional member function here.
143
}
144
145
DEFINE_ART_MODULE
(
pddp::recobWireCheck
)
art::ServiceHandle< art::TFileService >
lar::sparse_vector::n_ranges
size_type n_ranges() const
Returns the internal list of non-void ranges.
Definition:
sparse_vector.h:721
pddp::recobWireCheck::beginJob
void beginJob() override
Definition:
recobWireCheck_module.cc:128
Handle.h
art::DataViewImpl::getHandle
Handle< PROD > getHandle(SelectorBase const &) const
Definition:
DataViewImpl.h:382
string
std::string string
Definition:
nybbler.cc:12
pddp::recobWireCheck::fEndTick
int fEndTick
Definition:
recobWireCheck_module.cc:73
pddp
Definition:
recobWireCheck_module.cc:35
pddp::recobWireCheck::operator=
recobWireCheck & operator=(recobWireCheck const &)=delete
adc
int16_t adc
Definition:
CRTFragment.hh:202
lar::sparse_vector::get_ranges
const range_list_t & get_ranges() const
Returns the internal list of non-void ranges.
Definition:
sparse_vector.h:717
art::EDAnalyzer::EDAnalyzer
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition:
EDAnalyzer.h:25
MessageLogger.h
ParameterSet.h
pddp::recobWireCheck
Definition:
recobWireCheck_module.cc:40
e
const double e
Definition:
gUpMuFluxGen.cxx:165
DEFINE_ART_MODULE
#define DEFINE_ART_MODULE(klass)
Definition:
ModuleMacros.h:67
recob::Wire::Channel
raw::ChannelID_t Channel() const
Returns the ID of the channel (or InvalidChannelID)
Definition:
Wire.h:231
test.p
p
Definition:
test.py:223
recob::Wire::SignalROI
const RegionsOfInterest_t & SignalROI() const
Returns the list of regions of interest.
Definition:
Wire.h:228
SubRun.h
pddp::recobWireCheck::fInputLabel
std::string fInputLabel
Definition:
recobWireCheck_module.cc:63
EDAnalyzer.h
pddp::recobWireCheck::analyze
void analyze(art::Event const &e) override
Definition:
recobWireCheck_module.cc:88
ModuleMacros.h
pddp::recobWireCheck::fLogLevel
int fLogLevel
Definition:
recobWireCheck_module.cc:62
pddp::recobWireCheck::fTree
TTree * fTree
Definition:
recobWireCheck_module.cc:66
pddp::recobWireCheck::fAdcSum
float fAdcSum
Definition:
recobWireCheck_module.cc:69
raw.h
art::Event
Definition:
Event.h:22
lar::sparse_vector< float >
pddp::recobWireCheck::fAdcMax
float fAdcMax
Definition:
recobWireCheck_module.cc:68
pddp::recobWireCheck::endJob
void endJob() override
Definition:
recobWireCheck_module.cc:140
art::EDAnalyzer
Definition:
EDAnalyzer.h:20
pddp::recobWireCheck::recobWireCheck
recobWireCheck(fhicl::ParameterSet const &p)
Definition:
recobWireCheck_module.cc:78
InputTag.h
Wire.h
Declaration of basic channel signal object.
pddp::recobWireCheck::fTicks
unsigned fTicks
Definition:
recobWireCheck_module.cc:71
Event.h
pddp::recobWireCheck::fStartTick
int fStartTick
Definition:
recobWireCheck_module.cc:72
Run.h
art::Ptr< recob::Wire >
endl
QTextStream & endl(QTextStream &s)
Definition:
qtextstream.cpp:2030
fhicl::ParameterSet
Definition:
ParameterSet.h:36
pddp::recobWireCheck::fChanId
unsigned fChanId
Definition:
recobWireCheck_module.cc:70
Generated by
1.8.11