13 #include <TLorentzVector.h>
24 auto id1 = tr1_it->first;
25 auto tr1 = tr1_it->second;
33 TrackSeed* siliconseed = tr1->get_silicon_seed();
39 std::cout <<
"silicon seed not found" << std::endl;
47 Acts::Vector3 mom1(tr1->get_px(), tr1->get_py(), tr1->get_pz());
50 if (dcaVals1(0) < this_dca_cut or dcaVals1(1) < this_dca_cut)
58 auto id2 = tr2_it->first;
59 auto tr2 = tr2_it->second;
66 TrackSeed* siliconseed2 = tr2->get_silicon_seed();
73 std::cout <<
"silicon seed not found" << std::endl;
83 Acts::Vector3 mom2(tr2->get_px(), tr2->get_py(), tr2->get_pz());
86 if (dcaVals2(0) < this_dca_cut2 or dcaVals2(1) < this_dca_cut2)
94 std::cout <<
"Check DCA for tracks " << id1 <<
" and " << id2 << std::endl;
97 if (tr1->get_charge() == tr2->get_charge())
106 double invariantMass;
109 float pseudorapidity;
121 Eigen::Vector3d projected_pos1;
122 Eigen::Vector3d projected_mom1;
123 Eigen::Vector3d projected_pos2;
124 Eigen::Vector3d projected_mom2;
135 double pair_dca_proj;
138 findPcaTwoTracks(projected_pos1, projected_pos2, projected_mom1, projected_mom2, pca_rel1_proj, pca_rel2_proj, pair_dca_proj);
143 fillHistogram(projected_mom1, projected_mom2,
recomass, invariantMass, invariantPt, rapidity, pseudorapidity);
144 fillNtp(tr1, tr2, dcaVals1, dcaVals2, pca_rel1, pca_rel2, pair_dca, invariantMass, invariantPt, rapidity, pseudorapidity, projected_pos1, projected_pos2, projected_mom1, projected_mom2, pca_rel1_proj, pca_rel2_proj, pair_dca_proj);
148 std::cout <<
" Accepted Track Pair" << std::endl;
149 std::cout <<
" invariant mass: " << invariantMass << std::endl;
150 std::cout <<
" track1 dca_cut: " << this_dca_cut <<
" track2 dca_cut: " << this_dca_cut2 << std::endl;
151 std::cout <<
" dca3dxy1,dca3dz1,phi1: " << dcaVals1 << std::endl;
152 std::cout <<
" dca3dxy2,dca3dz2,phi2: " << dcaVals2 << std::endl;
153 std::cout <<
"Initial: pca_rel1: " << pca_rel1 <<
" pca_rel2: " << pca_rel2 << std::endl;
154 std::cout <<
" Initial: mom1: " << mom1 <<
" mom2: " << mom2 << std::endl;
155 std::cout <<
"Proj_pca_rel: proj_pos1: " << projected_pos1 <<
" proj_pos2: " << projected_pos2 <<
" proj_mom1: " << projected_mom1 <<
" proj_mom2: " << projected_mom2 << std::endl;
156 std::cout <<
" Relative PCA = " << abs(pair_dca) <<
" pca_cut = " <<
pair_dca_cut << std::endl;
157 std::cout <<
" charge 1: " << tr1->get_charge() <<
" charge2: " << tr2->get_charge() << std::endl;
158 std::cout <<
"found viable projection" << std::endl;
159 std::cout <<
"Final: pca_rel1_proj: " << pca_rel1_proj <<
" pca_rel2_proj: " << pca_rel2_proj <<
" mom1: " << projected_mom1 <<
" mom2: " << projected_mom2 << std::endl << std::endl;
167 void KshortReconstruction::fillNtp(
SvtxTrack* track1,
SvtxTrack* track2,
Acts::Vector3 dcavals1,
Acts::Vector3 dcavals2,
Acts::Vector3 pca_rel1,
Acts::Vector3 pca_rel2,
double pair_dca,
double invariantMass,
double invariantPt,
float rapidity,
float pseudorapidity, Eigen::Vector3d projected_pos1, Eigen::Vector3d projected_pos2, Eigen::Vector3d projected_mom1, Eigen::Vector3d projected_mom2,
Acts::Vector3 pca_rel1_proj,
Acts::Vector3 pca_rel2_proj,
double pair_dca_proj)
169 double px1 = track1->
get_px();
170 double py1 = track1->
get_py();
171 double pz1 = track1->
get_pz();
174 double eta1 = asinh(pz1 / sqrt(pow(px1, 2) + pow(py1, 2)));
176 double px2 = track2->
get_px();
177 double py2 = track2->
get_py();
178 double pz2 = track2->
get_pz();
181 double eta2 = asinh(pz2 / sqrt(pow(px2, 2) + pow(py2, 2)));
192 float mag_pathLength_proj = sqrt(pow(pathLength_proj(0), 2) + pow(pathLength_proj(1), 2) + pow(pathLength_proj(2), 2));
194 Acts::Vector3 projected_momentum = projected_mom1 + projected_mom2;
195 float cos_theta_reco = pathLength_proj.dot(projected_momentum) / (projected_momentum.norm() * pathLength_proj.norm());
202 float reco_info[] = {track1->
get_x(), track1->
get_y(), track1->
get_z(), track1->
get_px(), track1->
get_py(), track1->
get_pz(), (float) dcavals1(0), (float) dcavals1(1), (float) dcavals1(2), (float) pca_rel1(0), (float) pca_rel1(1), (float) pca_rel1(2), (float) eta1, (
float) track1->
get_charge(), (float) tpcClusters1, track2->
get_x(), track2->
get_y(), track2->
get_z(), track2->
get_px(), track2->
get_py(), track2->
get_pz(), (float) dcavals2(0), (float) dcavals2(1), (float) dcavals2(2), (float) pca_rel2(0), (float) pca_rel2(1), (float) pca_rel2(2), (float) eta2, (
float) track2->
get_charge(), (float) tpcClusters2, svtxVertex->get_x(), svtxVertex->get_y(), svtxVertex->get_z(), (float) pair_dca, (
float) invariantMass, (float) invariantPt, (
float)
pathLength(0), (float)
pathLength(1), (float)
pathLength(2), mag_pathLength, rapidity, pseudorapidity, (float) projected_pos1(0), (float) projected_pos1(1), (float) projected_pos1(2), (float) projected_pos2(0), (float) projected_pos2(1), (float) projected_pos2(2), (float) projected_mom1(0), (float) projected_mom1(1), (float) projected_mom1(2), (float) projected_mom2(0), (float) projected_mom2(1), (float) projected_mom2(2), (float) pca_rel1_proj(0), (float) pca_rel1_proj(1), (float) pca_rel1_proj(2), (float) pca_rel2_proj(0), (float) pca_rel2_proj(1), (float) pca_rel2_proj(2), (float) pair_dca_proj, (
float) pathLength_proj(0), (float) pathLength_proj(1), (float) pathLength_proj(2), mag_pathLength_proj, track1->
get_quality(), track2->
get_quality(), cos_theta_reco};
209 double E1 = sqrt(pow(mom1(0), 2) + pow(mom1(1), 2) + pow(mom1(2), 2) + pow(
decaymass, 2));
210 double E2 = sqrt(pow(mom2(0), 2) + pow(mom2(1), 2) + pow(mom2(2), 2) + pow(
decaymass, 2));
212 TLorentzVector
v1(mom1(0), mom1(1), mom1(2), E1);
213 TLorentzVector
v2(mom2(0), mom2(1), mom2(2), E2);
218 rapidity = tsum.Rapidity();
219 pseudorapidity = tsum.Eta();
220 invariantMass = tsum.M();
221 invariantPt = tsum.Pt();
225 std::cout <<
"px1: " << mom1(0) <<
" py1: " << mom1(1) <<
" pz1: " << mom1(2) <<
" E1: " << E1 << std::endl;
226 std::cout <<
"px2: " << mom2(0) <<
" py2: " << mom2(1) <<
" pz2: " << mom2(2) <<
" E2: " << E2 << std::endl;
227 std::cout <<
"tsum: " << tsum(0) <<
" " << tsum(1) <<
" " << tsum(2) <<
" " << tsum(3) << std::endl;
228 std::cout <<
"invariant mass: " << invariantMass <<
" invariant Pt: " << invariantPt << std::endl;
233 massreco->Fill(invariantMass);
249 auto result = actsPropagator.
propagateTrack(params.value(), perigee);
254 const auto momentum = result.value().second.momentum();
261 std::cout <<
" Input PCA " << PCA <<
" projection out " << pos << std::endl;
270 std::cout <<
" Failed projection of track with: " << std::endl;
271 std::cout <<
" x,y,z = " << track->
get_x() <<
" " << track->
get_y() <<
" " << track->
get_z() << std::endl;
272 std::cout <<
" px,py,pz = " << track->
get_px() <<
" " << track->
get_py() <<
" " << track->
get_pz() << std::endl;
284 const double eta = 2.0;
285 const double theta = 2. * atan(exp(-eta));
290 auto transform = Acts::Transform3::Identity();
292 std::shared_ptr<Acts::CylinderSurface> cylSurf =
293 Acts::Surface::makeShared<Acts::CylinderSurface>(
transform,
297 auto params = actsPropagator.makeTrackParams(track,
m_vertexMap);
303 auto result = actsPropagator.propagateTrack(params.value(), cylSurf);
307 const auto momentum = result.value().second.momentum();
344 double px1 = mom1(0);
345 double py1 = mom1(1);
346 double pz1 = mom1(2);
347 double px2 = mom2(0);
348 double py2 = mom2(1);
349 double pz2 = mom2(2);
351 Float_t E1 = sqrt(pow(px1, 2) + pow(py1, 2) + pow(pz1, 2) + pow(
decaymass, 2));
352 Float_t E2 = sqrt(pow(px2, 2) + pow(py2, 2) + pow(pz2, 2) + pow(
decaymass, 2));
354 v1.SetPxPyPzE(px1, py1, pz1, E1);
355 v2.SetPxPyPzE(px2, py2, pz2, E2);
358 const Eigen::Vector3d& a1 =
std::move(pos1);
361 Eigen::Vector3d
b1(v1.Px(), v1.Py(), v1.Pz());
362 Eigen::Vector3d b2(v2.Px(), v2.Py(), v2.Pz());
371 auto bcrossb =
b1.cross(b2);
372 auto mag_bcrossb = bcrossb.norm();
374 auto aminusa = a2 - a1;
379 if (mag_bcrossb != 0)
381 dca = bcrossb.dot(aminusa) / mag_bcrossb;
389 double X =
b1.dot(b2) -
b1.dot(
b1) * b2.dot(b2) / b2.dot(
b1);
390 double Y = (a2.dot(b2) - a1.dot(b2)) - (a2.dot(
b1) - a1.dot(
b1)) * b2.dot(b2) / b2.dot(
b1);
393 double F =
b1.dot(
b1) / b2.dot(
b1);
394 double G = -(a2.dot(
b1) - a1.dot(
b1)) / b2.dot(
b1);
395 double d = c * F + G;
416 std::cout <<
"Could not find m_vertexmap " << std::endl;
422 std::cout <<
"Could not find vtxid in m_vertexMap " << vtxid << std::endl;
428 float phi = atan2(
r(1),
r(0));
431 rot(0, 0) = cos(phi);
432 rot(0, 1) = -sin(phi);
434 rot(1, 0) = sin(phi);
435 rot(1, 1) = cos(phi);
442 double dca3dxy = pos_R(0);
443 double dca3dz = pos_R(2);
445 outVals(0) = abs(dca3dxy);
446 outVals(1) = abs(dca3dz);
451 std::cout <<
" pre-position: " << position << std::endl;
452 std::cout <<
" vertex: " <<
vertex << std::endl;
453 std::cout <<
" vertex subtracted-position: " << position << std::endl;
461 const char* cfilepath =
filepath.c_str();
462 fout =
new TFile(cfilepath,
"recreate");
463 ntp_reco_info =
new TNtuple(
"ntp_reco_info",
"decay_pairs",
"x1:y1:z1:px1:py1:pz1:dca3dxy1:dca3dz1:phi1:pca_rel1_x:pca_rel1_y:pca_rel1_z:eta1:charge1:tpcClusters_1:x2:y2:z2:px2:py2:pz2:dca3dxy2:dca3dz2:phi2:pca_rel2_x:pca_rel2_y:pca_rel2_z:eta2:charge2:tpcClusters_2:vertex_x:vertex_y:vertex_z:pair_dca:invariant_mass:invariant_pt:pathlength_x:pathlength_y:pathlength_z:pathlength:rapidity:pseudorapidity:projected_pos1_x:projected_pos1_y:projected_pos1_z:projected_pos2_x:projected_pos2_y:projected_pos2_z:projected_mom1_x:projected_mom1_y:projected_mom1_z:projected_mom2_x:projected_mom2_y:projected_mom2_z:projected_pca_rel1_x:projected_pca_rel1_y:projected_pca_rel1_z:projected_pca_rel2_x:projected_pca_rel2_y:projected_pca_rel2_z:projected_pair_dca:projected_pathlength_x:projected_pathlength_y:projected_pathlength_z:projected_pathlength:quality1:quality2:cosThetaReco");
468 sprintf(name,
"recomass");
469 recomass =
new TH1D(name, name, 1000, 0.0, 1);
486 m_svtxTrackMap = findNode::getClass<SvtxTrackMap>(topNode,
"SvtxTrackMap");
489 std::cout <<
PHWHERE <<
"No SvtxTrackMap on node tree, exiting." << std::endl;
493 m_vertexMap = findNode::getClass<SvtxVertexMap>(topNode,
"SvtxVertexMap");
496 std::cout <<
PHWHERE <<
"No vertexMap on node tree, exiting." << std::endl;
500 _tGeometry = findNode::getClass<ActsGeometry>(topNode,
"ActsGeometry");
503 std::cout <<
PHWHERE <<
"Error, can't find acts tracking geometry" << std::endl;