/usr/include/root/Math/GenVector/LorentzVector.h is in libroot-math-genvector-dev 5.34.30-0ubuntu8.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 | // @(#)root/mathcore:$Id$
// Authors: W. Brown, M. Fischler, L. Moneta 2005
/**********************************************************************
* *
* Copyright (c) 2005 , LCG ROOT MathLib Team *
* *
* *
**********************************************************************/
// Header file for class LorentzVector
//
// Created by: moneta at Tue May 31 17:06:09 2005
// Major mods by: fischler at Wed Jul 20 2005
//
// Last update: $Id$
//
#ifndef ROOT_Math_GenVector_LorentzVector
#define ROOT_Math_GenVector_LorentzVector 1
#ifndef ROOT_Math_GenVector_PxPyPzE4D
#include "Math/GenVector/PxPyPzE4D.h"
#endif
#ifndef ROOT_Math_GenVector_DisplacementVector3D
#include "Math/GenVector/DisplacementVector3D.h"
#endif
#ifndef ROOT_Math_GenVector_GenVectorIO
#include "Math/GenVector/GenVectorIO.h"
#endif
namespace ROOT {
namespace Math {
//__________________________________________________________________________________________
/**
Class describing a generic LorentzVector in the 4D space-time,
using the specified coordinate system for the spatial vector part.
The metric used for the LorentzVector is (-,-,-,+).
In the case of LorentzVector we don't distinguish the concepts
of points and displacement vectors as in the 3D case,
since the main use case for 4D Vectors is to describe the kinematics of
relativistic particles. A LorentzVector behaves like a
DisplacementVector in 4D. The Minkowski components could be viewed as
v and t, or for kinematic 4-vectors, as p and E.
@ingroup GenVector
*/
template< class CoordSystem >
class LorentzVector {
public:
// ------ ctors ------
typedef typename CoordSystem::Scalar Scalar;
typedef CoordSystem CoordinateType;
/**
default constructor of an empty vector (Px = Py = Pz = E = 0 )
*/
LorentzVector ( ) : fCoordinates() { }
/**
generic constructors from four scalar values.
The association between values and coordinate depends on the
coordinate system. For PxPyPzE4D,
\param a scalar value (Px)
\param b scalar value (Py)
\param c scalar value (Pz)
\param d scalar value (E)
*/
LorentzVector(const Scalar & a,
const Scalar & b,
const Scalar & c,
const Scalar & d) :
fCoordinates(a , b, c, d) { }
/**
constructor from a LorentzVector expressed in different
coordinates, or using a different Scalar type
*/
template< class Coords >
explicit LorentzVector(const LorentzVector<Coords> & v ) :
fCoordinates( v.Coordinates() ) { }
/**
Construct from a foreign 4D vector type, for example, HepLorentzVector
Precondition: v must implement methods x(), y(), z(), and t()
*/
template<class ForeignLorentzVector>
explicit LorentzVector( const ForeignLorentzVector & v) :
fCoordinates(PxPyPzE4D<Scalar>( v.x(), v.y(), v.z(), v.t() ) ) { }
#ifdef LATER
/**
construct from a generic linear algebra vector implementing operator []
and with a size of at least 4. This could be also a C array
In this case v[0] is the first data member
( Px for a PxPyPzE4D base)
\param v LA vector
\param index0 index of first vector element (Px)
*/
template< class LAVector >
explicit LorentzVector(const LAVector & v, size_t index0 ) {
fCoordinates = CoordSystem ( v[index0], v[index0+1], v[index0+2], v[index0+3] );
}
#endif
// ------ assignment ------
/**
Assignment operator from a lorentz vector of arbitrary type
*/
template< class OtherCoords >
LorentzVector & operator= ( const LorentzVector<OtherCoords> & v) {
fCoordinates = v.Coordinates();
return *this;
}
/**
assignment from any other Lorentz vector implementing
x(), y(), z() and t()
*/
template<class ForeignLorentzVector>
LorentzVector & operator = ( const ForeignLorentzVector & v) {
SetXYZT( v.x(), v.y(), v.z(), v.t() );
return *this;
}
#ifdef LATER
/**
assign from a generic linear algebra vector implementing operator []
and with a size of at least 4
In this case v[0] is the first data member
( Px for a PxPyPzE4D base)
\param v LA vector
\param index0 index of first vector element (Px)
*/
template< class LAVector >
LorentzVector & AssignFrom(const LAVector & v, size_t index0=0 ) {
fCoordinates.SetCoordinates( v[index0], v[index0+1], v[index0+2], v[index0+3] );
return *this;
}
#endif
// ------ Set, Get, and access coordinate data ------
/**
Retrieve a const reference to the coordinates object
*/
const CoordSystem & Coordinates() const {
return fCoordinates;
}
/**
get internal data into 4 Scalar numbers
*/
void GetCoordinates( Scalar& a, Scalar& b, Scalar& c, Scalar & d ) const
{ fCoordinates.GetCoordinates(a, b, c, d); }
/**
get internal data into an array of 4 Scalar numbers
*/
void GetCoordinates( Scalar dest[] ) const
{ fCoordinates.GetCoordinates(dest); }
/**
get internal data into 4 Scalars at *begin to *end
*/
template <class IT>
#ifndef NDEBUG
void GetCoordinates( IT begin, IT end ) const
#else
void GetCoordinates( IT begin, IT /* end */ ) const
#endif
{ IT a = begin; IT b = ++begin; IT c = ++begin; IT d = ++begin;
assert (++begin==end);
GetCoordinates (*a,*b,*c,*d);
}
/**
get internal data into 4 Scalars at *begin
*/
template <class IT>
void GetCoordinates( IT begin ) const {
Scalar a,b,c,d = 0;
GetCoordinates (a,b,c,d);
*begin++ = a;
*begin++ = b;
*begin++ = c;
*begin = d;
}
/**
Set internal data based on an array of 4 Scalar numbers
*/
LorentzVector<CoordSystem>& SetCoordinates( const Scalar src[] ) {
fCoordinates.SetCoordinates(src);
return *this;
}
/**
Set internal data based on 4 Scalar numbers
*/
LorentzVector<CoordSystem>& SetCoordinates( Scalar a, Scalar b, Scalar c, Scalar d ) {
fCoordinates.SetCoordinates(a, b, c, d);
return *this;
}
/**
Set internal data based on 4 Scalars at *begin to *end
*/
// Here it is needed to re-implement all the function for CINT , otherwise dictionary generation will fail
// for unknown reasons if we do as for GetCoordinates (fortunatly we will remove this in ROOT 6!)
#ifdef NDEBUG
template< class IT >
LorentzVector<CoordSystem>& SetCoordinates( IT begin, IT /*end*/ ) {
IT a = begin; IT b = ++begin; IT c = ++begin; IT d = ++begin;
assert (++begin==end);
SetCoordinates (*a,*b,*c,*d);
return *this;
}
#else
template< class IT >
LorentzVector<CoordSystem>& SetCoordinates( IT begin, IT end ) {
IT a = begin; IT b = ++begin; IT c = ++begin; IT d = ++begin;
assert (++begin==end);
SetCoordinates (*a,*b,*c,*d);
return *this;
}
#endif
/**
set the values of the vector from the cartesian components (x,y,z,t)
(if the vector is held in another coordinates, like (Pt,eta,phi,m)
then (x, y, z, t) are converted to that form)
*/
LorentzVector<CoordSystem>& SetXYZT (Scalar xx, Scalar yy, Scalar zz, Scalar tt) {
fCoordinates.SetPxPyPzE(xx,yy,zz,tt);
return *this;
}
LorentzVector<CoordSystem>& SetPxPyPzE (Scalar xx, Scalar yy, Scalar zz, Scalar ee) {
fCoordinates.SetPxPyPzE(xx,yy,zz,ee);
return *this;
}
// ------------------- Equality -----------------
/**
Exact equality
*/
bool operator==(const LorentzVector & rhs) const {
return fCoordinates==rhs.fCoordinates;
}
bool operator!= (const LorentzVector & rhs) const {
return !(operator==(rhs));
}
// ------ Individual element access, in various coordinate systems ------
// individual coordinate accessors in various coordinate systems
/**
spatial X component
*/
Scalar Px() const { return fCoordinates.Px(); }
Scalar X() const { return fCoordinates.Px(); }
/**
spatial Y component
*/
Scalar Py() const { return fCoordinates.Py(); }
Scalar Y() const { return fCoordinates.Py(); }
/**
spatial Z component
*/
Scalar Pz() const { return fCoordinates.Pz(); }
Scalar Z() const { return fCoordinates.Pz(); }
/**
return 4-th component (time, or energy for a 4-momentum vector)
*/
Scalar E() const { return fCoordinates.E(); }
Scalar T() const { return fCoordinates.E(); }
/**
return magnitude (mass) squared M2 = T**2 - X**2 - Y**2 - Z**2
(we use -,-,-,+ metric)
*/
Scalar M2() const { return fCoordinates.M2(); }
/**
return magnitude (mass) using the (-,-,-,+) metric.
If M2 is negative (space-like vector) a GenVector_exception
is suggested and if continuing, - sqrt( -M2) is returned
*/
Scalar M() const { return fCoordinates.M();}
/**
return the spatial (3D) magnitude ( sqrt(X**2 + Y**2 + Z**2) )
*/
Scalar R() const { return fCoordinates.R(); }
Scalar P() const { return fCoordinates.R(); }
/**
return the square of the spatial (3D) magnitude ( X**2 + Y**2 + Z**2 )
*/
Scalar P2() const { return P() * P(); }
/**
return the square of the transverse spatial component ( X**2 + Y**2 )
*/
Scalar Perp2( ) const { return fCoordinates.Perp2();}
/**
return the transverse spatial component sqrt ( X**2 + Y**2 )
*/
Scalar Pt() const { return fCoordinates.Pt(); }
Scalar Rho() const { return fCoordinates.Pt(); }
/**
return the transverse mass squared
\f[ m_t^2 = E^2 - p{_z}^2 \f]
*/
Scalar Mt2() const { return fCoordinates.Mt2(); }
/**
return the transverse mass
\f[ \sqrt{ m_t^2 = E^2 - p{_z}^2} X sign(E^ - p{_z}^2) \f]
*/
Scalar Mt() const { return fCoordinates.Mt(); }
/**
return the transverse energy squared
\f[ e_t = \frac{E^2 p_{\perp}^2 }{ |p|^2 } \f]
*/
Scalar Et2() const { return fCoordinates.Et2(); }
/**
return the transverse energy
\f[ e_t = \sqrt{ \frac{E^2 p_{\perp}^2 }{ |p|^2 } } X sign(E) \f]
*/
Scalar Et() const { return fCoordinates.Et(); }
/**
azimuthal Angle
*/
Scalar Phi() const { return fCoordinates.Phi();}
/**
polar Angle
*/
Scalar Theta() const { return fCoordinates.Theta(); }
/**
pseudorapidity
\f[ \eta = - \ln { \tan { \frac { \theta} {2} } } \f]
*/
Scalar Eta() const { return fCoordinates.Eta(); }
/**
get the spatial components of the Vector in a
DisplacementVector based on Cartesian Coordinates
*/
::ROOT::Math::DisplacementVector3D<Cartesian3D<Scalar> > Vect() const {
return ::ROOT::Math::DisplacementVector3D<Cartesian3D<Scalar> >( X(), Y(), Z() );
}
// ------ Operations combining two Lorentz vectors ------
/**
scalar (Dot) product of two LorentzVector vectors (metric is -,-,-,+)
Enable the product using any other LorentzVector implementing
the x(), y() , y() and t() member functions
\param q any LorentzVector implementing the x(), y() , z() and t()
member functions
\return the result of v.q of type according to the base scalar type of v
*/
template< class OtherLorentzVector >
Scalar Dot(const OtherLorentzVector & q) const {
return t()*q.t() - x()*q.x() - y()*q.y() - z()*q.z();
}
/**
Self addition with another Vector ( v+= q )
Enable the addition with any other LorentzVector
\param q any LorentzVector implementing the x(), y() , z() and t()
member functions
*/
template< class OtherLorentzVector >
inline LorentzVector & operator += ( const OtherLorentzVector & q)
{
SetXYZT( x() + q.x(), y() + q.y(), z() + q.z(), t() + q.t() );
return *this;
}
/**
Self subtraction of another Vector from this ( v-= q )
Enable the addition with any other LorentzVector
\param q any LorentzVector implementing the x(), y() , z() and t()
member functions
*/
template< class OtherLorentzVector >
LorentzVector & operator -= ( const OtherLorentzVector & q) {
SetXYZT( x() - q.x(), y() - q.y(), z() - q.z(), t() - q.t() );
return *this;
}
/**
addition of two LorentzVectors (v3 = v1 + v2)
Enable the addition with any other LorentzVector
\param v2 any LorentzVector implementing the x(), y() , z() and t()
member functions
\return a new LorentzVector of the same type as v1
*/
template<class OtherLorentzVector>
LorentzVector operator + ( const OtherLorentzVector & v2) const
{
LorentzVector<CoordinateType> v3(*this);
v3 += v2;
return v3;
}
/**
subtraction of two LorentzVectors (v3 = v1 - v2)
Enable the subtraction of any other LorentzVector
\param v2 any LorentzVector implementing the x(), y() , z() and t()
member functions
\return a new LorentzVector of the same type as v1
*/
template<class OtherLorentzVector>
LorentzVector operator - ( const OtherLorentzVector & v2) const {
LorentzVector<CoordinateType> v3(*this);
v3 -= v2;
return v3;
}
//--- scaling operations ------
/**
multiplication by a scalar quantity v *= a
*/
LorentzVector & operator *= (Scalar a) {
fCoordinates.Scale(a);
return *this;
}
/**
division by a scalar quantity v /= a
*/
LorentzVector & operator /= (Scalar a) {
fCoordinates.Scale(1/a);
return *this;
}
/**
product of a LorentzVector by a scalar quantity
\param a scalar quantity of type a
\return a new mathcoreLorentzVector q = v * a same type as v
*/
LorentzVector operator * ( const Scalar & a) const {
LorentzVector tmp(*this);
tmp *= a;
return tmp;
}
/**
Divide a LorentzVector by a scalar quantity
\param a scalar quantity of type a
\return a new mathcoreLorentzVector q = v / a same type as v
*/
LorentzVector<CoordSystem> operator / ( const Scalar & a) const {
LorentzVector<CoordSystem> tmp(*this);
tmp /= a;
return tmp;
}
/**
Negative of a LorentzVector (q = - v )
\return a new LorentzVector with opposite direction and time
*/
LorentzVector operator - () const {
//LorentzVector<CoordinateType> v(*this);
//v.Negate();
return operator*( Scalar(-1) );
}
LorentzVector operator + () const {
return *this;
}
// ---- Relativistic Properties ----
/**
Rapidity relative to the Z axis: .5 log [(E+Pz)/(E-Pz)]
*/
Scalar Rapidity() const {
// TODO - It would be good to check that E > Pz and use the Throw()
// mechanism or at least load a NAN if not.
// We should then move the code to a .cpp file.
Scalar ee = E();
Scalar ppz = Pz();
return .5f* std::log( (ee+ppz)/(ee-ppz) );
}
/**
Rapidity in the direction of travel: atanh (|P|/E)=.5 log[(E+P)/(E-P)]
*/
Scalar ColinearRapidity() const {
// TODO - It would be good to check that E > P and use the Throw()
// mechanism or at least load a NAN if not.
Scalar ee = E();
Scalar pp = P();
return .5f* std::log( (ee+pp)/(ee-pp) );
}
/**
Determine if momentum-energy can represent a physical massive particle
*/
bool isTimelike( ) const {
Scalar ee = E(); Scalar pp = P(); return ee*ee > pp*pp;
}
/**
Determine if momentum-energy can represent a massless particle
*/
bool isLightlike( Scalar tolerance
= 100*std::numeric_limits<Scalar>::epsilon() ) const {
Scalar ee = E(); Scalar pp = P(); Scalar delta = ee-pp;
if ( ee==0 ) return pp==0;
return delta*delta < tolerance * ee*ee;
}
/**
Determine if momentum-energy is spacelike, and represents a tachyon
*/
bool isSpacelike( ) const {
Scalar ee = E(); Scalar pp = P(); return ee*ee < pp*pp;
}
typedef DisplacementVector3D< Cartesian3D<Scalar> > BetaVector;
/**
The beta vector for the boost that would bring this vector into
its center of mass frame (zero momentum)
*/
BetaVector BoostToCM( ) const {
if (E() == 0) {
if (P() == 0) {
return BetaVector();
} else {
// TODO - should attempt to Throw with msg about
// boostVector computed for LorentzVector with t=0
return -Vect()/E();
}
}
if (M2() <= 0) {
// TODO - should attempt to Throw with msg about
// boostVector computed for a non-timelike LorentzVector
}
return -Vect()/E();
}
/**
The beta vector for the boost that would bring this vector into
its center of mass frame (zero momentum)
*/
template <class Other4Vector>
BetaVector BoostToCM(const Other4Vector& v ) const {
Scalar eSum = E() + v.E();
DisplacementVector3D< Cartesian3D<Scalar> > vecSum = Vect() + v.Vect();
if (eSum == 0) {
if (vecSum.Mag2() == 0) {
return BetaVector();
} else {
// TODO - should attempt to Throw with msg about
// boostToCM computed for two 4-vectors with combined t=0
return BetaVector(vecSum/eSum);
}
// TODO - should attempt to Throw with msg about
// boostToCM computed for two 4-vectors with combined e=0
}
return BetaVector (vecSum * (-1./eSum));
}
//beta and gamma
/**
Return beta scalar value
*/
Scalar Beta() const {
if ( E() == 0 ) {
if ( P2() == 0)
// to avoid Nan
return 0;
else {
GenVector::Throw ("LorentzVector::Beta() - beta computed for LorentzVector with t = 0. Return an Infinite result");
return 1./E();
}
}
if ( M2() <= 0 ) {
GenVector::Throw ("LorentzVector::Beta() - beta computed for non-timelike LorentzVector . Result is physically meaningless" );
}
return P() / E();
}
/**
Return Gamma scalar value
*/
Scalar Gamma() const {
Scalar v2 = P2();
Scalar t2 = E()*E();
if (E() == 0) {
if ( P2() == 0) {
return 1;
} else {
GenVector::Throw ("LorentzVector::Gamma() - gamma computed for LorentzVector with t = 0. Return a zero result");
}
}
if ( t2 < v2 ) {
GenVector::Throw ("LorentzVector::Gamma() - gamma computed for a spacelike LorentzVector. Imaginary result");
return 0;
}
else if ( t2 == v2 ) {
GenVector::Throw ("LorentzVector::Gamma() - gamma computed for a lightlike LorentzVector. Infinite result");
}
return 1./std::sqrt(1. - v2/t2 );
} /* gamma */
// Method providing limited backward name compatibility with CLHEP ----
Scalar x() const { return fCoordinates.Px(); }
Scalar y() const { return fCoordinates.Py(); }
Scalar z() const { return fCoordinates.Pz(); }
Scalar t() const { return fCoordinates.E(); }
Scalar px() const { return fCoordinates.Px(); }
Scalar py() const { return fCoordinates.Py(); }
Scalar pz() const { return fCoordinates.Pz(); }
Scalar e() const { return fCoordinates.E(); }
Scalar r() const { return fCoordinates.R(); }
Scalar theta() const { return fCoordinates.Theta(); }
Scalar phi() const { return fCoordinates.Phi(); }
Scalar rho() const { return fCoordinates.Rho(); }
Scalar eta() const { return fCoordinates.Eta(); }
Scalar pt() const { return fCoordinates.Pt(); }
Scalar perp2() const { return fCoordinates.Perp2(); }
Scalar mag2() const { return fCoordinates.M2(); }
Scalar mag() const { return fCoordinates.M(); }
Scalar mt() const { return fCoordinates.Mt(); }
Scalar mt2() const { return fCoordinates.Mt2(); }
// Methods requested by CMS ---
Scalar energy() const { return fCoordinates.E(); }
Scalar mass() const { return fCoordinates.M(); }
Scalar mass2() const { return fCoordinates.M2(); }
/**
Methods setting a Single-component
Work only if the component is one of which the vector is represented.
For example SetE will work for a PxPyPzE Vector but not for a PxPyPzM Vector.
*/
LorentzVector<CoordSystem>& SetE ( Scalar a ) { fCoordinates.SetE (a); return *this; }
LorentzVector<CoordSystem>& SetEta( Scalar a ) { fCoordinates.SetEta(a); return *this; }
LorentzVector<CoordSystem>& SetM ( Scalar a ) { fCoordinates.SetM (a); return *this; }
LorentzVector<CoordSystem>& SetPhi( Scalar a ) { fCoordinates.SetPhi(a); return *this; }
LorentzVector<CoordSystem>& SetPt ( Scalar a ) { fCoordinates.SetPt (a); return *this; }
LorentzVector<CoordSystem>& SetPx ( Scalar a ) { fCoordinates.SetPx (a); return *this; }
LorentzVector<CoordSystem>& SetPy ( Scalar a ) { fCoordinates.SetPy (a); return *this; }
LorentzVector<CoordSystem>& SetPz ( Scalar a ) { fCoordinates.SetPz (a); return *this; }
private:
CoordSystem fCoordinates; // internal coordinate system
}; // LorentzVector<>
// global nethods
/**
Scale of a LorentzVector with a scalar quantity a
\param a scalar quantity of typpe a
\param v mathcore::LorentzVector based on any coordinate system
\return a new mathcoreLorentzVector q = v * a same type as v
*/
template< class CoordSystem >
inline LorentzVector<CoordSystem> operator *
( const typename LorentzVector<CoordSystem>::Scalar & a,
const LorentzVector<CoordSystem>& v) {
LorentzVector<CoordSystem> tmp(v);
tmp *= a;
return tmp;
}
// ------------- I/O to/from streams -------------
template< class char_t, class traits_t, class Coords >
inline
std::basic_ostream<char_t,traits_t> &
operator << ( std::basic_ostream<char_t,traits_t> & os
, LorentzVector<Coords> const & v
)
{
if( !os ) return os;
typename Coords::Scalar a, b, c, d;
v.GetCoordinates(a, b, c, d);
if( detail::get_manip( os, detail::bitforbit ) ) {
detail::set_manip( os, detail::bitforbit, '\00' );
// TODO: call MF's bitwise-accurate functions on each of a, b, c, d
}
else {
os << detail::get_manip( os, detail::open ) << a
<< detail::get_manip( os, detail::sep ) << b
<< detail::get_manip( os, detail::sep ) << c
<< detail::get_manip( os, detail::sep ) << d
<< detail::get_manip( os, detail::close );
}
return os;
} // op<< <>()
template< class char_t, class traits_t, class Coords >
inline
std::basic_istream<char_t,traits_t> &
operator >> ( std::basic_istream<char_t,traits_t> & is
, LorentzVector<Coords> & v
)
{
if( !is ) return is;
typename Coords::Scalar a, b, c, d;
if( detail::get_manip( is, detail::bitforbit ) ) {
detail::set_manip( is, detail::bitforbit, '\00' );
// TODO: call MF's bitwise-accurate functions on each of a, b, c
}
else {
detail::require_delim( is, detail::open ); is >> a;
detail::require_delim( is, detail::sep ); is >> b;
detail::require_delim( is, detail::sep ); is >> c;
detail::require_delim( is, detail::sep ); is >> d;
detail::require_delim( is, detail::close );
}
if( is )
v.SetCoordinates(a, b, c, d);
return is;
} // op>> <>()
} // end namespace Math
} // end namespace ROOT
#endif
//#include "Math/GenVector/LorentzVectorOperations.h"
|