Changes in / [a1a25d4:d3165fa] in git
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
examples/Example6.C
ra1a25d4 rd3165fa 51 51 // Track parameter pulls 52 52 TH1* histDpull = new TH1F("h_Dpull", "Pull impact parameter", 100, -10., 10.); 53 TH1* histP0pull = new TH1F("h_P0pull", "Pull #phi_{0}", 100, -10., 10.);53 TH1* histP0pull = new TH1F("h_P0pull", "Pull phi_{0}", 100, -10., 10.); 54 54 TH1* histCpull = new TH1F("h_Cpull", "Pull half curvature", 100, -10., 10.); 55 TH1* histZ0pull = new TH1F("h_Z0pull", "Pull Z _{0}", 100, -10., 10.);55 TH1* histZ0pull = new TH1F("h_Z0pull", "Pull Z0", 100, -10., 10.); 56 56 TH1* histCtpull = new TH1F("h_Ctpull", "Pull cotg(#theta)", 100, -10., 10.); 57 57 // … … 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 … … 71 71 TH1* histAccPt = new TH1F("h_AccPt", "Pt acceptance", 500, 0., 50.); 72 72 // Tracks over min pt 73 TH1* histAccCtgH = new TH1F("h_AccCtgH", "Cotangent acceptance (high pt)", 100, -10., 10.);73 TH1* histAccCtgH = new TH1F("h_AccCtgH", "Cotangent acceptance (high pt)", 500, -10., 10.); 74 74 // tracks above min angle 75 75 TH1* histAccPtC = new TH1F("h_AccPtC", "Pt acceptance (central tracks)", 500, 0., 50.); 76 76 77 77 // 78 // Get magneti fc field78 // Get magnetic field 79 79 Double_t Bz = 2.0; 80 80 … … 106 106 histZ0obs->Fill(obsZ0); 107 107 histCtobs->Fill(obsCtg); 108 // 109 // Get associated generated particle 108 110 109 GenParticle* gp = (GenParticle*)trk->Particle.GetObject(); 111 // 110 112 111 // Position of origin in meters 113 112 Double_t x = 1.0e-3 * gp->X; … … 140 139 Double_t pullZ0 = (obsZ0 - genZ0) / trk->ErrorDZ; 141 140 Double_t pullCtg = (obsCtg - genCtg) / trk->ErrorCtgTheta; 142 // 143 histDpull ->Fill(pullD0); 141 142 // 143 histDpull->Fill(pullD0); 144 144 histP0pull->Fill(pullPhi); 145 histCpull 145 histCpull->Fill(pullC); 146 146 histZ0pull->Fill(pullZ0); 147 147 histCtpull->Fill(pullCtg); … … 149 149 // Acceptance plots 150 150 Double_t obsPt = trk->PT; 151 histPtobs->Fill(obsPt);152 151 if (TMath::Abs(genCtg) < maxCtAcc)histPtobsC->Fill(obsPt); // pt for central tracks 153 if ( obsPt > minPtAcc)histCtobsH->Fill(obsCtg); // cot(theta) for high pt tracks152 if (genPt > minPtAcc)histCtobsH->Fill(obsCtg); // cot(theta) for high pt tracks 154 153 } // End loop on tracks 155 154 … … 162 161 GenParticle* gpart = (GenParticle*)branchGenPart->At(it); 163 162 // 164 // Plot charged particle parameters 163 // Plot charged particle parameters 165 164 // Only final state particles (Status = 1) 166 165 if (gpart->Status == 1 && TMath::Abs(gpart->Charge) > 0) { 167 166 // 168 // Position of origin in meters169 Double_t x = 1.0e-3 *gpart->X;170 Double_t y = 1.0e-3 *gpart->Y;171 Double_t z = 1.0e-3 *gpart->Z;167 // Position of origin 168 Double_t x = gpart->X; 169 Double_t y = gpart->Y; 170 Double_t z = gpart->Z; 172 171 TVector3 xv(x, y, z); 173 172 // … … 180 179 // Original parameters 181 180 Double_t Q = gpart->Charge; 182 TVectorD gPar = TrkUtil::XPtoPar(xv, pv, Q, Bz); // Get parameters from position and momentum 183 TVectorD genPar = TrkUtil::ParToMm(gPar); // Convert to mm 181 TVectorD genPar = TrkUtil::XPtoPar(xv, pv, Q, Bz); // Get parameters from position and momentum 184 182 // Unpack parameters 185 Double_t genD0 183 Double_t genD0 = genPar(0); 186 184 Double_t genPhi = genPar(1); 187 Double_t genC 188 Double_t genZ0 185 Double_t genC = genPar(2); 186 Double_t genZ0 = genPar(3); 189 187 Double_t genCtg = genPar(4); 190 Double_t genPt = pv.Pt();191 188 // Fill histograms 192 histDgen 189 histDgen->Fill(genD0); 193 190 histP0gen->Fill(genPhi); 194 histCgen 191 histCgen->Fill(genC); 195 192 histZ0gen->Fill(genZ0); 196 193 histCtgen->Fill(genCtg); 197 194 // 198 195 // Acceptance plots 199 histPtgen->Fill(genPt); 200 if (TMath::Abs(genCtg) < maxCtAcc)histPtgenC->Fill(genPt); 201 if (genPt > minPtAcc)histCtgenH->Fill(genCtg); 196 if (TMath::Abs(genCtg) < maxCtAcc)histPtgenC->Fill(gpart->PT); 197 if (gpart->PT > minPtAcc)histCtgenH->Fill(genCtg); 202 198 } 203 199 } … … 226 222 TCanvas* Cnv2 = new TCanvas("Cnv2", "Delphes observed track pulls", 150, 150, 900, 500); 227 223 Cnv2->Divide(3, 2); 228 Cnv2->cd(1); gPad->SetLogy(1); 229 histDpull->Draw(); 230 Cnv2->cd(2); gPad->SetLogy(1); 231 histP0pull->Draw(); 232 Cnv2->cd(3); gPad->SetLogy(1); 233 histCpull->Draw(); 234 Cnv2->cd(4); gPad->SetLogy(1); 235 histZ0pull->Draw(); 236 Cnv2->cd(5); gPad->SetLogy(1); 237 histCtpull->Draw(); 224 Cnv2->cd(1); histDpull->Draw(); 225 Cnv2->cd(2); histP0pull->Draw(); 226 Cnv2->cd(3); histCpull->Draw(); 227 Cnv2->cd(4); histZ0pull->Draw(); 228 Cnv2->cd(5); histCtpull->Draw(); 238 229 // 239 230 // Acceptance plots 240 231 // 241 TCanvas* Cnv4 = new TCanvas("Cnv4", "Delphes acceptance", 200, 200, 500, 500);232 TCanvas* Cnv4 = new TCanvas("Cnv4", "Delphes acceptance", 350, 350, 500, 500); 242 233 Cnv4->Divide(2, 2); 243 234 Cnv4->cd(1); 244 235 histCtgen->Draw(); 245 histCtobs->SetLineColor(kRed);246 236 histCtobs->Draw("SAME"); 247 237 Cnv4->cd(2); … … 256 246 } 257 247 histAccCtg->Draw(); 258 Cnv4->cd(3); gPad->SetLogy(1);248 Cnv4->cd(3); 259 249 histPtgen->Draw(); 260 histPtobs->SetLineColor(kRed);261 250 histPtobs->Draw("SAME"); 262 251 Cnv4->cd(4); … … 272 261 histAccPt->Draw(); 273 262 // 274 TCanvas* Cnv5 = new TCanvas("Cnv5", "Delphes acceptance (constrained)", 250, 250, 500, 500);263 TCanvas* Cnv5 = new TCanvas("Cnv5", "Delphes acceptance (constrained)", 400, 400, 500, 500); 275 264 Cnv5->Divide(2, 2); 276 265 Cnv5->cd(1); 277 266 histCtgenH->Draw(); 278 histCtobsH->SetLineColor(kRed);279 267 histCtobsH->Draw("SAME"); 280 268 Cnv5->cd(2); … … 289 277 } 290 278 histAccCtgH->Draw(); 291 Cnv5->cd(3); gPad->SetLogy(1); 292 histPtgenC->Draw(); 293 histPtobsC->SetLineColor(kRed); 279 Cnv5->cd(3); 280 histPtgenC->Draw(); 294 281 histPtobsC->Draw("SAME"); 295 282 Cnv5->cd(4); -
external/TrackCovariance/TrkUtil.cc
ra1a25d4 rd3165fa 1 1 #include "TrkUtil.h" 2 #include <iostream>3 2 4 3 // Constructor … … 32 31 Double_t cross = x(0) * p(1) - x(1) * p(0); 33 32 Double_t T = sqrt(pt * pt - 2 * a * cross + a * a * r2); 34 Double_t phi0 = atan2((p(1) - a * x(0)) / T, (p(0) + a * x(1)) / T); // Phi033 Double_t phi0 = TMath::ATan2((p(1) - a * x(0)) / T, (p(0) + a * x(1)) / T); // Phi0 35 34 Double_t D; // Impact parameter D 36 35 if (pt < 10.0) D = (T - pt) / a; … … 42 41 //Longitudinal parameters 43 42 Double_t B = C * sqrt(TMath::Max(r2 - D * D, 0.0) / (1 + 2 * C * D)); 44 Double_t st = asin(B) / C;43 Double_t st = TMath::ASin(B) / C; 45 44 Double_t ct = p(2) / pt; 46 45 Double_t z0 = x(2) - ct * st; … … 69 68 // 70 69 TVector3 Xval; 71 Xval(0) = -D * sin(phi0);72 Xval(1) = D * cos(phi0);70 Xval(0) = -D * TMath::Sin(phi0); 71 Xval(1) = D * TMath::Cos(phi0); 73 72 Xval(2) = z0; 74 73 // … … 77 76 // 78 77 TVector3 TrkUtil::ParToP(TVectorD Par) 79 {80 if (fBz == 0.0)81 std::cout << "TrkUtil::ParToP: Warning Bz not set" << std::endl;82 //83 return ParToP(Par,fBz);84 }85 //86 TVector3 TrkUtil::ParToP(TVectorD Par, Double_t Bz)87 78 { 88 79 Double_t C = Par(2); … … 91 82 // 92 83 TVector3 Pval; 93 Double_t pt = Bz * cSpeed() / TMath::Abs(2 * C);94 Pval(0) = pt * cos(phi0);95 Pval(1) = pt * sin(phi0);84 Double_t pt = fBz * cSpeed() / TMath::Abs(2 * C); 85 Pval(0) = pt * TMath::Cos(phi0); 86 Pval(1) = pt * TMath::Sin(phi0); 96 87 Pval(2) = pt * ct; 97 88 // … … 112 103 Double_t b = -cSpeed() * fBz / 2.; 113 104 pACTS(0) = 1000 * Par(0); // D from m to mm 114 pACTS(1) = 1000 * Par(3); 105 pACTS(1) = 1000 * Par(3); // z0 from m to mm 115 106 pACTS(2) = Par(1); // Phi0 is unchanged 116 pACTS(3) = atan2(1.0, Par(4)); // Theta in [0, pi] range107 pACTS(3) = TMath::ATan2(1.0, Par(4)); // Theta in [0, pi] range 117 108 pACTS(4) = Par(2) / (b * sqrt(1 + Par(4) * Par(4))); // q/p in GeV 118 109 pACTS(5) = 0.0; // Time: currently undefined -
external/TrackCovariance/TrkUtil.h
ra1a25d4 rd3165fa 20 20 void SetBfield(Double_t Bz) { fBz = Bz; } 21 21 TVectorD XPtoPar(TVector3 x, TVector3 p, Double_t Q); 22 TVector3 ParToX(TVectorD Par); 22 23 TVector3 ParToP(TVectorD Par); 24 Double_t ParToQ(TVectorD Par); 23 25 // 24 26 // Conversion to ACTS parametrization … … 44 46 static Double_t cSpeed() 45 47 { 46 Double_t c = 2.99792458e8; // speed of light m/sec 47 //return TMath::C()*1.0e-9; // Incompatible with root5 48 return c*1.0e-9; // Reduced speed of light 48 return TMath::C()*1.0e-9; // Reduced speed of light 49 49 } 50 50 // … … 52 52 // 53 53 static TVectorD XPtoPar(TVector3 x, TVector3 p, Double_t Q, Double_t Bz); 54 static TVector3 ParToX(TVectorD Par); // position of minimum distance from z axis55 static TVector3 ParToP(TVectorD Par, Double_t Bz); // Get Momentum from track parameters56 static Double_t ParToQ(TVectorD Par); // Get track charge57 54 // 58 55 // Conversion from meters to mm
Note:
See TracChangeset
for help on using the changeset viewer.