]>
Commit | Line | Data |
---|---|---|
753896cd | 1 | #ifndef ALIHLTMUONRECHIT_H |
2 | #define ALIHLTMUONRECHIT_H | |
3 | /* This file is property of and copyright by the ALICE HLT Project * | |
4 | * ALICE Experiment at CERN, All rights reserved. * | |
5 | * See cxx source for full Copyright notice */ | |
6 | ||
1d8ae082 | 7 | // $Id$ |
753896cd | 8 | |
450e0b36 | 9 | /// |
10 | /// @file AliHLTMUONRecHit.h | |
11 | /// @author Artur Szostak <artursz@iafrica.com> | |
12 | /// @date 29 Sep 2007 | |
13 | /// @brief Declaration of a reconstructed hit ROOT object to store 3D hit coordinates. | |
14 | /// | |
753896cd | 15 | |
16 | #include "TObject.h" | |
17 | #include "TClonesArray.h" | |
18 | #include "TVector3.h" | |
19 | #include <ostream> | |
20 | ||
21 | /** | |
22 | * A 3D hit object used to store hits reconstructed on the tracking chambers by | |
23 | * the dHLT. These objects store information translated into ROOT format from | |
24 | * dHLT raw data. Reconstructed hit values of (0, 0, 0) indicate an invalid or | |
25 | * nil hit. | |
450e0b36 | 26 | * This class is mainly for testing or as a helper object for dHLT specific analysis, |
27 | * since it is sometimes easier to store and handle ROOT objects. | |
753896cd | 28 | */ |
29 | class AliHLTMUONRecHit : public TObject | |
30 | { | |
31 | /** | |
32 | * Stream operator for usage with std::ostream classes. | |
33 | * Allows usage such as: | |
34 | * AliHLTMUONRecHit h; std::cout << h; | |
35 | */ | |
36 | friend std::ostream& operator << (std::ostream& stream, const AliHLTMUONRecHit& hit); | |
37 | ||
38 | public: | |
39 | ||
40 | /** | |
450e0b36 | 41 | * The AliChannel class stores extra debugging information about the channels |
753896cd | 42 | * and raw data words that were considered during reconstruction of a hit |
43 | * by the dHLT hit reconstructor component. | |
44 | */ | |
450e0b36 | 45 | class AliChannel : public TObject |
753896cd | 46 | { |
47 | /** | |
48 | * Stream operator for usage with std::ostream classes. | |
49 | */ | |
450e0b36 | 50 | friend std::ostream& operator << (std::ostream& stream, const AliChannel& c); |
753896cd | 51 | |
52 | public: | |
53 | ||
450e0b36 | 54 | /** |
55 | * Constructor. | |
66622a82 | 56 | * \param busPatch The bus patch ID of the channel as found in the DDL raw data. |
450e0b36 | 57 | * \param manu The MANU ID of the channel as found in the raw data word. |
58 | * \param channel The MANU channel ID as found in the raw data word. | |
59 | * \param signal The ADC signal value as found in the raw data word. | |
60 | * \param rawDataWord The actual raw data word. | |
61 | */ | |
62 | AliChannel( | |
66622a82 | 63 | Short_t busPatch = -1, |
753896cd | 64 | Short_t manu = -1, |
65 | Short_t channel = -1, | |
66 | Short_t signal = -1, | |
67 | UInt_t rawDataWord = 0 | |
68 | ) : | |
66622a82 | 69 | TObject(), fBusPatch(busPatch), |
753896cd | 70 | fManu(manu), fAddress(channel), fSignal(signal), |
71 | fRawDataWord(rawDataWord) | |
72 | {} | |
73 | ||
450e0b36 | 74 | /** |
75 | * Default destructor. | |
76 | */ | |
77 | virtual ~AliChannel() {} | |
753896cd | 78 | |
66622a82 | 79 | /** |
80 | * Returns the bus patch ID of the channel. | |
81 | */ | |
82 | Short_t BusPatch() const { return fBusPatch; } | |
83 | ||
753896cd | 84 | /** |
85 | * Returns the MANU address. | |
86 | */ | |
87 | Short_t Manu() const { return fManu; } | |
88 | ||
89 | /** | |
90 | * Returns the channel address of the MANU. | |
91 | */ | |
92 | Short_t Address() const { return fAddress; } | |
93 | ||
94 | /** | |
95 | * Returns the ADC signal measured on the channel. | |
96 | */ | |
97 | Short_t Signal() const { return fSignal; } | |
98 | ||
99 | /** | |
100 | * Returns the raw data word as found in the tracking DDL payload. | |
101 | */ | |
102 | UInt_t RawDataWord() const { return fRawDataWord; } | |
103 | ||
66622a82 | 104 | /** |
105 | * Returns true if the channel is for the bending plane. | |
106 | */ | |
107 | Bool_t InBendingPlane() const { return (fRawDataWord & (1<<28)) == 0; } | |
108 | ||
109 | /** | |
110 | * Returns true if the channel is for the non-bending plane. | |
111 | */ | |
112 | Bool_t InNonBendingPlane() const { return (fRawDataWord & (1<<28)) != 0; } | |
113 | ||
753896cd | 114 | virtual void Print(Option_t* option = NULL) const; |
115 | ||
116 | // Methods inherited from TObject | |
117 | virtual Bool_t IsSortable() const { return kTRUE; } | |
118 | Int_t Compare(const TObject* obj) const; | |
119 | ||
120 | // Implement comparison operators. | |
450e0b36 | 121 | bool operator == (const AliChannel& c) const |
753896cd | 122 | { |
123 | return fManu == c.fManu and fAddress == c.fAddress | |
124 | and fSignal == c.fSignal | |
125 | and fRawDataWord == c.fRawDataWord; | |
126 | } | |
127 | ||
450e0b36 | 128 | bool operator != (const AliChannel& c) const |
753896cd | 129 | { |
450e0b36 | 130 | return not this->operator == (c); |
753896cd | 131 | } |
132 | ||
133 | private: | |
134 | ||
66622a82 | 135 | Short_t fBusPatch; ///< The bus patch ID for the channel. |
450e0b36 | 136 | Short_t fManu; ///< The MANU address on the electronics. |
137 | Short_t fAddress; ///< The channel address on the electronics. | |
138 | Short_t fSignal; ///< ADC value of signal. | |
139 | UInt_t fRawDataWord; ///< The raw data word as found in the DDL stream. | |
753896cd | 140 | |
66622a82 | 141 | ClassDef(AliHLTMUONRecHit::AliChannel, 5); // A MANU channel forming part of a cluster that was considered during hit reconstruction in dHLT. |
753896cd | 142 | }; |
143 | ||
144 | /** | |
145 | * Construct a new AliHLTMUONRecHit object with coordinate (x, y, z). | |
146 | * @param x X coordinate of hit | |
147 | * @param y Y coordinate of hit | |
148 | * @param z Z coordinate of hit | |
149 | * @param sourceDDL The DDL from which this hit originates. | |
150 | * @param detectorId The ID number for the AliRoot detector element on | |
151 | * which this hit resides. | |
152 | * @param clusterId The cluster ID number assigned to the hit's cluster. | |
66622a82 | 153 | * @param nChExpB The expected number of channels in the bending plane that form the cluster. |
154 | * @param nChExpNB The expected number of channels in the non-bending plane that form the cluster. | |
155 | * @param chargeB The charge of the cluster in the bending plane. | |
156 | * @param chargeNB The charge of the cluster in the non-bending plane. | |
753896cd | 157 | */ |
158 | AliHLTMUONRecHit( | |
159 | Float_t x = 0, | |
160 | Float_t y = 0, | |
161 | Float_t z = 0, | |
162 | Int_t sourceDDL = -1, | |
163 | Int_t detElemId = -1, | |
164 | Int_t clusterId = -1, | |
66622a82 | 165 | UShort_t nChExpB = 0, |
166 | UShort_t nChExpNB = 0, | |
167 | Float_t chargeB = -1, | |
168 | Float_t chargeNB = -1 | |
753896cd | 169 | ) : |
92aebaf3 | 170 | TObject(), fCoordinate(x, y, z), fSourceDDL(sourceDDL), |
66622a82 | 171 | fDetElemId(detElemId), fClusterId(clusterId), fNchExpB(nChExpB), |
172 | fNchExpNB(nChExpNB), fChannels("AliHLTMUONRecHit::AliChannel", 6), | |
173 | fChargeB(chargeB), fChargeNB(chargeNB) | |
753896cd | 174 | {} |
175 | ||
450e0b36 | 176 | /** |
177 | * Default destructor. | |
178 | */ | |
753896cd | 179 | virtual ~AliHLTMUONRecHit() {} |
180 | ||
181 | /** | |
182 | * Returns the 3D hit coordinate. | |
183 | */ | |
184 | const TVector3& Coordinate() const { return fCoordinate; } | |
185 | ||
186 | /** | |
187 | * Returns the X coordinate of the reconstructed hit in centimetres. | |
188 | */ | |
189 | Double_t X() const { return fCoordinate.X(); } | |
190 | ||
191 | /** | |
192 | * Returns the Y coordinate of the reconstructed hit in centimetres. | |
193 | */ | |
194 | Double_t Y() const { return fCoordinate.Y(); } | |
195 | ||
196 | /** | |
197 | * Returns the Z coordinate of the reconstructed hit in centimetres. | |
198 | */ | |
199 | Double_t Z() const { return fCoordinate.Z(); } | |
200 | ||
201 | /** | |
202 | * Returns the source DDL from which this hit originates. | |
203 | * -1 is returned if this was not set. | |
204 | */ | |
205 | Int_t SourceDDL() const { return fSourceDDL; } | |
206 | ||
207 | /** | |
208 | * Returns the detector element ID on which this reconstructed hit resides. | |
209 | * -1 is returned if this was not set. | |
210 | */ | |
211 | Int_t DetElemId() const { return fDetElemId; } | |
212 | ||
213 | /** | |
214 | * Returns the chamber number of this hit in the range [1..14]. | |
215 | * If -1 is returned then the chamber number is not known because the | |
a090ff22 | 216 | * detector element ID was not set or is invalid. |
753896cd | 217 | * @param warn Indicates if any warning should be printed in case of problems. |
218 | */ | |
219 | Int_t Chamber(bool warn = true) const; | |
220 | ||
221 | /** | |
222 | * Returns the ID number given to the hit's cluster. | |
223 | */ | |
224 | Int_t ClusterId() const { return fClusterId; } | |
225 | ||
226 | /** | |
66622a82 | 227 | * Returns the expected total number of channels that are to be added to this hit. |
753896cd | 228 | * If the number of calls to AddChannel does not correspond to this value |
229 | * then we lost some debugging information along the way. | |
230 | */ | |
66622a82 | 231 | UInt_t ExpectedNchannels() const { return ExpectedNchannelsB() + ExpectedNchannelsNB(); } |
232 | ||
233 | /** | |
234 | * Returns the expected number of channels in the bending plane that are to | |
235 | * be added to this hit. | |
236 | */ | |
237 | UInt_t ExpectedNchannelsB() const { return fNchExpB; } | |
238 | ||
239 | /** | |
240 | * Returns the expected number of channels in the non-bending plane that | |
241 | * are to be added to this hit. | |
242 | */ | |
243 | UInt_t ExpectedNchannelsNB() const { return fNchExpNB; } | |
753896cd | 244 | |
245 | /** | |
83d66053 | 246 | * Returns the total charge of the cluster. |
247 | */ | |
66622a82 | 248 | Float_t TotalCharge() const { return fChargeB + fChargeNB; } |
249 | ||
250 | /** | |
251 | * Returns the charge of the cluster in the bending plane. | |
252 | */ | |
253 | Float_t ChargeB() const { return fChargeB; } | |
254 | ||
255 | /** | |
256 | * Returns the charge of the cluster in the non-bending plane. | |
257 | */ | |
258 | Float_t ChargeNB() const { return fChargeNB; } | |
83d66053 | 259 | |
260 | /** | |
261 | * Sets the extra debugging information for this hit. | |
753896cd | 262 | * @param detElemId The detector element ID. |
263 | * @param clusterId Cluster ID of the hit's cluster. | |
66622a82 | 264 | * @param nChExpB Number of expected channels in the bending plane forming the cluster. |
265 | * @param nChExpNB Number of expected channels in the non-bending plane forming the cluster. | |
266 | * @param chargeB The charge of the cluster in the bending plane. | |
267 | * @param chargeNB The charge of the cluster in the non-bending plane. | |
753896cd | 268 | * @param sourceDDL The source DDL of this hit. |
269 | */ | |
270 | void SetDebugInfo( | |
66622a82 | 271 | Int_t detElemId, Int_t clusterId, |
272 | UShort_t nChExpB, UShort_t nChExpNB, | |
273 | Float_t chargeB, Float_t chargeNB, | |
274 | Int_t sourceDDL = -1 | |
753896cd | 275 | ); |
276 | ||
277 | /** | |
278 | * Sets the hit coordinate. | |
279 | */ | |
280 | void SetHit(Float_t x, Float_t y, Float_t z) | |
281 | { | |
282 | fCoordinate.SetXYZ(x, y, z); | |
283 | } | |
284 | ||
285 | /** | |
66622a82 | 286 | * Returns the total number of channels associated with this hit. |
753896cd | 287 | */ |
288 | Int_t Nchannels() const { return fChannels.GetEntriesFast(); } | |
289 | ||
290 | /** | |
291 | * Returns the i'th channel associated with this hit. | |
292 | * @param i Should be a number in the range [0..n), where n = Nchannels(). | |
293 | */ | |
450e0b36 | 294 | const AliChannel* GetChannel(Int_t i) const |
753896cd | 295 | { |
450e0b36 | 296 | return static_cast<const AliChannel*>(fChannels[i]); |
753896cd | 297 | } |
298 | ||
299 | /** | |
300 | * Adds a new channel to this hit if it is on a tracking chamber. | |
462e3880 | 301 | * @param buspatch The bus patch ID of the channel. |
753896cd | 302 | * @param manu The MANU number |
303 | * @param channel The MANU channel address. | |
304 | * @param signal The ADC signal value measured on the channel. | |
305 | * @param rawDataWord This is the raw data word as read from the DDL. | |
306 | */ | |
307 | void AddChannel( | |
462e3880 | 308 | Short_t buspatch, Short_t manu, Short_t channel, |
309 | Short_t signal, UInt_t rawDataWord | |
753896cd | 310 | ); |
311 | ||
312 | /** | |
313 | * Prints the details of the reconstructed hit. | |
314 | * @param option A case sensitive string that can contain one of the | |
315 | * following strings: | |
316 | * "compact" - Prints just the coordinates of the hit in a terse format. | |
317 | * "detail" - Prints the coordinates and detector element ID. | |
318 | * "all" - Prints all known information about this hit including | |
319 | * channel information forming the cluster that was reconstructed. | |
320 | * If the string contains an empty option or NULL then the default is | |
321 | * to print compactly. | |
322 | */ | |
323 | virtual void Print(Option_t* option = NULL) const; | |
324 | ||
325 | // Methods inherited from TObject | |
326 | virtual Bool_t IsSortable() const { return kTRUE; } | |
327 | Int_t Compare(const TObject* obj) const; | |
328 | ||
329 | // Implement comparison operators. | |
330 | bool operator == (const AliHLTMUONRecHit& hit) const | |
331 | { | |
332 | return X() == hit.X() and Y() == hit.Y() and Z() == hit.Z(); | |
333 | } | |
334 | ||
335 | bool operator != (const AliHLTMUONRecHit& hit) const | |
336 | { | |
337 | return not this->operator == (hit); | |
338 | } | |
339 | ||
340 | private: | |
341 | ||
450e0b36 | 342 | TVector3 fCoordinate; ///< The 3D coordinate of the hit in AliRoot global coordinates (cm). |
753896cd | 343 | |
344 | // The following is debugging information and may not be filled if the | |
345 | // dHLT components were not set to produce this information. | |
450e0b36 | 346 | Int_t fSourceDDL; ///< The DDL from which this hit originates. |
347 | Int_t fDetElemId; ///< Detector element ID number. | |
348 | Int_t fClusterId; ///< The cluster ID number used to relate all the channels to each other. | |
66622a82 | 349 | UShort_t fNchExpB; ///< The number of channels in the bending plane that were supposed to be found. |
350 | UShort_t fNchExpNB; ///< The number of channels in the non-bending plane that were supposed to be found. | |
450e0b36 | 351 | TClonesArray fChannels; ///< The channels forming part of the cluster from which this hit was reconstructed. |
66622a82 | 352 | Float_t fChargeB; ///< The charge of the cluster in the bending plane. |
353 | Float_t fChargeNB; ///< The charge of the cluster in the non-bending plane. | |
753896cd | 354 | |
66622a82 | 355 | ClassDef(AliHLTMUONRecHit, 5); // A reconstructed hit translated from dHLT raw data into ROOT format. |
753896cd | 356 | }; |
357 | ||
358 | #endif // ALIHLTMUONRECHIT_H |