]>
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 | ||
18 | //*-- Author: Rachid Guernane (LPCCFd) | |
edd00c2d | 19 | // GLOBAL TRIGGER IMPLEMENTATION |
20 | // INPUTS ARE REGIONAL RESPONSES | |
21 | // OUTPUT IS A 12-BIT WORD | |
22 | // 4 BITS PER TRIGGER LEVEL | |
d15ca731 | 23 | |
24 | #include "AliMUONGlobalTriggerBoard.h" | |
41922e78 | 25 | #include "AliLog.h" |
d15ca731 | 26 | #include "TBits.h" |
27 | ||
28 | #include <Riostream.h> | |
29 | ||
30 | ClassImp(AliMUONGlobalTriggerBoard) | |
31 | ||
32 | //___________________________________________ | |
33 | AliMUONGlobalTriggerBoard::AliMUONGlobalTriggerBoard() | |
34 | { | |
35 | for (Int_t i=0;i<16;i++) fRegionalResponse[i] = 0; | |
36 | } | |
37 | ||
38 | //___________________________________________ | |
39 | AliMUONGlobalTriggerBoard::AliMUONGlobalTriggerBoard(const char *name, Int_t a) : AliMUONTriggerBoard(name, a) | |
40 | { | |
41 | for (Int_t i=0;i<16;i++) fRegionalResponse[i] = 0; | |
42 | } | |
43 | ||
41922e78 | 44 | //___________________________________________ |
45 | void AliMUONGlobalTriggerBoard::Mask(Int_t index, UShort_t mask) | |
46 | { | |
edd00c2d | 47 | // MASK GLOBAL TRIGGER BOARD INPUT index WITH VALUE mask |
41922e78 | 48 | if ( index>=0 && index < 16 ) |
49 | { | |
50 | fMask[index]=mask; | |
51 | } | |
52 | else | |
53 | { | |
54 | AliError(Form("Index %d out of bounds (max %d)",index,16)); | |
55 | } | |
56 | } | |
57 | ||
d15ca731 | 58 | //___________________________________________ |
59 | void AliMUONGlobalTriggerBoard::Response() | |
60 | { | |
edd00c2d | 61 | // COMPUTE THE GLOBAL TRIGGER BOARD |
62 | // RESPONSE ACCORDING TO THE Algo() METHOD | |
d15ca731 | 63 | Int_t t[16]; |
64 | ||
41922e78 | 65 | for (Int_t i=0;i<16;i++) t[i] = fRegionalResponse[i] & fMask[i]; |
d15ca731 | 66 | |
67 | Int_t rank = 8; | |
68 | ||
69 | for (Int_t i=0;i<4;i++) | |
70 | { | |
71 | Int_t ip = 0; | |
72 | ||
73 | for (Int_t j=0;j<rank;j++) | |
74 | { | |
75 | UShort_t athres = Algo(t[2*j],t[2*j+1],"APT"); | |
76 | ||
77 | UShort_t lthres = Algo(t[2*j],t[2*j+1],"LPT"); lthres <<= 4; | |
78 | ||
79 | UShort_t hthres = Algo(t[2*j],t[2*j+1],"HPT"); hthres <<= 8; | |
80 | ||
81 | t[ip] = athres | lthres | hthres; | |
82 | ||
83 | ip++; | |
84 | } | |
85 | ||
86 | rank /= 2; | |
87 | } | |
88 | ||
89 | fResponse = t[0]; // 12-bit [H4:L4:A4] | |
90 | } | |
91 | ||
92 | //___________________________________________ | |
93 | UShort_t AliMUONGlobalTriggerBoard::Algo(UShort_t i, UShort_t j, char *thres) | |
94 | { | |
edd00c2d | 95 | // GLOBAL TRIGGER ALGORITHM |
d15ca731 | 96 | TBits a(12), b(12); a.Set(12,&i); b.Set(12,&j); |
97 | ||
98 | TBits trg1(2), trg2(2), trg(2); | |
99 | ||
100 | if (!strcmp(thres,"APT")) | |
101 | { | |
102 | trg1[0] = a[2]; trg1[1] = a[3]; | |
103 | trg2[0] = b[2]; trg2[1] = b[3]; | |
104 | } | |
105 | else if (!strcmp(thres,"LPT")) | |
106 | { | |
107 | trg1[0] = a[6]; trg1[1] = a[7]; | |
108 | trg2[0] = b[6]; trg2[1] = b[7]; | |
109 | } | |
110 | else | |
111 | { | |
112 | trg1[0] = a[10]; trg1[1] = a[11]; | |
113 | trg2[0] = b[10]; trg2[1] = b[11]; | |
114 | } | |
115 | ||
116 | TBits trgLS1(1), trgUS1(1), trgLS2(1), trgUS2(1), trgLS(1), trgUS(1); | |
117 | ||
118 | if (!strcmp(thres,"APT")) | |
119 | { | |
120 | trgLS1[0] = a[1]; trgUS1[0] = a[0]; | |
121 | trgLS2[0] = b[1]; trgUS2[0] = b[0]; | |
122 | } | |
123 | else if (!strcmp(thres,"LPT")) | |
124 | { | |
125 | trgLS1[0] = a[5]; trgUS1[0] = a[4]; | |
126 | trgLS2[0] = b[5]; trgUS2[0] = b[4]; | |
127 | } | |
128 | else | |
129 | { | |
130 | trgLS1[0] = a[9]; trgUS1[0] = a[8]; | |
131 | trgLS2[0] = b[9]; trgUS2[0] = b[8]; | |
132 | } | |
133 | ||
134 | trgLS[0] = ( trg1[0] & trg2[0] ) | ( trg1[1] & trg2[1] ) | trgLS1[0] | trgLS2[0]; | |
135 | trgUS[0] = ( trg1[0] & trg2[1] ) | ( trg1[1] & trg2[0] ) | trgUS1[0] | trgUS2[0]; | |
136 | ||
137 | trg[0] = trg1[0] | trg2[0]; | |
138 | trg[1] = trg1[1] | trg2[1]; | |
139 | ||
140 | TBits v(4); | |
141 | ||
142 | v[0] = trgUS[0]; | |
143 | v[1] = trgLS[0]; | |
144 | v[2] = trg[0]; | |
145 | v[3] = trg[1]; | |
146 | ||
147 | UShort_t rv = 0; | |
148 | v.Get(&rv); | |
149 | ||
150 | return rv; | |
151 | } | |
152 | ||
153 | //___________________________________________ | |
edd00c2d | 154 | void AliMUONGlobalTriggerBoard::Scan(Option_t*) const |
d15ca731 | 155 | { |
edd00c2d | 156 | // PRINT GLOBAL TRIGGER OUTPUT |
157 | TBits w(12); w.Set(12,&fResponse); | |
d15ca731 | 158 | |
159 | // TRG[1:0] | |
160 | // 00 noth | |
161 | // 01 negative track | |
162 | // 10 positive track | |
163 | // 11 undef | |
164 | ||
165 | Int_t iSP[3] = {0,0,0}, iSM[3] = {0,0,0}, iSU[3] = {0,0,0}; | |
166 | ||
167 | TBits a(2), n(2), p(2), u(2); | |
168 | ||
169 | UShort_t val; | |
170 | ||
171 | val = 1; n.Set(2,&val); | |
172 | val = 2; p.Set(2,&val); | |
173 | val = 3; u.Set(2,&val); | |
174 | ||
175 | a[0] = w[2]; | |
176 | a[1] = w[3]; | |
177 | ||
178 | if (a==p) iSP[0] = 1; | |
179 | else if (a==n) iSM[0] = 1; | |
180 | else if (a==u) iSU[0] = 1; | |
181 | ||
182 | a[0] = w[6]; | |
183 | a[1] = w[7]; | |
184 | ||
185 | if (a==p) iSP[1] = 1; | |
186 | else if (a==n) iSM[1] = 1; | |
187 | else if (a==u) iSU[1] = 1; | |
188 | ||
189 | a[0] = w[10]; | |
190 | a[1] = w[11]; | |
191 | ||
192 | if (a==p) iSP[2] = 1; | |
193 | else if (a==n) iSM[2] = 1; | |
194 | else if (a==u) iSU[2] = 1; | |
195 | ||
196 | Int_t iPU[3] = {w[0],w[4],w[8]}; | |
197 | Int_t iPL[3] = {w[1],w[5],w[9]}; | |
198 | ||
199 | printf("===================================================\n"); | |
200 | printf(" Global Trigger output Low pt High pt All\n"); | |
201 | printf(" number of Single Plus :\t"); | |
202 | for (Int_t i=0; i<3; i++) printf("%i\t",iSP[i]); | |
203 | printf("\n"); | |
204 | printf(" number of Single Minus :\t"); | |
205 | for (Int_t i=0; i<3; i++) printf("%i\t",iSM[i]); | |
206 | printf("\n"); | |
207 | printf(" number of Single Undefined :\t"); | |
208 | for (Int_t i=0; i<3; i++) printf("%i\t",iSU[i]); | |
209 | printf("\n"); | |
210 | printf(" number of UnlikeSign pair :\t"); | |
211 | for (Int_t i=0; i<3; i++) printf("%i\t",iPU[i]); | |
212 | printf("\n"); | |
213 | printf(" number of LikeSign pair :\t"); | |
214 | for (Int_t i=0; i<3; i++) printf("%i\t",iPL[i]); | |
215 | printf("\n"); | |
216 | printf("===================================================\n"); | |
217 | printf("\n"); | |
218 | } | |
219 | ||
220 | ClassImp(AliMUONGlobalTriggerBoard) |