LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
OpDetPulse.cxx
Go to the documentation of this file.
1 //
3 // OpDetPulse class
4 //
5 // Ben Jones
6 // bjpjones@mit.edu
7 //
8 // Christie Chiu
9 // cschiu@mit.edu
10 //
12 
14 #include "cetlib_except/exception.h"
16 
17 namespace raw {
18 
19  //----------------------------------------------------------------------
21  {
22  /* mf::LogWarning("OpDetPulse") <<"Warning : OpDetPulse default constructor called without "
23  <<"specification of OpChannel. This is not recommended";
24  */
25  }
26 
27  //----------------------------------------------------------------------
29  std::vector<short> Waveform,
30  unsigned int PMTFrame,
31  unsigned int FirstSample)
32  {
37  }
38 
39  //----------------------------------------------------------------------
41  {
43  }
44 
45  //----------------------------------------------------------------------
46  int OpDetPulse::Integral(unsigned short startbin, unsigned short endbin)
47  {
48  // endbin set to zero or not supplied means go to end of vector
49  if (endbin == 0) endbin = Samples();
50 
51  // Some error trapping for stupid integration limits
52  if (endbin < startbin)
53  throw cet::exception("OpDetPulse")
54  << " Trying to integrate between illegal limits : " << startbin << " " << endbin << "\n";
55  if (endbin > Samples())
56  throw cet::exception("OpDetPulse")
57  << " Trying to integrate between illegal limits : " << startbin << " " << endbin << "\n";
58 
59  unsigned int TotalIntegral = 0;
60  // Loop over vector to return the integral
61  for (size_t i = startbin; i != endbin; ++i) {
62  TotalIntegral += fWaveform.at(i);
63  }
64 
65  return TotalIntegral;
66  }
67 
68 }
unsigned short OpChannel() const
Definition: OpDetPulse.h:62
std::vector< short > fWaveform
Definition: OpDetPulse.h:30
Raw data description.
Definition: RawTypes.h:6
const std::vector< short > & Waveform() const
Definition: OpDetPulse.h:54
unsigned int fFirstSample
first sample number within pmt frame
Definition: OpDetPulse.h:28
unsigned int FirstSample() const
Definition: OpDetPulse.h:74
unsigned short Samples() const
Definition: OpDetPulse.h:66
unsigned int fPMTFrame
frame number where pulse begins
Definition: OpDetPulse.h:27
int Integral(unsigned short startbin=0, unsigned short endbin=0)
Definition: OpDetPulse.cxx:46
unsigned short fOpChannel
channel in the readout
Definition: OpDetPulse.h:24
unsigned int PMTFrame() const
Definition: OpDetPulse.h:70
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33