/*:>-------------------------------------------------------------------- **: FILE: mMvdSetUcal.c.template **: HISTORY: **: 00jan93-v000a-hpl- Created by stic Version **: Id: idl.y,v 1.17 1997/03/25 19:22:52 ward Exp **:<------------------------------------------------------------------*/ #include "mMvdSetUcal.h" #include #include extern void Table_bDbase( DMVDGEO_ST *Geo, DMVBPAR_ST *bPar, DMVCPAR_ST *cPar, int index, short *shell, short *row, short *panel, short *strip); extern void Table_cDbase( DMVDGEO_ST *Geo, DMVBPAR_ST *bPar, DMVCPAR_ST *cPar, int index, short *end, short *wedge, short *row, short *column); extern void MvdMess_(char *name_of_function, short ierror, short level, char *message, ...); #define NO_ERROR 0 /* used for mesage output with no error */ #define ERROR_1 1 #define ERROR_2 2 #define ERROR_3 3 #define ERROR_4 4 #define VERY_LOUD 3 /* for error message which are hard to turn off */ #define LOUD 2 /* messages which are usually output */ #define QUIET 1 /* used for messages which are output at default setting */ #define SILENT 0 /* for messages which are usually not output */ long adrcell( float *xin, float *xout, float dele, float sleng, float pitch, short max, short *cellhit, short *stripadr, float *stripdele); long adrpad( DMVCPAR_ST *cPar, DMVCGEO_ST *cGeo, float *xymid, short *padhit, short *nphichip,short *nphipad, short *nrpad ); long addnoise( TABLE_HEAD_ST *bDbase_h,DMVBDBASE_ST *bDbase, TABLE_HEAD_ST *cDbase_h,DMVCDBASE_ST *cDbase, DMVDPAR_ST *Par,DMVBPAR_ST *bPar,DMVCPAR_ST *cPar, DMVDGEO_ST *Geo, float skev[3072][6][2],float skevpad[144][21][2]); long digitize( TABLE_HEAD_ST *bDbase_h,DMVBDBASE_ST *bDbase , TABLE_HEAD_ST *cDbase_h,DMVCDBASE_ST *cDbase , TABLE_HEAD_ST *bRaw_h, DMVBRAW_ST *bRaw, TABLE_HEAD_ST *cRaw_h, DMVCRAW_ST *cRaw, DMVDPAR_ST *Par,DMVBPAR_ST *bPar, DMVCPAR_ST *cPar, DMVDGEO_ST *Geo, DMVBCAL_ST *bCal ,DMVCCAL_ST *cCal , float skev[3072][6][2],float skevpad[144][21][2], int *totalhit); long mMvdSetUcal_( TABLE_HEAD_ST *ghit_h, VERGHIT_ST *ghit , TABLE_HEAD_ST *Par_h, DMVDPAR_ST *Par , TABLE_HEAD_ST *bPar_h, DMVBPAR_ST *bPar , TABLE_HEAD_ST *cPar_h, DMVCPAR_ST *cPar , TABLE_HEAD_ST *tPar_h, DMVDTRIGPAR_ST *tPar , TABLE_HEAD_ST *Geo_h, DMVDGEO_ST *Geo , TABLE_HEAD_ST *bGeo_h, DMVBGEO_ST *bGeo , TABLE_HEAD_ST *cGeo_h, DMVCGEO_ST *cGeo , TABLE_HEAD_ST *bDbase_h, DMVBDBASE_ST *bDbase , TABLE_HEAD_ST *cDbase_h, DMVCDBASE_ST *cDbase , TABLE_HEAD_ST *bCal_h, DMVBCAL_ST *bCal , TABLE_HEAD_ST *cCal_h, DMVCCAL_ST *cCal , TABLE_HEAD_ST *bRaw_h, DMVBRAW_ST *bRaw , TABLE_HEAD_ST *cRaw_h, DMVCRAW_ST *cRaw , TABLE_HEAD_ST *Fic_h, DMVDFIC_ST *Fic ) { /*:>-------------------------------------------------------------------- **: ROUTINE : mMvdSetUcal_ **: **: DESCRIPTION : from GEANT hits, calculate address and add the effects of **: noise ,cross_talk ,dead channels and digitize. **: **: **: AUTHOR : J.H.Park, S.S.Ryu (YonSei Univ.) (Feb 03 98) **: Add the effects of noise ,cross_talk ,dead channels **: J.H.Park, S.S.Ryu (YonSei Univ.) (Nov 10 97) **: Translated from the original Fortran version VERSTRIP.f, **: VER_GETP.f, VER_NOIS.f, VER_DARY.f, VER_UPAK.f, **: and PVER_DODIGI.f written by J.P.Sullivan **: **: ARGUMENTS : **: IN: **: ghit - GEANT hits **: ghit_h - header Structure for ghit **: Par - mvd uncalibration parameters **: Par_h - header Structure for Par **: bPar - barrel detector geometry parameter **: bPar_h - header Structure for bPar **: cPar - pad detector geometry parameters **: cPar_h - header Structure for cPar **: tPar - trigger parameters **: tPar_h - header Structure for tPar **: Geo - mvd geometry parameters from GEANT **: Geo_h - header Structure for Geo **: bGeo - barrel detector geometric values **: bGeo_h - header Structure for bGeo **: cGeo - pad detector geometric values **: cGeo_h - header Structure for cGeo **: bDbase - mvd barrel database table **: bDbase_h - header Structure for bDbase **: cDbase - mvd endcap database table **: cDbase_h - header Structure for cDbase **: bCal - barrel detector calibration data **: bCal_h - header Structure for bCal **: cCal - endcap detector calibration data **: cCal_h - header Structure for cCal **: INOUT: **: OUT: **: bRaw - barrel detector raw ADC data **: bRaw_h - header Structure for bRaw **: cRaw - pad detector raw ADC data **: cRaw_h - header Structure for cRaw **: RETURNS: STAF Condition Value **: HISTORY: 23-Dec-97 JPSullivan added some comments, change ntype **: from short to long, change calculations of **: pad "end" and barrel "row" from pisa **: convention to offline convention. **: 10-Feb-98 J.H.Park added code to fill table **: which has multiplicity data from geant hits **: 23-Feb-98 fix calculating cross_talk data for endcaps **: **: 23-Feb-98 S.S.Ryu **: changing atan to atan2 in function adrpad, **: because atan wouldn't give correct adresses. **: **: 27-Mar-98 C.F. Maguire changed itrak from short to int **: since track number range exceeds two bytes. **: The itrak variable is not used in routine at **: this time. **: **: 14-Apr-98 J.P.Sullivan **: replace all printf with MvdMess calls, **: including those which were commented out. **: **: 29-Apr-98 J.P.Sullivan **: added a few comments, cleaned up a few things **: 28-Jul-98 J.P.Sullivan **: remove use of STAFCV_BAD **: 15-Oct-98 J.P.Sullivan **: changed noise calculation **: **: 15-Dec-98 S.S.Ryu fixed sign convention in N/S pads **: (N should be 1 and S should be 0, it was **: opposite before today). **: **: S.S.Ryu 09-JUL-1999 replaces declarations like **: "struct dMvdGeo_st *geo" **: with STAF standard "DMVDGEO_ST *geo" **:>------------------------------------------------------------------*/ short i,j,k,itemp; short x; DMVBRAW_ST *bdummy; short NZDIM; short NPHUSE; short NVPAD_RBINS; short NVPAD_PHI; float skev[3072][6][2]; float skevpad[144][21][2]; short nhitpad[144][21][2]; short multi=ghit_h->nok; float sleng=Geo->nstrip*Geo->pitch/2.; int wfradr; float dele; int itrak; float xin[3],xout[3]; float pitch=Geo->pitch; short MAXSTRIP=256; short cellhit,padhit; short nphichip; short nphipad; short nrpad; float stripdele[256]; short stripadr[256]; short nrow,nwafer; float phideg; /* phi (degrees) of a row in the barrel */ float DELPHI=60; /* degrees in phi between barrel rows */ int ntype; /* max value is 40000, so a signed short does not work */ short end; /* from ntype, 0 is south end, 1 is north */ short iz; float xymid[2]; int bmulti[2],cmulti[2]; int totalhit; float sumkev,summev; MvdMess_("mMvdSetUcal",NO_ERROR,LOUD, "mMvdSetUcal{\n\tghit_h->nok =%d",ghit_h->nok); NPHUSE =bPar->NPHUSE; NZDIM =bPar->NZDIM; NVPAD_RBINS=cPar->NVPAD_RBINS; NVPAD_PHI =cPar->NVPAD_PHI; summev=sumkev=0; /* clear keV per channel array for strips */ for (k=0;k<=1;k++){ bmulti[k] = 0; for (j=0;j0 && ntype <=2) { itemp = wfradr-ntype*10000; nrow = itemp/1000; /* 0-5 (phi) */ nwafer = itemp-nrow*1000; /* 1-12 (z) */ /* converting from fortran to c */ ntype--; /* now this is the shell number (0-1) */ nwafer--; /* now this is the panel number (0-11) */ nrow--; /* now this is the row number (0-5) */ /* now convert from the (unfortunate) pisa convention in which */ /* the first phi segment is usually at -120 deg to the official */ /* offline convention in which the first phi segment is at phi=0. */ /* A simpler algorithm could be used here if we assumed that the */ /* pisa convention will never change, this code should work even */ /* when the pisa convention is changed since Geo.sv1ph tells us */ /* the phi value of the first row in pisa. */ phideg = Geo[0].sv1ph + nrow*DELPHI; /* get phi of this row */ if ( phideg < -1. ) { phideg+=360.; /* force positive value of phi */ } nrow = (phideg/DELPHI) + 0.5; /* round to nearest integer */ adrcell(xin,xout,dele,sleng,pitch,MAXSTRIP,&cellhit,stripadr,stripdele); if (NZDIM !=bPar->NZDIM) { MvdMess_("mMvdSetUcal",ERROR_1,VERY_LOUD, " after adrcell i= %d \ wfradr=%d,ntype=%d,nrow=%d,nwafer=%d\t", i,wfradr,ntype,nrow,nwafer); return STAFCV_OK; /* remove use of STAFCV_BAD because it */ /* causes a crash on rcf linux */ } for(j=0;jnstrip+stripadr[j]; skev[iz][nrow][ntype]+=stripdele[j]; if ( iz > 3072 || iz < 0) { MvdMess_("mMvdSetUcal",ERROR_2,VERY_LOUD, "SubscriptRangeError \niz = %d ",iz); return STAFCV_OK; /* remove use of STAFCV_BAD because it */ /* causes a crash on rcf linux */ } } bmulti[ntype]++; } /* for pad */ if (ntype >2 && ntype < 5) { /* MvdMess_("mMvdSetUcal",NO_ERROR,SILENT, "\tNTYPE : %d ",ntype); */ /* For a hit on the pad detector, the pad number will be calculated from the average of xin and xout. Because the probability of hitting multiple pads is low, this version of the algorithm assumes only one pad hit. */ xymid[0]=(xin[0]+xout[0])/2; xymid[1]=(xin[1]+xout[1])/2; /* MvdMess_("mMvdSetUcal",NO_ERROR,SILENT, "\txin=%f %f %f xout= %f %f %f \n\txymid= %f %f", xin[0],xin[1],xin[2],xout[1],xout[2],xout[3], xymid[0],xymid[1]); */ ntype-=3; end=1-ntype; /* here, follow official convention in which */ /* 0 = -z (South), 1 = +z (North) */ /*MvdMess_("mMvdSetUcal",NO_ERROR,SILENT, "\tntype=%d end=%d",ntype,end); */ adrpad(cPar,cGeo,xymid,&padhit,&nphichip,&nphipad,&nrpad ); if ( NZDIM !=bPar->NZDIM ) { MvdMess_("mMvdSetUcal",ERROR_3,VERY_LOUD, " after adrpad i= %d wfradr=%d,ntype=%d,nrow=%d,nwafer=%d\t", i,wfradr,ntype,nrow,nwafer); return STAFCV_OK; /* remove use of STAFCV_BAD because it */ /* causes a crash on rcf linux */ } if( padhit !=0) { skevpad[nphipad][nrpad][end]+=dele; nhitpad[nphipad][nrpad][end]++; cmulti[end]++; MvdMess_("mMvdSetUcal",NO_ERROR,SILENT, "\tnphipad=%d nrpad=%d end=%d dele=%f skevpad=%f", nphipad, nrpad, end, dele, skevpad[nphipad][nrpad][end]); } } } Fic->inner_multi=bmulti[0]; /* true multiplicity of inner shell */ Fic->outer_multi=bmulti[1]; /*true multiplicity of outer shell */ Fic->south_multi=cmulti[0]; /* true multiplicity of south endcap */ Fic->north_multi=cmulti[1]; /* true multiplicity of north endcap */ Fic_h->nok=1; /* for(k=0;k<=1 ;k++) for(j=0;j 0){ MvdMess_("mMvdSetUcal",NO_ERROR,SILENT, "\tskev[%d][%d][%d]=%f",i,j,k, skev[i][j][k]); } */ for(k=0;k<=1 ;k++) for (j=0;j 0){ MvdMess_("mMvdSetUcal",NO_ERROR,SILENT, "\tskevpad[%d][%d][%d]=%f",i,j,k,skevpad[i][j][k]); } addnoise(bDbase_h,bDbase,cDbase_h,cDbase,Par,bPar,cPar,Geo,skev,skevpad); /* for(k=0;k<=1 ;k++) for(j=0;j 0){ MvdMess_("mMvdSetUcal",NO_ERROR,SILENT, "\tskev[%d][%d][%d]=%f",i,j,k, skev[i][j][k]); } */ for(k=0;k<=1 ;k++) for (j=0;j 0){ MvdMess_("mMvdSetUcal",NO_ERROR,SILENT, "\tskevpad[%d][%d][%d]=%f",i,j,k,skevpad[i][j][k]); } ds2ReallocTable(&bRaw_h,&bRaw,30000); /* 6*12*256+2*12*256+4*4*256=28672); ds2ReallocTable(&cRaw_h,&cRaw,6200); /* 2*12*21*12=6048 */ bdummy=bRaw; digitize(bDbase_h,bDbase,cDbase_h,cDbase,bRaw_h,bRaw,cRaw_h,cRaw,Par,bPar,cPar, Geo,bCal,cCal,skev,skevpad,&totalhit); MvdMess_("mMvdSetUcal",NO_ERROR,QUIET,"\tInner Shell # of hit = %d\ \n\tOuter Shell # of hit = %d\ \n\tEndcap (-z) # of hit = %d\ \n\tEndcap (+z) # of hit = %d ", bmulti[0],bmulti[1],cmulti[0],cmulti[1]); MvdMess_("mMvdSetUcal",NO_ERROR,QUIET,"\tbRaw_h->nok = %d\ \n\tcRaw_h->nok = %d\ \n\ttotalhit = %d", bRaw_h->nok, cRaw_h->nok, totalhit ); /* PISA : Mev average E loss in inner shell */ for (i=0;i tPar->THRESH_KEV) sumkev+=skev[j][i][0]; MvdMess_("mMvdSetUcal",NO_ERROR,LOUD,"}"); return STAFCV_OK; } long adrcell( float *xin, float *xout, float dele, float sleng, float pitch, short max, short *cellhit, short *stripadr, float *stripdele ) { /* arguments ; IN : xin, xout,del,sleng,pitch,max OUT : cellhit,stripadr,stripdele */ int i; short nhit=0; float z1,z2,z_tmp; float d_z1,d_z2,total_z; int n_z1,n_z2; z1=xin[2]+sleng; z2=xout[2]+sleng; /* make z2 > z1 */ if (z1 > z2){ z_tmp = z1; z1 = z2; z2 = z_tmp; } n_z1 = (int)(z1/pitch); n_z2 = (int)(z2/pitch); /* assert (n_z2 <256); */ /* if ( n_z1 > 255 || n_z2 > 255) MvdMess_("mMvdSetUcal",NO_ERROR,SILENT, " z1=%f,z2=%f,sleng=%f,n_z1=%d,n_z2=%d",z1,z2,sleng,n_z1,n_z2); */ *cellhit=0; if ( n_z1 == n_z2 ){ if ( (n_z1>=0) && (n_z1 < max) ){ stripdele[nhit] = dele; /* adding dE to AADC */ stripadr[nhit] = n_z1; /* saving jstrip index */ ++nhit; } } else{ d_z1 = pitch * (n_z1+1) - z1; d_z2 = z2 - pitch * n_z2; total_z = d_z1 + d_z2 + pitch*(n_z2-n_z1-1); for (i=n_z1; i<= n_z2; i++) if ( i>=0 && i< max ){ /* if ( nhit == (max-1) ){ nhit++; *cellhit=nhit; return STAFCV_OK; } */ stripadr[nhit] = i; if ( i == n_z1){ stripdele[nhit] = dele * d_z1/total_z; } else if ( i == n_z2 ){ stripdele[nhit] = dele * d_z2/total_z; } else stripdele[nhit] = dele * pitch/total_z; ++nhit ; } } *cellhit=nhit; if (nhit < 0 || nhit > 256){ MvdMess_("mMvdSetUcal",ERROR_4,VERY_LOUD,"\tcellhit=%d,nhit=%d",cellhit,nhit); return STAFCV_OK; /* remove use of STAFCV_BAD because it */ /* causes a crash on rcf linux */ } return STAFCV_OK; } long adrpad( DMVCPAR_ST *cPar,DMVCGEO_ST *cGeo, float *xymid, short *padhit, short *nphichip, short *nphipad, short *nrpad ){ /* arguments ; INS : cPar,cGeo,xymid OUTS : padhit,nphichip,nphipad,nrpad */ float rpad, vpad_phi,delta,xchan; short i,ichan; float TWOPHI=6.283185308; *padhit=0; rpad= (float)sqrt((double)(xymid[0]*xymid[0]+xymid[1]*xymid[1])); if ( rpad >=cGeo->rcuts[0] && rpad <= cGeo->rcuts[cPar->NVPAD_RBINS]) { for( i=0; rpad >=cGeo->rcuts[i] && i <=cPar->NVPAD_RBINS ;++i); *nrpad=--i; vpad_phi = atan2((double)xymid[1],(double)xymid[0]); if ( vpad_phi<0 ) vpad_phi = vpad_phi+TWOPHI; *nphichip=vpad_phi/cPar->VPAD_DELPHI; delta = vpad_phi-cGeo->phi_cent[*nphichip]; xchan =delta/cPar->VPAD_DELPHI2+cPar->NVPAD_SEGS2/2; if (xchan >0) { ichan=xchan; if ( ichan < cPar->NVPAD_SEGS2) { *nphipad=cPar->NVPAD_SEGS2*(*nphichip) +ichan; *padhit=1; } } } return STAFCV_OK; } long addnoise( TABLE_HEAD_ST *bDbase_h,DMVBDBASE_ST *bDbase, TABLE_HEAD_ST *cDbase_h,DMVCDBASE_ST *cDbase, DMVDPAR_ST *Par,DMVBPAR_ST *bPar,DMVCPAR_ST *cPar, DMVDGEO_ST *Geo, float skev[3072][6][2],float skevpad[144][21][2]) { /* arguments ; IN :bDbase_h,bDbase,cDbase_h,cDbase,Par,bPar,cPar,Geo INOUT : skev,skevpad */ int i; int index,sindex; short shell,shell_tmp,row,row_tmp,panel,strip; /* for barrels */ short end,end_tmp,wedge,wedge_tmp,crow,column; /* for endcaps */ float xnpair,diff_kev,sigma_kev; /* C interface for CERNLIB utilities */ float rg32_(int *); int dummy =0; for (i=0;i nok;++i) { /* transform index into index of skev array */ index=i; Table_bDbase(Geo,bPar,cPar,index,&shell,&row,&panel,&strip); /* MvdMess_("mMvdSetUcal",NO_ERROR,SILENT, "%d :%d,%d,%d,%d",index,shell,row,panel,strip); */ sindex=strip+panel*Geo->nstrip; xnpair=(bDbase[index].noise+skev[sindex][row][shell])*\ Par->xnum_mip/Par->skev_mip; if (xnpair > 0) { sigma_kev= Par->skev_noise; diff_kev=sigma_kev*rg32_(&dummy); /* MvdMess_("mMvdSetUcal",NO_ERROR,SILENT, "\tsqrt(xnpair)=%f,\ \n\tsigma_kev =%f,\ \n\tdiff_kev =%f", (float)sqrt((double)xnpair),sigma_kev,diff_kev); */ skev[sindex][row][shell]+=diff_kev; } } for (i=0;inok;++i) { index=i; Table_cDbase(Geo,bPar,cPar,index,&end,&wedge,&crow,&column); sindex=column+cPar->NVPAD_SEGS*wedge; /* MvdMess_("mMvdSetUcal",NO_ERROR,SILENT, "sindex:%d\twedge:%d\tend:%d",sindex,wedge,end); */ xnpair=(skevpad[sindex][crow][end]+cDbase[index].noise)*\ Par->xnum_mip/Par->skev_mip; if (xnpair>0){ sigma_kev= Par->skev_noise; diff_kev=sigma_kev*rg32_(&dummy); skevpad[sindex][crow][end]+=diff_kev; } } return STAFCV_OK; } long digitize( TABLE_HEAD_ST *bDbase_h,DMVBDBASE_ST *bDbase , TABLE_HEAD_ST *cDbase_h,DMVCDBASE_ST *cDbase , TABLE_HEAD_ST *bRaw_h, DMVBRAW_ST *bRaw, TABLE_HEAD_ST *cRaw_h, DMVCRAW_ST *cRaw, DMVDPAR_ST *Par,DMVBPAR_ST *bPar, DMVCPAR_ST *cPar, DMVDGEO_ST *Geo,DMVBCAL_ST *bCal ,DMVCCAL_ST *cCal , float skev[3072][6][2],float skevpad[144][21][2], int *totalhit) { /* arguments ; INS : bDbase_h,bDbase ,cDbase_h,cDbase ,bRaw_h,bRaw,cRaw_h,cRaw, Par,bPar,cPar, Geo,skev,skevpad OUTS : bRaw,cRaw,totalhit */ short i,j,k; int sindex,index; float bdigi[3072][6][2]; /* for barrels */ short shell,row,panel,strip; int NPHUSE=bPar->NPHUSE; int NZDIM=bPar->NZDIM; float edigi[144][21][2]; /* for endcaps */ short end,wedge,erow,column; short crow; int NVPAD_RBINS=cPar->NVPAD_RBINS; int NVPAD_PHI=cPar->NVPAD_PHI; float outchan; int btemp,ctemp; DMVBRAW_ST *bdummy=bRaw; DMVCRAW_ST *cdummy=cRaw; *totalhit=0; btemp=0; ctemp=0; for (k=0;k<=1;++k) for(j=0;j Par->ver_thrsh) bdigi[i][j][k] = Par->full_scale*skev[i][j][k]/Par->smax_kev; else bdigi[i][j][k]=0; } /* estimate cross talk effect between strips */ for (i=0;i nok;++i) { /* transform index into index of skev array */ index=i; Table_bDbase(Geo,bPar,cPar,index,&shell,&row,&panel,&strip); sindex=strip+panel*Geo->nstrip; if ( strip==0 ) outchan =(1-bDbase[index].cross_talk)*bdigi[sindex][row][shell]+\ bDbase[index+1].cross_talk*bdigi[1][row][shell]; else if ( strip==255) outchan =(1-bDbase[index].cross_talk)*bdigi[sindex][row][shell]+\ bDbase[index-1].cross_talk*bdigi[254][row][shell]; else outchan = (1-2*bDbase[index].cross_talk)*bdigi[sindex][row][shell]+\ bDbase[index-1].cross_talk*bdigi[sindex-1][row][shell]+\ bDbase[index+1].cross_talk*bdigi[sindex+1][row][shell]; /* estimate dead channel effect */ if (outchan*bCal->gain > Par->ver_thrsh && bDbase[i].flag_dead_channel !=0 ) { outchan = outchan< Par->full_scale? outchan:Par->full_scale; bdummy->shell=shell; bdummy->row =row; bdummy->cell =sindex/Geo->nstrip; bdummy->strip=sindex%Geo->nstrip; bdummy->adc =(short)outchan; bdummy++; btemp++; } } bRaw_h->nok=btemp; *totalhit+=btemp; for (k=0;k<=1;++k) for(j=0;jPar->ver_thrsh) edigi[i][j][k]=(Par->full_scale*skevpad[i][j][k])/Par->smax_kev; else edigi[i][j][k]=0; } for (i=0;inok;++i) { outchan=0; index=i; Table_cDbase(Geo,bPar,cPar,index,&end,&wedge,&crow,&column); sindex=column+cPar->NVPAD_SEGS2*wedge; for ( erow=0;erow < NVPAD_RBINS;erow++) { index=cDbase_Table(Geo,bPar,cPar,end,wedge,erow,column); if ( erow == crow) outchan+=(1-20*cDbase[index].cross_talk)*edigi[sindex][crow][end]; else outchan+=cDbase[index].cross_talk*edigi[sindex][erow][end]; } /* estimate dead channel effect */ /* we assume ADC value of dead channels is zero */ if (outchan*cCal->gain > Par->ver_thrsh && cDbase[i].flag_dead_channel !=0){ outchan=outchan< Par->full_scale?outchan:Par->full_scale; cdummy->end=end; cdummy->row=crow; cdummy->wedge=sindex/cPar->NVPAD_SEGS2; cdummy->column=sindex%cPar->NVPAD_SEGS2; cdummy->adc =(short)outchan; cdummy++; ctemp++; MvdMess_ ( "mMvdSetUcal",NO_ERROR,SILENT, "\tdigitize end=%d row=%d column=%d wedge=%d outchan=%f", end,crow,column,wedge,outchan); } } cRaw_h->nok=ctemp; *totalhit+=ctemp; return STAFCV_OK; }