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