]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PHOS/AliPHOSRecCpvManager.cxx
Inheritance from TObject. Automatic streamers.
[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 #include <iostream.h>
27
28 // --- AliRoot header files ---
29
30 #include "AliPHOSRecCpvManager.h"
31 #include "AliPHOS.h"
32 #include "AliRun.h"
33 #include "AliPHOSGetter.h"
34
35 ClassImp(AliPHOSRecCpvManager) 
36
37 //____________________________________________________________________________
38
39   AliPHOSRecCpvManager::AliPHOSRecCpvManager()
40 {
41
42   fOneGamChisqCut = 3.; // If Chi2/dof > fOneGamChisqCut, split point.
43
44   fOneGamInitialStep = 0.00005;
45   fOneGamChisqMin = 1.;
46   fOneGamStepMin = 0.0005;
47   fOneGamNumOfIterations = 50;
48
49   fTwoGamInitialStep = 0.00005;
50   fTwoGamChisqMin = 1.;
51   fTwoGamEmin = 0.1;
52   fTwoGamStepMin = 0.00005;
53   fTwoGamNumOfIterations = 50;  
54
55 //    fThr0 = 0.0285; // Min. energy of rec. point. If E<fThr0, point deleted.
56 //    fSqdCut = 3.; // Min. distance (in cm) between two rec points.
57
58   fThr0 = 0.; 
59   fSqdCut = 0.; 
60   
61   SetTitle("Cpv Reconstruction Manager");
62 }
63
64 AliPHOSRecCpvManager::~AliPHOSRecCpvManager(void) {}
65
66 Float_t AliPHOSRecCpvManager::Dispersion(Float_t Etot, Float_t Ai, Float_t Ei)
67 {
68   //"Dispresion" of energy deposition in the cell.
69   // Etot is the total shower energy, Ai is the
70   // calculated cell response,
71   // Ei is the measured cell response.
72
73   const Float_t Const = 1.5;
74   return Const*Ai*(1.-Ai/Etot);
75 }
76
77 Float_t AliPHOSRecCpvManager::OneGamChi2(Float_t Ai, Float_t Ei, Float_t Etot, Float_t& Gi)
78 {
79   //"Chi2" for one cell.
80   // Etot is the total "shower" energy, Ai is the
81   // calculated cell response,
82   // Ei is the measured cell response.
83
84   const Float_t Const = 1.5;
85
86   Float_t da = Ai - Ei;
87   Float_t D = Const*Ai*(1.-Ai/Etot);
88
89   Float_t dd = da/D;
90   Gi = dd*(2.- dd*Const*(1.-2.*Ai/Etot));
91
92   cout<<" OneGamChi2 (Ai,Ei,Etot,&Gi,chi2) "<<Ai<<" "<<Ei<<" "<<Etot<<" "<<Gi<<" "<<da*da/D<<endl<<endl;
93
94   return da*da/D;
95
96 }
97
98 Float_t AliPHOSRecCpvManager::TwoGamChi2(Float_t Ai, Float_t Ei, Float_t Etot, Float_t& Gi)
99 {
100
101   const Float_t Const = 1.5;
102
103   Float_t da = Ai - Ei;
104   Float_t D = Const*Ai*(1.-Ai/Etot);
105
106   Float_t dd = da/D;
107   Gi = dd*(2.- dd*Const*(1.-2.*Ai/Etot));
108
109   return da*da/D;
110  
111 }
112
113 void AliPHOSRecCpvManager::AG(Float_t Ei, Float_t Xi, Float_t Yi, Float_t& Ai, Float_t& GXi, Float_t& GYi )
114 {
115   //Calculates amplitude (Ai) and gradients (GXi, GYi) of CPV pad response.
116   //Integrated response (total "shower energy") is E, 
117   //Xi and Yi are the distances along x and y from reference point 
118   // to the pad center.
119
120   AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; 
121   const AliPHOSGeometry* geom = gime->PHOSGeometry();
122   Float_t CelZ = geom->GetPadSizeZ();
123   Float_t CelY = geom->GetPadSizePhi();
124
125 //  //    cout<<"CelZ: "<<CelZ<<" CelY: "<<CelY<<endl;
126
127   Float_t dx = CelZ/2.;
128   Float_t dy = CelY/2.;
129
130 //  //    Float_t x = Xi*CelZ;
131 //  //    Float_t y = Yi*CelZ;
132
133   Float_t x = Xi*CelZ;
134   Float_t y = Yi*CelY;
135
136   Float_t E = Ei;
137
138   Float_t A = Fcml(x+dx,y+dy) - Fcml(x+dx,y-dy) - Fcml(x-dx,y+dy) + Fcml(x-dx,y-dy);
139   Ai = A*E;
140
141
142   Float_t Gx = GradX(x+dx,y+dy) - GradX(x+dx,y-dy) - GradX(x-dx,y+dy) + GradX(x-dx,y-dy);
143   GXi = Gx*E*E;
144
145   Float_t Gy = GradY(x+dx,y+dy) - GradY(x+dx,y-dy) - GradY(x-dx,y+dy) + GradY(x-dx,y-dy);
146   GYi = Gy*E*E;
147
148 }
149
150 Float_t AliPHOSRecCpvManager::Fcml(Float_t x, Float_t y)
151 {
152   //Cumulative function
153
154   const Float_t A = 1.0;
155   const Float_t b = 0.70;
156
157   Float_t Fff  = TMath::ATan(x*y/(  b*TMath::Sqrt(  (b*b) + x*x+y*y)))
158     - TMath::ATan(x*y/(3*b*TMath::Sqrt((3*b)*(3*b) + x*x+y*y)))
159     + TMath::ATan(x*y/(5*b*TMath::Sqrt((5*b)*(5*b) + x*x+y*y))) 
160     - TMath::ATan(x*y/(7*b*TMath::Sqrt((7*b)*(7*b) + x*x+y*y)))
161     + TMath::ATan(x*y/(9*b*TMath::Sqrt((9*b)*(9*b) + x*x+y*y))); 
162   
163   Float_t Fcml = A*Fff/6.2831853071796;
164 //    cout<<" Fcml: "<<Fcml<<endl;
165   return Fcml;
166
167 }
168
169
170 Float_t AliPHOSRecCpvManager::GradX(Float_t x, Float_t y)
171 {
172
173   const Float_t A = 1.0;
174   const Float_t b = 0.70;
175
176   Float_t skv      = b*b + x*x + y*y;
177
178   Float_t Gradient = y*(1.-x*x/skv)*  b*TMath::Sqrt(skv)/( b*b*skv+x*x*y*y)
179     - y*(1.-x*x/skv)*3*b*TMath::Sqrt(skv)/((3*b)*(3*b)*skv+x*x*y*y)
180     + y*(1.-x*x/skv)*5*b*TMath::Sqrt(skv)/((5*b)*(5*b)*skv+x*x*y*y)
181     - y*(1.-x*x/skv)*7*b*TMath::Sqrt(skv)/((7*b)*(7*b)*skv+x*x*y*y)
182     + y*(1.-x*x/skv)*9*b*TMath::Sqrt(skv)/((9*b)*(9*b)*skv+x*x*y*y);
183       
184   Float_t Grad    = A*Gradient/6.2831853071796;
185   return Grad;
186 }
187
188
189 Float_t AliPHOSRecCpvManager::GradY(Float_t x, Float_t y)
190 {
191   
192   const Float_t A = 1.0;
193   const Float_t b = 0.70;
194  
195   Float_t skv      = b*b + x*x + y*y;
196   Float_t Gradient = x*(1.-y*y/skv)*  b*TMath::Sqrt(skv)/( b*b*skv+x*x*y*y)
197     - x*(1.-y*y/skv)*3*b*TMath::Sqrt(skv)/((3*b)*(3*b)*skv+x*x*y*y)
198     + x*(1.-y*y/skv)*5*b*TMath::Sqrt(skv)/((5*b)*(5*b)*skv+x*x*y*y)
199     - x*(1.-y*y/skv)*7*b*TMath::Sqrt(skv)/((7*b)*(7*b)*skv+x*x*y*y)
200     + x*(1.-y*y/skv)*9*b*TMath::Sqrt(skv)/((9*b)*(9*b)*skv+x*x*y*y);
201   
202   Float_t Grad    = A*Gradient/6.2831853071796;
203   return Grad;
204 }
205
206