00001
00002
00003 #if 0
00004
00005 #include <map>
00006 #include <string>
00007 #include <algorithm>
00008 #include <iostream>
00009
00010
00011 #include "StarClassLibrary/StPhysicalHelixD.hh"
00012 #include "StarClassLibrary/StThreeVectorD.hh"
00013 #include "StarClassLibrary/StThreeVectorF.hh"
00014
00015
00016
00017 #include "StEvent/StEmcDetector.h"
00018 #include "StEvent/StEmcCollection.h"
00019 #include "StEvent/StEmcRawHit.h"
00020 #include "StEvent/StEmcModule.h"
00021
00022
00023 #include "StEmcClusterCollection.h"
00024 #include "StEmcPoint.h"
00025 #include "StEmcUtil/geometry/StEmcGeom.h"
00026 #include "StEmcUtil/others/emcDetectorName.h"
00027 #include "StEmcADCtoEMaker/StBemcData.h"
00028 #include "StEmcADCtoEMaker/StEmcADCtoEMaker.h"
00029 #include "StEmcRawMaker/defines.h"
00030 #include "StEmcRawMaker/StBemcRaw.h"
00031
00032
00033 #include "TTree.h"
00034 #include "TFriendElement.h"
00035 #include "TFile.h"
00036
00037
00038
00039
00040 #include "StMuDSTMaker/COMMON/StMuTrack.h"
00041
00042
00043
00044
00045
00046 #include "StEEmcUtil/database/cstructs/eemcConstDB.hh"
00047 #include "StEEmcUtil/EEmcGeom/EEmcGeomSimple.h"
00048 #endif
00049
00050
00051 #include "StAdcPedHistoMaker.h"
00052 #include "StEEmcUtil/database/StEEmcDb.h"
00053 #include "StEEmcUtil/database/EEmcDbItem.h"
00054
00055 #include "StMuDSTMaker/COMMON/StMuDstMaker.h"
00056 #include "StMuDSTMaker/COMMON/StMuDst.h"
00057 #include "StMuDSTMaker/COMMON/StMuTriggerIdCollection.h"
00058 #include "StMuDSTMaker/COMMON/StMuEvent.h"
00059
00060 ClassImp(StAdcPedHistoMaker)
00061
00062
00063
00064
00065 StAdcPedHistoMaker::StAdcPedHistoMaker(const char* name, StMuDstMaker* uDstMaker)
00066 : StMaker(name), mDstMaker(uDstMaker) {
00067 HList=0;
00068 pedSub=false;
00069 killMask=0;
00070 SetTrigId(0);
00071 cout <<"StAdcPedHistoMaker::StAdcPedHistoMaker()"<<endl;
00072 }
00073
00074
00075
00076
00077
00078
00079 StAdcPedHistoMaker::~StAdcPedHistoMaker()
00080 {
00081 cout <<"StAdcPedHistoMaker::~StAdcPedHistoMaker()"<<endl;
00082 }
00083
00084
00085
00086
00087
00088
00089 Int_t
00090 StAdcPedHistoMaker::Init() {
00091 mEeDb = (StEEmcDb*)this->GetDataSet("StEEmcDb");
00092 assert(mEeDb);
00093 return kStOk;
00094 }
00095
00096
00097
00098
00099 Int_t StAdcPedHistoMaker::InitRun(int runNo){
00100
00101 assert(mEeDb);
00102
00103 int i,k=0;
00104 for(i=0;i<EEindexMax;i++) {
00105 const EEmcDbItem *x=mEeDb->getByIndex(i);
00106 if(x==0) continue;
00107
00108 k++;
00109 char tt1[100],tt2[200];
00110 sprintf(tt1,"a%s",x->name);
00111 sprintf(tt2,"ADC for %s, cr/chan=%3.3d/%3.3d, tube=%s; ADC",x->name,
00112 x->crate,x->chan,x->tube);
00113 TH1F* h=new TH1F(tt1,tt2,500,-20.5,479.5);
00114 hPix[i]=h;
00115 HList->Add(h);
00116 }
00117
00118 printf("StAdcPedHistoMaker::InitRun() setup: pedSub=%d killMask=0x%0x trigId=%d\n", pedSub, killMask, trigID);
00119 return kStOk;
00120 }
00121
00122
00123
00124 Int_t
00125 StAdcPedHistoMaker::Finish()
00126 {
00127 return kStOk;
00128 }
00129
00130
00131
00132 Int_t
00133 StAdcPedHistoMaker::Make(){
00134
00135 StMuEvent *event = mDstMaker -> muDst() -> event();
00136
00137 StMuTriggerIdCollection tic = event -> triggerIdCollection();
00138 StTriggerId l1trig = tic.l1();
00139 if( trigID && !l1trig.isTrigger(trigID)) return kStOk;
00140
00141
00142
00143
00144 StMuEmcCollection* emc = mDstMaker->muDst()->muEmcCollection();
00145 assert(emc);
00146
00147
00148 const int nEndcapTowers=720;
00149 for(int i=0;i<nEndcapTowers;i++){
00150 int sec,eta,sub,val;
00151 emc->getEndcapTowerADC(i,val,sec,sub,eta);
00152 const EEmcDbItem *x=mEeDb -> getTile(sec,'A'+sub-1,eta,'T');
00153 if(x==0) continue;
00154 float adc=val;
00155 if(pedSub) adc-=x->ped;
00156 if(killMask) {
00157 if(x->fail ) continue;
00158 if(x->stat & killMask) continue;
00159 }
00160 hPix[x->key]->Fill(adc);
00161 }
00162
00163
00164 int pNh= emc->getNEndcapPrsHits();
00165 for (int i=0; i < pNh; i++) {
00166 int pre, sec, eta, sub;
00167
00168 StMuEmcHit *hit=emc->getEndcapPrsHit(i,sec,sub,eta,pre);
00169 float adc=hit->getAdc();
00170
00171 const EEmcDbItem *x=mEeDb -> getTile(sec,sub-1+'A', eta, pre-1+'P');
00172 if(x==0) continue;
00173 if(pedSub) adc-=x->ped;
00174 if(killMask) {
00175 if(x->fail ) continue;
00176 if(x->stat & killMask) continue;
00177 }
00178 hPix[x->key]->Fill(adc);
00179 }
00180
00181
00182 char uv='U';
00183 for(uv='U'; uv <= 'V'; uv++) {
00184 int sec, strip;
00185 int nh= emc->getNEndcapSmdHits(uv);
00186 for (int i=0; i < nh; i++) {
00187 StMuEmcHit *hit=emc->getEndcapSmdHit(uv,i,sec,strip);
00188 float adc=hit->getAdc();
00189 const EEmcDbItem *x=mEeDb -> getByStrip(sec,uv,strip);
00190 if(x==0) continue;
00191 if(pedSub) adc-=x->ped;
00192 if(killMask) {
00193 if(x->fail ) continue;
00194 if(x->stat & killMask) continue;
00195 }
00196 hPix[x->key]->Fill(adc);
00197 }
00198 }
00199 return kStOk;
00200 }
00201
00202