5 #include "art/Framework/Core/EDAnalyzer.h"
6 #include "art/Framework/Core/ModuleMacros.h"
7 #include "art/Framework/Principal/Event.h"
8 #include "art/Framework/Principal/Handle.h"
9 #include "art/Framework/Services/Registry/ServiceHandle.h"
10 #include "canvas/Persistency/Common/Ptr.h"
11 #include "fhiclcpp/ParameterSet.h"
20 #include "TVirtualPad.h"
31 void Plot(
const std::vector<recob::SpacePoint>& pts,
const std::string& suffix)
const;
33 void Plot3D(
const std::vector<recob::SpacePoint>& pts,
const std::string& suffix)
const;
36 art::Handle<std::vector<recob::Hit>> hits)
const;
54 , fSpacePointTag(art::InputTag(pset.
get<
std::
string>("SpacePointLabel"),
55 pset.
get<
std::
string>("SpacePointInstanceLabel")))
56 , fHitLabel(pset.
get<
std::
string>("HitLabel"))
57 , fSuffix(pset.
get<
std::
string>("Suffix"))
59 , fPlots3D(pset.
get<
bool>("Plots3D"))
60 , fPlotsTrue(pset.
get<
bool>("PlotsTrue"))
62 if (!fSuffix.empty()) fSuffix =
"_" + fSuffix;
78 const double* xyz = pt.XYZ();
79 const double x = xyz[0];
80 const double y = xyz[1];
81 const double z = xyz[2];
82 gZX.SetPoint(gZX.GetN(),
z,
x);
83 gYX.SetPoint(gYX.GetN(),
y,
x);
84 gZY.SetPoint(gZY.GetN(),
z,
y);
87 if (gZX.GetN() == 0) gZX.SetPoint(0, 0, 0);
88 if (gYX.GetN() == 0) gYX.SetPoint(0, 0, 0);
89 if (gZY.GetN() == 0) gZY.SetPoint(0, 0, 0);
92 gPad->Print((
"plots/evd" + suffix +
".png").c_str());
95 gPad->Print((
"plots/evd_ortho" + suffix +
".png").c_str());
97 gPad->Print((
"plots/evd_zy" + suffix +
".png").c_str());
101 std::vector<recob::SpacePoint>
103 art::Handle<std::vector<recob::Hit>> hits)
const
105 std::vector<recob::SpacePoint> pts_true;
107 const double err[6] = {
111 art::ServiceHandle<cheat::BackTrackerService const> bt_serv;
112 for (
unsigned int i = 0; i < hits->size(); ++i) {
114 const std::vector<double> xyz = bt_serv->HitToXYZ(clockData, art::Ptr<recob::Hit>(hits, i));
115 pts_true.emplace_back(&xyz[0], err, 0);
127 const std::string& suffix)
const
130 for (
int phase = 0; phase < 4; ++phase) {
132 for (
int iang = 0; iang < Nang; ++iang) {
133 const double ang = M_PI / 2 * iang / double(Nang);
138 const double* xyz =
p.XYZ();
142 x = cos(ang) * xyz[1] + sin(ang) * xyz[2];
147 y = cos(ang) * xyz[0] + sin(ang) * xyz[1];
150 x = cos(ang) * xyz[2] - sin(ang) * xyz[0];
154 x = -cos(ang) * xyz[0] + sin(ang) * xyz[1];
155 y = cos(ang) * xyz[1] + sin(ang) * xyz[0];
159 const double phi = 0;
160 g.SetPoint(g.GetN(), cos(phi) *
x + sin(phi) *
y, cos(phi) * y - sin(phi) *
x);
164 TString::Format((
"anim/evd3d" + suffix +
"_%03d.png").c_str(), frame++).Data();
165 g.SetTitle(fname.c_str());
166 if (g.GetN()) g.Draw(
"ap");
167 gPad->Print(fname.c_str());
176 art::Handle<std::vector<recob::SpacePoint>> pts;
179 const std::string suffix = TString::Format(
"%s_%d",
fSuffix.c_str(), evt.event()).
Data();
189 art::Handle<std::vector<recob::Hit>> hits;
191 auto const clockData =
192 art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(evt);
193 const std::vector<recob::SpacePoint> pts =
TrueSpacePoints(clockData, hits);
195 const std::string suffix = TString::Format(
"%s_true_%d",
fSuffix.c_str(), evt.event()).
Data();
std::vector< recob::SpacePoint > TrueSpacePoints(detinfo::DetectorClocksData const &clockData, art::Handle< std::vector< recob::Hit >> hits) const
process_name opflash particleana ie ie ie z
double std(const std::vector< short > &wf, const double ped_mean, size_t start, size_t nsample)
process_name opflash particleana ie x
Declaration of signal hit object.
EResult err(const char *call)
PlotSpacePoints(const fhicl::ParameterSet &pset)
process_name opflash particleana ie ie y
art::InputTag fSpacePointTag
void Plot3D(const std::vector< recob::SpacePoint > &pts, const std::string &suffix) const
void Plots(const TH1 &a, const TH1 &b, const std::string &key)
Contains all timing reference information for the detector.
void Plot(const std::vector< recob::SpacePoint > &pts, const std::string &suffix) const
void analyze(const art::Event &evt) override