]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/MUON/AliHLTMUONTriggerRecord.h
Fixing warning
[u/mrichter/AliRoot.git] / HLT / MUON / AliHLTMUONTriggerRecord.h
1 #ifndef ALIHLTMUONTRIGGERRECORD_H
2 #define ALIHLTMUONTRIGGERRECORD_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   AliHLTMUONTriggerRecord.h
11 /// @author Artur Szostak <artursz@iafrica.com>
12 /// @date   29 Sep 2007
13 /// @brief  Declaration of the trigger record structure in ROOT object format for dHLT.
14 ///
15
16 #include "TObject.h"
17 #include "TVector3.h"
18 #include <ostream>
19
20 /**
21  * Trigger record class containing information about a dimuon L0 trigger
22  * local board decision in a ROOT object.
23  * This class is mainly for testing or as a helper object for dHLT specific analysis,
24  * since it is sometimes easier to store and handle ROOT objects.
25  */
26 class AliHLTMUONTriggerRecord : public TObject
27 {
28         /**
29          * Stream operator for usage with std::ostream classes.
30          * Allows usage such as:
31          *   AliHLTMUONTriggerRecord tr; std::cout << tr;
32          */
33         friend std::ostream& operator << (
34                         std::ostream& stream,
35                         const AliHLTMUONTriggerRecord& trigrec
36                 );
37
38 public:
39
40         /**
41          * Constructor for creating a new trigger record.
42          * @param id    The trigger record ID number unique for an event.
43          * @param sign  The particle's sign. Must be -1, 1 or 0 if the sign is unknown.
44          * @param px    X component of the particle's momentum.
45          * @param py    Y component of the particle's momentum.
46          * @param pz    Z component of the particle's momentum.
47          * @param sourceDDL  The DDL from which this trigger record originates.
48          * @param zf    The Z coordinate of the middle of the magnetic field assumed
49          *              during momentum calculation.
50          * @param qbl   The integrated magnetic field strength assumed during momentum
51          *              calculation.
52          */
53         AliHLTMUONTriggerRecord(
54                         Int_t id = -1,
55                         Int_t sign = 0,
56                         Float_t px = 0,
57                         Float_t py = 0,
58                         Float_t pz = 0,
59                         Int_t sourceDDL = -1,
60                         Float_t zf = 0,
61                         Float_t qbl = 0
62                 );
63         
64         /**
65          * Default destructor.
66          */
67         virtual ~AliHLTMUONTriggerRecord() {}
68
69         /**
70          * Returns the trigger record ID number, which is unique for an event.
71          */
72         Int_t Id() const { return fId; }
73
74         /**
75          * Returns the sign of the particle: -1, 1 or 0 if the sign is unknown.
76          */
77         Int_t Sign() const { return fSign; }
78
79         /**
80          * Returns the momentum vector with components in GeV/c.
81          */
82         const TVector3& Momentum() const { return fMomentum; }
83
84         /**
85          * Returns the X component of the particle's momentum in GeV/c.
86          */
87         Double_t Px() const { return fMomentum.Px(); }
88
89         /**
90          * Returns the Y component of the particle's momentum in GeV/c.
91          */
92         Double_t Py() const { return fMomentum.Py(); }
93
94         /**
95          * Returns the Z component of the particle's momentum in GeV/c.
96          */
97         Double_t Pz() const { return fMomentum.Pz(); }
98
99         /**
100          * Returns the momentum magnitude of the particle in GeV/c.
101          */
102         Double_t P() const { return fMomentum.Mag(); }
103
104         /**
105          * Returns the transverse momentum of the particle in GeV/c.
106          */
107         Double_t Pt() const { return fMomentum.Pt(); }
108
109         /**
110          * Returns the polar angle of the momentum vector in radians.
111          */
112         Double_t Polar() const { return fMomentum.Theta(); }
113
114         /**
115          * Returns the azimuthal angle of the transverse momentum in radians.
116          */
117         Double_t Phi() const { return fMomentum.Phi(); }
118
119         /**
120          * Returns the hit coordinate on the specified chamber in the AliRoot
121          * coordinate system.
122          * @param chamber  The chamber for which to fetch the hit. Valid values
123          *                 are in the range [11..14].
124          */
125         const TVector3& Hit(Int_t chamber) const;
126
127         /**
128          * Returns the X coordinate of the reconstructed hit in centimetres.
129          * @param chamber  The chamber for which to fetch the X coordinate.
130          *                 Valid values are in the range [11..14].
131          */
132         Double_t X(Int_t chamber) const { return Hit(chamber).X(); }
133
134         /**
135          * Returns the Y coordinate of the reconstructed hit in centimetres.
136          * @param chamber  The chamber for which to fetch the Y coordinate.
137          *                 Valid values are in the range [11..14].
138          */
139         Double_t Y(Int_t chamber) const { return Hit(chamber).Y(); }
140
141         /**
142          * Returns the Z coordinate of the reconstructed hit in centimetres.
143          * @param chamber  The chamber for which to fetch the Z coordinate.
144          *                 Valid values are in the range [11..14].
145          */
146         Double_t Z(Int_t chamber) const { return Hit(chamber).Z(); }
147         
148         /**
149          * Returns the source DDL from which this trigger record originates.
150          * -1 is returned if this was not set.
151          */
152         Int_t SourceDDL() const { return fSourceDDL; }
153         
154         /**
155          * Returns the detector element ID number for the hit on the specified
156          * chamber. -1 is returned if this information was not set.
157          * @param chamber  The chamber for which to fetch the detector element ID.
158          *                 Valid values are in the range [11..14].
159          */
160         Int_t DetElemId(Int_t chamber) const;
161         
162         /**
163          * Returns the 16 bit X pattern from the local board.
164          * -1 is returned if this information was not set.
165          * @param chamber  The chamber for which to fetch the bit pattern.
166          *                 Valid values are in the range [11..14].
167          * \param board  The board for which to fetch the bit pattern in the range [0..2].
168          *             0 indicates the previous board, 1 the central and 2 the next board.
169          */
170         Int_t PatternX(Int_t chamber, Int_t board) const;
171         
172         /**
173          * Returns the 16 bit Y pattern from the local board.
174          * -1 is returned if this information was not set.
175          * @param chamber  The chamber for which to fetch the bit pattern.
176          *                Valid values are in the range [11..14].
177          * \param board  The board for which to fetch the bit pattern in the range [0..2].
178          *             0 indicates the previous board, 1 the central and 2 the next board.
179          */
180         Int_t PatternY(Int_t chamber, Int_t board) const;
181         
182         /**
183          * Returns the Z coordinate in the middle of the magnetic field used to
184          * calculate the momentum.
185          */
186         Float_t Zmiddle() const { return fZmiddle; }
187         
188         /**
189          * Returns the integrated magnetic field strength times polarity used in
190          * the calculation of the momentum. Value returned in (T.m) tesla metres.
191          */
192         Float_t QBL() const { return fQBL; }
193         
194         /**
195          * Sets the hit coordinate (in AliRoot global coordinates) on the
196          * given chamber.
197          * @param chamber  The chamber for which to set the hit. Valid values
198          *                 are in the range [11..14].
199          * @param x  The X coordinate of the hit in centimetres.
200          * @param y  The Y coordinate of the hit in centimetres.
201          * @param z  The Z coordinate of the hit in centimetres.
202          */
203         void SetHit(Int_t chamber, Float_t x, Float_t y, Float_t z);
204         
205         /**
206          * Sets the hit coordinate on a given chamber with the detection element ID.
207          * @param chamber  The chamber for which to set the hit. Valid values
208          *                 are in the range [11..14].
209          * @param x  The X coordinate of the hit in centimetres.
210          * @param y  The Y coordinate of the hit in centimetres.
211          * @param z  The Z coordinate of the hit in centimetres.
212          * @param detElemId The detection element ID where the hit was found.
213          */
214         void SetHit(Int_t chamber, Float_t x, Float_t y, Float_t z, Int_t detElemId);
215         
216         /**
217          * Sets the debugging information for the hit on the specified chamber.
218          * @param chamber  The chamber for which to set the debugging information.
219          *                Valid values are in the range [11..14].
220          * @param patternX  Array of X bit pattern from the local boards.
221          * @param patternY  Array of Y bit pattern from the local boards.
222          * \note The bit patterns in the array are in the order: [previous, central, next].
223          */
224         void SetHitDebugInfo(Int_t chamber, UShort_t patternX[3], UShort_t patternY[3]);
225         
226         /**
227          * Sets the debugging information for the hit on the specified chamber.
228          * @param zmiddle  The z coordinate of the middle of the magnetic field.
229          * @param bfieldintegral  The magnetic field integral times field polarity.
230          */
231         void SetDebugInfo(Float_t zmiddle, Float_t bfieldintegral);
232         
233         /**
234          * Prints the details of the trigger record.
235          * @param option  A case sensitive string that can contain one of the
236          *     following strings:
237          *       "compact" - Prints just the momentum, sign and ID of the trigger
238          *                   record in a terse format.
239          *       "detail" - Prints also the hit information.
240          *       "all" - Prints all known information about this trigger record.
241          *     If the string contains an empty option or NULL then the default is
242          *     to print compactly.
243          */
244         virtual void Print(Option_t* option = NULL) const;
245         
246         // Methods inherited from TObject
247         virtual Bool_t IsSortable() const { return kTRUE; }
248         Int_t Compare(const TObject* obj) const;
249
250         // Implement comparison operators.
251         bool operator == (const AliHLTMUONTriggerRecord& trigrec) const;
252
253         bool operator != (const AliHLTMUONTriggerRecord& trigrec) const
254         {
255                 return not this->operator == (trigrec);
256         }
257
258 private:
259
260         Int_t fId; ///< Each trigger record should have an ID number unique for a given event.
261         Int_t fSign;  ///< The sign of the particle: -1 or 1. 0 indicates unknown value.
262         TVector3 fMomentum; ///< Momentum vector of the particle in GeV/c.
263         TVector3 fHit[4];   ///< hit coordinates on trigger chambers 11 to 14.
264         
265         // The following is debugging information and may not be filled if the
266         // dHLT components were not set to produce this information.
267         Int_t fSourceDDL;  ///< The DDL from which this trigger record originates.
268         Int_t fDetElemId[4]; ///< The detector element ID for the hit on each chamber 11 to 14.
269         Int_t fPatternX[4][3]; ///< The X strip pattern for chambers 11 to 14 and previous, central and next local boards. -1 if invalid.
270         Int_t fPatternY[4][3]; ///< The Y strip pattern for chambers 11 to 14 and previous, central and next local boards. -1 if invalid.
271         
272         // Parameters used in momentum estimation:
273         Float_t fZmiddle; ///< Particle momentum X component in GeV/c.
274         Float_t fQBL;     ///< The integrated magnetic field times field polarity in (T.m) tesla metres.
275                 
276         ClassDef(AliHLTMUONTriggerRecord, 4);  // Trigger record object translated from dHLT internal raw data.
277 };
278
279 #endif // ALIHLTMUONTRIGGERRECORD_H