8 #include "StPhiEtaHitList.h"
11 const Char_t *StPhiEtaHitList::names[3] = {
"Active",
"Fired",
"Track"};
12 static Int_t _debug = 0;
13 void StPhiEtaHitList::SetDebug(Int_t k) {_debug = k;}
14 Int_t StPhiEtaHitList::Debug() {
return _debug;}
15 Double_t StPhiEtaHitList::W(Double_t energy) {
17 if (energy > 0.1) W = 1;
18 if (energy > 0.5) W = 2;
19 if (energy > 1.0) W = 3;
20 if (energy > 4.0) W = 4;
21 if (energy > 10.0) W = 5;
22 if (energy > 20.0) W = 6;
23 if (energy >100.0) W = 7;
27 StPhiEtaHitList::StPhiEtaHitList() : Wmatch(4), Wveto(0.75) {
28 memset(beg, 0, end - beg + 1);
30 StPhiEtaHitList::~StPhiEtaHitList() {
31 TH2C **histList[3] = {&mActive, &mFired, &mTrack};
32 for (Int_t i = 0; i < 3; i++) {
33 SafeDelete(*histList[i]);
37 Bool_t StPhiEtaHitList::isMatched(Int_t iBin){
38 Char_t active = getActive(iBin);
39 Char_t fired = getFired(iBin);
40 Char_t
track = getTrack(iBin);
41 Bool_t match = kFALSE;
42 if (active && fired && track) match = kTRUE;
46 Int_t StPhiEtaHitList::addTrack(Float_t eta, Float_t phi) {
47 if (phi < phiMin) phi += 2*TMath::Pi();
48 Int_t iBin = mTrack->Fill(phi,eta);
50 LOG_INFO <<
"StPhiEtaHitList::addTrack add track at iBin = " << iBin <<
" with phi = " << phi <<
" eta = " << eta << endm;
55 Bool_t StPhiEtaHitList::isVetoed(Int_t iBin) {
56 Char_t active = getActive(iBin);
57 Char_t fired = getFired(iBin);
58 Char_t track = getTrack(iBin);
60 if (active && ! fired && track) veto = kTRUE;
64 #include "StDetectorDbMaker/St_tofStatusC.h"
65 #include "StBTofCollection.h"
70 Int_t nPhi = mxHalfTray*mxCell;
72 Double_t phiMax = phiMin + nPhi;
73 Int_t nEta = 2*mxModule;
74 Double_t etaMin = - mxModule;
75 Double_t etaMax = + mxModule;
76 TH2C **histList[3] = {&mActive, &mFired, &mTrack};
77 for (Int_t i = 0; i < 3; i++) {
78 *histList[i] =
new TH2C(Form(
"%sBToF",names[i]),Form(
"List of %s cells in BToF",names[i]),nPhi,phiMin,phiMax,nEta,etaMin,etaMax);
79 (*histList[i])->SetDirectory(0);
80 (*histList[i])->SetMarkerColor(i+1);
84 StBtofHitList::~StBtofHitList() {fgInstance = 0;}
86 void StBtofHitList::initRun() {
87 LOG_INFO <<Form(
"StBtofHitList::initRun() start")<<endm;
89 St_tofStatusC::instance()->Table()->
Print(0,1);
91 Int_t nB=0; Int_t nA=0;
92 for(Int_t tray = 1; tray <= mxTray;tray++)
93 for(Int_t module = 1; module <= mxModule;module++)
94 for(Int_t cell = 1; cell <= mxCell;cell++) {
97 LOG_INFO <<
"StBtofHitList::initRun() tray = " << tray
98 <<
" module " << module
100 <<
" status " << St_tofStatusC::instance()->status(tray,module,cell) << endm;
102 if (St_tofStatusC::instance()->status(tray,module,cell) != 1)
continue;
104 mActive->Fill(Phi(tray,module,cell),Eta(tray,module,cell));
106 LOG_INFO <<
" StBtofHitList::initRun() done, active="<<nA<<
" of "<<nB<<
" BTOF channels" <<endm;
110 if(!btofColl || !btofColl->hitsPresent()) {
111 LOG_INFO <<
" No available BTOF hits for this event ... " << endm;
114 StSPtrVecBTofHit& tofHits = btofColl->tofHits();
115 for(
size_t i=0;i<tofHits.size();i++) {
118 Int_t t = aHit->tray();
119 Int_t m = aHit->module();
120 Int_t c = aHit->cell();
121 Double_t phi = Phi(t,m,c);
122 Double_t eta = Eta(t,m,c);
123 Int_t iBin = mFired->Fill(phi,eta);
124 if (StPhiEtaHitList::Debug()) {
125 LOG_INFO <<
"StBtofHitList::build add fired at iBin = " << iBin <<
" with phi = " << phi <<
" eta = " << eta << endm;
130 Int_t StBtofHitList::addBtofTrack(Int_t t, Int_t m, Int_t c) {
131 Double_t phi = Phi(t,m,c);
132 Double_t eta = Eta(t,m,c);
133 Int_t iBin = mTrack->Fill(phi,eta);
134 if (StPhiEtaHitList::Debug()) {
135 LOG_INFO <<
"StBtofHitList::addBtofTrack add track at iBin = " << iBin <<
" with phi = " << phi <<
" eta = " << eta
136 <<
" tray = " << t <<
" module = " << m <<
" cell = " << c
142 Bool_t StBtofHitList::isMatched(IntVec ibinVec) {
143 Bool_t match = kFALSE;
144 for(
size_t i=0;i<ibinVec.size();i++) {
145 Int_t iBin = ibinVec[i];
146 match |= isMatched(iBin);
151 Bool_t StBtofHitList::isVetoed(IntVec ibinVec) {
154 for(
size_t i=0;i<ibinVec.size();i++) {
155 Int_t iBin = ibinVec[i];
156 if(getActive(iBin) > 0) {
158 if(getTrack(iBin) >0 && getFired(iBin) == 0) veto &= kTRUE;
162 if(nA==0)
return kFALSE;
166 Float_t StBtofHitList::getWeight(IntVec ibinVec) {
167 const Float_t Wdunno=1;
169 for(
size_t i=0;i<ibinVec.size();i++) {
170 Int_t iBin = ibinVec[i];
171 if(getActive(iBin) > 0) nA++;
173 if(nA==0)
return Wdunno;
174 if(isMatched(ibinVec))
return Wmatch;
175 if(isVetoed(ibinVec))
return Wveto;
178 #include <tables/St_g2t_ctf_hit_Table.h>
179 #include <StTriggerData.h>
188 phiMin = -TMath::Pi()/60.;
189 Double_t phiMax = phiMin + TMath::Pi();
191 Double_t
etaBins[5] = {-0.97, -0.5, 0.0, 0.5, 0.97};
192 TH2C **histList[3] = {&mActive, &mFired, &mTrack};
193 for (Int_t i = 0; i < 3; i++) {
194 *histList[i] =
new TH2C(Form(
"%sCtb",names[i]),Form(
"List of %s cells in Ctb",names[i]),nPhi,phiMin,phiMax,nEta,etaBins);
195 (*histList[i])->SetDirectory(0);
196 (*histList[i])->SetMarkerColor(i+1);
198 mgeantE =
new TH2F(
"geantECtb",
"geant deposited energy in Ctb", nPhi,phiMin,phiMax,nEta,etaBins);
201 void StCtbHitList::initRun(Float_t fac){
203 LOG_INFO <<
" StCtbHitList::initRun(), gain change factor="<<fac<<endm;
205 mCtbThres_ch=(int) (fac*mCtbThres_ch);
208 <<
" StCtbHitList::initRun() CtbThres_Ch (real)="<<mCtbThres_ch
209 <<
" or CtbThres_MeV (M-C)="<<mCtbThres_mev
211 StPhiEtaHitList::initRun();
214 for (slat = 0; slat < mxSlat; slat++)
215 for ( tray = 0; tray < mxTray; tray++) {
217 ctb_get_slat_from_data(slat,tray,phi,eta);
218 mActive->Fill(phi,eta);
223 void StCtbHitList::buildFromMC(
TDataSet *gds) {
225 LOG_INFO <<
" StCtbHitList::buildFromMC thr/MeV="<<mCtbThres_mev<<endm;
229 St_g2t_ctf_hit *g2t_ctb_hit = (St_g2t_ctf_hit *) gds->
Find(
"g2t_ctb_hit");
230 if(g2t_ctb_hit == 0){
231 LOG_INFO <<
"StCtbHitList::buildMC() No CTB Hits in MC table for this event" << endm;
232 LOG_INFO <<
"g2t_ctb_hit = " << g2t_ctb_hit << endm;
235 if (g2t_ctb_hit->GetNRows() == 0) LOG_INFO <<
" StCtbHitList::buildMC() Empty geant/ctb data set "<<endm;
236 g2t_ctf_hit_st *ctb_hit = g2t_ctb_hit->GetTable();
239 LOG_WARN <<
"StCtbHitList::buildMC() no CTB hits" << endm;
244 for (i = 0; i < g2t_ctb_hit->GetNRows(); i++,ctb_hit++){
245 Float_t de_mev=ctb_hit->de*1000.;
249 ctb_get_slat_from_geant(ctb_hit->volume_id,iPhi1,iEta1,phi,eta);
250 iBin = mgeantE->Fill(phi,eta,de_mev);
253 Int_t nx = mActive->GetNbinsX();
254 Int_t ny = mActive->GetNbinsY();
255 for (Int_t ix = 1; ix <= nx; ix++)
256 for (Int_t iy = 1; iy <= ny; iy++) {
257 Int_t iBin = mActive->GetBin(ix,iy);
258 if(mgeantE->GetBinContent(iBin) < mCtbThres_mev)
continue;
259 mFired->AddBinContent(iBin);
264 void StCtbHitList::ctb_get_slat_from_geant(Int_t volume, Int_t &i_phi, Int_t &i_eta, Float_t & phi, Float_t &eta) {
272 if ( i_phi < 1 ) i_phi = i_phi + 60 ;
273 if ( i1 == 11 ) i_eta = 3 ;
275 if ( i1 == 12 ) i_eta = 4 ;
277 else if ( i1 > 20 ) {
279 if ( i_phi < 1 ) i_phi = i_phi + 60 ;
280 if ( i1 == 21 ) i_eta = 2 ;
282 if ( i1 == 22 ) i_eta = 1 ;
284 Float_t phiD = 6*i_phi;
285 if (phiD < 0) phiD += 360;
286 if (phiD > 360) phiD -= 360;
287 phi = TMath::DegToRad()*phiD;
288 eta = -0.75 + 0.5*(i_eta-1);
293 LOG_INFO <<
" StCtbHitList::buildFromData CtbThres_Ch thres="<<mCtbThres_ch << endm;
298 LOG_WARN <<
"StCtbHitList::buildFromData: no trigData in real data" << endm;
303 for ( slat = 0; slat < mxSlat; slat++)
304 for ( tray = 0; tray < mxTray; tray++) {
305 Float_t adc = trgD->ctbTraySlat(tray,slat,0);
306 if(adc<mCtbThres_ch)
continue;
307 ctb_get_slat_from_data(slat, tray, phi, eta);
308 Int_t iBin = mFired->Fill(phi,eta);
309 if (StPhiEtaHitList::Debug()) {
310 LOG_INFO <<
"StCtbHitList::buildFromData add fired at iBin = " << iBin <<
" with phi = " << phi <<
" eta = " << eta << endm;
315 void StCtbHitList::ctb_get_slat_from_data(Int_t slat, Int_t tray, Float_t & phiRad, Float_t &eta) {
316 Float_t phiZero1 = 72 ;
317 Float_t phiZero2 = 108 ;
318 Float_t deltaPhi = 6 ;
326 phi = phiZero1 - tray * deltaPhi ;
329 phi = phiZero2 + (tray-60) * deltaPhi ;
332 if ( phi < 0. ) phi += 360 ;
333 if ( phi > 360. ) phi -= 360 ;
335 phiRad=phi/180*TMath::Pi();
336 eta=(1-2*iz)*(1+2*slat)*0.25;
340 #include "StEmcRawMaker/defines.h"
341 #include "StEmcDetector.h"
342 #include "StEmcModule.h"
343 #include "StEmcRawHit.h"
351 geomB = StEmcGeom::instance(
"bemc");
354 Double_t phiMax = phiMin + 2*TMath::Pi();
356 Double_t etaMin = -1;
358 TH2C **histList[3] = {&mActive, &mFired, &mTrack};
359 for (Int_t i = 0; i < 3; i++) {
360 *histList[i] =
new TH2C(Form(
"%sBemc",names[i]),Form(
"List of %s cells in Bemc",names[i]),nPhi,phiMin,phiMax,nEta,etaMin,etaMax);
361 (*histList[i])->SetDirectory(0);
362 (*histList[i])->SetMarkerColor(i+1);
366 void StBemcHitList::initRun() {
367 LOG_INFO <<Form(
"StBemcHitList::initRun() start")<<endm;
368 StPhiEtaHitList::initRun();
370 StMaker*mk = StMaker::GetChain()->GetMaker(
"db");
376 for(
id=1;
id<=BTOWSIZE;
id++) {
384 geomB->getEta(m,e,eta);
385 geomB->getPhi(m,s,phi);
386 if( phi < phiMin) phi+=2*TMath::Pi();
388 if( status!= 1)
continue;
389 mActive->Fill(phi,eta);
392 LOG_INFO <<
" StBemcHitList::initRun() done, active="<<nA<<
" of "<<nB<<
" BTOW towers" <<endm;
395 void StBemcHitList::build (
StEmcDetector*det, Float_t adcMin){
396 for(Int_t m = 1; m <= BEMCMODULES;m++) {
399 StSPtrVecEmcRawHit& rawHit=module->hits();
400 for(UInt_t k=0;k<rawHit.size();k++) {
401 if (rawHit[k]->energy() <= 0)
continue;
403 Int_t m=rawHit[k]->module();
404 Int_t e=rawHit[k]->eta();
405 Int_t s=abs(rawHit[k]->sub());
407 geomB->getEta(m,e,eta);
408 geomB->getPhi(m,s,phi);
409 if( phi < phiMin ) phi += 2*TMath::Pi();
410 if (phi > phiMin + 2*TMath::Pi()) phi -= 2*TMath::Pi();
413 geomB->getId(m,e,s,
id);
414 Float_t ped,sig,calib;
416 Float_t rawAdc = rawHit[k]->adc();
417 if( rawAdc<ped+ kSigPed*sig )
continue;
418 Float_t adc = rawAdc -ped;
419 if(adc< adcMin)
continue;
420 myTable->
getCalib(BTOW,
id, 1, calib);
421 Float_t energy = calib * (rawAdc - ped);
422 Float_t energy = rawHit[k].energy();
424 if (energy > 0.3) W = 2;
425 if (energy > 1.0) W = 3;
426 if (energy > 4.0) W = 4;
427 if (energy > 30.0) W = 5;
429 Double_t w = W(rawHit[k]->energy());
431 Int_t iBin = mFired->Fill(phi,eta,w);
432 if (StPhiEtaHitList::Debug()) {
433 LOG_INFO <<
"StBemcHitList::build add fired at iBin = " << iBin <<
" with phi = " << phi <<
" eta = " << eta
434 <<
" energy " << rawHit[k]->energy() <<
" with W = " << w
442 #include "StEEmcUtil/database/StEEmcDb.h"
443 #include "StEEmcUtil/database/EEmcDbItem.h"
444 #include "StEEmcUtil/EEmcGeom/EEmcGeomSimple.h"
447 #include "StEmcDetector.h"
448 #include "StEmcModule.h"
449 #include "StEmcRawHit.h"
462 eeDb-> setThreshold( kSigPed);
464 phiMin = -TMath::Pi()/60.;
465 Double_t phiMax = phiMin + 2*TMath::Pi();
467 const Float_t *etaHL= geomE->getEtaBinRangeArray();
469 Double_t etaBins[13];
470 for (Int_t i = 0; i < 13; i++) {
471 etaBins[i] = etaHL[12-i];
473 TH2C **histList[3] = {&mActive, &mFired, &mTrack};
474 for (Int_t i = 0; i < 3; i++) {
475 *histList[i] =
new TH2C(Form(
"%sEemc",names[i]),Form(
"List of %s cells in Eemc",names[i]),nPhi,phiMin,phiMax,nEta,etaBins);
476 (*histList[i])->SetDirectory(0);
477 (*histList[i])->SetMarkerColor(i+1);
479 LOG_INFO <<
" StEemcHitList::use kSigPed="<<kSigPed <<endm;
482 void StEemcHitList::initRun(){
483 LOG_INFO <<
" StEemcHitList::initRun()"<<endm;
484 StPhiEtaHitList::initRun();
490 for(sec=1;sec<=MaxSectors;sec++)
491 for(sub=
'A';sub<=
'E';sub++)
492 for(etaB=1;etaB<=MaxEtaBins;etaB++) {
497 if(x->fail )
continue;
498 if(x->stat & killStatEEmc)
continue;
501 Int_t isec=x->sec-1, isub=x->sub-
'A';
504 if( phi < phiMin) phi+=2*TMath::Pi();
505 mActive->Fill(phi,eta);
508 LOG_INFO <<
" StEemcHitList::initRun() done, active="<<nA<<
" of "<<nB<<
" ETOW towers" <<endm;
511 void StEemcHitList::build (
StEmcDetector*det, Float_t adcMin){
512 for(UInt_t mod=1;mod<=det->numberOfModules();mod++) {
515 StSPtrVecEmcRawHit& rawHit= module->hits();
517 for(UInt_t k=0;k<rawHit.size();k++){
518 if (rawHit[k]->energy() <= 0)
continue;
520 Char_t sub=
'A'+h->sub()-1;
525 if(x->fail )
continue;
526 if(x->stat & killStatEEmc)
continue;
530 Int_t isub=x->sub-
'A';
534 Int_t rawAdc=h->adc();
535 if(rawAdc< x->thr)
continue;
536 Float_t adc=rawAdc - x->ped ;
537 if(adc < adcMin)
continue;
540 Double_t w = W(rawHit[k]->energy());
542 Int_t iBin = mFired->Fill(Phi,Eta,w);
543 if (StPhiEtaHitList::Debug()) {
544 LOG_INFO <<
"StEemcHitList::build add fired at iBin = " << iBin <<
" with phi = " << Phi <<
" eta = " << Eta
545 <<
" energy " << rawHit[k]->energy() <<
" with W = " << w
void getPedestal(Int_t det, Int_t softId, Int_t cap, Float_t &ped, Float_t &rms) const
Return pedestal mean and rms.
Float_t getPhiMean(UInt_t sec) const
void loadTables(StMaker *anyMaker)
load tables.
void getCalib(Int_t det, Int_t softId, Int_t power, Float_t &calib) const
Return calibration constant.
Int_t getBin(const Float_t phi, const Float_t eta, Int_t &m, Int_t &e, Int_t &s) const
void getStatus(Int_t det, Int_t softId, Int_t &status, const char *option="") const
Return status.
virtual Char_t * Print(Char_t *buf, Int_t n) const
Create IDL table defintion (to be used for XDF I/O)
virtual TDataSet * Find(const char *path) const
Float_t getEtaMean(UInt_t eta) const