Public Member Functions | Protected Attributes | List of all members
dbutils::daqconfig::PixelEnableMasks Class Reference

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N20-12-02/DatabaseUtils/cxx/include/DAQConfig/PixelEnableMasks.h"

Public Member Functions

 PixelEnableMasks (const SubsystemNameSpec &nameSpec, std::vector< std::string > dcmList)
 
 PixelEnableMasks (const int64_t &globalConfigId, std::vector< std::string > dcmList)
 
virtual ~PixelEnableMasks ()
 
bool hasValidData () const
 
int getEnabledPixelCountForDCM (const std::string &dcmName)
 
bool getFEBEnableMask (const std::string &dcmName, int64_t &febMask)
 
bool febIsEnabled (const std::string &dcmName, const int &febId)
 
int getEnabledPixelCountForFEB (const std::string &dcmName, const int &febId)
 
bool getPixelEnableMask (const std::string &dcmName, const int &febId, int32_t &pixelMask)
 
bool pixelIsEnabled (const std::string &dcmName, const int &febId, const int &pixelId)
 

Protected Attributes

bool _hasValidData
 
boost::shared_ptr< ConfigDataTree_febEnableMaskDataSet
 
boost::shared_ptr< ConfigDataTree_pixelEnableDataSet
 

Detailed Description

Worker class to handle fetching and formatting of pixel enable mask data (including the FEB enable masks).

Author
Kurt Biery
Version
Revision
1.5.28.1
Date
2019/09/27 00:07:03

Definition at line 22 of file PixelEnableMasks.h.

Constructor & Destructor Documentation

dbutils::daqconfig::PixelEnableMasks::PixelEnableMasks ( const SubsystemNameSpec nameSpec,
std::vector< std::string dcmList 
)

Definition at line 10 of file PixelEnableMasks.cpp.

References _febEnableMaskDataSet, _hasValidData, _pixelEnableDataSet, dbutils::daqconfig::ConfigDataSelector::addSelectionColumn(), dbutils::daqconfig::DBColumnParams::DCMID_COLUMN_NAME, dbutils::daqconfig::DBColumnParams::FEBID_COLUMN_NAME, plot_validation_datamc::fname, dbutils::daqconfig::NamedConfigUtils::getSubsystemConfigIdAncestry(), fabricate::status, and string.

12 {
13  std::vector<int64_t> subsystemConfigIdList;
15  getSubsystemConfigIdAncestry(nameSpec, subsystemConfigIdList);
16  if (! status) {return;}
17  std::sort(dcmList.begin(), dcmList.end());
18 
19  {
20  ConfigDataSelector cfgSelector;
21  cfgSelector.addSelectionColumn(DBColumnParams::DCMID_COLUMN_NAME,
22  dcmList[0], dcmList[dcmList.size()-1]);
23  //std::cout << dcmList[0] << std::endl;
24 
25  std::vector<std::string> dataColumnsOfInterest;
26  dataColumnsOfInterest.push_back("mask");
27 
28  std::string fname("NovaDatabase/tables/DAQConfig/FEBEnableMasks.xml");
30  reset(new ConfigDataTree(fname, subsystemConfigIdList, cfgSelector,
31  dataColumnsOfInterest));
32  }
33 
34  {
35  ConfigDataSelector cfgSelector;
36  cfgSelector.addSelectionColumn(DBColumnParams::DCMID_COLUMN_NAME,
37  dcmList[0], dcmList[dcmList.size()-1]);
38  cfgSelector.addSelectionColumn(DBColumnParams::FEBID_COLUMN_NAME);
39 
40  std::vector<std::string> dataColumnsOfInterest;
41  dataColumnsOfInterest.push_back("mask");
42 
43  std::string fname("NovaDatabase/tables/DAQConfig/PixelEnableMasks.xml");
45  reset(new ConfigDataTree(fname, subsystemConfigIdList, cfgSelector,
46  dataColumnsOfInterest));
47  }
48 
49  _hasValidData = _febEnableMaskDataSet.get() != 0 &&
50  _febEnableMaskDataSet->hasValidData() &&
51  _pixelEnableDataSet.get() != 0 &&
52  _pixelEnableDataSet->hasValidData();
53 }
int status
Definition: fabricate.py:1613
boost::shared_ptr< ConfigDataTree > _pixelEnableDataSet
static bool getSubsystemConfigIdAncestry(const SubsystemNameSpec &subsystemNameSpec, std::vector< int64_t > &idList, const std::string &subsystemNamesTableFile=DEFAULT_SUBSYSTEM_NAMES_TABLE_FILE)
boost::shared_ptr< ConfigDataTree > _febEnableMaskDataSet
static const std::string DCMID_COLUMN_NAME
static const std::string FEBID_COLUMN_NAME
enum BeamMode string
dbutils::daqconfig::PixelEnableMasks::PixelEnableMasks ( const int64_t &  globalConfigId,
std::vector< std::string dcmList 
)

