All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Attributes | List of all members
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 59 of file PxHitConverter.cxx.

62  {
63  if (empty(hit_index)) throw UtilException(Form("Hit list empty! (%s)", __FUNCTION__));
64 
65  pxhits.clear();
66  pxhits.reserve(hit_index.size());
67 
68  for (auto const& index : hit_index) {
69  auto const& hit = hits[index];
70 
71  PxHit h;
73 
74  pxhits.push_back(h);
75  }
76  }
process_name hit
Definition: cheaterreco.fcl:51
void GenerateSinglePxHit(art::Ptr< recob::Hit > const &hit, PxHit &pxhits) const
while getopts h
decltype(auto) constexpr empty(T &&obj)
ADL-aware version of std::empty.
Definition: StdUtils.h:97
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 23 of file PxHitConverter.cxx.

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

Definition at line 39 of file PxHitConverter.cxx.

40  {
41  pxhit = ToPxHit(hit);
42  }
process_name hit
Definition: cheaterreco.fcl:51
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 45 of file PxHitConverter.cxx.

46  {
47  PxHit pxhit;
48  pxhit.t = hit.PeakTime() * fGeomUtils.TimeToCm();
49  pxhit.w = hit.WireID().Wire * fGeomUtils.WireToCm();
50  pxhit.charge = hit.Integral();
51  pxhit.sumADC = hit.SummedADC();
52  pxhit.peak = hit.PeakAmplitude();
53  pxhit.plane = hit.WireID().Plane;
54  return pxhit;
55  } // PxHitConverter::HitToPxHit(recob::Hit)
GeometryUtilities const & fGeomUtils
Double_t TimeToCm() const
Double_t WireToCm() const
process_name hit
Definition: cheaterreco.fcl:51
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

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

Definition at line 65 of file PxHitConverter.h.

66 {
67  // check that the argument is an object convertible to a recob::Hit,
68  // or it is a pointer to such an object
69  static_assert(
70  std::is_convertible<typename lar::util::dereferenced_type<HitObj>::type, recob::Hit>::value,
71  "The argument to PxHitConverter::ToPxHit() does not point to a recob::Hit");
73 } // PxHitConverter::ToPxHit()
process_name hit
Definition: cheaterreco.fcl:51
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
PxHit HitToPxHit(recob::Hit const &hit) const
Generates and returns a PxHit out of a recob::Hit.
temporary value
2D representation of charge deposited in the TDC/wire plane
Definition: Hit.h:48
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 77 of file PxHitConverter.h.

78 {
79  std::vector<PxHit> pxhits;
80  pxhits.reserve(hits.size());
81  std::transform(hits.begin(), hits.end(), std::back_inserter(pxhits), [this](Hit const& hit) {
82  return this->ToPxHit(hit);
83  });
84  return pxhits;
85 } // util::PxHitConverter::ToPxHitVector()
static constexpr Sample_t transform(Sample_t sample)
process_name hit
Definition: cheaterreco.fcl:51
PxHit ToPxHit(HitObj const &hit) const

Member Data Documentation

GeometryUtilities const& util::PxHitConverter::fGeomUtils
private

Definition at line 55 of file PxHitConverter.h.


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