Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
protoduneana
protoduneana
DataDump
DataDump_module.cc
Go to the documentation of this file.
1
////////////////////////////////////////////////////////////////////////
2
// Class: DataDump
3
// Plugin Type: analyzer (art v3_03_01)
4
// File: DataDump_module.cc
5
//
6
// Generated at Tue Nov 19 13:37:52 2019 by Tingjun Yang using cetskelgen
7
// from cetlib version v3_08_00.
8
////////////////////////////////////////////////////////////////////////
9
10
#include "
art/Framework/Core/EDAnalyzer.h
"
11
#include "
art/Framework/Core/ModuleMacros.h
"
12
#include "
art/Framework/Principal/Event.h
"
13
#include "
art/Framework/Principal/Handle.h
"
14
#include "
art/Framework/Principal/Run.h
"
15
#include "
art/Framework/Principal/SubRun.h
"
16
#include "
canvas/Utilities/InputTag.h
"
17
#include "
fhiclcpp/ParameterSet.h
"
18
#include "
messagefacility/MessageLogger/MessageLogger.h
"
19
#include "art_root_io/TFileService.h"
20
21
#include "
lardataobj/RecoBase/Wire.h
"
22
#include "
lardataobj/RawData/RawDigit.h
"
23
#include "
larcore/Geometry/Geometry.h
"
24
25
#include "TTree.h"
26
#include "TTimeStamp.h"
27
28
#include <fstream>
29
#include <vector>
30
31
namespace
pdune
{
32
class
DataDump
;
33
}
34
35
36
class
pdune::DataDump
:
public
art::EDAnalyzer
{
37
public
:
38
explicit
DataDump
(
fhicl::ParameterSet
const
&
p
);
39
// The compiler-generated destructor is fine for non-base
40
// classes without bare pointers or other resource use.
41
42
// Plugins should not be copied or assigned.
43
DataDump
(
DataDump
const
&) =
delete
;
44
DataDump
(
DataDump
&&) =
delete
;
45
DataDump
&
operator=
(
DataDump
const
&) =
delete
;
46
DataDump
&
operator=
(
DataDump
&&) =
delete
;
47
48
// Required functions.
49
void
analyze
(
art::Event
const
&
e
)
override
;
50
51
// Selected optional functions.
52
void
beginJob
()
override
;
53
54
private
:
55
56
//geo::GeometryCore const* fGeom;
57
TTree *
fTree
;
58
unsigned
int
run
;
59
unsigned
int
event
;
60
double
evttime
;
61
std::vector<unsigned short>
channel
;
62
std::vector<unsigned short>
tick
;
63
std::vector<float>
adc
;
64
};
65
66
67
pdune::DataDump::DataDump
(
fhicl::ParameterSet
const
&
p
)
68
:
EDAnalyzer
{p}
// ,
69
// More initializers here.
70
{
71
// Call appropriate consumes<>() for any products to be retrieved by this module.
72
}
73
74
void
pdune::DataDump::analyze
(
art::Event
const
&
e
)
75
{
76
77
//fGeom = &*(art::ServiceHandle<geo::Geometry>());
78
79
run
= e.
run
();
80
event
= e.
id
().
event
();
81
82
art::Timestamp
ts = e.
time
();
83
if
(ts.
timeHigh
() == 0){
84
TTimeStamp tts(ts.
timeLow
());
85
evttime
= tts.AsDouble();
86
}
87
else
{
88
TTimeStamp tts(ts.
timeHigh
(), ts.
timeLow
());
89
evttime
= tts.AsDouble();
90
}
91
channel
.clear();
92
tick
.clear();
93
adc
.clear();
94
95
//std::ofstream outfile (Form("r%de%d.txt",run,event));
96
97
auto
const
& wires =
98
e.
getValidHandle
<std::vector<recob::Wire> >(
"caldata:dataprep"
);
99
100
for
(
auto
& wire : * wires){
101
int
channel_no = wire.Channel();
102
std::cout<<
"Channel = "
<<channel_no<<
std::endl
;
103
if
(channel_no<2080 || channel_no > 2559)
continue
;
104
//for (auto & adc : wire.Signal()){
105
for
(
size_t
i = 0; i < wire.Signal().size(); ++i){
106
//outfile<<channel<<" "<<i<<" "<<wire.Signal()[i]<<std::endl;
107
channel
.push_back(channel_no);
108
tick
.push_back(i);
109
adc
.push_back(wire.Signal()[i]);
110
}
111
}
112
fTree
->Fill();
113
//outfile.close();
114
}
115
116
void
pdune::DataDump::beginJob
()
117
{
118
art::ServiceHandle<art::TFileService>
tfs;
119
fTree
= tfs->make<TTree>(
"spt"
,
"space point tree"
);
120
fTree
->Branch(
"run"
,&
run
,
"run/I"
);
121
fTree
->Branch(
"event"
,&
event
,
"event/I"
);
122
fTree
->Branch(
"evttime"
,&
evttime
,
"evttime/D"
);
123
fTree
->Branch(
"channel"
, &
channel
);
124
fTree
->Branch(
"tick"
,&
tick
);
125
fTree
->Branch(
"adc"
,&
adc
);
126
}
127
DEFINE_ART_MODULE
(
pdune::DataDump
)
pdune::DataDump::event
unsigned int event
Definition:
DataDump_module.cc:59
art::ServiceHandle< art::TFileService >
art::Timestamp::timeLow
constexpr std::uint32_t timeLow() const
Definition:
Timestamp.h:29
pdune
Definition:
DataDump_module.cc:31
Handle.h
pdune::DataDump::beginJob
void beginJob() override
Definition:
DataDump_module.cc:116
pdune::DataDump::adc
std::vector< float > adc
Definition:
DataDump_module.cc:63
art::Timestamp::timeHigh
constexpr std::uint32_t timeHigh() const
Definition:
Timestamp.h:34
art::EDAnalyzer::EDAnalyzer
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition:
EDAnalyzer.h:25
Geometry.h
art framework interface to geometry description
MessageLogger.h
ParameterSet.h
art::Timestamp
Definition:
Timestamp.h:10
pdune::DataDump::tick
std::vector< unsigned short > tick
Definition:
DataDump_module.cc:62
e
const double e
Definition:
gUpMuFluxGen.cxx:165
pdune::DataDump::fTree
TTree * fTree
Definition:
DataDump_module.cc:57
art::DataViewImpl::time
Timestamp time() const
Definition:
DataViewImpl.cc:106
DEFINE_ART_MODULE
#define DEFINE_ART_MODULE(klass)
Definition:
ModuleMacros.h:67
pdune::DataDump
Definition:
DataDump_module.cc:36
art::DataViewImpl::getValidHandle
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
Definition:
DataViewImpl.h:441
test.p
p
Definition:
test.py:223
SubRun.h
art::DataViewImpl::run
RunNumber_t run() const
Definition:
DataViewImpl.cc:71
EDAnalyzer.h
ModuleMacros.h
pdune::DataDump::run
unsigned int run
Definition:
DataDump_module.cc:58
art::Event
Definition:
Event.h:22
pdune::DataDump::operator=
DataDump & operator=(DataDump const &)=delete
art::EDAnalyzer
Definition:
EDAnalyzer.h:20
pdune::DataDump::channel
std::vector< unsigned short > channel
Definition:
DataDump_module.cc:61
InputTag.h
art::EventID::event
EventNumber_t event() const
Definition:
EventID.h:116
Wire.h
Declaration of basic channel signal object.
pdune::DataDump::DataDump
DataDump(fhicl::ParameterSet const &p)
Definition:
DataDump_module.cc:67
RawDigit.h
Event.h
pdune::DataDump::evttime
double evttime
Definition:
DataDump_module.cc:60
pdune::DataDump::analyze
void analyze(art::Event const &e) override
Definition:
DataDump_module.cc:74
Run.h
art::Event::id
EventID id() const
Definition:
Event.cc:34
endl
QTextStream & endl(QTextStream &s)
Definition:
qtextstream.cpp:2030
event
Event finding and building.
Definition:
EventCheater_module.cc:32
fhicl::ParameterSet
Definition:
ParameterSet.h:36
Generated by
1.8.11