ToF.cxx
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////////
2 /// \file ToF.cxx
3 /// \brief Encapsulation of reconstructed Time-of-Flight (ToF)
4 /// information.
5 /// Part of beamline reconstruction for NOvA test beam.
6 /// \author Mike Wallbank (University of Cincinnati) <wallbank@fnal.gov>
7 /// \date November 2018
8 ////////////////////////////////////////////////////////////////////////////
9 
10 #include "ToF.h"
11 
12 // -----------------------------------------------------------------------
14 }
15 
16 // -----------------------------------------------------------------------
17 brb::ToF::ToF(float time, std::pair<float, float> timestamps) {
18  fTime = time;
19  fTimestamps = timestamps;
20 }
21 
22 // -----------------------------------------------------------------------
23 float brb::ToF::Time() const {
24  return fTime;
25 }
26 
27 // -----------------------------------------------------------------------
28 std::pair<float, float> brb::ToF::Timestamps() const {
29  return fTimestamps;
30 }
31 
32 // -----------------------------------------------------------------------
33 float brb::ToF::Timestamp(unsigned int counter) const {
34  if (counter > 1)
35  throw cet::exception("ToF::Timestamp") << "Unknown ToF counter " << counter << std::endl
36  << "Expected 0 or 1." << std::endl;
37  return counter ? fTimestamps.second : fTimestamps.first;
38 }
39 
40 // -----------------------------------------------------------------------
41 void brb::ToF::SetTime(float time) {
42  fTime = time;
43  return;
44 }
45 
46 // -----------------------------------------------------------------------
47 void brb::ToF::SetTimestamps(std::pair<float, float> timestamps) {
48  fTimestamps = timestamps;
49  return;
50 }
51 
52 // -----------------------------------------------------------------------
53 void brb::ToF::SetTimestamp(unsigned int counter, float timestamp) {
54  if (counter > 1)
55  throw cet::exception("ToF::SetTimestamp") << "Unknown ToF counter " << counter << std::endl
56  << "Expected 0 or 1." << std::endl;
57  counter ? fTimestamps.second = timestamp : fTimestamps.first = timestamp;
58  return;
59 }
void SetTimestamps(std::pair< float, float > timestamps)
Definition: ToF.cxx:47
std::pair< float, float > Timestamps() const
Definition: ToF.cxx:28
void SetTimestamp(unsigned int counter, float timestamp)
Definition: ToF.cxx:53
void SetTime(float time)
Definition: ToF.cxx:41
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
float Timestamp(unsigned int counter) const
Definition: ToF.cxx:33
float Time() const
Definition: ToF.cxx:23
::xsd::cxx::tree::time< char, simple_type > time
Definition: Database.h:194
std::pair< float, float > fTimestamps
Definition: ToF.h:43
Encapsulation of reconstructed Time-of-Flight (ToF) information. Part of beamline reconstruction for ...
float fTime
Definition: ToF.h:42
ToF()
Definition: ToF.cxx:13