LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
pmtana Namespace Reference

Classes

class  AlgoCFD
 
class  AlgoFixedWindow
 
class  AlgoSiPM
 
class  AlgoSlidingWindow
 
class  AlgoThreshold
 
class  OpticalRecoException
 
class  PedAlgoEdges
 
class  PedAlgoRmsSlider
 
class  PedAlgoRollingMean
 
class  PedAlgoUB
 
class  PMTAna
 
class  PMTPedestalBase
 
class  PMTPulseRecoBase
 
struct  pulse_param
 
class  PulseRecoManager
 
class  RiseTimeCalculatorBase
 
class  RiseTimeGaussFit
 
class  RiseTimeThreshold
 

Typedefs

typedef std::vector< short > Waveform_t
 
typedef std::vector< double > PedestalMean_t
 
typedef std::vector< double > PedestalSigma_t
 
typedef std::vector< pmtana::pulse_parampulse_param_array
 

Functions

bool CheckIndex (const std::vector< short > &wf, const size_t &begin, size_t &end)
 
double mean (const std::vector< short > &wf, size_t start, size_t nsample)
 
double edge_aware_mean (const std::vector< short > &wf, int start, int end)
 
double std (const std::vector< short > &wf, const double ped_mean, size_t start, size_t nsample)
 
double BinnedMaxOccurrence (const PedestalMean_t &mean_v, const size_t nbins)
 
int sign (double val)
 
double BinnedMaxTH1D (const std::vector< double > &v, int bins)
 

Typedef Documentation

typedef std::vector< double > pmtana::PedestalMean_t

Definition at line 9 of file OpticalRecoTypes.h.

typedef std::vector< double > pmtana::PedestalSigma_t

Definition at line 10 of file OpticalRecoTypes.h.

Definition at line 49 of file PMTPulseRecoBase.h.

typedef std::vector< short > pmtana::Waveform_t

Definition at line 8 of file OpticalRecoTypes.h.

Function Documentation

double pmtana::BinnedMaxOccurrence ( const PedestalMean_t mean_v,
const size_t  nbins 
)

Definition at line 60 of file UtilFunc.cxx.

References util::begin(), bin, and util::end().

Referenced by pmtana::PedAlgoRollingMean::ComputePedestal().

61  {
62  if (nbins < 1) throw OpticalRecoException("Cannot have 0 binning");
63 
64  auto res = std::minmax_element(std::begin(mean_v), std::end(mean_v));
65 
66  double bin_width = ((*res.second) - (*res.first)) / ((double)nbins);
67 
68  if (nbins == 1 || bin_width == 0) return ((*res.first) + bin_width / 2.);
69 
70  //std::cout<<"Min: "<<(*res.first)<<" Max: "<<(*res.second)<<" Width: "<<bin_width<<std::endl;
71 
72  // Construct array of nbins
73  static std::vector<size_t> ctr_v(nbins, 0);
74  for (auto& v : ctr_v)
75  v = 0;
76  for (auto const& v : mean_v) {
77 
78  size_t index = int((v - (*res.first)) / bin_width);
79  //std::cout<<"adc = "<<v<<" width = "<<bin_width<< " ... "
80  //<<index<<" / "<<ctr_v.size()<<std::endl;
81 
82  ctr_v[index]++;
83  }
84 
85  // Find max occurrence
86  auto max_it = std::max_element(std::begin(ctr_v), std::end(ctr_v));
87 
88  // Get the mean of max-occurrence bins
89  double mean_max_occurrence = 0;
90  double num_occurrence = 0;
91  for (size_t bin = 0; bin < ctr_v.size(); ++bin) {
92 
93  if (ctr_v[bin] != (*max_it)) continue;
94 
95  mean_max_occurrence += ((*res.first) + bin_width / 2. + bin_width * bin);
96 
97  num_occurrence += 1.0;
98  }
99 
100  return (mean_max_occurrence / num_occurrence);
101  }
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
Definition: StdUtils.h:77
float bin[41]
Definition: plottest35.C:14
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Definition: StdUtils.h:69
double pmtana::BinnedMaxTH1D ( const std::vector< double > &  v,
int  bins 
)

Definition at line 112 of file UtilFunc.cxx.

References util::begin(), and util::end().

113  {
114 
115  auto max_it = std::max_element(std::begin(v), std::end(v));
116  auto min_it = std::min_element(std::begin(v), std::end(v));
117 
118  TH1D th("th", ";;", bins, *min_it, *max_it);
119 
120  for (const auto& m : v)
121  th.Fill(m);
122 
123  return th.GetXaxis()->GetBinCenter(th.GetMaximumBin());
124  }
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
Definition: StdUtils.h:77
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Definition: StdUtils.h:69
bool pmtana::CheckIndex ( const std::vector< short > &  wf,
const size_t &  begin,
size_t &  end 
)

Definition at line 46 of file PMTPulseRecoBase.cxx.

References util::end().

