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 "AliPHOSEsdCluster.h"
34 #include "AliPHOSCalibData.h"
35 #include "AliESDCaloCells.h"
37 ClassImp(AliPHOSEsdCluster)
39 //____________________________________________________________________________
40 AliPHOSEsdCluster::AliPHOSEsdCluster() :
41 AliESDCaloCluster(),fRecalibrated(0)
45 //____________________________________________________________________________
46 AliPHOSEsdCluster::AliPHOSEsdCluster(const AliESDCaloCluster & clu) :
47 AliESDCaloCluster(clu),fRecalibrated(0)
52 //____________________________________________________________________________
53 AliPHOSEsdCluster::~AliPHOSEsdCluster()
57 //____________________________________________________________________________
58 void AliPHOSEsdCluster::Recalibrate(AliPHOSCalibData * calibData,AliESDCaloCells *phsCells){
59 //If not done yet, apply recalibration coefficients to energies list
60 //NOTE that after recalibration fCellsAmpFraction contains not FRACTION but FULL energy
68 AliPHOSGeometry * phosgeom = AliPHOSGeometry::GetInstance() ;
70 AliFatal("AliPHOSGeometry was not contructed\n") ;
72 for(Int_t i=0; i<fNCells; i++){
74 phosgeom->AbsToRelNumbering(fCellsAbsId[i],relId) ;
75 Int_t module = relId[0];
76 Int_t column = relId[3];
78 Double_t energy = phsCells->GetCellAmplitude(fCellsAbsId[i]) ;
79 fCellsAmpFraction[i]*=energy*calibData->GetADCchannelEmc(module,column,row);
83 //____________________________________________________________________________
84 void AliPHOSEsdCluster::EvalAll(Float_t logWeight, TVector3 &vtx){
85 //If recalibrated - recalculate all cluster parameters
89 EvalEnergy() ; //Energy should be evaluated first
90 EvalCoord(logWeight, vtx) ;
93 //____________________________________________________________________________
94 void AliPHOSEsdCluster::EvalEnergy(){
95 if(!fRecalibrated) // no need to recalibrate
99 for(Int_t iDigit=0; iDigit<fNCells; iDigit++) {
100 fEnergy+=fCellsAmpFraction[iDigit] ;
102 //Correct for nonlinearity later
105 //____________________________________________________________________________
106 void AliPHOSEsdCluster::EnergyCorrection(AliPHOSPIDv1 * pid){
107 //apply nonlinearity correction same as in AliPHOSPIDv1.
108 fEnergy = pid->GetCalibratedEnergy(fEnergy) ;
110 //____________________________________________________________________________
111 void AliPHOSEsdCluster::EvalPID(AliPHOSPIDv1 * /*pid*/){
112 //re-evaluate identification parameters
113 // pid->CalculatePID(fEnergy,fDispersion,fEmcCpvDistance,tof,fPID) ;
114 // pid->CalculatePID(fEnergy,fDispersion,fM20,fM02,fEmcCpvDistance,tof,fPID) ;
116 //____________________________________________________________________________
117 void AliPHOSEsdCluster::EvalCoord(Float_t logWeight, TVector3 &vtx)
119 // Calculates new center of gravity in the local PHOS-module coordinates
120 // and tranfers into global ALICE coordinates
121 // Calculates Dispersion and main axis
122 if(!fRecalibrated) // no need to recalibrate
131 AliPHOSGeometry * phosgeom = AliPHOSGeometry::GetInstance() ;
133 AliFatal("AliPHOSGeometry was not contructed\n") ;
135 for(Int_t iDigit=0; iDigit<fNCells; iDigit++) {
138 phosgeom->AbsToRelNumbering(fCellsAbsId[iDigit], relid) ;
139 phosgeom->RelPosInModule(relid, xi, zi);
141 Double_t ei=fCellsAmpFraction[iDigit] ;
142 if (fEnergy>0 && ei>0) {
143 Float_t w = TMath::Max( 0., logWeight + TMath::Log(ei/fEnergy) ) ;
149 AliError(Form("Wrong energy %f and/or amplitude %f\n", ei, fEnergy));
156 AliError(Form("Wrong weight %f\n", wtot));
159 // Calculates the dispersion and second momenta
164 for(Int_t iDigit=0; iDigit < fNCells; iDigit++) {
167 phosgeom->AbsToRelNumbering(fCellsAbsId[iDigit], relid) ;
168 phosgeom->RelPosInModule(relid, xi, zi);
169 Double_t ei=fCellsAmpFraction[iDigit] ;
170 if (fEnergy>0 && ei>0) {
171 Float_t w = TMath::Max( 0., logWeight + TMath::Log(ei/fEnergy) ) ;
172 d += w*((xi-xMean)*(xi-xMean) + (zi-zMean)*(zi-zMean) ) ;
178 AliError(Form("Wrong energy %f and/or amplitude %f\n", ei, fEnergy));
186 dxx -= xMean * xMean ;
187 dzz -= zMean * zMean ;
188 dxz -= xMean * zMean ;
189 fM02 = 0.5 * (dxx + dzz) + TMath::Sqrt( 0.25 * (dxx - dzz) * (dxx - dzz) + dxz * dxz ) ;
190 fM20 = 0.5 * (dxx + dzz) - TMath::Sqrt( 0.25 * (dxx - dzz) * (dxx - dzz) + dxz * dxz ) ;
193 AliError(Form("Wrong weight %f\n", wtot));
200 fDispersion = TMath::Sqrt(d) ;
205 // Correction for the depth of the shower starting point (TDR p 127)
206 Float_t para = 0.925 ;
207 Float_t parb = 6.52 ;
210 phosgeom->GetIncidentVector(vtx,phosMod,xMean,zMean,vInc) ;
214 if (fEnergy>0&&vInc.Y()!=0.) {
215 depthx = ( para * TMath::Log(fEnergy) + parb ) * vInc.X()/TMath::Abs(vInc.Y()) ;
216 depthz = ( para * TMath::Log(fEnergy) + parb ) * vInc.Z()/TMath::Abs(vInc.Y()) ;
219 AliError(Form("Wrong amplitude %f\n", fEnergy));
224 //Go to the global system
226 phosgeom->Local2Global(phosMod, xMean, zMean, gps) ;
227 fGlobalPos[0]=gps[0] ;
228 fGlobalPos[1]=gps[1] ;
229 fGlobalPos[2]=gps[2] ;