]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PHOS/AliPHOSRecCpvManager.cxx
85e5ba7a2113657dc51d61be2f9ac15bb77e37da
[u/mrichter/AliRoot.git] / PHOS / AliPHOSRecCpvManager.cxx
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
17 //_________________________________________________________________________
18 // Class for the management by the CPV reconstruction.
19 //                  
20 //*-- Author   : Boris Polichtchouk (IHEP, Protvino) 6 Mar 2001
21 //
22 // --- ROOT system ---
23
24 // --- Standard library ---
25
26 // --- AliRoot header files ---
27
28 #include "AliPHOSRecCpvManager.h"
29 #include "AliPHOS.h"
30 #include "AliRun.h"
31 #include "AliPHOSGetter.h"
32
33 ClassImp(AliPHOSRecCpvManager) 
34
35 //____________________________________________________________________________
36
37   AliPHOSRecCpvManager::AliPHOSRecCpvManager()
38 {
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
62 AliPHOSRecCpvManager::~AliPHOSRecCpvManager(void) {}
63
64 Float_t AliPHOSRecCpvManager::Dispersion(Float_t Etot, Float_t Ai, Float_t Ei)
65 {
66   //"Dispresion" of energy deposition in the cell.
67   // Etot is the total shower energy, Ai is the
68   // calculated cell response,
69   // Ei is the measured cell response.
70
71   const Float_t Const = 1.5;
72   return Const*Ai*(1.-Ai/Etot);
73 }
74
75 Float_t AliPHOSRecCpvManager::OneGamChi2(Float_t Ai, Float_t Ei, Float_t Etot, Float_t& Gi)
76 {
77   //"Chi2" for one cell.
78   // Etot is the total "shower" energy, Ai is the
79   // calculated cell response,
80   // Ei is the measured cell response.
81
82   const Float_t Const = 1.5;
83
84   Float_t da = Ai - Ei;
85   Float_t D = Const*Ai*(1.-Ai/Etot);
86
87   Float_t dd = da/D;
88   Gi = dd*(2.- dd*Const*(1.-2.*Ai/Etot));
89
90   Info("OneGamChi2", " OneGamChi2 (Ai,Ei,Etot,&Gi,chi2) %f %f %f %f %f", Ai, Ei, Etot, Gi, da*da/D );
91
92   return da*da/D;
93
94 }
95
96 Float_t AliPHOSRecCpvManager::TwoGamChi2(Float_t Ai, Float_t Ei, Float_t Etot, Float_t& Gi)
97 {
98
99   const Float_t Const = 1.5;
100
101   Float_t da = Ai - Ei;
102   Float_t D = Const*Ai*(1.-Ai/Etot);
103
104   Float_t dd = da/D;
105   Gi = dd*(2.- dd*Const*(1.-2.*Ai/Etot));
106
107   return da*da/D;
108  
109 }
110
111 void AliPHOSRecCpvManager::AG(Float_t Ei, Float_t Xi, Float_t Yi, Float_t& Ai, Float_t& GXi, Float_t& GYi )
112 {
113   //Calculates amplitude (Ai) and gradients (GXi, GYi) of CPV pad response.
114   //Integrated response (total "shower energy") is E, 
115   //Xi and Yi are the distances along x and y from reference point 
116   // to the pad center.
117
118   AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; 
119   const AliPHOSGeometry* geom = gime->PHOSGeometry();
120   Float_t CelZ = geom->GetPadSizeZ();
121   Float_t CelY = geom->GetPadSizePhi();
122
123 //  //    Info("AG", "CelZ: %f CelY: %f", CelZ, CelY) ;
124
125   Float_t dx = CelZ/2.;
126   Float_t dy = CelY/2.;
127
128 //  //    Float_t x = Xi*CelZ;
129 //  //    Float_t y = Yi*CelZ;
130
131   Float_t x = Xi*CelZ;
132   Float_t y = Yi*CelY;
133
134   Float_t E = Ei;
135
136   Float_t A = Fcml(x+dx,y+dy) - Fcml(x+dx,y-dy) - Fcml(x-dx,y+dy) + Fcml(x-dx,y-dy);
137   Ai = A*E;
138
139
140   Float_t Gx = GradX(x+dx,y+dy) - GradX(x+dx,y-dy) - GradX(x-dx,y+dy) + GradX(x-dx,y-dy);
141   GXi = Gx*E*E;
142
143   Float_t Gy = GradY(x+dx,y+dy) - GradY(x+dx,y-dy) - GradY(x-dx,y+dy) + GradY(x-dx,y-dy);
144   GYi = Gy*E*E;
145
146 }
147
148 Float_t AliPHOSRecCpvManager::Fcml(Float_t x, Float_t y)
149 {
150   //Cumulative function
151
152   const Float_t A = 1.0;
153   const Float_t b = 0.70;
154
155   Float_t Fff  = TMath::ATan(x*y/(  b*TMath::Sqrt(  (b*b) + x*x+y*y)))
156     - TMath::ATan(x*y/(3*b*TMath::Sqrt((3*b)*(3*b) + x*x+y*y)))
157     + TMath::ATan(x*y/(5*b*TMath::Sqrt((5*b)*(5*b) + x*x+y*y))) 
158     - TMath::ATan(x*y/(7*b*TMath::Sqrt((7*b)*(7*b) + x*x+y*y)))
159     + TMath::ATan(x*y/(9*b*TMath::Sqrt((9*b)*(9*b) + x*x+y*y))); 
160   
161   Float_t Fcml = A*Fff/6.2831853071796;
162 //    Info("Fcml", "Fcml: %f", Fcml) ;
163   return Fcml;
164
165 }
166
167
168 Float_t AliPHOSRecCpvManager::GradX(Float_t x, Float_t y)
169 {
170
171   const Float_t A = 1.0;
172   const Float_t b = 0.70;
173
174   Float_t skv      = b*b + x*x + y*y;
175
176   Float_t Gradient = y*(1.-x*x/skv)*  b*TMath::Sqrt(skv)/( b*b*skv+x*x*y*y)
177     - y*(1.-x*x/skv)*3*b*TMath::Sqrt(skv)/((3*b)*(3*b)*skv+x*x*y*y)
178     + y*(1.-x*x/skv)*5*b*TMath::Sqrt(skv)/((5*b)*(5*b)*skv+x*x*y*y)
179     - y*(1.-x*x/skv)*7*b*TMath::Sqrt(skv)/((7*b)*(7*b)*skv+x*x*y*y)
180     + y*(1.-x*x/skv)*9*b*TMath::Sqrt(skv)/((9*b)*(9*b)*skv+x*x*y*y);
181       
182   Float_t Grad    = A*Gradient/6.2831853071796;
183   return Grad;
184 }
185
186
187 Float_t AliPHOSRecCpvManager::GradY(Float_t x, Float_t y)
188 {
189   
190   const Float_t A = 1.0;
191   const Float_t b = 0.70;
192  
193   Float_t skv      = b*b + x*x + y*y;
194   Float_t Gradient = x*(1.-y*y/skv)*  b*TMath::Sqrt(skv)/( b*b*skv+x*x*y*y)
195     - x*(1.-y*y/skv)*3*b*TMath::Sqrt(skv)/((3*b)*(3*b)*skv+x*x*y*y)
196     + x*(1.-y*y/skv)*5*b*TMath::Sqrt(skv)/((5*b)*(5*b)*skv+x*x*y*y)
197     - x*(1.-y*y/skv)*7*b*TMath::Sqrt(skv)/((7*b)*(7*b)*skv+x*x*y*y)
198     + x*(1.-y*y/skv)*9*b*TMath::Sqrt(skv)/((9*b)*(9*b)*skv+x*x*y*y);
199   
200   Float_t Grad    = A*Gradient/6.2831853071796;
201   return Grad;
202 }
203
204