1 #include "tables/St_g2t_ctf_hit_Table.h"
5 #include <StTriggerData.h>
8 extern void cts_get_ctb_indexes(
long,
long &,
long &);
12 #include "StCtbUtility.h"
15 StCtbUtility::StCtbUtility() {
17 mCtbEtaSeg=0.5; mCtbPhiSeg=M_PI/30;
29 void StCtbUtility::ctb_get_slat_from_data(
int slat,
int tray,
float & phiRad,
float &eta) {
31 float phiZero2 = 108 ;
40 phi = phiZero1 - tray * deltaPhi ;
43 phi = phiZero2 + (tray-60) * deltaPhi ;
46 if ( phi < 0. ) phi += 360 ;
47 if ( phi > 360. ) phi -= 360 ;
50 eta=(1-2*iz)*(1+2*slat)*0.25;
59 void StCtbUtility::collectCTBhitsMC(
St_DataSet *gds){
62 gMessMgr->Message(
"",
"I") <<
" use GEANT CTB hits, ADC's with 2 MeV=> 5 ADC, thr/MeV="<<
mCtbThres_mev<<endm;
69 St_g2t_ctf_hit *g2t_ctb_hit = (St_g2t_ctf_hit *) gds->
Find(
"g2t_ctb_hit");
71 LOG_DEBUG <<
"No CTB Hits in MC table for this event" << endm;
72 LOG_DEBUG <<
"g2t_ctb_hit = " << g2t_ctb_hit << endm;
76 g2t_ctf_hit_st *ctb_hit = NULL;
80 if (g2t_ctb_hit->GetNRows() == 0) gMessMgr->Message(
"",
"I") <<
" Empty geant/ctb data set "<<endm;
82 ctb_hit = g2t_ctb_hit->GetTable();
86 LOG_WARN <<
"StCtbUtility::collectCTBhitsMC: no CTB hits" << endm;
91 for (i = 0; i < g2t_ctb_hit->GetNRows(); i++,ctb_hit++){
92 float de_mev=ctb_hit->de*1000.;
93 if(de_mev>0.01) LOG_INFO<<Form(
"CTB Hit i=%d de/MeV=%f parent=%d\n",i,de_mev ,ctb_hit->track_p)<<endm;
97 cts_get_ctb_indexes(ctb_hit->volume_id,iPhi,iEta);
100 assert(iPhi >= 0 && iPhi<60 && iEta>=0 && iEta<4);
104 curHit.adc=de_mev*2.5 ;
105 curHit.phi=iPhi*mCtbPhiSeg;
106 curHit.eta=iEta*mCtbEtaSeg -0.75;
107 mCtbHits.push_back(curHit);
112 gMessMgr->Message(
"",
"I") << mCtbHits.size() <<
" CTB slats accepted from M-C data"<<endm;
123 LOG_INFO <<
"StCtbUtility scans real CTB hits" << endm;
128 LOG_WARN <<
"StCtbUtility scans: no trigData in real data" << endm;
133 for (UInt_t slat = 0; slat < 2; slat++)
134 for (UInt_t tray = 0; tray < 120; tray++) {
136 curHit.adc = trgD->ctbTraySlat(tray,slat,0);
137 if(curHit.adc<mCtbThres_ch)
continue;
139 ctb_get_slat_from_data(slat,tray,curHit.phi, curHit.eta);
140 mCtbHits.push_back(curHit);
148 LOG_WARN <<
"StCtbUtility scans: no trigCol in Data" << endm;
153 for (UInt_t slat = 0; slat < ctbDet->numberOfSlats(); slat++)
154 for (UInt_t tray = 0; tray < ctbDet->numberOfTrays(); tray++) {
156 curHit.adc = ctbDet->mips(tray,slat,0);
157 if(curHit.adc<mCtbThres_ch)
continue;
158 LOG_INFO<<Form(
"A sl=%3d tr=%3d %4f\n",slat,tray, curHit.adc )<<endm;
168 void StCtbUtility::printCtb() {
169 LOG_INFO<<Form(
"StCtbUtility::print(),nSlat=%d\n",mCtbHits.size())<<endm;
172 for(ih=0;ih<mCtbHits.size();ih++) {
173 LOG_INFO<<Form(
"ih=%d eta=%.3f phi/deg=%.1f adc=%.1f\n",ih
174 ,mCtbHits[ih].eta,mCtbHits[ih].phi/3.1416*180,mCtbHits[ih].adc)<<endm;
virtual TDataSet * Find(const char *path) const