StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
EzEEtowerExample.cxx
1 // $Id: EzEEtowerExample.cxx,v 1.2 2009/02/04 20:33:21 ogrebeny Exp $
2 
3 #include <assert.h>
4 #include <stdlib.h>
5 
6 
7 #include <TClonesArray.h>
8 
9 #include <TObjArray.h>
10 
11 #include "EzEEtowerExample.h"
12 
13 #include "StEEmcUtil/EEfeeRaw/EEfeeRawEvent.h"
14 #include "StEEmcUtil/EEfeeRaw/EEstarTrig.h"
15 #include "StEEmcUtil/EEfeeRaw/EEmcEventHeader.h"
16 
17 #include "StEEmcUtil/EEfeeRaw/EEfeeDataBlock.h"
18 #include "StEEmcUtil/EEfeeRaw/EEname2Index.h"
19 
20 #include "StEEmcUtil/database/EEmcDbItem.h"
21 
22 
23 #ifdef StRootFREE
24  #include "EEmcDb/EEmcDb.h"
25 #else
26  #include "StEEmcUtil/database/StEEmcDb.h"
27 #endif
28 
29 
30 ClassImp(EzEEtowerExample)
31 //--------------------------------------------------
32 //--------------------------------------------------
34  printf("EzEEtowerExample() constructed\n");
35  eHead=0;
36  eEve=0;
37  eTrig=0;
38 
39 }
40 
41 //--------------------------------------------------
42 //--------------------------------------------------
43 void EzEEtowerExample::init (){
44  printf("EzEEtowerExample() init\n");
45  EEtower::init();
46 }
47 
48 //--------------------------------------------------
49 //--------------------------------------------------
50 EzEEtowerExample::~EzEEtowerExample() {/* noop */}
51 
52 
53 //--------------------------------------------------
54 //--------------------------------------------------
55 //--------------------------------------------------
56 void EzEEtowerExample::make(){
57  EEtower::clear();
58  unpackEzTree();
59 
60  //print();
61  task1(); // do real analysis
62 }
63 
64 //--------------------------------------------------
65 //--------------------------------------------------
66 //--------------------------------------------------
67 void EzEEtowerExample::unpackEzTree(){
68  nInpEve++;
69  // printf(" EzEEtowerExample::getData()is called ......\n");
70 
71  // check CTB multiplicity
72  int ctbSum=0;
73  int isl;
74  for ( isl = 0; isl < 240; isl++ ) {
75  ctbSum+= eTrig -> CTB[isl];
76  }
77  //printf("ctbSum=%d \n",ctbSum);
78 
79  int nCr=0;
80  int ic;
81  for(ic=0;ic<eEve->block->GetEntries();ic++) {// over dat ablocks
82  EEfeeDataBlock *b=(EEfeeDataBlock *)eEve->block->At(ic);
83  if( !b->isValid() ) continue; // reject corrupted crates corruption
84 
85  int crateID=b->getCrateID();
86  if(crateID>MaxTwCrateID) continue; // just tower crates
87  nCr++; // count number of valid crates
88 
89  int chan;
90  UShort_t* data=b->getData();
91  int nd=b->getValidDataLen();
92 
93  for(chan=0;chan<nd;chan++) {
94  const EEmcDbItem *x=eeDb->getByCrate(crateID,chan);
95  if(x==0) continue;
96  if(x->fail ) continue; // drop broken channels
97 
98  float rawAdc=data[chan]; // raw ADC
99  if(rawAdc <x->thr) continue;
100 
101  // accept this hit
102  float value=(rawAdc-x->ped)/x->gain;
103  int iphi=(x->sec-1)*5+(x->sub-'A');
104  int ieta=x->eta-1;
105  assert(iphi>=0 && iphi<MaxPhiBins);
106  assert(ieta>=0 && ieta<MaxEtaBins);
107 
108  towerE[ieta][iphi]=value;
109  }
110  }
111 
112  return ;
113 
114 }
float towerE[MaxEtaBins][MaxPhiBins]
no. of input events
Definition: EEtower.h:45