]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/MUON/AliHLTMUONDataTypes.h
Cleanup of documentation and code.
[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         AliHLTFloat32_t fX;  // Global X coordinate of channel.
71         AliHLTFloat32_t fY;  // Global Y coordinate of channel.
72         AliHLTFloat32_t fZ;  // Global Z coordinate of channel.
73 };
74
75 /**
76  * The lookup table structure for the AliHLTMUONTriggerReconstructor component.
77  * The LUT is used for translating from channel addresses to geometrical positions
78  * and other relevant information of the strips in the trigger chambers.
79  */
80 struct AliHLTMUONTriggerRecoLookupTable
81 {
82         // [regional header index][local board ID][chamber][cathode - X/Y][bit set in bit pattern]
83         AliHLTMUONTriggerRecoLutRow fRow[8][16][4][2][16];
84 };
85
86 } // extern "C"
87
88
89 /**
90  * The sign/charge of a particle.
91  */
92 enum AliHLTMUONParticleSign
93 {
94         kSignMinus   = -1,
95         kSignUnknown = 0,
96         kSignPlus    = 1
97 };
98
99 /**
100  * The chamber names of the dimuon spectrometer.
101  */
102 enum AliHLTMUONChamberName
103 {
104         kUnknownChamber = -1,
105         kChamber1 = 0,
106         kChamber2 = 1,
107         kChamber3 = 2,
108         kChamber4 = 3,
109         kChamber5 = 4,
110         kChamber6 = 5,
111         kChamber7 = 6,
112         kChamber8 = 7,
113         kChamber9 = 8,
114         kChamber10 = 9,
115         kChamber11 = 10,
116         kChamber12 = 11,
117         kChamber13 = 12,
118         kChamber14 = 13
119 };
120
121 /**
122  * The internal data block type codes.
123  */
124 enum AliHLTMUONDataBlockType
125 {
126         kUnknownDataBlock = 0,
127         kTriggerRecordsDataBlock = 1000,
128         kTrigRecsDebugDataBlock = 1001,
129         kTriggerChannelsDataBlock = 1002,
130         kRecHitsDataBlock = 2000,
131         kClustersDataBlock = 2001,
132         kChannelsDataBlock = 2002,
133         kMansoTracksDataBlock = 3000,
134         kMansoCandidatesDataBlock = 3001,
135         kSinglesDecisionDataBlock = 4000,
136         kPairsDecisionDataBlock = 4001
137 };
138
139
140 /**
141  * Stream operator to be able to print AliHLTMUONParticleSign with human
142  * readable names to some stream object like cout (standard output).
143  */
144 inline std::ostream& operator << (std::ostream& stream, AliHLTMUONParticleSign sign)
145 {
146         switch (sign)
147         {
148         case kSignMinus:   stream << "kSignMinus";   break;
149         case kSignUnknown: stream << "kSignUnknown"; break;
150         case kSignPlus:    stream << "kSignPlus";    break;
151         default:           stream << "INVALID";
152         }
153         return stream;
154 }
155
156 /**
157  * Stream operator to be able to print AliHLTMUONChamberName with human
158  * readable names to some stream object like cout (standard output).
159  */
160 inline std::ostream& operator << (std::ostream& stream, AliHLTMUONChamberName chamber)
161 {
162         switch (chamber)
163         {
164         case kUnknownChamber:  stream << "kUnknownChamber";  break;
165         case kChamber1:        stream << "kChamber1";        break;
166         case kChamber2:        stream << "kChamber2";        break;
167         case kChamber3:        stream << "kChamber3";        break;
168         case kChamber4:        stream << "kChamber4";        break;
169         case kChamber5:        stream << "kChamber5";        break;
170         case kChamber6:        stream << "kChamber6";        break;
171         case kChamber7:        stream << "kChamber7";        break;
172         case kChamber8:        stream << "kChamber8";        break;
173         case kChamber9:        stream << "kChamber9";        break;
174         case kChamber10:       stream << "kChamber10";       break;
175         case kChamber11:       stream << "kChamber11";       break;
176         case kChamber12:       stream << "kChamber12";       break;
177         case kChamber13:       stream << "kChamber13";       break;
178         case kChamber14:       stream << "kChamber14";       break;
179         default:               stream << "INVALID";
180         }
181         return stream;
182 }
183
184 /**
185  * Stream operator to be able to print AliHLTMUONDataBlockType with human
186  * readable names to some stream object like cout (standard output).
187  */
188 inline std::ostream& operator << (std::ostream& stream, AliHLTMUONDataBlockType type)
189 {
190         switch (type)
191         {
192         case kUnknownDataBlock:         stream << "kUnknownDataBlock";         break;
193         case kTriggerRecordsDataBlock:  stream << "kTriggerRecordsDataBlock";  break;
194         case kTrigRecsDebugDataBlock:   stream << "kTrigRecsDebugDataBlock";   break;
195         case kTriggerChannelsDataBlock: stream << "kTriggerChannelsDataBlock"; break;
196         case kRecHitsDataBlock:         stream << "kRecHitsDataBlock";         break;
197         case kClustersDataBlock:        stream << "kClustersDataBlock";        break;
198         case kChannelsDataBlock:        stream << "kChannelsDataBlock";        break;
199         case kMansoTracksDataBlock:     stream << "kMansoTracksDataBlock";     break;
200         case kMansoCandidatesDataBlock: stream << "kMansoCandidatesDataBlock"; break;
201         case kSinglesDecisionDataBlock: stream << "kSinglesDecisionDataBlock"; break;
202         case kPairsDecisionDataBlock:   stream << "kPairsDecisionDataBlock";   break;
203         default:                        stream << "INVALID";
204         }
205         return stream;
206 }
207
208 /**
209  * Stream operator for usage with std::ostream classes which prints the common
210  * data block header in the following format:
211  *  {fType = xx, fRecordWidth = yy, fNrecords = zz}
212  */
213 inline std::ostream& operator << (
214                 std::ostream& stream, const AliHLTMUONDataBlockHeader& header
215         )
216 {
217         stream  << "{fType = " << AliHLTMUONDataBlockType(header.fType)
218                 << ", fRecordWidth = " << header.fRecordWidth
219                 << ", fNrecords = " << header.fNrecords << "}";
220         return stream;
221 }
222
223
224 inline bool operator == (
225                 const AliHLTMUONDataBlockHeader& a, const AliHLTMUONDataBlockHeader& b
226         )
227 {
228         return a.fType == b.fType and a.fRecordWidth == b.fRecordWidth
229                 and a.fNrecords == b.fNrecords;
230 }
231
232 inline bool operator != (
233                 const AliHLTMUONDataBlockHeader& a, const AliHLTMUONDataBlockHeader& b
234         )
235 {
236         return not operator == (a, b);
237 }
238
239 #endif // ALIHLTMUONDATATYPES_H