]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/CALO/AliHLTCaloClusterizerNbyN.cxx
Changes for Root6 (Mikolaj)
[u/mrichter/AliRoot.git] / HLT / CALO / AliHLTCaloClusterizerNbyN.cxx
CommitLineData
78943659 1
2
3/**************************************************************************
4 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 * *
6 * Authors: Oystein Djuvsland <oysteind@ift.uib.no> *
7 * *
8 * Permission to use, copy, modify and distribute this software and its *
9 * documentation strictly for non-commercial purposes is hereby granted *
10 * without fee, provided that the above copyright notice appears in all *
11 * copies and that both the copyright notice and this permission notice *
12 * appear in the supporting documentation. The authors make no claims *
13 * about the suitability of this software for any purpose. It is *
14 * provided "as is" without express or implied warranty. *
15 **************************************************************************/
16
17#include "AliHLTCaloClusterizerNbyN.h"
18
19/**
20 * @file AliHLTCaloClusterizerNbyN.cxx
21 * @author Oystein Djuvsland
22 * @date
23 * @brief Clusterizer for PHOS HLT
24 */
25
26// see header file for class documentation
27// or
28// refer to README to build package
29// or
30// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
31
32
33AliHLTCaloClusterizerNbyN::AliHLTCaloClusterizerNbyN(TString det) : AliHLTCaloClusterizer(det)
34,fN(3)
35{
36// Constructor
37}
38AliHLTCaloClusterizerNbyN::~AliHLTCaloClusterizerNbyN()
39{
40// Destructor
41}
42
43Int_t AliHLTCaloClusterizerNbyN::ClusterizeEvent(Int_t nDigits)
44{
78943659 45 //see header file for documentation
46 Int_t nRecPoints = 0;
47 fNRecPoints = 0;
48 fUsedSize = 0;
49 fNDigits = nDigits;
50 fRecPointDataPtr = fFirstRecPointPtr;
51
52 // Sort our digits
53 fSortedByEnergy = true;
54 SortDigits();
55
56 //Clusterization starts
57 for (Int_t i = 0; i < nDigits; i++)
58 {
59 fDigitsInCluster = 0;
60
61 HLTDebug("Digit with energy: %f", fDigitsPointerArray[i]->fEnergy);
62
63 if (fDigitsPointerArray[i]->fEnergy < fEmcClusteringThreshold)
64 {
65 // Since we have sorted by energy the next digit will have even lower energy, so we return
66 return fNRecPoints;
67 }
68
69 if (fDigitsPointerArray[i]->fAssociatedCluster != -1) // Digit is neighbour with a higher energy digit
70 {
71 continue;
72 }
73
74 // Check if we enough space to write to, if not we expand it automatically.
75 CheckArray();
76 CheckBuffer();
77
78 // Create the rec point and add the digit.
79 // First digit is placed at the fDigits member variable in the recpoint
80 fDigitIndexPtr = &(fRecPointDataPtr->fDigits);
81
82 fRecPointDataPtr->fAmp = 0;
83 fRecPointDataPtr->fModule = fDigitsPointerArray[i]->fModule;
84
85 // Assigning the digit to this rec point
86 fRecPointDataPtr->fDigits = i;
87 fUsedSize += sizeof(AliHLTCaloRecPointDataStruct);
88
89 // Incrementing the pointer to be ready for new entry
90 fDigitIndexPtr++;
91
92 fRecPointDataPtr->fAmp += fDigitsPointerArray[i]->fEnergy;
93
94
95 //fDigitsPointerArray[i]->fEnergy = 0;
96 fDigitsPointerArray[i]->fAssociatedCluster = fNRecPoints;
97
98
99 fDigitsInCluster++;
100 nRecPoints++;
101
102
103 // Then we loop over all the other digits (stupid, I know...)
104 Int_t maxDiff = fN/2;
105 for (Int_t j = 0; j < nDigits; j++)
106 {
80156a86 107 if (fDigitsPointerArray[j]->fEnergy < fEmcMinEnergyThreshold) break; // Sorted by energy
108 if(fDigitsPointerArray[j]->fAssociatedCluster!=-1) continue;//cell is already associated with a cluster (higher energy seed)
0a899b5c 109 if(TMath::Abs(fDigitsPointerArray[i]->fTime-fDigitsPointerArray[j]->fTime) >= fEmcTimeGate) continue;//time difference between cell and seed is larger than cut
78943659 110
111 if (TMath::Abs(fDigitsPointerArray[i]->fX - fDigitsPointerArray[j]->fX) <= maxDiff
112 && TMath::Abs(fDigitsPointerArray[i]->fZ - fDigitsPointerArray[j]->fZ) <= maxDiff) // The digit is in our grid
113 {
114 if (TMath::Abs(fDigitsPointerArray[i]->fX - fDigitsPointerArray[j]->fX) == 1
115 || TMath::Abs(fDigitsPointerArray[i]->fZ - fDigitsPointerArray[j]->fZ) == 1) // The digit neighbour to the seed
116 {
000d8c19 117 // This means the digit is not a local maximum
78943659 118 fDigitsPointerArray[j]->fAssociatedCluster = fNRecPoints;
78943659 119
000d8c19 120 // Check that the buffer is large enough for adding a digit (can be heavily improved wrt performance)
121 CheckBuffer();
78943659 122
000d8c19 123 // Assigning index to digit
124 *fDigitIndexPtr = j;
125 fUsedSize += sizeof(Int_t);
78943659 126
000d8c19 127 // Incrementing digit pointer to be ready for new entry
128 fDigitIndexPtr++;
78943659 129
000d8c19 130 // Adding the digit energy to the rec point
131 fRecPointDataPtr->fAmp += fDigitsPointerArray[j]->fEnergy;
78943659 132
000d8c19 133 // Count it
134 fDigitsInCluster++;
135 }
78943659 136 }
137 }
138
139 fRecPointDataPtr->fMultiplicity = fDigitsInCluster;
140 fRecPointArray[fNRecPoints] = fRecPointDataPtr;
141
142 fRecPointDataPtr = reinterpret_cast<AliHLTCaloRecPointDataStruct*>(fDigitIndexPtr);
143
144 fNRecPoints++;
145
146 }//end of clusterization
147
148 return nRecPoints;
149}
150