All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 
38 #include "art/Framework/Services/Registry/ServiceHandle.h"
39 #include "canvas/Persistency/Common/Ptr.h"
40 namespace fhicl {
41  class ParameterSet;
42 }
43 
46 
47 namespace detinfo {
48  class DetectorClocksData;
49  class DetectorPropertiesData;
50 }
51 
52 namespace util {
53  class GeometryUtilities;
54 }
55 
56 #include <vector>
57 
58 namespace cluster {
59 
61  public:
62  explicit SmallClusterFinderAlg(fhicl::ParameterSet const& pset);
63 
65  std::vector<art::Ptr<recob::Hit>> hitlist,
66  std::vector<art::Ptr<recob::Hit>>& hitlistlocal,
67  double wire_start,
68  double time_start,
69  double radlimit) const;
71  std::vector<art::Ptr<recob::Hit>> hitlist,
72  std::vector<art::Ptr<recob::Hit>>& hitlistlocal,
73  double wire_start,
74  double time_start,
75  double radlimit,
76  std::vector<int>&) const;
77 
78  // pass in a hit, all the others are filled in the function.
79  int GetPlaneAndTPC(art::Ptr<recob::Hit> a,
80  unsigned int& plane,
81  unsigned int& cryostat,
82  unsigned int& time,
83  unsigned int& wire) const;
84 
85  //passes in a hitlist, returns a list of gammas and puts everything else in hitlistleftover
86  std::vector<art::Ptr<recob::Hit>> CreateHighHitlist(
87  util::GeometryUtilities const& gser,
88  std::vector<art::Ptr<recob::Hit>> const& hitlist,
89  std::vector<art::Ptr<recob::Hit>>& hitlistleftover) const;
90 
91  // this routine actually finds the clusters
92  // It stores them in smallClustList
93  // It puts the leftover hits in hitlistleftover
95  detinfo::DetectorClocksData const& dataClocks,
97  std::vector<art::Ptr<recob::Hit>> allHits);
98 
99  // This function is solely to sort the leftover hits. It's not done
100  // automatically because it's not a short process if the number of hits is
101  // big. For a few hits its not that bad. not yet functional! by this I
102  // mean, does not yet exist
103  void sortLeftoverHits();
104 
105  std::vector<std::vector<art::Ptr<recob::Hit>>> GetSmallClustersByPlane(unsigned int iPlane);
106  //This function just returns the clusters by plane, and they are split already.
107 
108  std::vector<art::Ptr<recob::Hit>> GetLeftoversByPlane(unsigned int iPlane);
109  //This function returns the leftover hits.
110 
111  private:
112  //Special function to make sure the vectors are all the right size
113  //can't do the hits, but can clear them and do the planes.
114  //Gets called each time FindSmallClusters is called, as well as in the constructor.
115  void ClearandResizeVectors();
116 
117  //**************All of the constants needed to do this process:
119  float fTimeTick; // time sample in us
120  float fDriftVelocity; // used to convert time to cm
121  double fWirePitch; // wire pitch in cm
122  std::vector<unsigned int> fNWires; // Number of wires on each plane
123  unsigned int fNPlanes; // number of planes
124  double fNTimes;
125 
126  // The various art grabbed Larsoft stuff to get physical properties.
127  art::ServiceHandle<geo::Geometry const> geom;
128 
129  // The vectors that actually get used to hold hits, sets of hits, etc.
130  // All have the plane as the first index
131  std::vector<std::vector<std::vector<art::Ptr<recob::Hit>>>> smallClustList;
132  // This list is meant to contain the small clusters.
133  // It should be indexed by smallClustList[plane][smallcluster][hit]
134  std::vector<std::vector<art::Ptr<recob::Hit>>>
135  hitlistrefined; // list, by plane, of hits that ought to be gammas
136  std::vector<std::vector<art::Ptr<recob::Hit>>> hitlistbyplane; // list of all hits on each plane
137  std::vector<std::vector<art::Ptr<recob::Hit>>>
138  hitlistleftover; // list of all hits on each plane that are NOT gammas
139 
140  // input parameters, grabbed from the parameter set
141  bool verbose; // Make lots of printouts?
142  double fRadiusSizePar; // Determines the max radius of the cluster, must be
143  // separated
144  double fNHitsInClust; // Forces cluster to have a max number of hits
145  // Remember, this is the *small* cluster finder
146  }; // class SmallAngleFinder
147 }
148 #endif // SMALLCLUSTERFINDERALG_H
std::vector< art::Ptr< recob::Hit > > CreateHighHitlist(util::GeometryUtilities const &gser, std::vector< art::Ptr< recob::Hit >> const &hitlist, std::vector< art::Ptr< recob::Hit >> &hitlistleftover) const
process_name cluster
Definition: cheaterreco.fcl:51
std::vector< std::vector< art::Ptr< recob::Hit > > > hitlistbyplane
std::vector< std::vector< std::vector< art::Ptr< recob::Hit > > > > smallClustList
Declaration of signal hit object.
void FindSmallClusters(util::GeometryUtilities const &gser, detinfo::DetectorClocksData const &dataClocks, detinfo::DetectorPropertiesData const &detProp, std::vector< art::Ptr< recob::Hit >> allHits)
int GetPlaneAndTPC(art::Ptr< recob::Hit > a, unsigned int &plane, unsigned int &cryostat, unsigned int &time, unsigned int &wire) const
void SelectLocalHitlist(util::GeometryUtilities const &gser, std::vector< art::Ptr< recob::Hit >> hitlist, std::vector< art::Ptr< recob::Hit >> &hitlistlocal, double wire_start, double time_start, double radlimit) const
std::vector< std::vector< art::Ptr< recob::Hit > > > hitlistleftover
process_name gaushit a
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:265
std::vector< art::Ptr< recob::Hit > > GetLeftoversByPlane(unsigned int iPlane)
std::vector< std::vector< art::Ptr< recob::Hit > > > hitlistrefined
std::vector< unsigned int > fNWires
Contains all timing reference information for the detector.
std::vector< std::vector< art::Ptr< recob::Hit > > > GetSmallClustersByPlane(unsigned int iPlane)
art::ServiceHandle< geo::Geometry const > geom
SmallClusterFinderAlg(fhicl::ParameterSet const &pset)
art framework interface to geometry description
auto const detProp