53 float estimX,estimY,SUMlogFR;
59 crE[0]=M11x11Input[40];
60 crE[1]=M11x11Input[51];
61 crE[2]=M11x11Input[62];
62 crE[3]=M11x11Input[73];
63 crE[4]=M11x11Input[84];
65 crE[5]=M11x11Input[39];
66 crE[6]=M11x11Input[50];
67 crE[7]=M11x11Input[61];
68 crE[8]=M11x11Input[72];
69 crE[9]=M11x11Input[83];
71 crE[10]=M11x11Input[38];
72 crE[11]=M11x11Input[49];
73 crE[12]=M11x11Input[60];
74 crE[13]=M11x11Input[71];
75 crE[14]=M11x11Input[82];
77 crE[15]=M11x11Input[37];
78 crE[16]=M11x11Input[48];
79 crE[17]=M11x11Input[59];
80 crE[18]=M11x11Input[70];
81 crE[19]=M11x11Input[81];
83 crE[20]=M11x11Input[36];
84 crE[21]=M11x11Input[47];
85 crE[22]=M11x11Input[58];
86 crE[23]=M11x11Input[69];
87 crE[24]=M11x11Input[80];
90 std::cout<<
"Inside Correction Function : Dead Channel ETA" << DCeta << std::endl;
94 crE[0]=M11x11Input[36];
95 crE[1]=M11x11Input[47];
96 crE[2]=M11x11Input[58];
97 crE[3]=M11x11Input[69];
98 crE[4]=M11x11Input[80];
100 crE[5]=M11x11Input[37];
101 crE[6]=M11x11Input[48];
102 crE[7]=M11x11Input[59];
103 crE[8]=M11x11Input[70];
104 crE[9]=M11x11Input[81];
106 crE[10]=M11x11Input[38];
107 crE[11]=M11x11Input[49];
108 crE[12]=M11x11Input[60];
109 crE[13]=M11x11Input[71];
110 crE[14]=M11x11Input[82];
112 crE[15]=M11x11Input[39];
113 crE[16]=M11x11Input[50];
114 crE[17]=M11x11Input[61];
115 crE[18]=M11x11Input[72];
116 crE[19]=M11x11Input[83];
118 crE[20]=M11x11Input[40];
119 crE[21]=M11x11Input[51];
120 crE[22]=M11x11Input[62];
121 crE[23]=M11x11Input[73];
122 crE[24]=M11x11Input[84];
140 SUMuu = crE[4] + crE[9] + crE[14] + crE[19] + crE[24];
141 SUMu = crE[3] + crE[8] + crE[13] + crE[18] + crE[23];
142 SUMd = crE[1] + crE[6] + crE[11] + crE[16] + crE[21];
143 SUMdd = crE[0] + crE[5] + crE[10] + crE[15] + crE[20];
145 SUMll = crE[0] + crE[1] + crE[2] + crE[3] + crE[4];
146 SUMl = crE[5] + crE[6] + crE[7] + crE[8] + crE[9];
147 SUMr = crE[15] + crE[16] + crE[17] + crE[18] + crE[19];
148 SUMrr = crE[20] + crE[21] + crE[22] + crE[23] + crE[24];
163 float XLOW[50],XHIG[50],YLOW[50],YHIG[50];
164 float CentX[50],CentY[50];
166 for(
int ix=0; ix<5 ; ix++){
167 for(
int iy=0; iy<5 ; iy++){
170 XLOW[isub]= -10.0 +float(ix)*4.0;
171 XHIG[isub]= XLOW[isub] + 4.0;
172 YLOW[isub]= -10.0 +float(iy)*4.0;;
173 YHIG[isub]= YLOW[isub] + 4.0;
175 CentX[isub]=(XHIG[isub]+XLOW[isub])/2.0;
176 CentY[isub]=(YHIG[isub]+YLOW[isub])/2.0;
189 for(
int ix=1; ix<4 ; ix++){
190 for(
int iy=1; iy<4 ; iy++){
192 if(fabs(crE[idx])<epsilon && DeadCR >0){
std::cout<<
" Problem 2 dead channels in sum9! Can not correct ... I return 0.0"<<std::endl;
return 0.0;}
193 if(fabs(crE[idx])<epsilon && DeadCR==-1)DeadCR=idx;
200 for(
int j=0;
j<25;
j++)SUM24+=crE[
j];
201 if(DeadCR == -1){
std::cout<<
" No Dead Channel in 3x3 ! I don't correct ... I return 0.0 ....look S25 = "<<SUM24<<std::endl;
return 0.0;}
206 int CisMax; CisMax=-1;
207 float MaxEin5x5; MaxEin5x5=0.0;
208 for(
int ic=0;ic<24;ic++){
209 if(crE[ic]>MaxEin5x5){
215 std::cout<<
"ERROR ----> Central has NOT the MAX energy in 5x5 ... I return 0.0"<<std::endl;
224 if(DeadCR==6 && (SUMuu>SUMu || SUMrr>SUMr || SUMll>3.0*SUMr || SUMdd>3.0*SUMu)){
std::cout<<
"Unusual Pattern in 6 I return 0.0"<<std::endl;
return 0.0;}
225 if(DeadCR==8 && (SUMdd>SUMd || SUMrr>SUMr || SUMll>3.0*SUMr || SUMuu>3.0*SUMd)){
std::cout<<
"Unusual Pattern in 8 I return 0.0"<<std::endl;
return 0.0;}
226 if(DeadCR==16 && (SUMuu>SUMu || SUMll>SUMl || SUMrr>3.0*SUMl || SUMdd>3.0*SUMu)){
std::cout<<
"Unusual Pattern in 16 I return 0.0"<<std::endl;
return 0.0;}
227 if(DeadCR==18 && (SUMdd>SUMd || SUMll>SUMl || SUMrr>3.0*SUMl || SUMuu>3.0*SUMd)){
std::cout<<
"Unusual Pattern in 18 I return 0.0"<<std::endl;
return 0.0;}
229 if(DeadCR==7 && (SUMuu>SUMu || SUMdd>SUMd || SUMrr>SUMr)){
std::cout<<
"Unusual Pattern in 7 I return 0.0"<<std::endl;
return 0.0;}
230 if(DeadCR==17 && (SUMuu>SUMu || SUMdd>SUMd || SUMll>SUMl)){
std::cout<<
"Unusual Pattern in 17 I return 0.0"<<std::endl;
return 0.0;}
231 if(DeadCR==11 && (SUMll>SUMl || SUMrr>SUMr || SUMuu>SUMu)){
std::cout<<
"Unusual Pattern in 11 I return 0.0"<<std::endl;
return 0.0;}
232 if(DeadCR==13 && (SUMll>SUMl || SUMrr>SUMr || SUMdd>SUMd)){
std::cout<<
"Unusual Pattern in 13 I return 0.0"<<std::endl;
return 0.0;}
238 for(
int j=0;
j<25;
j++)
if(
j!=DeadCR)SUM24+=crE[
j];
259 for(
int ix=0; ix<5 ; ix++){
260 for(
int iy=0; iy<5 ; iy++){
263 float xpos = 20.0*(float(ix)-2.0);
264 float ypos = 20.0*(float(iy)-2.0);
269 float w = crE[idx]/SUM24;
272 SUMlogFR = SUMlogFR + w;
274 estimX = estimX + xpos*w;
275 estimY = estimY + ypos*w;
281 estimX = estimX/SUMlogFR;
282 estimY = estimY/SUMlogFR;
285 NEWx = PosCorr->
CORRX(DeadCR,0,50,estimX);
286 NEWy = PosCorr->
CORRY(DeadCR,0,50,estimY);
292 if(DeadCR==7 && (estimX>7.0 || estimX< -2.0 || estimY>10.0 || estimY<-9.0) ){
std::cout<<
"DC=7 Position OUT of LIMIT I return 0.0"<<std::endl;
return 0.0;}
293 if(DeadCR==17 && (estimX>2.5 || estimX< -8.0 || estimY>10.0 || estimY<-8.0) ){
std::cout<<
"DC=17 Position OUT of LIMIT I return 0.0"<<std::endl;
return 0.0;}
294 if(DeadCR==11 && (estimX>8.0 || estimX<-10.0 || estimY> 9.0 || estimY<-4.0) ){
std::cout<<
"DC=11 Position OUT of LIMIT I return 0.0"<<std::endl;
return 0.0;}
295 if(DeadCR==13 && (estimX>8.0 || estimX<-10.0 || estimY> 4.5 || estimY<-8.0) ){
std::cout<<
"DC=13 Position OUT of LIMIT I return 0.0"<<std::endl;
return 0.0;}
297 if(DeadCR==12 && (estimX>18.0 || estimX<-18.0 || estimY> 17.0 || estimY<-17.0) ){
std::cout<<
"DC=12 Position OUT of LIMIT I return 0.0"<<std::endl;
return 0.0;}
299 if(DeadCR==6 && (estimX>8.0 || estimX< -9.0 || estimY>10.0 || estimY<-8.0) ){
std::cout<<
"DC=6 Position OUT of LIMIT I return 0.0"<<std::endl;
return 0.0;}
300 if(DeadCR==8 && (estimX>8.0 || estimX< -9.0 || estimY> 9.0 || estimY<-8.5) ){
std::cout<<
"DC=8 Position OUT of LIMIT I return 0.0"<<std::endl;
return 0.0;}
301 if(DeadCR==16 && (estimX>7.0 || estimX<-10.0 || estimY> 9.0 || estimY<-8.0) ){
std::cout<<
"DC=16 Position OUT of LIMIT I return 0.0"<<std::endl;
return 0.0;}
302 if(DeadCR==18 && (estimX>8.0 || estimX< -9.0 || estimY> 9.0 || estimY<-8.0) ){
std::cout<<
"DC=18 Position OUT of LIMIT I return 0.0"<<std::endl;
return 0.0;}
317 float RECOfrDcr = 0.0;
318 RECOfrDcr = SplCorr->
value(DeadCR,0,50,NEWx,NEWy);
323 for (
int isub=0 ; isub<NSUBS ; isub++){
324 if( NEWx>XLOW[isub] && NEWx<XHIG[isub] && NEWy>YLOW[isub] && NEWy<YHIG[isub] ){
328 if(DeadCR==6 && (isub==0 || isub ==1 || isub==5) ){
329 RECOfrDcr = ExpCorr->
value(DeadCR,0,50,isub,NEWx,NEWy);
331 if(DeadCR==8 && (isub==4 || isub ==3 || isub==9) ){
332 RECOfrDcr = ExpCorr->
value(DeadCR,0,50,isub,NEWx,NEWy);
334 if(DeadCR==16 && (isub==15 || isub ==21 || isub==20) ){
335 RECOfrDcr = ExpCorr->
value(DeadCR,0,50,isub,NEWx,NEWy);
337 if(DeadCR==18 && (isub==19 || isub ==23 || isub==24) ){
338 RECOfrDcr = ExpCorr->
value(DeadCR,0,50,isub,NEWx,NEWy);
340 if(DeadCR==7 || DeadCR==11 || DeadCR==12 || DeadCR==13 || DeadCR==17 ){
341 RECOfrDcr = ExpCorr->
value(DeadCR,0,50,isub,NEWx,NEWy);
349 double ESTIMATED_ENERGY = RECOfrDcr*SUM24;
350 std::cout<<
" THE ESTIMATED RECOfrDcr is : "<< RECOfrDcr <<std::endl;
351 std::cout<<
" THE ESTIMATED ENERGY is : "<< ESTIMATED_ENERGY <<std::endl;
353 if(RECOfrDcr<0.0){
std::cout<<
"NEGATIVE RECOfrDr I Return 0.0"<<std::endl; RECOfrDcr=0.0;}
354 if( (DeadCR==6 || DeadCR==8 || DeadCR==16 || DeadCR==18) && RECOfrDcr>0.20){
std::cout<<
"Fraction OUT of LIMIT I return 0.0"<<std::endl;
return 0.0;}
355 if( (DeadCR==7 || DeadCR==17 || DeadCR==11 || DeadCR==13) && RECOfrDcr>1.00){
std::cout<<
"Fraction OUT of LIMIT I return 0.0"<<std::endl;
return 0.0;}
356 if( DeadCR==12 && RECOfrDcr>5.00){
std::cout<<
"Fraction OUT of LIMIT I return 0.0"<<std::endl;
return 0.0;}
366 return ESTIMATED_ENERGY;
double CORRX(int DeadCrystal, int DeadCrystalEta, int estimE, double estimX)
double value(int DeadCrystal, int DeadCrystalEta, int estimE, int subRegion, double estimX, double estimY)
double value(int DeadCrystal, int DeadCrystalEta, int estimE, double estimX, double estimY)
double CORRY(int DeadCrystal, int DeadCrystalEta, int estimE, double estimY)