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 // AliAODCaloCluster 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 "AliPHOSAodCluster.h"
34 #include "AliPHOSCalibData.h"
35 #include "AliAODCaloCells.h"
37 ClassImp(AliPHOSAodCluster)
39 //____________________________________________________________________________
40 AliPHOSAodCluster::AliPHOSAodCluster() :
41 AliAODCaloCluster(),fRecalibrated(0)
45 //____________________________________________________________________________
46 AliPHOSAodCluster::AliPHOSAodCluster(const AliAODCaloCluster & clu) :
47 AliAODCaloCluster(clu),fRecalibrated(0)
52 //____________________________________________________________________________
53 AliPHOSAodCluster::~AliPHOSAodCluster()
57 //____________________________________________________________________________
58 void AliPHOSAodCluster::Recalibrate(AliPHOSCalibData * calibData,AliAODCaloCells *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 Double32_t * cellsAmpFraction = GetCellsAmplitudeFraction();
74 for(Int_t i=0; i < GetNCells(); i++){
76 phosgeom->AbsToRelNumbering(GetCellAbsId(i),relId) ;
77 Int_t module = relId[0];
78 Int_t column = relId[3];
80 Double_t energy = phsCells->GetCellAmplitude(GetCellAbsId(i)) ;
81 cellsAmpFraction[i]*=energy*calibData->GetADCchannelEmc(module,column,row);
84 SetCellsAmplitudeFraction(cellsAmpFraction);
87 //____________________________________________________________________________
88 void AliPHOSAodCluster::EvalAll(Float_t logWeight, TVector3 &vtx){
89 //If recalibrated - recalculate all cluster parameters
93 EvalEnergy() ; //Energy should be evaluated first
94 EvalCoord(logWeight, vtx) ;
97 //____________________________________________________________________________
98 void AliPHOSAodCluster::EvalEnergy(){
99 if(!fRecalibrated) // no need to recalibrate
103 for(Int_t iDigit=0; iDigit < GetNCells(); iDigit++) {
104 energy+=GetCellAmplitudeFraction(iDigit) ;
108 //Correct for nonlinearity later
111 //____________________________________________________________________________
112 void AliPHOSAodCluster::EnergyCorrection(AliPHOSPIDv1 * pid){
113 //apply nonlinearity correction same as in AliPHOSPIDv1.
114 SetE(pid->GetCalibratedEnergy(E())) ;
116 //____________________________________________________________________________
117 void AliPHOSAodCluster::EvalPID(AliPHOSPIDv1 * /*pid*/){
118 //re-evaluate identification parameters
119 // pid->CalculatePID(E(),GetDispersion(),GetEmcCpvDistance(),GetTOF(),GetPID()) ;
120 // pid->CalculatePID(E(),GetDispersion(),GetM20(),GetM02(),GetEmcCpvDistance(),GetTOF(),GetPID()) ;
122 //____________________________________________________________________________
123 void AliPHOSAodCluster::EvalCoord(Float_t logWeight, TVector3 &vtx)
125 // Calculates new center of gravity in the local PHOS-module coordinates
126 // and tranfers into global ALICE coordinates
127 // Calculates Dispersion and main axis
128 if(!fRecalibrated) // no need to recalibrate
137 AliPHOSGeometry * phosgeom = AliPHOSGeometry::GetInstance() ;
139 AliFatal("AliPHOSGeometry was not contructed\n") ;
141 for(Int_t iDigit=0; iDigit < GetNCells(); iDigit++) {
144 phosgeom->AbsToRelNumbering(GetCellAbsId(iDigit), relid) ;
145 phosgeom->RelPosInModule(relid, xi, zi);
147 Double_t ei=GetCellAmplitudeFraction(iDigit) ;
148 if (E() > 0 && ei > 0) {
149 Float_t w = TMath::Max( 0., logWeight + TMath::Log(ei/E()) ) ;
155 AliError(Form("Wrong energy %f and/or amplitude %f\n", ei, E()));
162 AliError(Form("Wrong weight %f\n", wtot));
165 // Calculates the dispersion and second momenta
170 for(Int_t iDigit=0; iDigit < GetNCells(); iDigit++) {
173 phosgeom->AbsToRelNumbering(GetCellAbsId(iDigit), relid) ;
174 phosgeom->RelPosInModule(relid, xi, zi);
175 Double_t ei=GetCellAmplitudeFraction(iDigit) ;
176 if (E() > 0 && ei > 0) {
177 Float_t w = TMath::Max( 0., logWeight + TMath::Log(ei/E()) ) ;
178 d += w*((xi-xMean)*(xi-xMean) + (zi-zMean)*(zi-zMean) ) ;
184 AliError(Form("Wrong energy %f and/or amplitude %f\n", ei, E()));
192 dxx -= xMean * xMean ;
193 dzz -= zMean * zMean ;
194 dxz -= xMean * zMean ;
195 SetM02(0.5 * (dxx + dzz) + TMath::Sqrt( 0.25 * (dxx - dzz) * (dxx - dzz) + dxz * dxz )) ;
196 SetM20(0.5 * (dxx + dzz) - TMath::Sqrt( 0.25 * (dxx - dzz) * (dxx - dzz) + dxz * dxz ));
199 AliError(Form("Wrong weight %f\n", wtot));
206 SetDispersion(TMath::Sqrt(d)) ;
211 // Correction for the depth of the shower starting point (TDR p 127)
212 Float_t para = 0.925 ;
213 Float_t parb = 6.52 ;
216 phosgeom->GetIncidentVector(vtx,phosMod,xMean,zMean,vInc) ;
220 if (E()>0&&vInc.Y()!=0.) {
221 depthx = ( para * TMath::Log(E()) + parb ) * vInc.X()/TMath::Abs(vInc.Y()) ;
222 depthz = ( para * TMath::Log(E()) + parb ) * vInc.Z()/TMath::Abs(vInc.Y()) ;
225 AliError(Form("Wrong amplitude %f\n", E()));
230 //Go to the global system
232 phosgeom->Local2Global(phosMod, xMean, zMean, gps) ;
233 SetPosition(0, gps[0]) ;
234 SetPosition(1, gps[1]) ;
235 SetPosition(2, gps[2]) ;