StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
stage_0_201900.cxx
1 
2 #include <stdio.h>
3 #include "fcs_trg_base.h"
4 
5 void fcs_trg_base::stage_0_201900(adc_tick_t adc, geom_t geo, ped_gain_t *pg, u_int *dta_out)
6 {
7  int sum = 0 ;
8 // int peak = 0 ;
9 // int last = 0 ;
10 
11  for(int tb=0;tb<8;tb++) {
12  u_short radc = adc.d[tb] ;
13 
14  switch(tb) {
15  case 0 :
16  sum = radc ;
17 // peak = 0 ;
18 // last = 0 ;
19  break ;
20  default :
21  sum += radc ;
22  if(tb==7) {
23  sum -= pg->ped ;
24  if(sum < 0) sum = 0 ;
25  if(sum>0 && fcs_trgDebug>=2){
26  if(geo.det<2){
27  printf("ns=%1d det=%1d dep=%2d ch=%2d sum=%6d gain=%6d s*g=%6d pT=%6.3f\n",
28  geo.ns,geo.det,geo.dep,geo.ch,
29  sum,pg->gain,(sum*pg->gain)>>6,
30  0.00024711*((sum*pg->gain)>>6) );
31  }else{
32  printf("ns=%1d det=%1d dep=%2d ch=%2d sum=%6d gain=%6d s*g=%6d MIP=%5.3f\n",
33  geo.ns,geo.det,geo.dep,geo.ch,
34  sum,pg->gain,(sum*pg->gain)>>6,
35  float((sum*pg->gain)>>6)/100.0);
36  }
37  }
38  sum *= pg->gain ;
39  sum >>= 6 ;
40  }
41  }
42  }
43  *dta_out = sum ;
44 }