File indexing completed on 2025-08-06 08:13:21
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #define SCORRELATORUTILITIES_PARINFO_CC
0012
0013
0014 #include "ParInfo.h"
0015
0016
0017 using namespace std;
0018
0019
0020
0021 namespace SColdQcdCorrelatorAnalysis {
0022
0023
0024
0025
0026
0027
0028 void Types::ParInfo::Minimize() {
0029
0030 pid = -1 * numeric_limits<int>::max();
0031 status = -1 * numeric_limits<int>::max();
0032 barcode = -1 * numeric_limits<int>::max();
0033 embedID = -1 * numeric_limits<int>::max();
0034 charge = -1. * numeric_limits<float>::max();
0035 mass = -1. * numeric_limits<double>::max();
0036 eta = -1. * numeric_limits<double>::max();
0037 phi = -1. * numeric_limits<double>::max();
0038 ene = -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 vx = -1. * numeric_limits<double>::max();
0044 vy = -1. * numeric_limits<double>::max();
0045 vz = -1. * numeric_limits<double>::max();
0046 vr = -1. * numeric_limits<double>::max();
0047 return;
0048
0049 }
0050
0051
0052
0053
0054
0055
0056 void Types::ParInfo::Maximize() {
0057
0058 pid = numeric_limits<int>::max();
0059 status = numeric_limits<int>::max();
0060 barcode = numeric_limits<int>::max();
0061 embedID = numeric_limits<int>::max();
0062 charge = numeric_limits<float>::max();
0063 mass = numeric_limits<double>::max();
0064 eta = numeric_limits<double>::max();
0065 phi = numeric_limits<double>::max();
0066 ene = numeric_limits<double>::max();
0067 px = numeric_limits<double>::max();
0068 py = numeric_limits<double>::max();
0069 pz = numeric_limits<double>::max();
0070 pt = numeric_limits<double>::max();
0071 vx = numeric_limits<double>::max();
0072 vy = numeric_limits<double>::max();
0073 vz = numeric_limits<double>::max();
0074 vr = numeric_limits<double>::max();
0075 return;
0076
0077 }
0078
0079
0080
0081
0082
0083
0084
0085
0086 void Types::ParInfo::Reset() {
0087
0088 Maximize();
0089 return;
0090
0091 }
0092
0093
0094
0095
0096
0097
0098 void Types::ParInfo::SetInfo(const HepMC::GenParticle* particle, const int event) {
0099
0100 pid = particle -> pdg_id();
0101 status = particle -> status();
0102 barcode = particle -> barcode();
0103 embedID = event;
0104 charge = Const::MapPidOntoCharge()[pid];
0105 mass = particle -> momentum().m();
0106 eta = particle -> momentum().eta();
0107 phi = particle -> momentum().phi();
0108 ene = particle -> momentum().e();
0109 px = particle -> momentum().px();
0110 py = particle -> momentum().py();
0111 pz = particle -> momentum().pz();
0112 pt = particle -> momentum().perp();
0113 return;
0114
0115 }
0116
0117
0118
0119
0120
0121
0122 void Types::ParInfo::SetInfo(const PHG4Particle* particle, const int event) {
0123
0124
0125 pid = particle -> get_pid();
0126 status = numeric_limits<int>::max();
0127 barcode = particle -> get_barcode();
0128 embedID = event;
0129 charge = Const::MapPidOntoCharge()[pid];
0130 mass = numeric_limits<double>::max();
0131 ene = particle -> get_e();
0132 px = particle -> get_px();
0133 py = particle -> get_py();
0134 pz = particle -> get_pz();
0135
0136
0137 ROOT::Math::PxPyPzEVector pPar(px, py, pz, ene);
0138 eta = pPar.Eta();
0139 phi = pPar.Phi();
0140 pt = pPar.Pt();
0141 return;
0142
0143 }
0144
0145
0146
0147
0148
0149
0150 bool Types::ParInfo::IsInAcceptance(const ParInfo& minimum, const ParInfo& maximum) const {
0151
0152 return ((*this >= minimum) && (*this <= maximum));
0153
0154 }
0155
0156
0157
0158
0159
0160
0161 bool Types::ParInfo::IsInAcceptance(const pair<ParInfo, ParInfo>& range) const {
0162
0163 return ((*this >= range.first) && (*this <= range.second));
0164
0165 }
0166
0167
0168
0169
0170
0171
0172 bool Types::ParInfo::IsFinalState() const {
0173
0174 return (status == 1);
0175
0176 }
0177
0178
0179
0180
0181
0182
0183 bool Types::ParInfo::IsHardScatterProduct() const {
0184
0185 const bool isHardScatter = (
0186 (status == Const::HardScatterStatus::First) ||
0187 (status == Const::HardScatterStatus::Second)
0188 );
0189 return isHardScatter;
0190
0191 }
0192
0193
0194
0195
0196
0197
0198 bool Types::ParInfo::IsParton() const {
0199
0200 const bool isLightQuark = ((pid == Const::Parton::Down) || (pid == Const::Parton::Up));
0201 const bool isStrangeQuark = ((pid == Const::Parton::Strange) || (pid == Const::Parton::Charm));
0202 const bool isHeavyQuark = ((pid == Const::Parton::Bottom) || (pid == Const::Parton::Top));
0203 const bool isGluon = (pid == Const::Parton::Gluon);
0204 return (isLightQuark || isStrangeQuark || isHeavyQuark || isGluon);
0205
0206 }
0207
0208
0209
0210
0211
0212
0213 bool Types::ParInfo::IsOutgoingParton() const {
0214
0215 return (IsHardScatterProduct() && IsParton());
0216
0217 }
0218
0219
0220
0221
0222
0223
0224
0225
0226 vector<string> Types::ParInfo::GetListOfMembers() {
0227
0228 vector<string> members = {
0229 "pid",
0230 "status",
0231 "barcode",
0232 "embedID",
0233 "charge",
0234 "mass",
0235 "eta",
0236 "phi",
0237 "ene",
0238 "px",
0239 "py",
0240 "pz",
0241 "pt",
0242 "vx",
0243 "vy",
0244 "vz",
0245 "vr"
0246 };
0247 return members;
0248
0249 }
0250
0251
0252
0253
0254
0255
0256
0257
0258 bool Types::operator <(const ParInfo& lhs, const ParInfo& rhs) {
0259
0260
0261 const bool isLessThan = (
0262 (lhs.eta < rhs.eta) &&
0263 (lhs.phi < rhs.phi) &&
0264 (lhs.ene < rhs.ene) &&
0265 (lhs.px < rhs.px) &&
0266 (lhs.py < rhs.py) &&
0267 (lhs.pz < rhs.pz) &&
0268 (lhs.pt < rhs.pt)
0269 );
0270 return isLessThan;
0271
0272 }
0273
0274
0275
0276
0277
0278
0279 bool Types::operator >(const ParInfo& lhs, const ParInfo& rhs) {
0280
0281
0282 const bool isGreaterThan = (
0283 (lhs.eta > rhs.eta) &&
0284 (lhs.phi > rhs.phi) &&
0285 (lhs.ene > rhs.ene) &&
0286 (lhs.px > rhs.px) &&
0287 (lhs.py > rhs.py) &&
0288 (lhs.pz > rhs.pz) &&
0289 (lhs.pt > rhs.pt)
0290 );
0291 return isGreaterThan;
0292
0293 }
0294
0295
0296
0297
0298
0299
0300 bool Types::operator <=(const ParInfo& lhs, const ParInfo& rhs) {
0301
0302
0303 const bool isLessThanOrEqualTo = (
0304 (lhs.eta <= rhs.eta) &&
0305 (lhs.phi <= rhs.phi) &&
0306 (lhs.ene <= rhs.ene) &&
0307 (lhs.px <= rhs.px) &&
0308 (lhs.py <= rhs.py) &&
0309 (lhs.pz <= rhs.pz) &&
0310 (lhs.pt <= rhs.pt)
0311 );
0312 return isLessThanOrEqualTo;
0313
0314 }
0315
0316
0317
0318
0319
0320
0321 bool Types::operator >=(const ParInfo& lhs, const ParInfo& rhs) {
0322
0323
0324 const bool isGreaterThanOrEqualTo = (
0325 (lhs.eta >= rhs.eta) &&
0326 (lhs.phi >= rhs.phi) &&
0327 (lhs.ene >= rhs.ene) &&
0328 (lhs.px >= rhs.px) &&
0329 (lhs.py >= rhs.py) &&
0330 (lhs.pz >= rhs.pz) &&
0331 (lhs.pt >= rhs.pt)
0332 );
0333 return isGreaterThanOrEqualTo;
0334
0335 }
0336
0337
0338
0339
0340
0341
0342
0343
0344 Types::ParInfo::ParInfo() {
0345
0346
0347
0348 }
0349
0350
0351
0352
0353
0354
0355 Types::ParInfo::~ParInfo() {
0356
0357
0358
0359 }
0360
0361
0362
0363
0364
0365
0366 Types::ParInfo::ParInfo(const Const::Init init) {
0367
0368 switch (init) {
0369 case Const::Init::Minimize:
0370 Minimize();
0371 break;
0372 case Const::Init::Maximize:
0373 Maximize();
0374 break;
0375 default:
0376 Maximize();
0377 break;
0378 }
0379
0380 }
0381
0382
0383
0384
0385
0386
0387 Types::ParInfo::ParInfo(HepMC::GenParticle* particle, const int event) {
0388
0389 SetInfo(particle, event);
0390
0391 }
0392
0393
0394
0395
0396
0397
0398 Types::ParInfo::ParInfo(PHG4Particle* particle, const int event) {
0399
0400 SetInfo(particle, event);
0401
0402 }
0403
0404 }
0405
0406