LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
OpFlashAlg.h
Go to the documentation of this file.
1 // -*- mode: c++; c-basic-offset: 2; -*-
2 #ifndef OPFLASHALG_H
3 #define OPFLASHALG_H
4 
14 namespace detinfo {
15  class DetectorClocksData;
16 }
17 namespace geo {
18  class GeometryCore;
19 }
20 
21 #include <functional>
22 #include <map>
23 #include <vector>
24 
25 namespace opdet {
26 
27  void RunFlashFinder(std::vector<recob::OpHit> const&,
28  std::vector<recob::OpFlash>&,
29  std::vector<std::vector<int>>&,
30  double,
31  geo::GeometryCore const&,
32  float,
33  float,
35  float);
36 
37  unsigned int GetAccumIndex(double PeakTime, double MinTime, double BinWidth, double BinOffset);
38 
39  void FillAccumulator(unsigned int const& AccumIndex,
40  unsigned int const& HitIndex,
41  double PE,
42  float FlashThreshold,
43  std::vector<double>& Binned,
44  std::vector<std::vector<int>>& Contributors,
45  std::vector<int>& FlashesInAccumulator);
46 
47  void AssignHitsToFlash(std::vector<int> const&,
48  std::vector<int> const&,
49  std::vector<double> const&,
50  std::vector<double> const&,
51  std::vector<std::vector<int>> const&,
52  std::vector<std::vector<int>> const&,
53  std::vector<recob::OpHit> const&,
54  std::vector<std::vector<int>>&,
55  float);
56 
58  std::vector<int> const& FlashesInAccumulator,
59  std::vector<double> const& BinnedPE,
60  int const& Accumulator,
61  std::map<double, std::map<int, std::vector<int>>, std::greater<double>>& FlashesBySize);
62 
63  void FillHitsThisFlash(std::vector<std::vector<int>> const& Contributors,
64  int const& Bin,
65  std::vector<int> const& HitClaimedByFlash,
66  std::vector<int>& HitsThisFlash);
67 
68  void ClaimHits(std::vector<recob::OpHit> const& HitVector,
69  std::vector<int> const& HitsThisFlash,
70  float FlashThreshold,
71  std::vector<std::vector<int>>& HitsPerFlash,
72  std::vector<int>& HitClaimedByFlash);
73 
74  void RefineHitsInFlash(std::vector<int> const& HitsThisFlash,
75  std::vector<recob::OpHit> const& HitVector,
76  std::vector<std::vector<int>>& RefinedHitsPerFlash,
77  float WidthTolerance,
78  float FlashThreshold);
79 
80  void FindSeedHit(std::map<double, std::vector<int>, std::greater<double>> const& HitsBySize,
81  std::vector<bool>& HitsUsed,
82  std::vector<recob::OpHit> const& HitVector,
83  std::vector<int>& HitsThisRefinedFlash,
84  double& PEAccumulated,
85  double& FlashMaxTime,
86  double& FlashMinTime);
87 
88  void AddHitToFlash(int const& HitID,
89  std::vector<bool>& HitsUsed,
90  recob::OpHit const& currentHit,
91  double WidthTolerance,
92  std::vector<int>& HitsThisRefinedFlash,
93  double& PEAccumulated,
94  double& FlashMaxTime,
95  double& FlashMinTime);
96 
97  void CheckAndStoreFlash(std::vector<std::vector<int>>& RefinedHitsPerFlash,
98  std::vector<int> const& HitsThisRefinedFlash,
99  double PEAccumulated,
100  float FlashThreshold,
101  std::vector<bool>& HitsUsed);
102 
103  void ConstructFlash(std::vector<int> const& HitsPerFlashVec,
104  std::vector<recob::OpHit> const& HitVector,
105  std::vector<recob::OpFlash>& FlashVector,
106  geo::GeometryCore const& geom,
107  detinfo::DetectorClocksData const& data,
108  float TrigCoinc);
109 
110  void AddHitContribution(recob::OpHit const& currentHit,
111  double& MaxTime,
112  double& MinTime,
113  double& AveTime,
114  double& FastToTotal,
115  double& AveAbsTime,
116  double& TotalPE,
117  std::vector<double>& PEs);
118 
119  void GetHitGeometryInfo(recob::OpHit const& currentHit,
120  geo::GeometryCore const& geom,
121  std::vector<double>& sumw,
122  std::vector<double>& sumw2,
123  double& sumy,
124  double& sumy2,
125  double& sumz,
126  double& sumz2);
127 
128  void RemoveLateLight(std::vector<recob::OpFlash>&, std::vector<std::vector<int>>&);
129 
130  double GetLikelihoodLateLight(double iPE,
131  double iTime,
132  double iWidth,
133  double jPE,
134  double jTime,
135  double jWidth);
136 
137  void MarkFlashesForRemoval(std::vector<recob::OpFlash> const& FlashVector,
138  size_t BeginFlash,
139  std::vector<bool>& MarkedForRemoval);
140 
141  void RemoveFlashesFromVectors(std::vector<bool> const& MarkedForRemoval,
142  std::vector<recob::OpFlash>& FlashVector,
143  size_t BeginFlash,
144  std::vector<std::vector<int>>& RefinedHitsPerFlash);
145 
146  template <typename T, typename Compare>
147  std::vector<int> sort_permutation(std::vector<T> const& vec, int offset, Compare compare);
148 
149  template <typename T>
150  void apply_permutation(std::vector<T>& vec, std::vector<int> const& p);
151 
152 } // End opdet namespace
153 
154 #endif
void FillHitsThisFlash(std::vector< std::vector< int >> const &Contributors, int const &Bin, std::vector< int > const &HitClaimedByFlash, std::vector< int > &HitsThisFlash)
Definition: OpFlashAlg.cxx:207
void CheckAndStoreFlash(std::vector< std::vector< int >> &RefinedHitsPerFlash, std::vector< int > const &HitsThisRefinedFlash, double const PEAccumulated, float const FlashThreshold, std::vector< bool > &HitsUsed)
Definition: OpFlashAlg.cxx:347
void RunFlashFinder(std::vector< recob::OpHit > const &HitVector, std::vector< recob::OpFlash > &FlashVector, std::vector< std::vector< int >> &AssocList, double const BinWidth, geo::GeometryCore const &geom, float const FlashThreshold, float const WidthTolerance, detinfo::DetectorClocksData const &ClocksData, float const TrigCoinc)
Definition: OpFlashAlg.cxx:60
void ConstructFlash(std::vector< int > const &HitsPerFlashVec, std::vector< recob::OpHit > const &HitVector, std::vector< recob::OpFlash > &FlashVector, geo::GeometryCore const &geom, detinfo::DetectorClocksData const &ClocksData, float const TrigCoinc)
Definition: OpFlashAlg.cxx:507
void AddHitContribution(recob::OpHit const &currentHit, double &MaxTime, double &MinTime, double &AveTime, double &FastToTotal, double &AveAbsTime, double &TotalPE, std::vector< double > &PEs)
Definition: OpFlashAlg.cxx:442
void apply_permutation(std::vector< T > &vec, std::vector< int > const &p)
Definition: OpFlashAlg.cxx:680
void AssignHitsToFlash(std::vector< int > const &FlashesInAccumulator1, std::vector< int > const &FlashesInAccumulator2, std::vector< double > const &Binned1, std::vector< double > const &Binned2, std::vector< std::vector< int >> const &Contributors1, std::vector< std::vector< int >> const &Contributors2, std::vector< recob::OpHit > const &HitVector, std::vector< std::vector< int >> &HitsPerFlash, float const FlashThreshold)
Definition: OpFlashAlg.cxx:241
void FindSeedHit(std::map< double, std::vector< int >, std::greater< double >> const &HitsBySize, std::vector< bool > &HitsUsed, std::vector< recob::OpHit > const &HitVector, std::vector< int > &HitsThisRefinedFlash, double &PEAccumulated, double &FlashMaxTime, double &FlashMinTime)
Definition: OpFlashAlg.cxx:291
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:289
void MarkFlashesForRemoval(std::vector< recob::OpFlash > const &FlashVector, size_t const BeginFlash, std::vector< bool > &MarkedForRemoval)
Definition: OpFlashAlg.cxx:603
void ClaimHits(std::vector< recob::OpHit > const &HitVector, std::vector< int > const &HitsThisFlash, float const FlashThreshold, std::vector< std::vector< int >> &HitsPerFlash, std::vector< int > &HitClaimedByFlash)
Definition: OpFlashAlg.cxx:219
std::vector< int > sort_permutation(std::vector< T > const &vec, int offset, Compare compare)
Definition: OpFlashAlg.cxx:668
void FillFlashesBySizeMap(std::vector< int > const &FlashesInAccumulator, std::vector< double > const &BinnedPE, int const &Accumulator, std::map< double, std::map< int, std::vector< int >>, std::greater< double >> &FlashesBySize)
Definition: OpFlashAlg.cxx:196
void RemoveLateLight(std::vector< recob::OpFlash > &FlashVector, std::vector< std::vector< int >> &RefinedHitsPerFlash)
Definition: OpFlashAlg.cxx:643
General LArSoft Utilities.
Description of geometry of one entire detector.
Definition: GeometryCore.h:119
void AddHitToFlash(int const &HitID, std::vector< bool > &HitsUsed, recob::OpHit const &currentHit, double const WidthTolerance, std::vector< int > &HitsThisRefinedFlash, double &PEAccumulated, double &FlashMaxTime, double &FlashMinTime)
Definition: OpFlashAlg.cxx:320
std::vector< art::Ptr< recob::Hit > > HitVector
void RefineHitsInFlash(std::vector< int > const &HitsThisFlash, std::vector< recob::OpHit > const &HitVector, std::vector< std::vector< int >> &RefinedHitsPerFlash, float const WidthTolerance, float const FlashThreshold)
Definition: OpFlashAlg.cxx:371
Contains all timing reference information for the detector.
unsigned int GetAccumIndex(double const PeakTime, double const MinTime, double const BinWidth, double const BinOffset)
Definition: OpFlashAlg.cxx:168
void GetHitGeometryInfo(recob::OpHit const &currentHit, geo::GeometryCore const &geom, std::vector< double > &sumw, std::vector< double > &sumw2, double &sumy, double &sumy2, double &sumz, double &sumz2)
Definition: OpFlashAlg.cxx:468
Namespace collecting geometry-related classes utilities.
void RemoveFlashesFromVectors(std::vector< bool > const &MarkedForRemoval, std::vector< recob::OpFlash > &FlashVector, size_t const BeginFlash, std::vector< std::vector< int >> &RefinedHitsPerFlash)
Definition: OpFlashAlg.cxx:630
void FillAccumulator(unsigned int const &AccumIndex, unsigned int const &HitIndex, double const PE, float const FlashThreshold, std::vector< double > &Binned, std::vector< std::vector< int >> &Contributors, std::vector< int > &FlashesInAccumulator)
Definition: OpFlashAlg.cxx:177
double GetLikelihoodLateLight(double const iPE, double const iTime, double const iWidth, double const jPE, double const jTime, double const jWidth)
Definition: OpFlashAlg.cxx:586