30 #include "StBTofTables.h"
40 StBTofTables::~StBTofTables() {
45 void StBTofTables::Reset() {
47 memset(mBTofStatus, 0,
sizeof(mBTofStatus));
53 LOG_INFO <<
"StBTofTables -- loading the BTOF tray/channel status tables ..." << endm;
55 TDataSet *mDbTOFDataSet = maker->GetDataBase(
"Calibrations/tof/tofTrayConfig");
57 LOG_ERROR <<
"unable to access Calibrations TOF parameters for config" << endm;
62 St_tofTrayConfig* trayConfig =
static_cast<St_tofTrayConfig*
>(mDbTOFDataSet->
Find(
"tofTrayConfig"));
64 LOG_ERROR <<
"unable to get tof tray configuration" << endm;
67 tofTrayConfig_st* trayconf =
static_cast<tofTrayConfig_st*
>(trayConfig->GetArray());
68 if(maker->Debug()) { LOG_INFO <<
" Valid Trays: " << endm; }
70 Int_t nValidTrays = (Int_t)(trayconf[0].entries);
71 for (Int_t i=0;i<nValidTrays;i++) {
72 int trayId = (Int_t)(trayconf[0].iTray[i]);
75 LOG_INFO <<
" " << trayId;
78 if(maker->Debug()) { LOG_INFO << endm; }
80 mDbTOFDataSet = maker->GetDataBase(
"Calibrations/tof/tofStatus");
82 LOG_ERROR <<
"unable to access Calibrations TOF parameters for status" << endm;
86 St_tofStatus* tofStatus =
static_cast<St_tofStatus*
>(mDbTOFDataSet->
Find(
"tofStatus"));
88 LOG_ERROR <<
"unable to get tof status table" << endm;
92 tofStatus_st*
status =
static_cast<tofStatus_st*
>(tofStatus->GetArray());
93 for(
int i=0;i<mNChanMax;i++) {
94 int trayId = i/(mNModule*mNCell) + 1;
95 int moduleId = (i%(mNModule*mNCell))/mNCell + 1;
96 int cellId = i%mNCell + 1;
97 if(trayId<=0||trayId>mNTray||moduleId<=0||moduleId>mNModule||cellId<=0||cellId>mNCell)
continue;
98 mBTofStatus[trayId-1][moduleId-1][cellId-1] = (UShort_t)status[0].status[i];
111 return mBTofStatus[trayId-1][moduleId-1][cellId-1];
UShort_t mBTofTrayConfig[mNTray]
A large number for total channels.
int status(int trayId, int moduleId, int cellId) const
function to return the channel status
StBTofTables()
Default constructor.
bool trayValid(int trayId) const
function to return the tray status
void loadTables(StMaker *anyMaker)
load status tables from data base
virtual TDataSet * Find(const char *path) const