- Timestamp:
- Mar 4, 2021, 10:20:54 AM (4 years ago)
- Branches:
- master
- Children:
- 3dc190c
- Parents:
- 85aa1f4
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
examples/ExamplePVtxFit.C
r85aa1f4 rc24ad79 1 1 /* 2 2 Example of using vertex fitter class to fit primary vertex 3 assumed to be generated in (0,0,0) 3 assumed to be generated in (0,0,0). 4 To run compiled version: 5 root 6 root> .L examples/LoadPvtxFit.C+ 7 root> LoadPVtxFit() 8 root> ExamplePVtxFit("infile.root", Nevents) 9 10 March 4, 2021 11 F. Bedeschi, INFN-Pisa, Italy 4 12 */ 5 13 … … 12 20 #include <TClonesArray.h> 13 21 #include <TChain.h> 14 #include <TVector3.h>15 22 #include <TVectorD.h> 16 23 #include <TMatrixDSym.h> … … 49 56 treeReader->ReadEntry(entry); 50 57 Int_t Ntr = 0; // # of tracks from primary vertex 51 Int_t NtrG = branchTrack->GetEntries(); 58 Int_t NtrG = branchTrack->GetEntries(); // Total # of tracks 52 59 TVectorD** pr = new TVectorD * [NtrG]; 53 60 TMatrixDSym** cv = new TMatrixDSym * [NtrG]; … … 64 71 GenParticle* gp = (GenParticle*)trk->Particle.GetObject(); 65 72 // 66 // Position of origin in meters67 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; 70 77 // 71 // grouptracks originating from the primary vertex78 // Select group of tracks originating from the primary vertex 72 79 if (x == 0.0 && y == 0.0) 73 80 { … … 81 88 Double_t oPar[5] = { obsD0, obsPhi, obsC, obsZ0, obsCtg }; 82 89 TVectorD obsPar(5, oPar); // Fill observed parameters 83 TVector3 xv(x, y, z);84 90 // 85 91 pr[Ntr] = new TVectorD(obsPar); … … 88 94 } 89 95 } // End loop on tracks 90 //std::cout << "Total of " << Ntr << " primary tracks out of " << NtrG << " tracks" << std::endl;91 96 } 92 97 // … … 110 115 } 111 116 112 //std::cout << "Vertex chi2/Ndof = " << Chi2 / Ndof << std::endl;113 117 // 114 118 // Cleanup
Note:
See TracChangeset
for help on using the changeset viewer.