4 /**************************************************************************
5 * This file is property of and copyright by the ALICE HLT Project *
6 * All rights reserved. *
8 * Primary Authors: Oystein Djuvsland *
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 **************************************************************************/
19 #ifndef ALIHLTCALOCLUSTERIZER_H
20 #define ALIHLTCALOCLUSTERIZER_H
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
27 * @file AliHLTCaloClusterizer.h
28 * @author Oystein Djuvsland
30 * @brief Clusterizer for CALO HLT
33 // see header file for class documentation
35 // refer to README to build package
37 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
39 //#include "AliHLTCaloBase.h"
41 #include "AliHLTCaloRecPointContainerStruct.h"
42 #include "AliHLTCaloRecPointDataStruct.h"
43 #include "AliHLTCaloDigitContainerDataStruct.h"
44 #include "AliHLTCaloDigitDataStruct.h"
46 #include "AliHLTCaloConstantsHandler.h"
48 //#include "AliPHOSGeometry.h"
49 #include "AliHLTLogging.h"
54 //class AliPHOSRecoParamEmc;
55 //class AliPHOSRecoParam;
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
63 * @ingroup alihlt_calo
67 class AliHLTCaloClusterizer : public AliHLTCaloConstantsHandler, public AliHLTLogging
73 AliHLTCaloClusterizer(TString det);
76 virtual ~AliHLTCaloClusterizer();
78 /** Set digit container */
79 void SetDigitContainer(AliHLTCaloDigitContainerDataStruct* digitContainerPtr)
80 { fDigitContainerPtr = digitContainerPtr; }
82 /** Set array with digits */
83 void SetDigitArray(AliHLTCaloDigitDataStruct **digitPointerArr)
84 { fDigitsPointerArray = digitPointerArr; }
86 /** Set rec point data buffer */
87 void SetRecPointDataPtr(AliHLTCaloRecPointDataStruct* recPointDataPtr);
89 /** Set reco parameters */
90 // void SetRecoParameters(AliPHOSRecoParam* recoPars);
92 /** Set emc clustering threshold */
93 void SetEmcClusteringThreshold(Float_t threshold) { fEmcClusteringThreshold = threshold; }
95 /** Set emc min energy threshold */
96 void SetEmcMinEnergyThreshold(Float_t threshold) { fEmcMinEnergyThreshold = threshold; }
98 /** Set emc time gate */
99 void SetEmcTimeGate(Float_t gate) { fEmcTimeGate = gate; }
101 /** Starts clusterization of the event */
102 virtual Int_t ClusterizeEvent(Int_t nDigits);
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
111 virtual Int_t ScanForNeighbourDigits(Int_t digIndex, AliHLTCaloRecPointDataStruct* recPoint);
114 * Checks if two digits are neighbours
115 * @param d1 first digit
116 * @param d2 second digit
118 virtual Int_t AreNeighbours(AliHLTCaloDigitDataStruct* d1, AliHLTCaloDigitDataStruct* d2);
121 * Get pointer to the rec points array
123 AliHLTCaloRecPointDataStruct** GetRecPoints() const { return fRecPointArray; }
126 * Sort the digits by energy
128 void SetSortDigitsByEnergy();
131 * Sort the digits by position
133 void SetSortDigitsByPosition();
136 * Set the sorting function (as required by stdlib's qsort) if you don't want to use the provided ones
138 void SetSortingFunction(Int_t (*compare)(const void*, const void*)) { fCompareFunction = compare; }
140 /** Set the detector (PHOS or EMCAL) */
141 void SetDetector(TString det);
146 * Check the rec point buffer size and resize the buffer if necessary
148 virtual Int_t CheckBuffer(); //COMMENT
151 * Check the rec point array size and resize the array if necessary
153 virtual Int_t CheckArray(); //COMMENT
161 * Compare digits by position
163 static Int_t CompareDigitsByPosition(const void *dig0, const void *dig);
166 * Compare digits by energy
168 static Int_t CompareDigitsByEnergy(const void *dig0, const void *dig);
171 * Pointer to the compare function for the sorting of digits
173 //Int_t (AliHLTCaloClusterizer::*fCompareFunction)(const void*, const void*);
174 Int_t (*fCompareFunction)(const void*, const void*);
176 /** Check if two modules are connected */
177 Bool_t AreEdgeCells(AliHLTCaloDigitDataStruct *digit0, AliHLTCaloDigitDataStruct *digit1);
179 /** Array of pointers to the rec point output */
180 AliHLTCaloRecPointDataStruct **fRecPointArray; //COMMENT
182 /** Pointer to the rec point output */
183 AliHLTCaloRecPointDataStruct *fRecPointDataPtr; //COMMENT
185 /** The first rec point in the list */
186 AliHLTCaloRecPointDataStruct *fFirstRecPointPtr; //COMMENT
188 /** Size of the rec point array */
191 /** Available size for the rec point output */
192 Int_t fAvailableSize;
194 /** The used size for the rec point output */
197 /** Number of rec points created so far */
200 /** Pointer to the digit index array in the rec point */
201 Int_t* fDigitIndexPtr; //! transient
203 /** Energy threshold for starting a cluster for the calorimeter */
204 Float_t fEmcClusteringThreshold; //COMMENT
206 /** Energy threshold for including a crystal in a cluster */
207 Float_t fEmcMinEnergyThreshold; //COMMENT
209 /** Maximum time difference for inclusion in a rec point */
210 Float_t fEmcTimeGate; //COMMENT
212 /** Counts the digits in a rec point */
213 Int_t fDigitsInCluster; //COMMENT
215 /** Array of our digits */
216 AliHLTCaloDigitDataStruct **fDigitsPointerArray; //! transient
218 /** Contains the digits from one event */
219 AliHLTCaloDigitContainerDataStruct *fDigitContainerPtr; //! transient
221 /** Maximum difference in index to be a neighbour */
222 Int_t fMaxDigitIndexDiff; //COMMENT
224 /** Number of digits in event */
225 Int_t fNDigits; //COMMENT
227 /** Are we sorting digits by position? */
228 Bool_t fSortedByPosition; //COMMENT
230 /** Are we sorting digits by energy? */
231 Bool_t fSortedByEnergy; //COMMENT
233 /** Are we sorting at all? */
234 Bool_t fSortDigits; //COMMENT
236 /** Is this running for EMCAL */
237 Bool_t fIsEMCAL; //COMMENT
241 /** Default constructor, prohibited */
242 AliHLTCaloClusterizer(); // COMMENT
244 /** Copy constructor, prohibited */
245 AliHLTCaloClusterizer (const AliHLTCaloClusterizer &); //COMMENT
247 /** Assignment operator, prohibited */
248 AliHLTCaloClusterizer & operator = (const AliHLTCaloClusterizer &); //COMMENT
250 UChar_t* fBuffer; // Buffer for storing of Cluster Data
252 ClassDef(AliHLTCaloClusterizer, 0);