1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 //_________________________________________________________________________
17 // AliESDCaloCluster extension for PHOS to recalculate cluster
18 // parameters in case of recalibration.
20 //*-- Author: Dmitri Peressounko (RRC KI)
23 // --- ROOT system ---
27 // --- Standard library ---
29 // --- AliRoot header files ---
31 #include "AliPHOSGeometry.h"
32 #include "AliPHOSPIDv1.h"
33 #include "AliPHOSReconstructor.h"
34 #include "AliPHOSEsdCluster.h"
35 #include "AliPHOSCalibData.h"
36 #include "AliESDCaloCells.h"
38 ClassImp(AliPHOSEsdCluster)
40 //____________________________________________________________________________
41 AliPHOSEsdCluster::AliPHOSEsdCluster() :
42 AliESDCaloCluster(),fRecalibrated(0)
46 //____________________________________________________________________________
47 AliPHOSEsdCluster::AliPHOSEsdCluster(const AliESDCaloCluster & clu) :
48 AliESDCaloCluster(clu),fRecalibrated(0)
53 //____________________________________________________________________________
54 AliPHOSEsdCluster::~AliPHOSEsdCluster()
58 //____________________________________________________________________________
59 void AliPHOSEsdCluster::Recalibrate(AliPHOSCalibData * calibData,AliESDCaloCells *phsCells){
60 //If not done yet, apply recalibration coefficients to energies list
61 //NOTE that after recalibration fCellsAmpFraction contains not FRACTION but FULL energy
69 AliPHOSGeometry * phosgeom = AliPHOSGeometry::GetInstance() ;
71 AliFatal("AliPHOSGeometry was not contructed\n") ;
73 for(Int_t i=0; i<fNCells; i++){
75 phosgeom->AbsToRelNumbering(fCellsAbsId[i],relId) ;
76 Int_t module = relId[0];
77 Int_t column = relId[3];
79 Double_t energy = phsCells->GetCellAmplitude(fCellsAbsId[i]) ;
80 fCellsAmpFraction[i]*=energy*calibData->GetADCchannelEmc(module,column,row);
85 //____________________________________________________________________________
86 void AliPHOSEsdCluster::EvalAll(Float_t logWeight, TVector3 &vtx){
87 //If recalibrated - recalculate all cluster parameters
91 EvalEnergy() ; //Energy should be evaluated first
92 EvalCoord(logWeight, vtx) ;
95 //____________________________________________________________________________
96 void AliPHOSEsdCluster::EvalEnergy(){
97 if(!fRecalibrated) // no need to recalibrate
101 for(Int_t iDigit=0; iDigit<fNCells; iDigit++) {
102 fEnergy+=fCellsAmpFraction[iDigit] ;
104 //Correct for nonlinearity later
106 //____________________________________________________________________________
107 void AliPHOSEsdCluster::EnergyCorrection(){
108 //apply nonlinearity correction
109 fEnergy = AliPHOSReconstructor::CorrectNonlinearity(fEnergy) ;
111 //____________________________________________________________________________
112 void AliPHOSEsdCluster::EvalPID(AliPHOSPIDv1 * /*pid*/){
113 //re-evaluate identification parameters
114 // pid->CalculatePID(fEnergy,fDispersion,fEmcCpvDistance,tof,fPID) ;
115 // pid->CalculatePID(fEnergy,fDispersion,fM20,fM02,fEmcCpvDistance,tof,fPID) ;
117 //____________________________________________________________________________
118 void AliPHOSEsdCluster::EvalCoord(Float_t logWeight, TVector3 &vtx)
120 // Calculates new center of gravity in the local PHOS-module coordinates
121 // and tranfers into global ALICE coordinates
122 // Calculates Dispersion and main axis
123 if(!fRecalibrated) // no need to recalibrate
132 AliPHOSGeometry * phosgeom = AliPHOSGeometry::GetInstance() ;
134 AliFatal("AliPHOSGeometry was not contructed\n") ;
136 for(Int_t iDigit=0; iDigit<fNCells; iDigit++) {
139 phosgeom->AbsToRelNumbering(fCellsAbsId[iDigit], relid) ;
140 phosgeom->RelPosInModule(relid, xi, zi);
142 Double_t ei=fCellsAmpFraction[iDigit] ;
143 if (fEnergy>0 && ei>0) {
144 Float_t w = TMath::Max( 0., logWeight + TMath::Log(ei/fEnergy) ) ;
150 AliError(Form("Wrong energy %f and/or amplitude %f\n", ei, fEnergy));
157 AliError(Form("Wrong weight %f\n", wtot));
160 // Calculates the dispersion and second momenta
165 for(Int_t iDigit=0; iDigit < fNCells; iDigit++) {
168 phosgeom->AbsToRelNumbering(fCellsAbsId[iDigit], relid) ;
169 phosgeom->RelPosInModule(relid, xi, zi);
170 Double_t ei=fCellsAmpFraction[iDigit] ;
171 if (fEnergy>0 && ei>0) {
172 Float_t w = TMath::Max( 0., logWeight + TMath::Log(ei/fEnergy) ) ;
173 d += w*((xi-xMean)*(xi-xMean) + (zi-zMean)*(zi-zMean) ) ;
179 AliError(Form("Wrong energy %f and/or amplitude %f\n", ei, fEnergy));
187 dxx -= xMean * xMean ;
188 dzz -= zMean * zMean ;
189 dxz -= xMean * zMean ;
190 fM02 = 0.5 * (dxx + dzz) + TMath::Sqrt( 0.25 * (dxx - dzz) * (dxx - dzz) + dxz * dxz ) ;
191 fM20 = 0.5 * (dxx + dzz) - TMath::Sqrt( 0.25 * (dxx - dzz) * (dxx - dzz) + dxz * dxz ) ;
194 AliError(Form("Wrong weight %f\n", wtot));
201 fDispersion = TMath::Sqrt(d) ;
206 // Correction for the depth of the shower starting point (TDR p 127)
207 Float_t para = 0.925 ;
208 Float_t parb = 6.52 ;
211 phosgeom->GetIncidentVector(vtx,phosMod,xMean,zMean,vInc) ;
215 if (fEnergy>0&&vInc.Y()!=0.) {
216 depthx = ( para * TMath::Log(fEnergy) + parb ) * vInc.X()/TMath::Abs(vInc.Y()) ;
217 depthz = ( para * TMath::Log(fEnergy) + parb ) * vInc.Z()/TMath::Abs(vInc.Y()) ;
220 AliError(Form("Wrong amplitude %f\n", fEnergy));
225 //Go to the global system
227 phosgeom->Local2Global(phosMod, xMean, zMean, gps) ;
228 fGlobalPos[0]=gps[0] ;
229 fGlobalPos[1]=gps[1] ;
230 fGlobalPos[2]=gps[2] ;