]>
Commit | Line | Data |
---|---|---|
1b41ab20 | 1 | //-*- Mode: C++ -*- |
2 | // $Id$ | |
3 | ||
209a4703 | 4 | |
ab38011b | 5 | /************************************************************************** |
6 | * This file is property of and copyright by the ALICE HLT Project * | |
7 | * All rights reserved. * | |
8 | * * | |
9 | * Primary Authors: Oystein Djuvsland * | |
10 | * * | |
11 | * Permission to use, copy, modify and distribute this software and its * | |
12 | * documentation strictly for non-commercial purposes is hereby granted * | |
13 | * without fee, provided that the above copyright notice appears in all * | |
14 | * copies and that both the copyright notice and this permission notice * | |
15 | * appear in the supporting documentation. The authors make no claims * | |
16 | * about the suitability of this software for any purpose. It is * | |
17 | * provided "as is" without express or implied warranty. * | |
18 | **************************************************************************/ | |
209a4703 | 19 | #ifndef ALIHLTPHOSDIGITMAKER_H |
20 | #define ALIHLTPHOSDIGITMAKER_H | |
21 | ||
2374af72 | 22 | /** |
23 | * Class makes digits from information from raw data | |
24 | * | |
25 | * @file AliHLTPHOSDigitMaker.h | |
26 | * @author Oystein Djuvsland | |
27 | * @date | |
28 | * @brief Digit maker for PHOS HLT | |
29 | */ | |
30 | ||
31 | // see below for class documentation | |
32 | // or | |
33 | // refer to README to build package | |
34 | // or | |
35 | // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt | |
36 | ||
227e2399 | 37 | //#include "AliHLTPHOSBase.h" |
4f4b7ba4 | 38 | #include "AliHLTPHOSConstant.h" |
e304ea31 | 39 | #include "AliHLTPHOSDigitDataStruct.h" |
40 | #include "AliHLTPHOSChannelDataStruct.h" | |
227e2399 | 41 | #include "AliHLTDataTypes.h" |
5c6cac96 | 42 | #include "AliHLTLogging.h" |
209a4703 | 43 | |
2374af72 | 44 | /** |
45 | * @class AliHLTPHOSDigitMaker | |
46 | * Digit maker for PHOS HLT. Takes input from AliHLTPHOSRawAnalyzer, and | |
e304ea31 | 47 | * outputs a block of AliHLTPHOSDigitDataStruct container |
2374af72 | 48 | * @ingroup alihlt_phos |
49 | */ | |
37616445 | 50 | #include <AliHLTCaloConstantsHandler.h> |
209a4703 | 51 | |
7ce40e5c | 52 | class TH2F; |
94594220 | 53 | class AliHLTPHOSSharedMemoryInterfacev2; // added by PTH |
54 | class AliHLTPHOSChannelDataHeaderStruct; | |
e304ea31 | 55 | class AliHLTPHOSMapper; |
209a4703 | 56 | |
57 | using namespace PhosHLTConst; | |
58 | ||
227e2399 | 59 | //class AliHLTPHOSDigitMaker : public AliHLTPHOSBase |
37616445 | 60 | class AliHLTPHOSDigitMaker : public AliHLTCaloConstantsHandler |
209a4703 | 61 | { |
62 | public: | |
2374af72 | 63 | |
64 | /** Constructor */ | |
209a4703 | 65 | AliHLTPHOSDigitMaker(); |
2374af72 | 66 | |
67 | /** Destructor */ | |
ab38011b | 68 | virtual ~AliHLTPHOSDigitMaker(); |
25b7f84c | 69 | |
70 | /** Copy constructor */ | |
71 | AliHLTPHOSDigitMaker(const AliHLTPHOSDigitMaker &) : | |
5c6cac96 | 72 | AliHLTLogging(), |
7ce40e5c | 73 | fShmPtr(0), |
25b7f84c | 74 | fDigitStructPtr(0), |
f1bfc65f | 75 | fDigitHeaderPtr(0), |
94594220 | 76 | fDigitCount(0), |
e304ea31 | 77 | fOrdered(true), |
f1bfc65f | 78 | fMapperPtr(0), |
79 | fDigitPtrArray(0), | |
80 | fAvailableSize(0) | |
25b7f84c | 81 | { |
82 | //Copy constructor not implemented | |
83 | } | |
84 | ||
85 | /** Assignment */ | |
86 | AliHLTPHOSDigitMaker & operator = (const AliHLTPHOSDigitMaker) | |
87 | { | |
88 | //Assignment | |
89 | return *this; | |
90 | } | |
91 | ||
2374af72 | 92 | /** |
e304ea31 | 93 | * Sets the pointer to the output |
94 | * @param the output pointer | |
2374af72 | 95 | */ |
933eb3ed | 96 | void SetDigitHeaderPtr(AliHLTPHOSDigitHeaderStruct *digitHeaderPtr) |
0dc57e1b | 97 | { |
98 | fDigitHeaderPtr = digitHeaderPtr; | |
933eb3ed | 99 | fDigitStructPtr = reinterpret_cast<AliHLTPHOSDigitDataStruct*>(reinterpret_cast<Long_t>(digitHeaderPtr) + sizeof(AliHLTPHOSDigitHeaderStruct)); |
0dc57e1b | 100 | } |
d949e02e | 101 | |
102 | /** | |
103 | * Set the global high gain conversion factory | |
104 | * @param factor is the conversion factor | |
105 | */ | |
106 | void SetGlobalHighGainFactor(Float_t factor); | |
107 | ||
108 | /** | |
109 | * Set the global low gain conversion factory | |
110 | * @param factor is the conversion factor | |
111 | */ | |
112 | void SetGlobalLowGainFactor(Float_t factor); | |
2374af72 | 113 | |
114 | /** | |
115 | * Make the digits for one event. | |
94594220 | 116 | * @param channelDataHeader is the data header from the AliHLTPHOSRawAnalyzer |
2374af72 | 117 | * @return the number of digits found |
118 | */ | |
f3df2ba0 | 119 | Int_t MakeDigits(AliHLTPHOSChannelDataHeaderStruct* channelDataHeader, AliHLTUInt32_t availableSize); |
e304ea31 | 120 | |
2374af72 | 121 | |
7ce40e5c | 122 | /** |
123 | * Set the mask for dead channels | |
124 | * @param badChannelHGHist is a pointer to a high gain bad channel histogram | |
125 | * @param badChannelLGHist is a pointer to a low gain bad channel histogram | |
126 | * @param qCut is the cut | |
127 | */ | |
128 | void SetBadChannelMask(TH2F* badChannelHGHist, TH2F* badChannelLGHist, Float_t qCut); | |
129 | ||
94594220 | 130 | /** |
131 | * Set ordering of gains or not | |
132 | */ | |
133 | void SetOrdered(bool val) { fOrdered = val; } | |
0dc57e1b | 134 | |
135 | /** | |
933eb3ed | 136 | * Reset the digit maker |
0dc57e1b | 137 | */ |
e304ea31 | 138 | void Reset() { fDigitCount = 0; } |
209a4703 | 139 | |
0dc57e1b | 140 | /** |
141 | * Sort the digits and make internal links between them | |
142 | */ | |
143 | void SortDigits(); | |
144 | ||
145 | /** | |
146 | * Compare two digits, used during the sorting | |
147 | */ | |
933eb3ed | 148 | static Int_t CompareDigits(const void *dig0, const void *dig); |
0dc57e1b | 149 | |
150 | ||
209a4703 | 151 | private: |
152 | ||
e304ea31 | 153 | /** |
154 | * Add a new digit | |
155 | * @param channelData is the channel data | |
156 | * @param coordinates is the coordinates of the channel, including gain and module | |
0dc57e1b | 157 | * @return true if the digit is added correctly, false if out of buffer |
e304ea31 | 158 | */ |
0dc57e1b | 159 | bool AddDigit(AliHLTPHOSChannelDataStruct* channelData, UShort_t* channelCoordinates, Float_t* localCoordinates) |
e304ea31 | 160 | { |
341aab10 | 161 | // HLTError("Available size: %d", fAvailableSize); |
162 | ||
0dc57e1b | 163 | if(fAvailableSize < sizeof(AliHLTPHOSDigitDataStruct)) |
164 | { | |
341aab10 | 165 | HLTError("Output buffer is full, stopping digit making."); |
0dc57e1b | 166 | return false; |
167 | } | |
168 | ||
341aab10 | 169 | |
170 | ||
0dc57e1b | 171 | fAvailableSize -= sizeof(AliHLTPHOSDigitDataStruct); |
2f20cbe3 | 172 | |
173 | fDigitStructPtr->fX = channelCoordinates[0]; | |
174 | fDigitStructPtr->fZ = channelCoordinates[1]; | |
175 | ||
0dc57e1b | 176 | fDigitStructPtr->fID = fDigitStructPtr->fZ * NXCOLUMNSRCU + fDigitStructPtr->fX; |
177 | ||
2f20cbe3 | 178 | fDigitStructPtr->fLocX = localCoordinates[0]; |
179 | fDigitStructPtr->fLocZ = localCoordinates[1]; | |
180 | ||
87434909 | 181 | if(channelCoordinates[2] == HIGHGAIN) |
182 | { | |
183 | fDigitStructPtr->fEnergy = channelData->fEnergy*fHighGainFactors[channelCoordinates[0]][channelCoordinates[1]]; | |
341aab10 | 184 | // HLTError("HG channel (x = %d, z = %d) with amplitude: %f --> Digit with energy: %f \n", channelCoordinates[0], channelCoordinates[1], channelData->fEnergy, fDigitStructPtr->fEnergy); |
87434909 | 185 | } |
e304ea31 | 186 | else |
87434909 | 187 | { |
188 | fDigitStructPtr->fEnergy = channelData->fEnergy*fLowGainFactors[channelCoordinates[0]][channelCoordinates[1]]; | |
341aab10 | 189 | // HLTError("LG channel (x = %d, z = %d) with amplitude: %f --> Digit with energy: %f\n", channelCoordinates[0], channelCoordinates[1], channelData->fEnergy, fDigitStructPtr->fEnergy); |
87434909 | 190 | } |
191 | fDigitStructPtr->fTime = channelData->fTime * 0.0000001; //TODO | |
e304ea31 | 192 | fDigitStructPtr->fCrazyness = channelData->fCrazyness; |
87434909 | 193 | fDigitStructPtr->fModule = channelCoordinates[3]; |
0dc57e1b | 194 | |
195 | fDigitPtrArray[fDigitCount] = fDigitStructPtr; | |
196 | fDigitCount++; | |
e304ea31 | 197 | fDigitStructPtr++; |
f1bfc65f | 198 | return true; |
e304ea31 | 199 | } |
2374af72 | 200 | |
7ce40e5c | 201 | /** Pointer to shared memory interface */ |
94594220 | 202 | AliHLTPHOSSharedMemoryInterfacev2* fShmPtr; //! transient |
7ce40e5c | 203 | |
e304ea31 | 204 | /** Pointer to the AliHLTPHOSDigitDataStruct */ |
2374af72 | 205 | AliHLTPHOSDigitDataStruct *fDigitStructPtr; //! transient |
206 | ||
933eb3ed | 207 | /** Pointer to the AliHLTPHOSDigitDataStruct */ |
208 | AliHLTPHOSDigitHeaderStruct *fDigitHeaderPtr; //! transient | |
209 | ||
2374af72 | 210 | /** Digit count */ |
d949e02e | 211 | Int_t fDigitCount; //COMMENT |
212 | ||
e304ea31 | 213 | /** Are the gains ordered? */ |
94594220 | 214 | bool fOrdered; //COMMENT |
215 | ||
e304ea31 | 216 | /** Mapper */ |
217 | AliHLTPHOSMapper* fMapperPtr; //COMMENT | |
7ce40e5c | 218 | |
d949e02e | 219 | /** High gain energy conversion factors */ |
27029341 | 220 | Float_t fHighGainFactors[NXCOLUMNSMOD][NZROWSMOD]; //COMMENT |
d949e02e | 221 | |
222 | /** Low gain energy conversion factors */ | |
27029341 | 223 | Float_t fLowGainFactors[NXCOLUMNSMOD][NZROWSMOD]; //COMMENT |
2374af72 | 224 | |
7ce40e5c | 225 | /** Bad channel mask */ |
27029341 | 226 | Float_t fBadChannelMask[NXCOLUMNSMOD][NZROWSMOD][NGAINS]; //COMMENT |
7ce40e5c | 227 | |
0dc57e1b | 228 | /** Array of digit pointers */ |
229 | AliHLTPHOSDigitDataStruct **fDigitPtrArray; //COMMENT | |
230 | ||
231 | /** The available size of the output buffer */ | |
232 | AliHLTUInt32_t fAvailableSize; //COMMENT | |
87434909 | 233 | |
234 | ClassDef(AliHLTPHOSDigitMaker, 0); | |
e304ea31 | 235 | |
209a4703 | 236 | }; |
237 | ||
238 | ||
239 | #endif | |
240 |