]>
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 | ||
18 | //*-- Author: Rachid Guernane (LPCCFd) | |
edd00c2d | 19 | // DIMUON REGIONAL TRIGGER IMPLEMENTATION |
20 | // ENTRY ARE LOCAL BOARD RESPONSES | |
21 | // OUTPUT IS 12-BIT WORD | |
22 | // ALGORITHM IS SIMILAR TO THE GLOBAL ONE | |
809874e0 | 23 | |
24 | #include "AliMUONRegionalTriggerBoard.h" | |
25 | ||
41922e78 | 26 | #include "AliLog.h" |
27 | ||
809874e0 | 28 | #include "TBits.h" |
29 | ||
30 | #include <Riostream.h> | |
31 | ||
32 | ClassImp(AliMUONRegionalTriggerBoard) | |
33 | ||
34 | //___________________________________________ | |
35 | AliMUONRegionalTriggerBoard::AliMUONRegionalTriggerBoard() | |
36 | { | |
37 | for (Int_t i=0; i<16; i++) fLocalResponse[i] = 0; | |
38 | } | |
39 | ||
40 | //___________________________________________ | |
41 | AliMUONRegionalTriggerBoard::AliMUONRegionalTriggerBoard(const char *name, Int_t a) : AliMUONTriggerBoard(name, a) | |
42 | { | |
43 | for (Int_t i=0; i<16; i++) fLocalResponse[i] = 0; | |
44 | } | |
45 | ||
46 | //___________________________________________ | |
47 | void AliMUONRegionalTriggerBoard::Response() | |
48 | { | |
edd00c2d | 49 | /* |
50 | RESPONSE IS GIVEN FOLLOWING THE REGIONAL ALGORITHM | |
51 | */ | |
52 | Int_t t[16]; | |
809874e0 | 53 | |
41922e78 | 54 | for (Int_t i=0;i<16;i++) t[i] = fLocalResponse[i] & fMask[i]; |
809874e0 | 55 | |
56 | Int_t rank = 8; | |
57 | ||
58 | for (Int_t i=0;i<4;i++) | |
59 | { | |
60 | Int_t ip = 0; | |
61 | ||
62 | for (Int_t j=0;j<rank;j++) | |
63 | { | |
64 | UShort_t athres = Algo(t[2*j],t[2*j+1],"APT",i); | |
65 | ||
66 | UShort_t lthres = Algo(t[2*j],t[2*j+1],"LPT",i); lthres <<= 4; | |
67 | ||
68 | UShort_t hthres = Algo(t[2*j],t[2*j+1],"HPT",i); hthres <<= 8; | |
69 | ||
70 | t[ip] = athres | lthres | hthres; | |
71 | ||
72 | ip++; | |
73 | } | |
74 | ||
75 | rank /= 2; | |
76 | } | |
77 | ||
78 | fResponse = t[0]; // 12-bit [H4:L4:A4] | |
79 | } | |
80 | ||
81 | //___________________________________________ | |
82 | UShort_t AliMUONRegionalTriggerBoard::Algo(UShort_t i, UShort_t j, char *thres, Int_t level) | |
83 | { | |
edd00c2d | 84 | // IMPLEMENTATION OF THE REGIONAL ALGORITHM |
85 | // SIMILAR TO THE GLOBAL ALGORITHM EXCEPT FOR THE | |
86 | // INPUT LAYER | |
87 | TBits a(12), b(12); a.Set(12,&i); b.Set(12,&j); | |
809874e0 | 88 | |
89 | TBits trg1(2), trg2(2), trg(2); | |
90 | ||
91 | if (!strcmp(thres,"APT")) | |
92 | { | |
93 | if (!level) | |
94 | { | |
95 | trg1[0] = a[0]; trg1[1] = a[1]; | |
96 | trg2[0] = b[0]; trg2[1] = b[1]; | |
97 | } | |
98 | else | |
99 | { | |
100 | trg1[0] = a[2]; trg1[1] = a[3]; | |
101 | trg2[0] = b[2]; trg2[1] = b[3]; | |
102 | } | |
103 | } | |
104 | else if (!strcmp(thres,"LPT")) | |
105 | { | |
106 | if (!level) | |
107 | { | |
108 | trg1[0] = a[2]; trg1[1] = a[3]; | |
109 | trg2[0] = b[2]; trg2[1] = b[3]; | |
110 | } | |
111 | else | |
112 | { | |
113 | trg1[0] = a[6]; trg1[1] = a[7]; | |
114 | trg2[0] = b[6]; trg2[1] = b[7]; | |
115 | } | |
116 | } | |
117 | else | |
118 | { | |
119 | if (!level) | |
120 | { | |
121 | trg1[0] = a[4]; trg1[1] = a[5]; | |
122 | trg2[0] = b[4]; trg2[1] = b[5]; | |
123 | } | |
124 | else | |
125 | { | |
126 | trg1[0] = a[10]; trg1[1] = a[11]; | |
127 | trg2[0] = b[10]; trg2[1] = b[11]; | |
128 | } | |
129 | } | |
130 | ||
131 | TBits trgLS1(1), trgUS1(1), trgLS2(1), trgUS2(1), trgLS(1), trgUS(1); | |
132 | ||
133 | if (!level) | |
134 | { | |
135 | trgLS1[0] = trgUS1[0] = trgLS2[0] = trgUS2[0] = 0; | |
136 | } | |
137 | else | |
138 | { | |
139 | if (!strcmp(thres,"APT")) | |
140 | { | |
141 | trgLS1[0] = a[1]; trgUS1[0] = a[0]; | |
142 | trgLS2[0] = b[1]; trgUS2[0] = b[0]; | |
143 | } | |
144 | else if (!strcmp(thres,"LPT")) | |
145 | { | |
146 | trgLS1[0] = a[5]; trgUS1[0] = a[4]; | |
147 | trgLS2[0] = b[5]; trgUS2[0] = b[4]; | |
148 | } | |
149 | else | |
150 | { | |
151 | trgLS1[0] = a[9]; trgUS1[0] = a[8]; | |
152 | trgLS2[0] = b[9]; trgUS2[0] = b[8]; | |
153 | } | |
154 | } | |
155 | ||
156 | trgLS[0] = ( trg1[0] & trg2[0] ) | ( trg1[1] & trg2[1] ) | trgLS1[0] | trgLS2[0]; | |
157 | trgUS[0] = ( trg1[0] & trg2[1] ) | ( trg1[1] & trg2[0] ) | trgUS1[0] | trgUS2[0]; | |
158 | ||
159 | trg[0] = trg1[0] | trg2[0]; | |
160 | trg[1] = trg1[1] | trg2[1]; | |
161 | ||
162 | TBits v(4); | |
163 | ||
164 | v[0] = trgUS[0]; | |
165 | v[1] = trgLS[0]; | |
166 | v[2] = trg[0]; | |
167 | v[3] = trg[1]; | |
168 | ||
169 | UShort_t rv = 0; | |
170 | v.Get(&rv); | |
171 | ||
172 | return rv; | |
173 | } | |
edd00c2d | 174 | |
809874e0 | 175 | //___________________________________________ |
edd00c2d | 176 | void AliMUONRegionalTriggerBoard::Scan(Option_t*) const |
809874e0 | 177 | { |
edd00c2d | 178 | /* |
179 | SCAN LOCAL BOARD ENTRIES | |
180 | */ | |
181 | for (Int_t i=0; i<16; i++) | |
a4435944 | 182 | { |
183 | TBits b; | |
184 | b.Set(6,&fLocalResponse[i]); | |
185 | ||
186 | cout << "Entry " << i << " is " << b << endl; | |
187 | ||
188 | } | |
189 | ||
809874e0 | 190 | } |
191 | ||
41922e78 | 192 | //___________________________________________ |
193 | void AliMUONRegionalTriggerBoard::Mask(Int_t index, UShort_t mask) | |
194 | { | |
edd00c2d | 195 | // MASK ENTRY index |
41922e78 | 196 | if ( index>=0 && index < 16 ) |
197 | { | |
198 | fMask[index]=mask; | |
199 | } | |
200 | else | |
201 | { | |
202 | AliError(Form("Index %d out of bounds (max %d)",index,16)); | |
203 | } | |
204 | } | |
809874e0 | 205 | |
206 | ClassImp(AliMUONRegionalTriggerBoard) |