StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StEEtowerExampleMaker.cxx
1 // *-- Author : Jan Balewski
2 //
3 // $Id: StEEtowerExampleMaker.cxx,v 1.4 2012/03/14 23:53:19 balewski Exp $
4 
5 #include <TFile.h>
6 #include <TH2.h>
7 
8 #include "StEEtowerExampleMaker.h"
9 
10 #include "StMuDSTMaker/COMMON/StMuEvent.h"
11 #include "StMuDSTMaker/COMMON/StMuDst.h"
12 #include "StMuDSTMaker/COMMON/StMuDstMaker.h"
13 
14 #include <StMessMgr.h>
15 
16 #include "StEEmcUtil/database/EEmcDbItem.h"
17 #include "StEEmcUtil/database/StEEmcDb.h"
18 
19 
20 ClassImp(StEEtowerExampleMaker)
21 
22 //________________________________________________
23 //________________________________________________
24 StEEtowerExampleMaker::StEEtowerExampleMaker(const char* self ,const char* muDstMakerName) : StMaker(self){
25  mMuDstMaker = (StMuDstMaker*)GetMaker(muDstMakerName);
26  assert(mMuDstMaker);
27 }
28 
29 
30 //___________________ _____________________________
31 //________________________________________________
32 StEEtowerExampleMaker::~StEEtowerExampleMaker(){
33 }
34 
35 
36 //________________________________________________
37 //________________________________________________
38 Int_t StEEtowerExampleMaker::Init(){
39  eeDb = (StEEmcDb*)this->GetDataSet("StEEmcDb");
40  EEtower::init();
41  return StMaker::Init();
42 }
43 
44 //________________________________________________
45 //________________________________________________
47  finish();
48  return kStOK;
49 }
50 
51 
52 
53 
54 //________________________________________________
55 //________________________________________________
57 
58  EEtower::clear();
59 
60  // ............. acuire EEMC data
61  if(unpackMuDst()<0) return kStOK;
62 
63  //print();
64  task1(); // do real analysis
65 
66  return kStOK;
67 }
68 
69 
70 //________________________________________________
71 //________________________________________________
72 Int_t StEEtowerExampleMaker::unpackMuDst(){
73  nInpEve++;
74  gMessMgr->Message("","D") <<GetName()<<"::::getAdc() is called "<<endm;
75 
76  // Access to muDst .......................
77  StMuEmcCollection* emc = mMuDstMaker->muDst()->muEmcCollection();
78  if (!emc) {
79  gMessMgr->Message("","W") <<"No EMC data for this event"<<endm; return kStOK;
80  }
81 
82  int i, n1=0;
83 
84  int sec,eta,sub,adc;
85  for (i=0; i< emc->getNEndcapTowerADC(); i++) {
86  emc->getEndcapTowerADC(i,adc,sec,sub,eta);
87  assert(sec>0);// total corruption of muDst
88 
89  const EEmcDbItem *x=eeDb->getTile(sec,'A'+sub-1,eta,'T');
90  if(x==0) continue; // it should never happened for muDst
91  if(x->fail ) continue; // drop broken channels
92  if(adc <x->thr) continue;// value must be >ped+ N*ped_sig
93  if(x->gain<=0 ) continue; // gains not avaliable
94 
95  n1++;
96  float value=(adc-x->ped)/x->gain;
97  int iphi=(x->sec-1)*5+(x->sub-'A');
98  int ieta=x->eta-1;
99  assert(iphi>=0 && iphi<MaxPhiBins);
100  assert(ieta>=0 && ieta<MaxEtaBins);
101 
102  towerE[ieta][iphi]=value;
103  //if(value>0) printf(" %d %d %f\n",ieta,iphi,value);
104  }
105 
106  gMessMgr->Message("","I") <<GetName()<<"::::getAdc() found "<<n1<<" ADC>thres "<<endm;
107  return n1;
108 }
109 
110 
111 // $Log: StEEtowerExampleMaker.cxx,v $
112 // Revision 1.4 2012/03/14 23:53:19 balewski
113 // *** empty log message ***
114 //
115 // Revision 1.3 2009/02/04 20:33:22 ogrebeny
116 // Moved the EEMC database functionality from StEEmcDbMaker to StEEmcUtil/database. See ticket http://www.star.bnl.gov/rt2/Ticket/Display.html?id=1388
117 //
118 // Revision 1.2 2004/10/21 13:31:28 balewski
119 // to match new name of emcCollection in muDst
120 //
121 // Revision 1.1 2004/06/06 04:54:08 balewski
122 // dual analyzis
123 //
Axample to access EEMC data &amp; DB from muDst in StRoot-framework Only muDst data are decoded by this c...
StMuDst * muDst()
Definition: StMuDstMaker.h:425
float towerE[MaxEtaBins][MaxPhiBins]
no. of input events
Definition: EEtower.h:45
static StMuEmcCollection * muEmcCollection()
returns pointer to current StMuEmcCollection
Definition: StMuDst.h:389
virtual const char * GetName() const
special overload
Definition: StMaker.cxx:237
Definition: Stypes.h:40