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);
52 const AliHLTMUONHitRecoLutRow* lookupTable,
53 const IdManuChannelToEntry* idToEntry
56 void SetDCCut(AliHLTInt32_t dcCut) { fDCCut = dcCut; }
59 const AliHLTUInt32_t* rawData,
60 AliHLTUInt32_t rawDataSize,
61 AliHLTMUONRecHitStruct* recHit,
62 AliHLTUInt32_t& nofHit
65 static AliHLTInt32_t GetkDetectorId() { return fgkDetectorId; }
66 static AliHLTInt32_t GetkDDLOffSet() { return fgkDDLOffSet; }
67 static AliHLTInt32_t GetkNofDDL() { return fgkNofDDL; }
68 static AliHLTInt32_t GetkDDLHeaderSize() { return fgkDDLHeaderSize; }
72 static const AliHLTInt32_t fgkDetectorId; // DDL Offset
73 static const AliHLTInt32_t fgkDDLOffSet; // DDL Offset
74 static const AliHLTInt32_t fgkNofDDL; // Number of DDL
75 static const AliHLTInt32_t fgkDDLHeaderSize; // DDL header size
76 static const AliHLTInt32_t fgkLutLine; // nof Line in LookupTable
80 AliHLTMUONHitReconstructor(const AliHLTMUONHitReconstructor& rhs); // copy constructor
81 AliHLTMUONHitReconstructor& operator=(const AliHLTMUONHitReconstructor& rhs); // assignment operator
87 AliHLTInt32_t fDetElemId; // The detector element ID of the pad.
88 AliHLTInt32_t fIX, fIY; // The X,Y number of the pad.
89 AliHLTFloat32_t fRealX, fRealY, fRealZ; // The real coordinate of the pad.
90 AliHLTFloat32_t fHalfPadSize; // half padsize in X and Y
91 AliHLTInt32_t fPlane; // The plane and PCB zone ID numbers.
92 AliHLTFloat32_t fCharge; // The charge measured on the pad.
96 class AliHLTMUONRawDecoder : public AliMUONTrackerDDLDecoderEventHandler, public AliHLTLogging
100 AliHLTMUONRawDecoder();
101 virtual ~AliHLTMUONRawDecoder();
103 void OnData(UInt_t dataWord, bool /*parityError*/);
104 void OnNewBusPatch(const AliMUONBusPatchHeaderStruct* header, const void* /*data*/)
106 fBusPatchId = int(header->fBusPatchId);
109 void OnNewBuffer(const void* buffer, UInt_t /*bufferSize*/)
111 assert( buffer != NULL );
112 fBufferStart = buffer;
113 fDataCount = 1; // dataCount starts from 1 because the 0-th element of fPadData is used as null value.
114 *fNofFiredDetElem = 0;
118 void OnError(ErrorCode code, const void* location)
120 long bytepos = long(location) - long(fBufferStart) + sizeof(AliRawDataHeader);
121 HLTError("There is a problem with decoding the raw data. %s (Error code: %d, at byte %d)",
122 ErrorCodeToMessage(code), code, bytepos
126 void SetDCCut(AliHLTInt32_t dcCut) {fDCCut = dcCut;}
127 void SetPadData(AliHLTMUONPad* padData) {fPadData = padData;}
128 void SetLookUpTable(const AliHLTMUONHitRecoLutRow* lookUpTableData) {fLookUpTableData = lookUpTableData;}
129 void SetNofFiredDetElemId(AliHLTInt32_t& nofFiredDetElem) {fNofFiredDetElem = &nofFiredDetElem;}
130 void SetIdManuChannelToEntry(const IdManuChannelToEntry* idToEntry) {fIdToEntry = idToEntry;}
131 void SetMaxFiredPerDetElem(AliHLTInt32_t* maxFiredPerDetElem) {fMaxFiredPerDetElem = maxFiredPerDetElem;}
133 AliHLTInt32_t GetDataCount() {return fDataCount;}
136 // Do not allow copying of this class.
138 AliHLTMUONRawDecoder(const AliHLTMUONRawDecoder& rhs); // copy constructor
140 AliHLTMUONRawDecoder& operator=(const AliHLTMUONRawDecoder& rhs); // assignment operator
142 const void* fBufferStart; // Pointer to the start of the current DDL payload buffer.
143 AliHLTInt32_t fBusPatchId; // buspatchId
144 AliHLTInt32_t fDCCut; // DC Cut value
145 AliHLTMUONPad* fPadData; // pointer to the array containing the information of each padhits
146 const AliHLTMUONHitRecoLutRow* fLookUpTableData; // pointer to the array of Lookuptable data
147 AliHLTInt32_t* fNofFiredDetElem; // counter for detector elements that are fired
148 AliHLTInt32_t* fMaxFiredPerDetElem; // array for detector elements that are fired
149 const IdManuChannelToEntry* fIdToEntry; // Mapping between Linenumber to IdManuChannel;
151 AliHLTInt32_t fDataCount; // Data Counter
152 AliHLTInt32_t fPrevDetElemId; // previous detection elementId
153 AliHLTInt32_t fPadCharge; // pedestal subtracted pad charge
154 AliHLTFloat32_t fCharge; //calibrated pad charge
155 AliHLTInt32_t fIdManuChannel; // id manu channel
156 AliHLTInt32_t fLutEntry; // i-th entry in lookuptable
159 AliMUONTrackerDDLDecoder<AliHLTMUONRawDecoder> fHLTMUONDecoder; // robust HLTMUON Decoder
161 AliHLTInt32_t fkBlockHeaderSize; // Block header size
162 AliHLTInt32_t fkDspHeaderSize; // DSP header size
163 AliHLTInt32_t fkBuspatchHeaderSize; // buspatch header size
165 AliHLTInt32_t fDCCut; // DC Cut value
167 AliHLTMUONPad* fPadData; // pointer to the array containing the information of each padhits
168 const AliHLTMUONHitRecoLutRow* fLookUpTableData; // pointer to the array of Lookuptable data (The memory is not owned by this component).
170 AliHLTMUONRecHitStruct* fRecPoints; // Reconstructed hits
171 AliHLTUInt32_t *fRecPointsCount; // nof reconstructed hit.
172 AliHLTUInt32_t fMaxRecPointsCount; // max nof reconstructed hit.
174 AliHLTInt32_t fCentralCountB, fCentralCountNB; // centeral hits.
175 AliHLTInt32_t fDigitPerDDL; // Total nof Digits perDDL.
177 AliHLTInt32_t *fCentralChargeB, *fCentralChargeNB; // pointer to an array of central hit
178 AliHLTFloat32_t *fRecX, *fRecY; // pointer to an array of reconstructed hit
179 AliHLTFloat32_t *fAvgChargeX, *fAvgChargeY; // average charge on central pad found using CG method
180 AliHLTInt32_t *fNofBChannel, *fNofNBChannel; // number of channels bending and non-bending.
181 AliHLTInt32_t fGetIdTotalData[336][237][2]; // an array of idManuChannel with argument of centralX, centralY and planeType.
182 AliHLTInt32_t fNofFiredDetElem,fMaxFiredPerDetElem[13]; // counter for detector elements that are fired
183 const IdManuChannelToEntry* fIdToEntry; // Mapping between Linenumber to IdManuChannel (The object is not owned by this component).
185 //bool ReadDDL(const AliHLTUInt32_t* rawData, AliHLTUInt32_t rawDataSize);
186 bool DecodeDDL(const AliHLTUInt32_t* rawData, AliHLTUInt32_t rawDataSize);
187 void FindCentralHits(AliHLTInt32_t minPadId, AliHLTInt32_t maxPadId);
195 #endif // ALIHLTMUONHITRECONSTRUCTOR_H