SmallClusterFinderAlg.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // \file SmallClusterFinderAlg.h
4 //
5 // \author corey.adams@yale.edu
6 //
7 // This algorithm is designed to find small clusters that could correspond to gammas
8 // or low energy electrons.
9 //
10 /* There are two parameters that matter from the fcl file:
11  fNHitsInClust is the number of hits that should be in these small clusters
12  ^-- Gamma events seem to rarely have more than 4 hits in the cluster
13  ^-- SN events are unclear. Should this even be used for SN?
14  fRadiusSizePar is the distance (in cm) between the small clusters and any other hits.
15 
16  This algorithm sorts the hits by plane, and then looks at each hit individually. If
17  there is a hit within RadiusSizePar, it gets added to a local list. All other hits
18  are ignored. Then, if the number of hits that got added to the local list is greater
19  then NHitsInClust, the original hit is ignored. If it's less, the original hit is
20  presumed to be part of a very small (or single hit) cluster. So its added to the list
21  of hits in the small cluster.
22 
23  All of the small clusters are then split apart into groups in the way you would expect.
24  Each cluster is assigned an ID number to distinguish it, and the hits that aren't
25  identified as small clusters all end up in the "leftover" cluster. The numbering scheme
26  is ID = 100*iPlane + Cluster on that plane, and the leftover hits are the first (0th)
27  cluster written out.
28 
29  -Corey
30 */
31 //
32 //
33 ///////////////////////////////////////////////////////////////////////
34 
35 #ifndef SMALLCLUSTERFINDERALG_H
36 #define SMALLCLUSTERFINDERALG_H
37 
40 #include "fhiclcpp/fwd.h"
41 
44 
45 namespace detinfo {
46  class DetectorClocksData;
47  class DetectorPropertiesData;
48 }
49 
50 namespace util {
51  class GeometryUtilities;
52 }
53 
54 namespace cluster {
55 
57  public:
58  explicit SmallClusterFinderAlg(fhicl::ParameterSet const& pset);
59 
60  void SelectLocalHitlist(util::GeometryUtilities const& gser,
62  std::vector<art::Ptr<recob::Hit>>& hitlistlocal,
63  double wire_start,
64  double time_start,
65  double radlimit) const;
66  void SelectLocalHitlist(util::GeometryUtilities const& gser,
68  std::vector<art::Ptr<recob::Hit>>& hitlistlocal,
69  double wire_start,
70  double time_start,
71  double radlimit,
72  std::vector<int>&) const;
73 
74  // pass in a hit, all the others are filled in the function.
75  int GetPlaneAndTPC(art::Ptr<recob::Hit> a,
76  unsigned int& plane,
77  unsigned int& cryostat,
78  unsigned int& time,
79  unsigned int& wire) const;
80 
81  //passes in a hitlist, returns a list of gammas and puts everything else in hitlistleftover
82  std::vector<art::Ptr<recob::Hit>> CreateHighHitlist(
83  util::GeometryUtilities const& gser,
84  std::vector<art::Ptr<recob::Hit>> const& hitlist,
85  std::vector<art::Ptr<recob::Hit>>& hitlistleftover) const;
86 
87  // this routine actually finds the clusters
88  // It stores them in smallClustList
89  // It puts the leftover hits in hitlistleftover
90  void FindSmallClusters(util::GeometryUtilities const& gser,
91  detinfo::DetectorClocksData const& dataClocks,
92  detinfo::DetectorPropertiesData const& detProp,
94 
95  // This function is solely to sort the leftover hits. It's not done
96  // automatically because it's not a short process if the number of hits is
97  // big. For a few hits its not that bad. not yet functional! by this I
98  // mean, does not yet exist
99  void sortLeftoverHits();
100 
101  std::vector<std::vector<art::Ptr<recob::Hit>>> GetSmallClustersByPlane(unsigned int iPlane);
102  //This function just returns the clusters by plane, and they are split already.
103 
104  std::vector<art::Ptr<recob::Hit>> GetLeftoversByPlane(unsigned int iPlane);
105  //This function returns the leftover hits.
106 
107  private:
108  //Special function to make sure the vectors are all the right size
109  //can't do the hits, but can clear them and do the planes.
110  //Gets called each time FindSmallClusters is called, as well as in the constructor.
111  void ClearandResizeVectors();
112 
113  //**************All of the constants needed to do this process:
114  double fWiretoCm, fTimetoCm, fWireTimetoCmCm;
115  float fTimeTick; // time sample in us
116  float fDriftVelocity; // used to convert time to cm
117  double fWirePitch; // wire pitch in cm
118  std::vector<unsigned int> fNWires; // Number of wires on each plane
119  unsigned int fNPlanes; // number of planes
120  double fNTimes;
121 
122  // The various art grabbed Larsoft stuff to get physical properties.
124 
125  // The vectors that actually get used to hold hits, sets of hits, etc.
126  // All have the plane as the first index
127  std::vector<std::vector<std::vector<art::Ptr<recob::Hit>>>> smallClustList;
128  // This list is meant to contain the small clusters.
129  // It should be indexed by smallClustList[plane][smallcluster][hit]
130  std::vector<std::vector<art::Ptr<recob::Hit>>>
131  hitlistrefined; // list, by plane, of hits that ought to be gammas
132  std::vector<std::vector<art::Ptr<recob::Hit>>> hitlistbyplane; // list of all hits on each plane
133  std::vector<std::vector<art::Ptr<recob::Hit>>>
134  hitlistleftover; // list of all hits on each plane that are NOT gammas
135 
136  // input parameters, grabbed from the parameter set
137  bool verbose; // Make lots of printouts?
138  double fRadiusSizePar; // Determines the max radius of the cluster, must be
139  // separated
140  double fNHitsInClust; // Forces cluster to have a max number of hits
141  // Remember, this is the *small* cluster finder
142  }; // class SmallAngleFinder
143 }
144 #endif // SMALLCLUSTERFINDERALG_H
Namespace for general, non-LArSoft-specific utilities.
std::vector< std::vector< art::Ptr< recob::Hit > > > hitlistbyplane
std::vector< std::vector< std::vector< art::Ptr< recob::Hit > > > > smallClustList
struct vector vector
Cluster finding and building.
std::vector< std::vector< art::Ptr< recob::Hit > > > hitlistleftover
art framework interface to geometry description
const double a
General LArSoft Utilities.
std::vector< std::vector< art::Ptr< recob::Hit > > > hitlistrefined
std::vector< unsigned int > fNWires
Declaration of signal hit object.
Contains all timing reference information for the detector.
art::ServiceHandle< geo::Geometry const > geom