All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FeatureVertexFinderAna_module.cc
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////////////////
2 //
3 // FeatureVertexFinder designed to analyze 2d & 3d verticies found in the TPC
4 //
5 // jaasaadi@syr.edu
6 //
7 // Note: This ana module will utilize MC truth information for verticies and is not (yet)
8 // intended as a unit test for data...though many of the same methods will likely be used
9 // for real data (when the time comes)
10 //////////////////////////////////////////////////////////////////////////////////////////
11 
12 // LArSoft
19 
20 // C++
21 #include <string>
22 
23 // Framework
24 #include "art/Framework/Core/EDAnalyzer.h"
25 #include "art/Framework/Core/ModuleMacros.h"
26 #include "art/Framework/Principal/Event.h"
27 #include "art/Framework/Principal/Handle.h"
28 #include "art/Framework/Services/Registry/ServiceHandle.h"
29 #include "art_root_io/TFileService.h"
30 #include "canvas/Persistency/Common/Ptr.h"
31 #include "canvas/Persistency/Common/PtrVector.h"
32 #include "fhiclcpp/ParameterSet.h"
33 #include "messagefacility/MessageLogger/MessageLogger.h"
34 
35 // ROOT
36 #include "TH1F.h"
37 #include "TH2D.h"
38 
39 namespace vertex {
40 
41  class FeatureVertexFinderAna : public art::EDAnalyzer {
42  public:
43  explicit FeatureVertexFinderAna(fhicl::ParameterSet const& pset);
44 
45  private:
46  void analyze(const art::Event& evt) override;
47  void beginJob() override;
48 
49  std::string fLArG4ModuleLabel;
50  std::string fGenieModuleLabel;
51  std::string fVertexModuleLabel;
52  std::string fEndPoint2dModuleLabel; //<---2d Vertex Module Label (EndPoint2d)
53 
54  // Outputting histograms for analysis
55 
56  TH1F* fRun;
57  TH1F* fEvt;
73 
77 
90 
94 
99 
104 
109 
110  TH1F* fRecoVtxN3d;
114 
118 
122 
123  }; // End class VertexFinderAna
124 
125  FeatureVertexFinderAna::FeatureVertexFinderAna(fhicl::ParameterSet const& pset) : EDAnalyzer(pset)
126  {
127  fLArG4ModuleLabel = pset.get<std::string>("LArGeantModuleLabel");
128  fGenieModuleLabel = pset.get<std::string>("GenieModuleLabel");
129  fVertexModuleLabel = pset.get<std::string>("VertexModuleLabel");
130  fEndPoint2dModuleLabel = pset.get<std::string>("EndPoint2dModuleLabel");
131  }
132 
133  void
135  {
136  // get access to the TFile service
137  art::ServiceHandle<art::TFileService const> tfs;
138 
139  // Outputting TH1F Histograms
140  fRun = tfs->make<TH1F>("fRun", "Run Number", 1000, 0, 1000);
141  fEvt = tfs->make<TH1F>("fEvt", "Event Number", 1000, 0, 1000);
142  fTruthVtxXPos = tfs->make<TH1F>("fTruthVtxXPos", "Truth Vertex X Position", 400, 0, 200);
143  fTruthVtxYPos = tfs->make<TH1F>("fTruthVtxYPos", "Truth Vertex Y Position", 400, -100, 100);
144  fTruthVtxZPos = tfs->make<TH1F>("fTruthVtxZPos", "Truth Vertex Z Position", 2000, 0, 1000);
146  tfs->make<TH1F>("fTruthWireNumberPlane0", "Truth Wire Number Plane 0", 3000, 0, 3000);
148  tfs->make<TH1F>("fTruthTimeTickPlane0", "Truth Time Tick Plane 0", 3200, 0, 3200);
150  tfs->make<TH1F>("fTruthWireNumberPlane1", "Truth Wire Number Plane 1", 3000, 0, 3000);
152  tfs->make<TH1F>("fTruthTimeTickPlane1", "Truth Time Tick Plane 1", 3200, 0, 3200);
154  tfs->make<TH1F>("fTruthWireNumberPlane2", "Truth Wire Number Plane 2", 3000, 0, 3000);
156  tfs->make<TH1F>("fTruthTimeTickPlane2", "Truth Time Tick Plane 2", 3200, 0, 3200);
158  tfs->make<TH1F>("fTruthWireInCmPlane0", "Truth Wire In CM Plane 0", 2000, 0, 1000);
160  tfs->make<TH1F>("fTruthTimeInCmPlane0", "Truth Time In Cm Plane 0", 2000, 0, 1000);
162  tfs->make<TH1F>("fTruthWireInCmPlane1", "Truth Wire In CM Plane 1", 2000, 0, 1000);
164  tfs->make<TH1F>("fTruthTimeInCmPlane1", "Truth Time In Cm Plane 1", 2000, 0, 1000);
166  tfs->make<TH1F>("fTruthWireInCmPlane2", "Truth Wire In CM Plane 2", 2000, 0, 1000);
168  tfs->make<TH1F>("fTruthTimeInCmPlane2", "Truth Time In Cm Plane 2", 2000, 0, 1000);
169 
171  tfs->make<TH1F>("fTwoDNVtxPlane0", "TwoD Number of Verticies Found in Plane 0", 400, 0, 200);
173  tfs->make<TH1F>("fTwoDNVtxPlane1", "TwoD Number of Verticies Found in Plane 1", 400, 0, 200);
175  tfs->make<TH1F>("fTwoDNVtxPlane2", "TwoD Number of Verticies Found in Plane 2", 400, 0, 200);
176 
178  tfs->make<TH1F>("fTwoDWireNumberPlane0", "TwoD Wire Number Plane 0", 3000, 0, 3000);
180  tfs->make<TH1F>("fTwoDTimeTickPlane0", "TwoD Time Tick Plane 0", 3200, 0, 3200);
182  tfs->make<TH1F>("fTwoDWireNumberPlane1", "TwoD Wire Number Plane 1", 3000, 0, 3000);
184  tfs->make<TH1F>("fTwoDTimeTickPlane1", "TwoD Time Tick Plane 1", 3200, 0, 3200);
186  tfs->make<TH1F>("fTwoDWireNumberPlane2", "TwoD Wire Number Plane 2", 3000, 0, 3000);
188  tfs->make<TH1F>("fTwoDTimeTickPlane2", "TwoD Time Tick Plane 2", 3200, 0, 3200);
190  tfs->make<TH1F>("fTwoDWireInCmPlane0", "TwoD Wire In CM Plane 0", 2000, 0, 1000);
192  tfs->make<TH1F>("fTwoDTimeInCmPlane0", "TwoD Time In Cm Plane 0", 2000, 0, 1000);
194  tfs->make<TH1F>("fTwoDWireInCmPlane1", "TwoD Wire In CM Plane 1", 2000, 0, 1000);
196  tfs->make<TH1F>("fTwoDTimeInCmPlane1", "TwoD Time In Cm Plane 1", 2000, 0, 1000);
198  tfs->make<TH1F>("fTwoDWireInCmPlane2", "TwoD Wire In CM Plane 2", 2000, 0, 1000);
200  tfs->make<TH1F>("fTwoDTimeInCmPlane2", "TwoD Time In Cm Plane 2", 2000, 0, 1000);
201 
203  tfs->make<TH1F>("fTwoDStrengthPlane0", "TwoD Strength Plane 0", 1000, 0, 500);
205  tfs->make<TH1F>("fTwoDStrengthPlane1", "TwoD Strength Plane 1", 1000, 0, 500);
207  tfs->make<TH1F>("fTwoDStrengthPlane2", "TwoD Strength Plane 2", 1000, 0, 500);
208 
209  fRecoCheck2dWireNumPlane0 = tfs->make<TH1F>(
210  "fRecoCheck2dWireNumPlane0", "Reco Wire Number - True Wire Number Plane 0", 400, -200, 200);
211  fRecoCheck2dTimeTickPlane0 = tfs->make<TH1F>(
212  "fRecoCheck2dTimeTickPlane0", "Reco Time Tick - True Time Tick Plane 0", 1000, -500, 500);
213  fRecoCheck2dWireInCmPlane0 = tfs->make<TH1F>(
214  "fRecoCheck2dWireInCmPlane0", "Reco Wire in CM - True Wire in CM Plane 0", 200, -50, 50);
215  fRecoCheck2dTimeInCmPlane0 = tfs->make<TH1F>(
216  "fRecoCheck2dTimeInCmPlane0", "Reco Time in CM - True Time in CM Plane 0", 200, -50, 50);
217 
218  fRecoCheck2dWireNumPlane1 = tfs->make<TH1F>(
219  "fRecoCheck2dWireNumPlane1", "Reco Wire Number - True Wire Number Plane 1", 400, -200, 200);
220  fRecoCheck2dTimeTickPlane1 = tfs->make<TH1F>(
221  "fRecoCheck2dTimeTickPlane1", "Reco Time Tick - True Time Tick Plane 1", 1000, -500, 500);
222  fRecoCheck2dWireInCmPlane1 = tfs->make<TH1F>(
223  "fRecoCheck2dWireInCmPlane1", "Reco Wire in CM - True Wire in CM Plane 1", 200, -50, 50);
224  fRecoCheck2dTimeInCmPlane1 = tfs->make<TH1F>(
225  "fRecoCheck2dTimeInCmPlane1", "Reco Time in CM - True Time in CM Plane 1", 200, -50, 50);
226 
227  fRecoCheck2dWireNumPlane2 = tfs->make<TH1F>(
228  "fRecoCheck2dWireNumPlane2", "Reco Wire Number - True Wire Number Plane 2", 400, -200, 200);
229  fRecoCheck2dTimeTickPlane2 = tfs->make<TH1F>(
230  "fRecoCheck2dTimeTickPlane2", "Reco Time Tick - True Time Tick Plane 2", 1000, -500, 500);
231  fRecoCheck2dWireInCmPlane2 = tfs->make<TH1F>(
232  "fRecoCheck2dWireInCmPlane2", "Reco Wire in CM - True Wire in CM Plane 2", 200, -50, 50);
233  fRecoCheck2dTimeInCmPlane2 = tfs->make<TH1F>(
234  "fRecoCheck2dTimeInCmPlane2", "Reco Time in CM - True Time in CM Plane 2", 200, -50, 50);
235 
236  fRecoVtxN3d = tfs->make<TH1F>("fRecoVtxN3d", "Number of 3d-Reco Verticies", 400, 0, 200);
237  fRecoVtxXPos = tfs->make<TH1F>("fRecoVtxXPos", "Reco Vertex X Position", 400, -10, 200);
238  fRecoVtxYPos = tfs->make<TH1F>("fRecoVtxYPos", "Reco Vertex Y Position", 400, -100, 100);
239  fRecoVtxZPos = tfs->make<TH1F>("fRecoVtxZPos", "Reco Vertex Z Position", 2000, -10, 1000);
240 
242  tfs->make<TH1F>("fRecoCheck3dVtxX", "Reco X Position - True X Postion", 800, -100, 100);
244  tfs->make<TH1F>("fRecoCheck3dVtxY", "Reco Y Position - True Y Postion", 800, -100, 100);
246  tfs->make<TH1F>("fRecoCheck3dVtxZ", "Reco Z Position - True Z Postion", 800, -100, 100);
247 
248  fRecoCheck3dVtxXvsX = tfs->make<TH2D>(
249  "fRecoCheck3dVtxXvsX", "(Reco X - True X)/True X vs True X", 400, -10, 200, 120, -20, 20);
250  fRecoCheck3dVtxYvsY = tfs->make<TH2D>(
251  "fRecoCheck3dVtxYvsY", "(Reco Y - True Y)/True Y vs True Y", 400, -100, 100, 120, -20, 20);
252  fRecoCheck3dVtxZvsZ = tfs->make<TH2D>(
253  "fRecoCheck3dVtxZvsZ", "(Reco Z - True Z)/True Z vs True Z", 1000, -10, 1000, 120, -20, 20);
254  }
255 
256  void
258  {
259  // Filling Run/Event Histo
260  fRun->Fill(evt.run());
261  fEvt->Fill(evt.id().event());
262 
263  // Getting the Geant Information Directly
264  art::Handle<std::vector<simb::MCParticle>> mcParticleHandle;
265  evt.getByLabel(fLArG4ModuleLabel, mcParticleHandle);
266 
267  // Getting MC Truth Info from simb
268  art::Handle<std::vector<simb::MCTruth>> mctruthListHandle;
269  evt.getByLabel(fGenieModuleLabel, mctruthListHandle);
270 
271  // Getting information from BackTrackerService
272  art::ServiceHandle<cheat::BackTrackerService const> bt_serv;
273 
274  art::ServiceHandle<geo::Geometry const> geom;
275  auto const clock_data =
276  art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(evt);
277  auto const det_prop =
278  art::ServiceHandle<detinfo::DetectorPropertiesService const>()->DataFor(evt, clock_data);
279 
280  // Getting 2d Vertex information (vertex2dHandle)
281  art::Handle<std::vector<recob::EndPoint2D>> vertex2dHandle;
282  evt.getByLabel(fEndPoint2dModuleLabel, vertex2dHandle);
283 
284  // Getting the 3d Vertex (vertex3dListHandle)
285  art::Handle<std::vector<recob::Vertex>> vertex3dListHandle;
286  evt.getByLabel(fVertexModuleLabel, vertex3dListHandle);
287 
288  // Detector numbers that are useful (to be set later)
289  std::vector<double> WirePitch_CurrentPlane(geom->Views().size(),
290  0.); //<---Setting the Wire pitch for each plane
291  // Right now assuming only 3 planes
292  // get the wire pitch for each view
293  size_t vn = 0;
294  for (auto v : geom->Views()) {
295  WirePitch_CurrentPlane[vn] = geom->WirePitch(v);
296  ++vn;
297  }
298 
299  // Calculating the Timetick to CM conversion
300  float TimeTick =
301  sampling_rate(clock_data) / 1000.; //<---To get units of microsecond...not nanosec
302  float DriftVelocity = det_prop.DriftVelocity(det_prop.Efield(), det_prop.Temperature());
303  float TimetoCm = TimeTick * DriftVelocity;
304 
305  // Looping over MC information
306 
307  // Getting MC Truth simb Info
308  art::PtrVector<simb::MCTruth> mclist;
309  for (unsigned int ii = 0; ii < mctruthListHandle->size(); ++ii) {
310  art::Ptr<simb::MCTruth> mctparticle(mctruthListHandle, ii);
311  mclist.push_back(mctparticle);
312  }
313 
314  // Variables for truth vertex information
315  float truth_vertex[5] = {0.}; //<---Truth x,y,z information
316 
317  uint32_t VtxWireNum[3] = {0}; //<---Wire number in each plane ( WireNum[plane#] )
318  double VtxTimeTick[3] = {0.}; //<---Time tick in each plane ( TimeTick[plane#] )
319 
320  double VtxWireNum_InCM[3] = {0.}; //<---Wire number in each plane in CM ( WireNum[plane#] )
321  double VtxTimeTick_InCM[3] = {0.}; //<---Time tick in each plane in CM ( TimeTick[plane#] )
322 
323  // Finding the MC truth vertex
324  for (unsigned int i = 0; i < mclist.size(); ++i) {
325  art::Ptr<simb::MCTruth> mc(mclist[i]);
326  simb::MCParticle neut(mc->GetParticle(i));
327 
328  // Filling the vertex x,y,z information
329  truth_vertex[0] = neut.Vx();
330  truth_vertex[1] = neut.Vy();
331  truth_vertex[2] = neut.Vz();
332 
333  } // end i loop
334 
335  // Filling Histograms
336  fTruthVtxXPos->Fill(truth_vertex[0]);
337  fTruthVtxYPos->Fill(truth_vertex[1]);
338  fTruthVtxZPos->Fill(truth_vertex[2]);
339 
340  // Looping over geo::PlaneIDs
341  for (auto const& pid : geom->IteratePlaneIDs()) {
342  // Calculating the nearest wire the vertex corresponds to in each plane
343  try {
344  VtxWireNum[pid.Plane] = geom->NearestWire(truth_vertex, pid.Plane, pid.TPC, pid.Cryostat);
345  }
346  catch (...) {
347  mf::LogWarning("FeatureVertexFinderAna") << "Can't find nearest wire";
348  continue;
349  }
350  VtxTimeTick[pid.Plane] =
351  det_prop.ConvertXToTicks(truth_vertex[0], pid.Plane, pid.TPC, pid.Cryostat) +
352  det_prop.GetXTicksOffset(pid.Plane, pid.TPC, pid.Cryostat);
353 
354  // Translating each of these in cm
355  VtxWireNum_InCM[pid.Plane] = VtxWireNum[pid.Plane] * WirePitch_CurrentPlane[pid.Plane];
356  VtxTimeTick_InCM[pid.Plane] = VtxTimeTick[pid.Plane] * TimetoCm;
357  } //<---End pid loop
358 
359  // Filling Histograms
360  fTruthWireNumberPlane0->Fill(VtxWireNum[0]);
361  fTruthTimeTickPlane0->Fill(VtxTimeTick[0]);
362  fTruthWireNumberPlane1->Fill(VtxWireNum[1]);
363  fTruthTimeTickPlane1->Fill(VtxTimeTick[1]);
364  fTruthWireNumberPlane2->Fill(VtxWireNum[2]);
365  fTruthTimeTickPlane2->Fill(VtxTimeTick[2]);
366 
367  fTruthWireInCmPlane0->Fill(VtxWireNum_InCM[0]);
368  fTruthTimeInCmPlane0->Fill(VtxTimeTick_InCM[0]);
369  fTruthWireInCmPlane1->Fill(VtxWireNum_InCM[1]);
370  fTruthTimeInCmPlane1->Fill(VtxTimeTick_InCM[1]);
371  fTruthWireInCmPlane2->Fill(VtxWireNum_InCM[2]);
372  fTruthTimeInCmPlane2->Fill(VtxTimeTick_InCM[2]);
373 
374  // Looping over EndPoint2d information
375 
376  art::PtrVector<recob::EndPoint2D> vert2d;
377 
378  // Variables for Vertex2d
379  double Vertex2d_TimeTick[10000] = {
380  0.}; //<---Vertex2d Time Tick for the current plane ( TimeTick[#2d] )
381  double Vertex2d_Wire[10000] = {0.}; //<---Veretx2d Wire # ( Wire[#2d] )
382 
383  double Vertex2d_TimeTick_InCM[10000] = {0.}; //<---Vertex 2d Time tick in CM ( TimeTick[#2d] )
384  double Vertex2d_Wire_InCM[10000] = {0.}; //<---Veretx2d Wire in CM ( Wire[#2d] )
385  int n2dVtx = 0;
386 
387  int n2dVtxPlane0 = 0, n2dVtxPlane1 = 0, n2dVtxPlane2 = 0;
388 
389  bool vertexWstrengthplane0 = false,
390  vertexWstrengthplane1 =
391  false; //, vertexWstrengthplane2 = false; //commented out, Wes, 12.4.13
392 
393  // Loop over the EndPoint2d List
394  for (size_t ii = 0; ii < vertex2dHandle->size(); ++ii) {
395  art::Ptr<recob::EndPoint2D> vertex(vertex2dHandle, ii);
396  vert2d.push_back(vertex);
397  }
398 
399  // If we have 2d vertex, loop over them
400  if (vert2d.size() > 0) {
401 
402  // Looping over geo::PlaneIDs
403  for (auto const& pid : geom->IteratePlaneIDs()) {
404  for (size_t ww = 0; ww < vert2d.size(); ++ww) {
405  // Only look at this 2d vertex if it is in the current plane
406  if (vert2d[ww]->WireID().planeID() != pid) { continue; }
407 
408  Vertex2d_TimeTick[n2dVtx] = vert2d[ww]->DriftTime();
409  Vertex2d_Wire[n2dVtx] = vert2d[ww]->WireID().Wire;
410 
411  // Translating each of these in cm
412  Vertex2d_Wire_InCM[n2dVtx] = Vertex2d_Wire[n2dVtx] * WirePitch_CurrentPlane[pid.Plane];
413  Vertex2d_TimeTick_InCM[n2dVtx] = Vertex2d_TimeTick[n2dVtx] * TimetoCm;
414 
415  // Checking how well we did in reconstructing the vertex (Reco - True)
416 
417  float RecoCheck_TimeTick = Vertex2d_TimeTick[n2dVtx] - VtxTimeTick[pid.Plane];
418  float RecoCheck_WireNum = Vertex2d_Wire[n2dVtx] - VtxWireNum[pid.Plane];
419 
420  float RecoCheck_TimeInCm = Vertex2d_TimeTick_InCM[n2dVtx] - VtxTimeTick_InCM[pid.Plane];
421  float RecoCheck_WireInCm = Vertex2d_Wire_InCM[n2dVtx] - VtxWireNum_InCM[pid.Plane];
422 
423  if (vert2d[ww]->Strength() > -1) {
424  if (pid.Plane == 0) {
425  vertexWstrengthplane0 = true;
426 
427  fTwoDWireNumberPlane0->Fill(Vertex2d_Wire[n2dVtx]);
428  fTwoDTimeTickPlane0->Fill(Vertex2d_TimeTick[n2dVtx]);
429  fTwoDWireInCmPlane0->Fill(Vertex2d_Wire_InCM[n2dVtx]);
430  fTwoDTimeInCmPlane0->Fill(Vertex2d_TimeTick_InCM[n2dVtx]);
431 
432  fTwoDStrengthPlane0->Fill(vert2d[ww]->Strength());
433 
434  fRecoCheck2dWireNumPlane0->Fill(RecoCheck_WireNum);
435  fRecoCheck2dTimeTickPlane0->Fill(RecoCheck_TimeTick);
436  fRecoCheck2dWireInCmPlane0->Fill(RecoCheck_WireInCm);
437  fRecoCheck2dTimeInCmPlane0->Fill(RecoCheck_TimeInCm);
438 
439  n2dVtxPlane0++;
440 
441  } //<---End Plane 0
442 
443  if (pid.Plane == 1) {
444  vertexWstrengthplane1 = true;
445  fTwoDWireNumberPlane1->Fill(Vertex2d_Wire[n2dVtx]);
446  fTwoDTimeTickPlane1->Fill(Vertex2d_TimeTick[n2dVtx]);
447  fTwoDWireInCmPlane1->Fill(Vertex2d_Wire_InCM[n2dVtx]);
448  fTwoDTimeInCmPlane1->Fill(Vertex2d_TimeTick_InCM[n2dVtx]);
449 
450  fTwoDStrengthPlane1->Fill(vert2d[ww]->Strength());
451 
452  fRecoCheck2dWireNumPlane1->Fill(RecoCheck_WireNum);
453  fRecoCheck2dTimeTickPlane1->Fill(RecoCheck_TimeTick);
454  fRecoCheck2dWireInCmPlane1->Fill(RecoCheck_WireInCm);
455  fRecoCheck2dTimeInCmPlane1->Fill(RecoCheck_TimeInCm);
456 
457  n2dVtxPlane1++;
458 
459  } //<---End Plane 1
460 
461  if (pid.Plane == 2) {
462  fTwoDWireNumberPlane2->Fill(Vertex2d_Wire[n2dVtx]);
463  fTwoDTimeTickPlane2->Fill(Vertex2d_TimeTick[n2dVtx]);
464  fTwoDWireInCmPlane2->Fill(Vertex2d_Wire_InCM[n2dVtx]);
465  fTwoDTimeInCmPlane2->Fill(Vertex2d_TimeTick_InCM[n2dVtx]);
466 
467  fTwoDStrengthPlane2->Fill(vert2d[ww]->Strength());
468 
469  fRecoCheck2dWireNumPlane2->Fill(RecoCheck_WireNum);
470  fRecoCheck2dTimeTickPlane2->Fill(RecoCheck_TimeTick);
471  fRecoCheck2dWireInCmPlane2->Fill(RecoCheck_WireInCm);
472  fRecoCheck2dTimeInCmPlane2->Fill(RecoCheck_TimeInCm);
473 
474  n2dVtxPlane2++;
475 
476  } //<---End Plane 2
477  }
478 
479  ++n2dVtx;
480  } //<--end ww loop
481 
482  } //<---End plane ID
483 
484  } //<--End checking if we have 2d end points
485 
486  fTwoDNVtxPlane0->Fill(n2dVtxPlane0);
487  fTwoDNVtxPlane1->Fill(n2dVtxPlane1);
488  fTwoDNVtxPlane2->Fill(n2dVtxPlane2);
489 
490  // Looping over 3dVertex information
491  art::PtrVector<recob::Vertex> Vertexlist;
492 
493  double xyz[3] = {0.};
494 
495  for (unsigned int ii = 0; ii < vertex3dListHandle->size(); ++ii) {
496  art::Ptr<recob::Vertex> vertex3d(vertex3dListHandle, ii);
497  Vertexlist.push_back(vertex3d); // class member
498 
499  } //<---End ii loop
500 
501  if (Vertexlist.size() > 0 && vertexWstrengthplane0 && vertexWstrengthplane1) {
502 
503  fRecoVtxN3d->Fill(Vertexlist.size());
504  for (unsigned int ww = 0; ww < Vertexlist.size(); ww++) {
505  Vertexlist[ww]->XYZ(xyz);
506 
507  // Checking how well we did in reconstructing the vertex (Reco - True)
508 
509  // Finding the Delta X, Y, Z between Reco vtx and truth
510  double DeltaX = xyz[0] - truth_vertex[0];
511  double DeltaY = xyz[1] - truth_vertex[1];
512  double DeltaZ = xyz[2] - truth_vertex[2];
513 
514  double DeltaXoverTrueX = DeltaX / truth_vertex[0];
515  double DeltaYoverTrueY = DeltaY / truth_vertex[0];
516  double DeltaZoverTrueZ = DeltaZ / truth_vertex[0];
517 
518  fRecoVtxXPos->Fill(xyz[0]);
519  fRecoVtxYPos->Fill(xyz[1]);
520  fRecoVtxZPos->Fill(xyz[2]);
521 
522  fRecoCheck3dVtxX->Fill(DeltaX);
523  fRecoCheck3dVtxY->Fill(DeltaY);
524  fRecoCheck3dVtxZ->Fill(DeltaZ);
525 
526  fRecoCheck3dVtxXvsX->Fill(xyz[0], DeltaXoverTrueX);
527  fRecoCheck3dVtxYvsY->Fill(xyz[1], DeltaYoverTrueY);
528  fRecoCheck3dVtxZvsZ->Fill(xyz[2], DeltaZoverTrueZ);
529  }
530  }
531  } //<---End access the event
532 
533  DEFINE_ART_MODULE(FeatureVertexFinderAna)
534 
535 } // end of vertex namespace
process_name vertex
Definition: cheaterreco.fcl:51
void analyze(const art::Event &evt) override
FeatureVertexFinderAna(fhicl::ParameterSet const &pset)
IDparameter< geo::WireID > WireID
Member type of validated geo::WireID parameter.
art::ServiceHandle< art::TFileService > tfs
TCEvent evt
Definition: DataStructs.cxx:8
double sampling_rate(DetectorClocksData const &data)
Returns the period of the TPC readout electronics clock.
art framework interface to geometry description