nuisance is hosted by Hepforge, IPPP Durham
close Warning: Can't synchronize with repository "(default)" ("(default)" is not readable or not a Git repository.). Look in the Trac log for more information.

Changes between Version 43 and Version 44 of HowToAddSample


Ignore:
Timestamp:
Jan 6, 2017, 2:38:27 PM (7 years ago)
Author:
Clarence Wret
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • HowToAddSample

    v43 v44  
    260260
    261261{{{
    262   // Need to make sure there's a muon
    263   if (event->NumFSParticle(13) == 0) return;
    264 }}}
    265 
    266 To then get the muon kinematics in the `FitEvent` we use `FitEvent::GetHMFSParticle(int pdg)` to get the '''H'''ighest'''M'''omentum'''F'''inal'''S'''tate'''Particle''', which return a `FitParticle` object. The implementation for the `FitParticle` is in `FitBase/FitParticle.cxx`. We can now access the ROOT object `TLorentzVector` which stores the kinematics for the muon. So to get the muon we do:
    267 
    268 {{{
    269   // Get the muon
    270   TLorentzVector Pmu  = event->GetHMFSParticle(13)->fP;
     262// Need to make sure there's a muon
     263if (event->NumFSParticle(13) == 0) return;
     264}}}
     265
     266To then get the muon kinematics in the `FitEvent` we use `FitEvent::GetHMFSParticle(int pdg)` to get the '''H'''ighest'''M'''omentum'''F'''inal'''S'''tate particle, which return a `FitParticle` object. The implementation for `FitParticle` is in `FitBase/FitParticle.cxx`. We can now access the ROOT object `TLorentzVector` in the `FitParticle` which stores the kinematics for the muon. So after we know there's a muon in the event we get the muon by:
     267
     268{{{
     269// Get the muon
     270TLorentzVector Pmu  = event->GetHMFSParticle(13)->fP;
     271}}}
     272
     273Now we just need the momentum of this `TLorentzVector`, which can simply be done by calling `TLorentzVector::Vect()::Mag()`, amongst others.
     274
     275However, we recommend using the `FitUtils` namespace to unify the implementations and minimize errors. The `FitUtils` namespace lives in `src/Utils/FitUtils.cxx`, in which we see the `double p(TLorentzVector)` function.
     276
     277To get the muon momentum (in GeV) we do
     278
     279{{{
     280double p_mu = FitUtils::p(Pmu);
     281}}}
     282
     283and then to finally set the `Measurement1D` member which saves the dependent variable we do
     284
     285{{{
     286fXVar = p_mu
     287
     288return;
    271289}}}
    272290=== For the E^rec^,,nu,, ===