5 #include <St_base/StMessMgr.h>
7 #include <tables/St_g2t_ctf_hit_Table.h>
8 #include <StEvent/StTriggerData.h>
11 #include "StGenericVertexMaker/StiPPVertex/CtbHitList.h"
14 extern void cts_get_ctb_indexes(
long,
long &,
long &);
23 CtbHitList::CtbHitList() :
24 ScintHitList(-M_PI/60.,M_PI/30,60, -1.,0.5,4,(char *)
"Ctb",2.,0.5){
28 geantE=
new float [nBin];
35 CtbHitList::initRun(
float fac){
36 const float mCtbEtaSeg=0.5, mCtbPhiSeg=M_PI/30;
37 gMessMgr->Message(
"",
"I") <<
" CtbHitList::initRun(), gain change factor="<<fac<<endm;
39 mCtbThres_ch=(int) (fac*mCtbThres_ch);
41 gMessMgr->Message(
"",
"I")
42 <<
" CtbHitList::initRun() CtbThres_Ch (real)="<<mCtbThres_ch
43 <<
" or CtbThres_MeV (M-C)="<<mCtbThres_mev
46 ScintHitList::initRun();
50 if(i==40 || i==50 ||i==100 || i==110)
continue;
57 for(iPhi1=1;iPhi1<mxPhi1;iPhi1++)
58 for(iEta1=1;iEta1<mxEta1;iEta1++)
59 mcId2bin[iPhi1][iEta1]=-1;
61 for(iPhi1=1;iPhi1<mxPhi1;iPhi1++)
62 for(iEta1=1;iEta1<mxEta1;iEta1++) {
65 int iBin0=iPhiEta2bin(iPhi0,iEta0);
66 float phi=iPhi0*mCtbPhiSeg;
67 float eta=iEta0*mCtbEtaSeg -0.75;
73 int iBin=iPhiEta2bin(iPhi,iEta);
76 mcId2bin[iPhi1][iEta1]=iBin;
81 for (slat = 0; slat < mxSlat; slat++)
82 for ( tray = 0; tray < mxTray; tray++) {
84 ctb_get_slat_from_data(slat,tray,phi,eta);
90 int iBin=iPhiEta2bin(iPhi,iEta);
91 realId2bin[slat][tray]=iBin;
100 ScintHitList::clear();
101 memset(geantE,0,nBin*
sizeof(
float));
106 CtbHitList::~CtbHitList(){
114 CtbHitList::etaBin(
float eta){
115 if(eta<eta0)
return -1;
116 int iEta=(int)((eta-eta0)/dEta);
117 if( iEta>=nEta)
return -1;
125 CtbHitList::bin2EtaLeft(
int iEta){
128 float etaF= eta0+iEta*dEta ;
135 CtbHitList::buildFromMC(
TDataSet *gds) {
138 gMessMgr->Message(
"",
"I") <<
" CtbHitList::buildFromMC thr/MeV="<<mCtbThres_mev<<endm;
144 St_g2t_ctf_hit *g2t_ctb_hit = (St_g2t_ctf_hit *) gds->
Find(
"g2t_ctb_hit");
145 if(g2t_ctb_hit == 0){
146 LOG_DEBUG <<
"CtbHitList::buildMC() No CTB Hits in MC table for this event" << endm;
147 LOG_DEBUG <<
"g2t_ctb_hit = " << g2t_ctb_hit << endm;
151 g2t_ctf_hit_st *ctb_hit = NULL;
155 if (g2t_ctb_hit->GetNRows() == 0) gMessMgr->Message(
"",
"I") <<
" CtbHitList::buildMC() Empty geant/ctb data set "<<endm;
157 ctb_hit = g2t_ctb_hit->GetTable();
161 LOG_WARN <<
"CtbHitList::buildMC() no CTB hits" << endm;
166 for (i = 0; i < g2t_ctb_hit->GetNRows(); i++,ctb_hit++){
167 float de_mev=ctb_hit->de*1000.;
170 cts_get_ctb_indexes(ctb_hit->volume_id,iPhi1,iEta1);
175 int iBin=mcId2bin[iPhi1][iEta1];
176 geantE[iBin]+=de_mev;
180 if ( getActive(i)<0)
continue;
181 if( geantE[i]<mCtbThres_mev)
continue;
193 LOG_INFO <<
" CtbHitList::buildFromData CtbThres_Ch thres="<<mCtbThres_ch << endm;
198 LOG_WARN <<
"CtbHitList::buildFromData: no trigData in real data" << endm;
202 for ( slat = 0; slat < mxSlat; slat++)
203 for ( tray = 0; tray < mxTray; tray++) {
204 float adc = trgD->ctbTraySlat(tray,slat,0);
205 if(adc<mCtbThres_ch)
continue;
206 int iBin=realId2bin[slat][tray];
208 if ( getActive(iBin)<0)
continue;
216 LOG_WARN <<
"StCtbUtility scans: no trigCol in Data" << endm;
221 for (UInt_t slat = 0; slat < ctbDet->numberOfSlats(); slat++)
222 for (UInt_t tray = 0; tray < ctbDet->numberOfTrays(); tray++) {
224 curHit.adc = ctbDet->mips(tray,slat,0);
225 if(curHit.adc<mCtbThres_ch)
continue;
237 CtbHitList::ctb_get_slat_from_data(
int slat,
int tray,
float & phiRad,
float &eta) {
238 float phiZero1 = 72 ;
239 float phiZero2 = 108 ;
248 phi = phiZero1 - tray * deltaPhi ;
251 phi = phiZero2 + (tray-60) * deltaPhi ;
254 if ( phi < 0. ) phi += 360 ;
255 if ( phi > 360. ) phi -= 360 ;
258 eta=(1-2*iz)*(1+2*slat)*0.25;
virtual TDataSet * Find(const char *path) const