StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
fstPed.h
1 #ifndef _FST_PED_HH_
2 #define _FST_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 fstPed {
16 public:
17  fstPed(int rts_id) ;
18  ~fstPed() { ; } ;
19 
20  double nSigmaCut ;
21 
22  double nSeedsCut ;
23  int nSeedsTbs ;
24 
25  double nPedsCut1 ;
26  int nPedsTbs1 ;
27 
28  float nPedsCut2 ;
29  int nPedsTbs2 ;
30 
31  int valid ; // when calced or loaded
32 
33  void init(int active_rbs) ; // mallocs (if nece) and clears ped_store
34 
35  void clear() ;
36  void clear_from_cache() ;
37 
38  void accum(char *evbuff, int bytes, int rdo1) ;
39 
40  void calc() ; // calculates mean/rms into ped_store
41  int to_evb(char *buff) ; // to EVB format from ped_store
42 
43  double do_thresh(double n_sigma, int k_seq, int log_bad) ;
44 
45  int do_zs(char *src, int in_bytes, char *dst, int rdo1, int id) ;
46  int run_stop() ; // prints errors etc.
47 
48  int from_cache(char *fname = 0) ; // from cached file to ped_store
49  int to_cache(char *fname, u_int run, int dont_cache) ; // to cached file from ped_store
50  int bad_from_cache(char *fname = 0) ;
51 
52 
53  int sector ; // 1 or 2
54 
55  int evts_for_rms ;
56  int evts_for_cmn ;
57 
58  int tb_cou_xpect ; // as set in the conf file "ntimebins"!
59  int tb_cou_ped ; // as in the pedestals/load file!
60 
61  u_int total_charge ; // summed up in the do_zs
62 
63  u_char ch_status[FGT_RDO_COU][FGT_ARM_COU][FGT_APV_COU][FGT_CH_COU] ;
64 
65  static char cmnGroup[24][128] ; // apv,ch
66 
67  static int load_group(const char *fname=0) ;
68 
69 //private:
70  // allocated per RDO
71 
72 
73 
74  struct peds_t {
75  float cmn_ped[FGT_ARM_COU][FGT_APV_COU][FGT_CH_COU][FST_TB_COU] ; // common noise stuff for FST
76  double cmn_rms[FGT_ARM_COU][FGT_APV_COU][FGT_CH_COU][FST_TB_COU] ; // common noise stuff for FST
77 
78  float ped[FGT_ARM_COU][FGT_APV_COU][FGT_CH_COU][FST_TB_COU] ;
79  double rms[FGT_ARM_COU][FGT_APV_COU][FGT_CH_COU][FST_TB_COU] ;
80 
81  u_short cou[FGT_ARM_COU][FGT_APV_COU][FGT_CH_COU][FST_TB_COU] ;
82  } peds[FGT_RDO_COU] ; // peds_from_cache[FGT_RDO_COU] ; // I'm not sure I need this 2nd one at all
83 
84 
85  daq_fgt *fgt_rdr[8] ; // need this for ADC unpacking!
86 
87  int rb_mask ;
88 
89  int k_seq ;
90  double n_sigma ;
91 
92 
93  struct fgt_stat_t {
94  int err ;
95  int evts ;
96  int arm_mask ;
97 
98 
99  int err_apv[FGT_ARM_COU][FGT_APV_COU] ;
100  int cou_apv[FGT_ARM_COU][FGT_APV_COU] ;
101  } fgt_stat[FGT_RDO_COU] ; // counts from 0!
102 } ;
103 
104 #endif
Definition: fstPed.h:15