LCOV - code coverage report
Current view: top level - STEER/STEERBase - AliVParticle.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 16 31 51.6 %
Date: 2016-06-14 17:26:59 Functions: 5 8 62.5 %

          Line data    Source code
       1             : /**************************************************************************
       2             :  * Copyright(c) 1998-2007, 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             : 
      16             : /* $Id$ */
      17             : 
      18             : //-------------------------------------------------------------------------
      19             : //     base class for ESD and AOD particles
      20             : //     Author: Markus Oldenburg, CERN
      21             : //-------------------------------------------------------------------------
      22             : 
      23             : #include "AliVParticle.h"
      24             : #include "TMath.h"
      25             : 
      26         176 : ClassImp(AliVParticle)
      27             : 
      28             : AliVParticle::AliVParticle(const AliVParticle& vPart) :
      29       49464 :   TObject(vPart) { } // Copy constructor
      30             : 
      31             : AliVParticle& AliVParticle::operator=(const AliVParticle& vPart)
      32       31792 : { if (this!=&vPart) { 
      33       15896 :     TObject::operator=(vPart); 
      34       15896 :   }
      35             :   
      36       15896 :   return *this; 
      37             : }
      38             : 
      39             : Bool_t AliVParticle::Local2GlobalMomentum(Double_t p[3], Double_t alpha) const {
      40             :   //----------------------------------------------------------------
      41             :   // This function performs local->global transformation of the
      42             :   // track momentum.
      43             :   // When called, the arguments are:
      44             :   //    p[0] = 1/pt * charge of the track;
      45             :   //    p[1] = sine of local azim. angle of the track momentum;
      46             :   //    p[2] = tangent of the track momentum dip angle;
      47             :   //   alpha - rotation angle. 
      48             :   // The result is returned as:
      49             :   //    p[0] = px
      50             :   //    p[1] = py
      51             :   //    p[2] = pz
      52             :   // Results for (nearly) straight tracks are meaningless !
      53             :   //----------------------------------------------------------------
      54      614996 :   if (TMath::Abs(p[0])<=kAlmost0) return kFALSE;
      55      307498 :   if (TMath::Abs(p[1])> kAlmost1) return kFALSE;
      56             : 
      57      307498 :   Double_t pt=1./TMath::Abs(p[0]);
      58      307498 :   Double_t cs=TMath::Cos(alpha), sn=TMath::Sin(alpha);
      59      307498 :   Double_t r=TMath::Sqrt((1. - p[1])*(1. + p[1]));
      60      307498 :   p[0]=pt*(r*cs - p[1]*sn); p[1]=pt*(p[1]*cs + r*sn); p[2]=pt*p[2];
      61             : 
      62             :   return kTRUE;
      63      307498 : }
      64             : 
      65             : Bool_t AliVParticle::Local2GlobalPosition(Double_t r[3], Double_t alpha) const {
      66             :   //----------------------------------------------------------------
      67             :   // This function performs local->global transformation of the
      68             :   // track position.
      69             :   // When called, the arguments are:
      70             :   //    r[0] = local x
      71             :   //    r[1] = local y
      72             :   //    r[2] = local z
      73             :   //   alpha - rotation angle. 
      74             :   // The result is returned as:
      75             :   //    r[0] = global x
      76             :   //    r[1] = global y
      77             :   //    r[2] = global z
      78             :   //----------------------------------------------------------------
      79     2267646 :   Double_t cs=TMath::Cos(alpha), sn=TMath::Sin(alpha), x=r[0];
      80     1133823 :   r[0]=x*cs - r[1]*sn; r[1]=x*sn + r[1]*cs;
      81             : 
      82     1133823 :   return kTRUE;
      83             : }
      84             : 
      85             : Bool_t AliVParticle::Global2LocalMomentum(Double_t p[3], Short_t charge, Double_t &alpha) const {
      86             :   //----------------------------------------------------------------
      87             :   // This function performs global->local transformation of the
      88             :   // track momentum.
      89             :   // When called, the arguments are:
      90             :   //    p[0] = px
      91             :   //    p[1] = py
      92             :   //    p[2] = pz
      93             :   //   charge - of the track
      94             :   //   alpha - rotation angle. 
      95             :   // The result is returned as:
      96             :   //    p[0] = 1/pt * charge of the track;
      97             :   //    p[1] = sine of local azim. angle of the track momentum;
      98             :   //    p[2] = tangent of the track momentum dip angle;
      99             :   // Results for (nearly) straight tracks are meaningless !
     100             :   //----------------------------------------------------------------
     101           0 :   double pt = TMath::Sqrt(p[0]*p[0]+p[1]*p[1]);
     102           0 :   if (pt == 0.) return kFALSE;
     103           0 :   alpha = TMath::Pi() + TMath::ATan2(-p[1], -p[0]);
     104             :   
     105           0 :   p[0] = 1./pt * (float)charge;
     106           0 :   p[1] = 0.;
     107           0 :   p[2] = p[2]/pt;
     108             : 
     109           0 :   return kTRUE;
     110           0 : }
     111             : 
     112             : Bool_t AliVParticle::Global2LocalPosition(Double_t r[3], Double_t alpha) const {
     113           0 :   return Local2GlobalPosition(r, -alpha);
     114             : }
     115             : 
     116             : 
     117             : Int_t AliVParticle::Compare( const TObject* obj) const {
     118             : 
     119             :   // 
     120             :   // see header file for class documentation
     121             :   //
     122             : 
     123           0 :   if (this == obj)
     124           0 :     return 0;
     125             :   // check type
     126           0 :   if ( Pt() < ((AliVParticle*)(obj))->Pt())
     127           0 :     return 1;
     128             :   else
     129           0 :     return -1;
     130           0 : }
     131             : 

Generated by: LCOV version 1.11