Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
protoduneana
protoduneana
Utilities
RecoHitsEff_module.cc
Go to the documentation of this file.
1
//////////////////////////////////////////////////////////////////////////
2
// Class: RecoHitsEff
3
// Module Type: analyzer
4
// File: RecoHitsEff_module.cc
5
// Author: D.Stefan and R.Sulej
6
//
7
// Check of hit efficiency reconstruction.
8
// It helps to tests various disambiguation algorithms.
9
//
10
//////////////////////////////////////////////////////////////////////////
11
12
#include "
art/Framework/Core/EDAnalyzer.h
"
13
#include "
art/Framework/Core/ModuleMacros.h
"
14
#include "
art/Framework/Principal/Event.h
"
15
#include "
art/Framework/Principal/Handle.h
"
16
#include "
art/Framework/Principal/Run.h
"
17
#include "
art/Framework/Principal/SubRun.h
"
18
#include "
art/Framework/Services/Registry/ServiceHandle.h
"
19
#include "art_root_io/TFileService.h"
20
21
#include "
canvas/Utilities/InputTag.h
"
22
#include "
fhiclcpp/types/Atom.h
"
23
#include "
fhiclcpp/types/Table.h
"
24
25
#include "
messagefacility/MessageLogger/MessageLogger.h
"
26
27
#include "
larsim/Simulation/LArG4Parameters.h
"
28
#include "
lardata/ArtDataHelper/MVAReader.h
"
29
#include "
larreco/Calorimetry/CalorimetryAlg.h
"
30
#include "
lardataobj/RecoBase/Hit.h
"
31
#include "
lardataobj/RecoBase/Cluster.h
"
32
33
#include "TTree.h"
34
35
namespace
pdune
36
{
37
class
RecoHitsEff;
38
}
39
40
class
pdune::RecoHitsEff
:
public
art::EDAnalyzer
{
41
public
:
42
43
struct
Config
{
44
using
Name
=
fhicl::Name
;
45
using
Comment
=
fhicl::Comment
;
46
47
fhicl::Atom<art::InputTag>
HitModuleLabel
{
48
Name
(
"HitModuleLabel"
),
Comment
(
"tag of hits producer"
)
49
};
50
51
fhicl::Atom<art::InputTag>
HitDCheatLabel
{
52
Name
(
"HitDCheatLabel"
),
Comment
(
"tag of dcheat hits producer"
)
53
};
54
55
fhicl::Atom<int>
Plane
{
56
Name
(
"Plane"
),
Comment
(
"check hit disambiguation in selected plane only"
)
57
};
58
};
59
using
Parameters
=
art::EDAnalyzer::Table<Config>
;
60
61
explicit
RecoHitsEff
(
Parameters
const
&
config
);
62
63
RecoHitsEff
(
RecoHitsEff
const
&) =
delete
;
64
RecoHitsEff
(
RecoHitsEff
&&) =
delete
;
65
RecoHitsEff
&
operator =
(
RecoHitsEff
const
&) =
delete
;
66
RecoHitsEff
&
operator =
(
RecoHitsEff
&&) =
delete
;
67
68
void
analyze
(
art::Event
const
&
e
)
override
;
69
void
beginJob
()
override
;
70
71
private
:
72
73
void
ResetVars
();
74
75
TTree *
fTree
;
76
77
int
fRun
,
fEvent
;
78
int
fNhits
;
int
fNdcheat
;
79
int
fMatching
;
80
81
art::InputTag
fHitModuleLabel
;
82
art::InputTag
fHitDCheatLabel
;
83
int
fPlane
;
84
};
85
86
pdune::RecoHitsEff::RecoHitsEff
(
Parameters
const
&
config
) :
EDAnalyzer
(config),
87
fHitModuleLabel
(config().
HitModuleLabel
()),
88
fHitDCheatLabel
(config().
HitDCheatLabel
()),
89
fPlane
(config().
Plane
())
90
{
91
}
92
93
void
pdune::RecoHitsEff::beginJob
()
94
{
95
art::ServiceHandle<art::TFileService>
tfs;
96
97
fTree
= tfs->make<TTree>(
"events"
,
"summary tree"
);
98
fTree
->Branch(
"fRun"
, &
fRun
,
"fRun/I"
);
99
fTree
->Branch(
"fEvent"
, &
fEvent
,
"fEvent/I"
);
100
fTree
->Branch(
"fPlane"
, &
fPlane
,
"fPlane/I"
);
101
fTree
->Branch(
"fNhits"
, &
fNhits
,
"fNhits/I"
);
102
fTree
->Branch(
"fNdcheat"
, &
fNdcheat
,
"fNdcheat/I"
);
103
fTree
->Branch(
"fMatching"
, &
fMatching
,
"fMatching/I"
);
104
}
105
106
void
pdune::RecoHitsEff::analyze
(
art::Event
const
&
evt
)
107
{
108
ResetVars
();
109
110
fRun
= evt.
run
();
111
fEvent
= evt.
id
().
event
();
112
113
auto
const
& hitList = *evt.
getValidHandle
< std::vector<recob::Hit> >(
fHitModuleLabel
);
114
115
std::vector< size_t > hits;
116
// get and sort hits
117
int
plane = 0;
118
for
(
size_t
k
= 0;
k
< hitList.size(); ++
k
)
119
{
120
plane = hitList[
k
].WireID().Plane;
121
if
(plane !=
fPlane
)
continue
;
122
fNhits
++;
123
124
hits.push_back(
k
);
125
}
126
127
auto
const
& dcheatList = *evt.
getValidHandle
< std::vector<recob::Hit> >(
fHitDCheatLabel
);
128
129
std::vector< size_t > hitsdc;
130
// get and short hits_dc
131
for
(
size_t
k
= 0;
k
< dcheatList.size(); ++
k
)
132
{
133
plane = dcheatList[
k
].WireID().Plane;
134
if
(plane !=
fPlane
)
continue
;
135
fNdcheat
++;
136
137
hitsdc.push_back(
k
);
138
}
139
140
std::cout <<
" fNhits "
<<
fNhits
<<
std::endl
;
141
std::cout <<
" fNdcheat "
<<
fNdcheat
<<
std::endl
;
142
143
for
(
auto
const
h
: hits)
144
{
145
for
(
auto
const
hdc: hitsdc)
146
{
147
if
((hitList[
h
].PeakTime() == dcheatList[hdc].PeakTime()) && (hitList[
h
].
WireID
() == dcheatList[hdc].
WireID
()))
148
{
149
fMatching
++;
150
}
151
}
152
}
153
154
std::cout <<
" fMatching "
<<
fMatching
<<
std::endl
;
155
156
fTree
->Fill();
157
}
158
159
void
pdune::RecoHitsEff::ResetVars
()
160
{
161
fRun
= 0;
162
fEvent
= 0;
163
fNhits
= 0;
164
fNdcheat
= 0;
165
fMatching
= 0;
166
}
167
168
DEFINE_ART_MODULE
(
pdune::RecoHitsEff
)
LArG4Parameters.h
Store parameters for running LArG4.
pdune::RecoHitsEff::beginJob
void beginJob() override
Definition:
RecoHitsEff_module.cc:93
art::ServiceHandle< art::TFileService >
pdune::RecoHitsEff::Config::HitDCheatLabel
fhicl::Atom< art::InputTag > HitDCheatLabel
Definition:
RecoHitsEff_module.cc:51
pdune::RecoHitsEff::ResetVars
void ResetVars()
Definition:
RecoHitsEff_module.cc:159
pdune::RecoHitsEff::fEvent
int fEvent
Definition:
RecoHitsEff_module.cc:77
pdune
Definition:
DataDump_module.cc:31
pdune::RecoHitsEff::fNdcheat
int fNdcheat
Definition:
RecoHitsEff_module.cc:78
Handle.h
pdune::RecoHitsEff::operator=
RecoHitsEff & operator=(RecoHitsEff const &)=delete
pdune::RecoHitsEff::fTree
TTree * fTree
Definition:
RecoHitsEff_module.cc:75
Name
ChannelGroupService::Name Name
Definition:
FixedChannelGroupService_service.cc:19
pdune::RecoHitsEff
Definition:
RecoHitsEff_module.cc:40
pdune::RecoHitsEff::fPlane
int fPlane
Definition:
RecoHitsEff_module.cc:83
pdune::RecoHitsEff::analyze
void analyze(art::Event const &e) override
Definition:
RecoHitsEff_module.cc:106
art::EDAnalyzer::EDAnalyzer
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition:
EDAnalyzer.h:25
pdune::RecoHitsEff::fHitModuleLabel
art::InputTag fHitModuleLabel
Definition:
RecoHitsEff_module.cc:81
pdune::RecoHitsEff::fMatching
int fMatching
Definition:
RecoHitsEff_module.cc:79
MVAReader.h
MessageLogger.h
ServiceHandle.h
pdune::RecoHitsEff::fRun
int fRun
Definition:
RecoHitsEff_module.cc:77
pdune::RecoHitsEff::Config::Plane
fhicl::Atom< int > Plane
Definition:
RecoHitsEff_module.cc:55
pdune::RecoHitsEff::fNhits
int fNhits
Definition:
RecoHitsEff_module.cc:78
reco_momentum_tuples.h
h
Definition:
reco_momentum_tuples.py:66
e
const double e
Definition:
gUpMuFluxGen.cxx:165
DEFINE_ART_MODULE
#define DEFINE_ART_MODULE(klass)
Definition:
ModuleMacros.h:67
geo::fhicl::WireID
IDparameter< geo::WireID > WireID
Member type of validated geo::WireID parameter.
Definition:
geo_types_fhicl.h:407
pdune::RecoHitsEff::Config::Comment
fhicl::Comment Comment
Definition:
RecoHitsEff_module.cc:45
config
static Config * config
Definition:
config.cpp:1054
pdune::RecoHitsEff::fHitDCheatLabel
art::InputTag fHitDCheatLabel
Definition:
RecoHitsEff_module.cc:82
CalorimetryAlg.h
Cluster.h
art::InputTag
Definition:
InputTag.h:12
art::DataViewImpl::getValidHandle
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
Definition:
DataViewImpl.h:441
fhicl::Atom< art::InputTag >
SubRun.h
art::detail::Analyzer::Table
Definition:
Analyzer.h:36
pdune::RecoHitsEff::Config::HitModuleLabel
fhicl::Atom< art::InputTag > HitModuleLabel
Definition:
RecoHitsEff_module.cc:47
art::DataViewImpl::run
RunNumber_t run() const
Definition:
DataViewImpl.cc:71
EDAnalyzer.h
ModuleMacros.h
Hit.h
Declaration of signal hit object.
art::Event
Definition:
Event.h:22
pdune::RecoHitsEff::RecoHitsEff
RecoHitsEff(Parameters const &config)
Definition:
RecoHitsEff_module.cc:86
Comment
#define Comment
Definition:
commentscan.cpp:4062
art::EDAnalyzer
Definition:
EDAnalyzer.h:20
Table.h
muoncounters.k
k
Definition:
muoncounters.py:27
Atom.h
InputTag.h
art::EventID::event
EventNumber_t event() const
Definition:
EventID.h:116
pdune::RecoHitsEff::Config
Definition:
RecoHitsEff_module.cc:43
pdune::RecoHitsEff::Config::Name
fhicl::Name Name
Definition:
RecoHitsEff_module.cc:44
tca::evt
TCEvent evt
Definition:
DataStructs.cxx:7
Event.h
Run.h
art::Event::id
EventID id() const
Definition:
Event.cc:34
fhicl::Comment
Definition:
Comment.h:33
endl
QTextStream & endl(QTextStream &s)
Definition:
qtextstream.cpp:2030
fhicl::Name
Definition:
Name.h:10
Generated by
1.8.11