TimingRawDecoderOffsetTool.h
Go to the documentation of this file.
1 // TimingRawDecoderOffsetTool.h
2 //
3 // David Adams
4 // June 2018
5 //
6 // Tool that calculates time offset using the timing clock received in an
7 // argumment.
8 //
9 // An earlier version of this tool read the timing clock from a text file
10 // written by the protoDUNE TimingRawDecoder module.
11 //
12 // Parameters:
13 // LogLevel - Message logging level (0=none, 1=ctor, 2=each call, ...)
14 // TpcTickPhase - See below.
15 // Unit - Unit in which the timing offset should be returned (daq, tick, ns).
16 // FembScaleIds - IDs of the FEMBs fo which the offset should be scaled.
17 // FembScaleValues - Scale factors for the scaled FEMBs.
18 // RunDataTool - Name of the tool used to fetch the run data.
19 //
20 // For protoDUNE, daq is us/50, i.e 20 ns.
21 //
22 // The TPC tick is
23 //
24 // t_TPC = scale*(t_daq + TpcTickPhase + runPhase)/TpcTickPeriod
25 //
26 // where t_daq is the count from the DAQ clock, TpcTickPeriod is (for now)
27 // fixed to 25 (50 MHz/2 MHz) and TpcTickPhase is a configuration parameter.
28 // Sensible values for the latter are 0, 1, 2, ..., TpcTickPeriod-1.
29 //
30 // The factor scale is otained from the corresponding position in FembScaleValues
31 // if the FEMB ID
32 //
33 // If the run data tool is found and has phaseGroup, then
34 // runPhase = rdat.phases[igrp]
35 
36 #ifndef TimingRawDecoderOffsetTool_H
37 #define TimingRawDecoderOffsetTool_H
38 
40 #include "fhiclcpp/ParameterSet.h"
42 #include <vector>
43 #include <map>
44 
45 class RunDataTool;
46 
48 
49 public:
50 
51  using Name = std::string;
52  using IndexVector = std::vector<Index>;
53  using DoubleVector = std::vector<double>;
54  using ScaleMap = std::map<Index, double>;
55 
56  // Ctor.
58 
59  // Dtor.
60  ~TimingRawDecoderOffsetTool() override =default;
61 
62  // Return run data.
63  Offset offset(const Data& dat) const override;
64 
65 private:
66 
67  // Parameters.
74 
75  const RunDataTool* m_pRunDataTool =nullptr;
76 
77  // Derived from configuration.
78  ScaleMap m_fembScales; // Indexed by FEMB ID
79 
80 };
81 
82 
83 #endif
Offset offset(const Data &dat) const override
std::string string
Definition: nybbler.cc:12
std::map< Index, double > ScaleMap
unsigned int Index
TimingRawDecoderOffsetTool(fhicl::ParameterSet const &ps)
static constexpr double ps
Definition: Units.h:99
~TimingRawDecoderOffsetTool() override=default