]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONRegionalTriggerBoard.cxx
Add class description
[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)
19
20#include "AliMUONRegionalTriggerBoard.h"
21
22#include "TBits.h"
23
24#include <Riostream.h>
25
26ClassImp(AliMUONRegionalTriggerBoard)
27
28//___________________________________________
29AliMUONRegionalTriggerBoard::AliMUONRegionalTriggerBoard()
30{
31 for (Int_t i=0; i<16; i++) fLocalResponse[i] = 0;
32}
33
34//___________________________________________
35AliMUONRegionalTriggerBoard::AliMUONRegionalTriggerBoard(const char *name, Int_t a) : AliMUONTriggerBoard(name, a)
36{
37 for (Int_t i=0; i<16; i++) fLocalResponse[i] = 0;
38}
39
40//___________________________________________
41void AliMUONRegionalTriggerBoard::Response()
42{
43 Int_t t[16];
44
45 for (Int_t i=0;i<16;i++) t[i] = fLocalResponse[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",i);
56
57 UShort_t lthres = Algo(t[2*j],t[2*j+1],"LPT",i); lthres <<= 4;
58
59 UShort_t hthres = Algo(t[2*j],t[2*j+1],"HPT",i); 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//___________________________________________
73UShort_t AliMUONRegionalTriggerBoard::Algo(UShort_t i, UShort_t j, char *thres, Int_t level)
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 if (!level)
82 {
83 trg1[0] = a[0]; trg1[1] = a[1];
84 trg2[0] = b[0]; trg2[1] = b[1];
85 }
86 else
87 {
88 trg1[0] = a[2]; trg1[1] = a[3];
89 trg2[0] = b[2]; trg2[1] = b[3];
90 }
91 }
92 else if (!strcmp(thres,"LPT"))
93 {
94 if (!level)
95 {
96 trg1[0] = a[2]; trg1[1] = a[3];
97 trg2[0] = b[2]; trg2[1] = b[3];
98 }
99 else
100 {
101 trg1[0] = a[6]; trg1[1] = a[7];
102 trg2[0] = b[6]; trg2[1] = b[7];
103 }
104 }
105 else
106 {
107 if (!level)
108 {
109 trg1[0] = a[4]; trg1[1] = a[5];
110 trg2[0] = b[4]; trg2[1] = b[5];
111 }
112 else
113 {
114 trg1[0] = a[10]; trg1[1] = a[11];
115 trg2[0] = b[10]; trg2[1] = b[11];
116 }
117 }
118
119 TBits trgLS1(1), trgUS1(1), trgLS2(1), trgUS2(1), trgLS(1), trgUS(1);
120
121 if (!level)
122 {
123 trgLS1[0] = trgUS1[0] = trgLS2[0] = trgUS2[0] = 0;
124 }
125 else
126 {
127 if (!strcmp(thres,"APT"))
128 {
129 trgLS1[0] = a[1]; trgUS1[0] = a[0];
130 trgLS2[0] = b[1]; trgUS2[0] = b[0];
131 }
132 else if (!strcmp(thres,"LPT"))
133 {
134 trgLS1[0] = a[5]; trgUS1[0] = a[4];
135 trgLS2[0] = b[5]; trgUS2[0] = b[4];
136 }
137 else
138 {
139 trgLS1[0] = a[9]; trgUS1[0] = a[8];
140 trgLS2[0] = b[9]; trgUS2[0] = b[8];
141 }
142 }
143
144 trgLS[0] = ( trg1[0] & trg2[0] ) | ( trg1[1] & trg2[1] ) | trgLS1[0] | trgLS2[0];
145 trgUS[0] = ( trg1[0] & trg2[1] ) | ( trg1[1] & trg2[0] ) | trgUS1[0] | trgUS2[0];
146
147 trg[0] = trg1[0] | trg2[0];
148 trg[1] = trg1[1] | trg2[1];
149
150 TBits v(4);
151
152 v[0] = trgUS[0];
153 v[1] = trgLS[0];
154 v[2] = trg[0];
155 v[3] = trg[1];
156
157 UShort_t rv = 0;
158 v.Get(&rv);
159
160 return rv;
161}
162//___________________________________________
163void AliMUONRegionalTriggerBoard::Scan(Option_t*)
164{
a4435944 165 for (Int_t i=0; i<16; i++)
166 {
167 TBits b;
168 b.Set(6,&fLocalResponse[i]);
169
170 cout << "Entry " << i << " is " << b << endl;
171
172 }
173
809874e0 174}
175
176
177ClassImp(AliMUONRegionalTriggerBoard)