本文整理汇总了C++中TVector3::Pz方法的典型用法代码示例。如果您正苦于以下问题:C++ TVector3::Pz方法的具体用法?C++ TVector3::Pz怎么用?C++ TVector3::Pz使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TVector3
的用法示例。
在下文中一共展示了TVector3::Pz方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pos
/*
* Make SvtxTrack from PHGenFit::Track and SvtxTrack
*/
SvtxTrack* PHG4TrackKalmanFitter::MakeSvtxTrack(const SvtxTrack* svtx_track,
const PHGenFit::Track* phgf_track) {
double chi2 = phgf_track->get_chi2();
double ndf = phgf_track->get_ndf();
genfit::MeasuredStateOnPlane* gf_state = phgf_track->extrapolateToLine(TVector3(0.,0.,0.), TVector3(0.,0.,1.));
TVector3 mom = gf_state->getMom();
TVector3 pos = gf_state->getPos();
TMatrixDSym cov = gf_state->get6DCov();
//const SvtxTrack_v1* temp_track = static_cast<const SvtxTrack_v1*> (svtx_track);
SvtxTrack_v1* out_track = new SvtxTrack_v1(*static_cast<const SvtxTrack_v1*> (svtx_track));
/*!
* 1/p, u'/z', v'/z', u, v
* u is defined as mom X beam line at POCA
* so u is the dca2d direction
*/
double dca2d = gf_state->getState()[3];
out_track->set_dca2d(dca2d);
if(gf_state->getCov()[3][3] > 0)
out_track->set_dca2d_error(sqrt(gf_state->getCov()[3][3]));
else {
out_track->set_dca2d_error(-9999);
if(verbosity >= 1)
LogWarning("gf_state->getCov()[3][3] <= 0");
}
double dca3d = sqrt(
dca2d*dca2d +
gf_state->getState()[4]*gf_state->getState()[4]);
out_track->set_dca(dca3d);
out_track->set_chisq(chi2);
out_track->set_ndf(ndf);
out_track->set_charge((_reverse_mag_field) ? -1.*phgf_track->get_charge() : phgf_track->get_charge());
out_track->set_px(mom.Px());
out_track->set_py(mom.Py());
out_track->set_pz(mom.Pz());
out_track->set_x(pos.X());
out_track->set_y(pos.Y());
out_track->set_z(pos.Z());
for(int i=0;i<6;i++)
{
for(int j=i;j<6;j++)
{
out_track->set_error(i,j,cov[i][j]);
}
}
for (SvtxTrack::ConstClusterIter iter = svtx_track->begin_clusters();
iter != svtx_track->end_clusters(); ++iter) {
unsigned int cluster_id = *iter;
SvtxCluster* cluster = _clustermap->get(cluster_id);
if(!cluster)
{
LogError("No cluster Found!");
continue;
}
//cluster->identify(); //DEBUG
//unsigned int l = cluster->get_layer();
TVector3 pos(cluster->get_x(), cluster->get_y(), cluster->get_z());
double radius = pos.Pt();
//TODO add exception handling
genfit::MeasuredStateOnPlane* gf_state = phgf_track->extrapolateToCylinder(radius,TVector3(0,0,0),TVector3(0,0,1), 0);
if (!gf_state) {
if (verbosity > 1)
LogWarning("Exrapolation failed!");
continue;
}
SvtxTrackState* state = new SvtxTrackState_v1(radius);
state->set_x(gf_state->getPos().x());
state->set_y(gf_state->getPos().y());
state->set_z(gf_state->getPos().z());
state->set_px(gf_state->getMom().x());
state->set_py(gf_state->getMom().y());
state->set_pz(gf_state->getMom().z());
//gf_state->getCov().Print();
for(int i=0;i<6;i++)
{
for(int j=i;j<6;j++)
{
out_track->set_error(i,j, gf_state->get6DCov()[i][j]);
//.........这里部分代码省略.........
示例2: main
int main(int argc, char* argv[])
{
TApplication theApp(srcName.Data(), &argc, argv);
//=============================================================================
if (argc<5) return -1;
TString sPath = argv[1]; if (sPath.IsNull()) return -1;
TString sFile = argv[2]; if (sFile.IsNull()) return -1;
TString sJetR = argv[3]; if (sJetR.IsNull()) return -1;
TString sSjeR = argv[4]; if (sSjeR.IsNull()) return -1;
//=============================================================================
sPath.ReplaceAll("#", "/");
//=============================================================================
double dJetR = -1.;
if (sJetR=="JetR02") dJetR = 0.2;
if (sJetR=="JetR03") dJetR = 0.3;
if (sJetR=="JetR04") dJetR = 0.4;
if (sJetR=="JetR05") dJetR = 0.5;
if (dJetR<0.) return -1;
cout << "Jet R = " << dJetR << endl;
//=============================================================================
double dSjeR = -1.;
if (sSjeR=="SjeR01") dSjeR = 0.1;
if (sSjeR=="SjeR02") dSjeR = 0.2;
if (sSjeR=="SjeR03") dSjeR = 0.3;
if (sSjeR=="SjeR04") dSjeR = 0.4;
if (dSjeR<0.) return -1;
cout << "Sub-jet R = " << dSjeR << endl;
//=============================================================================
const double dJetsPtMin = 0.001;
const double dCutEtaMax = 1.6;
const double dJetEtaMax = 1.;
const double dJetAreaRef = TMath::Pi() * dJetR * dJetR;
fastjet::GhostedAreaSpec areaSpc(dCutEtaMax);
fastjet::JetDefinition jetsDef(fastjet::antikt_algorithm, dJetR, fastjet::BIpt_scheme, fastjet::Best);
//fastjet::AreaDefinition areaDef(fastjet::active_area,areaSpc);
fastjet::AreaDefinition areaDef(fastjet::active_area_explicit_ghosts,areaSpc);
//fastjet::JetDefinition bkgsDef(fastjet::kt_algorithm, 0.2, fastjet::BIpt_scheme, fastjet::Best);
//fastjet::AreaDefinition aBkgDef(fastjet::active_area_explicit_ghosts, areaSpc);
fastjet::Selector selectJet = fastjet::SelectorAbsEtaMax(dJetEtaMax);
//fastjet::Selector selectRho = fastjet::SelectorAbsEtaMax(dCutEtaMax-0.2);
//fastjet::Selector selecHard = fastjet::SelectorNHardest(2);
//fastjet::Selector selectBkg = selectRho * (!(selecHard));
//fastjet::JetMedianBackgroundEstimator bkgsEstimator(selectBkg, bkgsDef, aBkgDef);
//fastjet::Subtractor bkgSubtractor(&bkgsEstimator);
fastjet::JetDefinition subjDef(fastjet::antikt_algorithm, dSjeR, fastjet::BIpt_scheme, fastjet::Best);
//=============================================================================
std::vector<fastjet::PseudoJet> fjInput;
//=============================================================================
TList *list = new TList();
TH1D *hWeightSum = new TH1D("hWeightSum", "", 1, 0., 1.); list->Add(hWeightSum);
TH1D *hJet = new TH1D("hJet", "", 1000, 0., 1000.); hJet->Sumw2(); list->Add(hJet);
TH2D *hJetNsj = new TH2D("hJetNsj", "", 1000, 0., 1000., 101, -0.5, 100.5); hJetNsj->Sumw2(); list->Add(hJetNsj);
TH2D *hJetIsj = new TH2D("hJetIsj", "", 1000, 0., 1000., 1000, 0., 1000.); hJetIsj->Sumw2(); list->Add(hJetIsj);
TH2D *hJet1sj = new TH2D("hJet1sj", "", 1000, 0., 1000., 1000, 0., 1000.); hJet1sj->Sumw2(); list->Add(hJet1sj);
TH2D *hJet2sj = new TH2D("hJet2sj", "", 1000, 0., 1000., 1000, 0., 1000.); hJet2sj->Sumw2(); list->Add(hJet2sj);
TH2D *hJetDsj = new TH2D("hJetDsj", "", 1000, 0., 1000., 1000, 0., 1000.); hJetDsj->Sumw2(); list->Add(hJetDsj);
TH2D *hJetIsz = new TH2D("hJetIsz", "", 1000, 0., 1000., 120, 0., 1.2); hJetIsz->Sumw2(); list->Add(hJetIsz);
TH2D *hJet1sz = new TH2D("hJet1sz", "", 1000, 0., 1000., 120, 0., 1.2); hJet1sz->Sumw2(); list->Add(hJet1sz);
TH2D *hJet2sz = new TH2D("hJet2sz", "", 1000, 0., 1000., 120, 0., 1.2); hJet2sz->Sumw2(); list->Add(hJet2sz);
TH2D *hJetDsz = new TH2D("hJetDsz", "", 1000, 0., 1000., 120, 0., 1.2); hJetDsz->Sumw2(); list->Add(hJetDsz);
//=============================================================================
HepMC::IO_GenEvent ascii_in(Form("%s/%s.hepmc",sPath.Data(),sFile.Data()), std::ios::in);
HepMC::GenEvent *evt = ascii_in.read_next_event();
while (evt) {
fjInput.resize(0);
double dXsect = evt->cross_section()->cross_section() / 1e9;
double dWeight = evt->weights().back();
double dNorm = dWeight * dXsect;
hWeightSum->Fill(0.5, dWeight);
TVector3 vPar;
for (HepMC::GenEvent::particle_const_iterator p=evt->particles_begin(); p!=evt->particles_end(); ++p) if ((*p)->status()==1) {
vPar.SetXYZ((*p)->momentum().px(), (*p)->momentum().py(), (*p)->momentum().pz());
if ((TMath::Abs(vPar.Eta())<dCutEtaMax)) {
fjInput.push_back(fastjet::PseudoJet(vPar.Px(), vPar.Py(), vPar.Pz(), vPar.Mag()));
}
}
//=============================================================================
fastjet::ClusterSequenceArea clustSeq(fjInput, jetsDef, areaDef);
//.........这里部分代码省略.........
示例3:
inline TVector2 line_propagation(TVector3 Pi_momentum, double z_end, double z_start, double x_start=0, double y_start=0)
{
double z_travelled = z_end - z_start;
double scale = z_travelled/Pi_momentum.Pz();
return TVector2(Pi_momentum.Px()*scale + x_start, Pi_momentum.Py()*scale + y_start);
}
示例4: main
int main(int argc, char* argv[])
{
TApplication theApp(srcName.Data(), &argc, argv);
//=============================================================================
if (argc<5) return -1;
TString sPath = argv[1]; if (sPath.IsNull()) return -1;
TString sFile = argv[2]; if (sFile.IsNull()) return -1;
TString sJetR = argv[3]; if (sJetR.IsNull()) return -1;
TString sSjeR = argv[4]; if (sSjeR.IsNull()) return -1;
//=============================================================================
sPath.ReplaceAll("#", "/");
//=============================================================================
double dJetR = -1.;
if (sJetR=="JetR02") dJetR = 0.2;
if (sJetR=="JetR03") dJetR = 0.3;
if (sJetR=="JetR04") dJetR = 0.4;
if (sJetR=="JetR05") dJetR = 0.5;
if (dJetR<0.) return -1;
cout << "Jet R = " << dJetR << endl;
//=============================================================================
double dSjeR = -1.;
if (sSjeR=="SjeR01") dSjeR = 0.1;
if (sSjeR=="SjeR02") dSjeR = 0.2;
if (sSjeR=="SjeR03") dSjeR = 0.3;
if (sSjeR=="SjeR04") dSjeR = 0.4;
if (dSjeR<0.) return -1;
cout << "Sub-jet R = " << dSjeR << endl;
//=============================================================================
const double dJetsPtMin = 0.1;
const double dJetEtaMax = 2.;
const double dCutEtaMax = 2.6;
fastjet::GhostedAreaSpec areaSpc(dCutEtaMax);
fastjet::JetDefinition jetsDef(fastjet::antikt_algorithm, dJetR, fastjet::BIpt_scheme, fastjet::Best);
fastjet::AreaDefinition areaDef(fastjet::active_area_explicit_ghosts,areaSpc);
fastjet::Selector selectJet = fastjet::SelectorAbsEtaMax(dJetEtaMax);
fastjet::JetDefinition subjDef(fastjet::kt_algorithm, dSjeR, fastjet::BIpt_scheme, fastjet::Best);
//=============================================================================
std::vector<fastjet::PseudoJet> fjInput;
//=============================================================================
TFile *file = TFile::Open(Form("%s.root",sFile.Data()), "NEW");
TList *list = new TList();
TH1D *hWeightSum = new TH1D("hWeightSum", "", 1, 0., 1.); list->Add(hWeightSum);
TH2D *hTrkPtEta = new TH2D("hTrkPtEta", "", 1000, 0., 500., 60, -3., 3.); hTrkPtEta->Sumw2(); list->Add(hTrkPtEta);
TH2D *hTrkPtPhi = new TH2D("hTrkPtPhi", "", 1000, 0., 500., 20, -1., 1.); hTrkPtPhi->Sumw2(); list->Add(hTrkPtPhi);
TH2D *hJetPtNsj = new TH2D("hJetPtNsj", "", 1000, 0., 1000., 100, -0.5, 99.5); hJetPtNsj->Sumw2(); list->Add(hJetPtNsj);
TH2D *hJetPtEta = new TH2D("hJetPtEta", "", 1000, 0., 1000., 60, -3., 3.); hJetPtEta->Sumw2(); list->Add(hJetPtEta);
TH2D *hJetPtPhi = new TH2D("hJetPtPhi", "", 1000, 0., 1000., 20, -1., 1.); hJetPtPhi->Sumw2(); list->Add(hJetPtPhi);
TH2D *hLjePtEta = new TH2D("hLjePtEta", "", 1000, 0., 1000., 60, -3., 3.); hLjePtEta->Sumw2(); list->Add(hLjePtEta);
TH2D *hLjePtPhi = new TH2D("hLjePtPhi", "", 1000, 0., 1000., 20, -1., 1.); hLjePtPhi->Sumw2(); list->Add(hLjePtPhi);
TH2D *hNjePtEta = new TH2D("hNjePtEta", "", 1000, 0., 1000., 60, -3., 3.); hNjePtEta->Sumw2(); list->Add(hNjePtEta);
TH2D *hNjePtPhi = new TH2D("hNjePtPhi", "", 1000, 0., 1000., 20, -1., 1.); hNjePtPhi->Sumw2(); list->Add(hNjePtPhi);
TH2D *hJe2PtEta = new TH2D("hJe2PtEta", "", 1000, 0., 1000., 60, -3., 3.); hJe2PtEta->Sumw2(); list->Add(hJe2PtEta);
TH2D *hJe2PtPhi = new TH2D("hJe2PtPhi", "", 1000, 0., 1000., 20, -1., 1.); hJe2PtPhi->Sumw2(); list->Add(hJe2PtPhi);
TH2D *hLj2PtEta = new TH2D("hLj2PtEta", "", 1000, 0., 1000., 60, -3., 3.); hLj2PtEta->Sumw2(); list->Add(hLj2PtEta);
TH2D *hLj2PtPhi = new TH2D("hLj2PtPhi", "", 1000, 0., 1000., 20, -1., 1.); hLj2PtPhi->Sumw2(); list->Add(hLj2PtPhi);
TH2D *hNj2PtEta = new TH2D("hNj2PtEta", "", 1000, 0., 1000., 60, -3., 3.); hNj2PtEta->Sumw2(); list->Add(hNj2PtEta);
TH2D *hNj2PtPhi = new TH2D("hNj2PtPhi", "", 1000, 0., 1000., 20, -1., 1.); hNj2PtPhi->Sumw2(); list->Add(hNj2PtPhi);
//=============================================================================
HepMC::IO_GenEvent ascii_in(Form("%s/%s.hepmc",sPath.Data(),sFile.Data()), std::ios::in);
HepMC::GenEvent *evt = ascii_in.read_next_event();
while (evt) {
fjInput.resize(0);
double dWeight = evt->weights().back();
double dXsect = evt->cross_section()->cross_section() / 1e9;
double dNorm = dWeight * dXsect;
hWeightSum->Fill(0.5, dWeight);
TVector3 vTrk;
for (HepMC::GenEvent::particle_const_iterator p=evt->particles_begin(); p!=evt->particles_end(); ++p) if ((*p)->status()==1) {
double dTrkPt = (*p)->momentum().perp(); if (dTrkPt<0.5) continue;
double dTrkEta = (*p)->momentum().eta(); if (TMath::Abs(dTrkEta)>dCutEtaMax) continue;
double dTrkPhi = (*p)->momentum().phi(); vTrk.SetPtEtaPhi(dTrkPt, dTrkEta, dTrkPhi);
double dTrkCos = TMath::Cos(dTrkPhi); if (dTrkCos==1.) dTrkCos = 1. - 1e-6;
fjInput.push_back(fastjet::PseudoJet(vTrk.Px(), vTrk.Py(), vTrk.Pz(), vTrk.Mag()));
//.........这里部分代码省略.........