32 #include "tables/St_tofDaqMap_Table.h"
33 #include "tables/St_tofTrayConfig_Table.h"
34 #include "StMessMgr.h"
36 #include "StBTofDaqMap.h"
43 StBTofDaqMap::~StBTofDaqMap()
53 LOG_INFO <<
"[StBTofDaqMap] retrieving BTOF DAQ map and tray config ..." << endm;
59 TDataSet *mDbTOFDataSet = maker->GetDataBase(
"Calibrations/tof/tofDaqMap");
60 St_tofDaqMap* tofDaqMap =
static_cast<St_tofDaqMap*
>(mDbTOFDataSet->
Find(
"tofDaqMap"));
62 LOG_ERROR <<
"unable to get tof Module map table" << endm;
65 tofDaqMap_st* daqmap =
static_cast<tofDaqMap_st*
>(tofDaqMap->GetArray());
66 for (Int_t i=0;i<mNTOF;i++) {
67 mMRPC2TDIGChan[i] = (Int_t)(daqmap[0].MRPC2TDIGChanMap[i]);
68 mTDIG2MRPCChan[mMRPC2TDIGChan[i]] = i;
70 LOG_DEBUG <<
" MRPC = " << i <<
" TDC chan = " << mMRPC2TDIGChan[i] << endm;
73 for (Int_t i=0;i<mNVPD;i++) {
74 mWestPMT2TDIGLeChan[i] = (Int_t)(daqmap[0].PMT2TDIGLeChanMap[i]);
75 mWestPMT2TDIGTeChan[i] = (Int_t)(daqmap[0].PMT2TDIGTeChanMap[i]);
77 LOG_DEBUG <<
" VPD = " << i <<
" TDC Lechan = " << mWestPMT2TDIGLeChan[i] <<
" TDC TeChan = " << mWestPMT2TDIGTeChan[i] << endm;
79 mTDIGLe2WestPMTChan[mWestPMT2TDIGLeChan[i]] = i;
80 mTDIGTe2WestPMTChan[mWestPMT2TDIGTeChan[i]] = i;
84 mEastPMT2TDIGLeChan[i] = (Int_t)(daqmap[0].PMT2TDIGLeChanMap[j]);
85 mEastPMT2TDIGTeChan[i] = (Int_t)(daqmap[0].PMT2TDIGTeChanMap[j]);
87 LOG_DEBUG <<
" VPD = " << i <<
" TDC Lechan = " << mEastPMT2TDIGLeChan[i] <<
" TDC TeChan = " << mEastPMT2TDIGTeChan[i] << endm;
89 mTDIGLe2EastPMTChan[mEastPMT2TDIGLeChan[i]] = i;
90 mTDIGTe2EastPMTChan[mEastPMT2TDIGTeChan[i]] = i;
94 mDbTOFDataSet = maker->GetDataBase(
"Calibrations/tof/tofTrayConfig");
95 St_tofTrayConfig* trayConfig =
static_cast<St_tofTrayConfig*
>(mDbTOFDataSet->
Find(
"tofTrayConfig"));
97 LOG_ERROR <<
"unable to get tof tray configuration" << endm;
100 tofTrayConfig_st* trayconf =
static_cast<tofTrayConfig_st*
>(trayConfig->GetArray());
101 if(maker->Debug()) { LOG_DEBUG <<
" Valid Trays: " << endm; }
102 mNValidTrays = (Int_t)(trayconf[0].entries);
103 for (Int_t i=0;i<mNValidTrays;i++) {
104 mValidTrayId[i] = (Int_t)(trayconf[0].iTray[i]);
106 LOG_DEBUG <<
" " << mValidTrayId[i];
109 if(maker->Debug()) { LOG_DEBUG << endm; }
111 LOG_DEBUG <<
"[StBTofDaqMap] ... done." << endm;
116 void StBTofDaqMap::Reset() {
117 for(
int i=0;i<mNTOF;i++) {
118 mMRPC2TDIGChan[i] = -1;
119 mTDIG2MRPCChan[i] = -1;
120 mTDIGLe2WestPMTChan[i] = -1;
121 mTDIGTe2WestPMTChan[i] = -1;
122 mTDIGLe2EastPMTChan[i] = -1;
123 mTDIGTe2EastPMTChan[i] = -1;
125 for(
int i=0;i<mNVPD;i++) {
126 mEastPMT2TDIGLeChan[i] = -1;
127 mEastPMT2TDIGTeChan[i] = -1;
128 mWestPMT2TDIGLeChan[i] = -1;
129 mWestPMT2TDIGTeChan[i] = -1;
141 if ( iTdc<0 || iTdc>=mNTOF ) {
142 LOG_ERROR <<
"[TDIGChan2Cell] Uncorrected TDC Channel number for Tof! " << endm;
146 Int_t ModuleChan = mTDIG2MRPCChan[iTdc];
147 Int_t Module = ModuleChan / mNCell + 1;
148 Int_t Cell = ModuleChan % mNCell + 1;
149 map.push_back(Module);
158 if(iModule<1 || iModule>mNModule ) {
159 LOG_ERROR<<
"[Cell2TDIGChan] Wrong module number !"<<endm;
162 if(iCell <1 || iCell > mNCell) {
163 LOG_ERROR<<
"[Cell2TDIGChan] Wrong cell number ! "<<endm;
167 Int_t modulechan = (iModule-1)*mNCell+(iCell-1);
170 if (modulechan<0 || modulechan>=mNTOF) {
171 LOG_ERROR<<
"[Cell2TDIGChan] Wrong Module-Cell channel number!"<<endm;
175 return mMRPC2TDIGChan[modulechan];
180 if ( iTube<1 || iTube>mNVPD ) {
181 LOG_ERROR<<
"[WestPMT2TDIGLeChan] Wrong vpd tube number ! "<<endm;
185 return mWestPMT2TDIGLeChan[iTube-1];
190 if ( iTube<1 || iTube>mNVPD ) {
191 LOG_ERROR<<
"[WestPMT2TDIGTeChan] Wrong vpd tube number ! "<< iTube<<endm;
195 return mWestPMT2TDIGTeChan[iTube-1];
200 if ( iTdc<0 || iTdc>=mNTOF ) {
201 LOG_ERROR<<
"[TDIGLeChan2WestPMT] Wrong tdc channel number ! "<< iTdc<<endm;
205 return mTDIGLe2WestPMTChan[iTdc] + 1;
210 if ( iTdc<0 || iTdc>=mNTOF ) {
211 LOG_ERROR<<
"[TDIGTeChan2WestPMT] Wrong tdc channel number ! "<< iTdc <<endm;
215 return mTDIGTe2WestPMTChan[iTdc] + 1;
220 if ( iTube<1 || iTube>mNVPD ) {
221 LOG_ERROR<<
"[EastPMT2TDIGLeChan] Wrong vpd tube number ! "<<iTube<< endm;
225 return mEastPMT2TDIGLeChan[iTube-1];
230 if ( iTube<1 || iTube>mNVPD ) {
231 LOG_ERROR<<
"[EastPMT2TDIGTeChan] Wrong vpd tube number ! "<<iTube<< endm;
235 return mEastPMT2TDIGTeChan[iTube-1];
240 if ( iTdc<0 || iTdc>=mNTOF ) {
241 LOG_ERROR<<
"StBTofDaqMap::TDIGLeChan2EastPMT: Wrong tdc channel number ! "<<iTdc<<endm;
245 return mTDIGLe2EastPMTChan[iTdc] + 1;
250 if ( iTdc<0 || iTdc>=mNTOF ) {
251 LOG_ERROR<<
"StBTofDaqMap::TDIGTeChan2EastPMT: Wrong tdc channel number ! "<<iTdc << endm;
255 return mTDIGTe2EastPMTChan[iTdc] + 1;
261 for(
int i=0;i<mNValidTrays;i++) {
262 trayId.push_back(mValidTrayId[i]);
void Init(StMaker *maker)
Initial function, need a maker to access the data base.
Int_t WestPMT2TDIGTeChan(const Int_t iTube)
To convert west VPD PMT number to TDIG trailing channel number.
Int_t WestPMT2TDIGLeChan(const Int_t iTube)
To convert west VPD PMT number to TDIG leading channel number.
Int_t TDIGLeChan2WestPMT(const Int_t iTdc)
To convert TDIG leading channel number to west VPD PMT number.
IntVec ValidTrays()
Returns the list of valid tray Ids.
Int_t TDIGLeChan2EastPMT(const Int_t iTdc)
To convert TDIG leading channel number to east VPD PMT number.
Int_t Cell2TDIGChan(const Int_t iModule, const Int_t iCell)
To convert module/cell number to TDIG channel number.
Int_t TDIGTeChan2EastPMT(const Int_t iTdc)
To convert TDIG trailing channel number to east VPD PMT number.
Int_t EastPMT2TDIGTeChan(const Int_t iTube)
To convert east VPD PMT number to TDIG trailing channel number.
Int_t TDIGTeChan2WestPMT(const Int_t iTdc)
To convert TDIG trailing channel number to west VPD PMT number.
IntVec TDIGChan2Cell(const Int_t iTdc)
To convert TDIG channel number to module/cell number.
StBTofDaqMap()
Default constructor.
Int_t EastPMT2TDIGLeChan(const Int_t iTube)
virtual TDataSet * Find(const char *path) const