File indexing completed on 2025-08-06 08:13:21
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #define SCORRELATORUTILITIES_TRKINFO_CC
0011
0012
0013 #include "TrkInfo.h"
0014
0015
0016 using namespace std;
0017
0018
0019
0020 namespace SColdQcdCorrelatorAnalysis {
0021
0022
0023
0024
0025
0026
0027 void Types::TrkInfo::Minimize() {
0028
0029 id = -1 * numeric_limits<int>::max();
0030 vtxID = -1 * numeric_limits<int>::max();
0031 nMvtxLayer = -1 * numeric_limits<int>::max();
0032 nInttLayer = -1 * numeric_limits<int>::max();
0033 nTpcLayer = -1 * numeric_limits<int>::max();
0034 nMvtxClust = -1 * numeric_limits<int>::max();
0035 nInttClust = -1 * numeric_limits<int>::max();
0036 nTpcClust = -1 * numeric_limits<int>::max();
0037 eta = -1. * numeric_limits<double>::max();
0038 phi = -1. * numeric_limits<double>::max();
0039 px = -1. * numeric_limits<double>::max();
0040 py = -1. * numeric_limits<double>::max();
0041 pz = -1. * numeric_limits<double>::max();
0042 pt = -1. * numeric_limits<double>::max();
0043 ene = -1. * numeric_limits<double>::max();
0044 dcaXY = -1. * numeric_limits<double>::max();
0045 dcaZ = -1. * numeric_limits<double>::max();
0046 ptErr = -1. * numeric_limits<double>::max();
0047 quality = -1. * numeric_limits<double>::max();
0048 vx = -1. * numeric_limits<double>::max();
0049 vy = -1. * numeric_limits<double>::max();
0050 vz = -1. * numeric_limits<double>::max();
0051 return;
0052
0053 }
0054
0055
0056
0057
0058
0059
0060 void Types::TrkInfo::Maximize() {
0061
0062 id = numeric_limits<int>::max();
0063 vtxID = numeric_limits<int>::max();
0064 nMvtxLayer = numeric_limits<int>::max();
0065 nInttLayer = numeric_limits<int>::max();
0066 nTpcLayer = numeric_limits<int>::max();
0067 nMvtxClust = numeric_limits<int>::max();
0068 nInttClust = numeric_limits<int>::max();
0069 nTpcClust = numeric_limits<int>::max();
0070 eta = numeric_limits<double>::max();
0071 phi = numeric_limits<double>::max();
0072 px = numeric_limits<double>::max();
0073 py = numeric_limits<double>::max();
0074 pz = numeric_limits<double>::max();
0075 pt = numeric_limits<double>::max();
0076 ene = numeric_limits<double>::max();
0077 dcaXY = numeric_limits<double>::max();
0078 dcaZ = numeric_limits<double>::max();
0079 ptErr = numeric_limits<double>::max();
0080 quality = numeric_limits<double>::max();
0081 vx = numeric_limits<double>::max();
0082 vy = numeric_limits<double>::max();
0083 vz = numeric_limits<double>::max();
0084 return;
0085
0086 }
0087
0088
0089
0090
0091
0092
0093
0094 void Types::TrkInfo::Reset() {
0095
0096 Maximize();
0097 return;
0098
0099 }
0100
0101
0102
0103
0104
0105
0106 void Types::TrkInfo::SetInfo(SvtxTrack* track, PHCompositeNode* topNode) {
0107
0108
0109 const ROOT::Math::XYZVector trkVtx = Tools::GetTrackVertex(track, topNode);
0110 const pair<double, double> trkDcaPair = Tools::GetTrackDcaPair(track, topNode);
0111
0112
0113 id = track -> get_id();
0114 vtxID = track -> get_vertex_id();
0115 quality = track -> get_quality();
0116 eta = track -> get_eta();
0117 phi = track -> get_phi();
0118 px = track -> get_px();
0119 py = track -> get_py();
0120 pz = track -> get_pz();
0121 pt = track -> get_pt();
0122 ene = sqrt((px * px) + (py * py) + (pz * pz) + (Const::MassPion() * Const::MassPion()));
0123 vx = trkVtx.x();
0124 vy = trkVtx.y();
0125 vz = trkVtx.z();
0126 dcaXY = trkDcaPair.first;
0127 dcaZ = trkDcaPair.second;
0128 nMvtxLayer = Tools::GetNumLayer(track, Const::Subsys::Mvtx);
0129 nInttLayer = Tools::GetNumLayer(track, Const::Subsys::Intt);
0130 nTpcLayer = Tools::GetNumLayer(track, Const::Subsys::Tpc);
0131 nMvtxClust = Tools::GetNumClust(track, Const::Subsys::Mvtx);
0132 nInttClust = Tools::GetNumClust(track, Const::Subsys::Intt);
0133 nTpcClust = Tools::GetNumClust(track, Const::Subsys::Tpc);
0134 ptErr = Tools::GetTrackDeltaPt(track);
0135 return;
0136
0137 }
0138
0139
0140
0141
0142
0143
0144 bool Types::TrkInfo::IsInAcceptance(const TrkInfo& minimum, const TrkInfo& maximum) const {
0145
0146 return ((*this >= minimum) && (*this <= maximum));
0147
0148 }
0149
0150
0151
0152
0153
0154
0155 bool Types::TrkInfo::IsInAcceptance(const pair<TrkInfo, TrkInfo>& range) const {
0156
0157 return ((*this >= range.first) && (*this <= range.second));
0158
0159 }
0160
0161
0162
0163
0164
0165
0166 bool Types::TrkInfo::IsInSigmaDcaCut(
0167 const pair<float, float> nSigCut,
0168 const pair<float, float> ptFitMax,
0169 const pair<TF1*, TF1*> fSigmaDca
0170 ) const {
0171
0172
0173 const double ptEvalXY = (pt > ptFitMax.first) ? ptFitMax.first : pt;
0174 const double ptEvalZ = (pt > ptFitMax.second) ? ptFitMax.second : pt;
0175
0176
0177 const bool isInDcaRangeXY = (abs(dcaXY) < (nSigCut.first * (fSigmaDca.first -> Eval(ptEvalXY))));
0178 const bool isInDcaRangeZ = (abs(dcaZ) < (nSigCut.second * (fSigmaDca.second -> Eval(ptEvalZ))));
0179 const bool isInSigmaDcaCut = (isInDcaRangeXY && isInDcaRangeZ);
0180 return isInSigmaDcaCut;
0181
0182 }
0183
0184
0185
0186
0187
0188
0189 bool Types::TrkInfo::IsFromPrimaryVtx(PHCompositeNode* topNode) {
0190
0191 GlobalVertex* primVtx = Interfaces::GetGlobalVertex(topNode);
0192 const int primVtxID = primVtx -> get_id();
0193 return (vtxID == primVtxID);
0194
0195 }
0196
0197
0198
0199
0200
0201
0202
0203
0204 vector<string> Types::TrkInfo::GetListOfMembers() {
0205
0206 vector<string> members = {
0207 "id",
0208 "vtxID",
0209 "nMvtxLayer",
0210 "nInttLayer",
0211 "nTpcLayer",
0212 "nMvtxClust",
0213 "nInttClust",
0214 "nTpcClust",
0215 "eta",
0216 "phi",
0217 "px",
0218 "py",
0219 "pz",
0220 "pt",
0221 "ene",
0222 "dcaXY",
0223 "dcaZ",
0224 "ptErr",
0225 "quality",
0226 "vx",
0227 "vy",
0228 "vz"
0229 };
0230 return members;
0231
0232 }
0233
0234
0235
0236
0237
0238
0239
0240
0241 bool Types::operator <(const TrkInfo& lhs, const TrkInfo& rhs) {
0242
0243
0244 const bool isLessThan = (
0245 (lhs.nMvtxLayer < rhs.nMvtxLayer) &&
0246 (lhs.nInttLayer < rhs.nInttLayer) &&
0247 (lhs.nTpcLayer < rhs.nTpcLayer) &&
0248 (lhs.nMvtxClust < rhs.nMvtxClust) &&
0249 (lhs.nInttClust < rhs.nInttClust) &&
0250 (lhs.nTpcClust < rhs.nTpcClust) &&
0251 (lhs.eta < rhs.eta) &&
0252 (lhs.phi < rhs.phi) &&
0253 (lhs.px < rhs.px) &&
0254 (lhs.py < rhs.py) &&
0255 (lhs.pz < rhs.pz) &&
0256 (lhs.pt < rhs.pt) &&
0257 (lhs.ene < rhs.ene) &&
0258 (lhs.dcaXY < rhs.dcaXY) &&
0259 (lhs.dcaZ < rhs.dcaZ) &&
0260 (lhs.ptErr < rhs.ptErr) &&
0261 (lhs.quality < rhs.quality) &&
0262 (lhs.vx < rhs.vx) &&
0263 (lhs.vy < rhs.vy) &&
0264 (lhs.vz < rhs.vz)
0265 );
0266 return isLessThan;
0267
0268 }
0269
0270
0271
0272
0273
0274
0275 bool Types::operator >(const TrkInfo& lhs, const TrkInfo& rhs) {
0276
0277
0278 const bool isGreaterThan = (
0279 (lhs.nMvtxLayer > rhs.nMvtxLayer) &&
0280 (lhs.nInttLayer > rhs.nInttLayer) &&
0281 (lhs.nTpcLayer > rhs.nTpcLayer) &&
0282 (lhs.nMvtxClust > rhs.nMvtxClust) &&
0283 (lhs.nInttClust > rhs.nInttClust) &&
0284 (lhs.nTpcClust > rhs.nTpcClust) &&
0285 (lhs.eta > rhs.eta) &&
0286 (lhs.phi > rhs.phi) &&
0287 (lhs.px > rhs.px) &&
0288 (lhs.py > rhs.py) &&
0289 (lhs.pz > rhs.pz) &&
0290 (lhs.pt > rhs.pt) &&
0291 (lhs.ene > rhs.ene) &&
0292 (lhs.dcaXY > rhs.dcaXY) &&
0293 (lhs.dcaZ > rhs.dcaZ) &&
0294 (lhs.ptErr > rhs.ptErr) &&
0295 (lhs.quality > rhs.quality) &&
0296 (lhs.vx > rhs.vx) &&
0297 (lhs.vy > rhs.vy) &&
0298 (lhs.vz > rhs.vz)
0299 );
0300 return isGreaterThan;
0301
0302 }
0303
0304
0305
0306
0307
0308
0309 bool Types::operator <=(const TrkInfo& lhs, const TrkInfo& rhs) {
0310
0311
0312 const bool isLessThanOrEqualTo = (
0313 (lhs.nMvtxLayer <= rhs.nMvtxLayer) &&
0314 (lhs.nInttLayer <= rhs.nInttLayer) &&
0315 (lhs.nTpcLayer <= rhs.nTpcLayer) &&
0316 (lhs.nMvtxClust <= rhs.nMvtxClust) &&
0317 (lhs.nInttClust <= rhs.nInttClust) &&
0318 (lhs.nTpcClust <= rhs.nTpcClust) &&
0319 (lhs.eta <= rhs.eta) &&
0320 (lhs.phi <= rhs.phi) &&
0321 (lhs.px <= rhs.px) &&
0322 (lhs.py <= rhs.py) &&
0323 (lhs.pz <= rhs.pz) &&
0324 (lhs.pt <= rhs.pt) &&
0325 (lhs.ene <= rhs.ene) &&
0326 (lhs.dcaXY <= rhs.dcaXY) &&
0327 (lhs.dcaZ <= rhs.dcaZ) &&
0328 (lhs.ptErr <= rhs.ptErr) &&
0329 (lhs.quality <= rhs.quality) &&
0330 (lhs.vx <= rhs.vx) &&
0331 (lhs.vy <= rhs.vy) &&
0332 (lhs.vz <= rhs.vz)
0333 );
0334 return isLessThanOrEqualTo;
0335
0336 }
0337
0338
0339
0340
0341
0342
0343 bool Types::operator >=(const TrkInfo& lhs, const TrkInfo& rhs) {
0344
0345
0346 const bool isGreaterThanOrEqualTo = (
0347 (lhs.nMvtxLayer >= rhs.nMvtxLayer) &&
0348 (lhs.nInttLayer >= rhs.nInttLayer) &&
0349 (lhs.nTpcLayer >= rhs.nTpcLayer) &&
0350 (lhs.nMvtxClust >= rhs.nMvtxClust) &&
0351 (lhs.nInttClust >= rhs.nInttClust) &&
0352 (lhs.nTpcClust >= rhs.nTpcClust) &&
0353 (lhs.eta >= rhs.eta) &&
0354 (lhs.phi >= rhs.phi) &&
0355 (lhs.px >= rhs.px) &&
0356 (lhs.py >= rhs.py) &&
0357 (lhs.pz >= rhs.pz) &&
0358 (lhs.pt >= rhs.pt) &&
0359 (lhs.ene >= rhs.ene) &&
0360 (lhs.dcaXY >= rhs.dcaXY) &&
0361 (lhs.dcaZ >= rhs.dcaZ) &&
0362 (lhs.ptErr >= rhs.ptErr) &&
0363 (lhs.quality >= rhs.quality) &&
0364 (lhs.vx >= rhs.vx) &&
0365 (lhs.vy >= rhs.vy) &&
0366 (lhs.vz >= rhs.vz)
0367 );
0368 return isGreaterThanOrEqualTo;
0369
0370 }
0371
0372
0373
0374
0375
0376
0377
0378
0379 Types::TrkInfo::TrkInfo() {
0380
0381
0382
0383 }
0384
0385
0386
0387
0388
0389
0390 Types::TrkInfo::~TrkInfo() {
0391
0392
0393
0394 }
0395
0396
0397
0398
0399
0400
0401 Types::TrkInfo::TrkInfo(const Const::Init init) {
0402
0403 switch (init) {
0404 case Const::Init::Minimize:
0405 Minimize();
0406 break;
0407 case Const::Init::Maximize:
0408 Maximize();
0409 break;
0410 default:
0411 Maximize();
0412 break;
0413 }
0414
0415 }
0416
0417
0418
0419
0420
0421
0422 Types::TrkInfo::TrkInfo(SvtxTrack* track, PHCompositeNode* topNode) {
0423
0424 SetInfo(track, topNode);
0425
0426 }
0427
0428 }
0429
0430