7 #include <StMuDSTMaker/COMMON/StMuDstMaker.h>
8 #include <StMuDSTMaker/COMMON/StMuDst.h>
9 #include <StMuDSTMaker/COMMON/StMuTriggerIdCollection.h>
10 #include <StMuDSTMaker/COMMON/StMuEvent.h>
11 #include <StMuDSTMaker/COMMON/StMuTrack.h>
12 #include <StMuDSTMaker/COMMON/StMuPrimaryVertex.h>
14 #include "StEEmcUtil/database/StEEmcDb.h"
15 #include "StEEmcUtil/database/EEmcDbItem.h"
17 #include "St2011WMaker.h"
22 St2011WMaker::accessEndcapTrig(){
24 if(wEve->etow.maxAdc<10./60.*4096)
return -1;
25 hE[0]->Fill(
"L2ewET",1.);
34 vector<unsigned int> idL=l1.triggerIds();
37 for(
unsigned int i=0;i<idL.size(); i++){
39 sprintf(txt,
"%d",idL[i]);
44 if(!tic->nominal().isTrigger(parE_l2ewTrgID))
return -2;
45 hE[0]->Fill(
"L2ewId",1.);
48 struct L2weResult2011 {
49 unsigned char trigger;
50 unsigned char highestEt;
51 unsigned short highestRDO;
54 TArrayI& l2Array = muEve->L2Result();
55 LOG_DEBUG <<Form(
"AccessL2Decision() from regular muDst: L2Ar-size=%d",l2Array.GetSize())<<endm;
56 unsigned int *l2res=(
unsigned int *)l2Array.GetArray();
57 const int EEMCW_off=35;
59 L2weResult2011 *l2algo= ( L2weResult2011 *) &l2res[EEMCW_off];
60 wEve->l2EbitET=(l2algo->trigger&2)>0;
61 wEve->l2EbitRnd=(l2algo->trigger&1)>0;
64 if(l2algo->trigger==0)
return -3;
65 printf(
" L2-jet online results below:\n");
66 for (
int k=0;k<64;k++)
67 if(l2res[k]) printf(
"k=%2d val=0x%04x\n",k,l2res[k]);
68 printf(
"L2WE_Result 4-bytes: trg bitET=%d, bitRnd=%d, highets: ET/GeV=%.2f, RDO=%d hex=0x%08x\n",wEve->l2EbitET,wEve->l2EbitRnd,l2algo->highestEt/256.*60,l2algo->highestRDO,l2res[EEMCW_off]);
72 if (mRunNo<11000111 || mRunNo>13000000) {
77 if( (wEve->l2EbitRnd || wEve->l2EbitET)==0)
return -3;
78 hE[0]->Fill(
"L2ewBits",1.);
81 hE[0]->Fill(
"L2ewRnd",1.);
82 for (
int m=0;m<90;m++){
83 int val=muEve->emcTriggerDetector().highTowerEndcap(m);
86 hE[61]->Fill(wEve->bx7);
89 if(!wEve->l2EbitET)
return -3;
90 if(wEve->l2EbitET) hE[0]->Fill(
"L2ewET",1.);
93 hE[2]->Fill(wEve->bx48);
94 hE[3]->Fill(wEve->bx7);
98 for (
int m=0;m<90;m++) {
99 int val=muEve->emcTriggerDetector().highTowerEndcap(m);
100 if(mxVal<val) mxVal=val;
101 if(wEve->l2EbitET) hE[6]->Fill(val);
102 if(val<parE_DsmThres)
continue;
103 if(wEve->l2EbitET) hE[8]->Fill(m);
106 wEve->etow.maxHtDsm=mxVal;
113 St2011WMaker::accessETOW(){
117 LOG_WARN <<
"No EMC data for this event"<<endm;
return -4;
121 const char *maxIdName=0;
122 double maxADC=0,adcSum=0;
123 int maxSec=-1,maxSub=-1,maxEta=-1;
126 for (
int i=0; i< emc->getNEndcapTowerADC(); i++) {
127 int sec,eta,sub,rawAdc;
128 emc->getEndcapTowerADC(i,rawAdc,sec,sub,eta);
130 const EEmcDbItem *x=mDbE->getTile(sec,
'A'+sub-1,eta,
'T');
132 if(x->fail )
continue;
137 assert(isec>=0 && isec<mxEtowSec);
138 assert(isub>=0 && isub<mxEtowSub);
139 assert(ieta>=0 && ieta<mxEtowEta);
141 float adc=rawAdc-x->ped;
142 if(adc<par_kSigPed*x->sigPed)
continue;
144 wEve->etow.adc[isec*mxEtowSub+isub][ieta]=adc;
146 if(x->gain<=0)
continue;
147 float ene=adc/x->gain;
151 wEve->etow.ene[isec*mxEtowSub+isub][ieta]=ene;
152 wEve->etow.stat[isec*mxEtowSub+isub][ieta]=0;
154 if(maxADC<adc) { maxIdName=x->
name; maxADC=adc; maxSec=isec; maxSub=isub; maxEta=ieta;}
159 wEve->etow.maxAdc=maxADC;
160 wEve->etow.maxSec=maxSec; wEve->etow.maxSub=maxSub; wEve->etow.maxEta=maxEta;
161 hE[31]->Fill(maxADC);
162 hE[32]->Fill(adcSum);
164 if(maxADC<par_maxADC)
return -2 ;
172 St2011WMaker::accessEPRS(){
175 LOG_WARN <<
"No EMC data for this event"<<endm;
179 int pNh= emc->getNEndcapPrsHits();
180 for (i=0; i < pNh; i++) {
184 float rawAdc=hit->
getAdc();
186 const EEmcDbItem *x=mDbE->getTile(sec,sub-1+
'A',eta,pre-1+
'P');
188 if(x->fail )
continue;
194 int iphi=isec*mxEtowSub+isub;
196 assert(isec>=0 && isec<mxEtowSec);
197 assert(isub>=0 && isub<mxEtowSub);
198 assert(ieta>=0 && ieta<mxEtowEta);
200 float adc=rawAdc-x->ped;
201 if(adc<par_kSigPed*x->sigPed)
continue;
203 wEve->eprs.adc[iphi][ieta][ipre]=adc;
205 if(x->gain<=0)
continue;
207 wEve->eprs.ene[isec*mxEtowSub+isub][ieta][ipre]=adc/x->gain;
208 wEve->eprs.stat[isec*mxEtowSub+isub][ieta][ipre]=0;
216 St2011WMaker::accessESMD(){
219 LOG_WARN <<
"No EMC data for this event"<<endm;
223 for(uv=
'U'; uv <=
'V'; uv++) {
225 int nh= emc->getNEndcapSmdHits(uv);
227 for (i=0; i < nh; i++) {
228 StMuEmcHit *hit=emc->getEndcapSmdHit(uv,i,sec,strip);
229 float rawAdc=hit->
getAdc();
230 const EEmcDbItem *x=mDbE->getByStrip(sec,uv,strip);
233 if(x->fail )
continue;
234 if(x->ped<0)
continue;
236 float adc=rawAdc-x->ped;
238 float sigPed=x->sigPed;
241 int iuv=x->plane-
'U';
242 int istr=x->strip -1;
244 assert(isec>=0 && isec<mxEtowSec);
245 assert(iuv>=0 && iuv<mxEsmdPlane);
246 assert(istr>=0 && istr<mxEsmdStrip);
247 if(x->gain<=0)
continue;
248 if(adc<par_kSigPed*sigPed)
continue;
250 wEve->esmd.adc[isec][iuv][istr]=adc;
251 wEve->esmd.ene[isec][iuv][istr]=adc/x->gain;
char name[StEEmcNameLen]
ASCII name of the channel, see Readme.
int getAdc() const
Return ADC value.
static StMuEmcCollection * muEmcCollection()
returns pointer to current StMuEmcCollection
static StMuEvent * event()
returns pointer to current StMuEvent (class holding the event wise information, e.g. event number, run number)
Collection of trigger ids as stored in MuDst.