]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/MUON/AliHLTMUONDataTypes.h
-Added function to get module from specification.
[u/mrichter/AliRoot.git] / HLT / MUON / AliHLTMUONDataTypes.h
1 #ifndef ALIHLTMUONDATATYPES_H
2 #define ALIHLTMUONDATATYPES_H
3 /**************************************************************************
4  * Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. *
5  *                                                                        *
6  * Author: The ALICE Off-line Project.                                    *
7  * Contributors are mentioned in the code where appropriate.              *
8  *                                                                        *
9  * Permission to use, copy, modify and distribute this software and its   *
10  * documentation strictly for non-commercial purposes is hereby granted   *
11  * without fee, provided that the above copyright notice appears in all   *
12  * copies and that both the copyright notice and this permission notice   *
13  * appear in the supporting documentation. The authors make no claims     *
14  * about the suitability of this software for any purpose. It is          *
15  * provided "as is" without express or implied warranty.                  *
16  **************************************************************************/
17
18 /* $Id$ */
19
20 /**
21  * @file   AliHLTMUONDataTypes.h
22  * @author Artur Szostak <artursz@iafrica.com>
23  * @date   
24  * @brief  Declaration of basic data types used in HLT/MUON module.
25  *
26  * The types and structs are defined with C linkage since C generally gives us
27  * more binary compatibility between compilers.
28  */
29
30 #include "AliHLTDataTypes.h"
31 #include <ostream>
32
33 extern "C"
34 {
35
36 /**
37  * The common internal dimuon HLT data block header.
38  * These headers help to identify the data block when it is written to disk and
39  * helps to check the integrity of the data blocks in the system.
40  */
41 struct AliHLTMUONDataBlockHeader
42 {
43         AliHLTUInt16_t fType; // The type of the data block. Must contain a value
44                               // defined by AliHLTMUONDataBlockType.
45         AliHLTUInt16_t fRecordWidth; // The number of bytes each record uses. 
46         AliHLTUInt32_t fNrecords; // Number of records in this data block.
47 };
48
49 /**
50  * The field structure of a single row of the AliHLTMUONHitReconstructor component's
51  * lookup table.
52  */
53 struct AliHLTMUONHitRecoLutRow
54 {
55         AliHLTInt32_t fDetElemId;  // The detector element ID of the pad.
56         AliHLTInt32_t fIX, fIY;    // The X,Y number of the pad.
57         AliHLTFloat32_t fRealX, fRealY, fRealZ;  // The real coordinate of the pad.
58         AliHLTFloat32_t fHalfPadSize; // half padsize in X for bending and Y for nonbending
59         AliHLTInt32_t fPlane;  // The plane and PCB zone ID numbers.
60         AliHLTFloat32_t fPed, fSigma, fA0, fA1; // Calibration values
61         AliHLTInt32_t fThres, fSat; //Calibration values
62 };
63
64 /**
65  * The field structure of a single row of the AliHLTMUONTriggerReconstructor component's
66  * lookup table.
67  */
68 struct AliHLTMUONTriggerRecoLutRow
69 {
70         AliHLTUInt32_t fIdFlags;  /// The chamber and detector element identifier packed in AliHLTMUONRecHitStruct::fFlags format.
71         AliHLTFloat32_t fX;  // Global X coordinate of channel.
72         AliHLTFloat32_t fY;  // Global Y coordinate of channel.
73         AliHLTFloat32_t fZ;  // Global Z coordinate of channel.
74 };
75
76 /**
77  * The lookup table structure for the AliHLTMUONTriggerReconstructor component.
78  * The LUT is used for translating from channel addresses to geometrical positions
79  * and other relevant information of the strips in the trigger chambers.
80  */
81 struct AliHLTMUONTriggerRecoLookupTable
82 {
83         // The dimentions of the LUT are as follows:
84         // [trigger crate ID][local board ID][chamber][cathode - X/Y][bit set in bit pattern]
85         // - The trigger crate ID comes form the regional headers in the DDL payload.
86         // - Local board ID numbers come from the local trigger structures in the
87         //   DDL payload.
88         // - The chamber is for chambers 11 to 14 coded as [0..3], 0 for chamber 11,
89         //   1 for chamber 12 etc.
90         // - The cathode 0 is for the X trigger strips (bending plane) and 1 is
91         //   for the Y strips (non-bending plane).
92         // - The "bit set in pattern" indicates the bit number that was set in
93         //   the strip patterns found in the local structures of the DDL payload.
94         AliHLTMUONTriggerRecoLutRow fRow[16][16][4][2][16];
95 };
96
97 } // extern "C"
98
99
100 /**
101  * The sign/charge of a particle.
102  */
103 enum AliHLTMUONParticleSign
104 {
105         kSignMinus   = -1,
106         kSignUnknown = 0,
107         kSignPlus    = 1
108 };
109
110 /**
111  * The chamber names of the dimuon spectrometer.
112  */
113 enum AliHLTMUONChamberName
114 {
115         kUnknownChamber = -1,
116         kChamber1 = 0,
117         kChamber2 = 1,
118         kChamber3 = 2,
119         kChamber4 = 3,
120         kChamber5 = 4,
121         kChamber6 = 5,
122         kChamber7 = 6,
123         kChamber8 = 7,
124         kChamber9 = 8,
125         kChamber10 = 9,
126         kChamber11 = 10,
127         kChamber12 = 11,
128         kChamber13 = 12,
129         kChamber14 = 13
130 };
131
132 /**
133  * The internal data block type codes.
134  */
135 enum AliHLTMUONDataBlockType
136 {
137         kUnknownDataBlock = 0,
138         kTriggerRecordsDataBlock = 1000,
139         kTrigRecsDebugDataBlock = 1001,
140         kRecHitsDataBlock = 2000,
141         kClustersDataBlock = 2001,
142         kChannelsDataBlock = 2002,
143         kMansoTracksDataBlock = 3000,
144         kMansoCandidatesDataBlock = 3001,
145         kSinglesDecisionDataBlock = 4000,
146         kPairsDecisionDataBlock = 4001
147 };
148
149
150 /**
151  * Stream operator to be able to print AliHLTMUONParticleSign with human
152  * readable names to some stream object like cout (standard output).
153  */
154 inline std::ostream& operator << (std::ostream& stream, AliHLTMUONParticleSign sign)
155 {
156         switch (sign)
157         {
158         case kSignMinus:   stream << "kSignMinus";   break;
159         case kSignUnknown: stream << "kSignUnknown"; break;
160         case kSignPlus:    stream << "kSignPlus";    break;
161         default:           stream << "INVALID";
162         }
163         return stream;
164 }
165
166 /**
167  * Stream operator to be able to print AliHLTMUONChamberName with human
168  * readable names to some stream object like cout (standard output).
169  */
170 inline std::ostream& operator << (std::ostream& stream, AliHLTMUONChamberName chamber)
171 {
172         switch (chamber)
173         {
174         case kUnknownChamber:  stream << "kUnknownChamber";  break;
175         case kChamber1:        stream << "kChamber1";        break;
176         case kChamber2:        stream << "kChamber2";        break;
177         case kChamber3:        stream << "kChamber3";        break;
178         case kChamber4:        stream << "kChamber4";        break;
179         case kChamber5:        stream << "kChamber5";        break;
180         case kChamber6:        stream << "kChamber6";        break;
181         case kChamber7:        stream << "kChamber7";        break;
182         case kChamber8:        stream << "kChamber8";        break;
183         case kChamber9:        stream << "kChamber9";        break;
184         case kChamber10:       stream << "kChamber10";       break;
185         case kChamber11:       stream << "kChamber11";       break;
186         case kChamber12:       stream << "kChamber12";       break;
187         case kChamber13:       stream << "kChamber13";       break;
188         case kChamber14:       stream << "kChamber14";       break;
189         default:               stream << "INVALID";
190         }
191         return stream;
192 }
193
194 /**
195  * Stream operator to be able to print AliHLTMUONDataBlockType with human
196  * readable names to some stream object like cout (standard output).
197  */
198 inline std::ostream& operator << (std::ostream& stream, AliHLTMUONDataBlockType type)
199 {
200         switch (type)
201         {
202         case kUnknownDataBlock:         stream << "kUnknownDataBlock";         break;
203         case kTriggerRecordsDataBlock:  stream << "kTriggerRecordsDataBlock";  break;
204         case kTrigRecsDebugDataBlock:   stream << "kTrigRecsDebugDataBlock";   break;
205         case kRecHitsDataBlock:         stream << "kRecHitsDataBlock";         break;
206         case kClustersDataBlock:        stream << "kClustersDataBlock";        break;
207         case kChannelsDataBlock:        stream << "kChannelsDataBlock";        break;
208         case kMansoTracksDataBlock:     stream << "kMansoTracksDataBlock";     break;
209         case kMansoCandidatesDataBlock: stream << "kMansoCandidatesDataBlock"; break;
210         case kSinglesDecisionDataBlock: stream << "kSinglesDecisionDataBlock"; break;
211         case kPairsDecisionDataBlock:   stream << "kPairsDecisionDataBlock";   break;
212         default:                        stream << "INVALID";
213         }
214         return stream;
215 }
216
217 /**
218  * Stream operator for usage with std::ostream classes which prints the common
219  * data block header in the following format:
220  *  {fType = xx, fRecordWidth = yy, fNrecords = zz}
221  */
222 inline std::ostream& operator << (
223                 std::ostream& stream, const AliHLTMUONDataBlockHeader& header
224         )
225 {
226         stream  << "{fType = " << AliHLTMUONDataBlockType(header.fType)
227                 << ", fRecordWidth = " << header.fRecordWidth
228                 << ", fNrecords = " << header.fNrecords << "}";
229         return stream;
230 }
231
232
233 inline bool operator == (
234                 const AliHLTMUONDataBlockHeader& a, const AliHLTMUONDataBlockHeader& b
235         )
236 {
237         return a.fType == b.fType and a.fRecordWidth == b.fRecordWidth
238                 and a.fNrecords == b.fNrecords;
239 }
240
241 inline bool operator != (
242                 const AliHLTMUONDataBlockHeader& a, const AliHLTMUONDataBlockHeader& b
243         )
244 {
245         return not operator == (a, b);
246 }
247
248 #endif // ALIHLTMUONDATATYPES_H