-//-*- Mode: C++ -*-\r
-// $Id$\r
-\r
-/**************************************************************************\r
- * This file is property of and copyright by the ALICE HLT Project * \r
- * All rights reserved. *\r
- * *\r
- * Primary Authors: Oystein Djuvsland *\r
- * *\r
- * Permission to use, copy, modify and distribute this software and its *\r
- * documentation strictly for non-commercial purposes is hereby granted *\r
- * without fee, provided that the above copyright notice appears in all *\r
- * copies and that both the copyright notice and this permission notice *\r
- * appear in the supporting documentation. The authors make no claims *\r
- * about the suitability of this software for any purpose. It is * \r
- * provided "as is" without express or implied warranty. *\r
- **************************************************************************/\r
-\r
-#ifndef ALIHLTCALOCLUSTERIZER_H\r
-#define ALIHLTCALOCLUSTERIZER_H\r
-\r
-\r
-/**\r
- * Class does clusterization in for Calorimeters on an event basis. It is intended \r
- * for use in HLT, but can also be used offline\r
- *\r
- * @file AliHLTCaloClusterizer.h\r
- * @author Oystein Djuvsland\r
- * @date\r
- * @brief Clusterizer for CALO HLT\r
- */\r
-\r
-// see header file for class documentation\r
-// or\r
-// refer to README to build package\r
-// or\r
-// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt\r
-\r
-//#include "AliHLTCaloBase.h"\r
-\r
-#include "AliHLTCaloRecPointContainerStruct.h"\r
-#include "AliHLTCaloRecPointDataStruct.h"\r
-#include "AliHLTCaloDigitContainerDataStruct.h"\r
-#include "AliHLTCaloDigitDataStruct.h"\r
-#include "TString.h"\r
-#include "AliHLTCaloConstantsHandler.h"\r
-\r
-//#include "AliPHOSGeometry.h"\r
-#include "AliHLTLogging.h"\r
-\r
-class TClonesArray;\r
-class TString;\r
-//class AliPHOSDigit;\r
-//class AliPHOSRecoParamEmc;\r
-//class AliPHOSRecoParam;\r
-\r
-/** \r
- * @class AliHLTCaloClusterizer\r
- * Clusterizer for CALO HLT. The clusterizer takes digits as input, either\r
- * in the form of a container of AliHLTCaloDigitDataStruct or a\r
- * TClonesArray of AliPHOSDigit through an instance of a AliPHOSLoader\r
- *\r
- * @ingroup alihlt_calo\r
- */\r
-\r
-\r
-class AliHLTCaloClusterizer : public AliHLTCaloConstantsHandler, public AliHLTLogging\r
-{\r
- \r
-public:\r
- \r
- /** Constructor */\r
- AliHLTCaloClusterizer(TString det); \r
-\r
- /** Destructor */\r
- virtual ~AliHLTCaloClusterizer();\r
- \r
- /** Set digit container */\r
- void SetDigitContainer(AliHLTCaloDigitContainerDataStruct* digitContainerPtr)\r
- { fDigitContainerPtr = digitContainerPtr; }\r
-\r
- /** Set array with digits */\r
- void SetDigitArray(AliHLTCaloDigitDataStruct **digitPointerArr)\r
- { fDigitsPointerArray = digitPointerArr; } \r
-\r
- /** Set rec point data buffer */\r
- void SetRecPointDataPtr(AliHLTCaloRecPointDataStruct* recPointDataPtr);\r
-\r
- /** Set reco parameters */\r
- // void SetRecoParameters(AliPHOSRecoParam* recoPars);\r
-\r
- /** Set emc clustering threshold */\r
- void SetEmcClusteringThreshold(Float_t threshold) { fEmcClusteringThreshold = threshold; }\r
-\r
- /** Set emc min energy threshold */\r
- void SetEmcMinEnergyThreshold(Float_t threshold) { fEmcMinEnergyThreshold = threshold; }\r
-\r
- /** Set emc time gate */\r
- void SetEmcTimeGate(Float_t gate) { fEmcTimeGate = gate; }\r
- \r
- /** Starts clusterization of the event */ \r
- virtual Int_t ClusterizeEvent(Int_t nDigits);\r
- \r
- /**\r
- * For a given digit this digit scans for neighbouring digits which \r
- * passes the threshold for inclusion in a rec point. If one is found \r
- * it is added to the current rec point\r
- * @param digIndex index of the digit in the digit container\r
- * @param recPoint pointer to the current rec point\r
- */\r
- virtual Int_t ScanForNeighbourDigits(Int_t digIndex, AliHLTCaloRecPointDataStruct* recPoint);\r
-\r
- /**\r
- * Checks if two digits are neighbours\r
- * @param d1 first digit\r
- * @param d2 second digit\r
- */\r
- virtual Int_t AreNeighbours(AliHLTCaloDigitDataStruct* d1, AliHLTCaloDigitDataStruct* d2);\r
-\r
- /**\r
- * Get pointer to the rec points array\r
- */\r
- AliHLTCaloRecPointDataStruct** GetRecPoints() const { return fRecPointArray; }\r
-\r
- Int_t CheckDigits(AliHLTCaloRecPointDataStruct **recArray = 0, AliHLTCaloDigitDataStruct **digArray = 0, Int_t nRP = 0);\r
-\r
- Int_t CheckDigits(AliHLTCaloRecPointDataStruct **recArray, AliHLTCaloDigitDataStruct *digArray, Int_t nRP = 0);\r
-\r
-protected:\r
-\r
- /** \r
- * Check the rec point buffer size and resize the buffer if necessary\r
- */\r
- virtual Int_t CheckBuffer(); //COMMENT\r
- \r
- /** \r
- * Check the rec point array size and resize the array if necessary\r
- */\r
- virtual Int_t CheckArray(); //COMMENT\r
-\r
- /** Array of pointers to the rec point output */\r
- AliHLTCaloRecPointDataStruct **fRecPointArray; //COMMENT\r
-\r
- /** Pointer to the rec point output */\r
- AliHLTCaloRecPointDataStruct *fRecPointDataPtr; //COMMENT\r
-\r
- /** The first rec point in the list */\r
- AliHLTCaloRecPointDataStruct *fFirstRecPointPtr; //COMMENT\r
-\r
- /** Size of the rec point array */\r
- Int_t fArraySize;\r
- \r
- /** Available size for the rec point output */\r
- Int_t fAvailableSize;\r
-\r
- /** The used size for the rec point output */\r
- Int_t fUsedSize;\r
- \r
- /** Number of rec points created so far */\r
- Int_t fNRecPoints;\r
- \r
- /** Pointer to the digit index array in the rec point */\r
- Int_t* fDigitIndexPtr; //! transient\r
-\r
- /** Energy threshold for starting a cluster for the calorimeter */\r
- Float_t fEmcClusteringThreshold; //COMMENT\r
-\r
- /** Energy threshold for including a crystal in a cluster */\r
- Float_t fEmcMinEnergyThreshold; //COMMENT\r
-\r
- /** Maximum time difference for inclusion in a rec point */\r
- Float_t fEmcTimeGate; //COMMENT\r
-\r
- /** Counts the digits in a rec point */\r
- Int_t fDigitsInCluster; //COMMENT\r
-\r
- /** Array of our digits */\r
- AliHLTCaloDigitDataStruct **fDigitsPointerArray; //! transient\r
-\r
- /** Contains the digits from one event */\r
- AliHLTCaloDigitContainerDataStruct *fDigitContainerPtr; //! transient\r
-\r
- /** Maximum difference in index to be a neighbour */\r
- Int_t fMaxDigitIndexDiff; //COMMENT\r
-\r
- /** Number of digits in event */\r
- Int_t fNDigits; //COMMENT\r
-\r
-private:\r
-\r
- /** Default constructor, prohibited */\r
- AliHLTCaloClusterizer(); // COMMENT\r
- \r
- /** Copy constructor, prohibited */\r
- AliHLTCaloClusterizer (const AliHLTCaloClusterizer &); //COMMENT\r
- \r
- /** Assignment operator, prohibited */\r
- AliHLTCaloClusterizer & operator = (const AliHLTCaloClusterizer &); //COMMENT\r
-\r
- ClassDef(AliHLTCaloClusterizer, 0);\r
-\r
-};\r
-\r
-#endif\r
+//-*- Mode: C++ -*-
+// $Id$
+
+/**************************************************************************
+ * This file is property of and copyright by the ALICE HLT Project *
+ * All rights reserved. *
+ * *
+ * Primary Authors: Oystein Djuvsland *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+
+#ifndef ALIHLTCALOCLUSTERIZER_H
+#define ALIHLTCALOCLUSTERIZER_H
+
+
+/**
+ * Class does clusterization in for Calorimeters on an event basis. It is intended
+ * for use in HLT, but can also be used offline
+ *
+ * @file AliHLTCaloClusterizer.h
+ * @author Oystein Djuvsland
+ * @date
+ * @brief Clusterizer for CALO HLT
+ */
+
+// see header file for class documentation
+// or
+// refer to README to build package
+// or
+// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+
+//#include "AliHLTCaloBase.h"
+
+#include "AliHLTCaloRecPointContainerStruct.h"
+#include "AliHLTCaloRecPointDataStruct.h"
+#include "AliHLTCaloDigitContainerDataStruct.h"
+#include "AliHLTCaloDigitDataStruct.h"
+#include "TString.h"
+#include "AliHLTCaloConstantsHandler.h"
+
+//#include "AliPHOSGeometry.h"
+#include "AliHLTLogging.h"
+
+class TClonesArray;
+class TString;
+//class AliPHOSDigit;
+//class AliPHOSRecoParamEmc;
+//class AliPHOSRecoParam;
+
+/**
+ * @class AliHLTCaloClusterizer
+ * Clusterizer for CALO HLT. The clusterizer takes digits as input, either
+ * in the form of a container of AliHLTCaloDigitDataStruct or a
+ * TClonesArray of AliPHOSDigit through an instance of a AliPHOSLoader
+ *
+ * @ingroup alihlt_calo
+ */
+
+
+class AliHLTCaloClusterizer : public AliHLTCaloConstantsHandler, public AliHLTLogging
+{
+
+public:
+
+ /** Constructor */
+ AliHLTCaloClusterizer(TString det);
+
+ /** Destructor */
+ virtual ~AliHLTCaloClusterizer();
+
+ /** Set digit container */
+ void SetDigitContainer(AliHLTCaloDigitContainerDataStruct* digitContainerPtr)
+ { fDigitContainerPtr = digitContainerPtr; }
+
+ /** Set array with digits */
+ void SetDigitArray(AliHLTCaloDigitDataStruct **digitPointerArr)
+ { fDigitsPointerArray = digitPointerArr; }
+
+ /** Set rec point data buffer */
+ void SetRecPointDataPtr(AliHLTCaloRecPointDataStruct* recPointDataPtr);
+
+ /** Set reco parameters */
+ // void SetRecoParameters(AliPHOSRecoParam* recoPars);
+
+ /** Set emc clustering threshold */
+ void SetEmcClusteringThreshold(Float_t threshold) { fEmcClusteringThreshold = threshold; }
+
+ /** Set emc min energy threshold */
+ void SetEmcMinEnergyThreshold(Float_t threshold) { fEmcMinEnergyThreshold = threshold; }
+
+ /** Set emc time gate */
+ void SetEmcTimeGate(Float_t gate) { fEmcTimeGate = gate; }
+
+ /** Starts clusterization of the event */
+ virtual Int_t ClusterizeEvent(Int_t nDigits);
+
+ /**
+ * For a given digit this digit scans for neighbouring digits which
+ * passes the threshold for inclusion in a rec point. If one is found
+ * it is added to the current rec point
+ * @param digIndex index of the digit in the digit container
+ * @param recPoint pointer to the current rec point
+ */
+ virtual Int_t ScanForNeighbourDigits(Int_t digIndex, AliHLTCaloRecPointDataStruct* recPoint);
+
+ /**
+ * Checks if two digits are neighbours
+ * @param d1 first digit
+ * @param d2 second digit
+ */
+ virtual Int_t AreNeighbours(AliHLTCaloDigitDataStruct* d1, AliHLTCaloDigitDataStruct* d2);
+
+ /**
+ * Get pointer to the rec points array
+ */
+ AliHLTCaloRecPointDataStruct** GetRecPoints() const { return fRecPointArray; }
+
+ /**
+ * Sort the digits by energy
+ */
+ void SetSortDigitsByEnergy();
+
+ /**
+ * Sort the digits by position
+ */
+ void SetSortDigitsByPosition();
+
+ /**
+ * Set the sorting function (as required by stdlib's qsort) if you don't want to use the provided ones
+ */
+ void SetSortingFunction(Int_t (*compare)(const void*, const void*)) { fCompareFunction = compare; }
+
+ /** Set the detector (PHOS or EMCAL) */
+ void SetDetector(TString det);
+
+protected:
+
+ /**
+ * Check the rec point buffer size and resize the buffer if necessary
+ */
+ virtual Int_t CheckBuffer(); //COMMENT
+
+ /**
+ * Check the rec point array size and resize the array if necessary
+ */
+ virtual Int_t CheckArray(); //COMMENT
+
+ /**
+ * Sort the digits
+ */
+ void SortDigits();
+
+ /**
+ * Compare digits by position
+ */
+ static Int_t CompareDigitsByPosition(const void *dig0, const void *dig);
+
+ /**
+ * Compare digits by energy
+ */
+ static Int_t CompareDigitsByEnergy(const void *dig0, const void *dig);
+
+ /**
+ * Pointer to the compare function for the sorting of digits
+ */
+ //Int_t (AliHLTCaloClusterizer::*fCompareFunction)(const void*, const void*);
+ Int_t (*fCompareFunction)(const void*, const void*);
+
+ /** Check if two modules are connected */
+ Bool_t AreEdgeCells(AliHLTCaloDigitDataStruct *digit0, AliHLTCaloDigitDataStruct *digit1);
+
+ /** Array of pointers to the rec point output */
+ AliHLTCaloRecPointDataStruct **fRecPointArray; //COMMENT
+
+ /** Pointer to the rec point output */
+ AliHLTCaloRecPointDataStruct *fRecPointDataPtr; //COMMENT
+
+ /** The first rec point in the list */
+ AliHLTCaloRecPointDataStruct *fFirstRecPointPtr; //COMMENT
+
+ /** Size of the rec point array */
+ Int_t fArraySize;
+
+ /** Available size for the rec point output */
+ Int_t fAvailableSize;
+
+ /** The used size for the rec point output */
+ Int_t fUsedSize;
+
+ /** Number of rec points created so far */
+ Int_t fNRecPoints;
+
+ /** Pointer to the digit index array in the rec point */
+ Int_t* fDigitIndexPtr; //! transient
+
+ /** Energy threshold for starting a cluster for the calorimeter */
+ Float_t fEmcClusteringThreshold; //COMMENT
+
+ /** Energy threshold for including a crystal in a cluster */
+ Float_t fEmcMinEnergyThreshold; //COMMENT
+
+ /** Maximum time difference for inclusion in a rec point */
+ Float_t fEmcTimeGate; //COMMENT
+
+ /** Counts the digits in a rec point */
+ Int_t fDigitsInCluster; //COMMENT
+
+ /** Array of our digits */
+ AliHLTCaloDigitDataStruct **fDigitsPointerArray; //! transient
+
+ /** Contains the digits from one event */
+ AliHLTCaloDigitContainerDataStruct *fDigitContainerPtr; //! transient
+
+ /** Maximum difference in index to be a neighbour */
+ Int_t fMaxDigitIndexDiff; //COMMENT
+
+ /** Number of digits in event */
+ Int_t fNDigits; //COMMENT
+
+ /** Are we sorting digits by position? */
+ Bool_t fSortedByPosition; //COMMENT
+
+ /** Are we sorting digits by energy? */
+ Bool_t fSortedByEnergy; //COMMENT
+
+ /** Are we sorting at all? */
+ Bool_t fSortDigits; //COMMENT
+
+ /** Is this running for EMCAL */
+ Bool_t fIsEMCAL; //COMMENT
+
+private:
+
+ /** Default constructor, prohibited */
+ AliHLTCaloClusterizer(); // COMMENT
+
+ /** Copy constructor, prohibited */
+ AliHLTCaloClusterizer (const AliHLTCaloClusterizer &); //COMMENT
+
+ /** Assignment operator, prohibited */
+ AliHLTCaloClusterizer & operator = (const AliHLTCaloClusterizer &); //COMMENT
+
+ UChar_t* fBuffer; // Buffer for storing of Cluster Data
+
+ ClassDef(AliHLTCaloClusterizer, 0);
+
+};
+
+#endif