Definition at line 56 of file PixelEnableMasks.cpp.

References _febEnableMaskDataSet, _hasValidData, _pixelEnableDataSet, dbutils::daqconfig::ConfigDataSelector::addSelectionColumn(), dbutils::daqconfig::IDSpec::DAQ, dbutils::daqconfig::DBColumnParams::DCMID_COLUMN_NAME, dbutils::daqconfig::DBColumnParams::FEBID_COLUMN_NAME, plot_validation_datamc::fname, getEnabledPixelCountForDCM(), dbutils::daqconfig::NamedConfigUtils::getSubsystemConfigIdAncestryFromGlobalId(), dbutils::daqconfig::IDSpec::GLOBAL, fabricate::status, and string.

58 {
59  IDSpec idSpec(globalConfigId, IDSpec::GLOBAL, IDSpec::DAQ);
60  std::vector<int64_t> subsystemConfigIdList;
63  SubsystemNameSpec::
64  DCM_SUBSYSTEM_NAME,
65  SubsystemNameSpec::
66  HARDWARE_CONFIG_TYPE,
67  subsystemConfigIdList);
68  if (! status) {return;}
69  std::sort(dcmList.begin(), dcmList.end());
70 
71  {
72  ConfigDataSelector cfgSelector;
73  cfgSelector.addSelectionColumn(DBColumnParams::DCMID_COLUMN_NAME,
74  dcmList[0], dcmList[dcmList.size()-1]);
75  //std::cout << dcmList[0] << std::endl;
76 
77  std::vector<std::string> dataColumnsOfInterest;
78  dataColumnsOfInterest.push_back("mask");
79 
80  std::string fname("NovaDatabase/tables/DAQConfig/FEBEnableMasks.xml");
82  reset(new ConfigDataTree(fname, subsystemConfigIdList, cfgSelector,
83  dataColumnsOfInterest));
84  }
85 
86  {
87  ConfigDataSelector cfgSelector;
88  cfgSelector.addSelectionColumn(DBColumnParams::DCMID_COLUMN_NAME,
89  dcmList[0], dcmList[dcmList.size()-1]);
90  cfgSelector.addSelectionColumn(DBColumnParams::FEBID_COLUMN_NAME);
91 
92  std::vector<std::string> dataColumnsOfInterest;
93  dataColumnsOfInterest.push_back("mask");
94 
95  std::string fname("NovaDatabase/tables/DAQConfig/PixelEnableMasks.xml");
97  reset(new ConfigDataTree(fname, subsystemConfigIdList, cfgSelector,
98  dataColumnsOfInterest));
99  }
100 
101  _hasValidData = _febEnableMaskDataSet.get() != 0 &&
102  _febEnableMaskDataSet->hasValidData() &&
103  _pixelEnableDataSet.get() != 0 &&
104  _pixelEnableDataSet->hasValidData();
105 }
int status
Definition: fabricate.py:1613
boost::shared_ptr< ConfigDataTree > _pixelEnableDataSet
boost::shared_ptr< ConfigDataTree > _febEnableMaskDataSet
static const std::string DCMID_COLUMN_NAME
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)
enum BeamMode string
virtual dbutils::daqconfig::PixelEnableMasks::~PixelEnableMasks ( )
inlinevirtual

Definition at line 36 of file PixelEnableMasks.h.

36 {};

Member Function Documentation

bool dbutils::daqconfig::PixelEnableMasks::febIsEnabled ( const std::string dcmName,
const int febId 
)

Definition at line 126 of file PixelEnableMasks.cpp.

References _febEnableMaskDataSet, and getEnabledPixelCountForFEB().

Referenced by getEnabledPixelCountForFEB(), getFEBEnableMask(), hasValidData(), dbutils::RunHistory::Load(), and nova::dbi::RunHistory::LoadPixelInfo().

127 {
128  if (_febEnableMaskDataSet.get() == 0) {return false;}
129  int64_t febMask;
130  if (! _febEnableMaskDataSet->getEffectiveValueFor1Key(dcmName, "mask",
131  febMask)) {
132  return false;
133  }
134 
135  int64_t _64BitOne = 1;
136  return ((febMask & (_64BitOne << febId)) != 0);
137 }
boost::shared_ptr< ConfigDataTree > _febEnableMaskDataSet
int dbutils::daqconfig::PixelEnableMasks::getEnabledPixelCountForDCM ( const std::string dcmName)

Definition at line 108 of file PixelEnableMasks.cpp.

