3 #include "StEemcTriggerSimu.h"
5 #include "StMuDSTMaker/COMMON/StMuEvent.h"
7 #include "EEfeeTPTree.h"
9 #include "EEdsm0Tree.h"
10 #include "EEdsm1Tree.h"
11 #include "EMCdsm2Tree.h"
18 StEemcTriggerSimu::compareADCfee_TRG0(){
22 for(i=0;i<EEfeeTPTree::mxTP;i++) {
23 EEfeeTP *feeTP=feeTPTreeADC->TP(i);
26 int trgHT=dsm0TreeTRG->getInpHT6bit(i);
27 int trgTPsum=dsm0TreeTRG->getInpTP6bit(i);
29 int delHT=feeTP->getOutHT()-trgHT;
30 int delTPsum=feeTP->getOutTPsum()-trgTPsum;
34 hA[10]->Fill(i,trgHT);
35 hA[11]->Fill(i,feeTP->getOutHT());
37 hA[12]->Fill(i,delHT);
45 hA[20]->Fill(i,trgTPsum);
46 hA[21]->Fill(i,feeTP->getOutTPsum());
48 hA[22]->Fill(i,delTPsum);
64 StEemcTriggerSimu::compareTRG0_TRG1(){
70 for(ch=0;ch<12;ch++) {
72 int inpTrgTPsum=dsm1TreeTRG->getInpTPsum(ch);
73 int emuTrgTPsum=dsm0TreeTRG->getOutTPsum(ch);
75 hA[150]->Fill(ch, inpTrgTPsum);
76 hA[151]->Fill(ch, emuTrgTPsum);
78 if(inpTrgTPsum!=emuTrgTPsum) {
79 hA[152]->Fill(ch, emuTrgTPsum-inpTrgTPsum);
80 hA[157]->Fill(ch, emuTrgTPsum-inpTrgTPsum);
82 if(!mMCflag) printf(
"BaD TPsum(ch=%d) out0=%d inp1=%d del=%d\n", ch, emuTrgTPsum, inpTrgTPsum, emuTrgTPsum-inpTrgTPsum );
86 int inpTrgHT=dsm1TreeTRG->getInpHT2bit(ch);
87 int emuTrgHT=dsm0TreeTRG->getOutHT2bit(ch);
89 hA[160]->Fill(ch, inpTrgHT);
90 hA[161]->Fill(ch, emuTrgHT);
92 if(inpTrgHT!=emuTrgHT) {
93 hA[162]->Fill(ch, emuTrgHT-inpTrgHT);
96 if(!mMCflag) printf(
"BaD HT2bit(ch=%d) out0=%d inp1=%d del=%d\n",ch, emuTrgHT, inpTrgHT, emuTrgHT-inpTrgHT );
99 int inpTrgHTTP=dsm1TreeTRG->getInpHTTP2bit(ch);
100 int emuTrgHTTP=dsm0TreeTRG->getOutHTTP2bit(ch);
102 hA[170]->Fill(ch, inpTrgHTTP);
103 hA[171]->Fill(ch, emuTrgHTTP);
105 if(inpTrgHTTP!=emuTrgHTTP) {
106 hA[172]->Fill(ch, emuTrgHTTP-inpTrgHTTP);
109 if(!mMCflag) printf(
"BaD HTTP2bit(ch=%d) out0=%d inp1=%d del=%d\n", ch, emuTrgHTTP, inpTrgHTTP, emuTrgHTTP-inpTrgHTTP );
113 int inpTrgTP=dsm1TreeTRG->getInpTP2bit(ch);
114 int emuTrgTP=dsm0TreeTRG->getOutTP2bit(ch);
116 hA[180]->Fill(ch, inpTrgTP);
117 hA[181]->Fill(ch, emuTrgTP);
119 if(inpTrgTP!=emuTrgTP) {
120 hA[182]->Fill(ch, emuTrgTP-inpTrgTP);
123 if(!mMCflag) printf(
"BaD TP2bit(ch=%d) out0=%d inp1=%d del=%d\n", ch, emuTrgTP, inpTrgTP, emuTrgTP-inpTrgTP );
126 int inpTrg16bit=dsm1TreeTRG->getInp16bit(ch);
127 int emuTrg16bit=dsm0TreeTRG->getOut16bit(ch);
129 hA[190]->Fill(ch, inpTrg16bit);
130 hA[191]->Fill(ch, emuTrg16bit);
132 if(inpTrg16bit!=emuTrg16bit) {
133 hA[192]->Fill(ch, emuTrg16bit-inpTrg16bit);
136 if(!mMCflag) printf(
"BaD TP2bit(ch=%d) out0=%d inp1=%d del=%d\n", ch, emuTrgTP, inpTrgTP, emuTrgTP-inpTrgTP );
143 dsm0TreeTRG->print();
144 dsm1TreeTRG->print();
153 StEemcTriggerSimu::compareTRG1_TRG2(){
160 int outJPdiff[2],outHTdiff[2],outHTTPdiff[2],outTPdiff[2];
161 int inpJPdiff[2],inpHTdiff[2],inpHTTPdiff[2],inpTPdiff[2];
163 for(ch=0;ch<2;ch++) {
165 int outE=dsm1TreeTRG->getOutEsum5bit(ch);
166 int inpE=dsm2TreeTRG->getInpEsum5bit(ibr,ch);
172 hA[501]->Fill(ch, outE);
175 dsm1TreeTRG->print();
177 hA[502]->Fill(ch, outE-inpE);
180 if(!mMCflag) printf(
"BaD 3JP Esum5bit(ch=%d) out1=%d inp2=%d diff=%d\n",ch, outE,inpE,outE-inpE);
184 int outJP=dsm1TreeTRG->getOutJP2bit(ch);
185 int inpJP=dsm2TreeTRG->getInpJP2bit(ibr,ch);
193 hA[510]->Fill(ch, inpJP);
194 hA[511]->Fill(ch, outJP);
198 dsm1TreeTRG->print();
200 hA[512]->Fill(ch, outJP-inpJP);
203 if(!mMCflag) printf(
"BaD 3JP JP2bit(ch=%d) out1=%d inp2=%d diff=%d\n",ch, outJP,inpJP,outJP-inpJP);
207 int outHT=dsm1TreeTRG->getOutHT2bit(ch);
208 int inpHT=dsm2TreeTRG->getInpHT2bit(ibr,ch);
215 hA[510]->Fill(ch+3, inpHT);
216 hA[511]->Fill(ch+3, outHT);
219 dsm1TreeTRG->print();
221 hA[512]->Fill(ch+3, outHT-inpHT);
224 if(!mMCflag) printf(
"BaD 3JP HT2bit(ch=%d) out1=%d inp2=%d diff=%d\n",ch, outHT,inpHT,outHT-inpHT);
228 int outHTTP=dsm1TreeTRG->getOutHTTP1bit(ch);
229 int inpHTTP=dsm2TreeTRG->getInpHTTP1bit(ibr,ch);
231 outHTTPdiff[ch]=outHTTP;
232 inpHTTPdiff[ch]=inpHTTP;
236 hA[510]->Fill(ch+6, inpHTTP);
237 hA[511]->Fill(ch+6, outHTTP);
239 if(outHTTP!=inpHTTP) {
241 dsm1TreeTRG->print();
243 hA[512]->Fill(ch+6, outHTTP-inpHTTP);
246 if(!mMCflag) printf(
"BaD 3JP HTTP1bit(ch=%d) out1=%d inp2=%d diff=%d\n",ch, outHTTP,inpHTTP,outHTTP-inpHTTP);
250 int outTP=dsm1TreeTRG->getOutTP1bit(ch);
251 int inpTP=dsm2TreeTRG->getInpTP1bit(ibr,ch);
258 hA[510]->Fill(ch+9, inpTP);
259 hA[511]->Fill(ch+9, outTP);
263 dsm1TreeTRG->print();
265 hA[512]->Fill(ch+9, outTP-inpTP);
268 if(!mMCflag) printf(
"BaD 3JP TP1bit(ch=%d) out1=%d inp2=%d diff=%d\n",ch, outTP,inpTP,outTP-inpTP);
274 hA[520]->Fill(1,inpJPdiff[1]-inpJPdiff[0]);
275 hA[520]->Fill(4,inpHTdiff[1]-inpHTdiff[0]);
276 hA[520]->Fill(7,inpHTTPdiff[1]-inpHTTPdiff[0]);
277 hA[520]->Fill(10,inpTPdiff[1]-inpTPdiff[0]);
279 hA[521]->Fill(1,outJPdiff[1]-outJPdiff[0]);
280 hA[521]->Fill(4,outHTdiff[1]-outHTdiff[0]);
281 hA[521]->Fill(7,outHTTPdiff[1]-outHTTPdiff[0]);
282 hA[521]->Fill(10,outTPdiff[1]-outTPdiff[0]);
291 StEemcTriggerSimu::compareTRG2_TRG3(){
293 int outEndcapJP2bit = dsm2TreeTRG->getOutEndcapJP2bit();
294 int inpEndcapJP2bit = dsm3TRG->getEndcapJPthr2bit();
297 hA[600]->Fill(chan,inpEndcapJP2bit);
298 hA[601]->Fill(chan,outEndcapJP2bit);
300 if( outEndcapJP2bit != inpEndcapJP2bit){
301 printf(
"!!! BAD EndcapJP2bit out2 = %d, inp3 = %d, diff=%d\n", outEndcapJP2bit, inpEndcapJP2bit, outEndcapJP2bit-inpEndcapJP2bit);
302 hA[602]->Fill(chan,inpEndcapJP2bit-outEndcapJP2bit);
306 int outEndcapHT2bit = dsm2TreeTRG->getOutEndcapHT2bit();
307 int inpEndcapHT2bit = dsm3TRG->getEndcapHTthr2bit();
310 hA[600]->Fill(chan,inpEndcapHT2bit);
311 hA[601]->Fill(chan,outEndcapHT2bit);
313 if( outEndcapHT2bit != inpEndcapHT2bit){
314 printf(
"!!! BAD EndcapHT2bit out2 = %d, inp3 = %d, diff=%d\n", outEndcapHT2bit, inpEndcapHT2bit, outEndcapHT2bit-inpEndcapHT2bit);
315 hA[602]->Fill(chan,inpEndcapHT2bit-outEndcapHT2bit);
319 int outEndcapSum1bit = dsm2TreeTRG->getOutEndcapSum1bit();
320 int inpEndcapSum1bit = dsm3TRG->getEndcapEsumthr1bit();
323 hA[600]->Fill(chan,inpEndcapSum1bit);
324 hA[601]->Fill(chan,outEndcapSum1bit);
327 if( outEndcapSum1bit != inpEndcapSum1bit){
328 printf(
"!!! BAD EndcapSum1bit out2 = %d, inp3 = %d, diff=%d\n", outEndcapSum1bit, inpEndcapSum1bit, outEndcapSum1bit-inpEndcapSum1bit);
329 hA[602]->Fill(chan,inpEndcapSum1bit-outEndcapSum1bit);
333 int outEndcapHTTP1bit = dsm2TreeTRG->getOutEndcapHTTP1bit();
334 int inpEndcapHTTP1bit = dsm3TRG->getEndcapHTTPthr1bit();
337 hA[600]->Fill(chan,inpEndcapHTTP1bit);
338 hA[601]->Fill(chan,outEndcapHTTP1bit);
340 if( outEndcapHTTP1bit != inpEndcapHTTP1bit){
341 printf(
"!!! BAD EndcapHTTP1bit out2 = %d, inp3 = %d, diff=%d\n", outEndcapHTTP1bit, inpEndcapHTTP1bit, outEndcapHTTP1bit-inpEndcapHTTP1bit);
342 hA[602]->Fill(chan,inpEndcapHTTP1bit-outEndcapHTTP1bit);
346 int outEndcapTP1bit = dsm2TreeTRG->getOutEndcapTP1bit();
347 int inpEndcapTP1bit = dsm3TRG->getEndcapTPthr1bit();
350 hA[600]->Fill(chan,inpEndcapTP1bit);
351 hA[601]->Fill(chan,outEndcapTP1bit);
353 if( outEndcapTP1bit != inpEndcapTP1bit){
354 printf(
"!!! BAD EndcapTP1bit out2 = %d, inp3 = %d, diff=%d\n", outEndcapTP1bit, inpEndcapTP1bit, outEndcapTP1bit-inpEndcapTP1bit);
355 hA[602]->Fill(chan,inpEndcapTP1bit-outEndcapTP1bit);
360 int outBarreJP2bit = dsm2TreeTRG->getOutBarreJP2bit();
361 int inpBarreJP2bit = dsm3TRG->getBarreJPthr2bit();
364 hA[610]->Fill(ch,inpBarreJP2bit);
365 hA[611]->Fill(ch,outBarreJP2bit);
367 if( outBarreJP2bit != inpBarreJP2bit){
368 printf(
"!!! BAD BarreJP2bit out2 = %d, inp3 = %d, diff=%d\n", outBarreJP2bit, inpBarreJP2bit, outBarreJP2bit-inpBarreJP2bit);
369 hA[612]->Fill(ch,inpBarreJP2bit-outBarreJP2bit);
373 int outBarreHT2bit = dsm2TreeTRG->getOutBarreHT2bit();
374 int inpBarreHT2bit = dsm3TRG->getBarreHTthr2bit();
377 hA[610]->Fill(ch,inpBarreHT2bit);
378 hA[611]->Fill(ch,outBarreHT2bit);
380 if( outBarreHT2bit != inpBarreHT2bit){
381 printf(
"!!! BAD BarreHT2bit out2 = %d, inp3 = %d, diff=%d\n", outBarreHT2bit, inpBarreHT2bit, outBarreHT2bit-inpBarreHT2bit);
382 hA[612]->Fill(ch,inpBarreHT2bit-outBarreHT2bit);
386 int outBarreSum1bit = dsm2TreeTRG->getOutBarreSum1bit();
387 int inpBarreSum1bit = dsm3TRG->getBarreEsumThr1bit();
390 hA[610]->Fill(ch,inpBarreSum1bit);
391 hA[611]->Fill(ch,outBarreSum1bit);
393 if( outBarreSum1bit != inpBarreSum1bit){
394 printf(
"!!! BAD BarreSum1bit out2 = %d, inp3 = %d, diff=%d\n", outBarreSum1bit, inpBarreSum1bit, outBarreSum1bit-inpBarreSum1bit);
395 hA[612]->Fill(ch,inpBarreSum1bit-outBarreSum1bit);
399 int outBarreHTTP1bit = dsm2TreeTRG->getOutBarreHTTP1bit();
400 int inpBarreHTTP1bit = dsm3TRG->getBarreHTTPthr1bit();
403 hA[610]->Fill(ch,inpBarreHTTP1bit);
404 hA[611]->Fill(ch,outBarreHTTP1bit);
406 if( outBarreHTTP1bit != inpBarreHTTP1bit){
407 printf(
"!!! BAD BarreHTTP1bit out2 = %d, inp3 = %d, diff=%d\n", outBarreHTTP1bit, inpBarreHTTP1bit, outBarreHTTP1bit-inpBarreHTTP1bit);
408 hA[612]->Fill(ch,inpBarreHTTP1bit-outBarreHTTP1bit);
412 int outBarreTP1bit = dsm2TreeTRG->getOutBarreTP1bit();
413 int inpBarreTP1bit = dsm3TRG->getBarreTPthr1bit();
416 hA[610]->Fill(ch,inpBarreTP1bit);
417 hA[611]->Fill(ch,outBarreTP1bit);
419 if( outBarreTP1bit != inpBarreTP1bit){
420 printf(
"!!! BAD BarreTP1bit out2 = %d, inp3 = %d, diff=%d\n", outBarreTP1bit, inpBarreTP1bit, outBarreTP1bit-inpBarreTP1bit);
421 hA[612]->Fill(ch,inpBarreTP1bit-outBarreTP1bit);
425 int outBarreJPSi1bit = dsm2TreeTRG->getOutBarreJPSi1bit();
426 int inpBarreJPSi1bit = dsm3TRG->getJpsi1bit();
428 if( outBarreJPSi1bit != inpBarreJPSi1bit){
429 printf(
"!!! BAD BarreJPSi1bit out2 = %d, inp3 = %d, diff=%d\n", outBarreJPSi1bit, inpBarreJPSi1bit, outBarreJPSi1bit-inpBarreJPSi1bit);
433 int outEtot1bit = dsm2TreeTRG->getOutEtot1bit();
434 int inpEtot1bit = dsm3TRG->getEtotThr1bit();
437 hA[620]->Fill(cha,inpEtot1bit);
438 hA[621]->Fill(cha,outEtot1bit);
440 if( outEtot1bit != outEtot1bit){
441 printf(
"!!! BAD Etot1bit out2 = %d, inp3 = %d, diff=%d\n", outEtot1bit, inpEtot1bit, outEtot1bit-inpEtot1bit);
442 hA[622]->Fill(cha,inpEtot1bit-outEtot1bit);
446 int outBarreSum = dsm2TreeTRG->getIntBarreSum();
447 if ( (outBarreSum<76) && (outBarreSum>64) ){
448 hA[690]->Fill(cha, outBarreSum);
455 StEemcTriggerSimu::compareADC0_TRG1(){
460 for(ch=0;ch<12;ch++) {
462 int inpTrgTPsum=dsm1TreeTRG->getInpTPsum(ch);
463 int emuTrgTPsum=dsm0TreeADC->getOutTPsum(ch);
466 hA[154]->Fill(ch, emuTrgTPsum);
468 if(inpTrgTPsum!=emuTrgTPsum) {
469 hA[155]->Fill(ch, emuTrgTPsum-inpTrgTPsum);
470 hA[158]->Fill(ch, emuTrgTPsum-inpTrgTPsum);
473 if(!mMCflag) printf(
"BaD TPsum(ch=%d) emu-out0=%d inp1=%d del=%d\n", ch, emuTrgTPsum, inpTrgTPsum, emuTrgTPsum-inpTrgTPsum );
477 int inpTrgHT=dsm1TreeTRG->getInpHT2bit(ch);
478 int emuTrgHT=dsm0TreeADC->getOutHT2bit(ch);
481 hA[164]->Fill(ch, emuTrgHT);
483 if(inpTrgHT!=emuTrgHT) {
484 hA[165]->Fill(ch, emuTrgHT-inpTrgHT);
488 if(!mMCflag) printf(
"BaD HT2bit(ch=%d) emu-out0=%d inp1=%d del=%d\n",ch, emuTrgHT, inpTrgHT, emuTrgHT-inpTrgHT );
491 int inpTrgHTTP=dsm1TreeTRG->getInpHTTP2bit(ch);
492 int emuTrgHTTP=dsm0TreeADC->getOutHTTP2bit(ch);
495 hA[174]->Fill(ch, emuTrgHTTP);
497 if(inpTrgHTTP!=emuTrgHTTP) {
498 hA[175]->Fill(ch, emuTrgHTTP-inpTrgHTTP);
502 if(!mMCflag) printf(
"BaD HTTP2bit(ch=%d) emu-out0=%d inp1=%d del=%d\n", ch, emuTrgHTTP, inpTrgHTTP, emuTrgHTTP-inpTrgHTTP );
505 int inpTrgTP=dsm1TreeTRG->getInpTP2bit(ch);
506 int emuTrgTP=dsm0TreeADC->getOutTP2bit(ch);
509 hA[184]->Fill(ch, emuTrgTP);
511 if(inpTrgTP!=emuTrgTP) {
512 hA[185]->Fill(ch, emuTrgTP-inpTrgTP);
516 if(!mMCflag) printf(
"BaD TP2bit(ch=%d) emu-out0=%d inp1=%d del=%d\n", ch, emuTrgTP, inpTrgTP, emuTrgTP-inpTrgTP );
532 StEemcTriggerSimu::compareADC1_TRG2(){
536 int outJPdiff[2],outHTdiff[2],outHTTPdiff[2],outTPdiff[2];
537 int inpJPdiff[2],inpHTdiff[2],inpHTTPdiff[2],inpTPdiff[2];
539 for(ch=0;ch<2;ch++) {
541 int outJP=dsm1TreeADC->getOutJP2bit(ch);
542 int inpJP=dsm2TreeTRG->getInpJP2bit(ibr,ch);
551 hA[514]->Fill(ch, outJP);
558 hA[515]->Fill(ch, outJP-inpJP);
561 if(!mMCflag) printf(
"BaD 3JP JP2bit(ch=%d) emu-out1=%d inp2=%d diff=%d\n",ch, outJP,inpJP,outJP-inpJP);
565 int outHT=dsm1TreeADC->getOutHT2bit(ch);
566 int inpHT=dsm2TreeTRG->getInpHT2bit(ibr,ch);
574 hA[514]->Fill(ch+3, outHT);
580 hA[515]->Fill(ch+3, outHT-inpHT);
583 if(!mMCflag) printf(
"BaD 3JP HT2bit(ch=%d) emu-out1=%d inp2=%d diff=%d\n",ch, outHT,inpHT,outHT-inpHT);
587 int outHTTP=dsm1TreeADC->getOutHTTP1bit(ch);
588 int inpHTTP=dsm2TreeTRG->getInpHTTP1bit(ibr,ch);
590 outHTTPdiff[ch]=outHTTP;
591 inpHTTPdiff[ch]=inpHTTP;
596 hA[514]->Fill(ch+6, outHTTP);
598 if(outHTTP!=inpHTTP) {
603 hA[515]->Fill(ch+6, outHTTP-inpHTTP);
606 if(!mMCflag) printf(
"BaD 3JP HTTP1bit(ch=%d) emu-out1=%d inp2=%d diff=%d\n",ch, outHTTP,inpHTTP,outHTTP-inpHTTP);
610 int outTP=dsm1TreeADC->getOutTP1bit(ch);
611 int inpTP=dsm2TreeTRG->getInpTP1bit(ibr,ch);
619 hA[514]->Fill(ch+9, outTP);
626 hA[515]->Fill(ch+9, outTP-inpTP);
629 if(!mMCflag) printf(
"BaD 3JP TP1bit(ch=%d) emu-out1=%d inp2=%d diff=%d\n",ch, outTP,inpTP,outTP-inpTP);
637 for(ibr=0;ibr<EMCdsm2Tree::Nbe2;ibr++) {
638 for(ch=0;ch<2;ch++) {
640 int outE = dsm2TreeADC->getInpEsum5bit(ibr,ch);
641 int inpE = dsm2TreeTRG->getInpEsum5bit(ibr,ch);
643 hA[500]->Fill(jch, inpE);
644 hA[504]->Fill(jch, outE);
647 hA[505]->Fill(jch, outE-inpE);
649 if(!mMCflag) printf(
"BaD Esum5bit(ibr=%d,ch=%d) adcOut1=%d trgInp2=%d diff=%d\n",ibr,ch, outE,inpE,outE-inpE);
658 StEemcTriggerSimu::compareADC2_TRG3(){
660 int outEtot=dsm2TreeADC->getOutEtot1bit();
661 int inpEtot=dsm3TRG->getEtotThr1bit();
666 hA[624]->Fill(ch, outEtot);
668 if(outEtot!=inpEtot){
670 hA[625]->Fill(ch, outEtot-inpEtot);
673 if(!mMCflag) printf(
"BaD Etot 1bit emu-out2=%d inp3=%d, diff=%d\n", outEtot, inpEtot, outEtot-inpEtot);
680 StEemcTriggerSimu::DSM2EsumSpectra(){
682 int BarreEsum = dsm2TreeTRG->getIntBarreSum();
683 int adcBarreEsum = dsm2TreeADC->getIntBarreSum();
687 hA[550]->Fill(BarreEsum);
688 hA[560]->Fill(BarreEsum);
689 hA[551]->Fill(adcBarreEsum);
691 if(BarreEsum!=adcBarreEsum){
696 int EndcapEsum = dsm2TreeTRG->getIntEndcapSum();
697 int adcEndcapEsum = dsm2TreeADC->getIntEndcapSum();
701 hA[552]->Fill(EndcapEsum);
702 hA[562]->Fill(EndcapEsum);
703 hA[553]->Fill(adcEndcapEsum);
705 if(EndcapEsum!=adcEndcapEsum){
710 int Etot = dsm2TreeTRG->getIntEtot();
711 int adcEtot = dsm2TreeADC->getIntEtot();
715 hA[555]->Fill(adcEtot);