source: tags/Mars-V0.9.4/mtrigger/MTriggerPattern.cc

Last change on this file was 7170, checked in by tbretz, 20 years ago
*** empty log message ***
File size: 6.3 KB
Line 
1/* ======================================================================== *\
2!
3! *
4! * This file is part of MARS, the MAGIC Analysis and Reconstruction
5! * Software. It is distributed to you in the hope that it can be a useful
6! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
7! * It is distributed WITHOUT ANY WARRANTY.
8! *
9! * Permission to use, copy, modify and distribute this software and its
10! * documentation for any purpose is hereby granted without fee,
11! * provided that the above copyright notice appear in all copies and
12! * that both that copyright notice and this permission notice appear
13! * in supporting documentation. It is provided "as is" without express
14! * or implied warranty.
15! *
16!
17!
18! Author(s): Nicola Galante 12/2004 <mailto:nicola.galante@pi.infn.it>
19! Author(s): Thomas Bretz 12/2004 <mailto:nicola.galante@pi.infn.it>
20!
21! Copyright: MAGIC Software Development, 2004
22!
23\* ======================================================================== */
24
25/////////////////////////////////////////////////////////////////////////////
26//
27// MTriggerPattern
28//
29// A container to store the decoded trigger pattern.
30//
31// The idea is, that this container will never change the meaning of its
32// variables, while the trigger pattern itself could.
33//
34// If new 'features' are necessary the decoding (MTriggerPatternDecode)
35// must be changed to correctly decode the pattern into the existing
36// MTriggerPattern. If new information is decoded you may have to
37// add new variables to this container. Don't forget to increase the
38// class version number (ClassDef) and document your change HERE.
39//
40// For files before file version 5 the trigger pattern is set to 00000000.
41//
42// --------------------------------------------------------------------------
43//
44// Here an explanation about the meaning of the Trigger Pattern.
45// The trigger pattern is a 16-BIT number where are stored informations
46// about which thriggers have been shot on each event. Every bit
47// correspond to a prticular kind of trigger (Pedestal, Calibration,
48// LT1, LT2, PIN Diode...) but the whole trigger pattern number
49// is divided into two parts (from left to right):
50//
51// 1) The first concerns unprescaled triggers.
52// 2) The second concerns prescaled triggers.
53//
54// The prescaler is a devise installed AFTER the LT2. It collects
55// all kind of triggers and can prescale each trigger by a different
56// prescaling factor. This means that we can set the prescaler to
57// accept every LT2 trigger but only 1% of calibration triggers.
58// Therefore LT2 prescaling factor will be set to 1, while CAL prescaling
59// factor will be set to 100. If after the prescaler at least one trigger
60// survives, then the event is considered "TRIGGERED" and aquired by the DAQ.
61//
62// The current BIT meaning is:
63//
64// BIT(0): prescaled LT1
65// BIT(1): prescaled Calibration Trigger
66// BIT(2): prescaled LT2
67// BIT(3): prescaled Pedestal Trigger
68// BIT(4): prescaled Pin Diode
69// BIT(5): unused
70// BIT(6): unused
71// BIT(7): unused
72// BIT(8): unprescaled LT1
73// BIT(9): unprescaled Calibration Trigger
74// BIT(10): unprescaled LT2
75// BIT(11): unprescaled Pedestal Trigger
76// BIT(12): unprescaled Pin Diode
77// BIT(13): unused
78// BIT(14): unused
79// BIT(15): unused
80//
81// Why are we saving both prescaled and unprescaled triggers?
82// Which should I look at? Let's give an example:
83//
84// BIT # 15-14-13-12-11-10- 9- 8- 7- 6- 5- 4- 3- 2- 1- 0
85//
86// event #1: 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 1
87// event #2: 0 0 0 0 0 0 1 1 0 0 0 0 0 0 1 1
88//
89// In both cases you have both CAL and LT1 trigger, but in first
90// event calibration trigger is prescaled and in second event no
91// trigger is prescaled. Imagine you are looking for calibration events.
92// If you look at the prescale bits you are sure that events with CAL
93// flag are calibration events (event #2) but you can miss other
94// real calibration events (event #1). If you are lucky that
95// the related prescaling factor is 1 you won't have this problem,
96// otherway you will have it.
97//
98// To select events by the trigger pattern you should use MFTriggerPattern filter.
99// This filter uses Require- and Deny- methods to select your trigger pattern.
100// Require- methods requires that your trigger bit is ON, otherway the event
101// is kicked out. Deny- methods requires that your trigger bit is OFF, otherway
102// your event is kicked out. Other bits not selected by your Require- or Deny- call
103// are ignored. Let's give an example. You want to select all events that have
104// both LT1 and LT2 trigger but which are not calibration neither Pin Diode events.
105// You should look at unprescaled bits to be sure
106// about which were the initial triggers. Then you can implement in your macro
107// something like:
108//
109// MFTriggerPattern ftrigpatt;
110// ftrigpatt.RequireTriggerLvl1(MFTriggerPattern::kUnPrescaled);
111// ftrigpatt.RequireTriggerLvl2(MFTriggerPattern::kUnPrescaled);
112// ftrigpatt.DenyCalibration(MFTriggerPattern::kUnPrescaled);
113// ftrigpatt.DenyPinDiode(MFTriggerPattern::kUnPrescaled);
114//
115// Then you use in your tasklist as a usual MF filter. In this
116// example Pedestal trigger flag is ignored. Consider that by default
117// MFTriggerPattern::kUnPrescaled is set for Require- and Deny- methods.
118//
119// WARNING: please use MTriggerPatternDecode task to read the trigger pattern
120// of the event and to fill MTriggerPattern container. If you use your
121// private stuff to read MRawEvtHeader.fTriggerPattern[0] (data member
122// where the trigger pattern is stored) you must invert all the bits of
123// your number. Current hardware, infact, writes the trigger pattern bit-inverted.
124//
125//
126// For further informations contact:
127//
128// Nicola Galante nicola.galante@pi.infn.it
129// Riccardo Paoletti riccardo.paoletti@pi.infn.it
130// Antonio Stamerra antonio.stamerra@pi.infn.it
131//
132/////////////////////////////////////////////////////////////////////////////
133#include "MTriggerPattern.h"
134
135ClassImp(MTriggerPattern);
136
137using namespace std;
138
139// --------------------------------------------------------------------------
140//
141// Default constructor
142//
143MTriggerPattern::MTriggerPattern(const char *name, const char *title)
144 : fPrescaled(0), fUnprescaled(0)
145{
146 fName = name ? name : "MTriggerPattern";
147 fTitle = title ? title : "Container for decoded trigger pattern";
148}
Note: See TracBrowser for help on using the repository browser.