00001
00002
00003 #include <assert.h>
00004 #include <stdlib.h>
00005
00006
00007 #include <TClonesArray.h>
00008
00009 #include <TObjArray.h>
00010
00011 #include "EzEEtowerExample.h"
00012
00013 #include "StEEmcUtil/EEfeeRaw/EEfeeRawEvent.h"
00014 #include "StEEmcUtil/EEfeeRaw/EEstarTrig.h"
00015 #include "StEEmcUtil/EEfeeRaw/EEmcEventHeader.h"
00016
00017 #include "StEEmcUtil/EEfeeRaw/EEfeeDataBlock.h"
00018 #include "StEEmcUtil/EEfeeRaw/EEname2Index.h"
00019
00020 #include "StEEmcUtil/database/EEmcDbItem.h"
00021
00022
00023 #ifdef StRootFREE
00024 #include "EEmcDb/EEmcDb.h"
00025 #else
00026 #include "StEEmcUtil/database/StEEmcDb.h"
00027 #endif
00028
00029
00030 ClassImp(EzEEtowerExample)
00031
00032
00033 EzEEtowerExample::EzEEtowerExample(){
00034 printf("EzEEtowerExample() constructed\n");
00035 eHead=0;
00036 eEve=0;
00037 eTrig=0;
00038
00039 }
00040
00041
00042
00043 void EzEEtowerExample::init (){
00044 printf("EzEEtowerExample() init\n");
00045 EEtower::init();
00046 }
00047
00048
00049
00050 EzEEtowerExample::~EzEEtowerExample() {}
00051
00052
00053
00054
00055
00056 void EzEEtowerExample::make(){
00057 EEtower::clear();
00058 unpackEzTree();
00059
00060
00061 task1();
00062 }
00063
00064
00065
00066
00067 void EzEEtowerExample::unpackEzTree(){
00068 nInpEve++;
00069
00070
00071
00072 int ctbSum=0;
00073 int isl;
00074 for ( isl = 0; isl < 240; isl++ ) {
00075 ctbSum+= eTrig -> CTB[isl];
00076 }
00077
00078
00079 int nCr=0;
00080 int ic;
00081 for(ic=0;ic<eEve->block->GetEntries();ic++) {
00082 EEfeeDataBlock *b=(EEfeeDataBlock *)eEve->block->At(ic);
00083 if( !b->isValid() ) continue;
00084
00085 int crateID=b->getCrateID();
00086 if(crateID>MaxTwCrateID) continue;
00087 nCr++;
00088
00089 int chan;
00090 UShort_t* data=b->getData();
00091 int nd=b->getValidDataLen();
00092
00093 for(chan=0;chan<nd;chan++) {
00094 const EEmcDbItem *x=eeDb->getByCrate(crateID,chan);
00095 if(x==0) continue;
00096 if(x->fail ) continue;
00097
00098 float rawAdc=data[chan];
00099 if(rawAdc <x->thr) continue;
00100
00101
00102 float value=(rawAdc-x->ped)/x->gain;
00103 int iphi=(x->sec-1)*5+(x->sub-'A');
00104 int ieta=x->eta-1;
00105 assert(iphi>=0 && iphi<MaxPhiBins);
00106 assert(ieta>=0 && ieta<MaxEtaBins);
00107
00108 towerE[ieta][iphi]=value;
00109 }
00110 }
00111
00112 return ;
00113
00114 }