gotthard-changes in trimming_funcs and shared_memory to just make it compile

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@36 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
l_maliakal_d
2011-10-14 15:08:14 +00:00
parent 9cb8c0c378
commit ef657a9218

View File

@ -212,16 +212,14 @@ int choose_vthresh_and_vtrim(int countlim, int nsigma, int im) {
for (ithr=0; ithr<nthr; ithr++) { for (ithr=0; ithr<nthr; ithr++) {
fifoReset(); fifoReset();
/* scanning threshold */ /* scanning threshold */
/* commented out by dhanya
for (imod=modmi; imod<modma; imod++) { for (imod=modmi; imod<modma; imod++) {
thr=getDACbyIndexDACU(VTHRESH,imod); //commented out by dhanya thr=getDACbyIndexDACU(VTHRESH,imod);
if (ithr==0) { if (ithr==0) {
thrmi[imod]=thr; thrmi[imod]=thr;
initDACbyIndexDACU(VTHRESH,thr,imod); //commented out by dhanya initDACbyIndexDACU(VTHRESH,thr,imod);
} else } else
initDACbyIndexDACU(VTHRESH,thr+thrstep,imod); ;//commented out by dhanya initDACbyIndexDACU(VTHRESH,thr+thrstep,imod);
} }
*/
/* setCSregister(ALLMOD); /* setCSregister(ALLMOD);
setSSregister(ALLMOD); setSSregister(ALLMOD);
@ -243,14 +241,12 @@ int choose_vthresh_and_vtrim(int countlim, int nsigma, int im) {
for (imod=modmi; imod<modma; imod++) { for (imod=modmi; imod<modma; imod++) {
for (ichan=0; ichan<nChans*nChips; ichan++){ for (ichan=0; ichan<nChans*nChips; ichan++){
ich=imod*nChips*nChans+ichan; ich=imod*nChips*nChans+ichan;
/*commented out by dhanya
if (scan[ich]>countlim && trim[ich]==-1) { if (scan[ich]>countlim && trim[ich]==-1) {
trim[ich]=getDACbyIndexDACU(VTHRESH,imod); //commented out by dhanya trim[ich]=getDACbyIndexDACU(VTHRESH,imod);
#ifdef VERBOSE #ifdef VERBOSE
// printf("yes: %d %d %d\n",ich,ithr,scan[ich]); // printf("yes: %d %d %d\n",ich,ithr,scan[ich]);
#endif #endif
} }
*/
#ifdef VERBOSE #ifdef VERBOSE
/* else { /* else {
printf("no: %d %d %d\n",ich,ithr,scan[ich]); printf("no: %d %d %d\n",ich,ithr,scan[ich]);
@ -265,7 +261,7 @@ int choose_vthresh_and_vtrim(int countlim, int nsigma, int im) {
vthreshmean=0; vthreshmean=0;
vthreshSTDev=0; vthreshSTDev=0;
nvalid=0; nvalid=0;
// commented out by dhanya thrma[imod]=getDACbyIndexDACU(VTHRESH,imod); //commented out by dhanya thrma[imod]=getDACbyIndexDACU(VTHRESH,imod);
for (ichan=0; ichan<nChans*nChips; ichan++){ for (ichan=0; ichan<nChans*nChips; ichan++){
ich=imod*nChans*nChips+ichan; ich=imod*nChans*nChips+ichan;
@ -278,7 +274,7 @@ int choose_vthresh_and_vtrim(int countlim, int nsigma, int im) {
if (nvalid>0) { if (nvalid>0) {
vthreshmean=vthreshmean/nvalid; vthreshmean=vthreshmean/nvalid;
//vthreshSTDev=sqrt((vthreshSTDev/nvalid)-vthreshmean*vthreshmean); cuz <asm/page.h> is commented in firmware_funcs.c and in shared_memory.c //commented out by dhanya vthreshSTDev=sqrt((vthreshSTDev/nvalid)-vthreshmean*vthreshmean);
} else { } else {
vthreshmean=thrmi[imod]; vthreshmean=thrmi[imod];
vthreshSTDev=nthr*thrstep; vthreshSTDev=nthr*thrstep;
@ -296,19 +292,19 @@ int choose_vthresh_and_vtrim(int countlim, int nsigma, int im) {
printf("Can't find correct threshold for module %d\n",imod); printf("Can't find correct threshold for module %d\n",imod);
retval=FAIL; retval=FAIL;
} }
//commented out by dhanya initDACbyIndexDACU(VTHRESH,thr,imod); //commented out by dhanya initDACbyIndexDACU(VTHRESH,thr,imod);
#ifdef VERBOSE #ifdef VERBOSE
printf("vthresh=%d \n",thr); printf("vthresh=%d \n",thr);
#endif #endif
c=CVTRIM-2.*nsigma*vthreshSTDev/63.; c=CVTRIM-2.*nsigma*vthreshSTDev/63.;
// thr=(int)((-b-sqrt(b*b-4*a*c))/(2*a)); cuz <asm/page.h> is commented in firmware_funcs.c and in shared_memory.c //commented out by dhanya thr=(int)((-b-sqrt(b*b-4*a*c))/(2*a));
if (thr<500 || thr>(DAC_DR-1)) { if (thr<500 || thr>(DAC_DR-1)) {
thr=750; thr=750;
printf("Can't find correct trimbit size for module %d\n",imod); printf("Can't find correct trimbit size for module %d\n",imod);
retval=FAIL; retval=FAIL;
} }
//commented out by dhanya initDACbyIndexDACU(VTRIM,thr,imod); //commented out by dhanya initDACbyIndexDACU(VTRIM,thr,imod);
#ifdef VERBOSE #ifdef VERBOSE
printf("vtrim=%d \n",thr); printf("vtrim=%d \n",thr);
@ -478,7 +474,6 @@ int ave(int *a, int n)
int choose_vthresh() { int choose_vthresh() {
int retval=OK; int retval=OK;
/* commented out by dhanya
#ifdef MCB_FUNCS #ifdef MCB_FUNCS
int imod, ichan; int imod, ichan;
u_int32_t *scan, *scan1; u_int32_t *scan, *scan1;
@ -530,7 +525,7 @@ int choose_vthresh() {
// //
med[imod]=median(scan1+imod*nChans*nChips,nChans*nChips); med[imod]=median(scan1+imod*nChans*nChips,nChans*nChips);
med1[imod]=med[imod]; med1[imod]=med[imod];
// commented out by dhanya vthreshmean=vthreshmean+getDACbyIndexDACU(VTHRESH,imod); //commented out by dhanya vthreshmean=vthreshmean+getDACbyIndexDACU(VTHRESH,imod);
olddiff[imod]=0xffffff; olddiff[imod]=0xffffff;
direction[imod]=0; direction[imod]=0;
printf("Median of module %d=%d\n",imod,med[imod]); printf("Median of module %d=%d\n",imod,med[imod]);
@ -577,7 +572,7 @@ int choose_vthresh() {
else else
direction[ichan]=-1; direction[ichan]=-1;
} }
vthresh=getDACbyIndexDACU(VTHRESH,imod); //commented out by dhanya vthresh=getDACbyIndexDACU(VTHRESH,imod);
if ( direction[ichan]!=-3) { if ( direction[ichan]!=-3) {
if (abs(diff)>abs(olddiff[ichan])) { if (abs(diff)>abs(olddiff[ichan])) {
vthresh=vthresh-direction[ichan]; vthresh=vthresh-direction[ichan];
@ -597,7 +592,7 @@ int choose_vthresh() {
olddiff[ichan]=diff; olddiff[ichan]=diff;
change_flag=1; change_flag=1;
} }
initDACbyIndex(VTHRESH,vthresh, ichan); //commented out by dhanya initDACbyIndex(VTHRESH,vthresh, ichan);
} }
} }
iteration++; iteration++;
@ -605,7 +600,6 @@ int choose_vthresh() {
free(scan1); free(scan1);
} }
#endif #endif
*/
return retval; return retval;
} }
@ -711,7 +705,7 @@ int trim_with_median(int stop, int im) {
for (ich=0; ich<nChans; ich++) { for (ich=0; ich<nChans; ich++) {
ichan=imod*nChips*nChans+ichip*nChans+ich; ichan=imod*nChips*nChans+ichip*nChans+ich;
nextStrip(imod); nextStrip(imod);
diff=scan[ichan]-med; diff=scan[ichan]-me[imod];
if (direction[ichan]==0) { if (direction[ichan]==0) {
if (diff>0) { if (diff>0) {
direction[ichan]=1; direction[ichan]=1;