LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
EMShowerAlg.h
Go to the documentation of this file.
1 // Implementation of the EMShower algorithm
3 //
4 // Forms EM showers from clusters and associated tracks.
5 // Also provides methods for finding the vertex and further
6 // properties of the shower.
7 //
8 // Mike Wallbank (m.wallbank@sheffield.ac.uk), September 2015
10 
11 #ifndef EMShowerAlg_hxx
12 #define EMShowerAlg_hxx
13 
14 // framework
19 namespace fhicl {
20  class ParameterSet;
21 }
22 
23 // larsoft
38 
39 // C++
40 #include <map>
41 #include <memory>
42 #include <string>
43 #include <vector>
44 
45 // ROOT
46 #include "RtypesCore.h"
47 #include "TVector2.h"
48 #include "TVector3.h"
49 
50 namespace detinfo {
51  class DetectorClocksData;
52  class DetectorPropertiesData;
53 }
54 
55 namespace shower {
56  class EMShowerAlg;
57  struct HitPosition;
58 }
59 
61 public:
62  EMShowerAlg(fhicl::ParameterSet const& pset, int debug = 0);
63 
65  void AssociateClustersAndTracks(std::vector<art::Ptr<recob::Cluster>> const& clusters,
66  art::FindManyP<recob::Hit> const& fmh,
68  std::map<int, std::vector<int>>& clusterToTracks,
69  std::map<int, std::vector<int>>& trackToClusters) const;
70 
72  void AssociateClustersAndTracks(std::vector<art::Ptr<recob::Cluster>> const& clusters,
73  art::FindManyP<recob::Hit> const& fmh,
75  std::vector<int> const& clustersToIgnore,
76  std::map<int, std::vector<int>>& clusterToTracks,
77  std::map<int, std::vector<int>>& trackToClusters) const;
78 
80  std::vector<int> CheckShowerPlanes(std::vector<std::vector<int>> const& initialShowers,
81  std::vector<art::Ptr<recob::Cluster>> const& clusters,
82  art::FindManyP<recob::Hit> const& fmh) const;
83 
87  std::unique_ptr<recob::Track> ConstructTrack(
88  detinfo::DetectorPropertiesData const& detProp,
89  std::vector<art::Ptr<recob::Hit>> const& track1,
90  std::vector<art::Ptr<recob::Hit>> const& track2,
91  std::map<int, TVector2> const& showerCentreMap) const;
92 
95  std::unique_ptr<recob::Track> ConstructTrack(
96  detinfo::DetectorPropertiesData const& detProp,
97  std::vector<art::Ptr<recob::Hit>> const& track1,
98  std::vector<art::Ptr<recob::Hit>> const& track2) const;
99 
102  void FindInitialTrack(detinfo::DetectorPropertiesData const& detProp,
103  std::map<int, std::vector<art::Ptr<recob::Hit>>> const& hits,
104  std::unique_ptr<recob::Track>& initialTrack,
105  std::map<int, std::vector<art::Ptr<recob::Hit>>>& initialTrackHits) const;
106 
108  std::vector<std::vector<int>> FindShowers(
109  std::map<int, std::vector<int>> const& trackToClusters) const;
110 
112  recob::Shower MakeShower(
113  detinfo::DetectorClocksData const& clockData,
114  detinfo::DetectorPropertiesData const& detProp,
116  std::unique_ptr<recob::Track> const& initialTrack,
117  std::map<int, std::vector<art::Ptr<recob::Hit>>> const& initialTrackHits) const;
118 
120  recob::Shower MakeShower(detinfo::DetectorClocksData const& clockData,
121  detinfo::DetectorPropertiesData const& detProp,
122  art::PtrVector<recob::Hit> const& hits,
124  int& iok) const;
125 
127  std::vector<recob::SpacePoint> MakeSpacePoints(
128  detinfo::DetectorPropertiesData const& detProp,
129  std::map<int, std::vector<art::Ptr<recob::Hit>>> const& hits,
130  std::vector<std::vector<art::Ptr<recob::Hit>>>& hitAssns) const;
131 
133  std::map<int, std::vector<art::Ptr<recob::Hit>>> OrderShowerHits(
134  detinfo::DetectorPropertiesData const& detProp,
136  int plane) const;
137 
139  void FindInitialTrackHits(std::vector<art::Ptr<recob::Hit>> const& showerHits,
140  art::Ptr<recob::Vertex> const& vertex,
141  std::vector<art::Ptr<recob::Hit>>& trackHits) const;
142 
144  Int_t WeightedFit(const Int_t n,
145  const Double_t* x,
146  const Double_t* y,
147  const Double_t* w,
148  Double_t* parm) const;
149 
151  bool isCleanShower(std::vector<art::Ptr<recob::Hit>> const& hits) const;
152 
153  int fDebug;
154 
155 private:
158  void CheckIsolatedHits_(std::map<int, std::vector<art::Ptr<recob::Hit>>>& showerHitsMap) const;
159 
162  bool CheckShowerHits_(
163  detinfo::DetectorPropertiesData const& detProp,
164  std::map<int, std::vector<art::Ptr<recob::Hit>>> const& showerHitsMap) const;
165 
167  geo::Point_t Construct3DPoint_(detinfo::DetectorPropertiesData const& detProp,
168  art::Ptr<recob::Hit> const& hit1,
169  art::Ptr<recob::Hit> const& hit2) const;
170 
172  double FinddEdx_(detinfo::DetectorClocksData const& clockData,
173  detinfo::DetectorPropertiesData const& detProp,
174  std::vector<art::Ptr<recob::Hit>> const& trackHits,
175  std::unique_ptr<recob::Track> const& track) const;
176 
180  std::vector<art::Ptr<recob::Hit>> FindOrderOfHits_(detinfo::DetectorPropertiesData const& detProp,
181  std::vector<art::Ptr<recob::Hit>> const& hits,
182  bool perpendicular = false) const;
183 
187  std::map<int, std::vector<art::Ptr<recob::Hit>>> FindShowerStart_(
188  std::map<int, std::vector<art::Ptr<recob::Hit>>> const& orderedShowerMap) const;
189 
196  std::map<int, std::map<int, bool>> GetPlanePermutations_(
197  const detinfo::DetectorPropertiesData& detProp,
198  const std::map<int, std::vector<art::Ptr<recob::Hit>>>& showerHitsMap) const;
199 
201  double GlobalWire_(const geo::WireID& wireID) const;
202 
204  TVector2 HitCoordinates_(recob::Hit const& hit) const;
205 
207  TVector2 HitPosition_(detinfo::DetectorPropertiesData const& detProp,
208  recob::Hit const& hit) const;
209 
211  TVector2 HitPosition_(detinfo::DetectorPropertiesData const& detProp,
212  TVector2 const& pos,
213  geo::PlaneID planeID) const;
214 
217  std::unique_ptr<recob::Track> MakeInitialTrack_(
218  detinfo::DetectorPropertiesData const& detProp,
219  std::map<int, std::vector<art::Ptr<recob::Hit>>> const& initialHitsMap,
220  std::map<int, std::vector<art::Ptr<recob::Hit>>> const& showerHitsMap) const;
221 
224  void OrderShowerHits_(detinfo::DetectorPropertiesData const& detProp,
225  std::vector<art::Ptr<recob::Hit>> const& shower,
226  std::vector<art::Ptr<recob::Hit>>& orderedShower,
227  art::Ptr<recob::Vertex> const& vertex) const;
228 
231  TVector2 Project3DPointOntoPlane_(detinfo::DetectorPropertiesData const& detProp,
232  geo::Point_t const& point,
233  int plane,
234  int cryostat = 0) const;
235 
240  std::map<double, int> RelativeWireWidth_(
241  const std::map<int, std::vector<art::Ptr<recob::Hit>>>& showerHitsMap) const;
242 
244  TVector2 ShowerCenter_(detinfo::DetectorPropertiesData const& detProp,
245  std::vector<art::Ptr<recob::Hit>> const& showerHits) const;
246 
249  TVector2 ShowerDirection_(detinfo::DetectorPropertiesData const& detProp,
250  const std::vector<art::Ptr<recob::Hit>>& showerHits) const;
251 
254  double ShowerHitRMS_(detinfo::DetectorPropertiesData const& detProp,
255  std::vector<art::Ptr<recob::Hit>> const& showerHits) const;
256 
258  double ShowerHitRMSGradient_(detinfo::DetectorPropertiesData const& detProp,
259  const std::vector<art::Ptr<recob::Hit>>& showerHits) const;
260 
262  int WorstPlane_(const std::map<int, std::vector<art::Ptr<recob::Hit>>>& showerHitsMap) const;
263 
264  // Parameters
265  double const fMinTrackLength;
266  double const fdEdxTrackLength;
267  double const fSpacePointSize;
268 
269  // Parameters to fit wire vs time
270  unsigned int const fNfitpass;
271  std::vector<unsigned int> const fNfithits;
272  std::vector<double> const fToler;
273 
274  // Services used by this class
276 
277  // Algs used by this class
281 
282  std::string const fDetector;
283 
284  // tmp
285  bool const fMakeGradientPlot;
288 };
289 
291  TVector2 WireTick;
292  TVector2 Cm;
293 };
294 
295 #endif
Float_t x
Definition: compare.C:6
shower::ShowerEnergyAlg const fShowerEnergyAlg
Definition: EMShowerAlg.h:278
pma::ProjectionMatchingAlg const fProjectionMatchingAlg
Definition: EMShowerAlg.h:280
Declaration of signal hit object.
Float_t y
Definition: compare.C:6
The data type to uniquely identify a Plane.
Definition: geo_types.h:463
double const fdEdxTrackLength
Definition: EMShowerAlg.h:266
unsigned int const fNfitpass
Definition: EMShowerAlg.h:270
std::vector< double > const fToler
Definition: EMShowerAlg.h:272
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:289
Access the description of detector geometry.
bool const fMakeRMSGradientPlot
Definition: EMShowerAlg.h:286
std::vector< unsigned int > const fNfithits
Definition: EMShowerAlg.h:271
void hits()
Definition: readHits.C:15
DebugStuff debug
Definition: DebugStruct.cxx:4
parameter set interface
Provides recob::Track data product.
double const fMinTrackLength
Definition: EMShowerAlg.h:265
General LArSoft Utilities.
Declaration of cluster object.
Definition of data types for geometry description.
bool const fMakeGradientPlot
Definition: EMShowerAlg.h:285
Detector simulation of raw signals on wires.
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
Definition: geo_vectors.h:180
Contains all timing reference information for the detector.
int const fNumShowerSegments
Definition: EMShowerAlg.h:287
calo::CalorimetryAlg const fCalorimetryAlg
Definition: EMShowerAlg.h:279
double const fSpacePointSize
Definition: EMShowerAlg.h:267
Char_t n[5]
2D representation of charge deposited in the TDC/wire plane
Definition: Hit.h:46
art::ServiceHandle< geo::Geometry const > fGeom
Definition: EMShowerAlg.h:275
Float_t track
Definition: plot.C:35
Float_t w
Definition: plot.C:20
std::string const fDetector
Definition: EMShowerAlg.h:282
art framework interface to geometry description
vertex reconstruction