LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
PxHitConverter.h
Go to the documentation of this file.
1 // \file PxHitConverter.h
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 #ifndef UTIL_PXHITCONVERTER_H
11 #define UTIL_PXHITCONVERTER_H
12 
13 //#include <TMath.h>
14 //#include <TLorentzVector.h>
15 
16 #include "PxUtils.h"
21 //#include "time.h"
22 
24 //#include "Geometry/CryostatGeo.h"
25 //#include "Geometry/PlaneGeo.h"
26 //#include "Geometry/WireGeo.h"
27 //#include "Geometry/TPCGeo.h"
28 //#include "SimpleTypesAndConstants/geo_types.h"
30 
31 //#include <climits>
32 #include <iostream>
33 #include <vector>
34 
35 
37 namespace util{
38 
39 
40  //class GeometryUtilities : public larlight::larlight_base {
42 
43  public:
44 
45  // Constructors and assignment operators generated by default
46 
48  virtual ~PxHitConverter() = default;
49 
50 // /// Generate: from 1 set of hits => 1 CPAN using indexes (association)
51 // void GenerateCPAN(const std::vector<unsigned int>& hit_index,
52 // const larlite::event_hit* hits,
53 // ClusterParamsAlg &cpan) const;
54 //
55 // /// Generate: CPAN vector from event storage by specifying cluster type
56 // void GenerateCPAN(::larlite::storage_manager* storage,
57 // const std::string &cluster_producer_name,
58 // std::vector<cluster::ClusterParamsAlg> &cpan_v) const;
59 
61  void GeneratePxHit(const std::vector<unsigned int>& hit_index,
63  std::vector<util::PxHit> &pxhits) const;
64 
67  std::vector<util::PxHit> &pxhits) const;
68 
70  util::PxHit &pxhits) const;
71 
72 
74  util::PxHit HitToPxHit(recob::Hit const& hit) const;
75  /*
77  util::PxHit ToPxHit(recob::Hit const& hit) const;
78 
80  util::PxHit ToPxHit(art::Ptr<recob::Hit> const& hit) const
81  { return ToPxHit(*hit); }
82 
84  util::PxHit ToPxHit(recob::Hit const* hit) const
85  { return ToPxHit(*hit); }
86  */
87 
90  template <typename HitObj>
91  util::PxHit ToPxHit(HitObj const& hit) const;
92 
93 
95  template <typename Cont, typename Hit = typename Cont::value_type>
96  std::vector<util::PxHit> ToPxHitVector(Cont const& hits) const;
97 
98 
99 
100 
101 // /// Generate: vector of PxHit sets from event storage by specifying cluster type
102 // void GeneratePxHit(larlite::storage_manager* storage,
103 // const std::string &cluster_producer_name,
104 // std::vector<std::vector<larutil::PxHit> > &pxhits_v) const;
105 
106  }; // class PxHitConverter
107 
108 } //namespace util
109 
110 
111 //******************************************************************************
112 //*** Template implementation
113 //***
114 template <typename HitObj>
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  );
126  return HitToPxHit(lar::util::dereference(hit));
127 } // PxHitConverter::ToPxHit()
128 
129 
130 template <typename Cont, typename Hit /* = typename Cont::value_type */>
131 std::vector<util::PxHit> util::PxHitConverter::ToPxHitVector
132  (Cont const& hits) const
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()
140 
141 
142 
143 #endif // UTIL_PXHITCONVERTER_H
void GenerateSinglePxHit(art::Ptr< recob::Hit > const &hit, util::PxHit &pxhits) const
Namespace for general, non-LArSoft-specific utilities.
Definition: PIDAAlg.h:17
std::vector< util::PxHit > ToPxHitVector(Cont const &hits) const
Returns a vector of util::PxHit out of a vector of hits.
Class def header for exception classes used in GeometryUtilities.
Declaration of signal hit object.
util::PxHit ToPxHit(HitObj const &hit) const
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
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)
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
virtual ~PxHitConverter()=default
Default destructor (virtual)
art framework interface to geometry description