LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
PxHitConverter.cxx
Go to the documentation of this file.
1 // \file PxHitConverter.cxx
3 //
4 // \brief conversion utulities from recob::Hit to PxHit
5 //
6 // \author andrzej.szelc@yale.edu, based on LarLite code by Kazu
7 //
8 //
10 #include "PxHitConverter.h"
11 
12 
13 // C/C++ standard libraries
14 #include <algorithm> // std::transform(), std::iota()
15 #include <iterator> // std::back_inserter()
16 #include <functional> // std::mem_fun()
17 
18 
19 namespace util {
20 
21 
23 
24 
26  std::vector<util::PxHit> &pxhits) const
27  {
28 
29  if(!(hits.size())) throw UtilException(Form("Hit list empty! (%s)",__FUNCTION__));
30 
31  std::vector<unsigned int> hit_index;
32 
33  hit_index.clear();
34  hit_index.reserve(hits.size());
35 
36  //generate full index
37  for(unsigned int ix=0; ix<hits.size();++ix ) hit_index.push_back(ix);
38 
39  GeneratePxHit(hit_index,hits,pxhits);
40 
41  }
42 
43 
45  util::PxHit &pxhit) const
46  {
47  pxhit = ToPxHit(hit);
48  }
49 
50 
52  {
53 
55 
56  PxHit pxhit;
57  pxhit.t = hit.PeakTime() * gser.TimeToCm();
58  pxhit.w = hit.WireID().Wire * gser.WireToCm();
59  pxhit.charge = hit.Integral();
60  pxhit.sumADC = hit.SummedADC();
61  pxhit.peak = hit.PeakAmplitude();
62  pxhit.plane = hit.WireID().Plane;
63 
64  return pxhit;
65  } // PxHitConverter::HitToPxHit(recob::Hit)
66 
67 
68 
70  void PxHitConverter::GeneratePxHit(const std::vector<unsigned int>& hit_index,
72  std::vector<util::PxHit> &pxhits) const
73  {
74 
75  if(!(hit_index.size())) throw UtilException(Form("Hit list empty! (%s)",__FUNCTION__));
76 
77  pxhits.clear();
78  pxhits.reserve(hit_index.size());
79 
80  for(auto const& index : hit_index) {
81 
82  auto const& hit = hits[index];
83 
84  PxHit h;
86 
87  pxhits.push_back(h);
88  }
89 
90  }
91 
92 }// end namespace util
void GenerateSinglePxHit(art::Ptr< recob::Hit > const &hit, util::PxHit &pxhits) const
Namespace for general, non-LArSoft-specific utilities.
Definition: PIDAAlg.h:17
geo::WireID WireID() const
Initial tdc tick for hit.
Definition: Hit.h:234
Double_t TimeToCm() const
Double_t WireToCm() const
float Integral() const
Integral under the calibrated signal waveform of the hit, in tick x ADC units.
Definition: Hit.h:225
WireID_t Wire
Index of the wire within its plane.
Definition: geo_types.h:313
util::PxHit ToPxHit(HitObj const &hit) const
float PeakAmplitude() const
The estimated amplitude of the hit at its peak, in ADC units.
Definition: Hit.h:222
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:265
void hits()
Definition: readHits.C:15
void GeneratePxHit(const std::vector< unsigned int > &hit_index, const std::vector< art::Ptr< recob::Hit >> hits, std::vector< util::PxHit > &pxhits) const
Generate: from 1 set of hits => 1 set of PxHits using indexes (association)
double t
Definition: PxUtils.h:11
util::PxHit HitToPxHit(recob::Hit const &hit) const
Generates and returns a PxHit out of a recob::Hit.
PlaneID_t Plane
Index of the plane within its TPC.
Definition: geo_types.h:258
Detector simulation of raw signals on wires.
double w
Definition: PxUtils.h:10
float PeakTime() const
Time of the signal peak, in tick units.
Definition: Hit.h:219
double charge
area charge
Definition: PxUtils.h:39
float SummedADC() const
The sum of calibrated ADC counts of the hit (0. by default)
Definition: Hit.h:224
2D representation of charge deposited in the TDC/wire plane
Definition: Hit.h:49
double sumADC
sum of ADCs
Definition: PxUtils.h:40
double peak
peak amplitude
Definition: PxUtils.h:41
unsigned int plane
Definition: PxUtils.h:12