7 #include "BtofHitList.h"
10 #include "StBTofUtil/StBTofTables.h"
11 #include "StBTofCollection.h"
17 BtofHitList::BtofHitList() :
20 ScintHitList(0.,M_PI/60,60, -0.9,0.028125,64,
"Btof",4,0.75) {
28 BtofHitList::initRun() {
29 LOG_DEBUG <<Form(
"BtofHitList::initRun() start")<<endm;
30 ScintHitList::initRun();
34 for(j=0;j<mxModule;j++)
39 StMaker*mk=(
StMaker*)StMaker::GetChain()->GetMaker(
"GenericVertex");
45 for(
int i=0;i<mxTray;i++) {
46 for(
int j=0;j<mxModule;j++) {
47 for(
int k=0;k<mxCell;k++) {
48 int iBin = cell2bin(i+1,j+1,k+1);
49 tmc2bin[i][j][k]=iBin;
52 status = myTable->
status(i+1,j+1,k+1);
54 if( status!= 1)
continue;
62 LOG_INFO <<
" BtofHitList::initRun() done, active="<<nA<<
" of "<<nB<<
" BTOF channels" <<endm;
70 ScintHitList::clear();
76 BtofHitList::~BtofHitList(){
77 if(myTable)
delete myTable;
85 if(!btofColl || !btofColl->hitsPresent()) {
86 LOG_INFO <<
" No available BTOF hits for this event ... " << endm;
90 StSPtrVecBTofHit& tofHits = btofColl->tofHits();
92 for(
size_t i=0;i<tofHits.size();i++) {
96 int m = aHit->module();
98 if(t<=0||t>mxTray||m<=0||m>mxModule||c<=0||c>mxCell)
continue;
100 int iBin=tmc2bin[t-1][m-1][c-1];
102 if ( getActive(iBin)<0)
continue;
139 BtofHitList::cell2bin(
int tray,
int module,
int cell) {
140 int iPhi = (tray-1)%60;
141 int iEta = (tray-1)/60*mxModule + (module-1);
144 return iPhiEta2bin(iPhi,iEta);
149 BtofHitList::addBtofTrack(
int tray,
int module,
int cell) {
150 int iBin = cell2bin(tray, module, cell);
159 BtofHitList::addBtofMatch(IntVec ibinVec) {
160 if(isMatched(ibinVec)) nMatch++;
166 BtofHitList::isMatched(IntVec ibinVec) {
168 for(
size_t i=0;i<ibinVec.size();i++) {
169 int iBin = ibinVec[i];
170 if(getActive(iBin)>0) {
171 if(getTrack(iBin)>0&&getFired(iBin)>0) match = kTRUE;
179 BtofHitList::isVetoed(IntVec ibinVec) {
182 for(
size_t i=0;i<ibinVec.size();i++) {
183 int iBin = ibinVec[i];
184 if(getActive(iBin)>0) {
186 if(getTrack(iBin)>0&&getFired(iBin)==0) veto &= kTRUE;
190 if(nA==0)
return kFALSE;
196 BtofHitList::getWeight(IntVec ibinVec) {
197 const float Wdunno=1;
199 for(
size_t i=0;i<ibinVec.size();i++) {
200 int iBin = ibinVec[i];
201 if(getActive(iBin)>0) nA++;
203 if(nA==0)
return Wdunno;
204 if(isMatched(ibinVec))
return Wmatch;
205 if(isVetoed(ibinVec))
return Wveto;
211 BtofHitList::etaBin(
float eta){
212 if(fabs(eta)>0.9)
return -1;
213 int iEta=(int)((eta-eta0)/dEta);
214 if(iEta<0 || iEta>=nEta)
return -1;
221 BtofHitList::bin2EtaLeft(
int iEta){
224 float etaF= eta0+iEta*dEta ;
225 if(etaF<-0.9) etaF=0.9;
int status(int trayId, int moduleId, int cellId) const
function to return the channel status
void loadTables(StMaker *anyMaker)
load status tables from data base