StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
daq_sst.h
1 #ifndef _DAQ_SST_H_
2 #define _DAQ_SST_H_
3 
4 #include <DAQ_READER/daq_det.h>
5 
6 #define SST_RDO_COU 3 //per sector maximum
7 #define SST_FIBER_COU 8
8 #define SST_HYBRID_COU 16
9 #define SST_STRIP_COU 768
10 
11 
13  u_short strip ;
14  u_short adc ;
15 
16  u_char hybrid ;
17 } ;
18 
20  short ped[SST_HYBRID_COU][SST_STRIP_COU] ;
21  short rms[SST_HYBRID_COU][SST_STRIP_COU] ; //double d_rms = (double)rms/16.0
22 } ;
23 
24 /*
25  According to Jim on Feb 2014 the pedestals are calculated in the
26  following way:
27 
28  ADCprime = (ADC + PED_ADC_OFFSET) % 1024 ;
29  if(ADCprime > PED_ADC_HI) skip ;
30  if(ADCprime < PED_ADC_LO) skip ;
31  ...
32  ped = mean(ADCprime) - PED_ADC_OFFSET
33  rms = sigma(ADCprime)
34 */
35 
36 #define SST_PED_ADC_OFFSET 375
37 #define SST_OUTLIERBAND 256
38 
39 //#define SST_PED_ADC_HI 750
40 //#define SST_PED_ADC_LO 250
41 
42 struct daq_sst_ped_t {
43  double ped[SST_FIBER_COU][SST_HYBRID_COU][SST_STRIP_COU];
44  double rms[SST_FIBER_COU][SST_HYBRID_COU][SST_STRIP_COU];
45  u_int cou[SST_FIBER_COU][SST_HYBRID_COU][SST_STRIP_COU];
46 } ;
47 
48 
49 class daq_sst : public daq_det {
50 private:
51  class daq_dta *handle_raw(int sec, int rdo) ;
52  class daq_dta *handle_ped(int sec) ;
53  class daq_dta *handle_adc(int sec, int rdo, char *buff=0, int words=0) ;
54 
55  class daq_dta *raw ;
56  class daq_dta *adc ;
57  class daq_dta *ped ;
58 
59  static const char *help_string ;
60 
61 
62 
63 public:
64  daq_sst(daqReader *rts_caller=0) ;
65  ~daq_sst() ;
66 
67  daq_dta *get(const char *bank="*",int c1=-1, int c2=-1, int c3=-1, void *p1=0, void *p2=0) ;
68 
69  int get_l2(char *buff, int buff_bytes, struct daq_trg_word *trg, int prompt) ;
70 
71 
72  int raw_to_adc_utility(int s, int r, char *rdobuff, int words, daq_sst_ped_t *ped, int mode) ;
73 
74  const char *GetCVS() const { // Offline
75  static const char cvs[]="Tag $Name: $Id: built " __DATE__ " " __TIME__ ; return cvs;
76  }
77 
78 
79  u_int events[SST_RDO_COU] ;
80  u_int fiber_events[SST_RDO_COU][SST_FIBER_COU] ;
81 
82 } ;
83 
84 
85 #endif