7 #include <tables/St_g2t_ctf_hit_Table.h>
8 #include <StTriggerData.h>
11 #include "CtbHitList.h"
14 extern void cts_get_ctb_indexes(
long,
long &,
long &);
24 CtbHitList::CtbHitList() :
25 ScintHitList(-M_PI/60.,M_PI/30,60, -1.,0.5,4,(char *)
"Ctb",2.,0.5){
29 geantE=
new float [nBin];
36 CtbHitList::initRun(
float fac){
37 const float mCtbEtaSeg=0.5, mCtbPhiSeg=M_PI/30;
38 gMessMgr->Message(
"",
"I") <<
" CtbHitList::initRun(), gain change factor="<<fac<<endm;
40 mCtbThres_ch=(int) (fac*mCtbThres_ch);
42 gMessMgr->Message(
"",
"I")
43 <<
" CtbHitList::initRun() CtbThres_Ch (real)="<<mCtbThres_ch
44 <<
" or CtbThres_MeV (M-C)="<<mCtbThres_mev
47 ScintHitList::initRun();
51 if(i==40 || i==50 ||i==100 || i==110)
continue;
58 for(iPhi1=1;iPhi1<mxPhi1;iPhi1++)
59 for(iEta1=1;iEta1<mxEta1;iEta1++)
60 mcId2bin[iPhi1][iEta1]=-1;
62 for(iPhi1=1;iPhi1<mxPhi1;iPhi1++)
63 for(iEta1=1;iEta1<mxEta1;iEta1++) {
66 int iBin0=iPhiEta2bin(iPhi0,iEta0);
67 float phi=iPhi0*mCtbPhiSeg;
68 float eta=iEta0*mCtbEtaSeg -0.75;
74 int iBin=iPhiEta2bin(iPhi,iEta);
77 mcId2bin[iPhi1][iEta1]=iBin;
82 for (slat = 0; slat < mxSlat; slat++)
83 for ( tray = 0; tray < mxTray; tray++) {
85 ctb_get_slat_from_data(slat,tray,phi,eta);
91 int iBin=iPhiEta2bin(iPhi,iEta);
92 realId2bin[slat][tray]=iBin;
101 ScintHitList::clear();
102 memset(geantE,0,nBin*
sizeof(
float));
107 CtbHitList::~CtbHitList(){
115 CtbHitList::etaBin(
float eta){
116 if(eta<eta0)
return -1;
117 int iEta=(int)((eta-eta0)/dEta);
118 if( iEta>=nEta)
return -1;
126 CtbHitList::bin2EtaLeft(
int iEta){
129 float etaF= eta0+iEta*dEta ;
136 CtbHitList::buildFromMC(
TDataSet *gds) {
139 gMessMgr->Message(
"",
"I") <<
" CtbHitList::buildFromMC thr/MeV="<<mCtbThres_mev<<endm;
145 St_g2t_ctf_hit *g2t_ctb_hit = (St_g2t_ctf_hit *) gds->
Find(
"g2t_ctb_hit");
146 if(g2t_ctb_hit == 0){
147 LOG_DEBUG <<
"CtbHitList::buildMC() No CTB Hits in MC table for this event" << endm;
148 LOG_DEBUG <<
"g2t_ctb_hit = " << g2t_ctb_hit << endm;
152 g2t_ctf_hit_st *ctb_hit = NULL;
156 if (g2t_ctb_hit->GetNRows() == 0) gMessMgr->Message(
"",
"I") <<
" CtbHitList::buildMC() Empty geant/ctb data set "<<endm;
158 ctb_hit = g2t_ctb_hit->GetTable();
162 LOG_WARN <<
"CtbHitList::buildMC() no CTB hits" << endm;
167 for (i = 0; i < g2t_ctb_hit->GetNRows(); i++,ctb_hit++){
168 float de_mev=ctb_hit->de*1000.;
171 cts_get_ctb_indexes(ctb_hit->volume_id,iPhi1,iEta1);
176 int iBin=mcId2bin[iPhi1][iEta1];
177 geantE[iBin]+=de_mev;
181 if ( getActive(i)<0)
continue;
182 if( geantE[i]<mCtbThres_mev)
continue;
194 LOG_INFO <<
" CtbHitList::buildFromData CtbThres_Ch thres="<<mCtbThres_ch << endm;
199 LOG_WARN <<
"CtbHitList::buildFromData: no trigData in real data" << endm;
203 for ( slat = 0; slat < mxSlat; slat++)
204 for ( tray = 0; tray < mxTray; tray++) {
205 float adc = trgD->ctbTraySlat(tray,slat,0);
206 if(adc<mCtbThres_ch)
continue;
207 int iBin=realId2bin[slat][tray];
209 if ( getActive(iBin)<0)
continue;
217 LOG_WARN <<
"StCtbUtility scans: no trigCol in Data" << endm;
222 for (UInt_t slat = 0; slat < ctbDet->numberOfSlats(); slat++)
223 for (UInt_t tray = 0; tray < ctbDet->numberOfTrays(); tray++) {
225 curHit.adc = ctbDet->mips(tray,slat,0);
226 if(curHit.adc<mCtbThres_ch)
continue;
238 CtbHitList::ctb_get_slat_from_data(
int slat,
int tray,
float & phiRad,
float &eta) {
239 float phiZero1 = 72 ;
240 float phiZero2 = 108 ;
249 phi = phiZero1 - tray * deltaPhi ;
252 phi = phiZero2 + (tray-60) * deltaPhi ;
255 if ( phi < 0. ) phi += 360 ;
256 if ( phi > 360. ) phi -= 360 ;
259 eta=(1-2*iz)*(1+2*slat)*0.25;
virtual TDataSet * Find(const char *path) const