LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
util::PxHitConverter Class Reference

#include "PxHitConverter.h"

Public Member Functions

virtual ~PxHitConverter ()=default
 Default destructor (virtual) More...
 
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) More...
 
void GeneratePxHit (std::vector< art::Ptr< recob::Hit >> const &hits, std::vector< util::PxHit > &pxhits) const
 Generate: from 1 set of hits => 1 set of PxHits using using all hits. More...
 
void GenerateSinglePxHit (art::Ptr< recob::Hit > const &hit, util::PxHit &pxhits) const
 
util::PxHit HitToPxHit (recob::Hit const &hit) const
 Generates and returns a PxHit out of a recob::Hit. More...
 
template<typename HitObj >
util::PxHit ToPxHit (HitObj const &hit) const
 
template<typename Cont , typename Hit = typename Cont::value_type>
std::vector< util::PxHitToPxHitVector (Cont const &hits) const
 Returns a vector of util::PxHit out of a vector of hits. More...
 

Detailed Description

Definition at line 41 of file PxHitConverter.h.

Constructor & Destructor Documentation

virtual util::PxHitConverter::~PxHitConverter ( )
virtualdefault

Default destructor (virtual)

Member Function Documentation

void util::PxHitConverter::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)

Definition at line 70 of file PxHitConverter.cxx.

References GenerateSinglePxHit(), and hits().

Referenced by evd::HitSelector::ChangeHit(), GeneratePxHit(), cluster::SimpleClusterMerger::produce(), cluster::FuzzyClusterMerger::produce(), ShowerReco3D::produce(), and evd::HitSelector::SaveHits().

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  }
void GenerateSinglePxHit(art::Ptr< recob::Hit > const &hit, util::PxHit &pxhits) const
Detector simulation of raw signals on wires.
void util::PxHitConverter::GeneratePxHit ( std::vector< art::Ptr< recob::Hit >> const &  hits,
std::vector< util::PxHit > &  pxhits 
) const

Generate: from 1 set of hits => 1 set of PxHits using using all hits.

Generate: from 1 set of hits => 1 set of PxHits using indexes (association)

Definition at line 25 of file PxHitConverter.cxx.

References GeneratePxHit(), and hits().

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  }
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)
void util::PxHitConverter::GenerateSinglePxHit ( art::Ptr< recob::Hit > const &  hit,
util::PxHit pxhits 
) const

Definition at line 44 of file PxHitConverter.cxx.

References ToPxHit().

Referenced by GeneratePxHit().

46  {
47  pxhit = ToPxHit(hit);
48  }
util::PxHit ToPxHit(HitObj const &hit) const
PxHit util::PxHitConverter::HitToPxHit ( recob::Hit const &  hit) const

Generates and returns a PxHit out of a recob::Hit.

Definition at line 51 of file PxHitConverter.cxx.

References util::PxHit::charge, recob::Hit::Integral(), util::PxHit::peak, recob::Hit::PeakAmplitude(), recob::Hit::PeakTime(), util::PxPoint::plane, geo::PlaneID::Plane, util::PxHit::sumADC, recob::Hit::SummedADC(), util::PxPoint::t, util::GeometryUtilities::TimeToCm(), util::PxPoint::w, geo::WireID::Wire, recob::Hit::WireID(), and util::GeometryUtilities::WireToCm().

Referenced by ToPxHit().

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)
Double_t TimeToCm() const
Double_t WireToCm() const
Detector simulation of raw signals on wires.
template<typename HitObj >
util::PxHit util::PxHitConverter::ToPxHit ( HitObj const &  hit) const

Generates and returns a PxHit out of a pointer to recob::Hit or a hit itself

Definition at line 115 of file PxHitConverter.h.

References lar::util::dereference(), HitToPxHit(), ToPxHitVector(), and fhicl::detail::atom::value().

Referenced by GenerateSinglePxHit(), and ToPxHitVector().

116 {
117  // check that the argument is an object convertible to a recob::Hit,
118  // or it is a pointer to such an object
119  static_assert(
120  std::is_convertible<
122  recob::Hit
123  >::value,
124  "The argument to PxHitConverter::ToPxHit() does not point to a recob::Hit"
125  );
127 } // PxHitConverter::ToPxHit()
details::dereference_class< T, details::has_dereference_class< T >::value >::reference_type dereference(T &v)
Returns the value pointed by the argument, or the argument itself.
Definition: Dereference.h:254
util::PxHit HitToPxHit(recob::Hit const &hit) const
Generates and returns a PxHit out of a recob::Hit.
Detector simulation of raw signals on wires.
std::string value(boost::any const &)
2D representation of charge deposited in the TDC/wire plane
Definition: Hit.h:49
template<typename Cont , typename Hit >
std::vector< util::PxHit > util::PxHitConverter::ToPxHitVector ( Cont const &  hits) const

Returns a vector of util::PxHit out of a vector of hits.

Definition at line 132 of file PxHitConverter.h.

References ToPxHit().

Referenced by cluster::StandardClusterParamsAlg::SetHits(), and ToPxHit().

133 {
134  std::vector<util::PxHit> pxhits;
135  pxhits.reserve(hits.size());
136  std::transform(hits.begin(), hits.end(), std::back_inserter(pxhits),
137  [this](Hit const& hit) { return this->ToPxHit(hit); });
138  return pxhits;
139 } // util::PxHitConverter::ToPxHitVector()
util::PxHit ToPxHit(HitObj const &hit) const
void hits()
Definition: readHits.C:15
Detector simulation of raw signals on wires.

The documentation for this class was generated from the following files: