StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
daq100Decision.h
1 #ifndef _DAQ100_DECISION_H_
2 #define _DAQ100_DECISION_H_
3 
4 #include <daqModes.h>
5 
6 /*
7  The function returns a bitfield:
8 
9  Bit2 Do HLT
10  Bit1 Do Cluster Finding
11  Bit0 Do raw ADC
12 */
13 
14 extern inline int daq100Decision(int t, u_int daq_cmd, u_int run_type, u_int cl_run, u_int zero_wr)
15 {
16  int fmt, proc, hlt ;
17 
18  proc = 0 ;
19  fmt = 0 ;
20  hlt = 0 ;
21 
22  if(run_type == RUN_TYPE_DAQCHECK) return 1 ; // JUST fmt
23  if((t <= 0) || (t>=4096)) return 1 ; // JUST fmt for token 0 or other odd tokens...
24 
25  // cluster finder only in non-pedestal runs
26  if(run_type != RUN_TYPE_PED) { // only for non-pedestal runs!
27  if(cl_run == 0) proc = 0 ;
28  else if((t % cl_run)==0) proc = 1 ;
29 
30  // HLT
31 // if(daq_cmd & DAQCMD_HLT_RUN) hlt = 1 ; // Tonko: removed on Dec 13, 2009
32  }
33 
34  // raw formatting
35 #define ITPC_TOKEN_HACK
36 #ifdef ITPC_TOKEN_HACK
37  if(daq_cmd & 0x1) {
38 #else
39  if(daq_cmd & DAQCMD_FMT_ONLY) { // always i.e. zerobias
40 #endif
41  fmt = 1 ;
42  }
43  else {
44  if(zero_wr == 0) fmt = 0 ;
45  else if((t % zero_wr)==0) fmt = 1 ;
46  }
47 
48 
49  // special run types override
50  switch(run_type) {
51  case RUN_TYPE_PULSER :
52  case RUN_TYPE_PED_B : // misc tests...
53 // case RUN_TYPE_LASER : // Tonko: removed laser on Apr 14, 2009
54  fmt = 1 ;
55  break ;
56  }
57 
58  // assume HLT for physics runs whenever we also want clusterfinding.
59  // should not really be used but just for completness
60  // Tonko: Dec 13, 2009
61  if(run_type == RUN_TYPE_PHYS) {
62  if(proc) hlt = 1 ;
63  }
64 
65  return (hlt << 2) | (proc << 1) | fmt ;
66 
67 }
68 
69 #endif