## 3 The PMT Readout and Trigger System
### Trigger Masks  
The detector acquisition is conditioned by boolean expressions that are called \"trigger masks\".  
The PMT&T board implements three classes of trigger masks: the first class is named \"event acquisition masks\" and validates events produced by particles that are contained inside the detector. The \"event monitor masks\" class, instead, is used for efficiency measurements and to report particles that escape from the bottom or the sides of the calorimeter. The last class, named \"GRB detection masks\", represents an innovation for the mission and is designed for detecting Gamma Ray Bursts in the 2 to 20 MeV energy range.  
The event acquisition masks are defined as follows:  
\[M_{1}=TR1 And \tag{1}\]  
\[M_{2}=TR1\cdot TR2 \tag{2}\]  
\[M_{3}=TR1\cdot TR2\cdot RAN\_02 \tag{3}\]  
where the names of the detector sections (i.e., \(TR1\), \(TR2\), \(RAN\_xx\) and \(EN\_xx\)) identify the OR of the signals produced by the PMTs. The \"\(And\)\" suffix is used when the AND of the two PMTs connected to the same scintillator is used.  
These three masks are designed for particles with gradually increasing energies: \(M_{1}\) will produce a trigger for particles that lose all their energy in the first trigger plane. The other two masks allow the detection of particles that reach the TR2 scintillator (\(M_{2}\)) and the \(RAN\_02\) slab (\(M_{3}\)).  
The following masks belong to the event monitor class:  
\[M_{4}=RAN\_01\cdot RAN\_07\cdot RAN\_12 \tag{4}\]  
\[M_{5}=TR2\cdot BOT \tag{5}\]  
\[M_{6}=BOT\cdot EN1\cdot EN2\cdot\overline{TR1+TR2+LAT} \tag{6}\]  
\[M_{7}=\frac{(RAN\_05 And+RAN\_06 And+RAN\_07 And+RAN\_08 And)}{(\overline{RAN\_04 +RAN\_09})}\cdot \tag{7}\]  
The \(M_{4}\) masks allows for efficiency measurements if compared with \(M_{1}\), \(M_{2}\) or \(M_{3}\).  
Masks \(M_{5}\), \(M_{6}\) and \(M_{7}\) are designed for not contained particles.  
Lastly, there are two GRB detection masks:  
\[M_{8}=(EN1 And+EN2 And)\cdot(\overline{RAN\_12+LAT+BOT}) \tag{8}\]  
\[M_{9}=\frac{(RAN\_05 And+RAN\_06 And+RAN\_07 And+RAN\_08 And)}{(\overline{RAN\_04 +RAN\_09+LAT})}\cdot \tag{9}\]  
The \(M_{8}\) mask will trigger when signals are produced only in the LYSO crystals and not in the preceding plastic scintillators. The \(M_{9}\) mask, instead, is triggered by signals produced only in the central stages of the calorimeter and not in the surrounding scintillators.  
In addition to these, a \"generic trigger mask\" can be configured to obtain the AND of any scintillator.  
Six of these trigger masks can be selected to operate in concurrency and can be pre-scaled. This allows the control of the bandwidth occupation between different physics channels and to acquire data in regions of the orbit where the particle rate, especially for low energies, significantly increases and can reach hundreds of megahertz.  
To obtain these features, six multiplexers are connected to the output of the 10 trigger masks, and their outputs can be selected via SpaceWire registers.  
The outputs of four of these multiplexers are connected to counters that ignore a configurable number of triggers, actually accomplishing the pre-scaling.