ROOT logo
// @(#)root/eve:$Id: TEveVSDStructs.cxx 25879 2008-10-19 20:49:34Z matevz $
// Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007

/*************************************************************************
 * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#include "TEveVSDStructs.h"

//==============================================================================
// TEveVector
//==============================================================================

//______________________________________________________________________________
//
// Float three-vector; a inimal Float_t copy of TVector3 used to
// represent points and momenta (also used in VSD).

ClassImp(TEveVector);

//______________________________________________________________________________
void TEveVector::Dump() const
{
   // Dump to stdout as "(x, y, z)\n".

   printf("(%f, %f, %f)\n", fX, fY, fZ);
}

//______________________________________________________________________________
Float_t TEveVector::Eta() const
{
   // Calculate eta of the point, pretending it's a momentum vector.

   Float_t cosTheta = CosTheta();
   if (cosTheta*cosTheta < 1) return -0.5* TMath::Log( (1.0-cosTheta)/(1.0+cosTheta) );
   Warning("Eta","transverse momentum = 0, returning +/- 1e10");
   return (fZ >= 0) ? 1e10 : -1e10;
}

//______________________________________________________________________________
void TEveVector::Normalize(Float_t length)
{
   // Normalize the vector to length if current length is non-zero.

   Float_t m = Mag();
   if (m != 0)
   {
      m = length / m;
      fX *= m; fY *= m; fZ *= m;
   }
}

//______________________________________________________________________________
TEveVector TEveVector::Orthogonal() const
{
   // Returns an orthogonal vector (not normalized).

   Float_t xx = fX < 0 ? -fX : fX;
   Float_t yy = fY < 0 ? -fY : fY;
   Float_t zz = fZ < 0 ? -fZ : fZ;
   if (xx < yy) {
      return xx < zz ? TEveVector(0,fZ,-fY) : TEveVector(fY,-fX,0);
   } else {
      return yy < zz ? TEveVector(-fZ,0,fX) : TEveVector(fY,-fX,0);
   }
}

//______________________________________________________________________________
void TEveVector::OrthoNormBase(TEveVector& a, TEveVector& b) const
{
   // Set vectors a and b to be normal to this and among themselves,
   // both of length 1.

   a = Orthogonal();
   TMath::Cross(this->Arr(), a.Arr(), b.Arr());
   a.Normalize();
   b.Normalize();
}

//______________________________________________________________________________
TEveVector TEveVector::operator + (const TEveVector & b) const
{
   // Vector addition.

   return TEveVector(fX + b.fX, fY + b.fY, fZ + b.fZ);
}

//______________________________________________________________________________
TEveVector TEveVector::operator - (const TEveVector & b) const
{
   // Vector subtraction.

   return TEveVector(fX - b.fX, fY - b.fY, fZ - b.fZ);
}

//______________________________________________________________________________
TEveVector TEveVector::operator * (Float_t a) const
{
   // Multiplication with scalar.

   return TEveVector(a*fX, a*fY, a*fZ);
}


//==============================================================================
// TEveVector4
//==============================================================================

//______________________________________________________________________________
//
// Float four-vector.

ClassImp(TEveVector4);

//______________________________________________________________________________
void TEveVector4::Dump() const
{
   // Dump to stdout as "(x, y, z; t)\n".

   printf("(%f, %f, %f; %f)\n", fX, fY, fZ, fT);
}


//==============================================================================
// TEvePathMark
//==============================================================================

//______________________________________________________________________________
//
// Special-point on track:
//  kDaughter  - daughter creation; fP is momentum of the daughter
//  kReference - position/momentum reference
//  kDecay     - decay point, fP not used
//  kCluster2D - measurement with large error in one direction (like strip detectors):
//               fP - normal to detector plane,
//               fE - large error direction, must be normalized.
//               Track is propagated to plane and correction in fE direction is discarded.


ClassImp(TEvePathMark);

//______________________________________________________________________________
const char* TEvePathMark::TypeName()
{
   // Return the name of path-mark type.

   switch (fType)
   {
      case kDaughter:  return "Daughter";
      case kReference: return "Reference";
      case kDecay:     return "Decay";
      case kCluster2D: return "Cluster2D";
      default:         return "Unknown";
   }
}


//______________________________________________________________________________
//
// Not documented.
//

ClassImp(TEveVector4);
ClassImp(TEveMCTrack);
ClassImp(TEveHit);
ClassImp(TEveCluster);
ClassImp(TEveRecTrack);
ClassImp(TEveRecKink);
ClassImp(TEveRecV0);
ClassImp(TEveRecCascade);
ClassImp(TEveMCRecCrossRef);
 TEveVSDStructs.cxx:1
 TEveVSDStructs.cxx:2
 TEveVSDStructs.cxx:3
 TEveVSDStructs.cxx:4
 TEveVSDStructs.cxx:5
 TEveVSDStructs.cxx:6
 TEveVSDStructs.cxx:7
 TEveVSDStructs.cxx:8
 TEveVSDStructs.cxx:9
 TEveVSDStructs.cxx:10
 TEveVSDStructs.cxx:11
 TEveVSDStructs.cxx:12
 TEveVSDStructs.cxx:13
 TEveVSDStructs.cxx:14
 TEveVSDStructs.cxx:15
 TEveVSDStructs.cxx:16
 TEveVSDStructs.cxx:17
 TEveVSDStructs.cxx:18
 TEveVSDStructs.cxx:19
 TEveVSDStructs.cxx:20
 TEveVSDStructs.cxx:21
 TEveVSDStructs.cxx:22
 TEveVSDStructs.cxx:23
 TEveVSDStructs.cxx:24
 TEveVSDStructs.cxx:25
 TEveVSDStructs.cxx:26
 TEveVSDStructs.cxx:27
 TEveVSDStructs.cxx:28
 TEveVSDStructs.cxx:29
 TEveVSDStructs.cxx:30
 TEveVSDStructs.cxx:31
 TEveVSDStructs.cxx:32
 TEveVSDStructs.cxx:33
 TEveVSDStructs.cxx:34
 TEveVSDStructs.cxx:35
 TEveVSDStructs.cxx:36
 TEveVSDStructs.cxx:37
 TEveVSDStructs.cxx:38
 TEveVSDStructs.cxx:39
 TEveVSDStructs.cxx:40
 TEveVSDStructs.cxx:41
 TEveVSDStructs.cxx:42
 TEveVSDStructs.cxx:43
 TEveVSDStructs.cxx:44
 TEveVSDStructs.cxx:45
 TEveVSDStructs.cxx:46
 TEveVSDStructs.cxx:47
 TEveVSDStructs.cxx:48
 TEveVSDStructs.cxx:49
 TEveVSDStructs.cxx:50
 TEveVSDStructs.cxx:51
 TEveVSDStructs.cxx:52
 TEveVSDStructs.cxx:53
 TEveVSDStructs.cxx:54
 TEveVSDStructs.cxx:55
 TEveVSDStructs.cxx:56
 TEveVSDStructs.cxx:57
 TEveVSDStructs.cxx:58
 TEveVSDStructs.cxx:59
 TEveVSDStructs.cxx:60
 TEveVSDStructs.cxx:61
 TEveVSDStructs.cxx:62
 TEveVSDStructs.cxx:63
 TEveVSDStructs.cxx:64
 TEveVSDStructs.cxx:65
 TEveVSDStructs.cxx:66
 TEveVSDStructs.cxx:67
 TEveVSDStructs.cxx:68
 TEveVSDStructs.cxx:69
 TEveVSDStructs.cxx:70
 TEveVSDStructs.cxx:71
 TEveVSDStructs.cxx:72
 TEveVSDStructs.cxx:73
 TEveVSDStructs.cxx:74
 TEveVSDStructs.cxx:75
 TEveVSDStructs.cxx:76
 TEveVSDStructs.cxx:77
 TEveVSDStructs.cxx:78
 TEveVSDStructs.cxx:79
 TEveVSDStructs.cxx:80
 TEveVSDStructs.cxx:81
 TEveVSDStructs.cxx:82
 TEveVSDStructs.cxx:83
 TEveVSDStructs.cxx:84
 TEveVSDStructs.cxx:85
 TEveVSDStructs.cxx:86
 TEveVSDStructs.cxx:87
 TEveVSDStructs.cxx:88
 TEveVSDStructs.cxx:89
 TEveVSDStructs.cxx:90
 TEveVSDStructs.cxx:91
 TEveVSDStructs.cxx:92
 TEveVSDStructs.cxx:93
 TEveVSDStructs.cxx:94
 TEveVSDStructs.cxx:95
 TEveVSDStructs.cxx:96
 TEveVSDStructs.cxx:97
 TEveVSDStructs.cxx:98
 TEveVSDStructs.cxx:99
 TEveVSDStructs.cxx:100
 TEveVSDStructs.cxx:101
 TEveVSDStructs.cxx:102
 TEveVSDStructs.cxx:103
 TEveVSDStructs.cxx:104
 TEveVSDStructs.cxx:105
 TEveVSDStructs.cxx:106
 TEveVSDStructs.cxx:107
 TEveVSDStructs.cxx:108
 TEveVSDStructs.cxx:109
 TEveVSDStructs.cxx:110
 TEveVSDStructs.cxx:111
 TEveVSDStructs.cxx:112
 TEveVSDStructs.cxx:113
 TEveVSDStructs.cxx:114
 TEveVSDStructs.cxx:115
 TEveVSDStructs.cxx:116
 TEveVSDStructs.cxx:117
 TEveVSDStructs.cxx:118
 TEveVSDStructs.cxx:119
 TEveVSDStructs.cxx:120
 TEveVSDStructs.cxx:121
 TEveVSDStructs.cxx:122
 TEveVSDStructs.cxx:123
 TEveVSDStructs.cxx:124
 TEveVSDStructs.cxx:125
 TEveVSDStructs.cxx:126
 TEveVSDStructs.cxx:127
 TEveVSDStructs.cxx:128
 TEveVSDStructs.cxx:129
 TEveVSDStructs.cxx:130
 TEveVSDStructs.cxx:131
 TEveVSDStructs.cxx:132
 TEveVSDStructs.cxx:133
 TEveVSDStructs.cxx:134
 TEveVSDStructs.cxx:135
 TEveVSDStructs.cxx:136
 TEveVSDStructs.cxx:137
 TEveVSDStructs.cxx:138
 TEveVSDStructs.cxx:139
 TEveVSDStructs.cxx:140
 TEveVSDStructs.cxx:141
 TEveVSDStructs.cxx:142
 TEveVSDStructs.cxx:143
 TEveVSDStructs.cxx:144
 TEveVSDStructs.cxx:145
 TEveVSDStructs.cxx:146
 TEveVSDStructs.cxx:147
 TEveVSDStructs.cxx:148
 TEveVSDStructs.cxx:149
 TEveVSDStructs.cxx:150
 TEveVSDStructs.cxx:151
 TEveVSDStructs.cxx:152
 TEveVSDStructs.cxx:153
 TEveVSDStructs.cxx:154
 TEveVSDStructs.cxx:155
 TEveVSDStructs.cxx:156
 TEveVSDStructs.cxx:157
 TEveVSDStructs.cxx:158
 TEveVSDStructs.cxx:159
 TEveVSDStructs.cxx:160
 TEveVSDStructs.cxx:161
 TEveVSDStructs.cxx:162
 TEveVSDStructs.cxx:163
 TEveVSDStructs.cxx:164
 TEveVSDStructs.cxx:165
 TEveVSDStructs.cxx:166
 TEveVSDStructs.cxx:167
 TEveVSDStructs.cxx:168
 TEveVSDStructs.cxx:169
 TEveVSDStructs.cxx:170
 TEveVSDStructs.cxx:171
 TEveVSDStructs.cxx:172
 TEveVSDStructs.cxx:173
 TEveVSDStructs.cxx:174
 TEveVSDStructs.cxx:175