]>
Commit | Line | Data |
---|---|---|
809874e0 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | /* $Id$ */ | |
17 | ||
3d1463c8 | 18 | //----------------------------------------------------------------------------- |
c4ee792d | 19 | /// \class AliMUONRegionalTriggerBoard |
20 | /// Dimuon regional trigger implementation: | |
21 | /// - entry are local board responses | |
22 | /// - output is 12-bit word | |
23 | /// - algorithm is similar to the global one | |
24 | /// | |
25 | /// \author Rachid Guernane (LPCCFd) | |
c05673c9 | 26 | /// Corrected by Christian Finck (Subatech) |
3d1463c8 | 27 | //----------------------------------------------------------------------------- |
809874e0 | 28 | |
29 | #include "AliMUONRegionalTriggerBoard.h" | |
30 | ||
41922e78 | 31 | #include "AliLog.h" |
32 | ||
809874e0 | 33 | #include "TBits.h" |
34 | ||
35 | #include <Riostream.h> | |
36 | ||
71a2d3aa | 37 | /// \cond CLASSIMP |
809874e0 | 38 | ClassImp(AliMUONRegionalTriggerBoard) |
71a2d3aa | 39 | /// \endcond |
809874e0 | 40 | |
41 | //___________________________________________ | |
42 | AliMUONRegionalTriggerBoard::AliMUONRegionalTriggerBoard() | |
c05673c9 | 43 | : AliMUONTriggerBoard(), |
44 | fMask(0x0) | |
809874e0 | 45 | { |
71a2d3aa | 46 | /// Default constructor |
809874e0 | 47 | for (Int_t i=0; i<16; i++) fLocalResponse[i] = 0; |
48 | } | |
49 | ||
50 | //___________________________________________ | |
c05673c9 | 51 | AliMUONRegionalTriggerBoard::AliMUONRegionalTriggerBoard(const char *name, Int_t a) |
52 | : AliMUONTriggerBoard(name, a), | |
53 | fMask(0x0) | |
809874e0 | 54 | { |
71a2d3aa | 55 | /// Standard constructor |
809874e0 | 56 | for (Int_t i=0; i<16; i++) fLocalResponse[i] = 0; |
57 | } | |
58 | ||
71a2d3aa | 59 | //___________________________________________ |
60 | AliMUONRegionalTriggerBoard::~AliMUONRegionalTriggerBoard() | |
61 | { | |
62 | /// Destructor | |
63 | } | |
64 | ||
809874e0 | 65 | //___________________________________________ |
66 | void AliMUONRegionalTriggerBoard::Response() | |
67 | { | |
c05673c9 | 68 | /// response is given following the regional algorithm |
254985cb | 69 | // output from local trigger algorithm |
70 | // [+, -] * [Hpt, Lpt] | |
71 | // transformed to [+, -, US, LS] * [Hpt, Lpt] | |
71a2d3aa | 72 | |
00d46f24 | 73 | if ( IsNull() ) return; // Do nothing if all local responses are null |
74 | ||
edd00c2d | 75 | Int_t t[16]; |
809874e0 | 76 | |
c05673c9 | 77 | for (Int_t i = 0; i < 16; ++i) |
78 | { | |
79 | if ((fMask >> i) & 0x1) | |
80 | t[i] = fLocalResponse[i]; | |
81 | else | |
82 | t[i] = 0; | |
83 | } | |
84 | ||
809874e0 | 85 | Int_t rank = 8; |
86 | ||
c05673c9 | 87 | for (Int_t i = 0; i < 4; ++i) |
809874e0 | 88 | { |
89 | Int_t ip = 0; | |
90 | ||
c05673c9 | 91 | for (Int_t j = 0; j < rank; ++j) |
809874e0 | 92 | { |
ad705f30 | 93 | UShort_t lthres = Algo(t[2*j],t[2*j+1],"LPT",i); |
254985cb | 94 | |
ad705f30 | 95 | UShort_t hthres = Algo(t[2*j],t[2*j+1],"HPT",i); hthres <<= 4; |
809874e0 | 96 | |
ad705f30 | 97 | t[ip] = lthres | hthres; |
809874e0 | 98 | |
99 | ip++; | |
100 | } | |
101 | ||
102 | rank /= 2; | |
103 | } | |
00d46f24 | 104 | |
ad705f30 | 105 | fResponse = t[0]; // 8-bit [H4:L4] |
809874e0 | 106 | } |
107 | ||
108 | //___________________________________________ | |
a6e0ebfe | 109 | UShort_t AliMUONRegionalTriggerBoard::Algo(UShort_t i, UShort_t j, const char *thres, Int_t level) |
809874e0 | 110 | { |
c05673c9 | 111 | /// implementation of the regional algorithm |
112 | /// similar to the global algorithm except for the | |
113 | /// input layer | |
71a2d3aa | 114 | |
254985cb | 115 | /// level = 0 a ,b = local response = Hpt (+|-) | Lpt (+|-) |
116 | /// level > 0 a ,b = reg response = Hpt (+|-|us|ls) | Lpt (+|-|us|ls) | |
117 | ||
ad705f30 | 118 | TBits a(8), b(8); a.Set(8,&i); b.Set(8,&j); |
809874e0 | 119 | |
120 | TBits trg1(2), trg2(2), trg(2); | |
121 | ||
ad705f30 | 122 | if (!strcmp(thres,"LPT")) |
809874e0 | 123 | { |
254985cb | 124 | |
125 | if (!level) | |
809874e0 | 126 | { |
127 | trg1[0] = a[0]; trg1[1] = a[1]; | |
128 | trg2[0] = b[0]; trg2[1] = b[1]; | |
129 | } | |
130 | else | |
131 | { | |
132 | trg1[0] = a[2]; trg1[1] = a[3]; | |
133 | trg2[0] = b[2]; trg2[1] = b[3]; | |
134 | } | |
135 | } | |
ad705f30 | 136 | else |
809874e0 | 137 | { |
138 | if (!level) | |
139 | { | |
140 | trg1[0] = a[2]; trg1[1] = a[3]; | |
141 | trg2[0] = b[2]; trg2[1] = b[3]; | |
142 | } | |
143 | else | |
144 | { | |
145 | trg1[0] = a[6]; trg1[1] = a[7]; | |
ad705f30 | 146 | trg2[0] = b[6]; trg2[1] = b[7]; |
809874e0 | 147 | } |
148 | } | |
149 | ||
150 | TBits trgLS1(1), trgUS1(1), trgLS2(1), trgUS2(1), trgLS(1), trgUS(1); | |
151 | ||
152 | if (!level) | |
153 | { | |
154 | trgLS1[0] = trgUS1[0] = trgLS2[0] = trgUS2[0] = 0; | |
155 | } | |
156 | else | |
157 | { | |
ad705f30 | 158 | if (!strcmp(thres,"LPT")) |
809874e0 | 159 | { |
254985cb | 160 | //trgLS1[0] = a[1]; trgUS1[0] = a[0]; |
161 | //trgLS2[0] = b[1]; trgUS2[0] = b[0]; | |
162 | trgLS1[0] = a[0]; trgUS1[0] = a[1]; | |
163 | trgLS2[0] = b[0]; trgUS2[0] = b[1]; | |
809874e0 | 164 | } |
809874e0 | 165 | else |
166 | { | |
254985cb | 167 | //trgLS1[0] = a[5]; trgUS1[0] = a[4]; |
168 | //trgLS2[0] = b[5]; trgUS2[0] = b[4]; | |
169 | trgLS1[0] = a[4]; trgUS1[0] = a[5]; | |
170 | trgLS2[0] = b[4]; trgUS2[0] = b[5]; | |
809874e0 | 171 | } |
172 | } | |
173 | ||
174 | trgLS[0] = ( trg1[0] & trg2[0] ) | ( trg1[1] & trg2[1] ) | trgLS1[0] | trgLS2[0]; | |
175 | trgUS[0] = ( trg1[0] & trg2[1] ) | ( trg1[1] & trg2[0] ) | trgUS1[0] | trgUS2[0]; | |
176 | ||
177 | trg[0] = trg1[0] | trg2[0]; | |
178 | trg[1] = trg1[1] | trg2[1]; | |
179 | ||
180 | TBits v(4); | |
181 | ||
254985cb | 182 | //v[0] = trgUS[0]; |
183 | //v[1] = trgLS[0]; | |
184 | v[0] = trgLS[0]; | |
185 | v[1] = trgUS[0]; | |
809874e0 | 186 | v[2] = trg[0]; |
187 | v[3] = trg[1]; | |
809874e0 | 188 | UShort_t rv = 0; |
189 | v.Get(&rv); | |
809874e0 | 190 | return rv; |
191 | } | |
edd00c2d | 192 | |
809874e0 | 193 | //___________________________________________ |
edd00c2d | 194 | void AliMUONRegionalTriggerBoard::Scan(Option_t*) const |
809874e0 | 195 | { |
c05673c9 | 196 | /// scan local board entries |
71a2d3aa | 197 | |
edd00c2d | 198 | for (Int_t i=0; i<16; i++) |
a4435944 | 199 | { |
200 | TBits b; | |
201 | b.Set(6,&fLocalResponse[i]); | |
202 | ||
203 | cout << "Entry " << i << " is " << b << endl; | |
204 | ||
205 | } | |
206 | ||
809874e0 | 207 | } |
41922e78 | 208 | //___________________________________________ |
c05673c9 | 209 | void AliMUONRegionalTriggerBoard::Mask(UShort_t mask) |
41922e78 | 210 | { |
c05673c9 | 211 | /// mask entry index |
212 | ||
213 | fMask = mask; | |
41922e78 | 214 | } |
c05673c9 | 215 | |
00d46f24 | 216 | //___________________________________________ |
217 | Bool_t AliMUONRegionalTriggerBoard::IsNull() | |
218 | { | |
219 | /// Check if all local response are null | |
220 | for (Int_t i=0; i<16; i++) { | |
221 | if ( fLocalResponse[i] ) return kFALSE; | |
222 | } | |
223 | return kTRUE; | |
224 | } | |
c05673c9 | 225 | |
226 | ||
00d46f24 | 227 | //___________________________________________ |
228 | void AliMUONRegionalTriggerBoard::Reset() | |
229 | { | |
230 | /// Reset board | |
231 | ||
232 | for (Int_t i=0; i<16; ++i) fLocalResponse[i] = 0; | |
233 | ||
234 | fResponse = 0; | |
235 | ||
236 | } |