DDASToys for NSCLDAQ  6.2-000
Configuration.h
Go to the documentation of this file.
1 /*
2  This software is Copyright by the Board of Trustees of Michigan
3  State University (c) Copyright 2017.
4 
5  You may use this software under the terms of the GNU public license
6  (GPL). The terms of this license are described at:
7 
8  http://www.gnu.org/licenses/gpl.txt
9 
10  Authors:
11  Aaron Chester
12  FRIB
13  Michigan State University
14  East Lansing, MI 48824-1321
15 */
16 
22 #ifndef CONFIGURATION_H
23 #define CONFIGURATION_H
24 
25 #include <string>
26 #include <map>
27 #include <vector>
28 #include <utility>
29 
31 namespace ddastoys {
32 
68  {
69  public:
74 
75  // Public interface for this class
76  public:
82  void readConfigFile();
93  void readTemplateFile();
102  bool fitChannel(unsigned crate, unsigned slot, unsigned channel);
103 
104  // Helpers
105  public:
114  std::pair<unsigned, unsigned> getFitLimits(
115  unsigned crate, unsigned slot, unsigned channel
116  );
125  unsigned getSaturationValue(
126  unsigned crate, unsigned slot, unsigned channel
127  );
136  std::string getModelPath(
137  unsigned crate, unsigned slot, unsigned channel
138  );
144  std::vector<std::string> getModelList();
149  std::vector<double> getTemplate() { return m_template; };
154  unsigned getTemplateAlignPoint() { return m_alignPoint; };
155 
156  // Private methods
157  private:
165  std::string getFileNameFromEnv(const char* envname);
172  std::string isComment(std::string line);
180  unsigned channelIndex(unsigned crate, unsigned slot, unsigned channel);
181 
182  // Private data
183  private:
188  struct ConfigInfo {
189  std::pair<unsigned, unsigned> s_limits;
190  unsigned s_saturation;
191  std::string s_modelPath;
197  };
198  std::map<unsigned, ConfigInfo> m_fitChannels;
199  std::vector<double> m_template;
200  unsigned m_alignPoint;
201  };
202 
205 }
206 
207 #endif
Manage fit configuration information.
Definition: Configuration.h:68
std::vector< double > getTemplate()
Return the template data.
Definition: Configuration.h:149
Configuration()
Constructor.
Definition: Configuration.h:71
std::vector< std::string > getModelList()
Get the list of unique model names specified in the configuration file.
Definition: Configuration.cpp:247
~Configuration()
Destructor.
Definition: Configuration.h:73
bool fitChannel(unsigned crate, unsigned slot, unsigned channel)
Check the map and determine if the channel should be fit.
Definition: Configuration.cpp:202
void readConfigFile()
Read the configuration file.
Definition: Configuration.cpp:77
void readTemplateFile()
Read the formatted tempalate data from a file.
Definition: Configuration.cpp:129
std::string getModelPath(unsigned crate, unsigned slot, unsigned channel)
Get the ML inference model path for a single crate/slot/channel combination.
Definition: Configuration.cpp:230
unsigned getTemplateAlignPoint()
Return the template alignment point.
Definition: Configuration.h:154
std::pair< unsigned, unsigned > getFitLimits(unsigned crate, unsigned slot, unsigned channel)
Get the (inclusive) fit limits for a single crate/slot/channel combination.
Definition: Configuration.cpp:210
unsigned getSaturationValue(unsigned crate, unsigned slot, unsigned channel)
Get the ADC saturation value for a single crate/slot/channel combination.
Definition: Configuration.cpp:220