]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONRegionalTriggerBoard.cxx
fit fraction cut bug fixed
[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
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
24///
25/// \author Rachid Guernane (LPCCFd)
c05673c9 26/// Corrected by Christian Finck (Subatech)
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 38ClassImp(AliMUONRegionalTriggerBoard)
71a2d3aa 39/// \endcond
809874e0 40
41//___________________________________________
42AliMUONRegionalTriggerBoard::AliMUONRegionalTriggerBoard()
c05673c9 43 : AliMUONTriggerBoard(),
44 fMask(0x0)
809874e0 45{
71a2d3aa 46/// Default constructor
809874e0 47 for (Int_t i=0; i<16; i++) fLocalResponse[i] = 0;
48}
49
50//___________________________________________
c05673c9 51AliMUONRegionalTriggerBoard::AliMUONRegionalTriggerBoard(const char *name, Int_t a)
52 : AliMUONTriggerBoard(name, a),
53 fMask(0x0)
809874e0 54{
71a2d3aa 55/// Standard constructor
809874e0 56 for (Int_t i=0; i<16; i++) fLocalResponse[i] = 0;
57}
58
71a2d3aa 59//___________________________________________
60AliMUONRegionalTriggerBoard::~AliMUONRegionalTriggerBoard()
61{
62/// Destructor
63}
64
809874e0 65//___________________________________________
66void AliMUONRegionalTriggerBoard::Response()
67{
c05673c9 68/// response is given following the regional algorithm
71a2d3aa 69
edd00c2d 70 Int_t t[16];
809874e0 71
c05673c9 72 for (Int_t i = 0; i < 16; ++i)
73 {
74 if ((fMask >> i) & 0x1)
75 t[i] = fLocalResponse[i];
76 else
77 t[i] = 0;
78 }
79
809874e0 80 Int_t rank = 8;
81
c05673c9 82 for (Int_t i = 0; i < 4; ++i)
809874e0 83 {
84 Int_t ip = 0;
85
c05673c9 86 for (Int_t j = 0; j < rank; ++j)
809874e0 87 {
ad705f30 88 UShort_t lthres = Algo(t[2*j],t[2*j+1],"LPT",i);
809874e0 89
ad705f30 90 UShort_t hthres = Algo(t[2*j],t[2*j+1],"HPT",i); hthres <<= 4;
809874e0 91
ad705f30 92 t[ip] = lthres | hthres;
809874e0 93
94 ip++;
95 }
96
97 rank /= 2;
98 }
99
ad705f30 100 fResponse = t[0]; // 8-bit [H4:L4]
809874e0 101}
102
103//___________________________________________
104UShort_t AliMUONRegionalTriggerBoard::Algo(UShort_t i, UShort_t j, char *thres, Int_t level)
105{
c05673c9 106/// implementation of the regional algorithm
107/// similar to the global algorithm except for the
108/// input layer
71a2d3aa 109
ad705f30 110 TBits a(8), b(8); a.Set(8,&i); b.Set(8,&j);
809874e0 111
112 TBits trg1(2), trg2(2), trg(2);
113
ad705f30 114 if (!strcmp(thres,"LPT"))
809874e0 115 {
116 if (!level)
117 {
118 trg1[0] = a[0]; trg1[1] = a[1];
119 trg2[0] = b[0]; trg2[1] = b[1];
120 }
121 else
122 {
123 trg1[0] = a[2]; trg1[1] = a[3];
124 trg2[0] = b[2]; trg2[1] = b[3];
125 }
126 }
ad705f30 127 else
809874e0 128 {
129 if (!level)
130 {
131 trg1[0] = a[2]; trg1[1] = a[3];
132 trg2[0] = b[2]; trg2[1] = b[3];
133 }
134 else
135 {
136 trg1[0] = a[6]; trg1[1] = a[7];
ad705f30 137 trg2[0] = b[6]; trg2[1] = b[7];
809874e0 138 }
139 }
140
141 TBits trgLS1(1), trgUS1(1), trgLS2(1), trgUS2(1), trgLS(1), trgUS(1);
142
143 if (!level)
144 {
145 trgLS1[0] = trgUS1[0] = trgLS2[0] = trgUS2[0] = 0;
146 }
147 else
148 {
ad705f30 149 if (!strcmp(thres,"LPT"))
809874e0 150 {
151 trgLS1[0] = a[1]; trgUS1[0] = a[0];
152 trgLS2[0] = b[1]; trgUS2[0] = b[0];
153 }
809874e0 154 else
155 {
ad705f30 156 trgLS1[0] = a[5]; trgUS1[0] = a[4];
157 trgLS2[0] = b[5]; trgUS2[0] = b[4];
809874e0 158 }
159 }
160
161 trgLS[0] = ( trg1[0] & trg2[0] ) | ( trg1[1] & trg2[1] ) | trgLS1[0] | trgLS2[0];
162 trgUS[0] = ( trg1[0] & trg2[1] ) | ( trg1[1] & trg2[0] ) | trgUS1[0] | trgUS2[0];
163
164 trg[0] = trg1[0] | trg2[0];
165 trg[1] = trg1[1] | trg2[1];
166
167 TBits v(4);
168
169 v[0] = trgUS[0];
170 v[1] = trgLS[0];
171 v[2] = trg[0];
172 v[3] = trg[1];
173
174 UShort_t rv = 0;
175 v.Get(&rv);
176
177 return rv;
178}
edd00c2d 179
809874e0 180//___________________________________________
edd00c2d 181void AliMUONRegionalTriggerBoard::Scan(Option_t*) const
809874e0 182{
c05673c9 183/// scan local board entries
71a2d3aa 184
edd00c2d 185 for (Int_t i=0; i<16; i++)
a4435944 186 {
187 TBits b;
188 b.Set(6,&fLocalResponse[i]);
189
190 cout << "Entry " << i << " is " << b << endl;
191
192 }
193
809874e0 194}
41922e78 195//___________________________________________
c05673c9 196void AliMUONRegionalTriggerBoard::Mask(UShort_t mask)
41922e78 197{
c05673c9 198/// mask entry index
199
200 fMask = mask;
41922e78 201}
c05673c9 202
203
204