]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/MUON/AliHLTMUONTriggerRecord.h
Cleanup of documentation and code.
[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          */
168         Int_t PatternX(Int_t chamber) const;
169         
170         /**
171          * Returns the 16 bit Y pattern from the local board.
172          * -1 is returned if this information was not set.
173          * @param chamber  The chamber for which to fetch the bit pattern.
174          *                Valid values are in the range [11..14].
175          */
176         Int_t PatternY(Int_t chamber) const;
177         
178         /**
179          * Returns the Z coordinate in the middle of the magnetic field used to
180          * calculate the momentum.
181          */
182         Float_t Zmiddle() const { return fZmiddle; }
183         
184         /**
185          * Returns the integrated magnetic field strength times charge used in
186          * the calculation of the momentum. Value returned in (T.m) tesla metres.
187          */
188         Float_t QBL() const { return fQBL; }
189         
190         /**
191          * Sets the hit coordinate (in AliRoot global coordinates) on the
192          * given chamber.
193          * @param chamber  The chamber for which to set the hit. Valid values
194          *                 are in the range [11..14].
195          * @param x  The X coordinate of the hit in centimetres.
196          * @param y  The Y coordinate of the hit in centimetres.
197          * @param z  The Z coordinate of the hit in centimetres.
198          */
199         void SetHit(Int_t chamber, Float_t x, Float_t y, Float_t z);
200         
201         /**
202          * Sets the debugging information for the hit on the specified chamber.
203          * @param chamber  The chamber for which to set the debugging information.
204          *                Valid values are in the range [11..14].
205          * @param detElemId  The detector element ID.
206          * @param patterX    The X bit pattern from the local board.
207          * @param patterY    The Y bit pattern from the local board.
208          */
209         void SetHitDebugInfo(
210                         Int_t chamber,
211                         Int_t detElemId, UShort_t patternX, UShort_t patternY
212                 );
213         
214         /**
215          * Prints the details of the trigger record.
216          * @param option  A case sensitive string that can contain one of the
217          *     following strings:
218          *       "compact" - Prints just the momentum, sign and ID of the trigger
219          *                   record in a terse format.
220          *       "detail" - Prints also the hit information.
221          *       "all" - Prints all known information about this trigger record.
222          *     If the string contains an empty option or NULL then the default is
223          *     to print compactly.
224          */
225         virtual void Print(Option_t* option = NULL) const;
226         
227         // Methods inherited from TObject
228         virtual Bool_t IsSortable() const { return kTRUE; }
229         Int_t Compare(const TObject* obj) const;
230
231         // Implement comparison operators.
232         bool operator == (const AliHLTMUONTriggerRecord& trigrec) const;
233
234         bool operator != (const AliHLTMUONTriggerRecord& trigrec) const
235         {
236                 return not this->operator == (trigrec);
237         }
238
239 private:
240
241         Int_t fId; ///< Each trigger record should have an ID number unique for a given event.
242         Int_t fSign;  ///< The sign of the particle: -1 or 1. 0 indicates unknown value.
243         TVector3 fMomentum; ///< Momentum vector of the particle in GeV/c.
244         TVector3 fHit[4];   ///< hit coordinates on trigger chambers 11 to 14.
245         
246         // The following is debugging information and may not be filled if the
247         // dHLT components were not set to produce this information.
248         Int_t fSourceDDL;  ///< The DDL from which this trigger record originates.
249         Int_t fDetElemId[4]; ///< The detector element ID for the hit on each chamber 11 to 14.
250         Int_t fPatternX[4];  ///< The X pattern from the local board structure for chambers 11 to 14. -1 if invalid.
251         Int_t fPatternY[4];  ///< The Y pattern from the local board structure for chambers 11 to 14. -1 if invalid.
252         
253         // Parameters used in momentum estimation:
254         Float_t fZmiddle; ///< Particle momentum X component in GeV/c.
255         Float_t fQBL;     ///< The integrated magnetic field times charge in (T.m) tesla metres.
256                 
257         ClassDef(AliHLTMUONTriggerRecord, 2);  // Trigger record object translated from dHLT internal raw data.
258 };
259
260 #endif // ALIHLTMUONTRIGGERRECORD_H