00001 #include <math.h>
00002 #include <stdio.h>
00003 #include <string.h>
00004
00005 #include "BbcHex.h"
00006
00007
00008
00009 BbcHex::BbcHex(int i,char *nme) {
00010 id=i;
00011 strncpy(name,nme,len);
00012 name[len-1]=0;
00013 a=b=c=d=0;
00014 clear();
00015 }
00016
00017
00018
00019 void BbcHex::clear() {
00020 tdc=adc=0;
00021 tof=-999;
00022 }
00023
00024
00025
00026 void BbcHex::setHit(int T , int A) {
00027 tdc=T;
00028 adc=A;
00029 float xx=adc;
00030 if(adc>maxAdc) xx=maxAdc;
00031 float tCor=0;
00032 if(b!=.0)tCor=a+b*exp(-c*pow(xx,d));
00033 tof=tdc-tCor;
00034 }
00035
00036
00037
00038 void BbcHex::print(int k){
00039 printf(" tail=%s adc=%d tdc=%d tof=%f \n",name,adc,tdc,tof);
00040 }
00041
00042
00043