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