]>
Commit | Line | Data |
---|---|---|
b12fe461 | 1 | #ifndef ALIHLTMUONHITRECONSTRUCTOR_H |
2 | #define ALIHLTMUONHITRECONSTRUCTOR_H | |
ee3678d3 | 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 */ | |
b12fe461 | 6 | |
7 | /* $Id$ */ | |
8 | ||
9 | /////////////////////////////////////////////// | |
10 | //Author : Indranil Das, SINP, INDIA | |
11 | // Sukalyan Chattopadhyay, SINP, INDIA | |
12 | // | |
b12fe461 | 13 | //Email : indra.das@saha.ac.in |
14 | // sukalyan.chattopadhyay@saha.ac.in | |
15 | /////////////////////////////////////////////// | |
16 | ||
b12fe461 | 17 | #include <iostream> |
18 | #include <cstdio> | |
19 | #include <fstream> | |
20 | #include <cstring> | |
21 | #include <cmath> | |
22 | #include <map> | |
ee3678d3 | 23 | #include <cassert> |
b12fe461 | 24 | |
ee3678d3 | 25 | #include "TString.h" |
26 | #include "AliHLTLogging.h" | |
27 | #include "AliMUONTrackerDDLDecoder.h" | |
28 | #include "AliMUONTrackerDDLDecoderEventHandler.h" | |
29 | #include "AliHLTMUONDataTypes.h" | |
960d54ad | 30 | |
ee3678d3 | 31 | #include "AliRawDataHeader.h" |
b12fe461 | 32 | |
e29a165d | 33 | #if __GNUC__ && __GNUC__ < 3 |
960d54ad | 34 | #define std |
35 | #endif | |
b12fe461 | 36 | |
960d54ad | 37 | |
960d54ad | 38 | extern "C" struct AliHLTMUONRecHitStruct; |
b12fe461 | 39 | |
a6b16447 | 40 | //TODO: Change code to not use std::map to avoid too many AliRoot coding rule violations. |
ee3678d3 | 41 | typedef std::map<AliHLTInt32_t, AliHLTInt32_t> IdManuChannelToEntry; |
42 | ||
b12fe461 | 43 | |
44 | class AliHLTMUONHitReconstructor : public AliHLTLogging | |
45 | { | |
46 | public: | |
ee3678d3 | 47 | |
48 | AliHLTMUONHitReconstructor(); | |
49 | virtual ~AliHLTMUONHitReconstructor(void); | |
ee3678d3 | 50 | |
93a75941 | 51 | void SetLookUpTable( |
52 | const AliHLTMUONHitRecoLutRow* lookupTable, | |
53 | const IdManuChannelToEntry* idToEntry | |
54 | ); | |
55 | ||
56 | void SetDCCut(AliHLTInt32_t dcCut) { fDCCut = dcCut; } | |
ffc1a6f6 | 57 | AliHLTInt32_t GetDCCut() const { return fDCCut; } |
ee3678d3 | 58 | |
59 | bool Run( | |
60 | const AliHLTUInt32_t* rawData, | |
61 | AliHLTUInt32_t rawDataSize, | |
62 | AliHLTMUONRecHitStruct* recHit, | |
63 | AliHLTUInt32_t& nofHit | |
64 | ); | |
ee3678d3 | 65 | |
66 | static AliHLTInt32_t GetkDetectorId() { return fgkDetectorId; } | |
67 | static AliHLTInt32_t GetkDDLOffSet() { return fgkDDLOffSet; } | |
68 | static AliHLTInt32_t GetkNofDDL() { return fgkNofDDL; } | |
69 | static AliHLTInt32_t GetkDDLHeaderSize() { return fgkDDLHeaderSize; } | |
a5d4696f | 70 | |
71 | /// Returns true if the decoder is set to enable recovery logic if | |
72 | /// raw data errors are found. | |
73 | bool TryRecover() const { return fHLTMUONDecoder.TryRecover(); }; | |
74 | ||
75 | /// Sets if the decoder should enable the error recovery logic. | |
76 | void TryRecover(bool value); | |
ee3678d3 | 77 | |
78 | private: | |
79 | ||
80 | static const AliHLTInt32_t fgkDetectorId; // DDL Offset | |
81 | static const AliHLTInt32_t fgkDDLOffSet; // DDL Offset | |
82 | static const AliHLTInt32_t fgkNofDDL; // Number of DDL | |
83 | static const AliHLTInt32_t fgkDDLHeaderSize; // DDL header size | |
84 | static const AliHLTInt32_t fgkLutLine; // nof Line in LookupTable | |
b12fe461 | 85 | |
b12fe461 | 86 | protected: |
ee3678d3 | 87 | |
88 | AliHLTMUONHitReconstructor(const AliHLTMUONHitReconstructor& rhs); // copy constructor | |
89 | AliHLTMUONHitReconstructor& operator=(const AliHLTMUONHitReconstructor& rhs); // assignment operator | |
90 | ||
960d54ad | 91 | private: |
b12fe461 | 92 | |
ee3678d3 | 93 | struct AliHLTMUONPad |
94 | { | |
95 | AliHLTInt32_t fDetElemId; // The detector element ID of the pad. | |
96 | AliHLTInt32_t fIX, fIY; // The X,Y number of the pad. | |
97 | AliHLTFloat32_t fRealX, fRealY, fRealZ; // The real coordinate of the pad. | |
98 | AliHLTFloat32_t fHalfPadSize; // half padsize in X and Y | |
99 | AliHLTInt32_t fPlane; // The plane and PCB zone ID numbers. | |
100 | AliHLTFloat32_t fCharge; // The charge measured on the pad. | |
101 | }; | |
102 | ||
103 | ||
104 | class AliHLTMUONRawDecoder : public AliMUONTrackerDDLDecoderEventHandler, public AliHLTLogging | |
105 | { | |
106 | public: | |
107 | ||
108 | AliHLTMUONRawDecoder(); | |
109 | virtual ~AliHLTMUONRawDecoder(); | |
110 | ||
111 | void OnData(UInt_t dataWord, bool /*parityError*/); | |
112 | void OnNewBusPatch(const AliMUONBusPatchHeaderStruct* header, const void* /*data*/) | |
113 | { | |
114 | fBusPatchId = int(header->fBusPatchId); | |
115 | }; | |
116 | ||
878cb83d | 117 | void OnNewBuffer(const void* buffer, UInt_t bufferSize); |
118 | void OnError(ErrorCode code, const void* location); | |
ee3678d3 | 119 | |
120 | void SetDCCut(AliHLTInt32_t dcCut) {fDCCut = dcCut;} | |
121 | void SetPadData(AliHLTMUONPad* padData) {fPadData = padData;} | |
93a75941 | 122 | void SetLookUpTable(const AliHLTMUONHitRecoLutRow* lookUpTableData) {fLookUpTableData = lookUpTableData;} |
ee3678d3 | 123 | void SetNofFiredDetElemId(AliHLTInt32_t& nofFiredDetElem) {fNofFiredDetElem = &nofFiredDetElem;} |
93a75941 | 124 | void SetIdManuChannelToEntry(const IdManuChannelToEntry* idToEntry) {fIdToEntry = idToEntry;} |
ee3678d3 | 125 | void SetMaxFiredPerDetElem(AliHLTInt32_t* maxFiredPerDetElem) {fMaxFiredPerDetElem = maxFiredPerDetElem;} |
126 | ||
127 | AliHLTInt32_t GetDataCount() {return fDataCount;} | |
a5d4696f | 128 | |
129 | /** | |
130 | * Returns true if the OnError handler method will only generate warning | |
131 | * messages and rather than error messages. | |
132 | */ | |
133 | bool WarnOnly() const { return fWarnOnly; } | |
134 | ||
135 | /** | |
136 | * Sets the flag indicating if the OnError method should only generate | |
137 | * warnings rather than error messages. | |
138 | */ | |
139 | void WarnOnly(bool value) { fWarnOnly = value; } | |
ee3678d3 | 140 | |
141 | private: | |
142 | // Do not allow copying of this class. | |
143 | /// Not implemented | |
144 | AliHLTMUONRawDecoder(const AliHLTMUONRawDecoder& rhs); // copy constructor | |
145 | /// Not implemented | |
146 | AliHLTMUONRawDecoder& operator=(const AliHLTMUONRawDecoder& rhs); // assignment operator | |
147 | ||
148 | const void* fBufferStart; // Pointer to the start of the current DDL payload buffer. | |
93a75941 | 149 | AliHLTInt32_t fBusPatchId; // buspatchId |
150 | AliHLTInt32_t fDCCut; // DC Cut value | |
151 | AliHLTMUONPad* fPadData; // pointer to the array containing the information of each padhits | |
152 | const AliHLTMUONHitRecoLutRow* fLookUpTableData; // pointer to the array of Lookuptable data | |
153 | AliHLTInt32_t* fNofFiredDetElem; // counter for detector elements that are fired | |
154 | AliHLTInt32_t* fMaxFiredPerDetElem; // array for detector elements that are fired | |
155 | const IdManuChannelToEntry* fIdToEntry; // Mapping between Linenumber to IdManuChannel; | |
ee3678d3 | 156 | |
93a75941 | 157 | AliHLTInt32_t fDataCount; // Data Counter |
158 | AliHLTInt32_t fPrevDetElemId; // previous detection elementId | |
159 | AliHLTInt32_t fPadCharge; // pedestal subtracted pad charge | |
160 | AliHLTFloat32_t fCharge; //calibrated pad charge | |
161 | AliHLTInt32_t fIdManuChannel; // id manu channel | |
162 | AliHLTInt32_t fLutEntry; // i-th entry in lookuptable | |
a5d4696f | 163 | |
164 | bool fWarnOnly; ///< Flag indicating if the OnError method should generate warnings rather than error messages. | |
ee3678d3 | 165 | }; |
166 | ||
167 | AliMUONTrackerDDLDecoder<AliHLTMUONRawDecoder> fHLTMUONDecoder; // robust HLTMUON Decoder | |
168 | ||
93a75941 | 169 | AliHLTInt32_t fkBlockHeaderSize; // Block header size |
170 | AliHLTInt32_t fkDspHeaderSize; // DSP header size | |
171 | AliHLTInt32_t fkBuspatchHeaderSize; // buspatch header size | |
ee3678d3 | 172 | |
93a75941 | 173 | AliHLTInt32_t fDCCut; // DC Cut value |
ee3678d3 | 174 | |
93a75941 | 175 | AliHLTMUONPad* fPadData; // pointer to the array containing the information of each padhits |
176 | const AliHLTMUONHitRecoLutRow* fLookUpTableData; // pointer to the array of Lookuptable data (The memory is not owned by this component). | |
ee3678d3 | 177 | |
93a75941 | 178 | AliHLTMUONRecHitStruct* fRecPoints; // Reconstructed hits |
179 | AliHLTUInt32_t *fRecPointsCount; // nof reconstructed hit. | |
180 | AliHLTUInt32_t fMaxRecPointsCount; // max nof reconstructed hit. | |
ee3678d3 | 181 | |
93a75941 | 182 | AliHLTInt32_t fCentralCountB, fCentralCountNB; // centeral hits. |
183 | AliHLTInt32_t fDigitPerDDL; // Total nof Digits perDDL. | |
ee3678d3 | 184 | |
93a75941 | 185 | AliHLTInt32_t *fCentralChargeB, *fCentralChargeNB; // pointer to an array of central hit |
186 | AliHLTFloat32_t *fRecX, *fRecY; // pointer to an array of reconstructed hit | |
187 | AliHLTFloat32_t *fAvgChargeX, *fAvgChargeY; // average charge on central pad found using CG method | |
188 | AliHLTInt32_t *fNofBChannel, *fNofNBChannel; // number of channels bending and non-bending. | |
189 | AliHLTInt32_t fGetIdTotalData[336][237][2]; // an array of idManuChannel with argument of centralX, centralY and planeType. | |
190 | AliHLTInt32_t fNofFiredDetElem,fMaxFiredPerDetElem[13]; // counter for detector elements that are fired | |
191 | const IdManuChannelToEntry* fIdToEntry; // Mapping between Linenumber to IdManuChannel (The object is not owned by this component). | |
ee3678d3 | 192 | |
ee3678d3 | 193 | bool DecodeDDL(const AliHLTUInt32_t* rawData, AliHLTUInt32_t rawDataSize); |
194 | void FindCentralHits(AliHLTInt32_t minPadId, AliHLTInt32_t maxPadId); | |
195 | bool FindRecHits(); | |
878cb83d | 196 | void RecXRecY(); |
ee3678d3 | 197 | bool MergeRecHits(); |
198 | void Clear(); | |
199 | ||
b12fe461 | 200 | }; |
201 | ||
b12fe461 | 202 | #endif // ALIHLTMUONHITRECONSTRUCTOR_H |