Fork me on GitHub

Changeset c24ad79 in git for examples/ExamplePVtxFit.C


Ignore:
Timestamp:
Mar 4, 2021, 10:20:54 AM (3 years ago)
Author:
Franco BEDESCHI <bed@…>
Branches:
master
Children:
3dc190c
Parents:
85aa1f4
Message:

Add comments/authors

File:
1 edited

Legend:

Unmodified
Added
Removed
  • examples/ExamplePVtxFit.C

    r85aa1f4 rc24ad79  
    11/*
    22Example of using vertex fitter class to fit primary vertex
    3 assumed to be generated in (0,0,0)
     3assumed to be generated in (0,0,0).
     4To run compiled version:
     5root
     6root> .L examples/LoadPvtxFit.C+
     7root> LoadPVtxFit()
     8root> ExamplePVtxFit("infile.root", Nevents)
     9
     10March 4, 2021
     11F. Bedeschi, INFN-Pisa, Italy
    412*/
    513
     
    1220#include <TClonesArray.h>
    1321#include <TChain.h>
    14 #include <TVector3.h>
    1522#include <TVectorD.h>
    1623#include <TMatrixDSym.h>
     
    4956                treeReader->ReadEntry(entry);
    5057                Int_t Ntr = 0;  // # of tracks from primary vertex
    51                 Int_t NtrG = branchTrack->GetEntries();
     58                Int_t NtrG = branchTrack->GetEntries(); // Total # of tracks
    5259                TVectorD** pr = new TVectorD * [NtrG];
    5360                TMatrixDSym** cv = new TMatrixDSym * [NtrG];
     
    6471                                GenParticle* gp = (GenParticle*)trk->Particle.GetObject();
    6572                                //
    66                                 // Position of origin in meters
    67                                 Double_t x = 1.0e-3 * gp->X;
    68                                 Double_t y = 1.0e-3 * gp->Y;
    69                                 Double_t z = 1.0e-3 * gp->Z;
     73                                // Position of origin (mm)
     74                                Double_t x = gp->X;
     75                                Double_t y = gp->Y;
     76                                Double_t z = gp->Z;
    7077                                //
    71                                 // group tracks originating from the primary vertex
     78                                // Select group of tracks originating from the primary vertex
    7279                                if (x == 0.0 && y == 0.0)
    7380                                {
     
    8188                                        Double_t oPar[5] = { obsD0, obsPhi, obsC, obsZ0, obsCtg };
    8289                                        TVectorD obsPar(5, oPar);       // Fill observed parameters
    83                                         TVector3 xv(x, y, z);
    8490                                        //
    8591                                        pr[Ntr] = new TVectorD(obsPar);
     
    8894                                }
    8995                        }               // End loop on tracks
    90                         //std::cout << "Total of " << Ntr << " primary tracks out of " << NtrG << " tracks" << std::endl;
    9196                }
    9297                //
     
    110115                }
    111116
    112                 //std::cout << "Vertex chi2/Ndof = " << Chi2 / Ndof << std::endl;
    113117                //
    114118                // Cleanup
Note: See TracChangeset for help on using the changeset viewer.