FdAlwaysUpManager.cc
Go to the documentation of this file.
1 
9 #include <sstream>
10 
11 #include <fwk/CentralConfig.h>
12 #include <utl/Reader.h>
13 #include <utl/TimeStamp.h>
14 #include <utl/UTCDateTime.h>
15 #include <utl/ErrorLogger.h>
16 #include <det/Detector.h>
17 #include <fdet/FDetector.h>
18 
19 #include <fdet/FdAlwaysUpManager.h>
20 
21 using namespace fwk;
22 using namespace det;
23 using namespace fdet;
24 using namespace utl;
25 using namespace std;
26 
27 
28 REGISTER_F_MANAGER("FdAlwaysUpManager", FdAlwaysUpManager);
29 
30 
31 void
32 FdAlwaysUpManager::Init(const string& name)
33 {
34  ostringstream msg;
35  msg << "FdAlwaysUpManager initialized\n";
36  INFO(msg);
37  fAvailableComponents.insert("has_fduptime");
38  fAvailableComponents.insert("uptime_gpsStart");
39  fAvailableComponents.insert("uptime_gpsStop");
40  fAvailableComponents.insert("uptime_fraction");
41  fAvailableComponents.insert("veto_fraction");
42  fAvailableComponents.insert("status");
43  //fAvailableComponents.insert("ADCVariance"); // for channel
44  //fAvailableComponents.insert("Threshold"); // for channel
45  //fAvailableComponents.insert("Baseline"); // for channel
46 
47  // don't require initialization
48  fIsInitialized = true;
49  VManager::Init(name);
50 }
51 
52 
54 FdAlwaysUpManager::GetStatus(int& returnData,
55  const string& componentProperty,
56  const string& /*componentName*/,
57  const IndexMap& /*componentIndex*/)
58  const
59 {
60  /*ostringstream info;
61  info << "ALWAYSUP: called GetStatus for componentName=" << componentName
62  << " componentProperty=" << componentProperty << "\n" ;
63  for (IndexMap::const_iterator imap = componentIndex.begin();
64  imap != componentIndex.end(); ++imap)
65  info << " index=\"" << imap->first << "\" -> \"" << imap->second << "\"\n";
66  INFO(info);
67  */
68  if (fAvailableComponents.find(componentProperty) == fAvailableComponents.end())
69  return eNotFound;
70 
71  if (componentProperty == "has_fduptime") {
72  returnData = 0;//x00;// cout << returnData;
73  return VManager::eFound;
74  }
75 
76  if (componentProperty == "status") {
77  returnData = 0xff;
78  return VManager::eFound;
79  }
80 
81  if (componentProperty == "uptime_gpsStart") {
82  // very early
83  returnData = UTCDateTime(2000, 1, 1).GetTimeStamp().GetGPSSecond();
84  return eFound;
85  }
86 
87  if (componentProperty == "uptime_gpsStop") {
88  // very late
89  returnData = UTCDateTime(2037, 11, 30).GetTimeStamp().GetGPSSecond();
90  return eFound;
91  }
92 
93  return eNotFound;
94 }
95 
96 
98 FdAlwaysUpManager::GetUpFraction(double& returnData,
99  const string& componentProperty,
100  const string& /*componentName*/,
101  const IndexMap& /*componentIndex*/)
102  const
103 {
104  /*ostringstream info;
105  info << "ALWAYSUP: called GetStatus for componentName=" << componentName
106  << " componentProperty=" << componentProperty << "\n" ;
107  for (IndexMap::const_iterator imap = componentIndex.begin();
108  imap != componentIndex.end(); ++imap)
109  info << " index=\"" << imap->first << "\" -> \"" << imap->second << "\"\n";
110  INFO(info);
111  */
112  if (fAvailableComponents.find(componentProperty) == fAvailableComponents.end())
113  return eNotFound;
114 
115  if (componentProperty == "has_fduptime") {
116  returnData = 0;//x00;//cout << returnData << endl;
117  return VManager::eFound;
118  }
119  if (componentProperty == "uptime_fraction") {
120  // always on
121  returnData = 1;
122  return eFound;
123  }
124  else if (componentProperty == "veto_fraction") {
125  // always on
126  returnData = 1;
127  return eFound;
128  }
129  return eNotFound;
130 }
131 
132 
133 // Configure (x)emacs for this file ...
134 // Local Variables:
135 // mode: c++
136 // compile-command: "make -C .. -k"
137 // End:
default FD up time manger: always on !
#define INFO(message)
Macro for logging informational messages.
Definition: ErrorLogger.h:161
void Init()
Initialise the registry.
unsigned long GetGPSSecond() const
GPS second.
Definition: TimeStamp.h:124
#define REGISTER_F_MANAGER(_name_, _Type_)
std::map< std::string, std::string > IndexMap
Definition: VManager.h:133
TimeStamp GetTimeStamp() const
Definition: UTCDateTime.cc:115
Status
Specifies success or (eventually) various possible failure modes.
Definition: VManager.h:127

, generated on Tue Sep 26 2023.