Fork me on GitHub

Changes in / [22138b0:bae4fe8] in git


Ignore:
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • modules/TrackCountingBTagging.cc

    r22138b0 rbae4fe8  
    7272  fNtracks = GetInt("Ntracks", 3);
    7373
     74  fUse3D = GetBool("Use3D", false);
     75
    7476  // import input array(s)
    7577
     
    9597  Candidate *jet, *track;
    9698
    97   Double_t jpx, jpy;
     99  Double_t jpx, jpy, jpz;
    98100  Double_t dr, tpt;
    99   Double_t xd, yd, d0, dd0, ip, sip;
     101  Double_t xd, yd, zd, d0, dd0, dz, ddz, sip;
    100102
    101103  Int_t sign;
     
    110112    jpx = jetMomentum.Px();
    111113    jpy = jetMomentum.Py();
     114    jpz = jetMomentum.Pz();
    112115
    113116    // loop over all input tracks
    114117    fItTrackInputArray->Reset();
    115118    count = 0;
    116     while((track = static_cast<Candidate*>(fItTrackInputArray->Next())))
     119    // stop once we have enough tracks
     120    while((track = static_cast<Candidate*>(fItTrackInputArray->Next())) and count < fNtracks)
    117121    {
    118122      const TLorentzVector &trkMomentum = track->Momentum;
     123      tpt = trkMomentum.Pt();
     124      if(tpt < fPtMin) continue;
    119125     
     126      d0 = TMath::Abs(track->D0);
     127      if(d0 > fIPmax) continue;
     128
    120129      dr = jetMomentum.DeltaR(trkMomentum);
    121       tpt = trkMomentum.Pt();
     130      if(dr > fDeltaR) continue;
     131
    122132      xd = track->Xd;
    123133      yd = track->Yd;
    124       d0 = TMath::Hypot(xd, yd);
    125       dd0 = track->ErrorD0;
     134      zd = track->Zd;
     135      dd0 = TMath::Abs(track->ErrorD0);
     136      dz = TMath::Abs(track->DZ);
     137      ddz = TMath::Abs(track->ErrorDZ);
    126138
    127       if(tpt < fPtMin) continue;
    128       if(dr > fDeltaR) continue;
    129       if(d0 > fIPmax) continue;
    130 
    131       sign = (jpx*xd + jpy*yd > 0.0) ? 1 : -1;
    132 
    133       ip = sign*d0;
    134       sip = ip / TMath::Abs(dd0);
     139      if(fUse3D){
     140        sign = (jpx*xd + jpy*yd + jpz*zd > 0.0) ? 1 : -1;
     141        //add transverse and longitudinal significances in quadrature
     142        sip = sign * TMath::Sqrt( TMath::Power(d0 / dd0, 2) + TMath::Power(dz / ddz, 2) );
     143      }
     144      else {
     145        sign = (jpx*xd + jpy*yd > 0.0) ? 1 : -1;
     146        sip = sign * d0 / TMath::Abs(dd0);
     147      }
    135148
    136149      if(sip > fSigMin) count++;
  • modules/TrackCountingBTagging.h

    r22138b0 rbae4fe8  
    5454  Double_t fSigMin;
    5555  Int_t    fNtracks;
     56  Bool_t   fUse3D;
    5657
    5758  TIterator *fItTrackInputArray; //!
  • modules/TrackSmearing.cc

    r22138b0 rbae4fe8  
    6161void TrackSmearing::Init()
    6262{
     63  fBz = GetDouble("Bz", 0.0);
     64
    6365  // read resolution formula
    6466
     
    158160  Double_t pt, eta, d0, d0Error, trueD0, dz, dzError, trueDZ, p, pError, trueP, ctgTheta, ctgThetaError, trueCtgTheta, phi, phiError, truePhi;
    159161  Double_t x, y, z, t, px, py, pz, theta;
     162  Double_t q, r;
     163  Double_t x_c, y_c, r_c, phi_0;
     164  Double_t rcu, rc2, xd, yd, zd;
     165  const Double_t c_light = 2.99792458E8;
    160166  TProfile2D *d0ErrorHist = NULL,
    161167             *dzErrorHist = NULL,
     
    349355    y = candidate->InitialPosition.Y ();
    350356    candidate->InitialPosition.SetZ (z + ((pz * (px * (x - beamSpotPosition.X ()) + py * (y - beamSpotPosition.Y ())) + pt * pt * (dz - z)) / (pt * pt)));
    351  
     357    z = candidate->InitialPosition.Z ();
     358
    352359    candidate->InitialPosition.SetT(t);
    353    
     360
     361    // update closest approach
     362    x *= 1.0E-3;
     363    y *= 1.0E-3;
     364    z *= 1.0E-3;
     365
     366    q = candidate->Charge;
     367
     368    r = pt / (q * fBz) * 1.0E9/c_light;        // in [m]
     369    phi_0 = TMath::ATan2(py, px); // [rad] in [-pi, pi]
     370
     371    // 2. helix axis coordinates
     372    x_c = x + r*TMath::Sin(phi_0);
     373    y_c = y - r*TMath::Cos(phi_0);
     374    r_c = TMath::Hypot(x_c, y_c);
     375
     376    rcu = TMath::Abs(r);
     377    rc2 = r_c*r_c;
     378
     379    // calculate coordinates of closest approach to track circle in transverse plane xd, yd, zd
     380    xd = x_c*x_c*x_c - x_c*rcu*r_c + x_c*y_c*y_c;
     381    xd = (rc2 > 0.0) ? xd / rc2 : -999;
     382    yd = y_c*(-rcu*r_c + rc2);
     383    yd = (rc2 > 0.0) ? yd / rc2 : -999;
     384    zd = z + (TMath::Sqrt(xd*xd + yd*yd) - TMath::Sqrt(x*x + y*y))*pz/pt;
     385
     386    candidate->Xd = xd*1.0E3;
     387    candidate->Yd = yd*1.0E3;
     388    candidate->Zd = zd*1.0E3;
     389
    354390    if (fApplyToPileUp || !candidate->IsPU)
    355391    {
  • modules/TrackSmearing.h

    r22138b0 rbae4fe8  
    3232
    3333  Double_t ptError (const Double_t, const Double_t, const Double_t, const Double_t);
     34
     35  Double_t fBz;
    3436
    3537  DelphesFormula *fD0Formula; //!
Note: See TracChangeset for help on using the changeset viewer.