5 #include "TObjectSet.h"
7 #include <St_base/StMessMgr.h>
8 #include "St_db_Maker/St_db_Maker.h"
10 #include "StGenericVertexMaker/StiPPVertex/BtofHitList.h"
12 #include "StChain/StMaker.h"
13 #include "StBTofUtil/StBTofGeometry.h"
14 #include "StBTofUtil/StBTofTables.h"
15 #include "StEvent/StBTofCollection.h"
17 #include "TGeoManager.h"
22 BtofHitList::BtofHitList() : geometry(0),
25 ScintHitList(0.,M_PI/60,60, -0.9,0.028125,64,
"Btof",4,0.75)
35 LOG_DEBUG <<Form(
"BtofHitList::initRun() start")<<endm;
36 ScintHitList::initRun();
40 for(j=0;j<mxModule;j++)
51 LOG_INFO <<
" Found btofGeometry ... " << endm;
53 geometry =
new StBTofGeometry(
"btofGeometry",
"btofGeometry in VertexFinder");
54 geom =
new TObjectSet(
"btofGeometry",geometry);
55 LOG_INFO <<
" Create a new btofGeometry ... " << endm;
56 db_maker->AddConst(geom);
58 if(geometry && !geometry->IsInitDone()) {
59 LOG_INFO <<
" BTofGeometry initialization ... " << endm;
60 TVolume *starHall = gGeoManager ?
nullptr : (
TVolume *) (db_maker->GetDataSet(
"HALL"));
61 geometry->Init(db_maker, starHall, gGeoManager);
66 for(
int i=0;i<mxTray;i++) {
67 for(
int j=0;j<mxModule;j++) {
68 for(
int k=0;k<mxCell;k++) {
69 int iBin = cell2bin(i+1,j+1,k+1);
70 tmc2bin[i][j][k]=iBin;
73 status = myTable->
status(i+1,j+1,k+1);
75 if( status!= 1)
continue;
83 LOG_INFO <<
" BtofHitList::initRun() done, active="<<nA<<
" of "<<nB<<
" BTOF channels" <<endm;
91 ScintHitList::clear();
97 BtofHitList::~BtofHitList(){
98 if(myTable)
delete myTable;
106 if(!btofColl || !btofColl->hitsPresent()) {
107 LOG_INFO <<
" No available BTOF hits for this event ... " << endm;
111 StSPtrVecBTofHit& tofHits = btofColl->tofHits();
113 for(
size_t i=0;i<tofHits.size();i++) {
116 int t = aHit->tray();
117 int m = aHit->module();
118 int c = aHit->cell();
119 if(t<=0||t>mxTray||m<=0||m>mxModule||c<=0||c>mxCell)
continue;
121 int iBin=tmc2bin[t-1][m-1][c-1];
123 if ( getActive(iBin)<0)
continue;
160 BtofHitList::cell2bin(
int tray,
int module,
int cell) {
161 int iPhi = (tray-1)%60;
162 int iEta = (tray-1)/60*mxModule + (module-1);
165 return iPhiEta2bin(iPhi,iEta);
170 BtofHitList::addBtofTrack(
int tray,
int module,
int cell) {
171 int iBin = cell2bin(tray, module, cell);
180 BtofHitList::addBtofMatch(IntVec ibinVec) {
181 if(isMatched(ibinVec)) nMatch++;
187 BtofHitList::isMatched(IntVec ibinVec) {
189 for(
size_t i=0;i<ibinVec.size();i++) {
190 int iBin = ibinVec[i];
191 if(getActive(iBin)>0) {
192 if(getTrack(iBin)>0&&getFired(iBin)>0) match = kTRUE;
200 BtofHitList::isVetoed(IntVec ibinVec) {
203 for(
size_t i=0;i<ibinVec.size();i++) {
204 int iBin = ibinVec[i];
205 if(getActive(iBin)>0) {
207 if(getTrack(iBin)>0&&getFired(iBin)==0) veto &= kTRUE;
211 if(nA==0)
return kFALSE;
217 BtofHitList::getWeight(IntVec ibinVec) {
218 const float Wdunno=1;
220 for(
size_t i=0;i<ibinVec.size();i++) {
221 int iBin = ibinVec[i];
222 if(getActive(iBin)>0) nA++;
224 if(nA==0)
return Wdunno;
225 if(isMatched(ibinVec))
return Wmatch;
226 if(isVetoed(ibinVec))
return Wveto;
232 BtofHitList::etaBin(
float eta){
233 if(fabs(eta)>0.9)
return -1;
234 int iEta=(int)((eta-eta0)/dEta);
235 if(iEta<0 || iEta>=nEta)
return -1;
242 BtofHitList::bin2EtaLeft(
int iEta){
245 float etaF= eta0+iEta*dEta ;
246 if(etaF<-0.9) etaF=0.9;
int status(int trayId, int moduleId, int cellId) const
function to return the channel status
virtual TObject * GetObject() const
The depricated method (left here for the sake of the backward compatibility)
void loadTables(StMaker *anyMaker)
load status tables from data base