LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
SmallClusterFinderAlg.h
Go to the documentation of this file.
1 //
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 //
34 
35 
36 #ifndef SMALLCLUSTERFINDERALG_H
37 #define SMALLCLUSTERFINDERALG_H
38 
39 
43 
44 namespace cluster {
45 
47 
48  public:
49 
51  SmallClusterFinderAlg(); //default constructor
53  // ~SmallClusterFinderAlg(); /**Destructor*/
54  void reconfigure(fhicl::ParameterSet const& pset);
55  // void produce(art::Event& evt); /**Routine that finds the cluster and sets the dTdW of the 2D shower*/
56 
57 
58  void SelectLocalHitlist(std::vector< art::Ptr < recob::Hit> > hitlist, std::vector < art::Ptr<recob::Hit> > &hitlistlocal, double wire_start,double time_start, double radlimit);
60  double wire_start,double time_start, double radlimit, std::vector<int> &);
61 
62  //pass in a hit, all the others are filled in the function.
63  int GetPlaneAndTPC( art::Ptr<recob::Hit> a, //a hit
64  unsigned int &p, //the plane
65  unsigned int &cs, //cryostat
66  unsigned int &t, //time
67  unsigned int &w); //wire
68 
69  //passes in a hitlist, returns a list of gammas and puts everything else in hitlistleftover
70  std::vector< art::Ptr<recob::Hit> > CreateHighHitlist(std::vector< art::Ptr<recob::Hit> > hitlist,
72  void FindSmallClusters(std::vector<art::Ptr<recob::Hit> > allHits); //this routine actually finds the clusters
73  //It stores them in smallClustList
74  //It puts the leftover hits in hitlistleftover
75 
76  void sortLeftoverHits();
77  //This function is solely to sort the leftover hits. It's not done automatically
78  //because it's not a short process if the number of hits is big. For a few hits
79  //its not that bad.
80  //not yet functional! by this I mean, does not yet exist
81 
82 
83  std::vector< std::vector <art::Ptr< recob::Hit> > > GetSmallClustersByPlane(unsigned int iPlane);
84  //This function just returns the clusters by plane, and they are split already.
85 
86  std::vector< art::Ptr<recob::Hit> > GetLeftoversByPlane(unsigned int iPlane);
87  //This function returns the leftover hits.
88 
89  private:
90 
91  //Special function to make sure the vectors are all the right size
92  //can't do the hits, but can clear them and do the planes.
93  //Gets called each time FindSmallClusters is called, as well as in the constructor.
94  void ClearandResizeVectors();
95 
96  //**************All of the constants needed to do this process:
98  float fTimeTick; // time sample in us
99  float fDriftVelocity; // used to convert time to cm
100  double fWirePitch ; // wire pitch in cm
101  std::vector< unsigned int >fNWires; // Number of wires on each plane
102  unsigned int fNPlanes; // number of planes
103  double fNTimes;
104 
105  //The various art grabbed Larsoft stuff to get physical properties.
108 
109  //The vectors that actually get used to hold hits, sets of hits, etc.
110  //All have the plane as the first index
111  std::vector < std::vector< std::vector< art::Ptr<recob::Hit> > > > smallClustList;
112  //This list is meant to contain the small clusters.
113  //It should be indexed by smallClustList[plane][smallcluster][hit]
114  std::vector < std::vector< art::Ptr<recob::Hit> > > hitlistrefined; //list, by plane, of hits that ought to be gammas
115  std::vector < std::vector< art::Ptr<recob::Hit> > > hitlistbyplane; //list of all hits on each plane
116  std::vector < std::vector< art::Ptr<recob::Hit> > > hitlistleftover; //list of all hits on each plane that are NOT gammas
117 
118  //input parameters, grabbed from the parameter set
119  bool verbose; //Make lots of printouts?
120  double fRadiusSizePar; //Determines the max radius of the cluster, must be separated
121  double fNHitsInClust; //Forces cluster to have a max number of hits
122  // Remember, this is the *small* cluster finder
123  }; // class SmallAngleFinder
124 }
125 #endif // SMALLCLUSTERFINDERALG_H
std::vector< std::vector< art::Ptr< recob::Hit > > > hitlistbyplane
Declaration of signal hit object.
void FindSmallClusters(std::vector< art::Ptr< recob::Hit > > allHits)
Cluster finding and building.
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:265
std::vector< std::vector< art::Ptr< recob::Hit > > > hitlistleftover
std::vector< unsigned int > fNWires
std::vector< art::Ptr< recob::Hit > > GetLeftoversByPlane(unsigned int iPlane)
void SelectLocalHitlist(std::vector< art::Ptr< recob::Hit > > hitlist, std::vector< art::Ptr< recob::Hit > > &hitlistlocal, double wire_start, double time_start, double radlimit)
Declaration of cluster object.
std::vector< std::vector< art::Ptr< recob::Hit > > > hitlistrefined
std::vector< art::Ptr< recob::Hit > > CreateHighHitlist(std::vector< art::Ptr< recob::Hit > > hitlist, std::vector< art::Ptr< recob::Hit > > &hitlistleftover)
void reconfigure(fhicl::ParameterSet const &pset)
std::vector< std::vector< art::Ptr< recob::Hit > > > GetSmallClustersByPlane(unsigned int iPlane)
art::ServiceHandle< geo::Geometry > geom
int GetPlaneAndTPC(art::Ptr< recob::Hit > a, unsigned int &p, unsigned int &cs, unsigned int &t, unsigned int &w)
Float_t w
Definition: plot.C:23
std::vector< std::vector< std::vector< art::Ptr< recob::Hit > > > > smallClustList