00001
00002
00003
00004
00005 #include <iostream>
00006 #include <assert.h>
00007
00008
00009 #include "EEdsm1Tree.h"
00010 #include "EEdsm1.h"
00011
00012
00013
00014
00015 EEdsm1Tree::EEdsm1Tree(const char *nameX) {
00016 mYear=-999;
00017 int thr[3]={1000, 2000, 3000};
00018 int TPthr=100, HTTPthr=100;
00019 ee1=new EEdsm1[Nee1];
00020 int i=0;
00021 for(i=0; i<Nee1; i++) ee1[i].setYear(-999, thr, TPthr, HTTPthr);
00022 ee1[0].setType(1);
00023 ee1[1].setType(2);
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 clear();
00035 strncpy(name,nameX,mxTxt);
00036 }
00037
00038
00039
00040 EEdsm1Tree::~EEdsm1Tree() {
00041
00042 }
00043
00044
00045
00046 void
00047 EEdsm1Tree::setYear(int x, int *JPth, int TPthrSelc, int HTTPthrSelc) {
00048 mYear=x;
00049 int i;
00050 for (i=0;i<Nee1;i++) ee1[i].setYear(mYear, JPth, TPthrSelc, HTTPthrSelc);
00051 }
00052
00053
00054
00055 void EEdsm1Tree :: clear() {
00056 int i;
00057
00058 for (i=0;i<Nee1;i++) ee1[i].clear();
00059 #if 0
00060 memset(ee1out3JPadc,0,sizeof(ee1out3JPadc));
00061 memset(ee1outJPadc,0,sizeof(ee1outJPadc));
00062 memset(ee1outHT,0,sizeof(ee1outHT));
00063 memset(ee1outTPthrMax, 0, sizeof(ee1outTPthrMax));
00064 memset(ee1outHTTPthrMax, 0, sizeof(ee1outHTTPthrMax));
00065 #endif
00066
00067 }
00068
00069
00070
00071
00072 void
00073 EEdsm1Tree::setInp16bit(int brd, int ch, ushort val){
00074 assert(brd>0 && brd<=Nee1);
00075 ee1[brd-1].setWord(ch,val);
00076
00077 }
00078
00079
00080
00081 void
00082 EEdsm1Tree::compute() {
00083 int i;
00084 for (i=0;i<Nee1;i++) {
00085 ee1[i].compute();
00086
00087 }
00088
00089
00090
00091
00092 #if 0
00093
00094
00095 for (i=0;i<EEnJetPatch;i++) {
00096 AdjJPsum[i]=ee1outJPadc[i]+ee1outJPadc[(i+1)%EEnJetPatch];
00097
00098 }
00099 #endif
00100 }
00101
00102
00103
00104 int
00105 EEdsm1Tree:: getInpTPsum(int ch) const {
00106
00107 return ee1[ch/6].getInpTPsum(ch%6);
00108 }
00109
00110
00111
00112
00113 int
00114 EEdsm1Tree::getInpHT2bit(int ch) const {
00115
00116 return ee1[ch/6].getInpHT2bit(ch%6);
00117 }
00118
00119
00120
00121
00122 int
00123 EEdsm1Tree::getInpTP2bit(int ch) const {
00124
00125 return ee1[ch/6].getInpTP2bit(ch%6);
00126 }
00127
00128
00129
00130
00131 int
00132 EEdsm1Tree::getInpHTTP2bit(int ch) const {
00133
00134 return ee1[ch/6].getInpHTTP2bit(ch%6);
00135 }
00136
00137
00138
00139 int
00140 EEdsm1Tree::getInp16bit(int ch) const {
00141
00142 return ee1[ch/6].getInp16bit(ch%6);
00143 }
00144
00145
00146
00147 int
00148 EEdsm1Tree::getOutHT2bit(int ibr) const {
00149 return ee1[ibr].getOutHT2bit();
00150 }
00151
00152
00153
00154
00155 int
00156 EEdsm1Tree::getOutJP2bit(int ibr) const {
00157 return ee1[ibr].getOutJP2bit();
00158 }
00159
00160
00161
00162
00163 int
00164 EEdsm1Tree::getOutTP1bit(int ibr) const {
00165 return ee1[ibr].getOutTP1bit();
00166 }
00167
00168
00169
00170
00171 int
00172 EEdsm1Tree::getOutHTTP1bit(int ibr) const {
00173 return ee1[ibr].getOutHTTP1bit();
00174 }
00175
00176
00177
00178 int
00179 EEdsm1Tree::getOutEsum5bit(int ibr) const {
00180 return ee1[ibr].getOutEsum5bit();
00181 }
00182
00183
00184
00185 int
00186 EEdsm1Tree::getOut16bit(int ibr) const {
00187 return ee1[ibr].getOut16bit();
00188 }
00189
00190
00191
00192
00193 void
00194 EEdsm1Tree::print( int k) const {
00195 printf("EEdsm1Tree(%s) , year=%d \n",name,mYear);
00196
00197 printf("\n\n----------- level-1 -----------------\n ");
00198 int i;
00199 for(i=0;i<Nee1;i++) {
00200 printf("\n----------- level-1 Board %2d , ",i+1);
00201 ee1[i].print();
00202
00203 }
00204 #if 0
00205 printf("\n----------- level-1 emulated output \n JP_Falk =");
00206 int Njp=EEnJetPatch;
00207 for(i=Njp-1;i>=0; i--) printf(" %4d ",i);
00208 printf("\n JP_Steve=");
00209 for(i=Njp-1;i>=0; i--) printf(" %4d ",(i+2)%6+1);
00210 printf("\n JPsum =");
00211 for(i=Njp-1;i>=0; i--) printf(" %4d ",ee1outJPadc[i]);
00212 printf("\n HTthr =");
00213 for(i=Njp-1;i>=0; i--) printf(" %4d ",ee1outHT[i]);
00214 if(mYear<2006) {
00215 printf("\n AdjJPsum=");
00216 for(i=Njp-1;i>=0; i--) printf(" %4d ",AdjJPsum[i]);
00217 }
00218 printf("\n");
00219 printf("emul: orTPbit=%d orHTTPbit=%d \n",ee1outTPthrMax[0]||ee1outTPthrMax[1], ee1outHTTPthrMax[0] ||ee1outHTTPthrMax[1]);
00220
00221 #endif
00222 }
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247