]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONGlobalTriggerBoard.cxx
Corrected some manu Id's in mapping for slat and updated the serial manu numbers
[u/mrichter/AliRoot.git] / MUON / AliMUONGlobalTriggerBoard.cxx
CommitLineData
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
30ClassImp(AliMUONGlobalTriggerBoard)
31
32//___________________________________________
33AliMUONGlobalTriggerBoard::AliMUONGlobalTriggerBoard()
34{
35 for (Int_t i=0;i<16;i++) fRegionalResponse[i] = 0;
36}
37
38//___________________________________________
39AliMUONGlobalTriggerBoard::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//___________________________________________
45void 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//___________________________________________
59void AliMUONGlobalTriggerBoard::Response()
60{
edd00c2d 61 // COMPUTE THE GLOBAL TRIGGER BOARD
62 // RESPONSE ACCORDING TO THE Algo() METHOD
8d4fefab 63/// output from global trigger algorithm
64/// [+, -, LS, US] * [Hpt, Lpt]
65/// transformed to [usHpt, usLpt, lsHpt, lsLpt, sHpt, sLpt] according
66/// to Global Trigger Unit user manual
d15ca731 67
8d4fefab 68 Int_t t[16];
41922e78 69 for (Int_t i=0;i<16;i++) t[i] = fRegionalResponse[i] & fMask[i];
d15ca731 70
71 Int_t rank = 8;
72
73 for (Int_t i=0;i<4;i++)
74 {
75 Int_t ip = 0;
76
77 for (Int_t j=0;j<rank;j++)
78 {
ad705f30 79 UShort_t lthres = Algo(t[2*j],t[2*j+1],"LPT");
d15ca731 80
ad705f30 81 UShort_t hthres = Algo(t[2*j],t[2*j+1],"HPT"); hthres <<= 4;
d15ca731 82
ad705f30 83 t[ip] = lthres | hthres;
d15ca731 84
85 ip++;
86 }
87
88 rank /= 2;
89 }
8d4fefab 90 UChar_t sLpt, sHpt, lsLpt, lsHpt, usLpt, usHpt;
91 sLpt = ((t[0] & 0xC) != 0);
92 sHpt = ((t[0] & 0xC0) != 0);
93 lsLpt = ((t[0] & 0x2) != 0);
94 lsHpt = ((t[0] & 0x20) != 0);
95 usLpt = ((t[0] & 0x1 ) != 0);
96 usHpt = ((t[0] & 0x10) != 0);
97
98 sHpt <<= 1;
99 lsLpt <<= 2;
100 lsHpt <<= 3;
101 usLpt <<= 4;
102 usHpt <<= 5;
103
104 fResponse = sLpt | sHpt | lsLpt | lsHpt | usLpt |usHpt;
d15ca731 105}
106
107//___________________________________________
108UShort_t AliMUONGlobalTriggerBoard::Algo(UShort_t i, UShort_t j, char *thres)
109{
edd00c2d 110 // GLOBAL TRIGGER ALGORITHM
ad705f30 111 TBits a(8), b(8); a.Set(8,&i); b.Set(8,&j);
d15ca731 112
113 TBits trg1(2), trg2(2), trg(2);
114
ad705f30 115 if (!strcmp(thres,"LPT"))
d15ca731 116 {
117 trg1[0] = a[2]; trg1[1] = a[3];
118 trg2[0] = b[2]; trg2[1] = b[3];
119 }
d15ca731 120 else
121 {
ad705f30 122 trg1[0] = a[6]; trg1[1] = a[7];
123 trg2[0] = b[6]; trg2[1] = b[7];
d15ca731 124 }
125
126 TBits trgLS1(1), trgUS1(1), trgLS2(1), trgUS2(1), trgLS(1), trgUS(1);
127
ad705f30 128 if (!strcmp(thres,"LPT"))
d15ca731 129 {
130 trgLS1[0] = a[1]; trgUS1[0] = a[0];
131 trgLS2[0] = b[1]; trgUS2[0] = b[0];
132 }
d15ca731 133 else
134 {
ad705f30 135 trgLS1[0] = a[5]; trgUS1[0] = a[4];
136 trgLS2[0] = b[5]; trgUS2[0] = b[4];
d15ca731 137 }
138
139 trgLS[0] = ( trg1[0] & trg2[0] ) | ( trg1[1] & trg2[1] ) | trgLS1[0] | trgLS2[0];
140 trgUS[0] = ( trg1[0] & trg2[1] ) | ( trg1[1] & trg2[0] ) | trgUS1[0] | trgUS2[0];
141
142 trg[0] = trg1[0] | trg2[0];
143 trg[1] = trg1[1] | trg2[1];
144
145 TBits v(4);
146
147 v[0] = trgUS[0];
148 v[1] = trgLS[0];
149 v[2] = trg[0];
150 v[3] = trg[1];
151
152 UShort_t rv = 0;
153 v.Get(&rv);
154
155 return rv;
156}
157
158//___________________________________________
edd00c2d 159void AliMUONGlobalTriggerBoard::Scan(Option_t*) const
d15ca731 160{
edd00c2d 161 // PRINT GLOBAL TRIGGER OUTPUT
ad705f30 162 TBits w(8); w.Set(8,&fResponse);
d15ca731 163
164// TRG[1:0]
165// 00 noth
166// 01 negative track
167// 10 positive track
168// 11 undef
169
ad705f30 170 Int_t iSP[2] = {0,0}, iSM[2] = {0,0}, iSU[2] = {0,0};
d15ca731 171
172 TBits a(2), n(2), p(2), u(2);
173
174 UShort_t val;
175
176 val = 1; n.Set(2,&val);
177 val = 2; p.Set(2,&val);
178 val = 3; u.Set(2,&val);
179
180 a[0] = w[2];
181 a[1] = w[3];
182
183 if (a==p) iSP[0] = 1;
184 else if (a==n) iSM[0] = 1;
185 else if (a==u) iSU[0] = 1;
186
187 a[0] = w[6];
188 a[1] = w[7];
189
190 if (a==p) iSP[1] = 1;
191 else if (a==n) iSM[1] = 1;
192 else if (a==u) iSU[1] = 1;
193
ad705f30 194 Int_t iPU[2] = {w[0],w[4]};
195 Int_t iPL[2] = {w[1],w[5]};
d15ca731 196
ad705f30 197 printf("============================================\n");
198 printf(" Global Trigger output Low pt High pt\n");
d15ca731 199 printf(" number of Single Plus :\t");
ad705f30 200 for (Int_t i=0; i<2; i++) printf("%i\t",iSP[i]);
d15ca731 201 printf("\n");
202 printf(" number of Single Minus :\t");
ad705f30 203 for (Int_t i=0; i<2; i++) printf("%i\t",iSM[i]);
d15ca731 204 printf("\n");
205 printf(" number of Single Undefined :\t");
ad705f30 206 for (Int_t i=0; i<2; i++) printf("%i\t",iSU[i]);
d15ca731 207 printf("\n");
208 printf(" number of UnlikeSign pair :\t");
ad705f30 209 for (Int_t i=0; i<2; i++) printf("%i\t",iPU[i]);
d15ca731 210 printf("\n");
211 printf(" number of LikeSign pair :\t");
ad705f30 212 for (Int_t i=0; i<2; i++) printf("%i\t",iPL[i]);
d15ca731 213 printf("\n");
214 printf("===================================================\n");
215 printf("\n");
216}
217
218ClassImp(AliMUONGlobalTriggerBoard)