LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
util::PxHitConverter Class Reference

#include "PxHitConverter.h"

Public Member Functions

 PxHitConverter (GeometryUtilities const &geomUtils)
 
void GeneratePxHit (const std::vector< unsigned int > &hit_index, const std::vector< art::Ptr< recob::Hit >> hits, std::vector< 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< 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, PxHit &pxhits) const
 
PxHit HitToPxHit (recob::Hit const &hit) const
 Generates and returns a PxHit out of a recob::Hit. More...
 
template<typename HitObj >
PxHit ToPxHit (HitObj const &hit) const
 
template<typename Cont , typename Hit = typename Cont::value_type>
std::vector< PxHitToPxHitVector (Cont const &hits) const
 Returns a vector of PxHit out of a vector of hits. More...
 
template<typename HitObj >
util::PxHit ToPxHit (HitObj const &hit) const
 
template<typename Cont , typename Hit >
std::vector< util::PxHitToPxHitVector (Cont const &hits) const
 

Private Attributes

GeometryUtilities const & fGeomUtils
 

Detailed Description

Definition at line 27 of file PxHitConverter.h.

Constructor & Destructor Documentation

util::PxHitConverter::PxHitConverter ( GeometryUtilities const &  geomUtils)
explicit

Definition at line 19 of file PxHitConverter.cxx.

19 : fGeomUtils{geomUtils} {}
GeometryUtilities const & fGeomUtils

Member Function Documentation

void util::PxHitConverter::GeneratePxHit ( const std::vector< unsigned int > &  hit_index,
const std::vector< art::Ptr< recob::Hit >>  hits,
std::vector< PxHit > &  pxhits 
) const

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

Definition at line 56 of file PxHitConverter.cxx.

References util::empty(), GenerateSinglePxHit(), and hits().

Referenced by evd::HitSelector::ChangeHit(), GeneratePxHit(), and evd::HitSelector::SaveHits().

59  {
60  if (empty(hit_index)) throw UtilException(Form("Hit list empty! (%s)", __FUNCTION__));
61 
62  pxhits.clear();
63  pxhits.reserve(hit_index.size());
64 
65  for (auto const& index : hit_index) {
66  auto const& hit = hits[index];
67 
68  PxHit h;
70 
71  pxhits.push_back(h);
72  }
73  }
void GenerateSinglePxHit(art::Ptr< recob::Hit > const &hit, PxHit &pxhits) const
Detector simulation of raw signals on wires.
decltype(auto) constexpr empty(T &&obj)
ADL-aware version of std::empty.
Definition: StdUtils.h:109
void util::PxHitConverter::GeneratePxHit ( std::vector< art::Ptr< recob::Hit >> const &  hits,
std::vector< 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 22 of file PxHitConverter.cxx.

References util::empty(), GeneratePxHit(), and hits().

24  {
25  if (empty(hits)) throw UtilException(Form("Hit list empty! (%s)", __FUNCTION__));
26 
27  std::vector<unsigned int> hit_index;
28  hit_index.reserve(hits.size());
29 
30  //generate full index
31  for (unsigned int ix = 0; ix < hits.size(); ++ix)
32  hit_index.push_back(ix);
33 
34  GeneratePxHit(hit_index, hits, pxhits);
35  }
void GeneratePxHit(const std::vector< unsigned int > &hit_index, const std::vector< art::Ptr< recob::Hit >> hits, std::vector< PxHit > &pxhits) const
Generate: from 1 set of hits => 1 set of PxHits using indexes (association)
decltype(auto) constexpr empty(T &&obj)
ADL-aware version of std::empty.
Definition: StdUtils.h:109
void util::PxHitConverter::GenerateSinglePxHit ( art::Ptr< recob::Hit > const &  hit,
util::PxHit pxhit 
) const

Definition at line 37 of file PxHitConverter.cxx.

References ToPxHit().

Referenced by GeneratePxHit().

39  {
40  pxhit = ToPxHit(hit);
41  }
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 43 of file PxHitConverter.cxx.

References util::PxHit::charge, fGeomUtils, 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().

44  {
45  PxHit pxhit;
46  pxhit.t = hit.PeakTime() * fGeomUtils.TimeToCm();
47  pxhit.w = hit.WireID().Wire * fGeomUtils.WireToCm();
48  pxhit.charge = hit.Integral();
49  pxhit.sumADC = hit.SummedADC();
50  pxhit.peak = hit.PeakAmplitude();
51  pxhit.plane = hit.WireID().Plane;
52  return pxhit;
53  } // PxHitConverter::HitToPxHit(recob::Hit)
GeometryUtilities const & fGeomUtils
Detector simulation of raw signals on wires.
template<typename HitObj >
PxHit util::PxHitConverter::ToPxHit ( HitObj const &  hit) const

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

Referenced by GenerateSinglePxHit(), and ToPxHitVector().

template<typename HitObj >
util::PxHit util::PxHitConverter::ToPxHit ( HitObj const &  hit) const

Definition at line 64 of file PxHitConverter.h.

References lar::util::dereference(), HitToPxHit(), and value.

65 {
66  // check that the argument is an object convertible to a recob::Hit,
67  // or it is a pointer to such an object
68  static_assert(
69  std::is_convertible<typename lar::util::dereferenced_type<HitObj>::type, recob::Hit>::value,
70  "The argument to PxHitConverter::ToPxHit() does not point to a recob::Hit");
72 } // 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:241
PxHit HitToPxHit(recob::Hit const &hit) const
Generates and returns a PxHit out of a recob::Hit.
double value
Definition: spectrum.C:18
Detector simulation of raw signals on wires.
2D representation of charge deposited in the TDC/wire plane
Definition: Hit.h:46
template<typename Cont , typename Hit = typename Cont::value_type>
std::vector<PxHit> util::PxHitConverter::ToPxHitVector ( Cont const &  hits) const

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

template<typename Cont , typename Hit >
std::vector<util::PxHit> util::PxHitConverter::ToPxHitVector ( Cont const &  hits) const

Definition at line 75 of file PxHitConverter.h.

References ToPxHit().

76 {
77  std::vector<PxHit> pxhits;
78  pxhits.reserve(hits.size());
79  std::transform(hits.begin(), hits.end(), std::back_inserter(pxhits), [this](Hit const& hit) {
80  return this->ToPxHit(hit);
81  });
82  return pxhits;
83 } // util::PxHitConverter::ToPxHitVector()
PxHit ToPxHit(HitObj const &hit) const
void hits()
Definition: readHits.C:15
Detector simulation of raw signals on wires.

Member Data Documentation

GeometryUtilities const& util::PxHitConverter::fGeomUtils
private

Definition at line 55 of file PxHitConverter.h.

Referenced by HitToPxHit().


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