StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StEemcTriggerCompare.cxx
1 #include <TH2.h>
2 #include <vector>
3 #include "StEemcTriggerSimu.h"
4 
5 #include "StMuDSTMaker/COMMON/StMuEvent.h" // for triggerID
6 
7 #include "EEfeeTPTree.h"
8 #include "EEfeeTP.h"
9 #include "EEdsm0Tree.h"
10 #include "EEdsm1Tree.h"
11 #include "EMCdsm2Tree.h"
12 #include "EEdsm3.h"
13 
14 
15 //==================================================
16 //==================================================
17 void
18 StEemcTriggerSimu::compareADCfee_TRG0(){
19 
20  // compare DSM0 inputs: ADCemul vs. TRGreal
21  int i;
22  for(i=0;i<EEfeeTPTree::mxTP;i++) {
23  EEfeeTP *feeTP=feeTPTreeADC->TP(i);
24 
25 
26  int trgHT=dsm0TreeTRG->getInpHT6bit(i);
27  int trgTPsum=dsm0TreeTRG->getInpTP6bit(i);
28 
29  int delHT=feeTP->getOutHT()-trgHT;
30  int delTPsum=feeTP->getOutTPsum()-trgTPsum;
31  bool isBad=false;
32 
33  //.... HT ..............
34  hA[10]->Fill(i,trgHT);
35  hA[11]->Fill(i,feeTP->getOutHT());
36  if(delHT!=0) {
37  hA[12]->Fill(i,delHT);
38  hA[13]->Fill(i);
39  isBad=true;
40  // printf("\nBAD HT6bit eve=%d HanksCh=%d emuAdc=%d inpTRG=%d del=%d\n ", nInpEve, i, feeTP->getHT(), trgHT, delHT);
41 
42  }
43 
44  //.... TPsum ..............
45  hA[20]->Fill(i,trgTPsum);
46  hA[21]->Fill(i,feeTP->getOutTPsum());
47  if(delTPsum!=0) {
48  hA[22]->Fill(i,delTPsum);
49  hA[23]->Fill(i);
50  isBad=true;
51  // printf("\nBAD TP6bit eve=%d HanksCh=%d emuAdc=%d inpTRG=%d del=%d\n ", nInpEve, i, feeTP->getTP(), trgTP, delTP);
52  }
53 
54  // if(isBad ) feeTP->print();
55 
56  }
57 
58 }
59 
60 
61 //==================================================
62 //==================================================
63 void
64 StEemcTriggerSimu::compareTRG0_TRG1(){
65 
66  int ch;
67  // printf("eveID=%d ............ verify dsm0Tree math for TRG data only............\n",eveId);
68 
69  bool isGood=true;
70  for(ch=0;ch<12;ch++) {
71 
72  int inpTrgTPsum=dsm1TreeTRG->getInpTPsum(ch);
73  int emuTrgTPsum=dsm0TreeTRG->getOutTPsum(ch);
74 
75  hA[150]->Fill(ch, inpTrgTPsum);
76  hA[151]->Fill(ch, emuTrgTPsum);
77 
78  if(inpTrgTPsum!=emuTrgTPsum) {// error found
79  hA[152]->Fill(ch, emuTrgTPsum-inpTrgTPsum);
80  hA[157]->Fill(ch, emuTrgTPsum-inpTrgTPsum);
81  hA[153]->Fill(ch);
82  if(!mMCflag) printf("BaD TPsum(ch=%d) out0=%d inp1=%d del=%d\n", ch, emuTrgTPsum, inpTrgTPsum, emuTrgTPsum-inpTrgTPsum );
83  isGood=false;
84  }
85 
86  int inpTrgHT=dsm1TreeTRG->getInpHT2bit(ch);
87  int emuTrgHT=dsm0TreeTRG->getOutHT2bit(ch);
88 
89  hA[160]->Fill(ch, inpTrgHT);
90  hA[161]->Fill(ch, emuTrgHT);
91 
92  if(inpTrgHT!=emuTrgHT) {// error found
93  hA[162]->Fill(ch, emuTrgHT-inpTrgHT);
94  hA[163]->Fill(ch);
95  isGood=false;
96  if(!mMCflag) printf("BaD HT2bit(ch=%d) out0=%d inp1=%d del=%d\n",ch, emuTrgHT, inpTrgHT, emuTrgHT-inpTrgHT );
97  }
98 
99  int inpTrgHTTP=dsm1TreeTRG->getInpHTTP2bit(ch);
100  int emuTrgHTTP=dsm0TreeTRG->getOutHTTP2bit(ch);
101 
102  hA[170]->Fill(ch, inpTrgHTTP);
103  hA[171]->Fill(ch, emuTrgHTTP);
104 
105  if(inpTrgHTTP!=emuTrgHTTP) {// error found
106  hA[172]->Fill(ch, emuTrgHTTP-inpTrgHTTP);
107  hA[173]->Fill(ch);
108  isGood=false;
109  if(!mMCflag) printf("BaD HTTP2bit(ch=%d) out0=%d inp1=%d del=%d\n", ch, emuTrgHTTP, inpTrgHTTP, emuTrgHTTP-inpTrgHTTP );
110  }
111 
112 
113  int inpTrgTP=dsm1TreeTRG->getInpTP2bit(ch);
114  int emuTrgTP=dsm0TreeTRG->getOutTP2bit(ch);
115 
116  hA[180]->Fill(ch, inpTrgTP);
117  hA[181]->Fill(ch, emuTrgTP);
118 
119  if(inpTrgTP!=emuTrgTP) {// error found
120  hA[182]->Fill(ch, emuTrgTP-inpTrgTP);
121  hA[183]->Fill(ch);
122  isGood=false;
123  if(!mMCflag) printf("BaD TP2bit(ch=%d) out0=%d inp1=%d del=%d\n", ch, emuTrgTP, inpTrgTP, emuTrgTP-inpTrgTP );
124  }
125 
126  int inpTrg16bit=dsm1TreeTRG->getInp16bit(ch);
127  int emuTrg16bit=dsm0TreeTRG->getOut16bit(ch);
128 
129  hA[190]->Fill(ch, inpTrg16bit);
130  hA[191]->Fill(ch, emuTrg16bit);
131 
132  if(inpTrg16bit!=emuTrg16bit) {// error found
133  hA[192]->Fill(ch, emuTrg16bit-inpTrg16bit);
134  hA[193]->Fill(ch);
135  isGood=false;
136  if(!mMCflag) printf("BaD TP2bit(ch=%d) out0=%d inp1=%d del=%d\n", ch, emuTrgTP, inpTrgTP, emuTrgTP-inpTrgTP );
137  }
138 
139  }
140  //loop over chan finished
141 
142  if(!isGood) {
143  dsm0TreeTRG->print();
144  dsm1TreeTRG->print();
145  }
146 
147 }
148 
149 
150 //==================================================
151 //==================================================
152 void
153 StEemcTriggerSimu::compareTRG1_TRG2(){
154 
155  //printf("............ verify dsm1Tree math for TRG data only............\n");
156  // inputs to DSM2 board=0 (only Endcap)
157 
158  int ibr=0; //only Endcap
159  int ch;
160  int outJPdiff[2],outHTdiff[2],outHTTPdiff[2],outTPdiff[2];
161  int inpJPdiff[2],inpHTdiff[2],inpHTTPdiff[2],inpTPdiff[2];
162 
163  for(ch=0;ch<2;ch++) { // loop over DSM1 boards
164 
165  int outE=dsm1TreeTRG->getOutEsum5bit(ch);
166  int inpE=dsm2TreeTRG->getInpEsum5bit(ibr,ch);
167 
168 
169  //printf("!!! Esum5bit(ch=%d) out1=%d inp2=%d diff=%d\n",ch, outE,inpE,outE-inpE);
170 
171  // hA[500]->Fill(ch, inpE); // filled in compareADC1_TRG2()
172  hA[501]->Fill(ch, outE);
173 
174  if(outE!=inpE) {
175  dsm1TreeTRG->print();//tmp
176 
177  hA[502]->Fill(ch, outE-inpE);
178  hA[503]->Fill(ch);
179 
180  if(!mMCflag) printf("BaD 3JP Esum5bit(ch=%d) out1=%d inp2=%d diff=%d\n",ch, outE,inpE,outE-inpE);
181  // assert(400==i);
182  }
183 
184  int outJP=dsm1TreeTRG->getOutJP2bit(ch);
185  int inpJP=dsm2TreeTRG->getInpJP2bit(ibr,ch);
186 
187  outJPdiff[ch]=outJP;
188  inpJPdiff[ch]=inpJP;
189 
190 
191  //printf("!!! JP2bit(ch=%d) out1=%d inp2=%d diff=%d\n",ch, outJP,inpJP,outJP-inpJP);
192 
193  hA[510]->Fill(ch, inpJP);
194  hA[511]->Fill(ch, outJP);
195 
196  if(outJP!=inpJP) {
197 
198  dsm1TreeTRG->print();//tmp
199 
200  hA[512]->Fill(ch, outJP-inpJP);
201  hA[513]->Fill(ch);
202 
203  if(!mMCflag) printf("BaD 3JP JP2bit(ch=%d) out1=%d inp2=%d diff=%d\n",ch, outJP,inpJP,outJP-inpJP);
204  // assert(500==i);
205  }
206 
207  int outHT=dsm1TreeTRG->getOutHT2bit(ch);
208  int inpHT=dsm2TreeTRG->getInpHT2bit(ibr,ch);
209 
210  outHTdiff[ch]=outHT;
211  inpHTdiff[ch]=inpHT;
212 
213  //printf("!!! HT2bit(ch=%d) out1=%d inp2=%d diff=%d\n",ch, outHT,inpHT,outHT-inpHT);
214 
215  hA[510]->Fill(ch+3, inpHT);
216  hA[511]->Fill(ch+3, outHT);
217 
218  if(outHT!=inpHT) {
219  dsm1TreeTRG->print();//tmp
220 
221  hA[512]->Fill(ch+3, outHT-inpHT);
222  hA[513]->Fill(ch+3);
223 
224  if(!mMCflag) printf("BaD 3JP HT2bit(ch=%d) out1=%d inp2=%d diff=%d\n",ch, outHT,inpHT,outHT-inpHT);
225  // assert(100==i);
226  }
227 
228  int outHTTP=dsm1TreeTRG->getOutHTTP1bit(ch);
229  int inpHTTP=dsm2TreeTRG->getInpHTTP1bit(ibr,ch);
230 
231  outHTTPdiff[ch]=outHTTP;
232  inpHTTPdiff[ch]=inpHTTP;
233 
234  //printf("!!! HTTP1bit(ch=%d) out1=%d inp2=%d diff=%d\n",ch, outHTTP,inpHTTP,outHTTP-inpHTTP);
235 
236  hA[510]->Fill(ch+6, inpHTTP);
237  hA[511]->Fill(ch+6, outHTTP);
238 
239  if(outHTTP!=inpHTTP) {
240 
241  dsm1TreeTRG->print();//tmp
242 
243  hA[512]->Fill(ch+6, outHTTP-inpHTTP);
244  hA[513]->Fill(ch+6);
245 
246  if(!mMCflag) printf("BaD 3JP HTTP1bit(ch=%d) out1=%d inp2=%d diff=%d\n",ch, outHTTP,inpHTTP,outHTTP-inpHTTP);
247  // assert(300==i);
248  }
249 
250  int outTP=dsm1TreeTRG->getOutTP1bit(ch);
251  int inpTP=dsm2TreeTRG->getInpTP1bit(ibr,ch);
252 
253  outTPdiff[ch]=outTP;
254  inpTPdiff[ch]=inpTP;
255 
256  // printf("!!! TP1bit(ch=%d) out1=%d inp2=%d diff=%d\n",ch, outTP,inpTP,outTP-inpTP);
257 
258  hA[510]->Fill(ch+9, inpTP);
259  hA[511]->Fill(ch+9, outTP);
260 
261  if(outTP!=inpTP) {
262 
263  dsm1TreeTRG->print();//tmp
264 
265  hA[512]->Fill(ch+9, outTP-inpTP);
266  hA[513]->Fill(ch+9);
267 
268  if(!mMCflag) printf("BaD 3JP TP1bit(ch=%d) out1=%d inp2=%d diff=%d\n",ch, outTP,inpTP,outTP-inpTP);
269  //assert(200==i);
270  }
271 
272  }
273 
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]);
278 
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]);
283 
284 
285 }
286 
287 
288 //==================================================
289 //==================================================
290 void
291 StEemcTriggerSimu::compareTRG2_TRG3(){
292 
293  int outEndcapJP2bit = dsm2TreeTRG->getOutEndcapJP2bit();
294  int inpEndcapJP2bit = dsm3TRG->getEndcapJPthr2bit();
295  int chan=0;
296 
297  hA[600]->Fill(chan,inpEndcapJP2bit);
298  hA[601]->Fill(chan,outEndcapJP2bit);
299 
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);
303  hA[603]->Fill(chan);
304  }
305 
306  int outEndcapHT2bit = dsm2TreeTRG->getOutEndcapHT2bit();
307  int inpEndcapHT2bit = dsm3TRG->getEndcapHTthr2bit();
308  chan=1;
309 
310  hA[600]->Fill(chan,inpEndcapHT2bit);
311  hA[601]->Fill(chan,outEndcapHT2bit);
312 
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);
316  hA[603]->Fill(chan);
317  }
318 
319  int outEndcapSum1bit = dsm2TreeTRG->getOutEndcapSum1bit();
320  int inpEndcapSum1bit = dsm3TRG->getEndcapEsumthr1bit();
321  chan=2;
322 
323  hA[600]->Fill(chan,inpEndcapSum1bit);
324  hA[601]->Fill(chan,outEndcapSum1bit);
325 
326 
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);
330  hA[603]->Fill(chan);
331  }
332 
333  int outEndcapHTTP1bit = dsm2TreeTRG->getOutEndcapHTTP1bit();
334  int inpEndcapHTTP1bit = dsm3TRG->getEndcapHTTPthr1bit();
335  chan=3;
336 
337  hA[600]->Fill(chan,inpEndcapHTTP1bit);
338  hA[601]->Fill(chan,outEndcapHTTP1bit);
339 
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);
343  hA[603]->Fill(chan);
344  }
345 
346  int outEndcapTP1bit = dsm2TreeTRG->getOutEndcapTP1bit();
347  int inpEndcapTP1bit = dsm3TRG->getEndcapTPthr1bit();
348  chan=4;
349 
350  hA[600]->Fill(chan,inpEndcapTP1bit);
351  hA[601]->Fill(chan,outEndcapTP1bit);
352 
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);
356  hA[603]->Fill(chan);
357  }
358 
359 
360  int outBarreJP2bit = dsm2TreeTRG->getOutBarreJP2bit();
361  int inpBarreJP2bit = dsm3TRG->getBarreJPthr2bit();
362  int ch=0;
363 
364  hA[610]->Fill(ch,inpBarreJP2bit);
365  hA[611]->Fill(ch,outBarreJP2bit);
366 
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);
370  hA[613]->Fill(ch);
371  }
372 
373  int outBarreHT2bit = dsm2TreeTRG->getOutBarreHT2bit();
374  int inpBarreHT2bit = dsm3TRG->getBarreHTthr2bit();
375  ch=1;
376 
377  hA[610]->Fill(ch,inpBarreHT2bit);
378  hA[611]->Fill(ch,outBarreHT2bit);
379 
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);
383  hA[613]->Fill(ch);
384  }
385 
386  int outBarreSum1bit = dsm2TreeTRG->getOutBarreSum1bit();
387  int inpBarreSum1bit = dsm3TRG->getBarreEsumThr1bit();
388  ch=2;
389 
390  hA[610]->Fill(ch,inpBarreSum1bit);
391  hA[611]->Fill(ch,outBarreSum1bit);
392 
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);
396  hA[613]->Fill(ch);
397  }
398 
399  int outBarreHTTP1bit = dsm2TreeTRG->getOutBarreHTTP1bit();
400  int inpBarreHTTP1bit = dsm3TRG->getBarreHTTPthr1bit();
401  ch=3;
402 
403  hA[610]->Fill(ch,inpBarreHTTP1bit);
404  hA[611]->Fill(ch,outBarreHTTP1bit);
405 
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);
409  hA[613]->Fill(ch);
410  }
411 
412  int outBarreTP1bit = dsm2TreeTRG->getOutBarreTP1bit();
413  int inpBarreTP1bit = dsm3TRG->getBarreTPthr1bit();
414  ch=4;
415 
416  hA[610]->Fill(ch,inpBarreTP1bit);
417  hA[611]->Fill(ch,outBarreTP1bit);
418 
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);
422  hA[613]->Fill(ch);
423  }
424 #if 0
425  int outBarreJPSi1bit = dsm2TreeTRG->getOutBarreJPSi1bit();
426  int inpBarreJPSi1bit = dsm3TRG->getJpsi1bit();
427 
428  if( outBarreJPSi1bit != inpBarreJPSi1bit){
429  printf("!!! BAD BarreJPSi1bit out2 = %d, inp3 = %d, diff=%d\n", outBarreJPSi1bit, inpBarreJPSi1bit, outBarreJPSi1bit-inpBarreJPSi1bit);
430  }
431 
432 #endif
433  int outEtot1bit = dsm2TreeTRG->getOutEtot1bit();
434  int inpEtot1bit = dsm3TRG->getEtotThr1bit();
435  int cha=0;
436 
437  hA[620]->Fill(cha,inpEtot1bit);
438  hA[621]->Fill(cha,outEtot1bit);
439 
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);
443  hA[623]->Fill(cha);
444  }
445 
446  int outBarreSum = dsm2TreeTRG->getIntBarreSum();
447  if ( (outBarreSum<76) && (outBarreSum>64) ){
448  hA[690]->Fill(cha, outBarreSum);
449  }
450 }
451 
452 //==================================================
453 //==================================================
454 void
455 StEemcTriggerSimu::compareADC0_TRG1(){
456 
457  int ch;
458 
459  bool isGood=true;
460  for(ch=0;ch<12;ch++) {
461 
462  int inpTrgTPsum=dsm1TreeTRG->getInpTPsum(ch);
463  int emuTrgTPsum=dsm0TreeADC->getOutTPsum(ch);
464 
465  //hA[150]->Fill(ch, inpTrgTPsum);
466  hA[154]->Fill(ch, emuTrgTPsum);
467 
468  if(inpTrgTPsum!=emuTrgTPsum) {// error found
469  hA[155]->Fill(ch, emuTrgTPsum-inpTrgTPsum);
470  hA[158]->Fill(ch, emuTrgTPsum-inpTrgTPsum);
471  hA[156]->Fill(ch);
472 
473  if(!mMCflag) printf("BaD TPsum(ch=%d) emu-out0=%d inp1=%d del=%d\n", ch, emuTrgTPsum, inpTrgTPsum, emuTrgTPsum-inpTrgTPsum );
474  isGood=false;
475  }
476 
477  int inpTrgHT=dsm1TreeTRG->getInpHT2bit(ch);
478  int emuTrgHT=dsm0TreeADC->getOutHT2bit(ch);
479 
480  //hA[160]->Fill(ch, inpTrgHT);
481  hA[164]->Fill(ch, emuTrgHT);
482 
483  if(inpTrgHT!=emuTrgHT) {// error found
484  hA[165]->Fill(ch, emuTrgHT-inpTrgHT);
485  hA[166]->Fill(ch);
486 
487  isGood=false;
488  if(!mMCflag) printf("BaD HT2bit(ch=%d) emu-out0=%d inp1=%d del=%d\n",ch, emuTrgHT, inpTrgHT, emuTrgHT-inpTrgHT );
489  }
490 
491  int inpTrgHTTP=dsm1TreeTRG->getInpHTTP2bit(ch);
492  int emuTrgHTTP=dsm0TreeADC->getOutHTTP2bit(ch);
493 
494  //hA[170]->Fill(ch, inpTrgHTTP);
495  hA[174]->Fill(ch, emuTrgHTTP);
496 
497  if(inpTrgHTTP!=emuTrgHTTP) {// error found
498  hA[175]->Fill(ch, emuTrgHTTP-inpTrgHTTP);
499  hA[176]->Fill(ch);
500 
501  isGood=false;
502  if(!mMCflag) printf("BaD HTTP2bit(ch=%d) emu-out0=%d inp1=%d del=%d\n", ch, emuTrgHTTP, inpTrgHTTP, emuTrgHTTP-inpTrgHTTP );
503  }
504 
505  int inpTrgTP=dsm1TreeTRG->getInpTP2bit(ch);
506  int emuTrgTP=dsm0TreeADC->getOutTP2bit(ch);
507 
508  //hA[180]->Fill(ch, inpTrgTP);
509  hA[184]->Fill(ch, emuTrgTP);
510 
511  if(inpTrgTP!=emuTrgTP) {// error found
512  hA[185]->Fill(ch, emuTrgTP-inpTrgTP);
513  hA[186]->Fill(ch);
514 
515  isGood=false;
516  if(!mMCflag) printf("BaD TP2bit(ch=%d) emu-out0=%d inp1=%d del=%d\n", ch, emuTrgTP, inpTrgTP, emuTrgTP-inpTrgTP );
517  }
518 
519  }
520 
521  if(!isGood) {
522  //dsm0TreeADC->print();
523  //dsm1TreeTRG->print();
524  printf("!!!\n");
525  }
526 
527 }
528 
529 //==================================================
530 //==================================================
531 void
532 StEemcTriggerSimu::compareADC1_TRG2(){
533 
534  int ibr=0; //only Endcap
535  int ch;
536  int outJPdiff[2],outHTdiff[2],outHTTPdiff[2],outTPdiff[2];
537  int inpJPdiff[2],inpHTdiff[2],inpHTTPdiff[2],inpTPdiff[2];
538 
539  for(ch=0;ch<2;ch++) { // loop over DSM1 boards
540 
541  int outJP=dsm1TreeADC->getOutJP2bit(ch);
542  int inpJP=dsm2TreeTRG->getInpJP2bit(ibr,ch);
543 
544  outJPdiff[ch]=outJP;
545  inpJPdiff[ch]=inpJP;
546 
547 
548  //printf("!!! JP2bit(ch=%d) out1=%d inp2=%d diff=%d\n",ch, outJP,inpJP,outJP-inpJP);
549 
550  //hA[510]->Fill(ch, inpJP);
551  hA[514]->Fill(ch, outJP);
552 
553  if(outJP!=inpJP) {
554 
555  //dsm1TreeADC->print();//tmp
556  // printf("###\n");
557 
558  hA[515]->Fill(ch, outJP-inpJP);
559  hA[516]->Fill(ch);
560 
561  if(!mMCflag) printf("BaD 3JP JP2bit(ch=%d) emu-out1=%d inp2=%d diff=%d\n",ch, outJP,inpJP,outJP-inpJP);
562  // assert(500==i);
563  }
564 
565  int outHT=dsm1TreeADC->getOutHT2bit(ch);
566  int inpHT=dsm2TreeTRG->getInpHT2bit(ibr,ch);
567 
568  outHTdiff[ch]=outHT;
569  inpHTdiff[ch]=inpHT;
570 
571  //printf("!!! HT2bit(ch=%d) out1=%d inp2=%d diff=%d\n",ch, outHT,inpHT,outHT-inpHT);
572 
573  //hA[510]->Fill(ch+3, inpHT);
574  hA[514]->Fill(ch+3, outHT);
575 
576  if(outHT!=inpHT) {
577  //dsm1TreeADC->print();//tmp
578  // printf("###\n");
579 
580  hA[515]->Fill(ch+3, outHT-inpHT);
581  hA[516]->Fill(ch+3);
582 
583  if(!mMCflag) printf("BaD 3JP HT2bit(ch=%d) emu-out1=%d inp2=%d diff=%d\n",ch, outHT,inpHT,outHT-inpHT);
584  // assert(100==i);
585  }
586 
587  int outHTTP=dsm1TreeADC->getOutHTTP1bit(ch);
588  int inpHTTP=dsm2TreeTRG->getInpHTTP1bit(ibr,ch);
589 
590  outHTTPdiff[ch]=outHTTP;
591  inpHTTPdiff[ch]=inpHTTP;
592 
593  //printf("!!! HTTP1bit(ch=%d) out1=%d inp2=%d diff=%d\n",ch, outHTTP,inpHTTP,outHTTP-inpHTTP);
594 
595  //hA[510]->Fill(ch+6, inpHTTP);
596  hA[514]->Fill(ch+6, outHTTP);
597 
598  if(outHTTP!=inpHTTP) {
599 
600  //dsm1TreeADC->print();//tmp
601  // printf("###\n");
602 
603  hA[515]->Fill(ch+6, outHTTP-inpHTTP);
604  hA[516]->Fill(ch+6);
605 
606  if(!mMCflag) printf("BaD 3JP HTTP1bit(ch=%d) emu-out1=%d inp2=%d diff=%d\n",ch, outHTTP,inpHTTP,outHTTP-inpHTTP);
607  // assert(300==i);
608  }
609 
610  int outTP=dsm1TreeADC->getOutTP1bit(ch);
611  int inpTP=dsm2TreeTRG->getInpTP1bit(ibr,ch);
612 
613  outTPdiff[ch]=outTP;
614  inpTPdiff[ch]=inpTP;
615 
616  // printf("!!! TP1bit(ch=%d) out1=%d inp2=%d diff=%d\n",ch, outTP,inpTP,outTP-inpTP);
617 
618  //hA[510]->Fill(ch+9, inpTP);
619  hA[514]->Fill(ch+9, outTP);
620 
621  if(outTP!=inpTP) {
622 
623  //dsm1TreeADC->print();//tmp
624  // printf("###\n");
625 
626  hA[515]->Fill(ch+9, outTP-inpTP);
627  hA[516]->Fill(ch+9);
628 
629  if(!mMCflag) printf("BaD 3JP TP1bit(ch=%d) emu-out1=%d inp2=%d diff=%d\n",ch, outTP,inpTP,outTP-inpTP);
630  //assert(200==i);
631  }
632 
633  }
634 
635  //----------------- compare Esum5bit for both Endcap & Barrel
636 
637  for(ibr=0;ibr<EMCdsm2Tree::Nbe2;ibr++) { // loop over DSM2 boards
638  for(ch=0;ch<2;ch++) {
639  int jch = 2*ibr+ch;
640  int outE = dsm2TreeADC->getInpEsum5bit(ibr,ch);// Bemc is only avaliable here
641  int inpE = dsm2TreeTRG->getInpEsum5bit(ibr,ch);
642 
643  hA[500]->Fill(jch, inpE);
644  hA[504]->Fill(jch, outE);
645 
646  if(outE!=inpE) {
647  hA[505]->Fill(jch, outE-inpE);
648  hA[506]->Fill(jch);
649  if(!mMCflag) printf("BaD Esum5bit(ibr=%d,ch=%d) adcOut1=%d trgInp2=%d diff=%d\n",ibr,ch, outE,inpE,outE-inpE);
650  }
651  }
652  }
653 }
654 
655 //==================================================
656 //==================================================
657 void
658 StEemcTriggerSimu::compareADC2_TRG3(){
659  //printf("Wow!\n");
660  int outEtot=dsm2TreeADC->getOutEtot1bit();
661  int inpEtot=dsm3TRG->getEtotThr1bit();
662 
663  int ch=0;
664 
665  //hA[620]->Fill(ch, inpEtot);
666  hA[624]->Fill(ch, outEtot);
667 
668  if(outEtot!=inpEtot){
669 
670  hA[625]->Fill(ch, outEtot-inpEtot);
671  hA[626]->Fill(ch);
672 
673  if(!mMCflag) printf("BaD Etot 1bit emu-out2=%d inp3=%d, diff=%d\n", outEtot, inpEtot, outEtot-inpEtot);
674  }
675 }
676 
677 //==================================================
678 //==================================================
679 void
680 StEemcTriggerSimu::DSM2EsumSpectra(){
681 
682  int BarreEsum = dsm2TreeTRG->getIntBarreSum();
683  int adcBarreEsum = dsm2TreeADC->getIntBarreSum();
684 
685  //printf("BarreEsum=%d, adcBarreEsum=%d\n", BarreEsum, adcBarreEsum);
686 
687  hA[550]->Fill(BarreEsum);
688  hA[560]->Fill(BarreEsum);
689  hA[551]->Fill(adcBarreEsum);
690 
691  if(BarreEsum!=adcBarreEsum){
692  int chB=1;
693  hA[556]->Fill(chB);
694  }
695 
696  int EndcapEsum = dsm2TreeTRG->getIntEndcapSum();
697  int adcEndcapEsum = dsm2TreeADC->getIntEndcapSum();
698 
699  //printf("EndcapEsum=%d, adcEndcapEsum=%d\n", EndcapEsum, adcEndcapEsum);
700 
701  hA[552]->Fill(EndcapEsum);
702  hA[562]->Fill(EndcapEsum);
703  hA[553]->Fill(adcEndcapEsum);
704 
705  if(EndcapEsum!=adcEndcapEsum){
706  int chE=4;
707  hA[556]->Fill(chE);
708  }
709 
710  int Etot = dsm2TreeTRG->getIntEtot();
711  int adcEtot = dsm2TreeADC->getIntEtot();
712 
713  hA[554]->Fill(Etot);
714  hA[564]->Fill(Etot);
715  hA[555]->Fill(adcEtot);
716 
717  if(Etot!=adcEtot){
718  int chT=7;
719  hA[556]->Fill(chT);
720  }
721 
722 }
723 
724 //
725 // $Log: StEemcTriggerCompare.cxx,v $
726 // Revision 1.3 2009/10/13 17:06:52 pibero
727 // Changed location of #include files
728 //
729 // Revision 1.2 2007/07/23 02:59:59 balewski
730 // cleanup, bbc for M-C still not working
731 //