Cleanup of documentation and code.
[u/mrichter/AliRoot.git] / HLT / MUON / AliHLTMUONRecHit.h
CommitLineData
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
7/* $Id$ */
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 */
29class 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
38public:
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.
56 * \param manu The MANU ID of the channel as found in the raw data word.
57 * \param channel The MANU channel ID as found in the raw data word.
58 * \param signal The ADC signal value as found in the raw data word.
59 * \param rawDataWord The actual raw data word.
60 */
61 AliChannel(
753896cd 62 Short_t manu = -1,
63 Short_t channel = -1,
64 Short_t signal = -1,
65 UInt_t rawDataWord = 0
66 ) :
67 TObject(),
68 fManu(manu), fAddress(channel), fSignal(signal),
69 fRawDataWord(rawDataWord)
70 {}
71
450e0b36 72 /**
73 * Default destructor.
74 */
75 virtual ~AliChannel() {}
753896cd 76
77 /**
78 * Returns the MANU address.
79 */
80 Short_t Manu() const { return fManu; }
81
82 /**
83 * Returns the channel address of the MANU.
84 */
85 Short_t Address() const { return fAddress; }
86
87 /**
88 * Returns the ADC signal measured on the channel.
89 */
90 Short_t Signal() const { return fSignal; }
91
92 /**
93 * Returns the raw data word as found in the tracking DDL payload.
94 */
95 UInt_t RawDataWord() const { return fRawDataWord; }
96
97 virtual void Print(Option_t* option = NULL) const;
98
99 // Methods inherited from TObject
100 virtual Bool_t IsSortable() const { return kTRUE; }
101 Int_t Compare(const TObject* obj) const;
102
103 // Implement comparison operators.
450e0b36 104 bool operator == (const AliChannel& c) const
753896cd 105 {
106 return fManu == c.fManu and fAddress == c.fAddress
107 and fSignal == c.fSignal
108 and fRawDataWord == c.fRawDataWord;
109 }
110
450e0b36 111 bool operator != (const AliChannel& c) const
753896cd 112 {
450e0b36 113 return not this->operator == (c);
753896cd 114 }
115
116 private:
117
450e0b36 118 Short_t fManu; ///< The MANU address on the electronics.
119 Short_t fAddress; ///< The channel address on the electronics.
120 Short_t fSignal; ///< ADC value of signal.
121 UInt_t fRawDataWord; ///< The raw data word as found in the DDL stream.
753896cd 122
450e0b36 123 ClassDef(AliHLTMUONRecHit::AliChannel, 2); // A MANU channel forming part of a cluster that was considered during hit reconstruction in dHLT.
753896cd 124 };
125
126 /**
127 * Construct a new AliHLTMUONRecHit object with coordinate (x, y, z).
128 * @param x X coordinate of hit
129 * @param y Y coordinate of hit
130 * @param z Z coordinate of hit
131 * @param sourceDDL The DDL from which this hit originates.
132 * @param detectorId The ID number for the AliRoot detector element on
133 * which this hit resides.
134 * @param clusterId The cluster ID number assigned to the hit's cluster.
135 * @param nChExp The expected number of channels that form the cluster.
136 */
137 AliHLTMUONRecHit(
138 Float_t x = 0,
139 Float_t y = 0,
140 Float_t z = 0,
141 Int_t sourceDDL = -1,
142 Int_t detElemId = -1,
143 Int_t clusterId = -1,
144 Int_t nChExp = 0
145 ) :
146 fCoordinate(x, y, z), fSourceDDL(sourceDDL),
147 fDetElemId(detElemId), fClusterId(clusterId), fNchExp(nChExp),
450e0b36 148 fChannels("AliHLTMUONRecHit::AliChannel", 6)
753896cd 149 {}
150
450e0b36 151 /**
152 * Default destructor.
153 */
753896cd 154 virtual ~AliHLTMUONRecHit() {}
155
156 /**
157 * Returns the 3D hit coordinate.
158 */
159 const TVector3& Coordinate() const { return fCoordinate; }
160
161 /**
162 * Returns the X coordinate of the reconstructed hit in centimetres.
163 */
164 Double_t X() const { return fCoordinate.X(); }
165
166 /**
167 * Returns the Y coordinate of the reconstructed hit in centimetres.
168 */
169 Double_t Y() const { return fCoordinate.Y(); }
170
171 /**
172 * Returns the Z coordinate of the reconstructed hit in centimetres.
173 */
174 Double_t Z() const { return fCoordinate.Z(); }
175
176 /**
177 * Returns the source DDL from which this hit originates.
178 * -1 is returned if this was not set.
179 */
180 Int_t SourceDDL() const { return fSourceDDL; }
181
182 /**
183 * Returns the detector element ID on which this reconstructed hit resides.
184 * -1 is returned if this was not set.
185 */
186 Int_t DetElemId() const { return fDetElemId; }
187
188 /**
189 * Returns the chamber number of this hit in the range [1..14].
190 * If -1 is returned then the chamber number is not known because the
191 * extra debugging information such as detector element ID was not set.
192 * @param warn Indicates if any warning should be printed in case of problems.
193 */
194 Int_t Chamber(bool warn = true) const;
195
196 /**
197 * Returns the ID number given to the hit's cluster.
198 */
199 Int_t ClusterId() const { return fClusterId; }
200
201 /**
202 * Returns the expected number of channels that are to be added to this hit.
203 * If the number of calls to AddChannel does not correspond to this value
204 * then we lost some debugging information along the way.
205 */
206 UInt_t ExpectedNchannels() const { return fNchExp; }
207
208 /**
209 * Sets the debugging information for this hit.
210 * @param detElemId The detector element ID.
211 * @param clusterId Cluster ID of the hit's cluster.
212 * @param nChExp Number of expected channels forming the cluster.
213 * @param sourceDDL The source DDL of this hit.
214 */
215 void SetDebugInfo(
216 Int_t detElemId, Int_t clusterId, UInt_t nChExp,
217 Int_t sourceDDL = -1
218 );
219
220 /**
221 * Sets the hit coordinate.
222 */
223 void SetHit(Float_t x, Float_t y, Float_t z)
224 {
225 fCoordinate.SetXYZ(x, y, z);
226 }
227
228 /**
229 * Returns the number of channels associated with this hit.
230 */
231 Int_t Nchannels() const { return fChannels.GetEntriesFast(); }
232
233 /**
234 * Returns the i'th channel associated with this hit.
235 * @param i Should be a number in the range [0..n), where n = Nchannels().
236 */
450e0b36 237 const AliChannel* GetChannel(Int_t i) const
753896cd 238 {
450e0b36 239 return static_cast<const AliChannel*>(fChannels[i]);
753896cd 240 }
241
242 /**
243 * Adds a new channel to this hit if it is on a tracking chamber.
244 * @param manu The MANU number
245 * @param channel The MANU channel address.
246 * @param signal The ADC signal value measured on the channel.
247 * @param rawDataWord This is the raw data word as read from the DDL.
248 */
249 void AddChannel(
250 Short_t manu, Short_t channel, Short_t signal,
251 UInt_t rawDataWord
252 );
253
254 /**
255 * Prints the details of the reconstructed hit.
256 * @param option A case sensitive string that can contain one of the
257 * following strings:
258 * "compact" - Prints just the coordinates of the hit in a terse format.
259 * "detail" - Prints the coordinates and detector element ID.
260 * "all" - Prints all known information about this hit including
261 * channel information forming the cluster that was reconstructed.
262 * If the string contains an empty option or NULL then the default is
263 * to print compactly.
264 */
265 virtual void Print(Option_t* option = NULL) const;
266
267 // Methods inherited from TObject
268 virtual Bool_t IsSortable() const { return kTRUE; }
269 Int_t Compare(const TObject* obj) const;
270
271 // Implement comparison operators.
272 bool operator == (const AliHLTMUONRecHit& hit) const
273 {
274 return X() == hit.X() and Y() == hit.Y() and Z() == hit.Z();
275 }
276
277 bool operator != (const AliHLTMUONRecHit& hit) const
278 {
279 return not this->operator == (hit);
280 }
281
282private:
283
450e0b36 284 TVector3 fCoordinate; ///< The 3D coordinate of the hit in AliRoot global coordinates (cm).
753896cd 285
286 // The following is debugging information and may not be filled if the
287 // dHLT components were not set to produce this information.
450e0b36 288 Int_t fSourceDDL; ///< The DDL from which this hit originates.
289 Int_t fDetElemId; ///< Detector element ID number.
290 Int_t fClusterId; ///< The cluster ID number used to relate all the channels to each other.
291 UInt_t fNchExp; ///< The number of channels that were supposed to be found.
292 TClonesArray fChannels; ///< The channels forming part of the cluster from which this hit was reconstructed.
753896cd 293
450e0b36 294 ClassDef(AliHLTMUONRecHit, 2); // A reconstructed hit translated from dHLT raw data into ROOT format.
753896cd 295};
296
297#endif // ALIHLTMUONRECHIT_H