1 /**************************************************************************
2 * This file is property of and copyright by the ALICE HLT Project *
3 * All rights reserved. *
5 * Primary Authors: Oystein Djuvsland *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
17 * @file AliHLTPHOSClusterizer.cxx
18 * @author Oystein Djuvsland
20 * @brief Clusterizer for PHOS HLT
23 // see header file for class documentation
25 // refer to README to build package
27 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
29 #include "AliHLTPHOSClusterizer.h"
30 #include "AliHLTPHOSBase.h"
31 #include "AliHLTLogging.h"
33 #include "AliHLTPHOSRecPointContainerStruct.h"
34 #include "AliHLTPHOSRecPointDataStruct.h"
35 #include "AliHLTPHOSDigitDataStruct.h"
36 #include "AliHLTPHOSDigitContainerDataStruct.h"
37 #include "TClonesArray.h"
38 #include "AliPHOSGeometry.h"
39 #include "AliPHOSDigit.h"
40 #ifndef HAVE_NOT_PHOSRECOPARAMEMC // set from configure if EMC functionality not available in AliPHOSRecoParam
41 #include "AliPHOSRecoParam.h"
43 #include "AliPHOSRecoParamEmc.h"
49 ClassImp(AliHLTPHOSClusterizer);
51 AliHLTPHOSClusterizer::AliHLTPHOSClusterizer():
53 fEmcClusteringThreshold(0),
54 fEmcMinEnergyThreshold(0),
62 fDigitContainerPtr(0),
63 fRecPointContainerPtr(0),
66 fMaxDigitIndexDiff(2*N_ZROWS_MOD)
68 //See header file for documentation
69 fPHOSGeometry = AliPHOSGeometry::GetInstance("noCPV");
70 fEmcClusteringThreshold = 0.2;
71 fEmcMinEnergyThreshold = 0.03;
72 fEmcTimeGate = 1.e-6 ;
77 AliHLTPHOSClusterizer::~AliHLTPHOSClusterizer()
79 //See header file for documentation
83 AliHLTPHOSClusterizer::SetRecPointContainer(AliHLTPHOSRecPointContainerStruct* recPointContainerPtr)
85 fRecPointContainerPtr = recPointContainerPtr;
86 fRecPointContainerPtr->fNRecPoints = 0;
90 AliHLTPHOSClusterizer::SetRecoParameters(AliPHOSRecoParam* /*params*/)
92 //see header file for documentation
93 #ifndef HAVE_NOT_PHOSRECOPARAMEMC // set from configure if EMC functionality not available in AliPHOSRecoParam
94 // the new AliPHOSRecoParam functions, available from revision
95 // fEmcClusteringThreshold = params->GetEMCClusteringThreshold();
96 // fEmcMinEnergyThreshold = params->GetEMCMinE();
97 // fLogWeight = params->GetEMCLogWeight();
99 fEmcClusteringThreshold = params->GetClusteringThreshold();
100 fEmcMinEnergyThreshold = params->GetMinE();
101 fLogWeight = params->GetLogWeight();
106 AliHLTPHOSClusterizer::ClusterizeEvent()
108 //see header file for documentation
109 Int_t nRecPoints = 0;
111 AliHLTPHOSRecPointDataStruct *recPoint = 0;
112 //Clusterization starts
113 for(i = 0; i < fDigitContainerPtr->fNDigits; i++)
115 fDigitsInCluster = 0;
117 if(fDigitContainerPtr->fDigitDataStruct[i].fEnergy < fEmcClusteringThreshold)
121 recPoint = &(fRecPointContainerPtr->fRecPointArray[nRecPoints]);
123 recPoint->fModule = fDigitContainerPtr->fDigitDataStruct[i].fModule;
124 recPoint->fDigitsList[fDigitsInCluster] = fDigitContainerPtr->fDigitDataStruct[i];
125 recPoint->fAmp += fDigitContainerPtr->fDigitDataStruct[i].fEnergy;
126 fDigitContainerPtr->fDigitDataStruct[i].fEnergy = 0;
129 if(nRecPoints == 100)
131 // HLTWarning("Too many rec points in event. Aborting clusterisation");
134 ScanForNeighbourDigits(i, recPoint);
135 recPoint->fMultiplicity = fDigitsInCluster;
137 }//end of clusterization
138 fRecPointContainerPtr->fNRecPoints = nRecPoints;
143 AliHLTPHOSClusterizer::ScanForNeighbourDigits(Int_t index, AliHLTPHOSRecPointDataStruct* recPoint)
146 //see header file for documentation
147 UInt_t max = TMath::Min((Int_t)fDigitContainerPtr->fNDigits, (Int_t)fMaxDigitIndexDiff+index);
148 UInt_t min = TMath::Max(0, (Int_t)(index - (Int_t)fMaxDigitIndexDiff));
149 for(UInt_t j = min; j < max; j++)
151 if(fDigitContainerPtr->fDigitDataStruct[j].fEnergy > fEmcMinEnergyThreshold)
153 if(AreNeighbours(&(fDigitContainerPtr->fDigitDataStruct[index]),
154 &(fDigitContainerPtr->fDigitDataStruct[j])))
156 recPoint->fDigitsList[fDigitsInCluster] = fDigitContainerPtr->fDigitDataStruct[j];
157 recPoint->fAmp += fDigitContainerPtr->fDigitDataStruct[j].fEnergy;
158 fDigitContainerPtr->fDigitDataStruct[j].fEnergy = 0;
160 ScanForNeighbourDigits(j, recPoint);
168 AliHLTPHOSClusterizer::AreNeighbours(AliHLTPHOSDigitDataStruct* digit1,
169 AliHLTPHOSDigitDataStruct* digit2)
171 //see header file for documentation
172 if ( (digit1->fModule == digit2->fModule) /*&& (coord1[1]==coord2[1])*/ ) // inside the same PHOS module
174 Int_t rowdiff = TMath::Abs( digit1->fZ - digit2->fZ );
175 Int_t coldiff = TMath::Abs( digit1->fX - digit2->fX );
176 if (( coldiff <= 1 && rowdiff < 1 ) || ( coldiff < 1 && rowdiff <= 1 ))
178 if(TMath::Abs(digit1->fTime - digit2->fTime ) < fEmcTimeGate)