Changes in / [5c03893:dd263e4] in git
- Files:
-
- 1 deleted
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
examples/ExamplePVtxFind.C
r5c03893 rdd263e4 45 45 TH1D* hTrFoundB = new TH1D("hTrFoundB", "Found BAD primary tracks", 41, -0.5, 40.5); 46 46 TH1D* hTrDiff = new TH1D("hTrDiff", "Found - available tracks", 21, -10.5, 10.5); 47 // Chi2 for cuts48 TH1D* hChi2SngP = new TH1D("hChi2SngP", "#chi^2 for single tracks", 200, 0., 50.);49 TH1D* hChi2MaxP = new TH1D("hChi2MaxP", "#chi^2 max contribution", 200, 0., 50.);50 TH1D* hChi2SngN = new TH1D("hChi2SngN", "#chi^2 for single tracks", 200, 0., 50.);51 TH1D* hChi2MaxN = new TH1D("hChi2MaxN", "#chi^2 max contribution", 200, 0., 50.);52 53 54 47 // 55 48 // Loop over all events … … 60 53 treeReader->ReadEntry(entry); 61 54 Int_t NtrG = branchTrack->GetEntries(); 62 TVectorD** pr = new TVectorD * [NtrG]; // Track Parameters63 T MatrixDSym** cv = new TMatrixDSym * [NtrG]; // Track covariances64 Bool_t *fprvx = new Bool_t[NtrG]; // Primary vertex flag55 if(entry%500 ==0)std::cout << "Event "<<entry<<" opened containing " << NtrG << " tracks" << std::endl; 56 TVectorD** pr = new TVectorD * [NtrG]; 57 TMatrixDSym** cv = new TMatrixDSym * [NtrG]; 65 58 // 66 59 // test Particle branch … … 95 88 pr[it] = new TVectorD(obsPar); 96 89 cv[it] = new TMatrixDSym(trk->CovarianceMatrix()); 90 // Check covariance 91 /* 92 TMatrixDSymEigen Eign(*cv[it]); 93 TVectorD lambda = Eign.GetEigenValues(); 94 Bool_t good = kTRUE; 95 for(Int_t i=0; i<5; i++) if(lambda(i)<0.0) good = kFALSE; 96 if(!good){ 97 std::cout<<"Cov["<<it<<"]"<<" eigenvalues: " 98 <<lambda(0)<<", "<<lambda(1)<<", "<<lambda(2)<<", " 99 <<lambda(3)<<", "<<lambda(4)<<std::endl; 100 TMatrixDSym Ctmp = *cv[it]; 101 std::cout<<"Error D (dir - cov) "<<trk->ErrorD0 102 <<" - "<<TMath::Sqrt(Ctmp(0,0))<<std::endl; 103 } 104 */ 105 //std::cout << "Track loaded it= " << it << std::endl; 97 106 // 98 107 // Find true primary vertex … … 105 114 Double_t z = gp->Z; 106 115 Bool_t prim = kTRUE; // Is primary? 107 fprvx[it] = kFALSE;108 116 Int_t mp = gp->M1; // Mother 109 117 while (mp > 0) { … … 121 129 if (prim) { // It's a primary track 122 130 Nprim++; 123 fprvx[it] = kTRUE;124 131 xpv = x; // Store true primary 125 132 ypv = y; … … 129 136 } // End loop on tracks 130 137 } 131 if(entry%500 ==0){ 132 std::cout << "Event "<<entry<<" opened containing " << NtrG << " / "<< Nprim 133 << " Total / primary tracks"<< std::endl; 134 } 135 //std::cout<<"PVtxFind true vertex: Nprim= "<<Nprim<<", x,y,z= "<<xpv<<", "<<ypv<<", "<<zpv<<std::endl; 138 std::cout<<"PVtxFind true vertex: Nprim= "<<Nprim<<", x,y,z= "<<xpv<<", "<<ypv<<", "<<zpv<<std::endl; 136 139 // 137 140 // Find primary vertex … … 158 161 TVectorD** PrSk = new TVectorD * [1]; 159 162 TMatrixDSym** CvSk = new TMatrixDSym * [1]; 160 Double_t MaxChi2 = 9.;163 Double_t MaxChi2 = 2.0+3*2.; 161 164 for (Int_t n = 0; n < NtrG; n++) { 162 165 PrSk[0] = new TVectorD(*pr[n]); … … 166 169 Double_t Chi2One = Vskim->GetVtxChi2(); 167 170 //std::cout<<"Track "<<n<<", Chi2 = "<<Chi2One<<std::endl; 168 if(fprvx[n])hChi2SngP->Fill(Chi2One);169 else hChi2SngN->Fill(Chi2One);170 //171 171 if (Chi2One < MaxChi2) { 172 172 nSkimmed[nSkim] = n; … … 184 184 // Load tracks for primary fit 185 185 Int_t MinTrk = 1; // Minumum # tracks for vertex fit 186 std::vector<Int_t> trnum;187 186 if (nSkim >= MinTrk) { 188 187 TVectorD** PrFit = new TVectorD * [nSkim]; … … 191 190 PrFit[n] = new TVectorD(*pr[nSkimmed[n]]); 192 191 CvFit[n] = new TMatrixDSym(*cv[nSkimmed[n]]); 193 trnum.push_back(nSkimmed[n]);194 192 } 195 193 delete[] nSkimmed; … … 202 200 // 203 201 // Remove tracks with large chi2 204 Double_t MaxChi2Fit = 8.0;202 Double_t MaxChi2Fit = 4.5; 205 203 Bool_t Done = kFALSE; 206 204 while (!Done) { … … 215 213 Double_t Chi2Mx = Chi2L[iMax]; 216 214 //std::cout << "Chi2Mx "<<Chi2Mx << std::endl; 217 if(fprvx[trnum[iMax]])hChi2MaxP->Fill(Chi2Mx);218 else hChi2MaxN->Fill(Chi2Mx);219 215 if (Chi2Mx > MaxChi2Fit && Nfound > 1) { 220 216 //std::cout << "Before remove. Nfound = "<<Nfound << std::endl; 221 217 Vtx->RemoveTrk(iMax); 222 trnum.erase(trnum.begin() + iMax);223 218 //std::cout << "After remove." << std::endl; 224 219 Nfound--; … … 235 230 if (Nfound >= Nmin) { 236 231 TVectorD xvtx = Vtx->GetVtx(); 237 //std::cout << "Found vertex " << xvtx(0)<<", "<<xvtx(1)<<", "<<xvtx(2) << std::endl;232 std::cout << "Found vertex " << xvtx(0)<<", "<<xvtx(1)<<", "<<xvtx(2) << std::endl; 238 233 TMatrixDSym covX = Vtx->GetVtxCov(); 239 234 Double_t Chi2 = Vtx->GetVtxChi2(); … … 261 256 delete[] PrFit; 262 257 delete[] CvFit; 263 delete[] fprvx;264 trnum.clear();265 258 } 266 259 … … 278 271 TCanvas* Cnv = new TCanvas("Cnv", "Delphes primary vertex pulls", 50, 50, 900, 500); 279 272 Cnv->Divide(2, 2); 280 Cnv->cd(1); gPad->SetLogy(1); gStyle->SetOptFit(1111); gStyle->SetOptStat(111111);273 Cnv->cd(1); gPad->SetLogy(1); gStyle->SetOptFit(1111); 281 274 hXpull->Fit("gaus"); hXpull->Draw(); 282 Cnv->cd(2); gPad->SetLogy(1); gStyle->SetOptFit(1111); gStyle->SetOptStat(111111);275 Cnv->cd(2); gPad->SetLogy(1); gStyle->SetOptFit(1111); 283 276 hYpull->Fit("gaus"); hYpull->Draw(); 284 Cnv->cd(3); gPad->SetLogy(1); gStyle->SetOptFit(1111); gStyle->SetOptStat(111111);277 Cnv->cd(3); gPad->SetLogy(1); gStyle->SetOptFit(1111); 285 278 hZpull->Fit("gaus"); hZpull->Draw(); 286 279 Cnv->cd(4); hChi2->Draw(); … … 295 288 CnvN->cd(3); 296 289 hTrDiff->Draw(); 297 //298 TCanvas* CnvCh = new TCanvas("CnvCh", "#chi^2", 200, 200, 900, 500);299 CnvCh->Divide(2,1);300 CnvCh->cd(1);301 hChi2SngP->Draw();302 hChi2SngN->SetLineColor(kRed);303 hChi2SngN->Draw("SAME");304 CnvCh->cd(2);305 hChi2MaxP->Draw();306 hChi2MaxN->SetLineColor(kRed);307 hChi2MaxN->Draw("SAME");308 290 } -
external/TrackCovariance/ObsTrk.cc
r5c03893 rdd263e4 74 74 fCovILC.ResizeTo(5, 5); 75 75 fGenPar = XPtoPar(fGenX, fGenP, Q); 76 fGenParMm = ParToMm(fGenPar);77 76 fGenParACTS = ParToACTS(fGenPar); 78 77 fGenParILC = ParToILC(fGenPar); 79 78 // 80 79 fObsPar = GenToObsPar(fGenPar); 81 fObsParMm = ParToMm(fObsPar);82 80 fObsParACTS = ParToACTS(fObsPar); 83 81 fObsParILC = ParToILC(fObsPar); … … 85 83 fObsP = ParToP(fObsPar); 86 84 fObsQ = ParToQ(fObsPar); 87 fCovMm = CovToMm(fCov);88 85 fCovACTS = CovToACTS(fObsPar, fCov); 89 86 fCovILC = CovToILC(fCov); -
external/TrackCovariance/VertexFit.cc
r5c03893 rdd263e4 17 17 { 18 18 fNtr = 0; 19 fR start= -1.0;19 fRold = -1.0; 20 20 fVtxDone = kFALSE; 21 21 fVtxCst = kFALSE; … … 31 31 { 32 32 fNtr = Ntr; 33 fR start= -1.0;33 fRold = -1.0; 34 34 fVtxDone = kFALSE; 35 35 fVtxCst = kFALSE; … … 55 55 { 56 56 fNtr = Ntr; 57 fR start= -1.0;57 fRold = -1.0; 58 58 fVtxDone = kFALSE; 59 59 fVtxCst = kFALSE; … … 220 220 std::vector<TVectorD*> x0i; // Tracks at ma 221 221 std::vector<TVectorD*> ni; // Track derivative wrt phase 222 std::vector<TMatrixDSym*> Ci; 222 std::vector<TMatrixDSym*> Ci; // Position error matrix at fixed phase 223 223 std::vector<TVectorD*> wi; // Ci*ni 224 std::vector<Double_t> s_in; // Starting phase225 //226 //227 224 // 228 225 // Track loop 229 226 for (Int_t i = 0; i < fNtr; i++) 230 227 { 228 Double_t s = 0.; 231 229 TVectorD par = *fPar[i]; 232 230 TMatrixDSym Cov = *fCov[i]; 233 Double_t s = 0.; 234 // Case when starting radius is provided 235 if(fRstart > TMath::Abs(par(0))){ 236 s = 2.*TMath::ASin(par(2)*TMath::Sqrt((fRstart*fRstart-par(0)*par(0))/(1.+2.*par(2)*par(0)))); 237 } 238 // 239 x0i.push_back(new TVectorD(Fill_x(par, s))); 231 x0i.push_back(new TVectorD(Fill_x0(par))); 240 232 ni.push_back(new TVectorD(derXds(par, s))); 241 233 TMatrixD A = derXdPar(par, s); … … 243 235 TMatrixDSym Cinv = RegInv(*Ci[i]); 244 236 wi.push_back(new TVectorD(Cinv * (*ni[i]))); 245 s_in.push_back(s);246 237 } 247 238 //std::cout << "Vtx init completed. fNtr = "<<fNtr << std::endl; … … 271 262 for (Int_t i = 0; i < fNtr; i++){ 272 263 Double_t si = Dot(*wi[i], fXv - (*x0i[i])) / Ci[i]->Similarity(*wi[i]); 273 ffi.push_back(si +s_in[i]);264 ffi.push_back(si); 274 265 //TVectorD xvi = Fill_x(*fPar[i],si); 275 266 //std::cout << "Fast vertex "<<i<<": xvi = "<<xvi(0)<<", "<<xvi(1)<<", "<<xvi(2) … … 289 280 Ci.clear(); 290 281 wi.clear(); 291 s_in.clear();292 282 } 293 283 // … … 412 402 // 413 403 fVtxDone = kTRUE; // Set fit completion flag 414 //fRstart= TMath::Sqrt(fXv(0)*fXv(0) + fXv(1)*fXv(1)); // Store fit404 fRold = TMath::Sqrt(fXv(0)*fXv(0) + fXv(1)*fXv(1)); // Store fit 415 405 //std::cout << "Found vertex " << fXv(0) << ", " << fXv(1) << ", " << fXv(2) 416 406 // << ", after "<<Ntry<<" iterations"<<std::endl; -
external/TrackCovariance/VertexFit.h
r5c03893 rdd263e4 36 36 // Results 37 37 Bool_t fVtxDone; // Flag vertex fit completed 38 Double_t fR start; // Starting value of vertex radius (0 = none)38 Double_t fRold; // Current value of vertex radius 39 39 TVectorD fXv; // Found vertex 40 40 TMatrixDSym fcovXv; // Vertex covariance … … 83 83 // Handle tracks/constraints 84 84 void AddVtxConstraint(TVectorD xv, TMatrixDSym cov); // Add gaussian vertex constraint 85 void AddTrk(TVectorD *par, TMatrixDSym *Cov); // Add track to input list 86 void RemoveTrk(Int_t iTrk); // Remove iTrk track 87 void SetStartR(Double_t R) { fRstart = R; }; // Set starting radius 85 void AddTrk(TVectorD *par, TMatrixDSym *Cov); // Add track to input list 86 void RemoveTrk(Int_t iTrk); // Remove iTrk track 88 87 // 89 88 };
Note:
See TracChangeset
for help on using the changeset viewer.