LArSoft  v06_85_00
Liquid Argon Software toolkit - http://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 
17 
18 #include "TH1D.h"
19 #include "TFile.h"
20 
21 #include <functional>
22 #include <algorithm>
23 #include <limits>
24 #include <vector>
25 #include <map>
26 #include <iostream>
27 
28 namespace opdet{
29 
30  void RunFlashFinder(std::vector< recob::OpHit > const&,
31  std::vector< recob::OpFlash >&,
32  std::vector< std::vector< int > >&,
33  double const&,
34  geo::GeometryCore const&,
35  float const&,
36  float const&,
38  float const&);
39 
40  unsigned int GetAccumIndex(double const& PeakTime,
41  double const& MinTime,
42  double const& BinWidth,
43  double const& BinOffset);
44 
45  void FillAccumulator(unsigned int const& AccumIndex,
46  unsigned int const& HitIndex,
47  double const& PE,
48  float const& FlashThreshold,
49  std::vector< double >& Binned,
50  std::vector< std::vector< int > >& Contributors,
51  std::vector< int >& FlashesInAccumulator);
52 
53  void AssignHitsToFlash(std::vector< int > const&,
54  std::vector< int > const&,
55  std::vector< double > const&,
56  std::vector< double > const&,
57  std::vector< std::vector< int > > const&,
58  std::vector< std::vector< int > > const&,
59  std::vector< recob::OpHit > const&,
60  std::vector< std::vector< int > >&,
61  float const&);
62 
63  void FillFlashesBySizeMap(std::vector< int > const& FlashesInAccumulator,
64  std::vector< double > const& BinnedPE,
65  int const& Accumulator,
66  std::map< double,
67  std::map< int, std::vector< int > >,
68  std::greater< double > >& FlashesBySize);
69 
70  void FillHitsThisFlash(std::vector< std::vector< int > > const&
71  Contributors,
72  int const& Bin,
73  std::vector< int > const& HitClaimedByFlash,
74  std::vector< int >& HitsThisFlash);
75 
76  void ClaimHits(std::vector< recob::OpHit > const& HitVector,
77  std::vector< int > const& HitsThisFlash,
78  float const& FlashThreshold,
79  std::vector< std::vector< int > >& HitsPerFlash,
80  std::vector< int >& HitClaimedByFlash);
81 
82  void RefineHitsInFlash(std::vector< int > const& HitsThisFlash,
83  std::vector< recob::OpHit > const& HitVector,
84  std::vector< std::vector< int > >&
85  RefinedHitsPerFlash,
86  float const& WidthTolerance,
87  float const& FlashThreshold);
88 
89  void FindSeedHit(std::map< double, std::vector< int >,
90  std::greater< double > > const& HitsBySize,
91  std::vector< bool >& HitsUsed,
92  std::vector< recob::OpHit > const& HitVector,
93  std::vector< int >& HitsThisRefinedFlash,
94  double& PEAccumulated,
95  double& FlashMaxTime,
96  double& FlashMinTime);
97 
98  void AddHitToFlash(int const& HitID,
99  std::vector< bool >& HitsUsed,
100  recob::OpHit const& currentHit,
101  double const& WidthTolerance,
102  std::vector< int >& HitsThisRefinedFlash,
103  double& PEAccumulated,
104  double& FlashMaxTime,
105  double& FlashMinTime);
106 
107  void CheckAndStoreFlash(std::vector< std::vector< int > >&
108  RefinedHitsPerFlash,
109  std::vector< int > const& HitsThisRefinedFlash,
110  double const& PEAccumulated,
111  float const& FlashThreshold,
112  std::vector< bool >& HitsUsed);
113 
114  void ConstructFlash(std::vector< int > const& HitsPerFlashVec,
115  std::vector< recob::OpHit > const& HitVector,
116  std::vector< recob::OpFlash >& FlashVector,
117  geo::GeometryCore const& geom,
118  detinfo::DetectorClocks const& ts,
119  float const& TrigCoinc);
120 
121  void AddHitContribution(recob::OpHit const& currentHit,
122  double& MaxTime,
123  double& MinTime,
124  double& AveTime,
125  double& FastToTotal,
126  double& AveAbsTime,
127  double& TotalPE,
128  std::vector< double >& PEs);
129 
130  void GetHitGeometryInfo(recob::OpHit const& currentHit,
131  geo::GeometryCore const& geom,
132  std::vector< double >& sumw,
133  std::vector< double >& sumw2,
134  double& sumy,
135  double& sumy2,
136  double& sumz,
137  double& sumz2);
138 
139  void RemoveLateLight(std::vector< recob::OpFlash >&,
140  std::vector< std::vector< int > >&);
141 
142  double GetLikelihoodLateLight(double const& iPE,
143  double const& iTime,
144  double const& iWidth,
145  double const& jPE,
146  double const& jTime,
147  double const& jWidth);
148 
149  void MarkFlashesForRemoval(std::vector< recob::OpFlash > const& FlashVector,
150  size_t const& BeginFlash,
151  std::vector< bool >& MarkedForRemoval);
152 
153  void RemoveFlashesFromVectors(std::vector< bool > const&
154  MarkedForRemoval,
155  std::vector< recob::OpFlash >& FlashVector,
156  size_t const& BeginFlash,
157  std::vector< std::vector< int > >&
158  RefinedHitsPerFlash);
159 
160  template < typename T, typename Compare >
161  std::vector< int > sort_permutation(std::vector< T > const& vec,
162  int offset, Compare compare);
163 
164  template < typename T >
165  void apply_permutation(std::vector< T >& vec, std::vector< int > const& p);
166 
167 } // End opdet namespace
168 
169 #endif
void RemoveLateLight(std::vector< recob::OpFlash > &FlashVector, std::vector< std::vector< int > > &RefinedHitsPerFlash)
Definition: OpFlashAlg.cxx:703
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::DetectorClocks const &ts, float const &TrigCoinc)
Definition: OpFlashAlg.cxx:46
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:687
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:251
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:476
void apply_permutation(std::vector< T > &vec, std::vector< int > const &p)
Definition: OpFlashAlg.cxx:750
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:179
pure virtual base interface for detector clocks
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:404
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:265
Access the description of detector geometry.
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:319
std::vector< int > sort_permutation(std::vector< T > const &vec, int offset, Compare compare)
Definition: OpFlashAlg.cxx:736
double GetLikelihoodLateLight(double const &iPE, double const &iTime, double const &iWidth, double const &jPE, double const &jTime, double const &jWidth)
Definition: OpFlashAlg.cxx:638
Description of geometry of one entire detector.
std::vector< art::Ptr< recob::Hit > > HitVector
Conversion of times between different formats and references.
Encapsulate the geometry of an optical detector.
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:379
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:227
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:351
void ConstructFlash(std::vector< int > const &HitsPerFlashVec, std::vector< recob::OpHit > const &HitVector, std::vector< recob::OpFlash > &FlashVector, geo::GeometryCore const &geom, detinfo::DetectorClocks const &ts, float const &TrigCoinc)
Definition: OpFlashAlg.cxx:545
unsigned int GetAccumIndex(double const &PeakTime, double const &MinTime, double const &BinWidth, double const &BinOffset)
Definition: OpFlashAlg.cxx:169
void MarkFlashesForRemoval(std::vector< recob::OpFlash > const &FlashVector, size_t const &BeginFlash, std::vector< bool > &MarkedForRemoval)
Definition: OpFlashAlg.cxx:656
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:503
void FillHitsThisFlash(std::vector< std::vector< int > > const &Contributors, int const &Bin, std::vector< int > const &HitClaimedByFlash, std::vector< int > &HitsThisFlash)
Definition: OpFlashAlg.cxx:212
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:199