Effective c++ corrections (T.Pocheptsov)
[u/mrichter/AliRoot.git] / PHOS / AliPHOSRecCpvManager.cxx
CommitLineData
cbd576a6 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
15
16
386aef34 17//_________________________________________________________________________
cbd576a6 18// Class for the management by the CPV reconstruction.
386aef34 19////
cbd576a6 20//*-- Author : Boris Polichtchouk (IHEP, Protvino) 6 Mar 2001
21//
22// --- ROOT system ---
23
24// --- Standard library ---
25
cbd576a6 26// --- AliRoot header files ---
27
28#include "AliPHOSRecCpvManager.h"
e957fea8 29#include "AliPHOSGeometry.h"
30#include "AliPHOSLoader.h"
cbd576a6 31
32ClassImp(AliPHOSRecCpvManager)
33
34//____________________________________________________________________________
3f7dbdb7 35AliPHOSRecCpvManager::AliPHOSRecCpvManager() :
36 fOneGamChisqCut(3.),
37 fOneGamInitialStep(0.00005),
38 fOneGamChisqMin(1.),
39 fOneGamStepMin(0.0005),
40 fOneGamNumOfIterations(50),
41 fTwoGamInitialStep(0.00005),
42 fTwoGamChisqMin(1.),
43 fTwoGamEmin(0.1),
44 fTwoGamStepMin(0.00005),
45 fTwoGamNumOfIterations(50),
46 fThr0(0.),
47 fSqdCut(0.)
cbd576a6 48{
133fff9a 49 // Put a comment here
cbd576a6 50 SetTitle("Cpv Reconstruction Manager");
51}
52
133fff9a 53AliPHOSRecCpvManager::~AliPHOSRecCpvManager(void)
54{
55 // Put a comment here
56}
cbd576a6 57
90cceaf6 58Float_t AliPHOSRecCpvManager::Dispersion(Float_t etot, Float_t ai) const
cbd576a6 59{
60 //"Dispresion" of energy deposition in the cell.
133fff9a 61 // etot is the total shower energy, ai is the
cbd576a6 62 // calculated cell response,
133fff9a 63 // ei is the measured cell response.
cbd576a6 64
133fff9a 65 const Float_t kConst = 1.5;
66 return kConst*ai*(1.-ai/etot);
cbd576a6 67}
68
386aef34 69Float_t AliPHOSRecCpvManager::OneGamChi2(Float_t ai, Float_t ei, Float_t etot, Float_t& Gi) const
cbd576a6 70{
71 //"Chi2" for one cell.
133fff9a 72 // etot is the total "shower" energy, ai is the
cbd576a6 73 // calculated cell response,
133fff9a 74 // ei is the measured cell response.
cbd576a6 75
133fff9a 76 const Float_t kConst = 1.5;
cbd576a6 77
133fff9a 78 Float_t da = ai - ei;
79 Float_t d = kConst*ai*(1.-ai/etot);
cbd576a6 80
133fff9a 81 Float_t dd = da/d;
82 Gi = dd*(2.- dd*kConst*(1.-2.*ai/etot));
cbd576a6 83
133fff9a 84 Info("OneGamChi2", " OneGamChi2 (ai,ei,etot,&Gi,chi2) %f %f %f %f %f", ai, ei, etot, Gi, da*da/d );
cbd576a6 85
133fff9a 86 return da*da/d;
cbd576a6 87
88}
89
133fff9a 90Float_t AliPHOSRecCpvManager::TwoGamChi2(Float_t ai, Float_t ei, Float_t etot, Float_t& gi) const
cbd576a6 91{
133fff9a 92 // Put a comment here
cbd576a6 93
133fff9a 94 const Float_t kConst = 1.5;
cbd576a6 95
133fff9a 96 Float_t da = ai - ei;
97 Float_t d = kConst*ai*(1.-ai/etot);
cbd576a6 98
133fff9a 99 Float_t dd = da/d;
100 gi = dd*(2.- dd*kConst*(1.-2.*ai/etot));
cbd576a6 101
133fff9a 102 return da*da/d;
cbd576a6 103
104}
105
133fff9a 106void AliPHOSRecCpvManager::AG(Float_t ei, Float_t xi, Float_t yi, Float_t& ai, Float_t& gxi, Float_t& gyi )
cbd576a6 107{
133fff9a 108 //Calculates amplitude (ai) and gradients (gxi, gyi) of CPV pad response.
109 //Integrated response (total "shower energy") is e,
110 //xi and yi are the distances along x and y from reference point
cbd576a6 111 // to the pad center.
112
88cb7938 113 AliPHOSGeometry * geom = AliPHOSLoader::GetPHOSGeometry();
114
133fff9a 115 Float_t celZ = geom->GetPadSizeZ();
116 Float_t celY = geom->GetPadSizePhi();
cbd576a6 117
133fff9a 118// // Info("AG", "celZ: %f celY: %f", celZ, celY) ;
cbd576a6 119
133fff9a 120 Float_t dx = celZ/2.;
121 Float_t dy = celY/2.;
cbd576a6 122
133fff9a 123// // Float_t x = xi*celZ;
124// // Float_t y = yi*celZ;
cbd576a6 125
133fff9a 126 Float_t x = xi*celZ;
127 Float_t y = yi*celY;
cbd576a6 128
133fff9a 129 Float_t e = ei;
cbd576a6 130
133fff9a 131 Float_t a = Fcml(x+dx,y+dy) - Fcml(x+dx,y-dy) - Fcml(x-dx,y+dy) + Fcml(x-dx,y-dy);
132 ai = a*e;
cbd576a6 133
134
133fff9a 135 Float_t gx = GradX(x+dx,y+dy) - GradX(x+dx,y-dy) - GradX(x-dx,y+dy) + GradX(x-dx,y-dy);
136 gxi = gx*e*e;
cbd576a6 137
133fff9a 138 Float_t gy = GradY(x+dx,y+dy) - GradY(x+dx,y-dy) - GradY(x-dx,y+dy) + GradY(x-dx,y-dy);
139 gyi = gy*e*e;
cbd576a6 140
141}
142
143Float_t AliPHOSRecCpvManager::Fcml(Float_t x, Float_t y)
144{
145 //Cumulative function
146
133fff9a 147 const Float_t ka = 1.0;
148 const Float_t kb = 0.70;
cbd576a6 149
133fff9a 150 Float_t fff = TMath::ATan(x*y/( kb*TMath::Sqrt( (kb*kb) + x*x+y*y)))
151 - TMath::ATan(x*y/(3*kb*TMath::Sqrt((3*kb)*(3*kb) + x*x+y*y)))
152 + TMath::ATan(x*y/(5*kb*TMath::Sqrt((5*kb)*(5*kb) + x*x+y*y)))
153 - TMath::ATan(x*y/(7*kb*TMath::Sqrt((7*kb)*(7*kb) + x*x+y*y)))
154 + TMath::ATan(x*y/(9*kb*TMath::Sqrt((9*kb)*(9*kb) + x*x+y*y)));
cbd576a6 155
386aef34 156 Float_t fcml = ka*fff/TMath::TwoPi();
133fff9a 157// Info("Fcml", "fcml: %f", fcml) ;
158 return fcml;
cbd576a6 159
160}
161
162
163Float_t AliPHOSRecCpvManager::GradX(Float_t x, Float_t y)
164{
133fff9a 165 // Put a comment here
cbd576a6 166
133fff9a 167 const Float_t ka = 1.0;
168 const Float_t kb = 0.70;
cbd576a6 169
133fff9a 170 Float_t skv = kb*kb + x*x + y*y;
cbd576a6 171
133fff9a 172 Float_t gradient = y*(1.-x*x/skv)* kb*TMath::Sqrt(skv)/( kb*kb*skv+x*x*y*y)
173 - y*(1.-x*x/skv)*3*kb*TMath::Sqrt(skv)/((3*kb)*(3*kb)*skv+x*x*y*y)
174 + y*(1.-x*x/skv)*5*kb*TMath::Sqrt(skv)/((5*kb)*(5*kb)*skv+x*x*y*y)
175 - y*(1.-x*x/skv)*7*kb*TMath::Sqrt(skv)/((7*kb)*(7*kb)*skv+x*x*y*y)
176 + y*(1.-x*x/skv)*9*kb*TMath::Sqrt(skv)/((9*kb)*(9*kb)*skv+x*x*y*y);
cbd576a6 177
386aef34 178 Float_t grad = ka*gradient/TMath::TwoPi();
133fff9a 179 return grad;
cbd576a6 180}
181
182
183Float_t AliPHOSRecCpvManager::GradY(Float_t x, Float_t y)
184{
133fff9a 185 // Put a comment here
cbd576a6 186
386aef34 187 const Float_t ka = 1.0;
133fff9a 188 const Float_t kb = 0.70;
cbd576a6 189
133fff9a 190 Float_t skv = kb*kb + x*x + y*y;
191 Float_t gradient = x*(1.-y*y/skv)* kb*TMath::Sqrt(skv)/( kb*kb*skv+x*x*y*y)
192 - x*(1.-y*y/skv)*3*kb*TMath::Sqrt(skv)/((3*kb)*(3*kb)*skv+x*x*y*y)
193 + x*(1.-y*y/skv)*5*kb*TMath::Sqrt(skv)/((5*kb)*(5*kb)*skv+x*x*y*y)
194 - x*(1.-y*y/skv)*7*kb*TMath::Sqrt(skv)/((7*kb)*(7*kb)*skv+x*x*y*y)
195 + x*(1.-y*y/skv)*9*kb*TMath::Sqrt(skv)/((9*kb)*(9*kb)*skv+x*x*y*y);
cbd576a6 196
386aef34 197 Float_t grad = ka*gradient/TMath::TwoPi();
133fff9a 198 return grad;
cbd576a6 199}
200
201