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