8 #include <TClonesArray.h>
15 #include "EEqaSorterC.h"
17 #include "StMuDSTMaker/EZTREE/EztEmcRawData.h"
19 #include "StEEmcUtil/database/StEEmcDb.h"
20 #include "StEEmcUtil/database/EEmcDbItem.h"
23 #include "EEqaPresenter.h"
39 memset(h2D,0,
sizeof(h2D));
40 memset(hMult,0,
sizeof(hMult));
41 memset(hSmd,0,
sizeof(hSmd));
42 memset(hnHSmd,0,
sizeof(hnHSmd));
46 EEqaSorterC::~EEqaSorterC() {
47 for(
int i = 0;i < mxh;i++) {
48 if (hMult[i])
delete hMult[i];
49 if (h2D[i])
delete h2D[i];
51 memset(h2D,0,
sizeof(h2D));
52 memset(hMult,0,
sizeof(hMult));
53 if (hMAPMT)
delete hMAPMT;
55 for(
int iSec = 0;iSec < MaxSectors;iSec++) {
56 for(
int pl = 0;pl < MaxSmdPlains;pl++) {
57 if (hSmd[iSec][pl])
delete hSmd[iSec][pl];
58 if (hnHSmd[iSec][pl])
delete hnHSmd[iSec][pl];
61 memset(hSmd,0,
sizeof(hSmd));
62 memset(hnHSmd,0,
sizeof(hnHSmd));
75 for(
int icr=0;icr<t->getNBlocks();icr++) {
76 if(t->isCrateVoid(icr))
continue;
78 const UShort_t*
data=t->data(icr);
79 for(
int i=0;i<t->sizeData(icr) && i<MaxTwCrateCh;i++) {
81 const EEmcDbItem *x = eeDb ? eeDb->getByCrate(crateID,chan) : 0;
83 if(x->fail )
continue;
84 float adc=data[i]-x->ped;
85 if(adc<adcThrTw)
continue;
87 int iphi=(x->sec-1)*MaxSubSec+(x->sub-
'A');
88 h2D[0]->Fill(iphi,x->eta);
97 int nHit[mxh], nSmdH[MaxSectors][MaxSmdPlains];
98 memset(nHit,0,
sizeof(nHit));
99 memset(nSmdH,0,
sizeof(nSmdH));
101 for(
int icr=0;icr<s->getNBlocks();icr++) {
102 if(s->isCrateVoid(icr))
continue;
110 const UShort_t* data=s->data(icr);
111 for(
int i=0;i<s->sizeData(icr) && i<MaxMapmtCrateCh;i++) {
113 const EEmcDbItem *x = eeDb ? eeDb->getByCrate(crateID,chan) : 0;
115 if(x->fail)
continue;
121 case 'Q': thr=adcThrPrs;
break;
122 case 'R': thr=adcThrPost;
break;
124 case 'V': thr=adcThrSmd;
break;
128 float adc=data[i]-x->ped;
129 if(adc<thr)
continue;
134 int iplane =x->plane-
'U';
136 hSmd[isec][iplane]->Fill(strip);
137 nSmdH[isec][iplane]++;
141 int iphi=(x->sec-1)*MaxSubSec+(x->sub-
'A');
142 h2D[ik]->Fill(iphi,x->eta);
144 hMAPMT->Fill(crateID,x->mapmtId());
148 for(
int j=1;j<=3;j++) hMult[j]->Fill(nHit[j]);
150 for (
int j=0; j<MaxSectors; j++) {
151 for (
int pl=0; pl<MaxSmdPlains; pl++) {
152 hnHSmd[j][pl]->Fill(nSmdH[j][pl]);
158 void EEqaSorterC::initHisto(TObjArray *HList){
161 sprintf (tit,
"EEMC Tower hits>ped+%d; phibin : 1TA=0 3TA=10 5TA=20 7TA=30 9TA=40 11TA=50 ; #eta bin ",adcThrTw);
162 h2D[0] =
new TH2F(
"TowHits",tit, 60, -0.5, 59.5, 12, 0.5, 12.5);
164 addJPphiLimits( h2D[0]);
167 sprintf (tit,
"EEMC pres-1 hits>ped+%d; phi bin : 1TA=0 3TA=10 5TA=20 7TA=30 9TA=40 11TA=50 ; #eta bin ",adcThrPrs);
168 h2D[1] =
new TH2F(
"Pre1Hits",tit , 60, -0.5, 59.5, 12, 0.5, 12.5);
169 sprintf (tit,
"EEMC pres-2 hits>ped+%d; phi bin: 1TA=0 3TA=10 5TA=20 7TA=30 9TA=40 11TA=50 ; #eta bin ",adcThrPrs);
170 h2D[2] =
new TH2F(
"Pre2Hits",tit , 60, -0.5, 59.5, 12, 0.5, 12.5);
172 sprintf (tit,
"EEMC post hits>ped+%d; phi bin : 1TA=0 3TA=10 5TA=20 7TA=30 9TA=40 11TA=50 ; #eta bin ",adcThrPost);
173 h2D[3] =
new TH2F(
"PostHits",tit , 60, -0.5, 59.5, 12, 0.5, 12.5);
176 sprintf (tit,
"EEMC # Tower w/ adc>ped+%d; # Towers",adcThrTw);
177 hMult[0] =
new TH1F(
"HTow", tit, 100, -0.5, 99.5);
179 sprintf (tit,
"EEMC # Pre-1 w/ adc>ped+%d; # Tiles",adcThrPrs);
180 hMult[1] =
new TH1F(
"HPre1", tit, 100, -0.5, 199.5);
181 sprintf (tit,
"EEMC # Pre-2 w/ adc>ped+%d; # Tiles",adcThrPrs);
182 hMult[2] =
new TH1F(
"HPre2", tit, 100, -0.5, 199.5);
183 sprintf (tit,
"EEMC # Post w/ adc>ped+%d; # Tiles",adcThrPrs);
184 hMult[3] =
new TH1F(
"HPost", tit, 100, -0.5, 199.5);
188 if(HList && hMult[i]) HList->Add(hMult[i]);
189 if(HList && h2D[i]) HList->Add(h2D[i]);
192 hMAPMT=
new TH2F(
"MAPMHits",
"MAPMT Hits adc>ped+thr; crateID ; tube no.", 48, 63.5, 111.5, 12, 0.5, 12.5);
193 if (HList && hMAPMT) HList->Add(hMAPMT);
196 for(iSec=0; iSec<MaxSectors; iSec++) {
197 char cid[50], ctitl[50];
199 for(pl=0;pl<MaxSmdPlains;pl++) {
201 sprintf (cid,
"SmdA%d%c",iSec+1,uv);
202 sprintf (ctitl,
"ESMD %02d%c adc>ped+%02d;"
203 "Strip no.", iSec+1,uv, adcThrSmd);
204 hSmd[iSec][pl] =
new TH1F(cid, ctitl, 290, -0.5, 289.5);
205 if (HList && hSmd[iSec][pl]) HList->Add(hSmd[iSec][pl]);
207 sprintf (cid,
"HSmd%d%c",iSec+1,uv);
208 sprintf (ctitl,
"ESMD %02d%c Hits/eve adc>ped+%d; No. Hits", iSec+1, uv,adcThrSmd);
209 hnHSmd[iSec][pl] =
new TH1F(cid, ctitl, 100, -0.5, 99.5);
210 if (HList && hnHSmd[iSec][pl]) HList->Add(hnHSmd[iSec][pl]);
217 void EEqaSorterC::saveHisto(TFile *f)
const {
219 for(
int i = 0;i < mxh;i++) {
220 if (hMult[i]) hMult[i]->Write();
221 if (h2D[i]) h2D[i]->Write();
223 if (hMAPMT) hMAPMT->Write();
224 for(
int iSec = 0;iSec < MaxSectors;iSec++) {
225 for(
int pl = 0;pl < MaxSmdPlains;pl++) {
226 if (hSmd[iSec][pl]) hSmd[iSec][pl]->Write();
227 if (hnHSmd[iSec][pl]) hnHSmd[iSec][pl]->Write();
233 void EEqaSorterC::resetHisto() {
234 for(
int i = 0;i < mxh;i++) {
235 if (hMult[i]) hMult[i]->Reset();
236 if (h2D[i]) h2D[i]->Reset();
238 if (hMAPMT) hMAPMT->Reset();
239 for(
int iSec = 0;iSec < MaxSectors;iSec++) {
240 for(
int pl = 0;pl < MaxSmdPlains;pl++) {
241 if (hSmd[iSec][pl]) hSmd[iSec][pl]->Reset();
242 if (hnHSmd[iSec][pl]) hnHSmd[iSec][pl]->Reset();
248 void EEqaSorterC::initRun() {
char name[StEEmcNameLen]
ASCII name of the channel, see Readme.