]>
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 | |
71a2d3aa | 24 | /// \todo Change member functions comments in capital letters to normal text |
c4ee792d | 25 | /// |
26 | /// \author Rachid Guernane (LPCCFd) | |
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() | |
43 | { | |
71a2d3aa | 44 | /// Default constructor |
809874e0 | 45 | for (Int_t i=0; i<16; i++) fLocalResponse[i] = 0; |
46 | } | |
47 | ||
48 | //___________________________________________ | |
49 | AliMUONRegionalTriggerBoard::AliMUONRegionalTriggerBoard(const char *name, Int_t a) : AliMUONTriggerBoard(name, a) | |
50 | { | |
71a2d3aa | 51 | /// Standard constructor |
809874e0 | 52 | for (Int_t i=0; i<16; i++) fLocalResponse[i] = 0; |
53 | } | |
54 | ||
71a2d3aa | 55 | //___________________________________________ |
56 | AliMUONRegionalTriggerBoard::~AliMUONRegionalTriggerBoard() | |
57 | { | |
58 | /// Destructor | |
59 | } | |
60 | ||
809874e0 | 61 | //___________________________________________ |
62 | void AliMUONRegionalTriggerBoard::Response() | |
63 | { | |
71a2d3aa | 64 | /// RESPONSE IS GIVEN FOLLOWING THE REGIONAL ALGORITHM |
65 | ||
edd00c2d | 66 | Int_t t[16]; |
809874e0 | 67 | |
41922e78 | 68 | for (Int_t i=0;i<16;i++) t[i] = fLocalResponse[i] & fMask[i]; |
809874e0 | 69 | |
70 | Int_t rank = 8; | |
71 | ||
72 | for (Int_t i=0;i<4;i++) | |
73 | { | |
74 | Int_t ip = 0; | |
75 | ||
76 | for (Int_t j=0;j<rank;j++) | |
77 | { | |
ad705f30 | 78 | UShort_t lthres = Algo(t[2*j],t[2*j+1],"LPT",i); |
809874e0 | 79 | |
ad705f30 | 80 | UShort_t hthres = Algo(t[2*j],t[2*j+1],"HPT",i); hthres <<= 4; |
809874e0 | 81 | |
ad705f30 | 82 | t[ip] = lthres | hthres; |
809874e0 | 83 | |
84 | ip++; | |
85 | } | |
86 | ||
87 | rank /= 2; | |
88 | } | |
89 | ||
ad705f30 | 90 | fResponse = t[0]; // 8-bit [H4:L4] |
809874e0 | 91 | } |
92 | ||
93 | //___________________________________________ | |
94 | UShort_t AliMUONRegionalTriggerBoard::Algo(UShort_t i, UShort_t j, char *thres, Int_t level) | |
95 | { | |
71a2d3aa | 96 | /// IMPLEMENTATION OF THE REGIONAL ALGORITHM |
97 | /// SIMILAR TO THE GLOBAL ALGORITHM EXCEPT FOR THE | |
98 | /// INPUT LAYER | |
99 | ||
ad705f30 | 100 | TBits a(8), b(8); a.Set(8,&i); b.Set(8,&j); |
809874e0 | 101 | |
102 | TBits trg1(2), trg2(2), trg(2); | |
103 | ||
ad705f30 | 104 | if (!strcmp(thres,"LPT")) |
809874e0 | 105 | { |
106 | if (!level) | |
107 | { | |
108 | trg1[0] = a[0]; trg1[1] = a[1]; | |
109 | trg2[0] = b[0]; trg2[1] = b[1]; | |
110 | } | |
111 | else | |
112 | { | |
113 | trg1[0] = a[2]; trg1[1] = a[3]; | |
114 | trg2[0] = b[2]; trg2[1] = b[3]; | |
115 | } | |
116 | } | |
ad705f30 | 117 | else |
809874e0 | 118 | { |
119 | if (!level) | |
120 | { | |
121 | trg1[0] = a[2]; trg1[1] = a[3]; | |
122 | trg2[0] = b[2]; trg2[1] = b[3]; | |
123 | } | |
124 | else | |
125 | { | |
126 | trg1[0] = a[6]; trg1[1] = a[7]; | |
ad705f30 | 127 | trg2[0] = b[6]; trg2[1] = b[7]; |
809874e0 | 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 | { | |
ad705f30 | 139 | if (!strcmp(thres,"LPT")) |
809874e0 | 140 | { |
141 | trgLS1[0] = a[1]; trgUS1[0] = a[0]; | |
142 | trgLS2[0] = b[1]; trgUS2[0] = b[0]; | |
143 | } | |
809874e0 | 144 | else |
145 | { | |
ad705f30 | 146 | trgLS1[0] = a[5]; trgUS1[0] = a[4]; |
147 | trgLS2[0] = b[5]; trgUS2[0] = b[4]; | |
809874e0 | 148 | } |
149 | } | |
150 | ||
151 | trgLS[0] = ( trg1[0] & trg2[0] ) | ( trg1[1] & trg2[1] ) | trgLS1[0] | trgLS2[0]; | |
152 | trgUS[0] = ( trg1[0] & trg2[1] ) | ( trg1[1] & trg2[0] ) | trgUS1[0] | trgUS2[0]; | |
153 | ||
154 | trg[0] = trg1[0] | trg2[0]; | |
155 | trg[1] = trg1[1] | trg2[1]; | |
156 | ||
157 | TBits v(4); | |
158 | ||
159 | v[0] = trgUS[0]; | |
160 | v[1] = trgLS[0]; | |
161 | v[2] = trg[0]; | |
162 | v[3] = trg[1]; | |
163 | ||
164 | UShort_t rv = 0; | |
165 | v.Get(&rv); | |
166 | ||
167 | return rv; | |
168 | } | |
edd00c2d | 169 | |
809874e0 | 170 | //___________________________________________ |
edd00c2d | 171 | void AliMUONRegionalTriggerBoard::Scan(Option_t*) const |
809874e0 | 172 | { |
71a2d3aa | 173 | /// SCAN LOCAL BOARD ENTRIES |
174 | ||
edd00c2d | 175 | for (Int_t i=0; i<16; i++) |
a4435944 | 176 | { |
177 | TBits b; | |
178 | b.Set(6,&fLocalResponse[i]); | |
179 | ||
180 | cout << "Entry " << i << " is " << b << endl; | |
181 | ||
182 | } | |
183 | ||
809874e0 | 184 | } |
185 | ||
41922e78 | 186 | //___________________________________________ |
187 | void AliMUONRegionalTriggerBoard::Mask(Int_t index, UShort_t mask) | |
188 | { | |
71a2d3aa | 189 | /// MASK ENTRY index |
190 | ||
41922e78 | 191 | if ( index>=0 && index < 16 ) |
192 | { | |
193 | fMask[index]=mask; | |
194 | } | |
195 | else | |
196 | { | |
197 | AliError(Form("Index %d out of bounds (max %d)",index,16)); | |
198 | } | |
199 | } |