]>
Commit | Line | Data |
---|---|---|
d15ca731 | 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 AliMUONGlobalTriggerBoard |
20 | /// Global trigger implementation: | |
21 | /// - inputs are regional responses | |
22 | /// - output is a 12-bit word | |
23 | /// - 4 bits per trigger level | |
71a2d3aa | 24 | /// \todo Change member functions comments in capital letters to normal text |
c4ee792d | 25 | /// |
26 | /// \author Rachid Guernane (LPCCFd) | |
3d1463c8 | 27 | //----------------------------------------------------------------------------- |
d15ca731 | 28 | |
29 | #include "AliMUONGlobalTriggerBoard.h" | |
41922e78 | 30 | #include "AliLog.h" |
d15ca731 | 31 | #include "TBits.h" |
32 | ||
33 | #include <Riostream.h> | |
34 | ||
35 | ClassImp(AliMUONGlobalTriggerBoard) | |
36 | ||
37 | //___________________________________________ | |
38 | AliMUONGlobalTriggerBoard::AliMUONGlobalTriggerBoard() | |
39 | { | |
71a2d3aa | 40 | /// Default constructor |
41 | ||
d15ca731 | 42 | for (Int_t i=0;i<16;i++) fRegionalResponse[i] = 0; |
43 | } | |
44 | ||
45 | //___________________________________________ | |
46 | AliMUONGlobalTriggerBoard::AliMUONGlobalTriggerBoard(const char *name, Int_t a) : AliMUONTriggerBoard(name, a) | |
47 | { | |
71a2d3aa | 48 | /// Standard constructor |
49 | ||
d15ca731 | 50 | for (Int_t i=0;i<16;i++) fRegionalResponse[i] = 0; |
51 | } | |
52 | ||
71a2d3aa | 53 | //___________________________________________ |
54 | AliMUONGlobalTriggerBoard::~AliMUONGlobalTriggerBoard() | |
55 | { | |
56 | /// Destructor | |
57 | } | |
58 | ||
41922e78 | 59 | //___________________________________________ |
60 | void AliMUONGlobalTriggerBoard::Mask(Int_t index, UShort_t mask) | |
61 | { | |
71a2d3aa | 62 | /// MASK GLOBAL TRIGGER BOARD INPUT index WITH VALUE mask |
41922e78 | 63 | if ( index>=0 && index < 16 ) |
64 | { | |
65 | fMask[index]=mask; | |
66 | } | |
67 | else | |
68 | { | |
69 | AliError(Form("Index %d out of bounds (max %d)",index,16)); | |
70 | } | |
71 | } | |
72 | ||
d15ca731 | 73 | //___________________________________________ |
74 | void AliMUONGlobalTriggerBoard::Response() | |
75 | { | |
71a2d3aa | 76 | /// COMPUTE THE GLOBAL TRIGGER BOARD |
77 | /// RESPONSE ACCORDING TO THE Algo() METHOD | |
78 | // output from global trigger algorithm | |
79 | // [+, -, LS, US] * [Hpt, Lpt] | |
80 | // transformed to [usHpt, usLpt, lsHpt, lsLpt, sHpt, sLpt] according | |
81 | // to Global Trigger Unit user manual | |
d15ca731 | 82 | |
8d4fefab | 83 | Int_t t[16]; |
41922e78 | 84 | for (Int_t i=0;i<16;i++) t[i] = fRegionalResponse[i] & fMask[i]; |
d15ca731 | 85 | |
86 | Int_t rank = 8; | |
87 | ||
88 | for (Int_t i=0;i<4;i++) | |
89 | { | |
90 | Int_t ip = 0; | |
91 | ||
92 | for (Int_t j=0;j<rank;j++) | |
93 | { | |
ad705f30 | 94 | UShort_t lthres = Algo(t[2*j],t[2*j+1],"LPT"); |
d15ca731 | 95 | |
ad705f30 | 96 | UShort_t hthres = Algo(t[2*j],t[2*j+1],"HPT"); hthres <<= 4; |
d15ca731 | 97 | |
ad705f30 | 98 | t[ip] = lthres | hthres; |
d15ca731 | 99 | |
100 | ip++; | |
101 | } | |
102 | ||
103 | rank /= 2; | |
104 | } | |
8d4fefab | 105 | UChar_t sLpt, sHpt, lsLpt, lsHpt, usLpt, usHpt; |
106 | sLpt = ((t[0] & 0xC) != 0); | |
107 | sHpt = ((t[0] & 0xC0) != 0); | |
108 | lsLpt = ((t[0] & 0x2) != 0); | |
109 | lsHpt = ((t[0] & 0x20) != 0); | |
110 | usLpt = ((t[0] & 0x1 ) != 0); | |
111 | usHpt = ((t[0] & 0x10) != 0); | |
112 | ||
113 | sHpt <<= 1; | |
114 | lsLpt <<= 2; | |
115 | lsHpt <<= 3; | |
116 | usLpt <<= 4; | |
117 | usHpt <<= 5; | |
118 | ||
119 | fResponse = sLpt | sHpt | lsLpt | lsHpt | usLpt |usHpt; | |
d15ca731 | 120 | } |
121 | ||
122 | //___________________________________________ | |
123 | UShort_t AliMUONGlobalTriggerBoard::Algo(UShort_t i, UShort_t j, char *thres) | |
124 | { | |
71a2d3aa | 125 | /// GLOBAL TRIGGER ALGORITHM |
ad705f30 | 126 | TBits a(8), b(8); a.Set(8,&i); b.Set(8,&j); |
d15ca731 | 127 | |
128 | TBits trg1(2), trg2(2), trg(2); | |
129 | ||
ad705f30 | 130 | if (!strcmp(thres,"LPT")) |
d15ca731 | 131 | { |
132 | trg1[0] = a[2]; trg1[1] = a[3]; | |
133 | trg2[0] = b[2]; trg2[1] = b[3]; | |
134 | } | |
d15ca731 | 135 | else |
136 | { | |
ad705f30 | 137 | trg1[0] = a[6]; trg1[1] = a[7]; |
138 | trg2[0] = b[6]; trg2[1] = b[7]; | |
d15ca731 | 139 | } |
140 | ||
141 | TBits trgLS1(1), trgUS1(1), trgLS2(1), trgUS2(1), trgLS(1), trgUS(1); | |
142 | ||
ad705f30 | 143 | if (!strcmp(thres,"LPT")) |
d15ca731 | 144 | { |
145 | trgLS1[0] = a[1]; trgUS1[0] = a[0]; | |
146 | trgLS2[0] = b[1]; trgUS2[0] = b[0]; | |
147 | } | |
d15ca731 | 148 | else |
149 | { | |
ad705f30 | 150 | trgLS1[0] = a[5]; trgUS1[0] = a[4]; |
151 | trgLS2[0] = b[5]; trgUS2[0] = b[4]; | |
d15ca731 | 152 | } |
153 | ||
154 | trgLS[0] = ( trg1[0] & trg2[0] ) | ( trg1[1] & trg2[1] ) | trgLS1[0] | trgLS2[0]; | |
155 | trgUS[0] = ( trg1[0] & trg2[1] ) | ( trg1[1] & trg2[0] ) | trgUS1[0] | trgUS2[0]; | |
156 | ||
157 | trg[0] = trg1[0] | trg2[0]; | |
158 | trg[1] = trg1[1] | trg2[1]; | |
159 | ||
160 | TBits v(4); | |
161 | ||
162 | v[0] = trgUS[0]; | |
163 | v[1] = trgLS[0]; | |
164 | v[2] = trg[0]; | |
165 | v[3] = trg[1]; | |
166 | ||
167 | UShort_t rv = 0; | |
168 | v.Get(&rv); | |
169 | ||
170 | return rv; | |
171 | } | |
172 | ||
173 | //___________________________________________ | |
edd00c2d | 174 | void AliMUONGlobalTriggerBoard::Scan(Option_t*) const |
d15ca731 | 175 | { |
71a2d3aa | 176 | /// PRINT GLOBAL TRIGGER OUTPUT |
ad705f30 | 177 | TBits w(8); w.Set(8,&fResponse); |
d15ca731 | 178 | |
179 | // TRG[1:0] | |
180 | // 00 noth | |
181 | // 01 negative track | |
182 | // 10 positive track | |
183 | // 11 undef | |
184 | ||
ad705f30 | 185 | Int_t iSP[2] = {0,0}, iSM[2] = {0,0}, iSU[2] = {0,0}; |
d15ca731 | 186 | |
187 | TBits a(2), n(2), p(2), u(2); | |
188 | ||
189 | UShort_t val; | |
190 | ||
191 | val = 1; n.Set(2,&val); | |
192 | val = 2; p.Set(2,&val); | |
193 | val = 3; u.Set(2,&val); | |
194 | ||
195 | a[0] = w[2]; | |
196 | a[1] = w[3]; | |
197 | ||
198 | if (a==p) iSP[0] = 1; | |
199 | else if (a==n) iSM[0] = 1; | |
200 | else if (a==u) iSU[0] = 1; | |
201 | ||
202 | a[0] = w[6]; | |
203 | a[1] = w[7]; | |
204 | ||
205 | if (a==p) iSP[1] = 1; | |
206 | else if (a==n) iSM[1] = 1; | |
207 | else if (a==u) iSU[1] = 1; | |
208 | ||
ad705f30 | 209 | Int_t iPU[2] = {w[0],w[4]}; |
210 | Int_t iPL[2] = {w[1],w[5]}; | |
d15ca731 | 211 | |
ad705f30 | 212 | printf("============================================\n"); |
213 | printf(" Global Trigger output Low pt High pt\n"); | |
d15ca731 | 214 | printf(" number of Single Plus :\t"); |
ad705f30 | 215 | for (Int_t i=0; i<2; i++) printf("%i\t",iSP[i]); |
d15ca731 | 216 | printf("\n"); |
217 | printf(" number of Single Minus :\t"); | |
ad705f30 | 218 | for (Int_t i=0; i<2; i++) printf("%i\t",iSM[i]); |
d15ca731 | 219 | printf("\n"); |
220 | printf(" number of Single Undefined :\t"); | |
ad705f30 | 221 | for (Int_t i=0; i<2; i++) printf("%i\t",iSU[i]); |
d15ca731 | 222 | printf("\n"); |
223 | printf(" number of UnlikeSign pair :\t"); | |
ad705f30 | 224 | for (Int_t i=0; i<2; i++) printf("%i\t",iPU[i]); |
d15ca731 | 225 | printf("\n"); |
226 | printf(" number of LikeSign pair :\t"); | |
ad705f30 | 227 | for (Int_t i=0; i<2; i++) printf("%i\t",iPL[i]); |
d15ca731 | 228 | printf("\n"); |
229 | printf("===================================================\n"); | |
230 | printf("\n"); | |
231 | } | |
232 | ||
233 | ClassImp(AliMUONGlobalTriggerBoard) |