StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
trgQTMasks.h
1 #ifndef _TRG_QT_MASKS_
2 #define _TRG_QT_MASKS_
3 
4 #include <rtsSystems.h>
5 
6 
7 /*
8  The "system" bits below are used in the per-event STP "system_word"
9  which defines whic Trigger (sub)systems need to be readout for
10  this particular event.
11 
12  For example, an STP word in this form:
13 
14  stp_system_word = (1<<TRG_SYS_VPD) | (1<<TRG_SYS_MTD) | (1<< TRG_SYS_FMS) ;
15 
16  will _only_ read the QT boards that correspond those sysbsystems
17  for this specific event.
18 
19  These bits are used/set/sent in the L0 processor depending on the trigger/event
20  based upon the Run Control per/trigger setup.
21 
22  They are also used in the QT readout code.
23 */
24 
25 /* bits of the various Trigger QT-based subsystems */
26 #define TRG_SYS_VPD 0
27 #define TRG_SYS_BBC 1
28 #define TRG_SYS_ZDC 2
29 #define TRG_SYS_TOF 3
30 #define TRG_SYS_MTD 4
31 #define TRG_SYS_FMS 5
32 #define TRG_SYS_PP2 6 /* pp2pp */
33 #define TRG_SYS_EPD 7
34 
35 
36 
37 
38 /*
39  The function below will return the bitmask of QTs which only
40  need to be readout for a given Trigger crate (or "instance" as defined
41  in rtsSystems.h) using the per-event STP "system word" set by
42  the L0 CPU based upon the Run Control setings.
43 
44  The function is ONLY used in the QT readout task.
45 */
46 inline unsigned int trgQTCrateMask(int my_trg_instance, unsigned int stp_system_word)
47 {
48  unsigned int mask = 0 ;
49 
50  switch(my_trg_instance) {
51  case TRG_QT1_INSTANCE :
52  case TRG_QT2_INSTANCE :
53  case TRG_QT3_INSTANCE :
54  case TRG_QT4_INSTANCE :
55  if(stp_system_word & (1<<TRG_SYS_FMS)) mask |= 0x3FF ; //11 QTs each
56  break ;
57  case TRG_BBQ_INSTANCE :
58  if(stp_system_word & (1<<TRG_SYS_BBC)) mask |= 0x001 ;
59  if(stp_system_word & (1<<TRG_SYS_VPD)) mask |= 0x040 ;
60  if(stp_system_word & (1<<TRG_SYS_ZDC)) mask |= 0x100 ;
61  break ;
62  case TRG_MXQ_INSTANCE :
63  if(stp_system_word & (1<<TRG_SYS_MTD)) mask |= 0x371 ;
64  if(stp_system_word & (1<<TRG_SYS_PP2)) mask |= 0x002 ;
65  if(stp_system_word & (1<<TRG_SYS_ZDC)) mask |= 0x004 ;
66  if(stp_system_word & (1<<TRG_SYS_VPD)) mask |= 0x018 ;
67  break ;
68  case TRG_FEQ_INSTANCE :
69  if(stp_system_word & (1<<TRG_SYS_EPD)) mask |= 0x003 ;
70  break ;
71 
72  default : //this is an error!
73  break ;
74  }
75 
76  return mask ;
77 
78 }
79 
80 
81 
82 #endif