11 #ifndef SCHECKTRACKPAIRS_H
12 #define SCHECKTRACKPAIRS_H
20 #include <Math/Vector3D.h>
37 #include "/sphenix/user/danderson/eec/SCorrelatorUtilities/TrkTools.h"
38 #include "/sphenix/user/danderson/eec/SCorrelatorUtilities/Constants.h"
39 #include "/sphenix/user/danderson/eec/SCorrelatorUtilities/Interfaces.h"
43 using namespace findNode;
44 using namespace SColdQcdCorrelatorAnalysis::SCorrelatorUtilities;
48 namespace SColdQcdCorrelatorAnalysis {
120 DoDoubleTrackLoop(topNode);
139 void SCheckTrackPairs::InitTuples() {
141 if (m_isDebugOn && (m_verbosity > 2)) {
142 cout <<
"SColdQcdCorrelatorAnalysis::SCheckTrackPairs::InitTuples(): initializing output tuple." << endl;
146 vector<string> vecTrkPairLeaves = MakeLeafVector<TrkInfo>(
"_a");
147 vecTrkPairLeaves.push_back(
"nClustKey_a");
150 AddLeavesToVector<TrkInfo>(vecTrkPairLeaves,
"_b");
151 vecTrkPairLeaves.push_back(
"nClustKey_b");
155 vecTrkPairLeaves.push_back(
"nSameClustKey");
156 vecTrkPairLeaves.push_back(
"trackDeltaR");
162 m_ntTrackPairs =
new TNtuple(
"ntTrackPairs",
"Pairs of tracks", argTrkPairLeaves.data());
163 m_vecTrackPairLeaves.reserve(vecTrkPairLeaves.size());
170 void SCheckTrackPairs::SaveOutput() {
172 if (m_isDebugOn && (m_verbosity > 2)) {
173 cout <<
"SColdQcdCorrelatorAnalysis::SCheckTrackPairs::SaveOutput(): saving output." << endl;
177 m_ntTrackPairs ->
Write();
184 void SCheckTrackPairs::ResetVectors() {
186 if (m_isDebugOn && (m_verbosity > 4)) {
187 cout <<
"SColdQcdCorrelatorAnalysis::SCheckTrackPairs::ResetVectors(): resetting vectors." << endl;
191 const size_t nLeaves = m_vecTrackPairLeaves.size();
192 for (
size_t iLeaf = 0; iLeaf < nLeaves; iLeaf++) {
193 m_vecTrackPairLeaves[iLeaf] = -999.;
197 m_vecClustKeysA.clear();
198 m_vecClustKeysB.clear();
207 if (m_isDebugOn && (m_verbosity > 2)) {
208 cout <<
"SColdQcdCorrelatorAnalysis::SCheckTrackPairs::DoDoubleTrackLoop(): looping over all pairs of tracks." << endl;
218 trackA = itTrkA -> second;
219 if (!trackA)
continue;
221 const bool isGoodTrackA = IsGoodTrack(trackA, topNode);
222 if (!isGoodTrackA)
continue;
225 TrkInfo trkInfoA(trackA, topNode);
231 trackB = itTrkB -> second;
232 if (!trackB)
continue;
234 const bool isGoodTrackB = IsGoodTrack(trackB, topNode);
235 if (!isGoodTrackB)
continue;
238 if ((trackA -> get_id()) == (trackB -> get_id()))
continue;
241 TrkInfo trkInfoB(trackB, topNode);
244 const double dfTrkAB = trkInfoA.
phi - trkInfoB.
phi;
245 const double dhTrkAB = trkInfoA.
eta - trkInfoB.
eta;
246 const double drTrkAB = sqrt((dfTrkAB * dfTrkAB) + (dhTrkAB * dhTrkAB));
249 m_vecClustKeysA.clear();
250 m_vecClustKeysB.clear();
253 auto seedTpcA = trackA -> get_tpc_seed();
255 for (
auto local_iterA = seedTpcA -> begin_cluster_keys(); local_iterA != seedTpcA -> end_cluster_keys(); ++local_iterA) {
257 m_vecClustKeysA.push_back(cluster_keyA);
262 auto seedTpcB = trackB -> get_tpc_seed();
264 for (
auto local_iterB = seedTpcB -> begin_cluster_keys(); local_iterB != seedTpcB -> end_cluster_keys(); ++local_iterB) {
266 m_vecClustKeysB.push_back(cluster_keyB);
271 uint64_t nSameKey = 0;
272 for (
auto keyA : m_vecClustKeysA) {
273 for (
auto keyB : m_vecClustKeysB) {
282 m_vecTrackPairLeaves[0] = (float) trkInfoA.
id;
283 m_vecTrackPairLeaves[1] = (
float) trkInfoA.
nMvtxLayer;
284 m_vecTrackPairLeaves[2] = (float) trkInfoA.
nInttLayer;
285 m_vecTrackPairLeaves[3] = (
float) trkInfoA.
nTpcLayer;
286 m_vecTrackPairLeaves[4] = (float) trkInfoA.
nMvtxClust;
287 m_vecTrackPairLeaves[5] = (
float) trkInfoA.
nInttClust;
288 m_vecTrackPairLeaves[6] = (float) trkInfoA.
nTpcClust;
289 m_vecTrackPairLeaves[7] = (
float) trkInfoA.
eta;
290 m_vecTrackPairLeaves[8] = (float) trkInfoA.
phi;
291 m_vecTrackPairLeaves[9] = (
float) trkInfoA.
px;
292 m_vecTrackPairLeaves[10] = (float) trkInfoA.
py;
293 m_vecTrackPairLeaves[11] = (
float) trkInfoA.
pz;
294 m_vecTrackPairLeaves[12] = (float) trkInfoA.
pt;
295 m_vecTrackPairLeaves[13] = (
float) trkInfoA.
ene;
296 m_vecTrackPairLeaves[14] = (float) trkInfoA.
dcaXY;
297 m_vecTrackPairLeaves[15] = (
float) trkInfoA.
dcaZ;
298 m_vecTrackPairLeaves[16] = (float) trkInfoA.
ptErr;
299 m_vecTrackPairLeaves[17] = (
float) trkInfoA.
quality;
300 m_vecTrackPairLeaves[18] = (float) trkInfoA.
vtxX;
301 m_vecTrackPairLeaves[19] = (
float) trkInfoA.
vtxY;
302 m_vecTrackPairLeaves[20] = (float) trkInfoA.
vtxZ;
303 m_vecTrackPairLeaves[21] = (
float) m_vecClustKeysA.size();
304 m_vecTrackPairLeaves[22] = (float) trkInfoB.
id;
305 m_vecTrackPairLeaves[23] = (
float) trkInfoB.
nMvtxLayer;
306 m_vecTrackPairLeaves[24] = (float) trkInfoB.
nInttLayer;
307 m_vecTrackPairLeaves[25] = (
float) trkInfoB.
nTpcLayer;
308 m_vecTrackPairLeaves[26] = (float) trkInfoB.
nMvtxClust;
309 m_vecTrackPairLeaves[27] = (
float) trkInfoB.
nInttClust;
310 m_vecTrackPairLeaves[28] = (float) trkInfoB.
nTpcClust;
311 m_vecTrackPairLeaves[29] = (
float) trkInfoB.
eta;
312 m_vecTrackPairLeaves[30] = (float) trkInfoB.
phi;
313 m_vecTrackPairLeaves[31] = (
float) trkInfoB.
px;
314 m_vecTrackPairLeaves[32] = (float) trkInfoB.
py;
315 m_vecTrackPairLeaves[33] = (
float) trkInfoB.
pz;
316 m_vecTrackPairLeaves[34] = (float) trkInfoB.
pt;
317 m_vecTrackPairLeaves[35] = (
float) trkInfoB.
ene;
318 m_vecTrackPairLeaves[36] = (float) trkInfoB.
dcaXY;
319 m_vecTrackPairLeaves[37] = (
float) trkInfoB.
dcaZ;
320 m_vecTrackPairLeaves[38] = (float) trkInfoB.
ptErr;
321 m_vecTrackPairLeaves[39] = (
float) trkInfoB.
quality;
322 m_vecTrackPairLeaves[40] = (float) trkInfoB.
vtxX;
323 m_vecTrackPairLeaves[41] = (
float) trkInfoB.
vtxY;
324 m_vecTrackPairLeaves[42] = (float) trkInfoB.
vtxZ;
325 m_vecTrackPairLeaves[43] = (
float) m_vecClustKeysB.size();
326 m_vecTrackPairLeaves[44] = (float) nSameKey;
327 m_vecTrackPairLeaves[45] = (float) drTrkAB;
330 m_ntTrackPairs ->
Fill(m_vecTrackPairLeaves.data());
343 if (m_isDebugOn && (m_verbosity > 4)) {
344 cout <<
"SCheckTrackPairs::IsGoodTrack(SvtxTrack*, PHCompositeNode*) Checking if track is good..." << endl;
351 bool isInDcaSigma =
true;
352 if (m_config.doDcaSigCut) {
353 isInDcaSigma =
IsInSigmaDcaCut(info, m_config.nSigCut, m_config.ptFitMax, m_config.fSigDca);
357 const bool isFromPrimVtx = m_config.useOnlyPrimVtx ?
IsFromPrimaryVtx(track, topNode) :
true;
360 const bool isSeedGood =
IsGoodTrackSeed(track, m_config.requireSiSeed);
361 const bool isInAccept = IsInTrackAcceptance(info, m_config.minAccept, m_config.maxAccept);
364 return (isFromPrimVtx && isInDcaSigma && isSeedGood && isInAccept);