]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLTANALYSIS/JET/AliHLTJETBase.cxx
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / HLTANALYSIS / JET / AliHLTJETBase.cxx
1 //-*- Mode: C++ -*-
2 //**************************************************************************
3 //* This file is property of and copyright by the ALICE HLT Project        * 
4 //* ALICE Experiment at CERN, All rights reserved.                         *
5 //*                                                                        *
6 //* Primary Authors: Jochen Thaeder <thaeder@kip.uni-heidelberg.de>        *
7 //*                  for The ALICE HLT Project.                            *
8 //*                                                                        *
9 //* Permission to use, copy, modify and distribute this software and its   *
10 //* documentation strictly for non-commercial purposes is hereby granted   *
11 //* without fee, provided that the above copyright notice appears in all   *
12 //* copies and that both the copyright notice and this permission notice   *
13 //* appear in the supporting documentation. The authors make no claims     *
14 //* about the suitability of this software for any purpose. It is          *
15 //* provided "as is" without express or implied warranty.                  *
16 //**************************************************************************
17
18 /** @file   AliHLTJETBase.cxx
19     @author Jochen Thaeder
20     @date   
21     @brief  Base functionality for HLT JET package
22 */
23
24 // see header file for class documentation
25 // or
26 // refer to README to build package
27 // or
28 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
29
30 #include "AliHLTJETBase.h"
31
32 using namespace std;
33
34 /** ROOT macro for the implementation of ROOT specific class methods */
35 ClassImp(AliHLTJETBase)
36
37 /*
38  * ---------------------------------------------------------------------------------
39  *                            Constructor / Destructor
40  * ---------------------------------------------------------------------------------
41  */
42
43 //##################################################################################
44   AliHLTJETBase::AliHLTJETBase() {
45   // see header file for class documentation
46   // or
47   // refer to README to build package
48   // or
49   // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
50 }
51
52
53 //##################################################################################
54 AliHLTJETBase::~AliHLTJETBase() {
55   // see header file for class documentation
56 }
57
58 /*
59  * ---------------------------------------------------------------------------------
60  *                              Initialize static const
61  * ---------------------------------------------------------------------------------
62  */
63
64 //##################################################################################
65 const Char_t *AliHLTJETBase::fgkJetAlgorithmType[] = { 
66   "Anti Kt", 
67   "Kt",
68   "FFSC SquareCell",
69   "FFSC RadiusCell"
70 };
71
72 #if 0
73
74 //################################################################################## 
75 Float_t AliHLTJETBase::GetDistance2( const Float_t eta1, const Float_t phi1, 
76                                      const Float_t eta2, const Float_t phi2) {
77   // see header file for class documentation
78   
79   return ( (eta1-eta2)*(eta1-eta2) ) + ( (phi1-phi2)*(phi1-phi2) );
80 }
81
82 //##################################################################################
83 void AliHLTJETBase::XYZtoRPhiEta( const Double_t *xyz, Double_t *rpe ) {
84   // see header file for class documentation
85
86   // Spherical [r,phi,eta] - rpe
87   // Cartesian [x,y,z] - xyz
88   
89   rpe[0] = TMath::Sqrt( xyz[0]*xyz[0] + xyz[1]*xyz[1] + xyz[2]*xyz[2] );
90   rpe[1] = AliHLTJETBase::GetPhiFromXYZ( xyz );
91   rpe[2] = 0.5 * TMath::Log( (rpe[0]+xyz[2])/(rpe[0]-xyz[2]) );
92 }
93
94 //##################################################################################
95 void AliHLTJETBase::XYZEtoRPhiEtaPt( const Double_t *xyze, Double_t *rpep ) {
96   // see header file for class documentation
97
98   // Spherical [r,phi,eta,pt] - rpep
99   // Cartesian [x,y,z,E] - xyze
100   
101   rpep[0] = TMath::Sqrt( xyze[0]*xyze[0] + xyze[1]*xyze[1] + xyze[2]*xyze[2] );
102   rpep[1] = AliHLTJETBase::GetPhiFromXYZ( xyze );
103   rpep[2] = 0.5 * TMath::Log( (rpep[0]+xyze[2])/(rpep[0]-xyze[2]) );
104   rpep[3] = AliHLTJETBase::GetPtFromXYZ( xyze );
105 }
106
107 //##################################################################################
108 void AliHLTJETBase::XYZEtoRPhiEtaPt( const Float_t *xyze, Double_t *rpep ) {
109   // see header file for class documentation
110
111   // Spherical [r,phi,eta,pt] - rpep
112   // Cartesian [x,y,z,E] - xyze
113   Double_t x = (Double_t) xyze[0];
114   Double_t y = (Double_t) xyze[1];
115   Double_t z = (Double_t) xyze[2];
116   
117   rpep[0] = TMath::Sqrt( x*x + y*y + z*z );
118   rpep[1] = AliHLTJETBase::GetPhiFromXYZ( xyze );
119   rpep[2] = 0.5 * TMath::Log( (rpep[0]+z)/(rpep[0]-z) );
120   rpep[3] = AliHLTJETBase::GetPtFromXYZ( xyze );
121 }
122
123 //##################################################################################
124 void AliHLTJETBase::XYZEtoEPhiEtaPt( const Double_t *xyze, Double_t *epep ) {
125   // see header file for class documentation
126
127   // Spherical [r,phi,eta,pt] - rpep
128   // Cartesian [x,y,z,E] - xyze
129
130   Double_t r = TMath::Sqrt( xyze[0]*xyze[0] + xyze[1]*xyze[1] + xyze[2]*xyze[2] );
131   
132   epep[0] = xyze[3];
133   epep[1] = AliHLTJETBase::GetPhiFromXYZ( xyze );
134   epep[2] = 0.5 * TMath::Log( (r+xyze[2])/(r-xyze[2]) );
135   epep[3] = AliHLTJETBase::GetPtFromXYZ( xyze );
136 }
137
138 //##################################################################################
139 void AliHLTJETBase::XYZEtoEPhiEtaPt( const Float_t *xyze, Double_t *epep ) {
140   // see header file for class documentation
141
142   // Spherical [r,phi,eta,pt] - rpep
143   // Cartesian [x,y,z,E] - xyze
144   Double_t x = (Double_t) xyze[0];
145   Double_t y = (Double_t) xyze[1];
146   Double_t z = (Double_t) xyze[2];
147   Double_t e = (Double_t) xyze[3];
148   Double_t r = TMath::Sqrt( x*x + y*y + z*z );
149   
150   epep[0] = e;
151   epep[1] = AliHLTJETBase::GetPhiFromXYZ( xyze );
152   epep[2] = 0.5 * TMath::Log( (r+z)/(r-z) );
153   epep[3] = AliHLTJETBase::GetPtFromXYZ( xyze );
154 }
155
156 //##################################################################################
157 Double_t AliHLTJETBase::GetPtFromXYZ( const Double_t *pxpypz ) {
158   // see header file for class documentation
159   // Cartesian [px,py,pz] 
160   
161   return TMath::Sqrt( pxpypz[0]*pxpypz[0] + pxpypz[1]*pxpypz[1] );
162 }
163
164 //##################################################################################
165 Double_t AliHLTJETBase::GetPtFromXYZ( const Float_t *pxpypz ) {
166   // see header file for class documentation
167   // Cartesian [px,py,pz] 
168   
169   Double_t px = (Double_t) pxpypz[0];
170   Double_t py = (Double_t) pxpypz[1];
171
172   return TMath::Sqrt( px*px + py*py );
173 }
174
175 //##################################################################################
176 Double_t AliHLTJETBase::GetPhiFromXYZ( const Double_t *xyz ) {
177   // see header file for class documentation
178   // Cartesian [x,y,z,E] - xyz
179  
180   Double_t phi = TMath::ATan2( xyz[1], xyz[0] );  
181   if ( phi < 0.0 ) phi += TMath::TwoPi();
182
183   return phi;
184 }
185
186 //##################################################################################
187 Double_t AliHLTJETBase::GetPhiFromXYZ( const Float_t *xyz ) {
188   // see header file for class documentation
189   // Cartesian [x,y,z,E] - xyz
190  
191   Double_t x = (Double_t) xyz[0];
192   Double_t y = (Double_t) xyz[1];
193
194   Double_t phi = TMath::ATan2( y, x );  
195   if ( phi < 0.0 ) phi += TMath::TwoPi();
196
197   return phi;
198 }
199
200 //##################################################################################
201 Double_t AliHLTJETBase::GetEtaFromXYZ( const Double_t *xyz ) {
202   // see header file for class documentation
203   // Cartesian [x,y,z,E] - xyz
204   
205   Double_t r = TMath::Sqrt( xyz[0]*xyz[0] + xyz[1]*xyz[1] + xyz[2]*xyz[2] );
206   return 0.5 * TMath::Log( (r+xyz[2])/(r-xyz[2]) );
207 }
208 //##################################################################################
209 Double_t AliHLTJETBase::GetEtaFromXYZ( const Float_t *xyz ) {
210   // see header file for class documentation
211   // Cartesian [x,y,z,E] - xyz
212   
213   Double_t x = (Double_t) xyz[0];
214   Double_t y = (Double_t) xyz[1];
215   Double_t z = (Double_t) xyz[2];
216   
217   Double_t r = TMath::Sqrt( x*x + y*y + z*z );
218   return 0.5 * TMath::Log( (r+z)/(r-z) );
219 }
220
221
222
223 #endif