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