Fork me on GitHub

Changeset 91ef0b8 in git for examples/ExamplePVtxFit.C


Ignore:
Timestamp:
Mar 7, 2021, 9:48:26 AM (3 years ago)
Author:
Franco BEDESCHI <bed@…>
Branches:
master
Children:
bd33fce
Parents:
0d65492 (diff), 363e269 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Fixed conflicts and Reginv3

File:
1 edited

Legend:

Unmodified
Added
Removed
  • examples/ExamplePVtxFit.C

    r0d65492 r91ef0b8  
    11/*
    22Example of using vertex fitter class to fit primary vertex
    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)
     3assumed to be generated in (0,0,0)
     4*/
    95
    10 March 4, 2021
    11 F. Bedeschi, INFN-Pisa, Italy
    12 */
     6#ifdef __CLING__
     7R__LOAD_LIBRARY(libDelphes)
    138
    149#include "classes/DelphesClasses.h"
     
    1813#include "external/TrackCovariance/VertexFit.h"
    1914
    20 #include <TClonesArray.h>
    21 #include <TChain.h>
    22 #include <TVectorD.h>
    23 #include <TMatrixDSym.h>
    24 #include <TH1.h>
    25 #include <TCanvas.h>
    26 #include <TStyle.h>
     15#endif
     16
    2717
    2818//------------------------------------------------------------------------------
     
    5040        //
    5141        // Loop over all events
    52         Int_t Nev = TMath::Min(Nevent, (Int_t) numberOfEntries);
     42        Int_t Nev = TMath::Min(Nevent, (Int_t)numberOfEntries);
    5343        for (Int_t entry = 0; entry < Nev; ++entry)
    5444        {
     
    5646                treeReader->ReadEntry(entry);
    5747                Int_t Ntr = 0;  // # of tracks from primary vertex
    58                 Int_t NtrG = branchTrack->GetEntries(); // Total # of tracks
     48                Int_t NtrG = branchTrack->GetEntries();
    5949                TVectorD** pr = new TVectorD * [NtrG];
    6050                TMatrixDSym** cv = new TMatrixDSym * [NtrG];
     
    6858                                Track* trk = (Track*)branchTrack->At(it);
    6959                                //
    70                                 // Get associated generated particle 
     60                                // Get associated generated particle
    7161                                GenParticle* gp = (GenParticle*)trk->Particle.GetObject();
    7262                                //
    73                                 // Position of origin (mm)
     63                                // Position of origin in mm
    7464                                Double_t x = gp->X;
    7565                                Double_t y = gp->Y;
    7666                                Double_t z = gp->Z;
    7767                                //
    78                                 // Select group of tracks originating from the primary vertex
     68                                // group tracks originating from the primary vertex
    7969                                if (x == 0.0 && y == 0.0)
    8070                                {
     
    9080                                        //
    9181                                        pr[Ntr] = new TVectorD(obsPar);
    92                                         cv[Ntr] = new TMatrixDSym(TrkUtil::CovToMm(trk->CovarianceMatrix()));
     82                                        //std::cout<<"Cov Matrix:"<<std::endl;
     83                                        //trk->CovarianceMatrix().Print();
     84                                        cv[Ntr] = new TMatrixDSym(trk->CovarianceMatrix());
    9385                                        Ntr++;
    9486                                }
     
    115107                }
    116108
     109                //std::cout << "Vertex chi2/Ndof = " << Chi2 / Ndof << std::endl;
    117110                //
    118111                // Cleanup
     
    125118        // Show resulting histograms
    126119        //
    127         TCanvas* Cnv = new TCanvas("Cnv", "Delphes primary vertex fit pulls", 50, 50, 900, 500);
     120        TCanvas* Cnv = new TCanvas("Cnv", "Delphes primary vertex pulls", 50, 50, 900, 500);
    128121        Cnv->Divide(2, 2);
    129         Cnv->cd(1); gPad->SetLogy(1); gStyle->SetOptFit(1111); 
     122        Cnv->cd(1); gPad->SetLogy(1); gStyle->SetOptFit(1111);
    130123        hXpull->Fit("gaus"); hXpull->Draw();
    131         Cnv->cd(2); gPad->SetLogy(1); gStyle->SetOptFit(1111); 
     124        Cnv->cd(2); gPad->SetLogy(1); gStyle->SetOptFit(1111);
    132125        hYpull->Fit("gaus"); hYpull->Draw();
    133126        Cnv->cd(3); gPad->SetLogy(1); gStyle->SetOptFit(1111);
Note: See TracChangeset for help on using the changeset viewer.