]>
Commit | Line | Data |
---|---|---|
a65a7e70 | 1 | //-*- Mode: C++ -*- |
2 | // $Id$ | |
3 | ||
4 | /************************************************************************** | |
5 | * This file is property of and copyright by the ALICE HLT Project * | |
6 | * All rights reserved. * | |
7 | * * | |
8 | * Primary Authors: Oystein Djuvsland * | |
9 | * * | |
10 | * Permission to use, copy, modify and distribute this software and its * | |
11 | * documentation strictly for non-commercial purposes is hereby granted * | |
12 | * without fee, provided that the above copyright notice appears in all * | |
13 | * copies and that both the copyright notice and this permission notice * | |
14 | * appear in the supporting documentation. The authors make no claims * | |
15 | * about the suitability of this software for any purpose. It is * | |
16 | * provided "as is" without express or implied warranty. * | |
17 | **************************************************************************/ | |
18 | ||
19 | #ifndef ALIHLTCALOCLUSTERIZER_H | |
20 | #define ALIHLTCALOCLUSTERIZER_H | |
21 | ||
22 | ||
23 | /** | |
24 | * Class does clusterization in for Calorimeters on an event basis. It is intended | |
25 | * for use in HLT, but can also be used offline | |
26 | * | |
27 | * @file AliHLTCaloClusterizer.h | |
28 | * @author Oystein Djuvsland | |
29 | * @date | |
30 | * @brief Clusterizer for CALO HLT | |
31 | */ | |
32 | ||
33 | // see header file for class documentation | |
34 | // or | |
35 | // refer to README to build package | |
36 | // or | |
37 | // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt | |
38 | ||
39 | //#include "AliHLTCaloBase.h" | |
40 | ||
41 | #include "AliHLTCaloRecPointContainerStruct.h" | |
42 | #include "AliHLTCaloRecPointDataStruct.h" | |
43 | #include "AliHLTCaloDigitContainerDataStruct.h" | |
44 | #include "AliHLTCaloDigitDataStruct.h" | |
45 | #include "TString.h" | |
46 | #include "AliHLTCaloConstantsHandler.h" | |
47 | ||
48 | //#include "AliPHOSGeometry.h" | |
49 | #include "AliHLTLogging.h" | |
50 | ||
51 | class TClonesArray; | |
52 | class TString; | |
53 | //class AliPHOSDigit; | |
54 | //class AliPHOSRecoParamEmc; | |
55 | //class AliPHOSRecoParam; | |
56 | ||
57 | /** | |
58 | * @class AliHLTCaloClusterizer | |
59 | * Clusterizer for CALO HLT. The clusterizer takes digits as input, either | |
60 | * in the form of a container of AliHLTCaloDigitDataStruct or a | |
61 | * TClonesArray of AliPHOSDigit through an instance of a AliPHOSLoader | |
62 | * | |
63 | * @ingroup alihlt_calo | |
64 | */ | |
65 | ||
66 | ||
67 | class AliHLTCaloClusterizer : public AliHLTCaloConstantsHandler, public AliHLTLogging | |
68 | { | |
69 | ||
70 | public: | |
71 | ||
72 | /** Constructor */ | |
73 | AliHLTCaloClusterizer(TString det); | |
74 | ||
75 | /** Destructor */ | |
76 | virtual ~AliHLTCaloClusterizer(); | |
77 | ||
78 | /** Set digit container */ | |
79 | void SetDigitContainer(AliHLTCaloDigitContainerDataStruct* digitContainerPtr) | |
80 | { fDigitContainerPtr = digitContainerPtr; } | |
81 | ||
82 | /** Set array with digits */ | |
83 | void SetDigitArray(AliHLTCaloDigitDataStruct **digitPointerArr) | |
84 | { fDigitsPointerArray = digitPointerArr; } | |
85 | ||
86 | /** Set rec point data buffer */ | |
87 | void SetRecPointDataPtr(AliHLTCaloRecPointDataStruct* recPointDataPtr); | |
88 | ||
89 | /** Set reco parameters */ | |
90 | // void SetRecoParameters(AliPHOSRecoParam* recoPars); | |
91 | ||
92 | /** Set emc clustering threshold */ | |
93 | void SetEmcClusteringThreshold(Float_t threshold) { fEmcClusteringThreshold = threshold; } | |
94 | ||
95 | /** Set emc min energy threshold */ | |
96 | void SetEmcMinEnergyThreshold(Float_t threshold) { fEmcMinEnergyThreshold = threshold; } | |
97 | ||
98 | /** Set emc time gate */ | |
99 | void SetEmcTimeGate(Float_t gate) { fEmcTimeGate = gate; } | |
100 | ||
101 | /** Starts clusterization of the event */ | |
102 | virtual Int_t ClusterizeEvent(Int_t nDigits); | |
103 | ||
104 | /** | |
105 | * For a given digit this digit scans for neighbouring digits which | |
106 | * passes the threshold for inclusion in a rec point. If one is found | |
107 | * it is added to the current rec point | |
108 | * @param digIndex index of the digit in the digit container | |
109 | * @param recPoint pointer to the current rec point | |
110 | */ | |
111 | virtual Int_t ScanForNeighbourDigits(Int_t digIndex, AliHLTCaloRecPointDataStruct* recPoint); | |
112 | ||
113 | /** | |
114 | * Checks if two digits are neighbours | |
115 | * @param d1 first digit | |
116 | * @param d2 second digit | |
117 | */ | |
118 | virtual Int_t AreNeighbours(AliHLTCaloDigitDataStruct* d1, AliHLTCaloDigitDataStruct* d2); | |
119 | ||
120 | /** | |
121 | * Get pointer to the rec points array | |
122 | */ | |
123 | AliHLTCaloRecPointDataStruct** GetRecPoints() const { return fRecPointArray; } | |
124 | ||
125 | /** | |
126 | * Sort the digits by energy | |
127 | */ | |
128 | void SetSortDigitsByEnergy(); | |
129 | ||
130 | /** | |
131 | * Sort the digits by position | |
132 | */ | |
133 | void SetSortDigitsByPosition(); | |
134 | ||
135 | /** | |
136 | * Set the sorting function (as required by stdlib's qsort) if you don't want to use the provided ones | |
137 | */ | |
138 | void SetSortingFunction(Int_t (*compare)(const void*, const void*)) { fCompareFunction = compare; } | |
139 | ||
140 | /** Set the detector (PHOS or EMCAL) */ | |
141 | void SetDetector(TString det); | |
142 | ||
143 | protected: | |
144 | ||
145 | /** | |
146 | * Check the rec point buffer size and resize the buffer if necessary | |
147 | */ | |
148 | virtual Int_t CheckBuffer(); //COMMENT | |
149 | ||
150 | /** | |
151 | * Check the rec point array size and resize the array if necessary | |
152 | */ | |
153 | virtual Int_t CheckArray(); //COMMENT | |
154 | ||
155 | /** | |
156 | * Sort the digits | |
157 | */ | |
158 | void SortDigits(); | |
159 | ||
160 | /** | |
161 | * Compare digits by position | |
162 | */ | |
163 | static Int_t CompareDigitsByPosition(const void *dig0, const void *dig); | |
164 | ||
165 | /** | |
166 | * Compare digits by energy | |
167 | */ | |
168 | static Int_t CompareDigitsByEnergy(const void *dig0, const void *dig); | |
169 | ||
170 | /** | |
171 | * Pointer to the compare function for the sorting of digits | |
172 | */ | |
173 | //Int_t (AliHLTCaloClusterizer::*fCompareFunction)(const void*, const void*); | |
174 | Int_t (*fCompareFunction)(const void*, const void*); | |
175 | ||
176 | /** Check if two modules are connected */ | |
177 | Bool_t AreEdgeCells(AliHLTCaloDigitDataStruct *digit0, AliHLTCaloDigitDataStruct *digit1); | |
178 | ||
179 | /** Array of pointers to the rec point output */ | |
180 | AliHLTCaloRecPointDataStruct **fRecPointArray; //COMMENT | |
181 | ||
182 | /** Pointer to the rec point output */ | |
183 | AliHLTCaloRecPointDataStruct *fRecPointDataPtr; //COMMENT | |
184 | ||
185 | /** The first rec point in the list */ | |
186 | AliHLTCaloRecPointDataStruct *fFirstRecPointPtr; //COMMENT | |
187 | ||
188 | /** Size of the rec point array */ | |
189 | Int_t fArraySize; | |
190 | ||
191 | /** Available size for the rec point output */ | |
192 | Int_t fAvailableSize; | |
193 | ||
194 | /** The used size for the rec point output */ | |
195 | Int_t fUsedSize; | |
196 | ||
197 | /** Number of rec points created so far */ | |
198 | Int_t fNRecPoints; | |
199 | ||
200 | /** Pointer to the digit index array in the rec point */ | |
201 | Int_t* fDigitIndexPtr; //! transient | |
202 | ||
203 | /** Energy threshold for starting a cluster for the calorimeter */ | |
204 | Float_t fEmcClusteringThreshold; //COMMENT | |
205 | ||
206 | /** Energy threshold for including a crystal in a cluster */ | |
207 | Float_t fEmcMinEnergyThreshold; //COMMENT | |
208 | ||
209 | /** Maximum time difference for inclusion in a rec point */ | |
210 | Float_t fEmcTimeGate; //COMMENT | |
211 | ||
212 | /** Counts the digits in a rec point */ | |
213 | Int_t fDigitsInCluster; //COMMENT | |
214 | ||
215 | /** Array of our digits */ | |
216 | AliHLTCaloDigitDataStruct **fDigitsPointerArray; //! transient | |
217 | ||
218 | /** Contains the digits from one event */ | |
219 | AliHLTCaloDigitContainerDataStruct *fDigitContainerPtr; //! transient | |
220 | ||
221 | /** Maximum difference in index to be a neighbour */ | |
222 | Int_t fMaxDigitIndexDiff; //COMMENT | |
223 | ||
224 | /** Number of digits in event */ | |
225 | Int_t fNDigits; //COMMENT | |
226 | ||
227 | /** Are we sorting digits by position? */ | |
228 | Bool_t fSortedByPosition; //COMMENT | |
229 | ||
230 | /** Are we sorting digits by energy? */ | |
231 | Bool_t fSortedByEnergy; //COMMENT | |
232 | ||
233 | /** Are we sorting at all? */ | |
234 | Bool_t fSortDigits; //COMMENT | |
235 | ||
236 | /** Is this running for EMCAL */ | |
237 | Bool_t fIsEMCAL; //COMMENT | |
238 | ||
239 | private: | |
240 | ||
241 | /** Default constructor, prohibited */ | |
242 | AliHLTCaloClusterizer(); // COMMENT | |
243 | ||
244 | /** Copy constructor, prohibited */ | |
245 | AliHLTCaloClusterizer (const AliHLTCaloClusterizer &); //COMMENT | |
246 | ||
247 | /** Assignment operator, prohibited */ | |
248 | AliHLTCaloClusterizer & operator = (const AliHLTCaloClusterizer &); //COMMENT | |
249 | ||
250 | UChar_t* fBuffer; // Buffer for storing of Cluster Data | |
251 | ||
252 | ClassDef(AliHLTCaloClusterizer, 0); | |
253 | ||
254 | }; | |
255 | ||
256 | #endif |