22 #include <Math/Vector3D.h>
46 using namespace findNode;
50 namespace SColdQcdCorrelatorAnalysis {
51 namespace SCorrelatorUtilities {
65 int id = numeric_limits<int>::max();
66 int nMvtxLayer = numeric_limits<int>::max();
67 int nInttLayer = numeric_limits<int>::max();
68 int nTpcLayer = numeric_limits<int>::max();
69 int nMvtxClust = numeric_limits<int>::max();
70 int nInttClust = numeric_limits<int>::max();
71 int nTpcClust = numeric_limits<int>::max();
72 double phi = numeric_limits<double>::max();
73 double ene = numeric_limits<double>::max();
74 double px = numeric_limits<double>::max();
75 double py = numeric_limits<double>::max();
76 double pz = numeric_limits<double>::max();
77 double pt = numeric_limits<double>::max();
78 double eta = numeric_limits<double>::max();
79 double dcaXY = numeric_limits<double>::max();
80 double dcaZ = numeric_limits<double>::max();
81 double ptErr = numeric_limits<double>::max();
82 double quality = numeric_limits<double>::max();
83 double vtxX = numeric_limits<double>::max();
84 double vtxY = numeric_limits<double>::max();
85 double vtxZ = numeric_limits<double>::max();
90 const ROOT::Math::XYZVector trkVtx =
GetTrackVertex(track, topNode);
91 const pair<double, double> trkDcaPair =
GetTrackDcaPair(track, topNode);
94 id = track -> get_id();
95 quality = track -> get_quality();
96 eta = track -> get_eta();
97 phi = track -> get_phi();
98 px = track -> get_px();
99 py = track -> get_py();
100 pz = track -> get_pz();
101 pt = track -> get_pt();
102 ene = sqrt((px * px) + (py * py) + (pz * pz) + (MassPion * MassPion));
106 dcaXY = trkDcaPair.first;
107 dcaZ = trkDcaPair.second;
119 id = numeric_limits<int>::max();
120 nMvtxLayer = numeric_limits<int>::max();
121 nInttLayer = numeric_limits<int>::max();
122 nTpcLayer = numeric_limits<int>::max();
123 nMvtxClust = numeric_limits<int>::max();
124 nInttClust = numeric_limits<int>::max();
125 nTpcClust = numeric_limits<int>::max();
126 eta = numeric_limits<double>::max();
127 phi = numeric_limits<double>::max();
128 px = numeric_limits<double>::max();
129 py = numeric_limits<double>::max();
130 pz = numeric_limits<double>::max();
131 pt = numeric_limits<double>::max();
132 ene = numeric_limits<double>::max();
133 dcaXY = numeric_limits<double>::max();
134 dcaZ = numeric_limits<double>::max();
135 ptErr = numeric_limits<double>::max();
136 quality = numeric_limits<double>::max();
137 vtxX = numeric_limits<double>::max();
138 vtxY = numeric_limits<double>::max();
139 vtxZ = numeric_limits<double>::max();
144 vector<string> members = {
174 const bool isLessThan = (
204 const bool isGreaterThan = (
226 return isGreaterThan;
240 SetInfo(track, topNode);
252 SvtxTrackMap* mapTrks = findNode::getClass<SvtxTrackMap>(topNode,
"SvtxTrackMap");
255 <<
"PANIC: SvtxTrackMap node is missing!"
267 return ((trk >= minimum) && (trk <= maximum));
273 bool IsInSigmaDcaCut(
const TrkInfo& trk,
const pair<float, float> nSigCut,
const pair<float, float> ptFitMax,
const pair<TF1*, TF1*> fSigmaDca) {
276 const double ptEvalXY = (trk.
pt > ptFitMax.first) ? ptFitMax.first : trk.
pt;
277 const double ptEvalZ = (trk.
pt > ptFitMax.second) ? ptFitMax.second : trk.
pt;
280 const bool isInDcaRangeXY = (abs(trk.
dcaXY) < (nSigCut.first * (fSigmaDca.first -> Eval(ptEvalXY))));
281 const bool isInDcaRangeZ = (abs(trk.
dcaZ) < (nSigCut.second * (fSigmaDca.second -> Eval(ptEvalZ))));
282 const bool isInSigmaDcaCut = (isInDcaRangeXY && isInDcaRangeZ);
283 return isInSigmaDcaCut;
292 TrackSeed* trkSiSeed = track -> get_silicon_seed();
293 TrackSeed* trkTpcSeed = track -> get_tpc_seed();
296 bool isSeedGood = (trkSiSeed && trkTpcSeed);
297 if (!requireSiSeeds) {
298 isSeedGood = (trkSiSeed || trkTpcSeed);
309 const int vtxID = (int) track -> get_vertex_id();
313 const int primVtxID = primVtx -> get_id();
316 const bool isFromPrimVtx = (vtxID == primVtxID);
317 return isFromPrimVtx;
331 return make_pair(dcaAndErr.first.first, dcaAndErr.second.first);
340 const int vtxID = (int) track -> get_vertex_id();
344 ROOT::Math::XYZVector xyzVtx = ROOT::Math::XYZVector(vtx -> get_x(), vtx -> get_y(), vtx -> get_z());
354 const float trkCovXX = track -> get_error(3, 3);
355 const float trkCovXY = track -> get_error(3, 4);
356 const float trkCovYY = track -> get_error(4, 4);
359 const float trkPx = track -> get_px();
360 const float trkPy = track -> get_py();
361 const float trkPt = track -> get_pt();
364 const float numer = (trkCovXX * trkPx * trkPx) + 2 * (trkCovXY * trkPx * trkPy) + (trkCovYY * trkPy * trkPy);
365 const float denom = (trkPx * trkPx) + (trkPy * trkPy);
366 const float ptDelta2 = numer / denom;
367 const float ptDelta = sqrt(ptDelta2) / trkPt;
377 TrackSeed* trkSiSeed = track -> get_silicon_seed();
378 TrackSeed* trkTpcSeed = track -> get_tpc_seed();
381 const bool hasBothSeeds = (trkSiSeed && trkTpcSeed);
382 const bool hasOnlyTpcSeed = (!trkSiSeed && trkTpcSeed);
387 if (hasBothSeeds) seed = trkSiSeed;
388 if (hasOnlyTpcSeed) seed = trkTpcSeed;
391 if (hasBothSeeds) seed = trkSiSeed;
392 if (hasOnlyTpcSeed) seed = trkTpcSeed;
413 const int minInttLayer = NMvtxLayer;
414 const int minTpcLayer = NMvtxLayer + NInttLayer;
417 array<bool, NMvtxLayer> isMvtxLayerHit = {
false};
418 array<bool, NInttLayer> isInttLayerHit = {
false};
419 array<bool, NTpcLayer> isTpcLayerHit = {
false};
422 unsigned int layer = 0;
423 unsigned int mvtxLayer = 0;
424 unsigned int inttLayer = 0;
425 unsigned int tpcLayer = 0;
426 for (
auto itClustKey = (seed -> begin_cluster_keys()); itClustKey != (seed -> end_cluster_keys()); ++itClustKey) {
434 if (layer < NMvtxLayer) {
436 isMvtxLayerHit[mvtxLayer] =
true;
440 if ((layer >= minInttLayer) && (layer < minTpcLayer)) {
441 inttLayer = layer - minInttLayer;
442 isInttLayerHit[inttLayer] =
true;
446 if (layer >= minTpcLayer) {
447 tpcLayer = layer - minTpcLayer;
448 isTpcLayerHit[tpcLayer] =
true;
460 for (
int iMvtxLayer = 0; iMvtxLayer < NMvtxLayer; iMvtxLayer++) {
461 if (isMvtxLayerHit[iMvtxLayer]) ++nLayer;
465 for (
int iInttLayer = 0; iInttLayer < NInttLayer; iInttLayer++) {
466 if (isInttLayerHit[iInttLayer]) ++nLayer;
470 for (
int iTpcLayer = 0; iTpcLayer < NTpcLayer; iTpcLayer++) {
471 if (isTpcLayerHit[iTpcLayer]) ++nLayer;
489 const int minInttLayer = NMvtxLayer;
490 const int minTpcLayer = NMvtxLayer + NInttLayer;
493 unsigned int layer = 0;
494 unsigned int nCluster = 0;
495 for (
auto itClustKey = (seed -> begin_cluster_keys()); itClustKey != (seed -> end_cluster_keys()); ++itClustKey) {
503 if (layer < NMvtxLayer) {
508 if ((layer >= minInttLayer) && (layer < minTpcLayer)) {
513 if (layer >= minTpcLayer) {
530 PHG4Particle* bestMatch = trackEval -> max_truth_particle_by_nclusters(track);
535 matchID = bestMatch -> get_barcode();
537 matchID = numeric_limits<int>::max();