Fork me on GitHub

Changeset a1a25d4 in git for external/TrackCovariance


Ignore:
Timestamp:
Mar 2, 2021, 3:38:05 PM (4 years ago)
Author:
GitHub <noreply@…>
Branches:
master
Children:
4586f8f
Parents:
d3165fa (diff), 92b8d11 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
Michele Selvaggi <michele.selvaggi@…> (03/02/21 15:38:05)
git-committer:
GitHub <noreply@…> (03/02/21 15:38:05)
Message:

Merge pull request #85 from fbedesch/master

Fixed compatibility with ROOT5/minor changes to TrkUtil

Location:
external/TrackCovariance
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • external/TrackCovariance/TrkUtil.cc

    rd3165fa ra1a25d4  
    11#include "TrkUtil.h"
     2#include <iostream>
    23
    34// Constructor
     
    3132        Double_t cross = x(0) * p(1) - x(1) * p(0);
    3233        Double_t T = sqrt(pt * pt - 2 * a * cross + a * a * r2);
    33         Double_t phi0 = TMath::ATan2((p(1) - a * x(0)) / T, (p(0) + a * x(1)) / T);     // Phi0
     34        Double_t phi0 = atan2((p(1) - a * x(0)) / T, (p(0) + a * x(1)) / T);    // Phi0
    3435        Double_t D;                                                     // Impact parameter D
    3536        if (pt < 10.0) D = (T - pt) / a;
     
    4142        //Longitudinal parameters
    4243        Double_t B = C * sqrt(TMath::Max(r2 - D * D, 0.0) / (1 + 2 * C * D));
    43         Double_t st = TMath::ASin(B) / C;
     44        Double_t st = asin(B) / C;
    4445        Double_t ct = p(2) / pt;
    4546        Double_t z0 = x(2) - ct * st;
     
    6869        //
    6970        TVector3 Xval;
    70         Xval(0) = -D * TMath::Sin(phi0);
    71         Xval(1) = D * TMath::Cos(phi0);
     71        Xval(0) = -D * sin(phi0);
     72        Xval(1) = D * cos(phi0);
    7273        Xval(2) = z0;
    7374        //
     
    7677//
    7778TVector3 TrkUtil::ParToP(TVectorD Par)
     79{
     80        if (fBz == 0.0)
     81std::cout << "TrkUtil::ParToP: Warning Bz not set" << std::endl;
     82        //
     83        return ParToP(Par,fBz);
     84}
     85//
     86TVector3 TrkUtil::ParToP(TVectorD Par, Double_t Bz)
    7887{
    7988        Double_t C = Par(2);
     
    8291        //
    8392        TVector3 Pval;
    84         Double_t pt = fBz * cSpeed() / TMath::Abs(2 * C);
    85         Pval(0) = pt * TMath::Cos(phi0);
    86         Pval(1) = pt * TMath::Sin(phi0);
     93        Double_t pt = Bz * cSpeed() / TMath::Abs(2 * C);
     94        Pval(0) = pt * cos(phi0);
     95        Pval(1) = pt * sin(phi0);
    8796        Pval(2) = pt * ct;
    8897        //
     
    103112        Double_t b = -cSpeed() * fBz / 2.;
    104113        pACTS(0) = 1000 * Par(0);               // D from m to mm
    105         pACTS(1) = 1000 * Par(3);       // z0 from m to mm
     114        pACTS(1) = 1000 * Par(3);               // z0 from m to mm
    106115        pACTS(2) = Par(1);                      // Phi0 is unchanged
    107         pACTS(3) = TMath::ATan2(1.0, Par(4));           // Theta in [0, pi] range
     116        pACTS(3) = atan2(1.0, Par(4));          // Theta in [0, pi] range
    108117        pACTS(4) = Par(2) / (b * sqrt(1 + Par(4) * Par(4)));            // q/p in GeV
    109118        pACTS(5) = 0.0;                         // Time: currently undefined
  • external/TrackCovariance/TrkUtil.h

    rd3165fa ra1a25d4  
    2020        void SetBfield(Double_t Bz) { fBz = Bz; }
    2121        TVectorD XPtoPar(TVector3 x, TVector3 p, Double_t Q);
    22         TVector3 ParToX(TVectorD Par);
    2322        TVector3 ParToP(TVectorD Par);
    24         Double_t ParToQ(TVectorD Par);
    2523        //
    2624        // Conversion to ACTS parametrization
     
    4644        static Double_t cSpeed()
    4745        {
    48                 return TMath::C()*1.0e-9;       // Reduced speed of light
     46                Double_t c = 2.99792458e8;      // speed of light m/sec
     47                //return TMath::C()*1.0e-9;     // Incompatible with root5
     48                return c*1.0e-9;                // Reduced speed of light       
    4949        }
    5050        //
     
    5252        //
    5353        static TVectorD XPtoPar(TVector3 x, TVector3 p, Double_t Q, Double_t Bz);
     54        static TVector3 ParToX(TVectorD Par);                           // position of minimum distance from z axis
     55        static TVector3 ParToP(TVectorD Par, Double_t Bz);      // Get Momentum from track parameters
     56        static Double_t ParToQ(TVectorD Par);                           // Get track charge
    5457        //
    5558        // Conversion from meters to mm
Note: See TracChangeset for help on using the changeset viewer.