StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Wevent2011.h
1 // $Id: Wevent2011.h,v 1.9 2016/01/08 02:08:49 jlzhang Exp $
2 //
3 //*-- Author : Jan Balewski, MIT
4 
5 //----------------------------
6 //------- W-reco event container
7 //----------------------------
8 #ifndef W_EVENT_2011_HH
9 #define W_EVENT_2011_HH
10 
11 #include <TVector3.h>
12 #include <TH1.h>
13 //get L2
14 #include <StTriggerUtilities/L2Emulator/L2wAlgo/L2wResult2009.h>
15 
16 #include <StMuDSTMaker/COMMON/StMuTrack.h>
17 #include "WanaConst.h"
18 
19 //---------------
20 class WeveCluster { // info BTOW cluster
21  public:
22  float energy,ET, adcSum;
23  int nTower; // with non-zero ADC>kSigPed
24  int iEta, iPhi; // lower-left corner of the cluster, can be negative, L2-indexing convention
25  //int iEtaE[4]; int iPhiE[4]; //index of cluster towers
26  TVector3 position; // 3D ln(E) weighted sume of tower positions
27  WeveCluster() {clear();}
28 
29  void clear() { position=TVector3(0,0,0);
30  ET=energy=adcSum=0; nTower=0; iEta=iPhi=999;
31  //memset(iEtaE,9999,sizeof(iEta)); memset(iPhiE,9999,sizeof(iPhi));
32  }
33  void print( int flag=0){
34  printf(" Cluster ET=%.1f E=%.1f GeV, sumAdc=%.0f nTw=%d iEta=%d, iPhi=%d XYZ(%.0f,%.0f,%.0f)cm\n",ET,energy,adcSum,nTower,iEta, iPhi,position.x(),position.y(),position.z());}
35 
36  private:
37  protected:
38  ClassDef(WeveCluster,1);
39 
40 };
41 
42 
43 
44 //---------------
45 class WevePointTower { // tower pointed by the track
46  public:
47  TVector3 R; // extrapolated position of primary track
48  TVector3 Rglob; // extrapolated position of global track
49  int id; // BTOW tower id, not used for ETOW
50  int iEta, iPhi; // eta x phi bin using L2 indexing convention
51  void clear() { id=0; R=TVector3(0,0,0); Rglob=TVector3(0,0,0); iEta=iPhi=9999; }
52  void print( int flag=0){
53  printf(" pointed tower ID=%d; L2index: iEta=%d iPhi=%d; XYZ=(%.0f,%.0f,%.0f)cm\n",
54  id,iEta, iPhi, R.x(), R.y(), R.z());
55  }
56 
57  private:
58  protected:
59  ClassDef(WevePointTower,1);
60 
61 };
62 
63 //---------------
64 class WeveEleTrack { // electron track info
65  public:
66  int isMatch2Cl; // result of cuts
67  WevePointTower pointTower;
68  const StMuTrack *glMuTrack, *prMuTrack;
69  WeveCluster cluster,cl4x4;
70  TVector3 primP; // primary momentum vector
71  float nearTpcPT, nearEmcET, nearBtowET, nearEtowET, smallNearTpcPT; // (GeV/c), around prim track direction
72  float awayTpcPT, awayEmcET, awayBtowET, awayEtowET; // (GeV/c), opposite in phi to prim track direction
73  float nearTotET, awayTotET, nearTotET_noEEMC, awayTotET_noEEMC; // (GeV), for nearCone 10 GeV is subtracted to avoid double counting
74 
75  TVector3 ptBalance,ptBalance_noEEMC;
76  float sPtBalance,sPtBalance_noEEMC;// signed pT balance (GeV/c)
77  float sPtBalance2,sPtBalance_noEEMC2;// invariant
78  int jetCount;// number of jets out the near-cone; add in Dec 19, 2014, jinlong
79 
80  TVector3 hadronicRecoil;
81 
82  //esmd shower info
83  int hitSector; int esmdGlobStrip[mxEsmdPlane];
84  float esmdShower[mxEsmdPlane][41];
85  float esmdDca[mxEsmdPlane]; float esmdDcaGlob[mxEsmdPlane];
86  float esmdE[mxEsmdPlane]; float esmdEsum7[mxEsmdPlane]; int esmdNhit[mxEsmdPlane];
87  float esmdPeakSumE[mxEsmdPlane]; int esmdPeakOffset[mxEsmdPlane];//in strips
88 
89  TVector3 esmdXPcentroid;
90  int esmdMaxADC;
91 
92  //eprs cluster
93  float enePre1,enePre2,enePost;
94 
95  WeveEleTrack() { clear();}
96 
97  void clear() { pointTower.clear();
98  cluster.clear();cl4x4.clear(); isMatch2Cl=false; primP=TVector3(0,0,0);
99  prMuTrack=glMuTrack=0;
100  awayTpcPT=nearTpcPT=nearTotET=awayTotET=nearEmcET=awayEmcET=nearBtowET=awayBtowET=nearEtowET=awayEtowET=smallNearTpcPT=nearTotET_noEEMC=awayTotET_noEEMC=0;
101  enePre1=enePre2=enePost=0; esmdMaxADC=0;
102 
103  ptBalance=TVector3(0,0,0); ptBalance_noEEMC=TVector3(0,0,0);
104  sPtBalance=sPtBalance_noEEMC=0;
105  sPtBalance2=sPtBalance_noEEMC2=0;
106 
107  jetCount=0;
108 
109  hadronicRecoil=TVector3(0,0,0);
110 
111  memset(esmdGlobStrip,-999,sizeof(esmdGlobStrip));
112  memset(esmdDca,-999.,sizeof(esmdDca)); memset(esmdDcaGlob,-999.,sizeof(esmdDcaGlob)); memset(esmdE,0.,sizeof(esmdE)); memset(esmdEsum7,0.,sizeof(esmdEsum7)); memset(esmdNhit,0,sizeof(esmdNhit)); memset(esmdPeakSumE,0,sizeof(esmdPeakSumE)); memset(esmdPeakOffset,0,sizeof(esmdPeakOffset));
113  esmdXPcentroid=TVector3(0,0,0);
114 
115  }
116 
117  void print( int flag=0){
118  if(prMuTrack==0) { printf(" Track NULL pointer???\n"); return;}
119  printf(" Track glPT=%.1f GeV/c isMatch2Cl=%d, nearTotET=%.1f, awayTotET=%.1f primPT=%.1f\n",
120  glMuTrack->pt(),isMatch2Cl,nearTotET, awayTotET,primP.Pt());
121  pointTower.print(flag);
122  cluster.print(flag);
123  TVector3 D=pointTower.R-cluster.position;
124  printf(" XYZ(track-cluster): |3D dist|=%.1fcm delZ=%.1fcm\n",D.Mag(),D.z());
125  printf(" 4x4 :"); cl4x4.print(flag);
126  printf(" nearET/GeV: TPC=%.1f Emc=%.1f (BTOW=%.1f ETOW=%.1f) sum=%.1f\n",nearTpcPT,nearEmcET,nearBtowET,nearEtowET,nearTotET);
127  printf(" awayET/GeV: TPC=%.1f Emc=%.1f (BTOW=%.1f ETOW=%.1f) sum=%.1f\n",awayTpcPT,awayEmcET,awayBtowET,awayEtowET,awayTotET);
128  }
129 
130  private:
131  protected:
132  ClassDef(WeveEleTrack,2);
133 
134 };
135 
136 //---------------
137 class WeveVertex { // info about vertex
138  public:
139  int id; // as store do muDst list
140  float z; // cm
141  float rank,funnyRank;
142  int nEEMCMatch; //# of matched endcap towers
143  vector <WeveEleTrack> eleTrack;
144  vector <StMuTrack*> prTrList;
145 
146  void clear() {
147  id=-999; z=-999; funnyRank=-9999; rank=-9999;
148  eleTrack.clear(); nEEMCMatch=-999;
149  }
150 
151  void print( int flag=0){
152  printf(" Vertex ID=%d Z=%.1f cm nTrack=%d\n",id,z, eleTrack.size());
153  for(unsigned int i=0;i< eleTrack.size();i++)
154  eleTrack[i].print();
155  }
156 
157  private:
158  protected:
159  ClassDef(WeveVertex,1);
160 
161 };
162 
163 //---------------
164 class WeveBEMC { // info about BEMC
165  public:
166  //raw BTOW/BPRS hits
167  int tileIn[mxBTile]; // 0 if no data
168  float adcTile[mxBTile][mxBtow];
169  float eneTile[mxBTile][mxBtow];
170  int statTile[mxBTile][mxBtow];
171  float maxAdc;
172  int maxHtDsm;
173 
174  //raw BSMD hits, both planes
175  float adcBsmd[mxBSmd][mxBStrips];
176  int statBsmd[mxBSmd][mxBStrips];
177 
178  void clear() {
179  memset(adcTile,0,sizeof(adcTile));
180  memset(eneTile,0,sizeof(eneTile));
181  memset(statTile,-1,sizeof(statTile)); // default all dead
182  memset(tileIn,0,sizeof(tileIn)); // detector was On/Off
183  memset(adcBsmd,0,sizeof(adcBsmd));
184  memset(statBsmd,-1,sizeof(statBsmd));// default all dead
185  maxAdc=0;
186  maxHtDsm=-1;
187  }
188 
189  void print( int flag=0){
190  printf(" BTOW tower ADC>500 list: ");
191  for(int i=0;i< mxBtow;i++) {
192  if(adcTile[kBTow][i]<500) continue;
193  int id=i+1;
194  printf("id=%d adc=%.1f ene=%.1f; ",id,adcTile[kBTow][i],eneTile[kBTow][i]);
195  } printf("\n");
196 
197 #if 0
198  printf(" BSMDE tower ADC>200 list: ");
199  for(int i=0;i< mxBStrips;i++) {
200  if(adcBsmd[ kBSE][i]<200) continue;
201  int id=i+1;
202  int module= 1+i/150;
203  printf("id=%d mod=%d adc=%.1f ; ",id,module,adcBsmd[ kBSE][i]);
204  } printf("\n");
205 #endif
206 
207  printf(" BTOW maxAdc=%.1f maxHtDsm=%d\n",maxAdc, maxHtDsm);
208 
209  if(flag&1) {//..................
210  for(int i=0;i<120;i++) {
211  int id=7+i*40;
212  if(i%10==0) printf("\n softID=%4d adc format BTOW:BPRS= ",id);
213  printf("%.0f : %.0f, ", adcTile[kBTow][id-1], adcTile[kBPrs][id-1]);
214  }
215  printf("\n");
216  }
217  }// end of print
218 
219  private:
220  protected:
221  ClassDef(WeveBEMC,2);
222 
223 };
224 
225 //--------------
226 class WeveETOW { // info about ETOW
227  public:
228 
229  //raw ETOW hit
230  int etowIn;
231  float adc[mxEtowSec*mxEtowSub][mxEtowEta]; //[phibin][etabin]
232  float ene[mxEtowSec*mxEtowSub][mxEtowEta];
233  int stat[mxEtowSec*mxEtowSub][mxEtowEta];
234  float maxAdc;
235  int maxSec,maxSub,maxEta;
236  int maxHtDsm;
237 
238  void clear() {
239  memset(adc,0,sizeof(adc));
240  memset(ene,0,sizeof(ene));
241  memset(stat,-1,sizeof(stat)); // default all dead
242  maxAdc=0;
243  maxSec=maxSub=maxEta=0;
244  maxHtDsm=-1;
245  }
246 
247  private:
248  protected:
249  ClassDef(WeveETOW,2);
250 
251 };
252 
253 //--------------
254 class WeveEPRS { // info about EPRS
255  public:
256 
257  //raw EPRS hit
258  int eprsIn;
259  float adc[mxEtowSec*mxEtowSub][mxEtowEta][mxPrs]; //[phibin][etabin][layer]
260  float ene[mxEtowSec*mxEtowSub][mxEtowEta][mxPrs];
261  int stat[mxEtowSec*mxEtowSub][mxEtowEta][mxPrs];
262 
263  void clear() {
264  memset(adc,0,sizeof(adc));
265  memset(ene,0,sizeof(ene));
266  memset(stat,-1,sizeof(stat)); // default all dead
267  }
268 
269  private:
270  protected:
271  ClassDef(WeveEPRS,1);
272 
273 };
274 
275 //--------------
276 class WeveESMD { // info about ESMD
277  public:
278 
279  //raw ESMD hit
280  int esmdIn;
281  float adc[mxEtowSec][mxEsmdPlane][mxEsmdStrip]; //[phibin][etabin]
282  float ene[mxEtowSec][mxEsmdPlane][mxEsmdStrip];
283  int stat[mxEtowSec][mxEsmdPlane][mxEsmdStrip];
284 
285  void clear() {
286  memset(adc,0,sizeof(adc));
287  memset(ene,0,sizeof(ene));
288  memset(stat,-1,sizeof(stat)); // default all dead
289  }
290 
291  private:
292  protected:
293  ClassDef(WeveESMD,1);
294 
295 };
296 
297 
298 //---------------
299 class Wevent2011 : public TObject {
300  public:
301  // .....variables ....
302  int l2bitET,l2bitRnd;
303  int l2EbitET,l2EbitRnd;
304  int trigAwaySum[16]; //for lumi
305  int trigTotalSum; //for lumi
306 
307  int id; // eventID
308  int runNo;
309  int time;
310  float zdcRate;
311  int bx7, bx48; // raw from muDst
312  int bxStar7, bxStar48, spin4; // using spinDb or -1 if failed
313  bool zTag;
314  vector <WeveVertex> vertex;
315  WeveBEMC bemc;
316  WeveETOW etow;
317  WeveEPRS eprs;
318  WeveESMD esmd;
319 
320  // .... methods ....
321  Wevent2011() {};
322 
323  void clear() {
324  //printf("W2011event:clear()\n");
325  id=runNo=time=0;
326  zdcRate=0;
327  l2bitET=l2bitRnd=0;
328  l2EbitET=l2EbitRnd=0;
329  bx7=bx48=-1;
330  zTag=false;
331  bxStar7=bxStar48= spin4=-1;
332  vertex.clear();
333  bemc.clear();
334  etow.clear(); eprs.clear(); esmd.clear();
335  }
336 
337  //...........................
338  void print( int flag=0, int isMC=0) {
339  printf("\nmy W2011event runNo=%d ID=%d L2Wbits: ET=%d rnd=%d; muDst: bx7=%d bx48=%d nVert=%d star: Bx7m=%d, Bx48=%d, spin4=%d \n",runNo,id,l2bitET,l2bitRnd,bx7,bx48, vertex.size(),bxStar7, bxStar48, spin4);
340  int yyyymmdd, hhmmss; getGmt_day_hour( yyyymmdd, hhmmss);
341  printf(" event time is: day=%d, hour=%d (GMT)\n",yyyymmdd,hhmmss);
342 
343  for(unsigned int i=0;i< vertex.size();i++) vertex[i].print(flag);
344  bemc.print(flag);
345 
346  }// end of PRINT
347 
348  void getGmt_day_hour(int & yyyymmdd, int & hhmmss) {
349  time_t rawtime=this->time;
350  struct tm * timeinfo= gmtime ( &rawtime );
351  char buffer [80];
352  strftime (buffer,80,"%k%M%S",timeinfo);
353  //puts (buffer);
354  hhmmss=atoi(buffer);
355  strftime (buffer,80,"%G%m%d",timeinfo);
356  //puts (buffer);
357  yyyymmdd=atoi(buffer);
358  //printf("day=%d, hour=%d\n",yyyymmdd,hhmmss);
359 
360  }
361 
362  private:
363  protected:
364  ClassDef(Wevent2011,2);
365 
366 };
367 
368 #endif
369 
370 
371 // $Log: Wevent2011.h,v $
372 // Revision 1.9 2016/01/08 02:08:49 jlzhang
373 // added couples histograms and fixed a small bug
374 //
375 // Revision 1.8 2013/09/13 19:33:13 stevens4
376 // Updates to code for combined 2011+2012 result presented to spin PWG 9.12.13
377 //
378 // Revision 1.7 2013/01/15 23:26:35 fisyak
379 // add sys/types.h for APPLE
380 //
381 // Revision 1.6 2012/09/21 16:59:10 balewski
382 // added ESMD peak adjustement - partialy finished
383 //
384 // Revision 1.5 2012/08/21 18:29:16 stevens4
385 // Updates to endcap W selection using ESMD strip ratio
386 //
387 // Revision 1.4 2012/07/12 20:49:21 balewski
388 // added spin info(star: bx48, bx7, spin4) and maxHtDSM & BTOW to Wtree
389 // removed dependence of spinSortingMaker from muDst
390 // Now Wtree can be spin-sorted w/o DB
391 // rdMu.C & readWtree.C macros modified
392 // tested so far on real data run 11
393 // lot of misc. code shuffling
394 //
395 // Revision 1.3 2012/06/18 18:28:01 stevens4
396 // Updates for Run 9+11+12 AL analysis
397 //
398 // Revision 1.2 2011/02/25 06:03:56 stevens4
399 // addes some histos and enabled running on MC
400 //
401 // Revision 1.1 2011/02/10 20:33:26 balewski
402 // start
403 //
Double_t pt() const
Returns pT at point of dca to primary vertex.
Definition: StMuTrack.h:256