00001
00002
00003
00004
00005 #include <TFile.h>
00006 #include <TH2.h>
00007
00008 #include "StEEtowerExampleMaker.h"
00009
00010 #include "StMuDSTMaker/COMMON/StMuEvent.h"
00011 #include "StMuDSTMaker/COMMON/StMuDst.h"
00012 #include "StMuDSTMaker/COMMON/StMuDstMaker.h"
00013
00014 #include <StMessMgr.h>
00015
00016 #include "StEEmcUtil/database/EEmcDbItem.h"
00017 #include "StEEmcUtil/database/StEEmcDb.h"
00018
00019
00020 ClassImp(StEEtowerExampleMaker)
00021
00022
00023
00024 StEEtowerExampleMaker::StEEtowerExampleMaker(const char* self ,const char* muDstMakerName) : StMaker(self){
00025 mMuDstMaker = (StMuDstMaker*)GetMaker(muDstMakerName);
00026 assert(mMuDstMaker);
00027 }
00028
00029
00030
00031
00032 StEEtowerExampleMaker::~StEEtowerExampleMaker(){
00033 }
00034
00035
00036
00037
00038 Int_t StEEtowerExampleMaker::Init(){
00039 eeDb = (StEEmcDb*)this->GetDataSet("StEEmcDb");
00040 EEtower::init();
00041 return StMaker::Init();
00042 }
00043
00044
00045
00046 Int_t StEEtowerExampleMaker::Finish(){
00047 finish();
00048 return kStOK;
00049 }
00050
00051
00052
00053
00054
00055
00056 Int_t StEEtowerExampleMaker::Make(){
00057
00058 EEtower::clear();
00059
00060
00061 if(unpackMuDst()<0) return kStOK;
00062
00063
00064 task1();
00065
00066 return kStOK;
00067 }
00068
00069
00070
00071
00072 Int_t StEEtowerExampleMaker::unpackMuDst(){
00073 nInpEve++;
00074 gMessMgr->Message("","D") <<GetName()<<"::::getAdc() is called "<<endm;
00075
00076
00077 StMuEmcCollection* emc = mMuDstMaker->muDst()->muEmcCollection();
00078 if (!emc) {
00079 gMessMgr->Message("","W") <<"No EMC data for this event"<<endm; return kStOK;
00080 }
00081
00082 int i, n1=0;
00083
00084 int sec,eta,sub,adc;
00085 for (i=0; i< emc->getNEndcapTowerADC(); i++) {
00086 emc->getEndcapTowerADC(i,adc,sec,sub,eta);
00087 assert(sec>0);
00088
00089 const EEmcDbItem *x=eeDb->getTile(sec,'A'+sub-1,eta,'T');
00090 if(x==0) continue;
00091 if(x->fail ) continue;
00092 if(adc <x->thr) continue;
00093 if(x->gain<=0 ) continue;
00094
00095 n1++;
00096 float value=(adc-x->ped)/x->gain;
00097 int iphi=(x->sec-1)*5+(x->sub-'A');
00098 int ieta=x->eta-1;
00099 assert(iphi>=0 && iphi<MaxPhiBins);
00100 assert(ieta>=0 && ieta<MaxEtaBins);
00101
00102 towerE[ieta][iphi]=value;
00103
00104 }
00105
00106 gMessMgr->Message("","I") <<GetName()<<"::::getAdc() found "<<n1<<" ADC>thres "<<endm;
00107 return n1;
00108 }
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123