StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
fgtPed.h
1 #ifndef _FGT_PED_HH_
2 #define _FGT_PED_HH_
3 
4 
5 #include <sys/types.h>
6 
7 #include "daq_fgt.h"
8 
9 #define FGT_CH_STAT_SHOULD 0x01 // exists in hardware
10 #define FGT_CH_STAT_NO_CONFIG 0x02 // killed in RC or config file
11 #define FGT_CH_STAT_NO_RESPONSE 0x04 // killed in ARS_configure, non responding CH
12 #define FGT_CH_STAT_BAD 0x08 // killed in bad_channel
13 #define FGT_CH_STAT_PED_UNKNOWN 0x10 // never had a good pedestal calculated
14 
15 class fgtPed {
16 public:
17  fgtPed(int rts_id) ;
18  ~fgtPed() { ; } ;
19 
20 
21  int valid ; // when calced or loaded
22 
23  void init(int active_rbs) ; // mallocs (if nece) and clears ped_store
24 
25  void clear() ;
26  void clear_from_cache() ;
27 
28  void accum(char *evbuff, int bytes, int rdo1) ;
29 
30  void calc() ; // calculates mean/rms into ped_store
31  int to_evb(char *buff) ; // to EVB format from ped_store
32 
33  double do_thresh(double n_sigma, int k_seq, int log_bad) ;
34 
35  int do_zs(char *src, int in_bytes, char *dst, int rdo1) ;
36  int run_stop() ; // prints errors etc.
37 
38  int from_cache(char *fname = 0) ; // from cached file to ped_store
39  int to_cache(char *fname, u_int run, int dont_cache) ; // to cached file from ped_store
40  int bad_from_cache(char *fname = 0) ;
41 
42 
43  int rts_id ; //IST,FMT,FGT...
44 
45  int tb_cou_xpect ; // as set in the conf file "ntimebins"!
46  int tb_cou_ped ; // as in the pedestals/load file!
47 
48  u_int total_charge ; // summed up in the do_zs
49 
50  u_char ch_status[FGT_RDO_COU][FGT_ARM_COU][FGT_APV_COU][FGT_CH_COU] ;
51 
52 //private:
53  // allocated per RDO
54 
55 
56 
57  struct peds_t {
58 // float cmn_rms[FGT_ARM_COU][FGT_APV_COU][FGT_CH_COU][FGT_TB_COU] ; // common noise stuff for FST
59 
60  float ped[FGT_ARM_COU][FGT_APV_COU][FGT_CH_COU][FGT_TB_COU] ;
61  float rms[FGT_ARM_COU][FGT_APV_COU][FGT_CH_COU][FGT_TB_COU] ;
62  u_short thr[FGT_ARM_COU][FGT_APV_COU][FGT_CH_COU] ;
63  u_short cou[FGT_ARM_COU][FGT_APV_COU][FGT_CH_COU] ; // no need for TB cou!
64  } peds[FGT_RDO_COU], peds_from_cache[FGT_RDO_COU] ;
65 
66 
67  daq_fgt *fgt_rdr[FGT_RDO_COU] ; // need this for ADC unpacking!
68 
69  int rb_mask ;
70 
71  int k_seq ;
72  double n_sigma ;
73 
74  struct fgt_stat_t {
75  int err ;
76  int evts ;
77  int arm_mask ;
78 
79 
80  int err_apv[FGT_ARM_COU][FGT_APV_COU] ;
81  int cou_apv[FGT_ARM_COU][FGT_APV_COU] ;
82  } fgt_stat[FGT_RDO_COU] ; // counts from 0!
83 } ;
84 
85 #endif
Definition: fgtPed.h:15