]>
Commit | Line | Data |
---|---|---|
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 | #include "AliMUONLocalTrigger.h" | |
19 | #include <assert.h> | |
20 | #include "AliLog.h" | |
21 | ||
22 | ClassImp(AliMUONLocalTrigger) | |
23 | //---------------------------------------------------------------------- | |
24 | AliMUONLocalTrigger::AliMUONLocalTrigger() | |
25 | : TObject(), fDigits(0) | |
26 | { | |
27 | // constructor | |
28 | fLoCircuit = 0; | |
29 | fLoStripX = 0; | |
30 | fLoDev = 0; | |
31 | fLoStripY = 0; | |
32 | fLoLpt = 0; | |
33 | fLoHpt = 0; | |
34 | fLoApt = 0; | |
35 | ||
36 | fX1Pattern = 0; | |
37 | fX2Pattern = 0; | |
38 | fX3Pattern = 0; | |
39 | fX4Pattern = 0; | |
40 | ||
41 | fY1Pattern = 0; | |
42 | fY2Pattern = 0; | |
43 | fY3Pattern = 0; | |
44 | fY4Pattern = 0; | |
45 | ||
46 | fLoDecision = 0; | |
47 | } | |
48 | //---------------------------------------------------------------------- | |
49 | AliMUONLocalTrigger::AliMUONLocalTrigger(const AliMUONLocalTrigger& theMUONLocalTrig) | |
50 | : TObject(theMUONLocalTrig) | |
51 | { | |
52 | // copy constructor (useful for TClonesArray) | |
53 | fLoCircuit = theMUONLocalTrig.fLoCircuit; | |
54 | fLoStripX = theMUONLocalTrig.fLoStripX; | |
55 | fLoDev = theMUONLocalTrig.fLoDev; | |
56 | fLoStripY = theMUONLocalTrig.fLoStripY; | |
57 | fLoLpt = theMUONLocalTrig.fLoLpt; | |
58 | fLoHpt = theMUONLocalTrig.fLoHpt; | |
59 | fLoApt = theMUONLocalTrig.fLoApt; | |
60 | ||
61 | fX1Pattern = theMUONLocalTrig.fX1Pattern; | |
62 | fX2Pattern = theMUONLocalTrig.fX2Pattern; | |
63 | fX3Pattern = theMUONLocalTrig.fX3Pattern; | |
64 | fX4Pattern = theMUONLocalTrig.fX4Pattern; | |
65 | ||
66 | fY1Pattern = theMUONLocalTrig.fY1Pattern; | |
67 | fY2Pattern = theMUONLocalTrig.fY2Pattern; | |
68 | fY3Pattern = theMUONLocalTrig.fY3Pattern; | |
69 | fY4Pattern = theMUONLocalTrig.fY4Pattern; | |
70 | ||
71 | fLoDecision = theMUONLocalTrig.fLoDecision; | |
72 | ||
73 | fDigits = theMUONLocalTrig.fDigits; | |
74 | } | |
75 | //---------------------------------------------------------------------- | |
76 | AliMUONLocalTrigger& AliMUONLocalTrigger::operator=(const AliMUONLocalTrigger& theMUONLocalTrig) | |
77 | { | |
78 | // equal operator (useful for non-pointer member in TClonesArray) | |
79 | if (this == &theMUONLocalTrig) | |
80 | return *this; | |
81 | ||
82 | // base class assignement | |
83 | TObject::operator=(theMUONLocalTrig); | |
84 | ||
85 | fLoCircuit = theMUONLocalTrig.fLoCircuit; | |
86 | fLoStripX = theMUONLocalTrig.fLoStripX; | |
87 | fLoDev = theMUONLocalTrig.fLoDev; | |
88 | fLoStripY = theMUONLocalTrig.fLoStripY; | |
89 | fLoLpt = theMUONLocalTrig.fLoLpt; | |
90 | fLoHpt = theMUONLocalTrig.fLoHpt; | |
91 | fLoApt = theMUONLocalTrig.fLoApt; | |
92 | ||
93 | fX1Pattern = theMUONLocalTrig.fX1Pattern; | |
94 | fX2Pattern = theMUONLocalTrig.fX2Pattern; | |
95 | fX3Pattern = theMUONLocalTrig.fX3Pattern; | |
96 | fX4Pattern = theMUONLocalTrig.fX4Pattern; | |
97 | ||
98 | fY1Pattern = theMUONLocalTrig.fY1Pattern; | |
99 | fY2Pattern = theMUONLocalTrig.fY2Pattern; | |
100 | fY3Pattern = theMUONLocalTrig.fY3Pattern; | |
101 | fY4Pattern = theMUONLocalTrig.fY4Pattern; | |
102 | ||
103 | fLoDecision = theMUONLocalTrig.fLoDecision; | |
104 | ||
105 | fDigits = theMUONLocalTrig.fDigits; | |
106 | ||
107 | return *this; | |
108 | } | |
109 | ||
110 | //---------------------------------------------------------------------- | |
111 | AliMUONLocalTrigger::AliMUONLocalTrigger(const Int_t* localtr, const TArrayI& digits) | |
112 | { | |
113 | // add a local trigger object | |
114 | fLoCircuit = localtr[0]; | |
115 | fLoStripX = localtr[1]; | |
116 | fLoDev = localtr[2]; | |
117 | fLoStripY = localtr[3]; | |
118 | fLoLpt = localtr[4]; | |
119 | fLoHpt = localtr[5]; | |
120 | fLoApt = localtr[6]; | |
121 | ||
122 | // keep on with this way | |
123 | fX1Pattern = (UShort_t)localtr[7]; | |
124 | fX2Pattern = (UShort_t)localtr[8]; | |
125 | fX3Pattern = (UShort_t)localtr[9]; | |
126 | fX4Pattern = (UShort_t)localtr[10]; | |
127 | ||
128 | fY1Pattern = (UShort_t)localtr[11]; | |
129 | fY2Pattern = (UShort_t)localtr[12]; | |
130 | fY3Pattern = (UShort_t)localtr[13]; | |
131 | fY4Pattern = (UShort_t)localtr[14]; | |
132 | ||
133 | fDigits = digits; | |
134 | } | |
135 | //---------------------------------------------------------------------- | |
136 | Char_t AliMUONLocalTrigger::GetLoDecision() | |
137 | { | |
138 | fLoDecision = (fLoLpt & 0x3); | |
139 | fLoDecision |= (fLoHpt << 2) & 0xC; | |
140 | ||
141 | return fLoDecision; | |
142 | } | |
143 | ||
144 | //---------------------------------------------------------------------- | |
145 | void AliMUONLocalTrigger::GetDigit( | |
146 | Int_t i, Int_t& chamber, Int_t& cathode, Int_t& digit | |
147 | ) const | |
148 | { | |
149 | // Returns the i'th digit that fired this circuit. | |
150 | // The number of digits can be found with NumberOfDigits(), that is | |
151 | // i is valid in the range [ 0 , NumberOfDigits() - 1 ] | |
152 | ||
153 | Int_t digitnumber = fDigits[i]; | |
154 | DecodeDigitNumber(digitnumber, chamber, cathode, digit); | |
155 | } | |
156 | ||
157 | //---------------------------------------------------------------------- | |
158 | Int_t AliMUONLocalTrigger::EncodeDigitNumber( | |
159 | Int_t chamber, Int_t cathode, Int_t digit | |
160 | ) | |
161 | { | |
162 | // Encodes a 32-bit digit number from digit information to be stored | |
163 | // in internal integer arrays. Note that the value of the digit parameter | |
164 | // can not be larger than 0x07FFFFFF. | |
165 | ||
166 | assert( 0 <= cathode && cathode <= 1 ); | |
167 | assert( 0 <= chamber && chamber <= 13 ); | |
168 | ||
169 | if ((digit & 0xF8000000) != 0) | |
170 | { | |
171 | AliErrorGeneral("AliMUONLocalTrigger", Form( | |
172 | "Digit index value is to large: 0x%8.8X. Maximum supported value is 0x07FFFFFF.", | |
173 | cathode, chamber, digit | |
174 | )); | |
175 | return -1; | |
176 | }; | |
177 | ||
178 | return ((cathode & 0x1) << 31) | ((chamber & 0xF) << 27) | digit; | |
179 | } | |
180 | ||
181 | //---------------------------------------------------------------------- | |
182 | void AliMUONLocalTrigger::DecodeDigitNumber( | |
183 | Int_t digitnumber, | |
184 | Int_t& chamber, Int_t& cathode, Int_t& digit | |
185 | ) | |
186 | { | |
187 | // Decodes a digit number into information about the digit. | |
188 | // One can subsequently fetch the digit with | |
189 | // AliMUONDataInterface::Digit(chamber, cathode, digit) | |
190 | ||
191 | cathode = (digitnumber >> 31) & 0x1; | |
192 | chamber = (digitnumber >> 27) & 0xF; | |
193 | digit = digitnumber & 0x7FFFFFF; | |
194 | } | |
195 |