11 #define EEmapTP_USE // trick instattiates data only in the cxx
12 #include "StTriggerUtilities/Eemc/EEmapTP.h"
15 #include "StTriggerUtilities/Eemc/EEdsm0.h"
16 #include "StTriggerUtilities/Eemc/EEdsm1.h"
17 #include "StTriggerUtilities/Eemc/EEdsm2.h"
18 #include "StTriggerUtilities/Eemc/EEdsm3.h"
20 #include "StTriggerUtilities/StDSMUtilities/DSM.hh"
21 #include "StTriggerUtilities/StDSMUtilities/DSMAlgo_EE101_2009.hh"
22 #include "StTriggerUtilities/StDSMUtilities/DSMAlgo_EE102_2009.hh"
31 , EE101(*new
DSM("EE101"))
32 , EE102(*new
DSM("EE102"))
47 ee0outTPadc =
new int [Nee0out];
48 ee0outHTadc =
new int [Nee0out];
51 ped0 =
new int *[Nee0];
52 for (
int ibr = 0;ibr < Nee0; ibr++) {
53 ped0[ibr] =
new int [ee0[ibr].getNc()];
54 for(
int ch = 0;ch < ee0[ibr].getNc();ch++)
61 for(
int i = 0;i < Nee1;i++) ee1[i].setYear(mYear, mJPthr, TPthrSelc, HTTPthrSelc);
64 ee1out3JPadc =
new int [Nee1];
71 for(
int i = 0;i < Nbe2;i++)
72 be2[i].setYear(mYear);
82 EE101.registers[0] = EE102.registers[0] = 32;
83 EE101.registers[1] = EE102.registers[1] = 40;
84 EE101.registers[2] = EE102.registers[2] = 60;
90 EEdsmAna::~EEdsmAna() {
96 void EEdsmAna::clear() {
98 for (
int i=0;i<Nee0;i++)
if (ee0) ee0[i].clear();
99 for (
int i=0;i<Nee0out;i++) {
100 if (ee0outTPadc) ee0outTPadc[i]=0;
101 if (ee0outHTadc) ee0outHTadc[i]=0;
104 for (
int i=0;i<Nee1;i++) {
105 if (ee1) ee1[i].clear();
106 if (ee1out3JPadc) ee1out3JPadc[i]=0;
109 memset(ee1outTPthrMax, 0,
sizeof(ee1outTPthrMax));
110 memset(ee1outHTTPthrMax, 0,
sizeof(ee1outHTTPthrMax));
112 for (
int i=0;i<EEnJetPatch;i++) {
118 for (
int i = 0;i < EEnHalf;i++) {
119 ee1outTPthrMax[i] = 0;
120 ee1outHTTPthrMax[i] = 0;
123 if (ee2) ee2->clear();
126 for (
int i=0;i<Nbe2;i++)
127 if (be2) be2[i].clear();
129 if (ee3) ee3->clear();
133 void EEdsmAna::initHisto(TObjArray *HList){
135 for(
int iJ = 0;iJ < EEnJetPatch;iJ++) {
136 H0inHT[iJ] =
new TH2F(Form(
"dsm0inJP%d_HT", iJ + 1),
137 Form(
"HT input, DSM layer-0, Jet Patch %d (Steve), trig=%s;input 0-DSM ADC value;Trig Patch ID", iJ + 1, myName),
138 64, -0.5, 63.5, EEnTPinJP, 0.5, EEnTPinJP + 0.5);
139 if (HList) HList->Add(H0inHT[iJ]);
142 H0inHTall =
new TH2F(
"dsm0inJPall_HT",
143 Form(
"HT input, DSM layer-0, all trig Patches, trig=%s; Hanks ID=10*brd+inpID", myName),
144 90, -0.5, 89.5, 64, -0.5, 63.5);
145 if (HList) HList->Add(H0inHTall);
148 for(
int iJ = 0;iJ < EEnJetPatch;iJ++) {
149 H0inTP[iJ] =
new TH2F(Form(
"dsm0inJP%d_TP", iJ + 1),
150 Form(
"TP input, DSM layer-0, Jet Patch %d (Steve), trig=%s;input to level 0;Trig Patch ID", iJ + 1,myName),
151 64, -0.5, 63.5, EEnTPinJP, 0.5, EEnTPinJP + 0.5);
152 if (HList) HList->Add(H0inTP[iJ]);
155 H0inTPall =
new TH2F(
"dsm0inJPall_TP", Form(
"TP input, DSM layer-0, all trig Patches, trig=%s", myName),
156 90, -0.5, 89.5, 64, -0.5, 63.5);
157 if (HList) HList->Add( H0inTPall);
162 for(
int iJ = 0;iJ < EEnHalfJetPatch;iJ++) {
163 H1inTPvEmu[iJ] =
new TH2F(Form(
"dsm1HJP%d_TP", iJ + 1),
164 Form(
"TP input vs. emulated, DSM layer-1, brd=%d ch=%d, trig=%s;emulated TP from level-0;input to level-1", iJ/6, iJ%6, myName),
165 40, 0., 400, 40, 0, 400);
166 if (HList) HList->Add(H1inTPvEmu[iJ]);
170 for(
int iJ = 0;iJ < EEnHalfJetPatch;iJ++) {
171 H1inHTvEmu[iJ] =
new TH2F(Form(
"dsm1HJP%d_HT", iJ + 1),
172 Form(
"HT input vs.emu, DSM-1, Half Patch %d (Falk), trig=%s;emulated HT from level-0;input to level-1", iJ + 1, myName),
173 64, -0.5, 63.5, 4, -0.5, 3.5);
174 if (HList) HList->Add(H1inHTvEmu[iJ]);
180 for(
int iJ = 0;iJ < EEnHalf;iJ++) {
181 H2inHTTP[iJ] =
new TH2F(Form(
"dsm2Half%d_HTTP", iJ + 1),
182 Form(
"TP (+) HTTP thres, JP_Falk(%d+%d+%d), trig=%s;emu layer1 out: maxTPthr*4 + maxHTTPthr;layer2 inp: TPthr*2 + HTTP",
183 3*iJ, (3*iJ) + 1, (3*iJ) + 2, myName),
184 16, -0.5, 15.5, 4, -0.5, 3.5);
185 if (HList) HList->Add(H2inHTTP[iJ]);
189 for(
int iJ = 0;iJ < EEnHalf;iJ++) {
190 H1inEtot[iJ] =
new TH1F(Form(
"dsm2Half%d_Etot", iJ + 1),
191 Form(
"Etot for JP_Falk(%d+%d+%d), trig=%s; level2 input", 3*iJ, (3*iJ) + 1, (3*iJ) + 2, myName),
193 if (HList) HList->Add(H1inEtot[iJ]);
197 for(
int iJ = 0;iJ < mxEtotBit;iJ++) {
198 HEetot[iJ] =
new TH1F(Form(
"dsm2E_etot%d", iJ),
199 Form(
"EEMC ETOT BIT=%d, trig=%s; EEMC ETOT emul sum over 1 brd @ level2", iJ, myName),
201 HEetot[iJ]->SetLineColor((iJ == 1) ? kRed : kBlue);
202 if (HList) HList->Add(HEetot[iJ]);
204 HBetot[iJ] =
new TH1F(Form(
"dsm2B_etot%d", iJ),
205 Form(
"BEMC ETOT BIT=%d, trig=%s; BEMC ETOT emul sum over 3 brds @ level2", iJ, myName),
207 HBetot[iJ]->SetLineColor((iJ == 1) ? kRed : kBlue);
208 if (HList) HList->Add(HBetot[iJ]);
210 HBEetot[iJ] =
new TH1F(Form(
"dsm2BE_etot%d", iJ),
211 Form(
"B+EEMC ETOT BIT=%d, trig=%s; B+EEMC ETOT emul sum over 4 brds @ level2", iJ, myName),
213 HBEetot[iJ]->SetLineColor((iJ == 1) ? kRed : kBlue);
214 if (HList) HList->Add(HBEetot[iJ]);
219 H3inHTTP =
new TH2F(
"dsm3_HTTP", Form(
"HTTP layer=3, trig=%s;emu layer2 out: orTPbit*2 + orHTTPbit;layer3 inp: TPbit*2 + HTTPbit", myName),
220 4, -0.5, 3.5, 4, -0.5, 3.5);
221 if (HList) HList->Add(H3inHTTP);
225 for(
int iJ = 0;iJ < EEnJetPatch;iJ++) {
226 int steve_jp = ((iJ + 2) % EEnJetPatch) + 1;
227 H4jpSums[iJ] =
new TH1F(Form(
"JP%d_sum", steve_jp),
228 Form(
"Emulated Sum Jet Patch %d (DSMin %d);Jet Patch Emu Sum;Freq", ((iJ + 2) % EEnJetPatch) + 1, iJ),
230 if (HList) HList->Add(H4jpSums[iJ]);
234 static const char* JetPatchSumThresholdTitles[] = {
235 "Jet Patch Sum <= JP0",
236 "JP0 < Jet Patch Sum <= JP1",
237 "JP1 < Jet Patch Sum <= JP2",
238 "Jet Patch Sum > JP2"
241 for (
int iJ = 0;iJ < EEnThresh;iJ++) {
242 TH1F *h =
new TH1F(Form(
"JPsumTh%d", iJ), JetPatchSumThresholdTitles[iJ], 6, 0.5, 6.5);
243 h->GetXaxis()->SetTitle(
"Steve's Jet Patch ID");
244 h->GetYaxis()->SetTitle(
"Frequency");
245 h->SetFillColor(kBlue);
247 if (HList) HList->Add(h);
251 for(
int iJ = 0;iJ < EEnJetPatch;iJ++) {
252 int steve_jp = ((iJ + 2) % EEnJetPatch) + 1;
253 int steve_jp2 = ((iJ + 3) % EEnJetPatch) + 1;
254 H4adjpSums[iJ] =
new TH1F(Form(
"JP%d%d_sum", steve_jp, steve_jp2),
255 Form(
"Emulated Sum Jet Patches %d+%d;Jet Patch Emu Sum;Freq", steve_jp, steve_jp2),
257 if (HList) HList->Add(H4adjpSums[iJ]);
261 for(
int iJ = 0;iJ < EEnJetPatch;iJ++) {
262 int steve_jp = ((iJ + 2) % EEnJetPatch) + 1;
263 int steve_jp2 = ((iJ + 3) % EEnJetPatch) + 1;
264 H4adjPcor[iJ] =
new TH2F(Form(
"JP%d%d_cor", steve_jp, steve_jp2),
265 Form(
"Emulated Sum Jet Patches %d vs %d;Jet Patch %d Sum;Jet Patch %d Sum", steve_jp, steve_jp2, steve_jp, steve_jp2),
266 60, 9.5, 69.5, 60, 9.5,69.5);
267 if (HList) HList->Add(H4adjPcor[iJ]);
271 H4adjpFreq =
new TH1F(
"JPadjTh",
"Adjacent Jet patches both over thr0;DSM Adjacent Jet Patch Emu Sum (FEE crate add 2);Freq",
273 if (HList) HList->Add(H4adjpFreq);
278 H5jpPed =
new TH2F(
"JPpedZoom",
"Zoom in of 1x1 JP pedestals;Steve's JP ID",
279 EEnJetPatch, 0.5, EEnJetPatch + 0.5, 46, -0.5, 45.5);
280 if (HList) HList->Add(H5jpPed);
284 H5jpFreq =
new TH1F(
"JPtotFreq", Form(
"JP DSM sum > %d;Steve's JP ID", mJPthr[1]),
285 EEnJetPatch, 0.5, EEnJetPatch + 0.5);
286 H5jpFreq->SetFillColor(kGreen);
287 if (HList) HList->Add(H5jpFreq);
289 H5jpHot =
new TH1F(
"JPpedHot",
"Hot towers;Steve's JP ID",
290 EEnJetPatch, 0.5, EEnJetPatch + 0.5);
291 H5jpHot->SetFillColor(kRed);
292 if (HList) HList->Add(H5jpHot);
297 void EEdsmAna::resetHisto(){
299 for(
int iJ = 0;iJ < EEnJetPatch;iJ++) {
300 if (H0inHT[iJ]) H0inHT[iJ]->Reset();
302 if (H0inHTall) H0inHTall->Reset();
304 for(
int iJ = 0;iJ < EEnJetPatch;iJ++) {
305 if (H0inTP[iJ]) H0inTP[iJ]->Reset();
307 if (H0inTPall) H0inTPall->Reset();
311 for(
int iJ = 0;iJ < EEnHalfJetPatch;iJ++) {
312 if (H1inTPvEmu[iJ]) H1inTPvEmu[iJ]->Reset();
315 for(
int iJ = 0;iJ < EEnHalfJetPatch;iJ++) {
316 if (H1inHTvEmu[iJ]) H1inHTvEmu[iJ]->Reset();
321 for(
int iJ = 0;iJ < EEnHalf;iJ++) {
322 if (H2inHTTP[iJ]) H2inHTTP[iJ]->Reset();
325 for(
int iJ = 0;iJ < EEnHalf;iJ++) {
326 if (H1inEtot[iJ]) H1inEtot[iJ]->Reset();
330 for(
int iJ = 0;iJ < mxEtotBit;iJ++) {
331 if (HEetot[iJ]) HEetot[iJ]->Reset();
332 if (HBetot[iJ]) HBetot[iJ]->Reset();
333 if (HBEetot[iJ]) HBEetot[iJ]->Reset();
338 if (H3inHTTP) H3inHTTP->Reset();
342 for(
int iJ = 0;iJ < EEnJetPatch;iJ++) {
343 if (H4jpSums[iJ]) H4jpSums[iJ]->Reset();
346 for (
int iJ = 0;iJ < EEnThresh;iJ++) {
347 if (H4jpFreq[iJ]) H4jpFreq[iJ]->Reset();
350 for(
int iJ = 0;iJ < EEnJetPatch;iJ++) {
351 if (H4adjpSums[iJ]) H4adjpSums[iJ]->Reset();
354 for(
int iJ = 0;iJ < EEnJetPatch;iJ++) {
355 if (H4adjPcor[iJ]) H4adjPcor[iJ]->Reset();
358 if (H4adjpFreq) H4adjpFreq->Reset();
362 if (H5jpPed) H5jpPed->Reset();
365 if (H5jpFreq) H5jpFreq->Reset();
366 if (H5jpHot) H5jpHot->Reset();
372 void EEdsmAna::sort(
const unsigned char * dsm0inp,
373 const unsigned short int * dsm1inp,
374 const unsigned short int * dsm2inp,
375 const unsigned short int * dsm3inp) {
378 if (dsm0inp) readDsm0(dsm0inp);
379 if (dsm1inp) readDsm1(dsm1inp);
380 if(dsm2inp) readDsm2(dsm2inp);
381 if(dsm3inp) readDsm3(dsm3inp);
394 LOG_DEBUG <<
"==================================" << endm;
401 for(iJ=0;iJ<EEnHalf;iJ++) {
402 if(ee1outTPthrMax[iJ]>=ee1outHTTPthrMax[iJ])
continue;
403 LOG_DEBUG << Form(
"NEW_EVE==================================\n ee1outTPthrMax[%d]=%d <ee1outHTTPthrMax[%d]=%d\n",iJ,ee1outTPthrMax[iJ],iJ,ee1outHTTPthrMax[iJ]) << endm;
412 void EEdsmAna::emulDsm0() {
414 for (
int i = 0;i < EEnTPphi;i++) {
415 for(
int j = 0;j < EEnTPeta;j++) {
416 const EEmapTP &y = eeMapTP[i][j];
418 int ibr = y.brdIn - 1;
421 const EEdsm0 &br = ee0[ibr];
423 ee0outTPadc[chOut] += br.getInpTP6bit(ch);
425 int val= br.getInpHT6bit(ch);
426 if(ee0outHTadc[chOut]< val)ee0outHTadc[chOut]=val;
434 void EEdsmAna::emulDsm1() {
438 for (
int i=0;i<Nee1;i++) {
439 const EEdsm1 &br = ee1[i];
442 for(
int j=0;j<br.getNc(); j++) {
443 int ix=j+i*br.getNc();
445 ee1outJPadc[ijp]+=br.getInpTPsum(j);
447 ee1out3JPadc[i]+=br.getInpTPsum(j);
453 ee1outTPthrMax[i] =maxTPthr;
454 ee1outHTTPthrMax[i]=maxHTTPthr;
459 for (
int i=0;i<EEnJetPatch;i++) {
460 AdjJPsum[i]=ee1outJPadc[i]+ee1outJPadc[(i+1)%EEnJetPatch];
470 ee1outJPadc[0] = EE102.info[0];
471 ee1outJPadc[1] = EE102.info[1];
472 ee1outJPadc[2] = EE102.info[2];
474 ee1outJPadc[3] = EE101.info[0];
475 ee1outJPadc[4] = EE101.info[1];
476 ee1outJPadc[5] = EE101.info[2];
480 for (
int jp = 0; jp < 6; ++jp)
481 AdjJPsum[jp] = ee1outJPadc[jp] + ee1outJPadc[(jp+1)%6];
488 void EEdsmAna::emulDsm2() {
490 ee2outHT=ee2->get3JPHTthr(0);
491 if(ee2outHT<ee2->get3JPHTthr(1))ee2outHT=ee2->get3JPHTthr(1);
496 void EEdsmAna::readDsm0(
const unsigned char *EEMC) {
503 for(
int ibr = 0;ibr < Nee0;ibr++) {
506 for(
int i = 0;i < 8;i++) ee0[ibr].setBite(7 - i, EEMC[k + i]);
508 for(
int i = 8;i < 16;i++) ee0[ibr].setBite(23 - i, EEMC[k + i]);
515 void EEdsmAna::readDsm1(
const unsigned short *EEMC_l1) {
527 if (EEMC_l1 && ee1) {
528 for(
int i = 0;i < Nee1;i++) {
529 ee1[i].setWord(0, EEMC_l1[3 + i*8]);
530 ee1[i].setWord(1, EEMC_l1[2 + i*8]);
531 ee1[i].setWord(2, EEMC_l1[1 + i*8]);
532 ee1[i].setWord(3, EEMC_l1[0 + i*8]);
533 ee1[i].setWord(4, EEMC_l1[7 + i*8]);
534 ee1[i].setWord(5, EEMC_l1[6 + i*8]);
541 EE101.channels[0] = EEMC_l1[3];
542 EE101.channels[1] = EEMC_l1[2];
543 EE101.channels[2] = EEMC_l1[1];
544 EE101.channels[3] = EEMC_l1[0];
545 EE101.channels[4] = EEMC_l1[7];
546 EE101.channels[5] = EEMC_l1[6];
547 EE101.channels[6] = EEMC_l1[5];
548 EE101.channels[7] = EEMC_l1[4];
550 EE102.channels[0] = EEMC_l1[11];
551 EE102.channels[1] = EEMC_l1[10];
552 EE102.channels[2] = EEMC_l1[ 9];
553 EE102.channels[3] = EEMC_l1[ 8];
554 EE102.channels[4] = EEMC_l1[15];
555 EE102.channels[5] = EEMC_l1[14];
556 EE102.channels[6] = EEMC_l1[13];
557 EE102.channels[7] = EEMC_l1[12];
564 void EEdsmAna::readDsm2(
const unsigned short *EMC) {
565 if (EMC && ee2 && be2) {
567 ee2->setWord(0, EMC[5]);
568 ee2->setWord(1, EMC[4]);
570 be2[0].setWord(0, EMC[3]);
571 be2[0].setWord(1, EMC[2]);
572 be2[1].setWord(0, EMC[1]);
573 be2[1].setWord(1, EMC[0]);
574 be2[2].setWord(0, EMC[7]);
575 be2[2].setWord(1, EMC[6]);
580 void EEdsmAna::readDsm3(
const unsigned short *lastDSM) {
581 if (lastDSM && ee3) {
582 ee3->setWord(0, lastDSM[0]);
587 void EEdsmAna::histoDsm0() {
589 for(
int i = 0;i < EEnTPphi;i++) {
590 for(
int j = 0;j < EEnTPeta;j++) {
591 const EEmapTP &y = eeMapTP[i][j];
593 int ibr = y.brdIn - 1;
595 int iJP = y.JPid - 1;
596 if ((iJP >= 0) && (iJP < EEnJetPatch)) {
597 H0inHT[iJP]->Fill(ee0[ibr].getInpHT6bit(ch), y.TPid);
598 H0inTP[iJP]->Fill(ee0[ibr].getInpTP6bit(ch), y.TPid);
599 H0inHTall->Fill((10 * ibr) + ch, ee0[ibr].getInpHT6bit(ch));
600 H0inTPall->Fill((10 * ibr) + ch, ee0[ibr].getInpTP6bit(ch));
609 void EEdsmAna::histoDsm1(){
613 for (
int i = 0;i < Nee1;i++) {
614 const EEdsm1 &br = ee1[i];
616 for(
int j = 0;j < br.getNc();j++) {
617 int ix = j + (i * br.getNc());
619 H1inTPvEmu[ix]->Fill(ee0outTPadc[ix], br.getInpTPsum(j));
635 for (
int i = 0;i < EEnJetPatch;i++) {
636 int steve_jp = ((i + 2) % EEnJetPatch) + 1;
637 H4jpSums[i]->Fill(ee1outJPadc[i]);
638 int JPene = ee1outJPadc[i];
639 if(JPene > mJPthr[0]) H4jpFreq[0]->Fill(steve_jp);
640 if(JPene > mJPthr[3]) H4jpFreq[3]->Fill(steve_jp);
641 else if(JPene > mJPthr[2]) H4jpFreq[2]->Fill(steve_jp);
642 else if(JPene > mJPthr[1]) H4jpFreq[1]->Fill(steve_jp);
644 H5jpPed->Fill(steve_jp, ee1outJPadc[i]);
645 if (ee1outJPadc[i] > mJPthr[1]) H5jpFreq->Fill(steve_jp);
646 int j = (i + 1) % EEnJetPatch;
647 H4adjPcor[i]->Fill(ee1outJPadc[i], ee1outJPadc[j]);
648 H4adjpSums[i]->Fill(AdjJPsum[i]);
650 if ((ee1outJPadc[i] > mJPthr[1]) && (ee1outJPadc[(i + 1) % EEnJetPatch] > mJPthr[1])) H4adjpFreq->Fill(steve_jp);
664 static const int steve_jp[] = { 6, 1, 2, 3, 4, 5 };
666 for (
int jp = 0; jp < 6; ++jp) {
667 H4jpSums[jp]->Fill(ee1outJPadc[jp]);
675 if (ee1outJPadc[jp] <= EE101.registers[0])
676 H4jpFreq[0]->Fill(steve_jp[jp]);
677 else if (ee1outJPadc[jp] > EE101.registers[0] && ee1outJPadc[jp] <= EE101.registers[1])
678 H4jpFreq[1]->Fill(steve_jp[jp]);
679 else if (ee1outJPadc[jp] > EE101.registers[1] && ee1outJPadc[jp] <= EE101.registers[2])
680 H4jpFreq[2]->Fill(steve_jp[jp]);
681 else if (ee1outJPadc[jp] > EE101.registers[2])
682 H4jpFreq[3]->Fill(steve_jp[jp]);
684 H5jpPed->Fill(steve_jp[jp], ee1outJPadc[jp]);
685 if (ee1outJPadc[jp] > EE101.registers[1]) H5jpFreq->Fill(steve_jp[jp]);
687 H4adjPcor[jp]->Fill(ee1outJPadc[jp], ee1outJPadc[(jp+1)%6]);
688 H4adjpSums[jp]->Fill(AdjJPsum[jp]);
695 void EEdsmAna::histoDsm2() {
730 for(
int iJ = 0;iJ < EEnHalf;iJ++) {
731 int x = (ee1outTPthrMax[iJ] * 4) + ee1outHTTPthrMax[iJ];
732 int y = (ee2->getTPthr(iJ) * 2) + ee2->getHTTPthr(iJ);
733 H2inHTTP[iJ]->Fill(x,y);
743 for (
int iJ = 0;iJ < EEnHalf;iJ++) H1inEtot[iJ]->Fill(ee2->get3JPsum(iJ));
756 unsigned short sumE = ee2->get3JPsum(0) + ee2->get3JPsum(1);
757 HEetot[ee3->getEndcapEsumthr1bit()]->Fill(sumE);
768 unsigned short sumB = 0;
769 for(
int i = 0;i < Nbe2;i++) {
770 sumB += be2[i].get3JPsum(0);
771 sumB += be2[i].get3JPsum(1);
773 HBetot[ee3->getBarreEsumThr1bit()]->Fill(sumB);
784 HBEetot[ee3->getEtotThr1bit()]->Fill(sumB + sumE);
789 void EEdsmAna::histoDsm3() {
800 bool x_b0 = ee1outTPthrMax[0] || ee1outTPthrMax[1];
801 bool x_b1 = ee1outHTTPthrMax[0] || ee1outHTTPthrMax[1];
802 int x = (x_b1 * 2) + x_b0;
803 int y = (ee3->getEndcapHTTPthr1bit() * 2) +ee3->getEndcapTPthr1bit();
804 H3inHTTP->Fill(x, y);
809 void EEdsmAna::printDsm0map()
const {
810 printf(
"TP Map level-0 \n ");
811 for(
int j=0;j< EEnTPeta;j++)
812 printf(
" iEta=%d ",j);
814 for(
int j=0;j< EEnTPeta;j++)
815 printf(
"JP/TP brd:ch->outCh ");
816 for(
int i=0;i<EEnTPphi; i++) {
819 printf(
"\nPhi/deg=%3d ",phi);
820 for(
int j=0;j< EEnTPeta;j++) {
821 EEmapTP *y=&eeMapTP[i][j];
822 printf(
"%d/%2d %2d:%2d -> %2d ",y->JPid,y->TPid,y->brdIn,y->chIn,y->chOut);
829 void EEdsmAna::printAllEndcap(
int k)
const {
830 printf(
"\n\nEEdsmAna(%s)::print(eve=%d) , year=%d \n",myName,nTot,mYear);
831 for(
int i=0;i<Nee0;i++) {
832 printf(
"\n----------- level-0 Board %2d ",i+1);
835 printf(
"\n----------- level-0 emulated output \n ch =");
836 for(
int i=Nee0out-1;i>=0; i--) printf(
" %4d ",i);
838 for(
int i=Nee0out-1;i>=0; i--) printf(
" %4d ",ee0outTPadc[i]);
840 for(
int i=Nee0out-1;i>=0; i--) printf(
" %4d ",ee0outHTadc[i]);
841 printf(
"\n\n----------- level-1 -----------------\n ");
842 for(
int i=0;i<Nee1;i++) {
843 printf(
"\n----------- level-1 Board %2d , ",i+1);
845 printf(
"emul out 3x.9 JP_Falk(%d+%d+%d) energy/dec: 13bit=%d 8bit=%d mxTPthr=%d mxHTTPthr=%d\n",3*i,3*i+1,3*i+2,ee1out3JPadc[i],ee1out3JPadc[i]>>5, ee1outTPthrMax[i], ee1outHTTPthrMax[i]);
847 printf(
"\n----------- level-1 emulated output \n JP_Falk =");
849 for(
int i=Njp-1;i>=0; i--) printf(
" %4d ",i);
850 printf(
"\n JP_Steve=");
851 for(
int i=Njp-1;i>=0; i--) printf(
" %4d ",(i+2)%6+1);
852 printf(
"\n JPsum =");
853 for(
int i=Njp-1;i>=0; i--) printf(
" %4d ",ee1outJPadc[i]);
854 printf(
"\n HTthr =");
855 for(
int i=Njp-1;i>=0; i--) printf(
" %4d ",ee1outHT[i]);
857 printf(
"\n AdjJPsum=");
858 for(
int i=Njp-1;i>=0; i--) printf(
" %4d ",AdjJPsum[i]);
861 printf(
"emul: orTPbit=%d orHTTPbit=%d \n",ee1outTPthrMax[0]||ee1outTPthrMax[1], ee1outHTTPthrMax[0] ||ee1outHTTPthrMax[1]);
862 printf(
"\n\n----------- level-2 ----------------- \n");
864 printf(
"\n\n----------- level-3 ( aka TCU) ----------- \n");
869 void EEdsmAna::printAllBarrel(
int k)
const {
870 printf(
"\n\nBEdsmAna(%s)::print(eve=%d) , year=%d \n",myName,nTot,mYear);
871 for(
int i=0;i<Nbe2;i++) {
872 printf(
"\n----------- level-2 BARREL Board %2d ",i+1);
879 void EEdsmAna::usePed(
const Char_t *fName){
881 LOG_INFO <<
"EEdsmAna(" << myName <<
") reads pedestals from " << fName << endm;
882 FILE *fd = fopen(fName,
"r");
884 for (Int_t ibr = 0;ibr < Nee0;ibr++) {
885 for (Int_t ch = 0;ch < ee0[ibr].getNc();ch++) {
886 int a = 0, b = 0, c = 0;
887 int ret = fscanf(fd,
"%d %d %d", &a, &b, &c);
888 if ((ret == 3) && (a == (ibr + 1)) && (b == ch)) {
891 LOG_ERROR <<
"Bad file format " << fName <<
": got ret=" << ret <<
", a=" << a <<
", b=" << b <<
", c=" << c << endm;
898 LOG_ERROR <<
"Cannot read file " << fName << endm;
902 void EEdsmAna::saveHisto(TFile *f)
const {
907 for(
int iJ = 0;iJ < EEnJetPatch;iJ++) {
908 if (H0inHT[iJ]) H0inHT[iJ]->Write();
911 if (H0inHTall) H0inHTall->Write();
914 for(
int iJ = 0;iJ < EEnJetPatch;iJ++) {
915 if (H0inTP[iJ]) H0inTP[iJ]->Write();
918 if (H0inTPall) H0inTPall->Write();
923 for(
int iJ = 0;iJ < EEnHalfJetPatch;iJ++) {
924 if (H1inTPvEmu[iJ]) H1inTPvEmu[iJ]->Write();
928 for(
int iJ = 0;iJ < EEnHalfJetPatch;iJ++) {
929 if (H1inHTvEmu[iJ]) H1inHTvEmu[iJ]->Write();
935 for(
int iJ = 0;iJ < EEnHalf;iJ++) {
936 if (H2inHTTP[iJ]) H2inHTTP[iJ]->Write();
940 for(
int iJ = 0;iJ < EEnHalf;iJ++) {
941 if (H1inEtot[iJ]) H1inEtot[iJ]->Write();
945 for(
int iJ = 0;iJ < mxEtotBit;iJ++) {
946 if (HEetot[iJ]) HEetot[iJ]->Write();
948 if (HBetot[iJ]) HBetot[iJ]->Write();
950 if (HBEetot[iJ]) HBEetot[iJ]->Write();
955 if (H3inHTTP) H3inHTTP->Write();
959 for(
int iJ = 0;iJ < EEnJetPatch;iJ++) {
960 if (H4jpSums[iJ]) H4jpSums[iJ]->Write();
964 for (
int iJ = 0;iJ < EEnThresh;iJ++) {
965 if (H4jpFreq[iJ]) H4jpFreq[iJ]->Write();
969 for(
int iJ = 0;iJ < EEnJetPatch;iJ++) {
970 if (H4adjpSums[iJ]) H4adjpSums[iJ]->Write();
974 for(
int iJ = 0;iJ < EEnJetPatch;iJ++) {
975 if (H4adjPcor[iJ]) H4adjPcor[iJ]->Write();
979 if (H4adjpFreq) H4adjpFreq->Write();
984 if (H5jpPed) H5jpPed->Write();
988 if (H5jpFreq) H5jpFreq->Write();
990 if (H5jpHot) H5jpHot->Write();