LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
ClusterParamsAlg.h
Go to the documentation of this file.
1 // ClusterParamsAlg.h
3 //
4 // ClusterParamsAlg class
5 //
6 // Andrzej Szelc (andrzej.szelc@yale.edu)
7 //
9 #ifndef CLUSTERPARAMSALG_H
10 #define CLUSTERPARAMSALG_H
11 
12 #include <string>
13 #include <vector>
14 
17 
18 namespace util {
19  class GeometryUtilities;
20 }
21 
22 namespace cluster {
23 
25  public:
27  ClusterParamsAlg(const std::vector<util::PxHit>&);
28 
29  void Initialize();
30 
31  void SetMinNHits(size_t nhit) { fMinNHits = nhit; }
32 
33  size_t MinNHits() const { return fMinNHits; }
34 
35  int SetHits(const std::vector<util::PxHit>&);
36 
37  void SetRefineDirectionQMin(double qmin) { fQMinRefDir = qmin; }
38 
39  void SetVerbose(bool yes = true) { verbose = yes; }
40 
41  template <typename Stream>
42  void TimeReport(Stream& stream) const;
43 
51  void GetFANNVector(std::vector<float>& data);
52  // std::vector<float> & GetFANNVector();
53 
59  void PrintFANNVector();
60 
73  void FillParams(util::GeometryUtilities const& gser,
74  bool override_DoGetAverages = false,
75  bool override_DoGetRoughAxis = false,
76  bool override_DoGetProfileInfo = false,
77  bool override_DoRefineStartPointsAndDirection = false,
78  bool override_DoGetFinalSlope = false,
79  bool override_DoTrackShowerSep = false,
80  bool override_DoEndCharge = false);
81 
82  const cluster_params& GetParams() const { return fParams; }
83 
97  void GetAverages(bool override = false);
98 
106  void GetRoughAxis(bool override = false);
107 
117  void GetProfileInfo(util::GeometryUtilities const& gser, bool override = false);
118 
124  void RefineStartPoints(util::GeometryUtilities const& gser);
125 
134  void GetFinalSlope(util::GeometryUtilities const& gser, bool override = false);
135 
143  void GetEndCharges(util::GeometryUtilities const& gser, bool override_ = false);
144 
145  void RefineDirection(bool override = false);
146 
147  void RefineStartPointAndDirection(util::GeometryUtilities const& gser, bool override = false);
148 
149  void TrackShowerSeparation(bool override = false);
150 
151  void setNeuralNetPath(std::string s) { fNeuralNetPath = s; }
152 
153  void FillPolygon(util::GeometryUtilities const& gser);
154 
155  void GetOpeningAngle();
156 
157  const util::PxPoint& RoughStartPoint() { return fRoughBeginPoint; }
158  const util::PxPoint& RoughEndPoint() { return fRoughEndPoint; }
159 
160  double RoughSlope() { return fRough2DSlope; }
161  double RoughIntercept() { return fRough2DIntercept; }
162 
188  double StartCharge(util::GeometryUtilities const& gser,
189  float length = 1.,
190  unsigned int nbins = 10);
191 
203  double EndCharge(util::GeometryUtilities const& gser,
204  float length = 1.,
205  unsigned int nbins = 10);
206 
214  float MultipleHitWires();
215 
223  float MultipleHitDensity(util::GeometryUtilities const& gser);
224 
225  void EnableFANN();
226 
227  void DisableFANN() { enableFANN = false; }
228 
229  size_t GetNHits() const { return fHitVector.size(); }
230  const std::vector<util::PxHit>& GetHitVector() const { return fHitVector; }
231  int Plane() const { return fPlane; }
232  void SetPlane(int p);
233 
234  protected:
236  size_t fMinNHits;
237 
242  std::vector<util::PxHit> fHitVector;
243 
244  // bool to control debug/verbose mode defaults to off.
245  bool verbose;
246 
247  //settable parameters:
248  std::vector<double> fChargeCutoffThreshold;
249  int fPlane;
250 
251  //this is required in RefineDirection
252  double fQMinRefDir;
253 
254  std::vector<double> fChargeProfile;
255  std::vector<double> fCoarseChargeProfile;
256 
257  std::vector<double> fChargeProfileNew;
258 
265 
266  //extreme intercepts using the rough_2d_slope
271 
272  // book keeping variables to validate completion of methods:
282 
283  double fRough2DSlope; // slope
284  double fRough2DIntercept; // slope
288 
317  double IntegrateFitCharge(util::GeometryUtilities const& gser,
318  double from_length,
319  double to_length,
320  unsigned int fit_first_bin,
321  unsigned int fit_end_bin);
322 
324  static double LinearIntegral(double m, double q, double x1, double x2);
325 
326  public:
328 
329  std::string fNeuralNetPath;
330 
331  std::vector<std::string> fTimeRecord_ProcName;
332  std::vector<double> fTimeRecord_ProcTime;
333 
334  }; //class ClusterParamsAlg
335 
336 } //namespace cluster
337 
338 //------------------------------------------------------------------------------
339 //--- template implementation
340 //---
341 
342 namespace cluster {
343 
344  template <typename Stream>
345  void ClusterParamsAlg::TimeReport(Stream& stream) const
346  {
347 
348  stream << " <<ClusterParamsAlg::TimeReport>> starts...\n";
349  for (size_t i = 0; i < fTimeRecord_ProcName.size(); ++i) {
350 
351  stream << " Function: " << fTimeRecord_ProcName[i].c_str()
352  << " ... Time = " << fTimeRecord_ProcTime[i] << " [s]\n";
353  }
354  stream << " <<ClusterParamsAlg::TimeReport>> ends...\n";
355  }
356 
357 } //namespace cluster
358 
359 #endif
const util::PxPoint & RoughStartPoint()
Namespace for general, non-LArSoft-specific utilities.
Definition: PIDAAlg.h:26
std::vector< double > fCoarseChargeProfile
void SetRefineDirectionQMin(double qmin)
std::vector< std::string > fTimeRecord_ProcName
Float_t x1[n_points_granero]
Definition: compare.C:5
void Initialize()
Definition: errprop.cc:100
void setNeuralNetPath(std::string s)
std::vector< util::PxHit > fHitVector
Cluster finding and building.
const cluster_params & GetParams() const
cluster::cluster_params fParams
const std::vector< util::PxHit > & GetHitVector() const
std::vector< double > fTimeRecord_ProcTime
std::vector< double > fChargeProfile
void SetMinNHits(size_t nhit)
std::vector< double > fChargeProfileNew
size_t fMinNHits
Cut value for # hits: below this value clusters are not evaluated.
const util::PxPoint & RoughEndPoint()
Float_t x2[n_points_geant4]
Definition: compare.C:26
void SetVerbose(bool yes=true)
std::vector< double > fChargeCutoffThreshold