Some of the coding violations corrected
[u/mrichter/AliRoot.git] / TPC / AliDetectorParam.cxx
CommitLineData
cc80f89e 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
88cb7938 16/* $Id$ */
cc80f89e 17
18///////////////////////////////////////////////////////////////////////
19// Paramter class for AliDetector //
20// //
21// Origin: Marian Ivanov, Uni. of Bratislava, ivanov@fmph.uniba.sk //
22// //
23///////////////////////////////////////////////////////////////////////
24
090026bf 25#include <TMath.h>
26#include <TObject.h>
27
cc80f89e 28#include "AliDetectorParam.h"
29
30
179c6296 31AliDetectorParam::AliDetectorParam()
32 :TNamed(),
33 fBField(0.),
34 fNPrimLoss(0.),
35 fNTotalLoss(0.)
36{
37 //
38 // default constructor
39 //
40}
cc80f89e 41
176aff27 42Float_t * AliDetectorParam::GetAnglesAccMomentum(Float_t *x, Int_t * /*index*/, Float_t *momentum, Float_t *angle)
cc80f89e 43{
44 //
45 //calculates deflection angle of particle with longitudinal
46 //longitudinal momentum[0] and transversal momentum momentum[1]
47 //at position (x,y,z) = (x[0],x[1],x[2])
48 //angle[0] - deep angle
49 //angle[1] - magnetic deflection angle
50 if (momentum==0) {
51 Float_t rtotal =TMath::Sqrt(x[0]*x[0]+x[1]*x[1]);
52 if (rtotal==0) angle[0]=0;
53 else
54 angle[0] = TMath::ATan(x[2]/rtotal);
55 angle[1]=0;
56 return angle;
57 }
58 Float_t mtotal =TMath::Sqrt(momentum[0]*momentum[0]+momentum[1]*momentum[1]);
59 if (mtotal==0) {
60 angle[0]= 0;
61 angle[1]=0;
62 return angle;
63 }
64 angle[0]= TMath::ATan(momentum[2]/mtotal);
65 Float_t radius1 = TMath::Sqrt(x[0]*x[0]+x[1]*x[1]); //axial symetry in z
66 Float_t radius2 = 1000*mtotal/(3*fBField);
67 if (radius1<radius2)
68 angle[1]= TMath::ASin(radius1/radius2);
69 else
70 angle[1]=0;
71 return angle;
72}
73
74
75
76
77
78ClassImp(AliDetectorParam)