LArSoft  v10_04_05
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 #include "fhiclcpp/fwd.h"
20 
21 // larsoft
37 
38 // C++
39 #include <map>
40 #include <memory>
41 #include <string>
42 #include <vector>
43 
44 // ROOT
45 #include "RtypesCore.h"
46 #include "TVector2.h"
47 #include "TVector3.h"
48 
49 namespace detinfo {
50  class DetectorClocksData;
51  class DetectorPropertiesData;
52 }
53 
54 namespace shower {
55  class EMShowerAlg;
56  struct HitPosition;
57 }
58 
60 public:
61  EMShowerAlg(fhicl::ParameterSet const& pset, int debug = 0);
62 
64  void AssociateClustersAndTracks(std::vector<art::Ptr<recob::Cluster>> const& clusters,
65  art::FindManyP<recob::Hit> const& fmh,
67  std::map<int, std::vector<int>>& clusterToTracks,
68  std::map<int, std::vector<int>>& trackToClusters) const;
69 
71  void AssociateClustersAndTracks(std::vector<art::Ptr<recob::Cluster>> const& clusters,
72  art::FindManyP<recob::Hit> const& fmh,
74  std::vector<int> const& clustersToIgnore,
75  std::map<int, std::vector<int>>& clusterToTracks,
76  std::map<int, std::vector<int>>& trackToClusters) const;
77 
79  std::vector<int> CheckShowerPlanes(std::vector<std::vector<int>> const& initialShowers,
80  std::vector<art::Ptr<recob::Cluster>> const& clusters,
81  art::FindManyP<recob::Hit> const& fmh) const;
82 
86  std::unique_ptr<recob::Track> ConstructTrack(
87  detinfo::DetectorPropertiesData const& detProp,
88  std::vector<art::Ptr<recob::Hit>> const& track1,
89  std::vector<art::Ptr<recob::Hit>> const& track2,
90  std::map<int, TVector2> const& showerCentreMap) const;
91 
94  std::unique_ptr<recob::Track> ConstructTrack(
95  detinfo::DetectorPropertiesData const& detProp,
96  std::vector<art::Ptr<recob::Hit>> const& track1,
97  std::vector<art::Ptr<recob::Hit>> const& track2) const;
98 
101  void FindInitialTrack(detinfo::DetectorPropertiesData const& detProp,
102  std::map<int, std::vector<art::Ptr<recob::Hit>>> const& hits,
103  std::unique_ptr<recob::Track>& initialTrack,
104  std::map<int, std::vector<art::Ptr<recob::Hit>>>& initialTrackHits) const;
105 
107  std::vector<std::vector<int>> FindShowers(
108  std::map<int, std::vector<int>> const& trackToClusters) const;
109 
111  recob::Shower MakeShower(
112  detinfo::DetectorClocksData const& clockData,
113  detinfo::DetectorPropertiesData const& detProp,
115  std::unique_ptr<recob::Track> const& initialTrack,
116  std::map<int, std::vector<art::Ptr<recob::Hit>>> const& initialTrackHits) const;
117 
119  recob::Shower MakeShower(detinfo::DetectorClocksData const& clockData,
120  detinfo::DetectorPropertiesData const& detProp,
121  art::PtrVector<recob::Hit> const& hits,
123  int& iok) const;
124 
126  std::vector<recob::SpacePoint> MakeSpacePoints(
127  detinfo::DetectorPropertiesData const& detProp,
128  std::map<int, std::vector<art::Ptr<recob::Hit>>> const& hits,
129  std::vector<std::vector<art::Ptr<recob::Hit>>>& hitAssns) const;
130 
132  std::map<int, std::vector<art::Ptr<recob::Hit>>> OrderShowerHits(
133  detinfo::DetectorPropertiesData const& detProp,
135  int plane) const;
136 
138  void FindInitialTrackHits(std::vector<art::Ptr<recob::Hit>> const& showerHits,
139  art::Ptr<recob::Vertex> const& vertex,
140  std::vector<art::Ptr<recob::Hit>>& trackHits) const;
141 
143  Int_t WeightedFit(const Int_t n,
144  const Double_t* x,
145  const Double_t* y,
146  const Double_t* w,
147  Double_t* parm) const;
148 
150  bool isCleanShower(std::vector<art::Ptr<recob::Hit>> const& hits) const;
151 
152  int fDebug;
153 
154 private:
157  void CheckIsolatedHits_(std::map<int, std::vector<art::Ptr<recob::Hit>>>& showerHitsMap) const;
158 
161  bool CheckShowerHits_(
162  detinfo::DetectorPropertiesData const& detProp,
163  std::map<int, std::vector<art::Ptr<recob::Hit>>> const& showerHitsMap) const;
164 
166  geo::Point_t Construct3DPoint_(detinfo::DetectorPropertiesData const& detProp,
167  art::Ptr<recob::Hit> const& hit1,
168  art::Ptr<recob::Hit> const& hit2) const;
169 
171  double FinddEdx_(detinfo::DetectorClocksData const& clockData,
172  detinfo::DetectorPropertiesData const& detProp,
173  std::vector<art::Ptr<recob::Hit>> const& trackHits,
174  std::unique_ptr<recob::Track> const& track) const;
175 
179  std::vector<art::Ptr<recob::Hit>> FindOrderOfHits_(detinfo::DetectorPropertiesData const& detProp,
180  std::vector<art::Ptr<recob::Hit>> const& hits,
181  bool perpendicular = false) const;
182 
186  std::map<int, std::vector<art::Ptr<recob::Hit>>> FindShowerStart_(
187  std::map<int, std::vector<art::Ptr<recob::Hit>>> const& orderedShowerMap) const;
188 
195  std::map<int, std::map<int, bool>> GetPlanePermutations_(
196  const detinfo::DetectorPropertiesData& detProp,
197  const std::map<int, std::vector<art::Ptr<recob::Hit>>>& showerHitsMap) const;
198 
200  double GlobalWire_(const geo::WireID& wireID) const;
201 
203  TVector2 HitCoordinates_(recob::Hit const& hit) const;
204 
206  TVector2 HitPosition_(detinfo::DetectorPropertiesData const& detProp,
207  recob::Hit const& hit) const;
208 
210  TVector2 HitPosition_(detinfo::DetectorPropertiesData const& detProp,
211  TVector2 const& pos,
212  geo::PlaneID planeID) const;
213 
216  std::unique_ptr<recob::Track> MakeInitialTrack_(
217  detinfo::DetectorPropertiesData const& detProp,
218  std::map<int, std::vector<art::Ptr<recob::Hit>>> const& initialHitsMap,
219  std::map<int, std::vector<art::Ptr<recob::Hit>>> const& showerHitsMap) const;
220 
223  void OrderShowerHits_(detinfo::DetectorPropertiesData const& detProp,
224  std::vector<art::Ptr<recob::Hit>> const& shower,
225  std::vector<art::Ptr<recob::Hit>>& orderedShower,
226  art::Ptr<recob::Vertex> const& vertex) const;
227 
230  TVector2 Project3DPointOntoPlane_(detinfo::DetectorPropertiesData const& detProp,
231  geo::Point_t const& point,
232  int plane,
233  int cryostat = 0) const;
234 
239  std::map<double, int> RelativeWireWidth_(
240  const std::map<int, std::vector<art::Ptr<recob::Hit>>>& showerHitsMap) const;
241 
243  TVector2 ShowerCenter_(detinfo::DetectorPropertiesData const& detProp,
244  std::vector<art::Ptr<recob::Hit>> const& showerHits) const;
245 
248  TVector2 ShowerDirection_(detinfo::DetectorPropertiesData const& detProp,
249  const std::vector<art::Ptr<recob::Hit>>& showerHits) const;
250 
253  double ShowerHitRMS_(detinfo::DetectorPropertiesData const& detProp,
254  std::vector<art::Ptr<recob::Hit>> const& showerHits) const;
255 
257  double ShowerHitRMSGradient_(detinfo::DetectorPropertiesData const& detProp,
258  const std::vector<art::Ptr<recob::Hit>>& showerHits) const;
259 
261  int WorstPlane_(const std::map<int, std::vector<art::Ptr<recob::Hit>>>& showerHitsMap) const;
262 
263  // Parameters
264  double const fMinTrackLength;
265  double const fdEdxTrackLength;
266  double const fSpacePointSize;
267 
268  // Parameters to fit wire vs time
269  unsigned int const fNfitpass;
270  std::vector<unsigned int> const fNfithits;
271  std::vector<double> const fToler;
272 
273  // Services used by this class
275  geo::WireReadoutGeom const* fWireReadoutGeom{
277 
278  // Algs used by this class
282 
283  std::string const fDetector;
284 
285  // tmp
286  bool const fMakeGradientPlot;
289 };
290 
292  TVector2 WireTick;
293  TVector2 Cm;
294 };
295 
296 #endif
Float_t x
Definition: compare.C:6
shower::ShowerEnergyAlg const fShowerEnergyAlg
Definition: EMShowerAlg.h:279
pma::ProjectionMatchingAlg const fProjectionMatchingAlg
Definition: EMShowerAlg.h:281
Declaration of signal hit object.
Float_t y
Definition: compare.C:6
The data type to uniquely identify a Plane.
Definition: geo_types.h:364
cout<< "Opened file "<< fin<< " ixs= "<< ixs<< endl;if(ixs==0) hhh=(TH1F *) fff-> Get("h1")
Definition: AddMC.C:8
double const fdEdxTrackLength
Definition: EMShowerAlg.h:265
unsigned int const fNfitpass
Definition: EMShowerAlg.h:269
std::vector< double > const fToler
Definition: EMShowerAlg.h:271
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:289
Access the description of the physical detector geometry.
bool const fMakeRMSGradientPlot
Definition: EMShowerAlg.h:287
std::vector< unsigned int > const fNfithits
Definition: EMShowerAlg.h:270
void hits()
Definition: readHits.C:15
DebugStuff debug
Definition: DebugStruct.cxx:4
Interface for a class providing readout channel mapping to geometry.
double const fMinTrackLength
Definition: EMShowerAlg.h:264
General LArSoft Utilities.
Declaration of cluster object.
Definition of data types for geometry description.
bool const fMakeGradientPlot
Definition: EMShowerAlg.h:286
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.
Provides recob::Track data product.
int const fNumShowerSegments
Definition: EMShowerAlg.h:288
calo::CalorimetryAlg const fCalorimetryAlg
Definition: EMShowerAlg.h:280
double const fSpacePointSize
Definition: EMShowerAlg.h:266
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:274
Float_t track
Definition: plot.C:35
Float_t w
Definition: plot.C:20
std::string const fDetector
Definition: EMShowerAlg.h:283
art framework interface to geometry description
vertex reconstruction