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