Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
dunereco
dunereco
HitFinderDUNE
ClusterHitTime_module.cc
Go to the documentation of this file.
1
////////////////////////////////////////////////////////////////////////
2
// Class: ClusterHitTime
3
// Plugin Type: analyzer (art v3_05_00)
4
// File: ClusterHitTime_module.cc
5
//
6
// Generated at Thu Apr 2 08:17:05 2020 by Tingjun Yang using cetskelgen
7
// from cetlib version v3_10_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 "
canvas/Utilities/InputTag.h
"
20
#include "canvas/Persistency/Common/FindManyP.h"
21
#include "art_root_io/TFileService.h"
22
#include "
lardataobj/RecoBase/Cluster.h
"
23
#include "
lardataobj/RecoBase/Hit.h
"
24
#include "
lardata/DetectorInfoServices/DetectorPropertiesService.h
"
25
#include "
larcore/CoreUtils/ServiceUtil.h
"
26
27
#include "TH1D.h"
28
29
class
ClusterHitTime
;
30
31
32
class
ClusterHitTime
:
public
art::EDAnalyzer
{
33
public
:
34
explicit
ClusterHitTime
(
fhicl::ParameterSet
const
&
p
);
35
// The compiler-generated destructor is fine for non-base
36
// classes without bare pointers or other resource use.
37
38
// Plugins should not be copied or assigned.
39
ClusterHitTime
(
ClusterHitTime
const
&) =
delete
;
40
ClusterHitTime
(
ClusterHitTime
&&) =
delete
;
41
ClusterHitTime
&
operator=
(
ClusterHitTime
const
&) =
delete
;
42
ClusterHitTime
&
operator=
(
ClusterHitTime
&&) =
delete
;
43
44
// Required functions.
45
void
analyze
(
art::Event
const
&
e
)
override
;
46
47
// Selected optional functions.
48
void
beginJob
()
override
;
49
50
private
:
51
52
TH1D *
clutime
[3];
53
art::InputTag
fClusterModuleLabel
;
54
std::vector<int>
fClusterIDs
;
55
};
56
57
58
ClusterHitTime::ClusterHitTime
(
fhicl::ParameterSet
const
&
p
)
59
:
EDAnalyzer
{p},
60
fClusterModuleLabel
(
p
.get<
art::InputTag
>(
"ClusterModuleLabel"
,
"linecluster"
)),
61
fClusterIDs
(
p
.get<std::vector<int>>(
"ClusterIDs"
))
62
{
63
}
64
65
void
ClusterHitTime::analyze
(
art::Event
const
&
e
)
66
{
67
68
std::vector<art::Ptr<recob::Cluster> > clusterlist;
69
auto
clusterListHandle = e.
getHandle
< std::vector<recob::Cluster> >(
fClusterModuleLabel
);
70
if
(clusterListHandle)
71
art::fill_ptr_vector
(clusterlist, clusterListHandle);
72
73
art::FindManyP<recob::Hit> fmhc(clusterListHandle, e,
fClusterModuleLabel
);
74
75
auto
const
detProp =
art::ServiceHandle<detinfo::DetectorPropertiesService const>
()->DataFor(e);
76
for
(
const
auto
&
cluster
: clusterlist){
77
bool
match =
false
;
78
for
(
const
auto
&
id
:
fClusterIDs
){
79
if
(
int
(
cluster
.key()) ==
id
){
80
match =
true
;
81
}
82
}
83
//std::cout<<cluster.key()<<std::endl;
84
if
(!match)
continue
;
85
auto
&hits = fmhc.at(
cluster
.key());
86
for
(
const
auto
&
hit
: hits){
87
std::cout<<
hit
->WireID().Plane<<
" "
<<
hit
->PeakTime()<<
" "
<<detProp.GetXTicksOffset(
hit
->WireID())<<
" "
<<
hit
->Integral()<<
std::endl
;
88
clutime
[
hit
->WireID().Plane]->Fill(
hit
->PeakTime()-detProp.GetXTicksOffset(
hit
->WireID())+5000,
hit
->Integral());
89
}
90
}
91
92
}
93
94
void
ClusterHitTime::beginJob
()
95
{
96
art::ServiceHandle<art::TFileService>
tfs;
97
clutime
[0] = tfs->make<TH1D>(
"clutime_0"
,
"Plane 0;Tick;ADC"
,2000,0,2000);
98
clutime
[1] = tfs->make<TH1D>(
"clutime_1"
,
"Plane 1;Tick;ADC"
,2000,0,2000);
99
clutime[2] = tfs->make<TH1D>(
"clutime_2"
,
"Plane 2;Tick;ADC"
,2000,0,2000);
100
101
}
102
103
DEFINE_ART_MODULE
(
ClusterHitTime
)
art::ServiceHandle
Definition:
ServiceHandle.h:37
Handle.h
art::DataViewImpl::getHandle
Handle< PROD > getHandle(SelectorBase const &) const
Definition:
DataViewImpl.h:382
DetectorPropertiesService.h
ClusterHitTime::analyze
void analyze(art::Event const &e) override
Definition:
ClusterHitTime_module.cc:65
cluster
Cluster finding and building.
Definition:
SmallClusterFilter_module.cc:34
art::EDAnalyzer::EDAnalyzer
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition:
EDAnalyzer.h:25
MessageLogger.h
ParameterSet.h
e
const double e
Definition:
gUpMuFluxGen.cxx:165
DEFINE_ART_MODULE
#define DEFINE_ART_MODULE(klass)
Definition:
ModuleMacros.h:67
Cluster.h
art::InputTag
Definition:
InputTag.h:12
test.p
p
Definition:
test.py:223
ServiceUtil.h
ClusterHitTime::clutime
TH1D * clutime[3]
Definition:
ClusterHitTime_module.cc:52
SubRun.h
EDAnalyzer.h
ModuleMacros.h
ClusterHitTime::fClusterIDs
std::vector< int > fClusterIDs
Definition:
ClusterHitTime_module.cc:54
hit
Detector simulation of raw signals on wires.
Definition:
NumberOfHitsFilter_module.cc:25
ClusterHitTime::ClusterHitTime
ClusterHitTime(fhicl::ParameterSet const &p)
Definition:
ClusterHitTime_module.cc:58
ClusterHitTime::beginJob
void beginJob() override
Definition:
ClusterHitTime_module.cc:94
ClusterHitTime::operator=
ClusterHitTime & operator=(ClusterHitTime const &)=delete
Hit.h
Declaration of signal hit object.
art::Event
Definition:
Event.h:22
ClusterHitTime::fClusterModuleLabel
art::InputTag fClusterModuleLabel
Definition:
ClusterHitTime_module.cc:53
art::EDAnalyzer
Definition:
EDAnalyzer.h:20
InputTag.h
ClusterHitTime
Definition:
ClusterHitTime_module.cc:32
Event.h
art::fill_ptr_vector
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
Definition:
Ptr.h:297
Run.h
endl
QTextStream & endl(QTextStream &s)
Definition:
qtextstream.cpp:2030
fhicl::ParameterSet
Definition:
ParameterSet.h:36
Generated by
1.8.11