Trigger Mask
Introduction
The Trigger Mask is made by the Decoding Library. It uses the information from the Prescaler module, where all trigger signals arrive.
The information flow for the trigger is done via a few steps: First of all, there is the detector level from where you get the trigger signals for hits in the hodoscopes and other detectors. These signals are then processed in the trigger logic, where you get out logic signals for a specific condition. That is what we call "a Trigger". An example: If you get correlated hits in the RPD, the BC and the FI01X plane, but don't have any hits in the Sandwich, Hodoscope Vetos or the BK, then you will get the DT0 Trigger signal. If you also have a hit in the FH, you will also have a CT1 Trigger. After that, all these trigger signals arrive at the Prescaler module, which has several inputs (you can take a look at the
Hadron Trigger pages to see the mapping). The signal arriving first triggers the TCS controller, which starts the Compass read-out.
The first input of the Prescaler now corresponds to the first Trigger Mask bit, i.e. 1. The second input corresponds to 2, the third one to 4, the fourth one to 8 and so on. If two inputs at the Prescaler fire at the same time, the bits are just added up. Example: You have a hit in the CT1 trigger (4th input), which is a logical subset of DT0 (CT1 = DTO and FH). Normally then you also expect a hit in the DT0(1st) input of the prescaler. That means the Trigger mask for such an event is simply 1 + 8 = 9.
Note: For using the Trigger Mask in this way, one should know if the triggers are logical subsets of each other. Sometimes even logical subsets do not overlap, which is the case if the run included some prescaling of triggers. One can get this information via the run logbook, where the Prescaler settings are stored for each run.
Selecting Triggers
If you want to select specific triggers in your analysis, you may use one of the following options:
putting an option to Phast
If you run your UserEvent function with Phast, you can simply start Phast with the option "-t mmmm" where mmmm is the decimal representation of the Trigger Mask.
putting some cuts in the UserEvent
You may implement some small code in your UserEvent function, which could look like this:
void UserEvent01(PaEvent& e) {
static TTree* tree(NULL); // a tree to save your results
static long Trig; // a variable to save the trigger mask of an event
static bool first=1;
if(first)
{
tree = new TTree("data","my analysis data");
tree->Branch("Trig",&Trig,"Trig/I");
first=0;
}
Trig=(e.TrigMask()&0xfff); // to get rid of Online Filter Mask entries > 0xfff(=4095)
tree->Fill();
}
After that you can easily make a cut on Trig to select your desired trigger, like
if (!(Trig & 0x1)) continue;
to select all DT0 events.
Advanced usage: Sometimes due to deadtimes etc. you may have triggers for e.g. CT1 but not for DT0. Logically that can't be, because CT1 is a subset of DT0. So you may also include these events safely via an or condition. Then your code may look like
if (!(Trig & 0x1) && !(Trig & 0x8)) continue;
Careful, though, as this may bias the data due to different pre-scaler settings. For the sake of argument, say there are a lot more CT1 triggers than DT0 triggers in the run you're analysing. If you select DT0 triggers including CT1 as described above, your sample would consist mainly of events which had CT1 as their trigger, i.e. your selection of DT0 events would be biased towards events that had CT1 triggers.
In any case, if you encounter problems or need help, just contact one member of the Trigger or Offline Group.
--
JohannesBernhard - 12 Nov 2008
--
TobiasSchlueter - 12 Nov 2008