本文整理汇总了C++中TParticle::IsPrimary方法的典型用法代码示例。如果您正苦于以下问题:C++ TParticle::IsPrimary方法的具体用法?C++ TParticle::IsPrimary怎么用?C++ TParticle::IsPrimary使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TParticle
的用法示例。
在下文中一共展示了TParticle::IsPrimary方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Kin2Txt
void Kin2Txt() {
AliRunLoader* rl = AliRunLoader::Open("galice.root");
rl->LoadKinematics();
rl->LoadHeader();
TH1* hM = new TH1D("hM", "TreeK;M#(){#pi^{+}#pi^{-}} #(){GeV/#it{c}^{2}}", 100, 0., 2.);
TH1* hPt = new TH1D("hPt", "TreeK;P_{T}#(){#pi^{+}#pi^{-}} #(){GeV/#it{c}}", 100, 0., 1.);
TH1* hY = new TH1D("hY", "TreeK;Y#(){#pi^{+}#pi^{-}}", 160,-8., 8.);
std::ofstream ofs("rho0.txt");
AliStack *stack = NULL;
TParticle *part = NULL;
TLorentzVector v[2], vSum;
for (Int_t i=0, n(rl->GetNumberOfEvents()); i<n; ++i) {
rl->GetEvent(i);
stack = rl->Stack();
Int_t nPrimary(0);
for (Int_t j(0), m(stack->GetNtrack()); j<m; ++j) {
part = stack->Particle(j);
if (part->IsPrimary())
part->Momentum(v[nPrimary++]);
}
if (nPrimary != 2) {
Printf("Error: nPrimary=%d != 2", nPrimary);
continue;
}
vSum = v[0] + v[1];
hM->Fill(vSum.M());
hPt->Fill(vSum.Perp());
hY->Fill(vSum.Rapidity());
ofs << std::fixed << std::setprecision(4)
<< vSum.M() << " " << vSum.Perp() << " " << vSum.Rapidity() << " "
<< v[0].Eta() << " " << v[0].Px() << " " << v[0].Py() << " " << v[0].Pz() << " "
<< v[1].Eta() << " " << v[1].Px() << " " << v[1].Py() << " " << v[1].Pz()
<< std::endl;
}
hM->Draw();
c1->SaveAs("TreeK.pdf(");
hPt->Draw();
c1->SaveAs("TreeK.pdf");
hY->Draw();
c1->SaveAs("TreeK.pdf)");
}