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
30 #include "AliHLTJETBase.h"
34 /** ROOT macro for the implementation of ROOT specific class methods */
35 ClassImp(AliHLTJETBase)
38 * ---------------------------------------------------------------------------------
39 * Constructor / Destructor
40 * ---------------------------------------------------------------------------------
43 //##################################################################################
44 AliHLTJETBase::AliHLTJETBase() {
45 // see header file for class documentation
47 // refer to README to build package
49 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
53 //##################################################################################
54 AliHLTJETBase::~AliHLTJETBase() {
55 // see header file for class documentation
59 * ---------------------------------------------------------------------------------
60 * Initialize static const
61 * ---------------------------------------------------------------------------------
64 //##################################################################################
65 const Char_t *AliHLTJETBase::fgkJetAlgorithmType[] = {
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
79 return ( (eta1-eta2)*(eta1-eta2) ) + ( (phi1-phi2)*(phi1-phi2) );
82 //##################################################################################
83 void AliHLTJETBase::XYZtoRPhiEta( const Double_t *xyz, Double_t *rpe ) {
84 // see header file for class documentation
86 // Spherical [r,phi,eta] - rpe
87 // Cartesian [x,y,z] - xyz
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]) );
94 //##################################################################################
95 void AliHLTJETBase::XYZEtoRPhiEtaPt( const Double_t *xyze, Double_t *rpep ) {
96 // see header file for class documentation
98 // Spherical [r,phi,eta,pt] - rpep
99 // Cartesian [x,y,z,E] - xyze
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 );
107 //##################################################################################
108 void AliHLTJETBase::XYZEtoRPhiEtaPt( const Float_t *xyze, Double_t *rpep ) {
109 // see header file for class documentation
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];
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 );
123 //##################################################################################
124 void AliHLTJETBase::XYZEtoEPhiEtaPt( const Double_t *xyze, Double_t *epep ) {
125 // see header file for class documentation
127 // Spherical [r,phi,eta,pt] - rpep
128 // Cartesian [x,y,z,E] - xyze
130 Double_t r = TMath::Sqrt( xyze[0]*xyze[0] + xyze[1]*xyze[1] + xyze[2]*xyze[2] );
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 );
138 //##################################################################################
139 void AliHLTJETBase::XYZEtoEPhiEtaPt( const Float_t *xyze, Double_t *epep ) {
140 // see header file for class documentation
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 );
151 epep[1] = AliHLTJETBase::GetPhiFromXYZ( xyze );
152 epep[2] = 0.5 * TMath::Log( (r+z)/(r-z) );
153 epep[3] = AliHLTJETBase::GetPtFromXYZ( xyze );
156 //##################################################################################
157 Double_t AliHLTJETBase::GetPtFromXYZ( const Double_t *pxpypz ) {
158 // see header file for class documentation
159 // Cartesian [px,py,pz]
161 return TMath::Sqrt( pxpypz[0]*pxpypz[0] + pxpypz[1]*pxpypz[1] );
164 //##################################################################################
165 Double_t AliHLTJETBase::GetPtFromXYZ( const Float_t *pxpypz ) {
166 // see header file for class documentation
167 // Cartesian [px,py,pz]
169 Double_t px = (Double_t) pxpypz[0];
170 Double_t py = (Double_t) pxpypz[1];
172 return TMath::Sqrt( px*px + py*py );
175 //##################################################################################
176 Double_t AliHLTJETBase::GetPhiFromXYZ( const Double_t *xyz ) {
177 // see header file for class documentation
178 // Cartesian [x,y,z,E] - xyz
180 Double_t phi = TMath::ATan2( xyz[1], xyz[0] );
181 if ( phi < 0.0 ) phi += TMath::TwoPi();
186 //##################################################################################
187 Double_t AliHLTJETBase::GetPhiFromXYZ( const Float_t *xyz ) {
188 // see header file for class documentation
189 // Cartesian [x,y,z,E] - xyz
191 Double_t x = (Double_t) xyz[0];
192 Double_t y = (Double_t) xyz[1];
194 Double_t phi = TMath::ATan2( y, x );
195 if ( phi < 0.0 ) phi += TMath::TwoPi();
200 //##################################################################################
201 Double_t AliHLTJETBase::GetEtaFromXYZ( const Double_t *xyz ) {
202 // see header file for class documentation
203 // Cartesian [x,y,z,E] - xyz
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]) );
208 //##################################################################################
209 Double_t AliHLTJETBase::GetEtaFromXYZ( const Float_t *xyz ) {
210 // see header file for class documentation
211 // Cartesian [x,y,z,E] - xyz
213 Double_t x = (Double_t) xyz[0];
214 Double_t y = (Double_t) xyz[1];
215 Double_t z = (Double_t) xyz[2];
217 Double_t r = TMath::Sqrt( x*x + y*y + z*z );
218 return 0.5 * TMath::Log( (r+z)/(r-z) );