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