StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StPhiEtaHitList.cxx
1 #include <string.h>
2 #include <assert.h>
3 #include <stdio.h>
4 
5 #include "TH1.h"
6 #include "TObjArray.h"
7 #include "StMessMgr.h"
8 #include "StPhiEtaHitList.h"
9 #include "StMaker.h"
10 //________________________________________________________________________________
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) {
16  Double_t W = 0;
17  if (energy > 0.1) W = 1; // 1 ==> 0.1 < energy <= 0.5 Mip
18  if (energy > 0.5) W = 2; // 2 ==> 0.5 < energy <= 1.0 Hadron
19  if (energy > 1.0) W = 3; // 3 ==> 1.0 < energy <= 4.0 Electon
20  if (energy > 4.0) W = 4; // 4 ==> 4.0 < energy <= 10.0 Tower
21  if (energy > 10.0) W = 5; // 5 ==>10.0 < energy <= 20.0 W
22  if (energy > 20.0) W = 6; // 6 ==>20.0 < energy <=100.0 Z
23  if (energy >100.0) W = 7; // 7 ==> energy > 100.0 ?
24  return W;
25 }
26 //________________________________________________________________________________
27 StPhiEtaHitList::StPhiEtaHitList() : Wmatch(4), Wveto(0.75) {
28  memset(beg, 0, end - beg + 1);
29 }
30 StPhiEtaHitList::~StPhiEtaHitList() {
31  TH2C **histList[3] = {&mActive, &mFired, &mTrack};
32  for (Int_t i = 0; i < 3; i++) {
33  SafeDelete(*histList[i]);
34  }
35 }
36 //________________________________________________________________________________
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;
43  return match;
44 }
45 //________________________________________________________________________________
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);
49  if (Debug()) {
50  LOG_INFO << "StPhiEtaHitList::addTrack add track at iBin = " << iBin << " with phi = " << phi << " eta = " << eta << endm;
51  }
52  return iBin;
53 }
54 //________________________________________________________________________________
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);
59  Bool_t veto = kFALSE;
60  if (active && ! fired && track) veto = kTRUE;
61  return veto;
62 }
63 //________________________________________________________________________________
64 #include "StDetectorDbMaker/St_tofStatusC.h"
65 #include "StBTofCollection.h"
66 StBtofHitList *StBtofHitList::fgInstance = 0;
67 //________________________________________________________________________________
68 StBtofHitList::StBtofHitList() : StPhiEtaHitList() {
69  fgInstance = this;
70  Int_t nPhi = mxHalfTray*mxCell;
71  phiMin = 0.5;
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);
81  }
82 }
83 //________________________________________________________________________________
84 StBtofHitList::~StBtofHitList() {fgInstance = 0;}
85 //________________________________________________________________________________
86 void StBtofHitList::initRun() {
87  LOG_INFO <<Form("StBtofHitList::initRun() start")<<endm;
88  if (Debug() > 1) {
89  St_tofStatusC::instance()->Table()->Print(0,1);
90  }
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++) {
95  nB++;
96  if (Debug()) {
97  LOG_INFO << "StBtofHitList::initRun() tray = " << tray
98  << " module " << module
99  << " cell " << cell
100  << " status " << St_tofStatusC::instance()->status(tray,module,cell) << endm;
101  }
102  if (St_tofStatusC::instance()->status(tray,module,cell) != 1) continue;
103  nA++;
104  mActive->Fill(Phi(tray,module,cell),Eta(tray,module,cell));
105  }
106  LOG_INFO <<" StBtofHitList::initRun() done, active="<<nA<<" of "<<nB<<" BTOF channels" <<endm;
107 }
108 //________________________________________________________________________________
109 void StBtofHitList::build ( StBTofCollection *btofColl){
110  if(!btofColl || !btofColl->hitsPresent()) {
111  LOG_INFO << " No available BTOF hits for this event ... " << endm;
112  return;
113  }
114  StSPtrVecBTofHit& tofHits = btofColl->tofHits();
115  for(size_t i=0;i<tofHits.size();i++) { //loop on hits in modules
116  StBTofHit *aHit = tofHits[i];
117  if(!aHit) continue;
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;
126  }
127  }
128 }
129 //________________________________________________________________________________
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
137  << endm;
138  }
139  return iBin;
140 }
141 //________________________________________________________________________________
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);
147  }
148  return match;
149 }
150 //________________________________________________________________________________
151 Bool_t StBtofHitList::isVetoed(IntVec ibinVec) {
152  Int_t nA = 0;
153  Bool_t veto = kTRUE;
154  for(size_t i=0;i<ibinVec.size();i++) {
155  Int_t iBin = ibinVec[i];
156  if(getActive(iBin) > 0) {
157  nA++;
158  if(getTrack(iBin) >0 && getFired(iBin) == 0) veto &= kTRUE;
159  else veto &= kFALSE;
160  }
161  }
162  if(nA==0) return kFALSE;
163  else return veto;
164 }
165 //________________________________________________________________________________
166 Float_t StBtofHitList::getWeight(IntVec ibinVec) {
167  const Float_t Wdunno=1;
168  Int_t nA = 0;
169  for(size_t i=0;i<ibinVec.size();i++) {
170  Int_t iBin = ibinVec[i];
171  if(getActive(iBin) > 0) nA++;
172  }
173  if(nA==0) return Wdunno;
174  if(isMatched(ibinVec)) return Wmatch;
175  if(isVetoed(ibinVec)) return Wveto;
176  return Wdunno;
177 }
178 #include <tables/St_g2t_ctf_hit_Table.h>
179 #include <StTriggerData.h>
180 //________________________________________________________________________________
181 StCtbHitList *StCtbHitList::fgInstance = 0;
182 //________________________________________________________________________________
183 StCtbHitList::StCtbHitList() : StPhiEtaHitList(), // CTB clibration: 2 MeV==5 ADC
184  mCtbThres_mev(1),//to reject slats with low dE for M-C data
185  mCtbThres_ch(2) {//to reject slats with low ADC for real data
186  fgInstance = this;
187  Int_t nPhi = 60;
188  phiMin = -TMath::Pi()/60.;
189  Double_t phiMax = phiMin + TMath::Pi();
190  Int_t nEta = 4;
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);
197  }
198  mgeantE = new TH2F("geantECtb","geant deposited energy in Ctb", nPhi,phiMin,phiMax,nEta,etaBins);
199 }
200 //________________________________________________________________________________
201 void StCtbHitList::initRun(Float_t fac){
202  // const Float_t mCtbEtaSeg=0.5, mCtbPhiSeg=TMath::Pi()/30; // NEVER chang this two , JB
203  LOG_INFO <<" StCtbHitList::initRun(), gain change factor="<<fac<<endm;
204  mCtbThres_mev*=fac; // tmp to test cuts
205  mCtbThres_ch=(int) (fac*mCtbThres_ch); // tmp to test cuts
206 
207  LOG_INFO
208  <<" StCtbHitList::initRun() CtbThres_Ch (real)="<<mCtbThres_ch
209  <<" or CtbThres_MeV (M-C)="<<mCtbThres_mev
210  <<endm;
211  StPhiEtaHitList::initRun();
212  // real data events
213  Int_t slat, tray;
214  for (slat = 0; slat < mxSlat; slat++)
215  for ( tray = 0; tray < mxTray; tray++) {
216  Float_t phi,eta;
217  ctb_get_slat_from_data(slat,tray,phi,eta);
218  mActive->Fill(phi,eta);
219  }
220 
221 }
222 //________________________________________________________________________________
223 void StCtbHitList::buildFromMC(TDataSet *gds) {
224  // CTB clibration: 2 MeV==5 ADC
225  LOG_INFO <<" StCtbHitList::buildFromMC thr/MeV="<<mCtbThres_mev<<endm;
226  if(gds==0) return ;
227  // -------------- E X T R A C T C T B H I T S --------------------
228  //access the CTB data from GEANT
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;
233  return ;
234  }
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();
237  //assert(ctb_hit);
238  if (! ctb_hit){
239  LOG_WARN << "StCtbHitList::buildMC() no CTB hits" << endm;
240  return ;
241  }
242  Int_t i;
243  Int_t iBin = -1;
244  for (i = 0; i < g2t_ctb_hit->GetNRows(); i++,ctb_hit++){
245  Float_t de_mev=ctb_hit->de*1000.;
246  // if(de_mev>0.5) printf("CTB Hit i=%d de/MeV=%f parent=%d\n",i,de_mev ,ctb_hit->track_p);
247  Int_t iPhi1,iEta1;
248  Float_t phi, eta;
249  ctb_get_slat_from_geant(ctb_hit->volume_id,iPhi1,iEta1,phi,eta);
250  iBin = mgeantE->Fill(phi,eta,de_mev);
251  }
252  if (iBin > 0) {
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; // ignore low energy CTB slat
259  mFired->AddBinContent(iBin);
260  }
261  }
262 }
263 //________________________________________________________________________________
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) {
265 // volume_id = 1000*numbv(1)+100*numbv(3)+numbv(2)
266 // [1-2] [1-2] [1-60]
267  long i1 ;
268  i1 = volume/100; // 10*numbv(1)+numbv(3)
269  i_phi = volume%100; // numbv(2)
270  if ( i1 < 20 ) {
271  i_phi = 14 - i_phi ;
272  if ( i_phi < 1 ) i_phi = i_phi + 60 ;
273  if ( i1 == 11 ) i_eta = 3 ;
274  else
275  if ( i1 == 12 ) i_eta = 4 ;
276  }
277  else if ( i1 > 20 ) {
278  i_phi = i_phi - 42 ;
279  if ( i_phi < 1 ) i_phi = i_phi + 60 ;
280  if ( i1 == 21 ) i_eta = 2 ;
281  else
282  if ( i1 == 22 ) i_eta = 1 ;
283  }
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);
289 }
290 //________________________________________________________________________________
291 void StCtbHitList::buildFromData(StTriggerData *trgD){
292 
293  LOG_INFO << " StCtbHitList::buildFromData CtbThres_Ch thres="<<mCtbThres_ch << endm;
294 
295  // access CTB from Akio's Maker
296 
297  if(!trgD){
298  LOG_WARN << "StCtbHitList::buildFromData: no trigData in real data" << endm;
299  return ;
300  }
301  Int_t slat, tray;
302  Float_t phi, eta;
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;
311  }
312  }
313 }
314 //________________________________________________________________________________
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 ; // magic lines from Pablo & Herb
317  Float_t phiZero2 = 108 ;
318  Float_t deltaPhi = 6 ;
319  // tray=0,1
320  // slat=0,...,119
321 
322  Int_t iz ;
323  Float_t phi ;
324 
325  if ( tray < 60 ) {
326  phi = phiZero1 - tray * deltaPhi ;
327  iz = 0 ;
328  } else {
329  phi = phiZero2 + (tray-60) * deltaPhi ;
330  iz = 1 ;
331  }
332  if ( phi < 0. ) phi += 360 ;
333  if ( phi > 360. ) phi -= 360 ;
334 
335  phiRad=phi/180*TMath::Pi();
336  eta=(1-2*iz)*(1+2*slat)*0.25;
337  // printf("CTB hit: slat=%d, tray=%d, phiDeg=%f/deg, eta=%f\n",slat,tray,phi,eta);
338 
339 }
340 #include "StEmcRawMaker/defines.h"
341 #include "StEmcDetector.h"
342 #include "StEmcModule.h"
343 #include "StEmcRawHit.h"
344 //Rxy = 222, 242, 262 cm
345 //________________________________________________________________________________
346 StBemcHitList *StBemcHitList::fgInstance = 0;
347 //________________________________________________________________________________
348 StBemcHitList::StBemcHitList() : StPhiEtaHitList(), kSigPed(5.0) {
349  fgInstance = this;
350  myTable = new StBemcTables();
351  geomB = StEmcGeom::instance("bemc");
352  Int_t nPhi = 120;
353  phiMin = 0;
354  Double_t phiMax = phiMin + 2*TMath::Pi();
355  Int_t nEta = 40;
356  Double_t etaMin = -1;
357  Double_t etaMax = 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);
363  }
364 }
365 //________________________________________________________________________________
366 void StBemcHitList::initRun() {
367  LOG_INFO <<Form("StBemcHitList::initRun() start")<<endm;
368  StPhiEtaHitList::initRun();
369  // .. grab table
370  StMaker*mk = StMaker::GetChain()->GetMaker("db");
371  assert(mk);
372  myTable->loadTables(mk );
373 
374  Int_t nB=0,nA=0;
375  Int_t id;
376  for(id=1; id<=BTOWSIZE; id++) {
377 
378  //........... querry BTOW DB/geom
379  Int_t status;
380  myTable->getStatus(BTOW, id, status);
381  Int_t m,e,s;
382  geomB->getBin(id,m,e,s);
383  Float_t eta=0,phi=0;
384  geomB->getEta(m,e,eta);
385  geomB->getPhi(m,s,phi); // -pi <= phi < pi
386  if( phi < phiMin) phi+=2*TMath::Pi(); // I want phi in [0,2Pi]
387  nB++;
388  if( status!= 1) continue; // drop broken towers
389  mActive->Fill(phi,eta);
390  nA++;
391  }
392  LOG_INFO <<" StBemcHitList::initRun() done, active="<<nA<<" of "<<nB<<" BTOW towers" <<endm;
393 }
394 //________________________________________________________________________________
395 void StBemcHitList::build ( StEmcDetector*det, Float_t adcMin){
396  for(Int_t m = 1; m <= BEMCMODULES;m++) { //loop on modules...
397  StEmcModule* module = det->module(m);
398  assert(module);
399  StSPtrVecEmcRawHit& rawHit=module->hits();
400  for(UInt_t k=0;k<rawHit.size();k++) { //loop on hits in modules
401  if (rawHit[k]->energy() <= 0) continue;
402  // check geometry
403  Int_t m=rawHit[k]->module();
404  Int_t e=rawHit[k]->eta();
405  Int_t s=abs(rawHit[k]->sub());
406  Float_t eta=0,phi=0;
407  geomB->getEta(m,e,eta);
408  geomB->getPhi(m,s,phi); // -pi <= phi < pi
409  if( phi < phiMin ) phi += 2*TMath::Pi(); // I want phi in [0,2Pi]
410  if (phi > phiMin + 2*TMath::Pi()) phi -= 2*TMath::Pi();
411 #if 0
412  Int_t id;
413  geomB->getId(m,e,s,id); // to get the software id
414  Float_t ped,sig,calib;
415  myTable->getPedestal(BTOW, id, 0, ped,sig);
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();
423  Double_t W = 1;
424  if (energy > 0.3) W = 2; // MIP
425  if (energy > 1.0) W = 3; // Above
426  if (energy > 4.0) W = 4; // lowest HT threshold (4 GeV for Run7)
427  if (energy > 30.0) W = 5; //
428 #endif
429  Double_t w = W(rawHit[k]->energy());
430  if (w > 0) {
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
435  << endm;
436  }
437  }
438  }
439  }
440 
441 };
442 #include "StEEmcUtil/database/StEEmcDb.h"
443 #include "StEEmcUtil/database/EEmcDbItem.h"
444 #include "StEEmcUtil/EEmcGeom/EEmcGeomSimple.h"
445 
446 
447 #include "StEmcDetector.h"
448 #include "StEmcModule.h"
449 #include "StEmcRawHit.h"
450 
451 
452 //Z=270, 288,306 cm
453 //________________________________________________________________________________
454 StEemcHitList *StEemcHitList::fgInstance = 0;
455 //________________________________________________________________________________
456 StEemcHitList::StEemcHitList(StEEmcDb* x, UInt_t y, EEmcGeomSimple *z) :
457  StPhiEtaHitList(), eeDb(x), geomE(z), killStatEEmc(y) {
458  assert(eeDb);
459  assert(geomE);
460  fgInstance = this;
461  Float_t kSigPed=5.0;
462  eeDb-> setThreshold( kSigPed);
463  Int_t nPhi = 60;
464  phiMin = -TMath::Pi()/60.;
465  Double_t phiMax = phiMin + 2*TMath::Pi();
466  // the first 13 entries mark the bounds of the 12 eta Bins.
467  const Float_t *etaHL= geomE->getEtaBinRangeArray();
468  Int_t nEta = 12;
469  Double_t etaBins[13];
470  for (Int_t i = 0; i < 13; i++) {
471  etaBins[i] = etaHL[12-i];
472  }
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);
478  }
479  LOG_INFO <<" StEemcHitList::use kSigPed="<<kSigPed <<endm;
480 }
481 //________________________________________________________________________________
482 void StEemcHitList::initRun(){
483  LOG_INFO <<" StEemcHitList::initRun()"<<endm;
484  StPhiEtaHitList::initRun();
485 
486  // clear old lookup table
487  Int_t sec,sub,etaB;
488  // fill in new association
489  Int_t nB=0,nA=0;
490  for(sec=1;sec<=MaxSectors;sec++)
491  for(sub='A';sub<='E';sub++)
492  for(etaB=1;etaB<=MaxEtaBins;etaB++) {
493  //Db ranges: sec=1-12,sub=A-E,eta=1-12; slow method
494  const EEmcDbItem *x=eeDb->getT(sec,sub,etaB);
495  if(x==0) continue;
496  nB++;
497  if(x->fail ) continue; // drop broken channels
498  if(x->stat & killStatEEmc) continue; // other problems
499 
500  Int_t ieta=x->eta-1; // typical endcap bin numbering
501  Int_t isec=x->sec-1, isub=x->sub-'A';
502  Float_t eta=geomE->getEtaMean(ieta);
503  Float_t phi=geomE->getPhiMean(isec,isub); // // -pi <= phi < pi
504  if( phi < phiMin) phi+=2*TMath::Pi(); // I want phi in [0,2Pi]
505  mActive->Fill(phi,eta);
506  nA++;
507  }
508  LOG_INFO <<" StEemcHitList::initRun() done, active="<<nA<<" of "<<nB<<" ETOW towers" <<endm;
509 }
510 //________________________________________________________________________________
511 void StEemcHitList::build ( StEmcDetector*det, Float_t adcMin){
512  for(UInt_t mod=1;mod<=det->numberOfModules();mod++) {
513  StEmcModule* module=det->module(mod);
514  //printf("ETOW sector=%d nHit=%d\n",mod,module->numberOfHits());
515  StSPtrVecEmcRawHit& rawHit= module->hits();
516  Int_t sec=mod; // range 1-12
517  for(UInt_t k=0;k<rawHit.size();k++){ // over cesctors
518  if (rawHit[k]->energy() <= 0) continue;
519  StEmcRawHit *h=rawHit[k];
520  Char_t sub='A'+h->sub()-1;// range A-E
521  Int_t eta=h->eta();// range 1-12
522  //Db ranges: sec=1-12,sub=A-E,eta=1-12; slow method
523  const EEmcDbItem *x=eeDb->getT(sec,sub,eta);
524  if(! x) continue;
525  if(x->fail ) continue; // drop broken channels
526  if(x->stat & killStatEEmc) continue; // other problems
527  // functioning chan
528  Int_t ieta=x->eta-1; // typical endcap bin numbering
529  Int_t isec=x->sec-1;
530  Int_t isub=x->sub-'A';
531  Float_t Phi=geomE->getPhiMean(isec,isub); // // -pi <= phi < pi
532  Float_t Eta=geomE->getEtaMean(ieta);
533 #if 0
534  Int_t rawAdc=h->adc();
535  if(rawAdc< x->thr) continue; // still only ped
536  Float_t adc=rawAdc - x->ped ;
537  if(adc < adcMin) continue; // too low response for MIP
538  // printf("add Eemc hit %s adc=%.1f\n",x->name,adc);
539 #endif
540  Double_t w = W(rawHit[k]->energy());
541  if (w > 0) {
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
546  << endm;
547  }
548  }
549  }
550  }
551 }
552 
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.
EEMC simple geometry.
Int_t getBin(const Float_t phi, const Float_t eta, Int_t &m, Int_t &e, Int_t &s) const
Definition: StEmcGeom.h:321
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)
Definition: TTable.cxx:1548
virtual TDataSet * Find(const char *path) const
Definition: TDataSet.cxx:362
Float_t getEtaMean(UInt_t eta) const