StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StMuEEDemoMaker.cxx
1 // *-- Author : Victor Perevoztchikov
2 //
3 // $Id: StMuEEDemoMaker.cxx,v 1.9 2009/02/04 20:33:26 ogrebeny Exp $
4 
5 #include "StMuEEDemoMaker.h"
6 
7 #include "StChain.h"
8 #include "St_DataSetIter.h"
9 
10 #include "StMuDSTMaker/COMMON/StMuDstMaker.h"
11 #include "StMuDSTMaker/COMMON/StMuDst.h"
12 #include "StMuDSTMaker/COMMON/StMuEmcCollection.h"
13 
14 #include "StEEmcUtil/EEmcGeom/EEmcGeomSimple.h"
15 #include "StEEmcUtil/StEEmcSmd/StEEmcSmdGeom.h"
16 
17 
18 #include "StEEmcUtil/database/StEEmcDb.h"
19 #include "StEEmcUtil/database/EEmcDbItem.h"
20 #include "StEEmcUtil/EEfeeRaw/EEname2Index.h"
21 
22 ClassImp(StMuEEDemoMaker)
23 
24 StMuEEDemoMaker::StMuEEDemoMaker(const char* self ,const char* muDstMakerName) : StMaker(self){
25  mMuDstMaker = (StMuDstMaker*)GetMaker(muDstMakerName);
26  assert(mMuDstMaker);
27  geomTw= new EEmcGeomSimple(); // tower geomtry
28  geomSmd = StEEmcSmdGeom::instance(); //strip geometry, do NOT call new StEEmcSmdGeom()
29 
30 }
31 
32 
33 StMuEEDemoMaker::~StMuEEDemoMaker(){
34  //
35 }
36 
37 
38 //_____________________________________________________________________________
41  // connect to eemcDB
42  eeDb = (StEEmcDb*)this->GetDataSet("StEEmcDb");
43  if(eeDb==0) {
44  printf("eemcDB must be in the chain, fix it or drop %s-maker, JB\n",GetName());
45  assert(eeDb); // eemcDB must be in the chain, fix it
46  }
47 
48  // Create tables
49  // Create Histograms
50  return StMaker::Init();
51 }
52 
53 
54 //_____________________________________________________________________________
57  //
58  // PrintInfo();
59  //
60 
61  printf("%s::Make() is called .................................\n",GetName());
62 
63  if(eeDb->valid()<=0) {
64  printf("%s aborted, due to no eemcDb records\n",GetName());
65  return kStErr;
66  }
67 
68  StMuEmcCollection* emc = mMuDstMaker->muDst()->muEmcCollection();
69  if (!emc) {
70  printf(" No EMC data for this event\n");
71  return kStOK;
72  }
73 
74  int isec,ieta,isub,istrip,adc,ipre;
75  StMuEmcHit *hit;
76 
77  int i, nh;
78 
79  printf("\nTotal %d hits in Tower\n",emc->getNEndcapTowerADC());
80  nh=0;
81  for (i=0; i< emc->getNEndcapTowerADC(); i++) {
82  emc->getEndcapTowerADC(i,adc,isec,isub,ieta);
83  if (adc<=0) continue; // print only non-zero values
84  nh++;
85  // access geometry info
86  float etaCenter =geomTw->getEtaMean(ieta);
87  float phiCenter =geomTw->getPhiMean(isec,isub);
88  TVector3 r= geomTw-> getTowerCenter(isec, isub,ieta);
89 
90  printf("\nTower %2.2dT%c%2.2d phi/deg=%6.1f eta=%5.2f x=%4.1f y=%4.1f z=%5.1f: adc=%4d\n ",isec+1,isub+'A',ieta+1,phiCenter/3.14*180,etaCenter,r.x(),r.y(),r.z(),adc );
91 
92  #if 0
93  // more geometry info for towers, see .h
94  float etaHalfWidth =geomTw->getEtaHalfWidth(ieta);
95  float phiHalfWidth =geomTw->getPhiHalfWidth(isec,isub);
96 
97  // center of the tower in two ways
98  TVector3 r1=geomTw-> getDirection( etaCenter, phiCenter);
99  #endif
100 
101  // ....... Access DB
102  const EEmcDbItem *dbItem=eeDb->getT(isec+1,isub+'A',ieta+1);
103  assert(dbItem); // fatal error in EEmcDb-maker
104  dbItem->print();
105  }
106  printf("Total %d towers with ADC>0\n",nh);
107 
108  //====================== PRE/POST
109  nh= emc->getNEndcapPrsHits();
110  printf("\nTotal %d hits in pre1+2+post\n",nh);
111  for (i=0; i<nh; i++) {
112  hit=emc->getEndcapPrsHit(i,isec,isub,ieta,ipre);
113  printf("\n\npre/post(%d) %2.2d%c%c%2.2d : energy=%f adc=%d\n",ipre+1,isec+1,ipre+'P',isub+'A',ieta+1,hit->getEnergy(),hit->getAdc());
114  // ....... Access DB
115  char name[20];
116  sprintf(name,"%2.2d%c%c%2.2d",isec+1,ipre+'P',isub+'A',ieta+1);
117  printf(" DB: name='%s'",name);
118  int index=EEname2Index(name);
119  printf(", index=%d, ", index);
120  const EEmcDbItem *dbItem=eeDb->getByIndex(index);
121  assert(dbItem); // fatal error in EEmcDb-maker
122  dbItem->print();
123 
124  }
125 
126  //====================== SMD
127  char uv='U';
128 
129  for(uv='U'; uv<='V'; uv++) {
130  nh= emc->getNEndcapSmdHits(uv);
131  printf("\nTotal %d hits in SMD-%c\n",nh,uv);
132  for (i=0; i<nh; i++) {
133  hit=emc->getEndcapSmdHit(uv,i,isec,istrip);
134  printf("\nSMD-%c %2.2d%c%3.3d : energy=%f adc=%d\n",uv,isec+1,uv,istrip+1,hit->getEnergy(),hit->getAdc());
135 
136  // ... geometry
137  int iuv=uv-'U';
138  StructEEmcStrip *st=geomSmd->getStripPtr(istrip,iuv,isec);
139  // StEEmcSmdGeom changed, now stores TVector3 in StructEEmcStrip...
140  // besides, you really shouldn't be accessing these directly
141  // anyway.
142  //StThreeVectorD end1 = st->end1;
143  //StThreeVectorD end2 = st->end2;
144  StThreeVectorD end1 = geomSmd -> getstripEnd( *st, 0 );
145  StThreeVectorD end2 = geomSmd -> getstripEnd( *st, 1 );
146 
147  printf(" x1=%6.2f y1=%6.2f z1=%6.2f x2=%6.2f y2=%6.2f z2=%6.2f\n",
148  end1.x(),end1.y(),end1.z(),end2.x(),end2.y(),end2.z());
149 // st.end1.x(),
150 // st.end1.y(),st.end2.x(),st.end1.z(),st.end2.y(),st.end2.z());
151 
152 
153  // ....... Access DB
154 
155  const EEmcDbItem *dbItem=eeDb-> getByStrip0(isec,iuv,istrip);
156  assert(dbItem); // fatal error in EEmcDb-maker
157  dbItem->print();
158 
159  }
160  }
161 
162  //====================== Clusters tw,pre12po,smdu, smdv
163  for (int n=eemc ; n<=esmdv; n++) {
164  int nClusters = emc->getNClusters(n);
165  printf("EEMC depth=%d nClust=%d\n",n,nClusters);
166  for (int i=0; i<nClusters; i++) {
167  StMuEmcCluster* c = emc->getCluster(i,n);
168  printf("Cluster(%02i,%02i): energy=%f phi=%f eta=%f nHits=%d\n"
169  ,n,i,c->getEnergy(), c->getPhi(), c->getEta(), c->getNHits() );
170  }
171  }
172 
173  //==================== points
174  int nPoints = emc->getNEndcapPoints();
175  printf("Points: %d\n",nPoints);
176  for (int n=0; n<nPoints; n++) {
177  StMuEmcPoint* p = emc->getPoint(n);
178  printf("Point(%02i) : energy=%f phi=%f eta=%f\n",n,p->getEnergy(), p->getPhi(), p->getEta());
179  }
180 
181  return kStOK;
182 }
183 
184 
185 
186 
187 // $Log: StMuEEDemoMaker.cxx,v $
188 // Revision 1.9 2009/02/04 20:33:26 ogrebeny
189 // Moved the EEMC database functionality from StEEmcDbMaker to StEEmcUtil/database. See ticket http://www.star.bnl.gov/rt2/Ticket/Display.html?id=1388
190 //
191 // Revision 1.8 2004/10/21 13:31:40 balewski
192 // to match new name of emcCollection in muDst
193 //
194 // Revision 1.7 2004/04/12 16:20:10 balewski
195 // DB cleanup & update
196 //
197 // Revision 1.6 2004/02/03 22:59:47 jwebb
198 // *** empty log message ***
199 //
200 // Revision 1.5 2003/11/08 00:35:44 balewski
201 // change order of arguments
202 //
203 // Revision 1.4 2003/10/15 15:29:53 wzhang
204 // updated for the new StEEmcSmdGeom
205 //
206 // Revision 1.3 2003/09/02 17:57:54 perev
207 // gcc 3.2 updates + WarnOff
208 //
209 // Revision 1.2 2003/08/28 17:52:57 balewski
210 // works for SMD, Wei-Ming fix
211 //
212 // Revision 1.1 2003/08/27 22:56:30 balewski
213 // example of access to EEMC data+DB+geom from muDst
214 //
215 // Revision 1.15 2002/04/28 01:28:36 jeromel
216 // Reshaped comments for doxygen. Hopefully, users will propagate this good
217 // habit.
218 //
219 // Revision 1.14 2000/06/23 16:50:07 fisyak
220 // remove params
221 //
222 // Revision 1.13 1999/12/19 16:07:01 perev
223 // Add README
224 //
225 // Revision 1.12 1999/07/15 13:57:44 perev
226 // cleanup
227 //
228 // Revision 1.11 1999/07/10 22:59:16 fine
229 // Some comments have been introduced to show html docs
230 //
231 
232 
233 
234 
235 
236 
virtual base class for Maker
float getEnergy() const
Return Hit energy.
Definition: StMuEmcHit.h:21
StMuDst * muDst()
Definition: StMuDstMaker.h:425
float getEnergy() const
Return Energy of the point.
Definition: StMuEmcPoint.h:31
const EEmcDbItem * getByIndex(int ikey) const
returns full DB info for one pixel
Definition: StEEmcDb.cxx:584
Float_t getEtaHalfWidth(UInt_t eta) const
virtual Int_t Make()
Make - this method is called in loop for each event.
int getNHits() const
Return Number of hits of the cluster.
Float_t getPhiMean(UInt_t sec) const
int getAdc() const
Return ADC value.
Definition: StMuEmcHit.h:19
virtual Int_t Init()
Init - is a first method the top level StChain calls to initialize all its makers.
float getPhi() const
Return Phi of the cluster.
static StMuEmcCollection * muEmcCollection()
returns pointer to current StMuEmcCollection
Definition: StMuDst.h:389
Float_t getPhiHalfWidth(UInt_t sec=0, UInt_t ssec=0) const
virtual const char * GetName() const
special overload
Definition: StMaker.cxx:237
EEMC simple geometry.
Definition: Stypes.h:40
float getPhi() const
Return Phi of the point.
Definition: StMuEmcPoint.h:27
StructEEmcStrip * getStripPtr(const Int_t iStrip, const Int_t iUV, const Int_t iSec)
return a strip pointer from indices
Definition: Stypes.h:44
float getEta() const
Return Eta of the cluster.
float getEta() const
Return Eta of the point.
Definition: StMuEmcPoint.h:26
Float_t getEtaMean(UInt_t eta) const