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