References confusionMatrixTree::count, getEnabledPixelCountForFEB(), and getFEBEnableMask().

Referenced by hasValidData(), and PixelEnableMasks().

109 {
110  int count = 0;
111  for (int ifeb = 0; ifeb < 64; ++ifeb) {
112  count += getEnabledPixelCountForFEB(dcmName, ifeb);
113  }
114  return count;
115 }
int getEnabledPixelCountForFEB(const std::string &dcmName, const int &febId)
int dbutils::daqconfig::PixelEnableMasks::getEnabledPixelCountForFEB ( const std::string dcmName,
const int febId 
)

Definition at line 140 of file PixelEnableMasks.cpp.

References _pixelEnableDataSet, confusionMatrixTree::count, febIsEnabled(), and getPixelEnableMask().

Referenced by febIsEnabled(), getEnabledPixelCountForDCM(), and hasValidData().

142 {
143  if (! this->febIsEnabled(dcmName, febId)) {return 0;}
144 
145  if (_pixelEnableDataSet.get() == 0) {return 0;}
146  int32_t pixelMask;
147  if (! _pixelEnableDataSet->getEffectiveValueFor2Keys(dcmName, febId,
148  "mask", pixelMask)) {
149  return 0;
150  }
151 
152  int count = 0;
153  for (int ipix = 0; ipix < 32; ++ipix) {
154  if ((pixelMask & (1 << ipix)) != 0) {
155  ++count;
156  }
157  }
158  return count;
159 }
boost::shared_ptr< ConfigDataTree > _pixelEnableDataSet
bool febIsEnabled(const std::string &dcmName, const int &febId)
bool dbutils::daqconfig::PixelEnableMasks::getFEBEnableMask ( const std::string dcmName,
int64_t &  febMask 
)

Definition at line 118 of file PixelEnableMasks.cpp.

References _febEnableMaskDataSet, and febIsEnabled().

Referenced by getEnabledPixelCountForDCM(), hasValidData(), dbutils::RunHistory::Load(), nova::dbi::RunHistory::LoadFEBMasksFromDAQDB(), and nova::dbi::RunHistory::LoadPixelInfo().

119 {
120  if (_febEnableMaskDataSet.get() == 0) {return false;}
121  return _febEnableMaskDataSet->getEffectiveValueFor1Key(dcmName, "mask",
122  febMask);
123 }
boost::shared_ptr< ConfigDataTree > _febEnableMaskDataSet
bool dbutils::daqconfig::PixelEnableMasks::getPixelEnableMask ( const std::string dcmName,
const int febId,
int32_t &  pixelMask 
)

Definition at line 162 of file PixelEnableMasks.cpp.

References _pixelEnableDataSet, and pixelIsEnabled().

Referenced by getEnabledPixelCountForFEB(), hasValidData(), dbutils::RunHistory::Load(), and nova::dbi::RunHistory::LoadPixelInfo().

164 {
165  if (_pixelEnableDataSet.get() == 0) {return false;}
166  return _pixelEnableDataSet->getEffectiveValueFor2Keys(dcmName, febId,
167  "mask", pixelMask);
168 }
boost::shared_ptr< ConfigDataTree > _pixelEnableDataSet
bool dbutils::daqconfig::PixelEnableMasks::hasValidData ( ) const
inline
bool dbutils::daqconfig::PixelEnableMasks::pixelIsEnabled ( const std::string dcmName,
const int febId,
const int pixelId 
)

Definition at line 171 of file PixelEnableMasks.cpp.

References _pixelEnableDataSet.

Referenced by getPixelEnableMask(), and hasValidData().

172 {
173  if (_pixelEnableDataSet.get() == 0) {return false;}
174  int32_t pixelMask;
175  if (! _pixelEnableDataSet->getEffectiveValueFor2Keys(dcmName, febId,
176  "mask", pixelMask)) {
177  return false;
178  }
179 
180  return ((pixelMask & (1 << pixelId)) != 0);
181 }
boost::shared_ptr< ConfigDataTree > _pixelEnableDataSet

Member Data Documentation

boost::shared_ptr<ConfigDataTree> dbutils::daqconfig::PixelEnableMasks::_febEnableMaskDataSet
protected

Definition at line 59 of file PixelEnableMasks.h.

Referenced by febIsEnabled(), getFEBEnableMask(), and PixelEnableMasks().

bool dbutils::daqconfig::PixelEnableMasks::_hasValidData
protected

Definition at line 58 of file PixelEnableMasks.h.

Referenced by hasValidData(), and PixelEnableMasks().

boost::shared_ptr<ConfigDataTree> dbutils::daqconfig::PixelEnableMasks::_pixelEnableDataSet
protected

The documentation for this class was generated from the following files: