OpDetPulse.cxx
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // OpDetPulse class
4 //
5 // Ben Jones
6 // bjpjones@mit.edu
7 //
8 // Christie Chiu
9 // cschiu@mit.edu
10 //
11 ////////////////////////////////////////////////////////////////////////
12 
15 #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 
47  //----------------------------------------------------------------------
48  int OpDetPulse::Integral(unsigned short startbin, unsigned short endbin)
49  {
50  // endbin set to zero or not supplied means go to end of vector
51  if(endbin==0) endbin=Samples();
52 
53  // Some error trapping for stupid integration limits
54  if(endbin < startbin)
55  throw cet::exception("OpDetPulse")
56  <<" Trying to integrate between illegal limits : " <<startbin<<" " <<endbin << "\n";
57  if(endbin > Samples())
58  throw cet::exception("OpDetPulse")
59  <<" Trying to integrate between illegal limits : "<< startbin<<" " <<endbin << "\n";
60 
61  unsigned int TotalIntegral = 0;
62  // Loop over vector to return the integral
63  for(size_t i=startbin; i!=endbin; ++i)
64  {
65  TotalIntegral+=fWaveform.at(i);
66  }
67 
68  return TotalIntegral;
69  }
70 
71 
72 }
unsigned short OpChannel() const
Definition: OpDetPulse.h:61
std::vector< short > fWaveform
Definition: OpDetPulse.h:31
Raw data description.
const std::vector< short > & Waveform() const
Definition: OpDetPulse.h:59
unsigned int fFirstSample
first sample number within pmt frame
Definition: OpDetPulse.h:29
unsigned int FirstSample() const
Definition: OpDetPulse.h:64
unsigned short Samples() const
Definition: OpDetPulse.h:62
unsigned int fPMTFrame
frame number where pulse begins
Definition: OpDetPulse.h:28
int Integral(unsigned short startbin=0, unsigned short endbin=0)
Definition: OpDetPulse.cxx:48
unsigned short fOpChannel
channel in the readout
Definition: OpDetPulse.h:25
unsigned int PMTFrame() const
Definition: OpDetPulse.h:63
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33