LArSoft  v06_85_00
Liquid Argon Software toolkit - http://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
 

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 53 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 61 of file UtilFunc.cxx.

References evd::details::begin(), bin, and evd::details::end().

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

62  {
63  if(nbins<1) throw OpticalRecoException("Cannot have 0 binning");
64 
65  auto res = std::minmax_element(std::begin(mean_v),std::end(mean_v));
66 
67  double bin_width = ((*res.second) - (*res.first)) / ((double)nbins);
68 
69  if(nbins==1 || bin_width == 0) return ((*res.first) + bin_width /2.);
70 
71  //std::cout<<"Min: "<<(*res.first)<<" Max: "<<(*res.second)<<" Width: "<<bin_width<<std::endl;
72 
73  // Construct array of nbins
74  static std::vector<size_t> ctr_v(nbins,0);
75  for(auto& v : ctr_v) 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 
86  // Find max occurrence
87  auto max_it = std::max_element(std::begin(ctr_v),std::end(ctr_v));
88 
89  // Get the mean of max-occurrence bins
90  double mean_max_occurrence = 0;
91  double num_occurrence = 0;
92  for(size_t bin=0; bin<ctr_v.size(); ++bin) {
93 
94  if(ctr_v[bin] != (*max_it)) continue;
95 
96  mean_max_occurrence += ((*res.first) + bin_width / 2. + bin_width * bin);
97 
98  num_occurrence += 1.0;
99  }
100 
101  return (mean_max_occurrence / num_occurrence);
102  }
std::vector< evd::details::RawDigitInfo_t >::const_iterator begin(RawDigitCacheDataClass const &cache)
float bin[41]
Definition: plottest35.C:14
std::vector< evd::details::RawDigitInfo_t >::const_iterator end(RawDigitCacheDataClass const &cache)
double pmtana::BinnedMaxTH1D ( const std::vector< double > &  v,
int  bins 
)

Definition at line 114 of file UtilFunc.cxx.

References evd::details::begin(), and evd::details::end().

114  {
115 
116  auto max_it = std::max_element(std::begin(v), std::end(v));
117  auto min_it = std::min_element(std::begin(v), std::end(v));
118 
119  TH1D th("th",";;",bins,*min_it,*max_it);
120 
121  for (const auto & m : v) th.Fill(m);
122 
123  return th.GetXaxis()->GetBinCenter(th.GetMaximumBin());
124  }
std::vector< evd::details::RawDigitInfo_t >::const_iterator begin(RawDigitCacheDataClass const &cache)
std::vector< evd::details::RawDigitInfo_t >::const_iterator end(RawDigitCacheDataClass const &cache)
bool pmtana::CheckIndex ( const std::vector< short > &  wf,
const size_t &  begin,
size_t &  end 
)

Definition at line 46 of file PMTPulseRecoBase.cxx.

References evd::details::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 << " end = " << end << std::endl;
52 
53  return false;
54  }
55 
56  if(!end) end = wf.size() - 1;
57 
58  return true;
59  }
std::vector< evd::details::RawDigitInfo_t >::const_iterator begin(RawDigitCacheDataClass const &cache)
std::vector< evd::details::RawDigitInfo_t >::const_iterator end(RawDigitCacheDataClass const &cache)
double pmtana::edge_aware_mean ( const std::vector< short > &  wf,
int  start,
int  end 
)

Definition at line 27 of file UtilFunc.cxx.

References evd::details::end().

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

27  {
28 
29  auto m = double{0.0};
30  auto n_t = unsigned{0};
31 
32  for(int k = start; k < end; ++k) {
33  if (k < 0 or k > (int)(wf.size()) - 1) continue;
34  m += wf.at(k);
35  ++n_t;
36  }
37 
38  if( n_t > 0 ) m /= n_t;
39  n_t = 0;
40 
41  return m;
42  }
std::vector< evd::details::RawDigitInfo_t >::const_iterator end(RawDigitCacheDataClass const &cache)
int pmtana::sign ( double  val)

Definition at line 106 of file UtilFunc.cxx.

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

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

Definition at line 44 of file UtilFunc.cxx.

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

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