本文整理汇总了C++中TParticle::Vx方法的典型用法代码示例。如果您正苦于以下问题:C++ TParticle::Vx方法的具体用法?C++ TParticle::Vx怎么用?C++ TParticle::Vx使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TParticle
的用法示例。
在下文中一共展示了TParticle::Vx方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CheckESD
//.........这里部分代码省略.........
TH1F* hMassK0 = CreateHisto("hMassK0", "K^{0}", 100, 0.4, 0.6,
"M(#pi^{+}#pi^{-}) [GeV/c^{2}]", "N");
TH1F* hMassLambda = CreateHisto("hMassLambda", "#Lambda", 100, 1.0, 1.2,
"M(p#pi^{-}) [GeV/c^{2}]", "N");
TH1F* hMassLambdaBar = CreateHisto("hMassLambdaBar", "#bar{#Lambda}",
100, 1.0, 1.2,
"M(#bar{p}#pi^{+}) [GeV/c^{2}]", "N");
Int_t nGenV0s = 0;
Int_t nRecV0s = 0;
TH1F* hMassXi = CreateHisto("hMassXi", "#Xi", 100, 1.2, 1.5,
"M(#Lambda#pi) [GeV/c^{2}]", "N");
TH1F* hMassOmega = CreateHisto("hMassOmega", "#Omega", 100, 1.5, 1.8,
"M(#LambdaK) [GeV/c^{2}]", "N");
Int_t nGenCascades = 0;
Int_t nRecCascades = 0;
// loop over events
for (Int_t iEvent = 0; iEvent < runLoader->GetNumberOfEvents(); iEvent++) {
runLoader->GetEvent(iEvent);
// select simulated primary particles, V0s and cascades
AliStack* stack = runLoader->Stack();
Int_t nParticles = stack->GetNtrack();
TArrayF vertex(3);
runLoader->GetHeader()->GenEventHeader()->PrimaryVertex(vertex);
TObjArray selParticles;
TObjArray selV0s;
TObjArray selCascades;
for (Int_t iParticle = 0; iParticle < nParticles; iParticle++) {
TParticle* particle = stack->Particle(iParticle);
if (!particle) continue;
if (particle->Pt() < 0.001) continue;
if (TMath::Abs(particle->Eta()) > 0.9) continue;
TVector3 dVertex(particle->Vx() - vertex[0],
particle->Vy() - vertex[1],
particle->Vz() - vertex[2]);
if (dVertex.Mag() > 0.0001) continue;
switch (TMath::Abs(particle->GetPdgCode())) {
case kElectron:
case kMuonMinus:
case kPiPlus:
case kKPlus:
case kProton: {
if (particle->Pt() > minPt) {
selParticles.Add(particle);
nGen++;
hGen->Fill(particle->Pt());
}
break;
}
case kK0Short:
case kLambda0: {
if (particle->Pt() > cutPtV0) {
nGenV0s++;
selV0s.Add(particle);
}
break;
}
case kXiMinus:
case kOmegaMinus: {
if (particle->Pt() > cutPtCascade) {
nGenCascades++;
selCascades.Add(particle);
}
break;
示例2: TOFquickanal
//.........这里部分代码省略.........
Int_t ntracks = TH->GetEntries();
cout<<" ntracks = "<<ntracks<<endl;
AliTOFhitT0 *tofHit;
// Start loop on tracks in the hits containers
for (Int_t track=0; track<ntracks;track++) {
tof->ResetHits();
TH->GetEvent(track);
for(tofHit=(AliTOFhitT0*)tof->FirstHit(track); tofHit; tofHit=(AliTOFhitT0*)tof->NextHit()) {
Float_t toflight = tofHit->GetTof();
toflight *= 1.E+09; // conversion from s to ns
Double_t tofmom = tofHit->GetMom();
Int_t ipart = tofHit->Track();
TParticle *particle = gAlice->Particle(ipart);
if (particle->GetFirstMother() < 0) {
htofprim->Fill(toflight);
htofmom->Fill(tofmom);
} else {
htofsec->Fill(toflight);
}
Double_t zcoor = tofHit->Z();
hzcoor->Fill(zcoor);
Double_t incangle = tofHit->GetIncA();
hincangle->Fill(incangle);
Double_t xcoor = particle->Vx();
Double_t ycoor = particle->Vy();
Double_t radius = TMath::Sqrt(xcoor*xcoor+ycoor*ycoor);
if (particle->GetFirstMother() >= 0) hradius->Fill(radius);
Double_t prodmom = particle->P();
if (prodmom!=0.) {
Double_t dummy = (particle->Pz())/prodmom;
Double_t prodthe = TMath::ACos(dummy);
prodthe *= 57.29578; // conversion from rad to deg
if (particle->GetFirstMother() < 0) hprodthe->Fill(prodthe);
} // theta at production vertex
if (particle->GetFirstMother() < 0) {
hprodmom->Fill(prodmom);
Double_t dummypx = particle->Px();
Double_t dummypy = particle->Py();
Double_t prodphi = TMath::ATan2(dummypy,dummypx);
prodphi *= 57.29578; // conversion from rad to deg
hprodphi->Fill(prodphi);
} // phi at production vertex
} // close loop on TOF-hits
} // close loop on tracks in the hits containers
//Create canvas, set the view range, show histograms
TCanvas *c1 = new TCanvas("c1","Alice TOF hits quick analysis",400,10,600,700);
c1->cd();
hprodmom->Draw();
TCanvas *c2 = new TCanvas("c2","Alice TOF hits quick analysis",400,10,600,700);
c2->cd();
hprodthe->Draw();