Fork me on GitHub

Ignore:
Timestamp:
Feb 23, 2022, 4:24:07 PM (3 years ago)
Author:
GitHub <noreply@…>
Branches:
master
Children:
3a105e5
Parents:
dd263e4 (diff), 00b14d5 (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@…> (02/23/22 16:24:07)
git-committer:
GitHub <noreply@…> (02/23/22 16:24:07)
Message:

Merge pull request #105 from fbedesch/master

Add method to get first track hit in ObsTrk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • external/TrackCovariance/SolTrack.cc

    rdd263e4 r56fb0be  
    232232        //
    233233        return kmh;
     234}
     235//
     236Int_t SolTrack::FirstHit(Double_t &Xfirst, Double_t &Yfirst, Double_t &Zfirst)
     237{
     238        Int_t iFirst = -1;     
     239        Int_t iFirstLay = -1;   // Default return with no hits
     240        Xfirst = 0.;
     241        Yfirst = 0.;
     242        Zfirst = 0.;
     243        Int_t Nmh = nmHit();    // # measurement hits
     244        if(Nmh > 0){
     245                Int_t    *ih = new Int_t   [Nmh];
     246                Double_t *Xh = new Double_t[Nmh];
     247                Double_t *Yh = new Double_t[Nmh];
     248                Double_t *Zh = new Double_t[Nmh];
     249                Double_t *dh = new Double_t[Nmh];
     250                //
     251                Int_t n = HitListXYZ(ih, Xh, Yh, Zh);   
     252                //
     253                for(Int_t i=0; i<Nmh; i++){
     254                        Double_t rr = TMath::Sqrt(Xh[i]*Xh[i]+Yh[i]*Yh[i]);     // Hit radius           
     255                        dh[i] = TMath::ASin(C() * TMath::Sqrt((rr * rr - D() * D()) / (1. + 2 * C() * D()))) / C();     // Arc length traveled
     256                }
     257                //
     258                Int_t *hord = new Int_t[Nmh];                   // hit order by increasing arc length
     259                TMath::Sort(Nmh, dh, hord, kFALSE);             // Order by increasing arc length
     260                iFirst = hord[0];                               // First hit pointer
     261                Xfirst = Xh[iFirst];
     262                Yfirst = Yh[iFirst];
     263                Zfirst = Zh[iFirst];
     264                iFirstLay = ih[iFirst];
     265                //
     266                // Clean
     267                delete [] ih;
     268                delete [] Xh;
     269                delete [] Yh;
     270                delete [] Zh;
     271                delete [] dh;
     272                delete [] hord;
     273        }
     274//
     275        return  iFirstLay;      // Return first hit layer number
    234276}
    235277//
Note: See TracChangeset for help on using the changeset viewer.