TimeOffsetTool.h
Go to the documentation of this file.
1 // TimeOffsetTool.h
2 
3 #ifndef TimeOffsetTool_H
4 #define TimeOffsetTool_H
5 
6 // Interface for a tool providing access to a timing offset,
7 // e.g. for the ADC samples from a TPC.
8 
9 #include<string>
10 
12 
13 public:
14 
15  using Index = unsigned int;
16  using LongIndex = unsigned long;
17  using Name = std::string;
18 
19  // Data on which the offset may depend.
20  class Data {
21  public:
22  Index run =0;
24  Index event =0;
28  };
29 
30  // Class describing a time offset.
31  // value - Integral part of the offset (typically sufficient?)
32  // rem - value remainder if offset in non-integral
33  // unit - Unit for offset, e.g. tick, us, ns
34  class Offset {
35  public:
36  int status =0;
37  long value =0;
38  double rem =0.0;
40  bool isValid() const { return status == 0; }
41  const Offset& setStatus(int val) { status = val; return *this; }
42  };
43 
44  virtual ~TimeOffsetTool() =default;
45 
46  virtual Offset offset(const Data& dat) const =0;
47 
48 };
49 
50 #endif
std::string string
Definition: nybbler.cc:12
const Offset & setStatus(int val)
unsigned int Index
virtual Offset offset(const Data &dat) const =0
virtual ~TimeOffsetTool()=default
std::string Name
unsigned long LongIndex