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 "AliPHOSReconstructor.h"
34 #include "AliPHOSAodCluster.h"
35 #include "AliPHOSCalibData.h"
36 #include "AliAODCaloCells.h"
38 ClassImp(AliPHOSAodCluster)
40 //____________________________________________________________________________
41 AliPHOSAodCluster::AliPHOSAodCluster() :
42 AliAODCaloCluster(),fRecalibrated(0)
46 //____________________________________________________________________________
47 AliPHOSAodCluster::AliPHOSAodCluster(const AliAODCaloCluster & clu) :
48 AliAODCaloCluster(clu),fRecalibrated(0)
53 //____________________________________________________________________________
54 AliPHOSAodCluster::~AliPHOSAodCluster()
58 //____________________________________________________________________________
59 void AliPHOSAodCluster::Recalibrate(AliPHOSCalibData * calibData,AliAODCaloCells *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 Double32_t * cellsAmpFraction = GetCellsAmplitudeFraction();
75 for(Int_t i=0; i < GetNCells(); i++){
77 phosgeom->AbsToRelNumbering(GetCellAbsId(i),relId) ;
78 Int_t module = relId[0];
79 Int_t column = relId[3];
81 Double_t energy = phsCells->GetCellAmplitude(GetCellAbsId(i)) ;
82 cellsAmpFraction[i]*=energy*calibData->GetADCchannelEmc(module,column,row);
85 SetCellsAmplitudeFraction(cellsAmpFraction);
88 //____________________________________________________________________________
89 void AliPHOSAodCluster::EvalAll(Float_t logWeight, TVector3 &vtx){
90 //If recalibrated - recalculate all cluster parameters
94 EvalEnergy() ; //Energy should be evaluated first
95 EvalCoord(logWeight, vtx) ;
98 //____________________________________________________________________________
99 void AliPHOSAodCluster::EvalEnergy(){
100 if(!fRecalibrated) // no need to recalibrate
104 for(Int_t iDigit=0; iDigit < GetNCells(); iDigit++) {
105 energy+=GetCellAmplitudeFraction(iDigit) ;
109 //Correct for nonlinearity later
112 //____________________________________________________________________________
113 void AliPHOSAodCluster::EnergyCorrection(){
114 //apply nonlinearity correction same as in AliPHOSPIDv1.
115 SetE(AliPHOSReconstructor::CorrectNonlinearity(E())) ;
117 //____________________________________________________________________________
118 void AliPHOSAodCluster::EvalPID(AliPHOSPIDv1 * /*pid*/){
119 //re-evaluate identification parameters
120 // pid->CalculatePID(E(),GetDispersion(),GetEmcCpvDistance(),GetTOF(),GetPID()) ;
121 // pid->CalculatePID(E(),GetDispersion(),GetM20(),GetM02(),GetEmcCpvDistance(),GetTOF(),GetPID()) ;
123 //____________________________________________________________________________
124 void AliPHOSAodCluster::EvalCoord(Float_t logWeight, TVector3 &vtx)
126 // Calculates new center of gravity in the local PHOS-module coordinates
127 // and tranfers into global ALICE coordinates
128 // Calculates Dispersion and main axis
129 if(!fRecalibrated) // no need to recalibrate
138 AliPHOSGeometry * phosgeom = AliPHOSGeometry::GetInstance() ;
140 AliFatal("AliPHOSGeometry was not contructed\n") ;
142 for(Int_t iDigit=0; iDigit < GetNCells(); iDigit++) {
145 phosgeom->AbsToRelNumbering(GetCellAbsId(iDigit), relid) ;
146 phosgeom->RelPosInModule(relid, xi, zi);
148 Double_t ei=GetCellAmplitudeFraction(iDigit) ;
149 if (E() > 0 && ei > 0) {
150 Float_t w = TMath::Max( 0., logWeight + TMath::Log(ei/E()) ) ;
156 AliError(Form("Wrong energy %f and/or amplitude %f\n", ei, E()));
163 AliError(Form("Wrong weight %f\n", wtot));
166 // Calculates the dispersion and second momenta
171 for(Int_t iDigit=0; iDigit < GetNCells(); iDigit++) {
174 phosgeom->AbsToRelNumbering(GetCellAbsId(iDigit), relid) ;
175 phosgeom->RelPosInModule(relid, xi, zi);
176 Double_t ei=GetCellAmplitudeFraction(iDigit) ;
177 if (E() > 0 && ei > 0) {
178 Float_t w = TMath::Max( 0., logWeight + TMath::Log(ei/E()) ) ;
179 d += w*((xi-xMean)*(xi-xMean) + (zi-zMean)*(zi-zMean) ) ;
185 AliError(Form("Wrong energy %f and/or amplitude %f\n", ei, E()));
193 dxx -= xMean * xMean ;
194 dzz -= zMean * zMean ;
195 dxz -= xMean * zMean ;
196 SetM02(0.5 * (dxx + dzz) + TMath::Sqrt( 0.25 * (dxx - dzz) * (dxx - dzz) + dxz * dxz )) ;
197 SetM20(0.5 * (dxx + dzz) - TMath::Sqrt( 0.25 * (dxx - dzz) * (dxx - dzz) + dxz * dxz ));
200 AliError(Form("Wrong weight %f\n", wtot));
207 SetDispersion(TMath::Sqrt(d)) ;
212 // Correction for the depth of the shower starting point (TDR p 127)
213 Float_t para = 0.925 ;
214 Float_t parb = 6.52 ;
217 phosgeom->GetIncidentVector(vtx,phosMod,xMean,zMean,vInc) ;
221 if (E()>0&&vInc.Y()!=0.) {
222 depthx = ( para * TMath::Log(E()) + parb ) * vInc.X()/TMath::Abs(vInc.Y()) ;
223 depthz = ( para * TMath::Log(E()) + parb ) * vInc.Z()/TMath::Abs(vInc.Y()) ;
226 AliError(Form("Wrong amplitude %f\n", E()));
231 //Go to the global system
233 phosgeom->Local2Global(phosMod, xMean, zMean, gps) ;
234 SetPositionAt(gps[0],0) ;
235 SetPositionAt(gps[1],1) ;
236 SetPositionAt(gps[2],2) ;