2 //**************************************************************************
3 //* This file is property of and copyright by the ALICE HLT Project *
4 //* ALICE Experiment at CERN, All rights reserved. *
6 //* Primary Authors: Jochen Thaeder <thaeder@kip.uni-heidelberg.de> *
7 //* for The ALICE HLT Project. *
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 //**************************************************************************
18 /** @file AliHLTJETBase.cxx
19 @author Jochen Thaeder
21 @brief Base functionality for HLT JET package
24 // see header file for class documentation
26 // refer to README to build package
28 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
34 #include "AliHLTJETBase.h"
36 /** ROOT macro for the implementation of ROOT specific class methods */
37 ClassImp(AliHLTJETBase)
40 * ---------------------------------------------------------------------------------
41 * Constructor / Destructor
42 * ---------------------------------------------------------------------------------
45 //##################################################################################
46 AliHLTJETBase::AliHLTJETBase() {
47 // see header file for class documentation
49 // refer to README to build package
51 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
55 //##################################################################################
56 AliHLTJETBase::~AliHLTJETBase() {
57 // see header file for class documentation
61 * ---------------------------------------------------------------------------------
62 * Initialize static const
63 * ---------------------------------------------------------------------------------
66 //##################################################################################
67 const Char_t *AliHLTJETBase::fgkJetAlgorithmType[] = {
76 //##################################################################################
77 Float_t AliHLTJETBase::GetDistance2( const Float_t eta1, const Float_t phi1,
78 const Float_t eta2, const Float_t phi2) {
79 // see header file for class documentation
81 return ( (eta1-eta2)*(eta1-eta2) ) + ( (phi1-phi2)*(phi1-phi2) );
84 //##################################################################################
85 void AliHLTJETBase::XYZtoRPhiEta( const Double_t *xyz, Double_t *rpe ) {
86 // see header file for class documentation
88 // Spherical [r,phi,eta] - rpe
89 // Cartesian [x,y,z] - xyz
91 rpe[0] = TMath::Sqrt( xyz[0]*xyz[0] + xyz[1]*xyz[1] + xyz[2]*xyz[2] );
92 rpe[1] = AliHLTJETBase::GetPhiFromXYZ( xyz );
93 rpe[2] = 0.5 * TMath::Log( (rpe[0]+xyz[2])/(rpe[0]-xyz[2]) );
96 //##################################################################################
97 void AliHLTJETBase::XYZEtoRPhiEtaPt( const Double_t *xyze, Double_t *rpep ) {
98 // see header file for class documentation
100 // Spherical [r,phi,eta,pt] - rpep
101 // Cartesian [x,y,z,E] - xyze
103 rpep[0] = TMath::Sqrt( xyze[0]*xyze[0] + xyze[1]*xyze[1] + xyze[2]*xyze[2] );
104 rpep[1] = AliHLTJETBase::GetPhiFromXYZ( xyze );
105 rpep[2] = 0.5 * TMath::Log( (rpep[0]+xyze[2])/(rpep[0]-xyze[2]) );
106 rpep[3] = AliHLTJETBase::GetPtFromXYZ( xyze );
109 //##################################################################################
110 void AliHLTJETBase::XYZEtoRPhiEtaPt( const Float_t *xyze, Double_t *rpep ) {
111 // see header file for class documentation
113 // Spherical [r,phi,eta,pt] - rpep
114 // Cartesian [x,y,z,E] - xyze
115 Double_t x = (Double_t) xyze[0];
116 Double_t y = (Double_t) xyze[1];
117 Double_t z = (Double_t) xyze[2];
119 rpep[0] = TMath::Sqrt( x*x + y*y + z*z );
120 rpep[1] = AliHLTJETBase::GetPhiFromXYZ( xyze );
121 rpep[2] = 0.5 * TMath::Log( (rpep[0]+z)/(rpep[0]-z) );
122 rpep[3] = AliHLTJETBase::GetPtFromXYZ( xyze );
125 //##################################################################################
126 void AliHLTJETBase::XYZEtoEPhiEtaPt( const Double_t *xyze, Double_t *epep ) {
127 // see header file for class documentation
129 // Spherical [r,phi,eta,pt] - rpep
130 // Cartesian [x,y,z,E] - xyze
132 Double_t r = TMath::Sqrt( xyze[0]*xyze[0] + xyze[1]*xyze[1] + xyze[2]*xyze[2] );
135 epep[1] = AliHLTJETBase::GetPhiFromXYZ( xyze );
136 epep[2] = 0.5 * TMath::Log( (r+xyze[2])/(r-xyze[2]) );
137 epep[3] = AliHLTJETBase::GetPtFromXYZ( xyze );
140 //##################################################################################
141 void AliHLTJETBase::XYZEtoEPhiEtaPt( const Float_t *xyze, Double_t *epep ) {
142 // see header file for class documentation
144 // Spherical [r,phi,eta,pt] - rpep
145 // Cartesian [x,y,z,E] - xyze
146 Double_t x = (Double_t) xyze[0];
147 Double_t y = (Double_t) xyze[1];
148 Double_t z = (Double_t) xyze[2];
149 Double_t e = (Double_t) xyze[3];
150 Double_t r = TMath::Sqrt( x*x + y*y + z*z );
153 epep[1] = AliHLTJETBase::GetPhiFromXYZ( xyze );
154 epep[2] = 0.5 * TMath::Log( (r+z)/(r-z) );
155 epep[3] = AliHLTJETBase::GetPtFromXYZ( xyze );
158 //##################################################################################
159 Double_t AliHLTJETBase::GetPtFromXYZ( const Double_t *pxpypz ) {
160 // see header file for class documentation
161 // Cartesian [px,py,pz]
163 return TMath::Sqrt( pxpypz[0]*pxpypz[0] + pxpypz[1]*pxpypz[1] );
166 //##################################################################################
167 Double_t AliHLTJETBase::GetPtFromXYZ( const Float_t *pxpypz ) {
168 // see header file for class documentation
169 // Cartesian [px,py,pz]
171 Double_t px = (Double_t) pxpypz[0];
172 Double_t py = (Double_t) pxpypz[1];
174 return TMath::Sqrt( px*px + py*py );
177 //##################################################################################
178 Double_t AliHLTJETBase::GetPhiFromXYZ( const Double_t *xyz ) {
179 // see header file for class documentation
180 // Cartesian [x,y,z,E] - xyz
182 Double_t phi = TMath::ATan2( xyz[1], xyz[0] );
183 if ( phi < 0.0 ) phi += TMath::TwoPi();
188 //##################################################################################
189 Double_t AliHLTJETBase::GetPhiFromXYZ( const Float_t *xyz ) {
190 // see header file for class documentation
191 // Cartesian [x,y,z,E] - xyz
193 Double_t x = (Double_t) xyz[0];
194 Double_t y = (Double_t) xyz[1];
196 Double_t phi = TMath::ATan2( y, x );
197 if ( phi < 0.0 ) phi += TMath::TwoPi();
202 //##################################################################################
203 Double_t AliHLTJETBase::GetEtaFromXYZ( const Double_t *xyz ) {
204 // see header file for class documentation
205 // Cartesian [x,y,z,E] - xyz
207 Double_t r = TMath::Sqrt( xyz[0]*xyz[0] + xyz[1]*xyz[1] + xyz[2]*xyz[2] );
208 return 0.5 * TMath::Log( (r+xyz[2])/(r-xyz[2]) );
210 //##################################################################################
211 Double_t AliHLTJETBase::GetEtaFromXYZ( const Float_t *xyz ) {
212 // see header file for class documentation
213 // Cartesian [x,y,z,E] - xyz
215 Double_t x = (Double_t) xyz[0];
216 Double_t y = (Double_t) xyz[1];
217 Double_t z = (Double_t) xyz[2];
219 Double_t r = TMath::Sqrt( x*x + y*y + z*z );
220 return 0.5 * TMath::Log( (r+z)/(r-z) );