FdUpTimeFileManager.h
Go to the documentation of this file.
1 #ifndef _fdet_FdUpTimeFileManager_h_
2 #define _fdet_FdUpTimeFileManager_h_
3 
4 #include <det/ValidityStamp.h>
5 
6 
7 class TTree;
8 
9 
10 struct UpTimePeriod {
11  unsigned int fGpsStart = 0;
12  unsigned int fGpsStop = 0;
13  TFile* fRootFilePtr = nullptr;
14  TTree* fDataTree = nullptr;
15  TTree* fHeaderTree = nullptr;
16  double fFileVersion = 0;
17  UpTimePeriod() = default;
18  UpTimePeriod(TFile* const f);
19  bool operator<(const UpTimePeriod& x) const { return fGpsStart < x.fGpsStart; }
20 };
21 
22 
23 namespace fdet {
24 
89 
90  public:
91  FdUpTimeFileManager() = default;
92  virtual ~FdUpTimeFileManager() = default;
93 
95  //VMANAGER_GETDATA_NOTFOUND(unsigned long long int)
96  VMANAGER_GETDATA_NOTFOUND(std::string)
97  VMANAGER_GETDATA_NOTFOUND(std::list<int>)
98  VMANAGER_GETDATA_NOTFOUND(std::list<std::pair<int, int> >)
99  VMANAGER_GETDATA_NOTFOUND(std::vector<double>)
100  VMANAGER_GETDATA_NOTFOUND(std::vector<int>)
101  VMANAGER_GETDATA_NOTFOUND(std::vector<std::string>)
102  VMANAGER_GETDATA_NOTFOUND(std::vector<bool>)
103  VMANAGER_GETDATA_NOTFOUND(std::list<double>)
104  VMANAGER_GETDATA_NOTFOUND(std::list<std::string>)
107  VMANAGER_GETDATA_NOTFOUND(std::map<int, utl::TabulatedFunction>)
108  VMANAGER_GETDATA_NOTFOUND(std::map<std::string, double>)
109 
110  virtual Status GetData(double& returnData,
111  const std::string& componentProperty,
112  const std::string& componentName,
113  const IndexMap& componentIndex) const;
114 
115  virtual Status GetData(int& returnData,
116  const std::string& componentProperty,
117  const std::string& componentName,
118  const IndexMap& componentIndex) const
119  { return GetOkFlag(returnData, componentProperty, componentName, componentIndex); }
120 
121  void Init(const std::string& configLink);
122 
123  private:
124  void Initialize();
125 
126  Status GetOkFlag(int& returnData,
127  const std::string& componentProperty,
128  const std::string& componentName,
129  const IndexMap& componentIndex) const;
130 
131  Status GetUpTimeFraction(double& returnData,
132  const std::string& componentProperty,
133  const std::string& componentName,
134  const IndexMap& componentIndex) const;
135 
136  Status GetVetoFraction(double& returnData,
137  const std::string& componentProperty,
138  const std::string& componentName,
139  const IndexMap& componentIndex) const;
140 
141  Status GetChannelData(double& returnData,
142  const std::string& componentProperty,
143  const std::string& componentName,
144  const IndexMap& componentIndex) const;
145 
146  int GetEyeIndex(const IndexMap& componentIndex) const;
147  int GetTelIndex(const IndexMap& componentIndex) const;
148  int GetChannelIndex(const IndexMap& componentIndex) const;
149  bool ReadData() const;
150 
152 
153  int fVerbosity = 0;
154  std::vector<std::string> fFileList;
155  std::vector<std::string>::const_iterator fRootFileIterator;
156  std::vector<UpTimePeriod> fUpTimeVector;
157  std::vector<UpTimePeriod>::const_iterator fUpTimeVectorIterator;
158 
159  // number of pixels per telescope (as used in AugerUpTime-tree)
160  static const unsigned int kNPixelPerTel = 440;
161 
162  // data cache
164  mutable std::map<int, int> fEyeStatus;
165  mutable std::map<int, int> fTelescopeStatus;
166  mutable std::map<int, double> fEyeUpTimeFraction;
167  mutable std::map<int, double> fFDASVetoFraction;
168  mutable std::map<int, double> fCDASVetoFraction;
169  mutable std::map<int, double> fTelescopeUpTimeFraction;
170 
171  struct ChannelInfo {
172  ChannelInfo(unsigned int v, unsigned int t, unsigned int b)
173  : fVariance(v), fThreshold(t), fBaseline(b) { }
174  unsigned short fVariance = 0;
175  unsigned short fThreshold = 0;
176  unsigned short fBaseline = 0;
177  };
178 
179  mutable std::map<int, std::vector<ChannelInfo>> fChannelInfo;
180  mutable int fCDASStatus;
181  mutable double fCDASUpTimeFraction;
182  // index map
183  static const double fgSearchMapBinning;
184  typedef std::pair<unsigned int, unsigned int> IndexEntry;
185  typedef std::pair<IndexEntry, UpTimePeriod> IndexRecord;
186  typedef std::vector<IndexRecord> IndexVector;
187  typedef IndexVector::const_iterator IndexVectorIterator;
188  typedef std::map<unsigned int, IndexVector> Index;
189  typedef Index::iterator IndexIterator;
190  typedef Index::const_iterator ConstIndexIterator;
193 
194  };
195 
196 }
197 
198 
199 #endif
std::vector< IndexRecord > IndexVector
std::map< int, double > fCDASVetoFraction
ChannelInfo(unsigned int v, unsigned int t, unsigned int b)
std::vector< std::string > fFileList
Class to hold collection (x,y) points and provide interpolation between them.
VMANAGER_GETDATA_HANDLE_DENIED int fVerbosity
std::pair< IndexEntry, UpTimePeriod > IndexRecord
Interface for detector managers.
Definition: VManager.h:115
int GetChannelIndex(const IndexMap &componentIndex) const
std::map< unsigned int, IndexVector > Index
Status GetVetoFraction(double &returnData, const std::string &componentProperty, const std::string &componentName, const IndexMap &componentIndex) const
std::vector< UpTimePeriod >::const_iterator fUpTimeVectorIterator
std::pair< unsigned int, unsigned int > IndexEntry
Class to hold collection (x,y) points and provide interpolation between them, where y are complex num...
UpTimePeriod()=default
static const double fgSearchMapBinning
virtual ~FdUpTimeFileManager()=default
virtual Status GetData(double &returnData, const std::string &componentProperty, const std::string &componentName, const IndexMap &componentIndex) const
#define VMANAGER_GETDATA_HANDLE_DENIED
Definition: VManager.h:75
std::map< int, double > fEyeUpTimeFraction
Class to manage Fd UpTime ROOT files.
int GetEyeIndex(const IndexMap &componentIndex) const
void Init(const std::string &configLink)
Manager Initialization. configLink is the CentralConfig hook for the configuration file...
std::vector< std::string >::const_iterator fRootFileIterator
Index::const_iterator ConstIndexIterator
std::vector< UpTimePeriod > fUpTimeVector
Status GetChannelData(double &returnData, const std::string &componentProperty, const std::string &componentName, const IndexMap &componentIndex) const
std::map< std::string, std::string > IndexMap
Definition: VManager.h:133
std::map< int, int > fTelescopeStatus
det::ValidityStamp fDataValidity
std::map< int, std::vector< ChannelInfo > > fChannelInfo
std::map< int, double > fFDASVetoFraction
std::map< int, double > fTelescopeUpTimeFraction
IndexVector::const_iterator IndexVectorIterator
Object to keep track of whether data are valid, or have expired.
Definition: ValidityStamp.h:29
int GetTelIndex(const IndexMap &componentIndex) const
bool operator<(const UpTimePeriod &x) const
#define VMANAGER_GETDATA_NOTFOUND(_T_...)
Definition: VManager.h:41
Status
Specifies success or (eventually) various possible failure modes.
Definition: VManager.h:127
Status GetUpTimeFraction(double &returnData, const std::string &componentProperty, const std::string &componentName, const IndexMap &componentIndex) const
std::map< int, int > fEyeStatus
static const unsigned int kNPixelPerTel
unsigned int fGpsStart
unsigned int fGpsStop
virtual Status GetData(int &returnData, const std::string &componentProperty, const std::string &componentName, const IndexMap &componentIndex) const
Status GetOkFlag(int &returnData, const std::string &componentProperty, const std::string &componentName, const IndexMap &componentIndex) const

, generated on Tue Sep 26 2023.