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