1 #ifndef ALIHLTMUONHITRECONSTRUCTOR_H
2 #define ALIHLTMUONHITRECONSTRUCTOR_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 */
9 ///////////////////////////////////////////////
10 //Author : Indranil Das, SINP, INDIA
11 // Sukalyan Chattopadhyay, SINP, INDIA
13 //Email : indra.das@saha.ac.in
14 // sukalyan.chattopadhyay@saha.ac.in
15 ///////////////////////////////////////////////
26 #include "AliHLTLogging.h"
27 #include "AliMUONTrackerDDLDecoder.h"
28 #include "AliMUONTrackerDDLDecoderEventHandler.h"
29 #include "AliHLTMUONDataTypes.h"
31 #include "AliRawDataHeader.h"
33 #if __GNUC__ && __GNUC__ < 3
38 extern "C" struct AliHLTMUONRecHitStruct;
40 //TODO: Change code to not use std::map to avoid too many AliRoot coding rule violations.
41 typedef std::map<AliHLTInt32_t, AliHLTInt32_t> IdManuChannelToEntry;
44 class AliHLTMUONHitReconstructor : public AliHLTLogging
48 AliHLTMUONHitReconstructor();
49 virtual ~AliHLTMUONHitReconstructor(void);
51 bool LoadLookUpTable(AliHLTMUONHitRecoLutRow* lookUpTableData, AliHLTInt32_t lookUpTableId);
52 bool SetIdManuChannelToEntry(IdManuChannelToEntry lineToId);
56 const AliHLTUInt32_t* rawData,
57 AliHLTUInt32_t rawDataSize,
58 AliHLTMUONRecHitStruct* recHit,
59 AliHLTUInt32_t& nofHit
61 void SetDCCut(AliHLTInt32_t dcCut) {fDCCut = dcCut;}
63 static AliHLTInt32_t GetkDetectorId() { return fgkDetectorId; }
64 static AliHLTInt32_t GetkDDLOffSet() { return fgkDDLOffSet; }
65 static AliHLTInt32_t GetkNofDDL() { return fgkNofDDL; }
66 static AliHLTInt32_t GetkDDLHeaderSize() { return fgkDDLHeaderSize; }
70 static const AliHLTInt32_t fgkDetectorId; // DDL Offset
71 static const AliHLTInt32_t fgkDDLOffSet; // DDL Offset
72 static const AliHLTInt32_t fgkNofDDL; // Number of DDL
73 static const AliHLTInt32_t fgkDDLHeaderSize; // DDL header size
74 static const AliHLTInt32_t fgkLutLine; // nof Line in LookupTable
78 AliHLTMUONHitReconstructor(const AliHLTMUONHitReconstructor& rhs); // copy constructor
79 AliHLTMUONHitReconstructor& operator=(const AliHLTMUONHitReconstructor& rhs); // assignment operator
85 AliHLTInt32_t fDetElemId; // The detector element ID of the pad.
86 AliHLTInt32_t fIX, fIY; // The X,Y number of the pad.
87 AliHLTFloat32_t fRealX, fRealY, fRealZ; // The real coordinate of the pad.
88 AliHLTFloat32_t fHalfPadSize; // half padsize in X and Y
89 AliHLTInt32_t fPlane; // The plane and PCB zone ID numbers.
90 AliHLTFloat32_t fCharge; // The charge measured on the pad.
94 class AliHLTMUONRawDecoder : public AliMUONTrackerDDLDecoderEventHandler, public AliHLTLogging
98 AliHLTMUONRawDecoder();
99 virtual ~AliHLTMUONRawDecoder();
101 void OnData(UInt_t dataWord, bool /*parityError*/);
102 void OnNewBusPatch(const AliMUONBusPatchHeaderStruct* header, const void* /*data*/)
104 fBusPatchId = int(header->fBusPatchId);
107 void OnNewBuffer(const void* buffer, UInt_t /*bufferSize*/)
109 assert( buffer != NULL );
110 fBufferStart = buffer;
111 fDataCount = 1; // dataCount starts from 1 because the 0-th element of fPadData is used as null value.
112 *fNofFiredDetElem = 0;
116 void OnError(ErrorCode code, const void* location)
118 long bytepos = long(location) - long(fBufferStart) + sizeof(AliRawDataHeader);
119 HLTError("There is a problem with decoding the raw data. %s (Error code: %d, at byte %d)",
120 ErrorCodeToMessage(code), code, bytepos
124 void SetDCCut(AliHLTInt32_t dcCut) {fDCCut = dcCut;}
125 void SetPadData(AliHLTMUONPad* padData) {fPadData = padData;}
126 void SetLookUpTable(AliHLTMUONHitRecoLutRow* lookUpTableData) {fLookUpTableData = lookUpTableData;}
127 void SetNofFiredDetElemId(AliHLTInt32_t& nofFiredDetElem) {fNofFiredDetElem = &nofFiredDetElem;}
128 void SetIdManuChannelToEntry(IdManuChannelToEntry idToEntry) {fIdToEntry = idToEntry;}
129 void SetMaxFiredPerDetElem(AliHLTInt32_t* maxFiredPerDetElem) {fMaxFiredPerDetElem = maxFiredPerDetElem;}
131 AliHLTInt32_t GetDataCount() {return fDataCount;}
134 // Do not allow copying of this class.
136 AliHLTMUONRawDecoder(const AliHLTMUONRawDecoder& rhs); // copy constructor
138 AliHLTMUONRawDecoder& operator=(const AliHLTMUONRawDecoder& rhs); // assignment operator
140 const void* fBufferStart; // Pointer to the start of the current DDL payload buffer.
141 AliHLTInt32_t fBusPatchId; // buspatchId
142 AliHLTInt32_t fDCCut; // DC Cut value
143 AliHLTMUONPad* fPadData; // pointer to the array containing the information of each padhits
144 AliHLTMUONHitRecoLutRow* fLookUpTableData; // pointer to the array of Lookuptable data
145 AliHLTInt32_t* fNofFiredDetElem; // counter for detector elements that are fired
146 AliHLTInt32_t* fMaxFiredPerDetElem; // array for detector elements that are fired
147 IdManuChannelToEntry fIdToEntry; // Mapping between Linenumber to IdManuChannel;
149 AliHLTInt32_t fDataCount; // Data Counter
150 AliHLTInt32_t fPrevDetElemId; // previous detection elementId
151 AliHLTInt32_t fPadCharge; // pedestal subtracted pad charge
152 AliHLTFloat32_t fCharge; //calibrated pad charge
153 AliHLTInt32_t fIdManuChannel; // id manu channel
154 AliHLTInt32_t fLutEntry; // i-th entry in lookuptable
157 AliMUONTrackerDDLDecoder<AliHLTMUONRawDecoder> fHLTMUONDecoder; // robust HLTMUON Decoder
159 AliHLTInt32_t fkBlockHeaderSize; // Block header size
160 AliHLTInt32_t fkDspHeaderSize; // DSP header size
161 AliHLTInt32_t fkBuspatchHeaderSize; // buspatch header size
163 AliHLTInt32_t fDCCut; // DC Cut value
165 AliHLTMUONPad* fPadData; // pointer to the array containing the information of each padhits
166 AliHLTMUONHitRecoLutRow* fLookUpTableData; // pointer to the array of Lookuptable data
168 AliHLTMUONRecHitStruct* fRecPoints; // Reconstructed hits
169 AliHLTUInt32_t *fRecPointsCount; // nof reconstructed hit
170 AliHLTUInt32_t fMaxRecPointsCount; // max nof reconstructed hit
172 AliHLTInt32_t fCentralCountB, fCentralCountNB; // centeral hits
173 AliHLTInt32_t fDDLId; // DDLId
174 AliHLTInt32_t fDigitPerDDL; // Total nof Digits perDDL
176 AliHLTInt32_t *fCentralChargeB, *fCentralChargeNB; // pointer to an array of central hit
177 AliHLTFloat32_t *fRecX, *fRecY; // pointer to an array of reconstructed hit
178 AliHLTFloat32_t *fAvgChargeX, *fAvgChargeY; // average charge on central pad found using CG method
179 AliHLTInt32_t *fNofBChannel, *fNofNBChannel; // number of channels bending and non-bending.
180 AliHLTInt32_t fGetIdTotalData[336][237][2]; // an array of idManuChannel with argument of centralX, centralY and planeType.
181 AliHLTInt32_t fNofFiredDetElem,fMaxFiredPerDetElem[13]; // counter for detector elements that are fired
182 IdManuChannelToEntry fIdToEntry; // Mapping between Linenumber to IdManuChannel;
184 //bool ReadDDL(const AliHLTUInt32_t* rawData, AliHLTUInt32_t rawDataSize);
185 bool DecodeDDL(const AliHLTUInt32_t* rawData, AliHLTUInt32_t rawDataSize);
186 void FindCentralHits(AliHLTInt32_t minPadId, AliHLTInt32_t maxPadId);
194 #endif // ALIHLTMUONHITRECONSTRUCTOR_H