Fork me on GitHub

Changeset 60e1de6 in git for modules/ParticlePropagator.cc


Ignore:
Timestamp:
Jun 6, 2018, 11:54:55 AM (6 years ago)
Author:
Pavel Demin <pavel-demin@…>
Branches:
ImprovedOutputFile, Timing, dual_readout, llp, master
Children:
5b51d33
Parents:
748ce07
Message:

simplify DenseTrackFilter

File:
1 edited

Legend:

Unmodified
Added
Removed
  • modules/ParticlePropagator.cc

    r748ce07 r60e1de6  
    124124void ParticlePropagator::Process()
    125125{
    126   Candidate *candidate, *mother;
    127   TLorentzVector candidatePosition, candidateMomentum, beamSpotPosition;
     126  Candidate *candidate, *mother, *particle;
     127  TLorentzVector particlePosition, particleMomentum, beamSpotPosition;
    128128  Double_t px, py, pz, pt, pt2, e, q;
    129129  Double_t x, y, z, t, r, phi;
     
    151151  while((candidate = static_cast<Candidate*>(fItInputArray->Next())))
    152152  {
    153     candidatePosition = candidate->Position;
    154     candidateMomentum = candidate->Momentum;
    155     x = candidatePosition.X()*1.0E-3;
    156     y = candidatePosition.Y()*1.0E-3;
    157     z = candidatePosition.Z()*1.0E-3;
     153    if(candidate->GetCandidates()->GetEntriesFast() == 0)
     154    {
     155      particle = candidate;
     156    }
     157    else
     158    {
     159      particle = static_cast<Candidate*>(candidate->GetCandidates()->At(0));
     160    }
     161
     162    particlePosition = particle->Position;
     163    particleMomentum = particle->Momentum;
     164    x = particlePosition.X()*1.0E-3;
     165    y = particlePosition.Y()*1.0E-3;
     166    z = particlePosition.Z()*1.0E-3;
    158167
    159168    bsx = beamSpotPosition.X()*1.0E-3;
     
    161170    bsz = beamSpotPosition.Z()*1.0E-3;
    162171
    163     q = candidate->Charge;
     172    q = particle->Charge;
    164173
    165174    // check that particle position is inside the cylinder
     
    169178    }
    170179
    171     px = candidateMomentum.Px();
    172     py = candidateMomentum.Py();
    173     pz = candidateMomentum.Pz();
    174     pt = candidateMomentum.Pt();
    175     pt2 = candidateMomentum.Perp2();
    176     e = candidateMomentum.E();
     180    px = particleMomentum.Px();
     181    py = particleMomentum.Py();
     182    pz = particleMomentum.Pz();
     183    pt = particleMomentum.Pt();
     184    pt2 = particleMomentum.Perp2();
     185    e = particleMomentum.E();
    177186
    178187    if(pt2 < 1.0E-9)
     
    186195      candidate = static_cast<Candidate*>(candidate->Clone());
    187196
    188       candidate->InitialPosition = candidatePosition;
    189       candidate->Position = candidatePosition;
     197      candidate->InitialPosition = particlePosition;
     198      candidate->Position = particlePosition;
    190199      candidate->L = 0.0;
    191200
    192       candidate->Momentum = candidateMomentum;
     201      candidate->Momentum = particleMomentum;
    193202      candidate->AddCandidate(mother);
    194203
     
    230239      candidate = static_cast<Candidate*>(candidate->Clone());
    231240
    232       candidate->InitialPosition = candidatePosition;
    233       candidate->Position.SetXYZT(x_t*1.0E3, y_t*1.0E3, z_t*1.0E3, candidatePosition.T() + t*e*1.0E3);
     241      candidate->InitialPosition = particlePosition;
     242      candidate->Position.SetXYZT(x_t*1.0E3, y_t*1.0E3, z_t*1.0E3, particlePosition.T() + t*e*1.0E3);
    234243      candidate->L = l*1.0E3;
    235244
    236       candidate->Momentum = candidateMomentum;
     245      candidate->Momentum = particleMomentum;
    237246      candidate->AddCandidate(mother);
    238247
     
    295304      px = TMath::Sign(1.0, r) * pt * (-y_c / r_c);
    296305      py = TMath::Sign(1.0, r) * pt * (x_c / r_c);
    297       etap = candidateMomentum.Eta();
     306      etap = particleMomentum.Eta();
    298307      phip = TMath::ATan2(py, px);
    299308
    300       candidateMomentum.SetPtEtaPhiE(pt, etap, phip, candidateMomentum.E());
     309      particleMomentum.SetPtEtaPhiE(pt, etap, phip, particleMomentum.E());
    301310
    302311      // calculate additional track parameters (correct for beamspot position)
     
    304313      d0        = ((x - bsx) * py - (y - bsy) * px) / pt;
    305314      dz        = z - ((x - bsx) * px + (y - bsy) * py) / pt * (pz / pt);
    306       p         = candidateMomentum.P();
    307       ctgTheta  = 1.0 / TMath::Tan (candidateMomentum.Theta());
     315      p         = particleMomentum.P();
     316      ctgTheta  = 1.0 / TMath::Tan (particleMomentum.Theta());
    308317
    309318
     
    363372
    364373        // store these variables before cloning
    365         candidate->D0 = d0*1.0E3;
    366         candidate->DZ = dz*1.0E3;
    367         candidate->P  = p;
    368         candidate->PT = pt;
    369         candidate->CtgTheta = ctgTheta;
    370         candidate->Phi = phip;
     374        particle->D0 = d0*1.0E3;
     375        particle->DZ = dz*1.0E3;
     376        particle->P  = p;
     377        particle->PT = pt;
     378        particle->CtgTheta = ctgTheta;
     379        particle->Phi = phip;
    371380
    372381        mother = candidate;
    373382        candidate = static_cast<Candidate*>(candidate->Clone());
    374383
    375         candidate->InitialPosition = candidatePosition;
    376         candidate->Position.SetXYZT(x_t*1.0E3, y_t*1.0E3, z_t*1.0E3, candidatePosition.T() + t*c_light*1.0E3);
    377 
    378         candidate->Momentum = candidateMomentum;
     384        candidate->InitialPosition = particlePosition;
     385        candidate->Position.SetXYZT(x_t*1.0E3, y_t*1.0E3, z_t*1.0E3, particlePosition.T() + t*c_light*1.0E3);
     386
     387        candidate->Momentum = particleMomentum;
    379388
    380389        candidate->L = l*1.0E3;
Note: See TracChangeset for help on using the changeset viewer.