9 #include "EMCdsm2Tree.h"
15 EMCdsm2Tree::EMCdsm2Tree(
const char *nameX) {
25 for(i=0; i<Nbe2; i++) be2[i].setYear(-999);
27 strncpy(name,nameX,mxTxt);
32 EMCdsm2Tree::~EMCdsm2Tree() {
39 EMCdsm2Tree::setYear(
int x,
int BEsumthr,
int EEsumthr,
int JPSIthrSelc,
int BarreSide,
int EtotThr) {
41 BEsumthr8bit = BEsumthr;
42 EEsumthr6bit = EEsumthr;
43 JPSIthrSelc2bit = JPSIthrSelc;
44 BarreSide2bit = BarreSide;
45 EtotThr8bit = EtotThr;
47 for (i=0;i<Nbe2;i++) be2[i].setYear(mYear);
53 EMCdsm2Tree::clear() {
55 for (i=0;i<Nbe2;i++) be2[i].clear();
80 EMCdsm2Tree::setInput16bit(
int ibrd,
int ch,
unsigned short val){
82 assert(ibrd>=0 && ibrd<Nbe2);
83 be2[ibrd].setWord(ch,val);
92 EMCdsm2Tree::compute() {
97 intEndcapSum = getInpEsum5bit(0,0) + getInpEsum5bit(0,1);
98 if ( intEndcapSum > EEsumthr6bit ) OutEndcapSum1bit = 1;
99 else OutEndcapSum1bit = 0;
102 for (i=1; i<Nbe2; i++){
103 intBarreSum = intBarreSum + getInpEsum5bit(i,0) + getInpEsum5bit(i,1);
105 if ( intBarreSum > BEsumthr8bit ) OutBarreSum1bit = 1;
106 else OutBarreSum1bit = 0;
108 intEtot = intEndcapSum + intBarreSum;
109 if ( intEtot > EtotThr8bit ) OutEtot1bit = 1;
110 else OutEtot1bit = 0;
113 for ( j=0; j<Nbe2; j++){
114 for( k=0; k<Nbe2Cha; k++){
116 if ( OutEndcapJP2bit <= getInpJP2bit(j,k) ) OutEndcapJP2bit = getInpJP2bit(j,k) ;
117 if ( OutEndcapHT2bit <= getInpHT2bit(j,k) ) OutEndcapHT2bit = getInpHT2bit(j,k);
118 if ( OutEndcapHTTP1bit <= getInpHTTP1bit(j,k) ) OutEndcapHTTP1bit = getInpHTTP1bit(j,k);
119 if ( OutEndcapTP1bit <= getInpTP1bit(j,k) ) OutEndcapTP1bit = getInpTP1bit(j,k);
123 if ( OutBarreJP2bit <= getInpJP2bit(j,k) ) OutBarreJP2bit = getInpJP2bit(j,k) ;
124 if ( OutBarreHT2bit <= getInpHT2bit(j,k) ) OutBarreHT2bit = getInpHT2bit(j,k);
125 if ( OutBarreHT2bit <= getInpHT2bit_2(j,k) ) OutBarreHT2bit = getInpHT2bit_2(j,k);
126 if ( OutBarreHTTP1bit <= getInpHTTP1bit(j,k) ) OutBarreHTTP1bit = getInpHTTP1bit(j,k);
127 if ( OutBarreTP1bit <= getInpTP1bit(j,k) ) OutBarreTP1bit = getInpTP1bit(j,k);
133 int BarreEast_HT_JPSI[6]={0,0,0,0,0,0};
134 int BarreWest_HT_JPSI[6]={0,0,0,0,0,0};
136 BarreEast_HT_JPSI[0]=getInpHT2bit(1,1);
137 BarreEast_HT_JPSI[1]=getInpHT2bit_2(1,1);
138 BarreEast_HT_JPSI[2]=getInpHT2bit(2,0);
139 BarreEast_HT_JPSI[3]=getInpHT2bit_2(2,0);
140 BarreEast_HT_JPSI[4]=getInpHT2bit(1,0);
141 BarreEast_HT_JPSI[5]=getInpHT2bit_2(1,0);
143 BarreWest_HT_JPSI[0]=getInpHT2bit(3,1);
144 BarreWest_HT_JPSI[1]=getInpHT2bit_2(3,1);
145 BarreWest_HT_JPSI[2]=getInpHT2bit(2,1);
146 BarreWest_HT_JPSI[3]=getInpHT2bit_2(2,1);
147 BarreWest_HT_JPSI[4]=getInpHT2bit(3,0);
148 BarreWest_HT_JPSI[5]=getInpHT2bit_2(3,0);
151 for ( l=0; l<6; l++){
152 if ( BarreEast_HT_JPSI[l] > JPSIthrSelc2bit ) BarreEast_HT_JPSI[l]=1;
153 else BarreEast_HT_JPSI[l]=0;
155 if ( BarreWest_HT_JPSI[l] > JPSIthrSelc2bit ) BarreWest_HT_JPSI[l]=1;
156 else BarreWest_HT_JPSI[l]=0;
159 if ( BarreEast_HT_JPSI[0] && ( BarreEast_HT_JPSI[2] || BarreEast_HT_JPSI[3] ||BarreEast_HT_JPSI[4] )) OutBarreJPSi1bit=1;
161 if ( BarreEast_HT_JPSI[1] && ( BarreEast_HT_JPSI[3] || BarreEast_HT_JPSI[4] ||BarreEast_HT_JPSI[5] )) OutBarreJPSi1bit=1;
163 if ( BarreEast_HT_JPSI[2] && ( BarreEast_HT_JPSI[4] || BarreEast_HT_JPSI[5] )) OutBarreJPSi1bit=1;
165 if ( BarreEast_HT_JPSI[3] && BarreEast_HT_JPSI[5] ) OutBarreJPSi1bit=1;
167 if ( BarreWest_HT_JPSI[0] && ( BarreWest_HT_JPSI[2] || BarreWest_HT_JPSI[3] ||BarreWest_HT_JPSI[4] )) OutBarreJPSi1bit=1;
169 if ( BarreWest_HT_JPSI[1] && ( BarreWest_HT_JPSI[3] || BarreWest_HT_JPSI[4] ||BarreWest_HT_JPSI[5] )) OutBarreJPSi1bit=1;
171 if ( BarreWest_HT_JPSI[2] && ( BarreWest_HT_JPSI[4] || BarreWest_HT_JPSI[5] )) OutBarreJPSi1bit=1;
173 if ( BarreWest_HT_JPSI[3] && BarreWest_HT_JPSI[5] ) OutBarreJPSi1bit=1;
179 EMCdsm2Tree::getInpHT2bit(
int ibr,
int ch)
const {
180 assert(ibr>=0 && ibr<Nbe2);
181 return be2[ibr].getInpHT2bit(ch);
187 EMCdsm2Tree::getInpHT2bit_2(
int ibr,
int ch)
const {
188 assert(ibr>=0 && ibr<Nbe2);
189 return be2[ibr].getInpHT2bit_2(ch);
195 EMCdsm2Tree::getInpJP2bit(
int ibr,
int ch)
const {
196 assert(ibr>=0 && ibr<Nbe2);
197 return be2[ibr].getInpJP2bit(ch);
204 EMCdsm2Tree::getInpTP1bit(
int ibr,
int ch)
const {
205 assert(ibr>=0 && ibr<Nbe2);
206 return be2[ibr].getInpTP1bit(ch);
212 EMCdsm2Tree::getInpHTTP1bit(
int ibr,
int ch)
const {
213 assert(ibr>=0 && ibr<Nbe2);
214 return be2[ibr].getInpHTTP1bit(ch);
220 EMCdsm2Tree::getInpEsum5bit(
int ibr,
int ch)
const {
221 assert(ibr>=0 && ibr<Nbe2);
222 return be2[ibr].getInpEsum5bit(ch);
230 EMCdsm2Tree::print(
int k)
const {
231 printf(
"EMCdsm2Tree(%s) , year=%d \n",name,mYear);
233 printf(
"\n\n----------- level-2 -----------------\n ");
235 for (i=0;i<Nbe2;i++) {
236 if(i==0) printf(
"\nEndcap board=1 ");
237 else printf(
"\nBarrel board=%d ",i);