110 likes | 299 Views
The Incredible Power of a FIR Filter. SVD Meeting. Tested Readout Chain. 12m of cable between hybrid (APV25) and repeater 1m of cable between repeater and APVDAQ (VME) One channel optimized for cable termination & pre-emphasis Other channels remained in standard configuration. 12m. 1m.
E N D
The Incredible Power of a FIR Filter Markus Friedl (HEPHY Vienna) SVD Meeting
Tested Readout Chain • 12m of cable between hybrid (APV25) and repeater • 1m of cable between repeater and APVDAQ (VME) • One channel optimized for cable termination & pre-emphasis • Other channels remained in standard configuration 12m 1m CAT7 cable Small pitch Twisted-pair Cable (CERN) Hybrid Repeater VME Markus Friedl (HEPHY Vienna)
APV25 Output (idle) Without Filter • Optimized channel • Non-optimized channel Cable transfer function Cable transfer function Big negative reflection Small positive reflection Markus Friedl (HEPHY Vienna)
APV25 Output • Luckily, the APV25 delivers tick marks when idle • Can be interpreted as impulse response of the transfer chain • We just need averaged tick marks (used 300 events here) • After normalization, the data can be used to calculate the FIR filter coefficients (triangular matrix inversion) Markus Friedl (HEPHY Vienna)
Averaged APV25 Output • Optimized channel • Non-optimized channel After normalization, first 8 samples are used to calculate filter coefficients Markus Friedl (HEPHY Vienna)
C Code to calculate filter coefficients (simple!) voidprocess_fir(void) { // calculate FIR coefficientsandprogramthem // input: double fir_adc[MAX_APV][35] (not normalized, averaged ADC values, [33]=baseline) // output: double firconst[MAX_APV][8] (signedfractional) unsignedchar i; intj,k,l; double max_fir_adc=0., sumcoeff=0., sum=0.; double vdelta[8], hF[8], h[34]; double H[8*8]; for (i=0; i<number_apv; i++) // loopover all APV25 chips { for(j=0; j<33; j++) // subtractbaselineand find peak { h[j]=fir_adc[i][j]-fir_adc[i][33]; // subtractbaseline //searchmaxoffir_adc[MAX_APV][35]: if (j==0) { max_fir_adc=h[0]; } if (h[j]>max_fir_adc) { max_fir_adc=h[j]; } } for (j=0; j<33; j++) // normalize { h[j]=h[j]/max_fir_adc; } // initializematrix H: for (j=0; j<8; j++) { for (k=0; k<=j; k++) { H[j*8+k]= h[j-k]; } for (k=j+1; k<8; k++) { H[j*8+k]=0.; } } // initializevectordelta_i, hF: memset(hF,0,sizeof(hF)); memset(vdelta,0,sizeof(vdelta)); vdelta[0]=1.; // calculate filter coefficients // (recursiveinversionoftriangularmatrix): sumcoeff=0.; for (j=0; j<8; j++) { sum=0; for (l=0; l<j; l++) { sum = sum+H[j*8+l]*hF[l]; } hF[j] = 1./H[j*8+j]*(vdelta[j]-sum); sumcoeff += hF[j]; } // normalize filter coefficients (sumof all coefficients := 1) for(j=0; j<8; j++) { firconst[i][j]=hF[j]/sumcoeff; } } } Markus Friedl (HEPHY Vienna)
Altera Firmware Implementation • Uses dedicated DSP blocks (MULT+ADD with 40 MHz) • 16bit signed integer inputs (coefficients are scaled by 2^14) Markus Friedl (HEPHY Vienna)
APV25 Output without/with FIR8 filter • Firmware implementation (using APVDAQ 6U VME board) • Optimized channel: Without FIR With firmware FIR Markus Friedl (HEPHY Vienna)
APV25 Noise without/with FIR8 filter • Peaks at channels 0,32,64,96,… indicate header aftermath • Optimized channel: Scale is different Without FIR With firmware FIR Markus Friedl (HEPHY Vienna)
Surprise • FIR filter even works for non-optimized channels! • No need to worry about termination anymore Without FIR With firmware FIR Markus Friedl (HEPHY Vienna)
Next Step • Write Belle II Note • Nakayama-san told me the present location: • http://b2comp.kek.jp/~twiki/bin/view/Archive/Belle2note • Jacobus van Hoorne (student): filter calculation • Helmut Steininger: firmware implementation Acknowledgements Markus Friedl (HEPHY Vienna)