All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DetectorClocksStandard.cxx
Go to the documentation of this file.
2 #include "fhiclcpp/ParameterSet.h"
3 
5 
6 #include <iostream>
7 
8 //-------------------------------------------------------------------------
10  : fConfigName{"G4RefTime",
11  "TriggerOffsetTPC",
12  "FramePeriod",
13  "ClockSpeedTPC",
14  "ClockSpeedOptical",
15  "ClockSpeedTrigger",
16  "ClockSpeedExternal",
17  "DefaultTrigTime",
18  "DefaultBeamTime"}
19  , fConfigValue{pset.get<double>(fConfigName[kG4RefTime]),
20  pset.get<double>(fConfigName[kTriggerOffsetTPC]),
21  pset.get<double>(fConfigName[kFramePeriod]),
22  pset.get<double>(fConfigName[kClockSpeedTPC]),
23  pset.get<double>(fConfigName[kClockSpeedOptical]),
24  pset.get<double>(fConfigName[kClockSpeedTrigger]),
25  pset.get<double>(fConfigName[kClockSpeedExternal]),
26  pset.get<double>(fConfigName[kDefaultTrigTime]),
27  pset.get<double>(fConfigName[kDefaultBeamTime])}
28  , fTrigModuleName{pset.get<std::string>("TrigModuleName")}
29  , fG4RefCorrTrigModuleName{pset.get<std::string>("G4RefCorrTrigModuleName", "baddefault")}
30  , fTriggerOffsetTPC{fConfigValue[kTriggerOffsetTPC]}
31  , fTriggerTime{fConfigValue[detinfo::kDefaultTrigTime]}
32  , fBeamGateTime{fConfigValue[detinfo::kDefaultBeamTime]}
33  , fFramePeriod{fConfigValue[kFramePeriod]}
34  , fTPCClock{fTriggerTime, fFramePeriod, fConfigValue[kClockSpeedTPC]}
35 {
36  SetTriggerTime(fConfigValue[detinfo::kDefaultTrigTime], fConfigValue[detinfo::kDefaultBeamTime]);
37 }
38 
39 void
41 {
42  fFramePeriod = fConfigValue[kFramePeriod];
43  fTriggerOffsetTPC = fConfigValue[kTriggerOffsetTPC];
44  SetTriggerTime(fConfigValue[detinfo::kDefaultTrigTime], fConfigValue[detinfo::kDefaultBeamTime]);
45 }
46 
47 bool
48 detinfo::DetectorClocksStandard::IsRightConfig(const fhicl::ParameterSet& ps) const
49 {
50  if (ps.has_key("module_label")) { return false; }
51  return std::all_of(fConfigName.cbegin(), fConfigName.cend(), [&ps](auto const& config_name) {
52  return ps.has_key(config_name);
53  });
54 }
55 
56 
57 void
59 {
60  std::cout << "fConfigValues contents: " << std::endl;
61 
62  for(auto const& [ name, value ]: util::zip(fConfigName, fConfigValue))
63  std::cout << "\n " << name << " ... " << value;
64  std::cout << std::endl;
65 
66  DataForJob().debugReport(std::cout);
67  std::cout.flush();
68 
69 } // detinfo::DetectorClocksStandard::debugReport()
70 
Definition of util::zip().
bool IsRightConfig(const fhicl::ParameterSet &ps) const
void debugReport() const
Dumps the current configuration to screen.
void ApplyParams()
Internal function to apply loaded parameters to member attributes.
then echo fcl name
DetectorClocksStandard(fhicl::ParameterSet const &pset)
auto zip(Iterables &&...iterables)
Range-for loop helper iterating across many collections at the same time.
Definition: zip.h:295
temporary value
BEGIN_PROLOG could also be cout