StandardAdcChannelStringTool.h
Go to the documentation of this file.
1 // StandardAdcChannelStringTool.h
2 
3 // David Adams
4 // May 2018
5 //
6 // Tool to construct a string from an input template taking data
7 // from AdcChannelData and DataMap objects.
8 //
9 // The string is the pattern with the following replacements:
10 // %RUN% --> acd.run
11 // %SUBRUN% --> acd.subRun
12 // %EVENT% --> acd.event
13 // %CHAN% --> acd.channel
14 // %FEMB% --> acd.fembID
15 // %SUNIT% --> "sunit" where sunit = acd.sampleUnit
16 // % SUNIT% --> " sunit" or "" if sunit is empty
17 // %(SUNIT)% --> "(sunit)" or "" if sunit is empty
18 // % (SUNIT)% --> " (sunit)" or "" if sunit is empty
19 // %((SUNIT))% --> "(sunit)" or sunit if there is no space in sunit
20 // % ((SUNIT))% --> add preceding space to this if sunit is not blank
21 // %[SUNIT]% --> "[sunit]" or "" if sunit is empty
22 // % [SUNIT]% --> " [sunit]" or "" if sunit is empty
23 // Same patterns with ASUNIT substitute sunit-tick
24 // %COUNT% --> dm.getInt("count") passed in call to build
25 // %CHAN1% --> dm.getInt("chan1") passed in call to build
26 // %CHAN2% --> dm.getInt("chan2") passed in call to build
27 // %TRIG% --> acd.trigger
28 // %TRIGNAME% --> TrigNames[acd.trigger]
29 // %TRIGNAMECAP% --> TrigNames[acd.trigger] with first letter capitalized.
30 // %UTCTIME% --> Time string in UTC (implicit), e.g. "2018-10-23 15:31:12"
31 // %UTCTIMEn% --> Previous plus fractional seconds to n digits for n=0-9.
32 // where acd is the AdcChannelData object and dm is the DataMap object
33 // passed in the call to build.
34 //
35 // E.g. if acd.run = 123, then "%RUN%" is replaced with "123".
36 //
37 // In addition, any number can be prefixed with a digit to indicate that
38 // the number should be padded with leading zeros to a width equal to that
39 // digit if its natural width is less that that value. E.g. %6RUN% will
40 // produce "000123" if acd.run = 123.
41 //
42 // If a number is prefixed with 0, then the width used is specified by
43 // the configuration here. E.g. if RunWidth == 5, then "%0RUN" will be
44 // replaced with "00123" if acd.run = 123.
45 //
46 // Tool configuration:
47 // LogLevel - 1 to log from ctor
48 // 2 to log every call to build
49 // RunWidth - width for run
50 // SubRunWidth - width for subrun
51 // EventWidth - width for event
52 // ChannelWidth - width for channel
53 // FembWidth - width for FEMB
54 // TrigNames - Names for triggers.
55 
56 #ifndef StandardAdcChannelStringTool_H
57 #define StandardAdcChannelStringTool_H
58 
60 #include "fhiclcpp/ParameterSet.h"
62 #include <vector>
63 
65 : public AdcChannelStringTool {
66 
67 public:
68 
69  using Index = unsigned int;
70  using Name = std::string;
71  using NameVector = std::vector<Name>;
72 
74 
75  std::string build(const AdcChannelData& acd, const DataMap& dm, std::string spat) const override;
76 
77 private:
78 
79  // Configuration data.
89 
90  static const Index m_nrep = 9;
94 
95 };
96 
97 
98 #endif
std::string string
Definition: nybbler.cc:12
StandardAdcChannelStringTool(fhicl::ParameterSet const &ps)
static constexpr double ps
Definition: Units.h:99
std::string build(const AdcChannelData &acd, const DataMap &dm, std::string spat) const override