Referenced by pmtana::PMTPulseRecoBase::Derivative(), pmtana::PMTPulseRecoBase::Integral(), pmtana::PMTPulseRecoBase::Max(), and pmtana::PMTPulseRecoBase::Min().

48  {
49  if (begin >= wf.size() || end >= wf.size() || begin > end) {
50 
51  std::cerr << "Invalid arguments: waveform length = " << wf.size() << " begin = " << begin
52  << " end = " << end << std::endl;
53 
54  return false;
55  }
56 
57  if (!end) end = wf.size() - 1;
58 
59  return true;
60  }
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
Definition: StdUtils.h:77
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Definition: StdUtils.h:69
double pmtana::edge_aware_mean ( const std::vector< short > &  wf,
int  start,
int  end 
)

Definition at line 25 of file UtilFunc.cxx.

References util::end().

Referenced by pmtana::PedAlgoRollingMean::ComputePedestal().

26  {
27 
28  auto m = double{0.0};
29  auto n_t = unsigned{0};
30 
31  for (int k = start; k < end; ++k) {
32  if (k < 0 or k > (int)(wf.size()) - 1) continue;
33  m += wf.at(k);
34  ++n_t;
35  }
36 
37  if (n_t > 0) m /= n_t;
38  n_t = 0;
39 
40  return m;
41  }
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
Definition: StdUtils.h:77
double pmtana::mean ( const std::vector< short > &  wf,
size_t  start,
size_t  nsample 
)

Definition at line 13 of file UtilFunc.cxx.

References sum.

Referenced by lar_dl_content::DlTrackShowerStreamSelectionAlgorithm::AllocateToStreams(), NestAlg::BinomFluct(), larg4::ISCalcNESTLAr::BinomFluct(), TruncMean::CalcIterativeTruncMean(), hit::RFFHitFitter::CalculateAllMeansAndSigmas(), lar_content::LArDiscreteProbabilityHelper::CalculateMean(), ShowerRecoTools::ShowerBayesianTrucatingdEdx::CalculatePosterior(), pmtana::PedAlgoRmsSlider::CheckSanity(), pmtana::PedAlgoRollingMean::ComputePedestal(), pmtana::PedAlgoRmsSlider::ComputePedestal(), pmtana::PedAlgoEdges::ComputePedestal(), pma::PMAlgVertexing::convolute(), lariov::DetPedestalRetrievalAlg::DBUpdate(), lar_dl_content::DlPfoCharacterisationAlgorithm::DlPfoCharacterisationAlgorithm(), pma::PMAlgVertexing::findKinksOnTracks(), trkf::TrackMomentumCalculator::getDeltaThetaRMS_(), ShowerRecoTools::ShowerBayesianTrucatingdEdx::GetLikelihooddEdxVec(), trkf::TrackMomentumCalculator::GetMomentumMultiScatterChi2(), opdet::FlashUtilities::GetPosition(), reco_tool::WaveformTools::getTruncatedMeanRMS(), pma::Track3D::InitFromRefPoints(), lar_dl_content::DlPfoCharacterisationAlgorithm::IsClearTrack(), lar_dl_content::DlClusterCharacterisationAlgorithm::IsClearTrack(), hit::CCHitFinderAlg::MakeCrudeHit(), TruncMean::Mean(), tss::Cluster2D::outermost(), shower::LArPandoraShowerAlg::ShowerCentre(), and pma::PMAlgCosmicTagger::tagApparentStopper().

14  {
15  if (!nsample) nsample = wf.size();
16  if (start > wf.size() || (start + nsample) > wf.size())
17  throw OpticalRecoException("Invalid start/end index!");
18 
19  double sum =
20  std::accumulate(wf.begin() + start, wf.begin() + start + nsample, 0.0) / ((double)nsample);
21 
22  return sum;
23  }
Double_t sum
Definition: plot.C:31
int pmtana::sign ( double  val)

Definition at line 104 of file UtilFunc.cxx.

Referenced by rwgt::GENIEReweight::CalculateSigma(), lar_pandora::PFParticleHitDumper::GetUVW(), pmtana::AlgoCFD::LinearZeroPointX(), and trkf::TrackCheater::produce().

105  {
106 
107  if (val > 0) return 1;
108  if (val < 0) return -1;
109  return 0;
110  }
double pmtana::std ( const std::vector< short > &  wf,
const double  ped_mean,
size_t  start,
size_t  nsample 
)

Definition at line 43 of file UtilFunc.cxx.

Referenced by pmtana::PedAlgoRollingMean::ComputePedestal(), pmtana::PedAlgoRmsSlider::ComputePedestal(), and pmtana::PedAlgoEdges::ComputePedestal().

44  {
45  if (!nsample) nsample = wf.size();
46  if (start > wf.size() || (start + nsample) > wf.size())
47  throw OpticalRecoException("Invalid start/end index!");
48 
49  double sigma = 0;
50 
51  for (size_t index = start; index < (start + nsample); ++index)
52 
53  sigma += pow((wf[index] - ped_mean), 2);
54 
55  sigma = sqrt(sigma / ((double)(nsample)));
56 
57  return sigma;
58  }