PixelThresholds.cpp
Go to the documentation of this file.
1 #include <DatabaseUtils/DAQConfig/PixelThresholds.h>
2 #include <DatabaseUtils/DAQConfig/DBColumnParams.h>
3 #include <DatabaseUtils/DAQConfig/NamedConfigUtils.h>
4 #include <DatabaseUtils/DAQConfig/SubsystemNameSpec.h>
5 #include <algorithm>
6 
7 namespace dbutils {
8 namespace daqconfig {
9 
11 PixelThresholds(const int64_t& globalConfigId,
12  std::vector<std::string> dcmList)
13 {
14  IDSpec idSpec(globalConfigId, IDSpec::GLOBAL, IDSpec::DAQ);
15  std::vector<int64_t> subsystemConfigIdList;
19  DCM_SUBSYSTEM_NAME,
21  HARDWARE_CONFIG_TYPE,
22  subsystemConfigIdList);
23  if (! status) {return;}
24  std::sort(dcmList.begin(), dcmList.end());
25 
26  {
27  ConfigDataSelector cfgSelector;
29  dcmList[0], dcmList[dcmList.size()-1]);
32 
33  std::vector<std::string> dataColumnsOfInterest;
34  dataColumnsOfInterest.push_back("threshold");
35 
36  std::string fname("NovaDatabase/tables/DAQConfig/PixelThresholds.xml");
38  reset(new ConfigDataTree(fname, subsystemConfigIdList, cfgSelector,
39  dataColumnsOfInterest));
40  }
41 
43  _pixelThresholdDataSet->hasValidData();
44 }
45 
47 getThreshold(const std::string& dcmName, const int& febId,
48  const int& pixelId, int16_t& threshold)
49 {
50  if (_pixelThresholdDataSet.get() == 0) {return false;}
51  return _pixelThresholdDataSet->
52  getEffectiveValueFor3Keys(dcmName, febId, pixelId,
53  "threshold", threshold);
54 }
55 
57 getThresholdsForFEB(const std::string& dcmName, const int& febId,
58  std::vector<int16_t>& thresholdList)
59 {
60  if (_pixelThresholdDataSet.get() == 0) {return false;}
61 
62  thresholdList.clear();
63  for (int ipix = 0; ipix < 32; ++ipix) {
64  int16_t threshold = 0;
66  getEffectiveValueFor3Keys(dcmName, febId, ipix,
67  "threshold", threshold)) {
68  return false;
69  }
70  thresholdList.push_back(threshold);
71  }
72 
73  return true;
74 }
75 
76 } // end of namespace daqconfig
77 } // end of namespace dbutils
void addSelectionColumn(std::string columnName)
int status
Definition: fabricate.py:1613
bool getThresholdsForFEB(const std::string &dcmName, const int &febId, std::vector< int16_t > &thresholdList)
PixelThresholds(const int64_t &globalConfigId, std::vector< std::string > dcmList)
static const std::string PIXELID_COLUMN_NAME
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
static const std::string DCMID_COLUMN_NAME
bool getThreshold(const std::string &dcmName, const int &febId, const int &pixelId, int16_t &threshold)
static const std::string FEBID_COLUMN_NAME
static bool getSubsystemConfigIdAncestryFromGlobalId(const IDSpec &globalConfigId, const std::string &subsystemName, const std::string &subsystemConfigType, std::vector< int64_t > &idList, const std::string &globalNamesTableFile=DEFAULT_GLOBAL_NAMES_TABLE_FILE, const std::string &subsystemNamesTableFile=DEFAULT_SUBSYSTEM_NAMES_TABLE_FILE)
boost::shared_ptr< ConfigDataTree > _pixelThresholdDataSet