]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/MUON/AliHLTMUONDataTypes.h
ALIROOT-5433 Transition to CDHv3 in HLT
[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   18 May 2007
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         AliHLTFloat32_t fPadSizeXY; // padsize in Y for bending plane and X for nonbending
60         AliHLTInt32_t fPlane;  // The plane and PCB zone ID numbers.
61         AliHLTFloat32_t fPed, fSigma, fA0, fA1; // Calibration values
62         AliHLTInt32_t fThres, fSat; //Calibration values
63 };
64
65 /**
66  * The field structure of a single row of the AliHLTMUONTriggerReconstructor component's
67  * lookup table.
68  */
69 struct AliHLTMUONTriggerRecoLutRow
70 {
71         AliHLTUInt32_t fIdFlags;  /// The chamber and detector element identifier packed in AliHLTMUONRecHitStruct::fFlags format.
72         AliHLTFloat32_t fX;  // Global X coordinate of channel.
73         AliHLTFloat32_t fY;  // Global Y coordinate of channel.
74         AliHLTFloat32_t fZ;  // Global Z coordinate of channel.
75 };
76
77 /**
78  * The lookup table structure for the AliHLTMUONTriggerReconstructor component.
79  * The LUT is used for translating from channel addresses to geometrical positions
80  * and other relevant information of the strips in the trigger chambers.
81  */
82 struct AliHLTMUONTriggerRecoLookupTable
83 {
84         // The dimentions of the LUT are as follows:
85         // [trigger crate ID][local board ID][chamber][cathode - X/Y][bit set in bit pattern]
86         // - The trigger crate ID comes form the regional headers in the DDL payload.
87         // - Local board ID numbers come from the local trigger structures in the
88         //   DDL payload.
89         // - The chamber is for chambers 11 to 14 coded as [0..3], 0 for chamber 11,
90         //   1 for chamber 12 etc.
91         // - The cathode 0 is for the X trigger strips (bending plane) and 1 is
92         //   for the Y strips (non-bending plane).
93         // - The "bit set in pattern" indicates the bit number that was set in
94         //   the strip patterns found in the local structures of the DDL payload.
95         AliHLTMUONTriggerRecoLutRow fRow[16][16][4][2][16];
96 };
97
98 } // extern "C"
99
100
101 /**
102  * The sign/charge of a particle.
103  */
104 enum AliHLTMUONParticleSign
105 {
106         kSignMinus   = -1,
107         kSignUnknown = 0,
108         kSignPlus    = 1
109 };
110
111 /**
112  * The chamber names of the dimuon spectrometer.
113  */
114 enum AliHLTMUONChamberName
115 {
116         kUnknownChamber = -1,
117         kChamber1 = 0,
118         kChamber2 = 1,
119         kChamber3 = 2,
120         kChamber4 = 3,
121         kChamber5 = 4,
122         kChamber6 = 5,
123         kChamber7 = 6,
124         kChamber8 = 7,
125         kChamber9 = 8,
126         kChamber10 = 9,
127         kChamber11 = 10,
128         kChamber12 = 11,
129         kChamber13 = 12,
130         kChamber14 = 13
131 };
132
133 /**
134  * The internal data block type codes.
135  */
136 enum AliHLTMUONDataBlockType
137 {
138         kUnknownDataBlock = 0,
139         kTriggerRecordsDataBlock = 1000,
140         kTrigRecsDebugDataBlock = 1001,
141         kRecHitsDataBlock = 2000,
142         kClustersDataBlock = 2001,
143         kChannelsDataBlock = 2002,
144         kMansoTracksDataBlock = 3000,
145         kMansoCandidatesDataBlock = 3001,
146         kTracksDataBlock = 3100,
147         kSinglesDecisionDataBlock = 4000,
148         kPairsDecisionDataBlock = 4001
149 };
150
151
152 /**
153  * Stream operator to be able to print AliHLTMUONParticleSign with human
154  * readable names to some stream object like cout (standard output).
155  */
156 inline std::ostream& operator << (std::ostream& stream, AliHLTMUONParticleSign sign)
157 {
158         switch (sign)
159         {
160         case kSignMinus:   stream << "kSignMinus";   break;
161         case kSignUnknown: stream << "kSignUnknown"; break;
162         case kSignPlus:    stream << "kSignPlus";    break;
163         default:           stream << "INVALID";
164         }
165         return stream;
166 }
167
168 /**
169  * Stream operator to be able to print AliHLTMUONChamberName with human
170  * readable names to some stream object like cout (standard output).
171  */
172 inline std::ostream& operator << (std::ostream& stream, AliHLTMUONChamberName chamber)
173 {
174         switch (chamber)
175         {
176         case kUnknownChamber:  stream << "kUnknownChamber";  break;
177         case kChamber1:        stream << "kChamber1";        break;
178         case kChamber2:        stream << "kChamber2";        break;
179         case kChamber3:        stream << "kChamber3";        break;
180         case kChamber4:        stream << "kChamber4";        break;
181         case kChamber5:        stream << "kChamber5";        break;
182         case kChamber6:        stream << "kChamber6";        break;
183         case kChamber7:        stream << "kChamber7";        break;
184         case kChamber8:        stream << "kChamber8";        break;
185         case kChamber9:        stream << "kChamber9";        break;
186         case kChamber10:       stream << "kChamber10";       break;
187         case kChamber11:       stream << "kChamber11";       break;
188         case kChamber12:       stream << "kChamber12";       break;
189         case kChamber13:       stream << "kChamber13";       break;
190         case kChamber14:       stream << "kChamber14";       break;
191         default:               stream << "INVALID";
192         }
193         return stream;
194 }
195
196 /**
197  * Stream operator to be able to print AliHLTMUONDataBlockType with human
198  * readable names to some stream object like cout (standard output).
199  */
200 inline std::ostream& operator << (std::ostream& stream, AliHLTMUONDataBlockType type)
201 {
202         switch (type)
203         {
204         case kUnknownDataBlock:         stream << "kUnknownDataBlock";         break;
205         case kTriggerRecordsDataBlock:  stream << "kTriggerRecordsDataBlock";  break;
206         case kTrigRecsDebugDataBlock:   stream << "kTrigRecsDebugDataBlock";   break;
207         case kRecHitsDataBlock:         stream << "kRecHitsDataBlock";         break;
208         case kClustersDataBlock:        stream << "kClustersDataBlock";        break;
209         case kChannelsDataBlock:        stream << "kChannelsDataBlock";        break;
210         case kMansoTracksDataBlock:     stream << "kMansoTracksDataBlock";     break;
211         case kMansoCandidatesDataBlock: stream << "kMansoCandidatesDataBlock"; break;
212         case kTracksDataBlock:          stream << "kTracksDataBlock";          break;
213         case kSinglesDecisionDataBlock: stream << "kSinglesDecisionDataBlock"; break;
214         case kPairsDecisionDataBlock:   stream << "kPairsDecisionDataBlock";   break;
215         default:                        stream << "INVALID";
216         }
217         return stream;
218 }
219
220 /**
221  * Stream operator for usage with std::ostream classes which prints the common
222  * data block header in the following format:
223  *  {fType = xx, fRecordWidth = yy, fNrecords = zz}
224  */
225 inline std::ostream& operator << (
226                 std::ostream& stream, const AliHLTMUONDataBlockHeader& header
227         )
228 {
229         stream  << "{fType = " << AliHLTMUONDataBlockType(header.fType)
230                 << ", fRecordWidth = " << header.fRecordWidth
231                 << ", fNrecords = " << header.fNrecords << "}";
232         return stream;
233 }
234
235
236 inline bool operator == (
237                 const AliHLTMUONDataBlockHeader& a, const AliHLTMUONDataBlockHeader& b
238         )
239 {
240         return a.fType == b.fType and a.fRecordWidth == b.fRecordWidth
241                 and a.fNrecords == b.fNrecords;
242 }
243
244 inline bool operator != (
245                 const AliHLTMUONDataBlockHeader& a, const AliHLTMUONDataBlockHeader& b
246         )
247 {
248         return not operator == (a, b);
249 }
250
251 #endif // ALIHLTMUONDATATYPES_H