1 #include <DatabaseUtils/RunHistory/RunHistory.h> 2 #include <DatabaseUtils/DAQConfig/PixelEnableMasks.h> 3 #include <DatabaseUtils/DCS/APDSettings.h> 4 #include <NovaDAQConventions/DAQConventions.h> 15 _runNumber(run), _nsubrun(0), _nTotTrig(0),
16 _nActiveChannels(0), _nTotalChannels(0),
17 _nTotalFEBs(0), _nMaskedOffFEBs(0),
18 _tStart(
"2010-01-01 00:00:00"), _tEnd(
""),
19 _dcmList(0), _bnevbList(0)
22 resTable.reset(
new db::Table(
"NovaDatabase/tables/RunHistory/DAQResourcesByRun.xml"));
28 sprintf(daqEnv,
"NOVADAQ_ENVIRONMENT=%s",det.c_str());
32 std::string errStr =
"RunHistory::RunHistory: invalid detector name!";
33 throw std::runtime_error(errStr);
37 hwposTable->SetDBInfo(
"nova_hardware",
"ifdbprod.fnal.gov",
38 "5432",
"nova_reader");
53 resTable.reset(
new db::Table(
"NovaDatabase/tables/RunHistory/DAQResourcesByRun.xml"));
59 sprintf(daqEnv,
"NOVADAQ_ENVIRONMENT=%s",
_detector.c_str());
63 std::string errStr =
"RunHistory::RunHistory: invalid detector id!";
64 throw std::runtime_error(errStr);
68 hwposTable->SetDBInfo(
"nova_hardware",
"ifdbprod.fnal.gov",
69 "5432",
"nova_reader");
127 if (row->
Col(
"tstop")->
Get(timeStr))
_tEnd = timeStr;
133 std::vector<std::string> tmpDCMList;
137 for (
int i=0;
i<nResources; ++
i) {
141 if (row->
Col(
"resource_type")->
Get(rtype)) {
142 if (rtype ==
"bnevb") {
144 row->
Col(
"appname")->
Get(appname);
148 else if (rtype ==
"dcm") {
150 row->
Col(
"appname")->
Get(appname);
153 tmpDCMList.push_back(appname);
160 for (uint32_t iDCM = 0; iDCM <
_dcmList.size(); ++iDCM) {
165 for (
int iFEB = 0; iFEB < 64; ++iFEB) {
167 if ( (
_dcmList[iDCM].appname ==
"dcm-3-01-03" ||
168 _dcmList[iDCM].appname ==
"dcm-3-02-03") &&
169 ((iFEB >= 16 && iFEB <= 31) || (iFEB >= 47)) )
171 if ( (
_dcmList[iDCM].appname ==
"dcm-3-01-01" ||
172 _dcmList[iDCM].appname ==
"dcm-3-02-01" ||
173 _dcmList[iDCM].appname ==
"dcm-3-01-02" ||
174 _dcmList[iDCM].appname ==
"dcm-3-02-02") &&
175 (iFEB == 47 || iFEB == 63))
177 if ((
_dcmList[iDCM].appname ==
"dcm-3-03-02") &&
178 ((iFEB >= 62)||(iFEB >= 46 && iFEB <= 47)))
180 if ((
_dcmList[iDCM].appname ==
"dcm-3-03-03") &&
181 ((iFEB >= 16 && iFEB <= 31)||(iFEB >= 46)))
183 if (
_dcmList[iDCM].appname ==
"dcm-3-04-01")
184 if ((iFEB >= 6 && iFEB <= 15) || iFEB >= 22)
186 if (
_dcmList[iDCM].appname ==
"dcm-3-04-02")
187 if ((iFEB >= 7 && iFEB <= 15) || (iFEB >= 23 && iFEB <= 31) ||
200 int32_t pixelMask = 0;
205 getEnabledPixelCountForFEB(
_dcmList[iDCM].appname, iFEB);
234 int module_position; row->
Col(
"module_position")->
Get(module_position);
256 tEnd =
"2000-01-01 00:00:00";
266 cout <<
"****************************************" <<
endl;
268 cout <<
"****************************************\n" <<
endl;
287 std::vector<std::string> dcmNameList;
289 dcmNameList.push_back(
_dcmList[
i].appname);
296 return _pixMaskPtr->getFEBEnableMask(dcmName, febMask);
302 const int& febId, int32_t& pixelMask) {
304 std::vector<std::string> dcmNameList;
306 dcmNameList.push_back(
_dcmList[
i].appname);
312 return _pixMaskPtr->getPixelEnableMask(dcmName, febId, pixelMask);
319 std::vector<int16_t>& thresholdList) {
321 std::vector<std::string> dcmNameList;
323 dcmNameList.push_back(
_dcmList[
i].appname);
329 return _pixThreshPtr->getThresholdsForFEB(dcmName, febId, thresholdList);
static std::string GetName(int id)
std::string TStartAsString() const
std::string TStopAsString() const
Column & Col(int i)
Find index of column with name. Suitable for passing to Col.
std::unique_ptr< db::Table > hwposTable
bool getFEBEnableMask(const std::string &dcmName, int64_t &febMask)
std::unique_ptr< daqcfg::PixelThresholds > _pixThreshPtr
static bool TimeAsStringToTime_t(std::string ts, time_t &t)
bool getTemperatureEnable(const std::string &dcmName, const int &febId, bool &enableFlag)
std::unique_ptr< db::Table > resTable
bool getPixelEnableMask(const std::string &dcmName, const int &febId, int32_t &pixelMask)
block
print "ROW IS " print row
virtual bool hasValidData() const
std::vector< BNEVB > _bnevbList
static bool DetIdOk(int id)
std::unique_ptr< db::Table > runsTable
void SetDBInfo(std::string dbname="", std::string dbhost="", std::string user="", std::string port="")
bool febIsEnabled(const std::string &dcmName, const int &febId)
bool getTemperature(const std::string &dcmName, const int &febId, int &temperature)
std::vector< DCM > _dcmList
RunHistory(int run, std::string det)
std::unique_ptr< daqcfg::PixelEnableMasks > _pixMaskPtr
bool PixelEnableMask(const std::string &dcmName, const int &febId, int32_t &pixelMask)
bool PixelThresholdsForFEB(const std::string &dcmName, const int &febId, std::vector< int16_t > &thresholdList)
static bool DetNameOk(std::string name)
bool FEBEnableMask(const std::string &dcmName, int64_t &febMask)