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