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