Initial commitment
[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//____________________________________________________________________________
35
36 AliPHOSRecCpvManager::AliPHOSRecCpvManager()
37{
133fff9a 38 // Put a comment here
cbd576a6 39
40 fOneGamChisqCut = 3.; // If Chi2/dof > fOneGamChisqCut, split point.
41
42 fOneGamInitialStep = 0.00005;
43 fOneGamChisqMin = 1.;
44 fOneGamStepMin = 0.0005;
45 fOneGamNumOfIterations = 50;
46
47 fTwoGamInitialStep = 0.00005;
48 fTwoGamChisqMin = 1.;
49 fTwoGamEmin = 0.1;
50 fTwoGamStepMin = 0.00005;
51 fTwoGamNumOfIterations = 50;
52
53// fThr0 = 0.0285; // Min. energy of rec. point. If E<fThr0, point deleted.
54// fSqdCut = 3.; // Min. distance (in cm) between two rec points.
55
56 fThr0 = 0.;
57 fSqdCut = 0.;
58
59 SetTitle("Cpv Reconstruction Manager");
60}
61
133fff9a 62AliPHOSRecCpvManager::~AliPHOSRecCpvManager(void)
63{
64 // Put a comment here
65}
cbd576a6 66
90cceaf6 67Float_t AliPHOSRecCpvManager::Dispersion(Float_t etot, Float_t ai) const
cbd576a6 68{
69 //"Dispresion" of energy deposition in the cell.
133fff9a 70 // etot is the total shower energy, ai is the
cbd576a6 71 // calculated cell response,
133fff9a 72 // ei is the measured cell response.
cbd576a6 73
133fff9a 74 const Float_t kConst = 1.5;
75 return kConst*ai*(1.-ai/etot);
cbd576a6 76}
77
386aef34 78Float_t AliPHOSRecCpvManager::OneGamChi2(Float_t ai, Float_t ei, Float_t etot, Float_t& Gi) const
cbd576a6 79{
80 //"Chi2" for one cell.
133fff9a 81 // etot is the total "shower" energy, ai is the
cbd576a6 82 // calculated cell response,
133fff9a 83 // ei is the measured cell response.
cbd576a6 84
133fff9a 85 const Float_t kConst = 1.5;
cbd576a6 86
133fff9a 87 Float_t da = ai - ei;
88 Float_t d = kConst*ai*(1.-ai/etot);
cbd576a6 89
133fff9a 90 Float_t dd = da/d;
91 Gi = dd*(2.- dd*kConst*(1.-2.*ai/etot));
cbd576a6 92
133fff9a 93 Info("OneGamChi2", " OneGamChi2 (ai,ei,etot,&Gi,chi2) %f %f %f %f %f", ai, ei, etot, Gi, da*da/d );
cbd576a6 94
133fff9a 95 return da*da/d;
cbd576a6 96
97}
98
133fff9a 99Float_t AliPHOSRecCpvManager::TwoGamChi2(Float_t ai, Float_t ei, Float_t etot, Float_t& gi) const
cbd576a6 100{
133fff9a 101 // Put a comment here
cbd576a6 102
133fff9a 103 const Float_t kConst = 1.5;
cbd576a6 104
133fff9a 105 Float_t da = ai - ei;
106 Float_t d = kConst*ai*(1.-ai/etot);
cbd576a6 107
133fff9a 108 Float_t dd = da/d;
109 gi = dd*(2.- dd*kConst*(1.-2.*ai/etot));
cbd576a6 110
133fff9a 111 return da*da/d;
cbd576a6 112
113}
114
133fff9a 115void AliPHOSRecCpvManager::AG(Float_t ei, Float_t xi, Float_t yi, Float_t& ai, Float_t& gxi, Float_t& gyi )
cbd576a6 116{
133fff9a 117 //Calculates amplitude (ai) and gradients (gxi, gyi) of CPV pad response.
118 //Integrated response (total "shower energy") is e,
119 //xi and yi are the distances along x and y from reference point
cbd576a6 120 // to the pad center.
121
88cb7938 122 AliPHOSGeometry * geom = AliPHOSLoader::GetPHOSGeometry();
123
133fff9a 124 Float_t celZ = geom->GetPadSizeZ();
125 Float_t celY = geom->GetPadSizePhi();
cbd576a6 126
133fff9a 127// // Info("AG", "celZ: %f celY: %f", celZ, celY) ;
cbd576a6 128
133fff9a 129 Float_t dx = celZ/2.;
130 Float_t dy = celY/2.;
cbd576a6 131
133fff9a 132// // Float_t x = xi*celZ;
133// // Float_t y = yi*celZ;
cbd576a6 134
133fff9a 135 Float_t x = xi*celZ;
136 Float_t y = yi*celY;
cbd576a6 137
133fff9a 138 Float_t e = ei;
cbd576a6 139
133fff9a 140 Float_t a = Fcml(x+dx,y+dy) - Fcml(x+dx,y-dy) - Fcml(x-dx,y+dy) + Fcml(x-dx,y-dy);
141 ai = a*e;
cbd576a6 142
143
133fff9a 144 Float_t gx = GradX(x+dx,y+dy) - GradX(x+dx,y-dy) - GradX(x-dx,y+dy) + GradX(x-dx,y-dy);
145 gxi = gx*e*e;
cbd576a6 146
133fff9a 147 Float_t gy = GradY(x+dx,y+dy) - GradY(x+dx,y-dy) - GradY(x-dx,y+dy) + GradY(x-dx,y-dy);
148 gyi = gy*e*e;
cbd576a6 149
150}
151
152Float_t AliPHOSRecCpvManager::Fcml(Float_t x, Float_t y)
153{
154 //Cumulative function
155
133fff9a 156 const Float_t ka = 1.0;
157 const Float_t kb = 0.70;
cbd576a6 158
133fff9a 159 Float_t fff = TMath::ATan(x*y/( kb*TMath::Sqrt( (kb*kb) + x*x+y*y)))
160 - TMath::ATan(x*y/(3*kb*TMath::Sqrt((3*kb)*(3*kb) + x*x+y*y)))
161 + TMath::ATan(x*y/(5*kb*TMath::Sqrt((5*kb)*(5*kb) + x*x+y*y)))
162 - TMath::ATan(x*y/(7*kb*TMath::Sqrt((7*kb)*(7*kb) + x*x+y*y)))
163 + TMath::ATan(x*y/(9*kb*TMath::Sqrt((9*kb)*(9*kb) + x*x+y*y)));
cbd576a6 164
386aef34 165 Float_t fcml = ka*fff/TMath::TwoPi();
133fff9a 166// Info("Fcml", "fcml: %f", fcml) ;
167 return fcml;
cbd576a6 168
169}
170
171
172Float_t AliPHOSRecCpvManager::GradX(Float_t x, Float_t y)
173{
133fff9a 174 // Put a comment here
cbd576a6 175
133fff9a 176 const Float_t ka = 1.0;
177 const Float_t kb = 0.70;
cbd576a6 178
133fff9a 179 Float_t skv = kb*kb + x*x + y*y;
cbd576a6 180
133fff9a 181 Float_t gradient = y*(1.-x*x/skv)* kb*TMath::Sqrt(skv)/( kb*kb*skv+x*x*y*y)
182 - y*(1.-x*x/skv)*3*kb*TMath::Sqrt(skv)/((3*kb)*(3*kb)*skv+x*x*y*y)
183 + y*(1.-x*x/skv)*5*kb*TMath::Sqrt(skv)/((5*kb)*(5*kb)*skv+x*x*y*y)
184 - y*(1.-x*x/skv)*7*kb*TMath::Sqrt(skv)/((7*kb)*(7*kb)*skv+x*x*y*y)
185 + y*(1.-x*x/skv)*9*kb*TMath::Sqrt(skv)/((9*kb)*(9*kb)*skv+x*x*y*y);
cbd576a6 186
386aef34 187 Float_t grad = ka*gradient/TMath::TwoPi();
133fff9a 188 return grad;
cbd576a6 189}
190
191
192Float_t AliPHOSRecCpvManager::GradY(Float_t x, Float_t y)
193{
133fff9a 194 // Put a comment here
cbd576a6 195
386aef34 196 const Float_t ka = 1.0;
133fff9a 197 const Float_t kb = 0.70;
cbd576a6 198
133fff9a 199 Float_t skv = kb*kb + x*x + y*y;
200 Float_t gradient = x*(1.-y*y/skv)* kb*TMath::Sqrt(skv)/( kb*kb*skv+x*x*y*y)
201 - x*(1.-y*y/skv)*3*kb*TMath::Sqrt(skv)/((3*kb)*(3*kb)*skv+x*x*y*y)
202 + x*(1.-y*y/skv)*5*kb*TMath::Sqrt(skv)/((5*kb)*(5*kb)*skv+x*x*y*y)
203 - x*(1.-y*y/skv)*7*kb*TMath::Sqrt(skv)/((7*kb)*(7*kb)*skv+x*x*y*y)
204 + x*(1.-y*y/skv)*9*kb*TMath::Sqrt(skv)/((9*kb)*(9*kb)*skv+x*x*y*y);
cbd576a6 205
386aef34 206 Float_t grad = ka*gradient/TMath::TwoPi();
133fff9a 207 return grad;
cbd576a6 208}
209
210