- Timestamp:
- Mar 7, 2021, 9:48:26 AM (4 years ago)
- 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. - Location:
- examples
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
examples/Example6.C
r0d65492 r91ef0b8 64 64 // CEntral track over min Pt 65 65 TH1* histPtgenC = new TH1F("h_PtgenC", "Generated Pt - Central", 500, 0., 50.); // pt for central tracks; 66 TH1* histPtobsC = new TH1F("h_PtobsC", "Reconstructed Pt - Central", 500, 0., 50.); // pt for central 66 TH1* histPtobsC = new TH1F("h_PtobsC", "Reconstructed Pt - Central", 500, 0., 50.); // pt for central 67 67 TH1* histCtgenH = new TH1F("h_CtgenH", "Generateded Cotangent", 100, -10., 10.); // cot(theta) for high pt tracks; 68 68 TH1* histCtobsH = new TH1F("h_CtobsH", "Reconstructed Cotangent", 100, -10., 10.); // cot(theta) for high pt tracks … … 77 77 // 78 78 // Get magnetifc field 79 Double_t Bz = 2.0;79 Double_t Bz = treeReader->GetInfo("Bz"); 80 80 81 81 // Loop over all events … … 107 107 histCtobs->Fill(obsCtg); 108 108 // 109 // Get associated generated particle 109 // Get associated generated particle 110 110 GenParticle* gp = (GenParticle*)trk->Particle.GetObject(); 111 111 // … … 162 162 GenParticle* gpart = (GenParticle*)branchGenPart->At(it); 163 163 // 164 // Plot charged particle parameters 164 // Plot charged particle parameters 165 165 // Only final state particles (Status = 1) 166 166 if (gpart->Status == 1 && TMath::Abs(gpart->Charge) > 0) { … … 290 290 histAccCtgH->Draw(); 291 291 Cnv5->cd(3); gPad->SetLogy(1); 292 histPtgenC->Draw(); 292 histPtgenC->Draw(); 293 293 histPtobsC->SetLineColor(kRed); 294 294 histPtobsC->Draw("SAME"); -
examples/ExamplePVtxFit.C
r0d65492 r91ef0b8 1 1 /* 2 2 Example 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) 3 assumed to be generated in (0,0,0) 4 */ 9 5 10 March 4, 2021 11 F. Bedeschi, INFN-Pisa, Italy 12 */ 6 #ifdef __CLING__ 7 R__LOAD_LIBRARY(libDelphes) 13 8 14 9 #include "classes/DelphesClasses.h" … … 18 13 #include "external/TrackCovariance/VertexFit.h" 19 14 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 27 17 28 18 //------------------------------------------------------------------------------ … … 50 40 // 51 41 // Loop over all events 52 Int_t Nev = TMath::Min(Nevent, (Int_t) 42 Int_t Nev = TMath::Min(Nevent, (Int_t)numberOfEntries); 53 43 for (Int_t entry = 0; entry < Nev; ++entry) 54 44 { … … 56 46 treeReader->ReadEntry(entry); 57 47 Int_t Ntr = 0; // # of tracks from primary vertex 58 Int_t NtrG = branchTrack->GetEntries(); // Total # of tracks48 Int_t NtrG = branchTrack->GetEntries(); 59 49 TVectorD** pr = new TVectorD * [NtrG]; 60 50 TMatrixDSym** cv = new TMatrixDSym * [NtrG]; … … 68 58 Track* trk = (Track*)branchTrack->At(it); 69 59 // 70 // Get associated generated particle 60 // Get associated generated particle 71 61 GenParticle* gp = (GenParticle*)trk->Particle.GetObject(); 72 62 // 73 // Position of origin (mm)63 // Position of origin in mm 74 64 Double_t x = gp->X; 75 65 Double_t y = gp->Y; 76 66 Double_t z = gp->Z; 77 67 // 78 // Select group oftracks originating from the primary vertex68 // group tracks originating from the primary vertex 79 69 if (x == 0.0 && y == 0.0) 80 70 { … … 90 80 // 91 81 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()); 93 85 Ntr++; 94 86 } … … 115 107 } 116 108 109 //std::cout << "Vertex chi2/Ndof = " << Chi2 / Ndof << std::endl; 117 110 // 118 111 // Cleanup … … 125 118 // Show resulting histograms 126 119 // 127 TCanvas* Cnv = new TCanvas("Cnv", "Delphes primary vertex fitpulls", 50, 50, 900, 500);120 TCanvas* Cnv = new TCanvas("Cnv", "Delphes primary vertex pulls", 50, 50, 900, 500); 128 121 Cnv->Divide(2, 2); 129 Cnv->cd(1); gPad->SetLogy(1); gStyle->SetOptFit(1111); 122 Cnv->cd(1); gPad->SetLogy(1); gStyle->SetOptFit(1111); 130 123 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); 132 125 hYpull->Fit("gaus"); hYpull->Draw(); 133 126 Cnv->cd(3); gPad->SetLogy(1); gStyle->SetOptFit(1111);
Note:
See TracChangeset
for help on using the changeset viewer.