File indexing completed on 2025-08-06 08:13:20
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #define SCORRELATORUTILITIES_CLUSTINFO_CC
0012
0013
0014 #include "ClustInfo.h"
0015
0016
0017 using namespace std;
0018
0019
0020
0021 namespace SColdQcdCorrelatorAnalysis {
0022
0023
0024
0025
0026
0027
0028 void Types::ClustInfo::Minimize() {
0029
0030 system = -1 * numeric_limits<int>::max();
0031 id = -1 * numeric_limits<int>::max();
0032 nTwr = -1 * numeric_limits<int>::max();
0033 ene = -1. * numeric_limits<double>::max();
0034 rho = -1. * numeric_limits<double>::max();
0035 eta = -1. * numeric_limits<double>::max();
0036 phi = -1. * numeric_limits<double>::max();
0037 px = -1. * numeric_limits<double>::max();
0038 py = -1. * numeric_limits<double>::max();
0039 pz = -1. * numeric_limits<double>::max();
0040 rx = -1. * numeric_limits<double>::max();
0041 ry = -1. * numeric_limits<double>::max();
0042 rz = -1. * numeric_limits<double>::max();
0043 return;
0044
0045 }
0046
0047
0048
0049
0050
0051
0052 void Types::ClustInfo::Maximize() {
0053
0054 system = numeric_limits<int>::max();
0055 id = numeric_limits<int>::max();
0056 nTwr = numeric_limits<int>::max();
0057 ene = numeric_limits<double>::max();
0058 rho = numeric_limits<double>::max();
0059 eta = numeric_limits<double>::max();
0060 phi = numeric_limits<double>::max();
0061 px = numeric_limits<double>::max();
0062 py = numeric_limits<double>::max();
0063 pz = numeric_limits<double>::max();
0064 rx = numeric_limits<double>::max();
0065 ry = numeric_limits<double>::max();
0066 rz = numeric_limits<double>::max();
0067 return;
0068
0069 }
0070
0071
0072
0073
0074
0075
0076
0077
0078 void Types::ClustInfo::Reset() {
0079
0080 Maximize();
0081 return;
0082
0083 }
0084
0085
0086
0087
0088
0089
0090 void Types::ClustInfo::SetInfo(const RawCluster* clust, optional<ROOT::Math::XYZVector> vtx, optional<int> sys) {
0091
0092
0093 ROOT::Math::XYZVector vtxToUse(0., 0., 0.);
0094 if (vtx.has_value()) {
0095 vtxToUse = vtx.value();
0096 }
0097
0098
0099 if (sys.has_value()) {
0100 system = sys.value();
0101 }
0102
0103
0104 ROOT::Math::XYZVector position(
0105 clust -> get_position().x(),
0106 clust -> get_position().y(),
0107 clust -> get_position().z()
0108 );
0109
0110
0111 ROOT::Math::PxPyPzEVector momentum = Tools::GetClustMomentum(clust -> get_energy(), position, vtxToUse);
0112
0113
0114 id = clust -> get_id();
0115 nTwr = clust -> getNTowers();
0116 ene = clust -> get_energy();
0117 rho = clust -> get_r();
0118 eta = momentum.Eta();
0119 phi = momentum.Phi();
0120 px = momentum.Px();
0121 py = momentum.Py();
0122 pz = momentum.Pz();
0123 rx = position.X();
0124 ry = position.Y();
0125 rz = position.Z();
0126 return;
0127
0128 }
0129
0130
0131
0132
0133
0134
0135 bool Types::ClustInfo::IsInAcceptance(const ClustInfo& minimum, const ClustInfo& maximum) const {
0136
0137 return ((*this >= minimum) && (*this <= maximum));
0138
0139 }
0140
0141
0142
0143
0144
0145
0146 bool Types::ClustInfo::IsInAcceptance(const pair<ClustInfo, ClustInfo>& range) const {
0147
0148 return ((*this >= range.first) && (*this <= range.second));
0149
0150 }
0151
0152
0153
0154
0155
0156
0157
0158
0159 vector<string> Types::ClustInfo::GetListOfMembers() {
0160
0161 vector<string> members = {
0162 "system",
0163 "id",
0164 "nTwr",
0165 "ene",
0166 "rho",
0167 "eta",
0168 "phi",
0169 "px",
0170 "py",
0171 "pz",
0172 "rx",
0173 "ry",
0174 "rz"
0175 };
0176 return members;
0177
0178 }
0179
0180
0181
0182
0183
0184
0185
0186
0187 bool Types::operator <(const ClustInfo& lhs, const ClustInfo& rhs) {
0188
0189
0190 const bool isLessThan = (
0191 (lhs.nTwr < rhs.nTwr) &&
0192 (lhs.ene < rhs.ene) &&
0193 (lhs.rho < rhs.rho) &&
0194 (lhs.eta < rhs.eta) &&
0195 (lhs.phi < rhs.phi) &&
0196 (lhs.px < rhs.px) &&
0197 (lhs.py < rhs.py) &&
0198 (lhs.pz < rhs.pz) &&
0199 (lhs.rx < rhs.rx) &&
0200 (lhs.ry < rhs.ry) &&
0201 (lhs.rz < rhs.rz)
0202 );
0203 return isLessThan;
0204
0205 }
0206
0207
0208
0209
0210
0211
0212 bool Types::operator >(const ClustInfo& lhs, const ClustInfo& rhs) {
0213
0214
0215 const bool isGreaterThan = (
0216 (lhs.nTwr > rhs.nTwr) &&
0217 (lhs.ene > rhs.ene) &&
0218 (lhs.rho > rhs.rho) &&
0219 (lhs.eta > rhs.eta) &&
0220 (lhs.phi > rhs.phi) &&
0221 (lhs.px > rhs.px) &&
0222 (lhs.py > rhs.py) &&
0223 (lhs.pz > rhs.pz) &&
0224 (lhs.rx > rhs.rx) &&
0225 (lhs.ry > rhs.ry) &&
0226 (lhs.rz > rhs.rz)
0227 );
0228 return isGreaterThan;
0229
0230 }
0231
0232
0233
0234
0235
0236
0237 bool Types::operator <=(const ClustInfo& lhs, const ClustInfo& rhs) {
0238
0239
0240 const bool isLessThanOrEqualTo = (
0241 (lhs.nTwr <= rhs.nTwr) &&
0242 (lhs.ene <= rhs.ene) &&
0243 (lhs.rho <= rhs.rho) &&
0244 (lhs.eta <= rhs.eta) &&
0245 (lhs.phi <= rhs.phi) &&
0246 (lhs.px <= rhs.px) &&
0247 (lhs.py <= rhs.py) &&
0248 (lhs.pz <= rhs.pz) &&
0249 (lhs.rx <= rhs.rx) &&
0250 (lhs.ry <= rhs.ry) &&
0251 (lhs.rz <= rhs.rz)
0252 );
0253 return isLessThanOrEqualTo;
0254
0255 }
0256
0257
0258
0259
0260
0261
0262 bool Types::operator >=(const ClustInfo& lhs, const ClustInfo& rhs) {
0263
0264
0265 const bool isGreaterThanOrEqualTo = (
0266 (lhs.nTwr >= rhs.nTwr) &&
0267 (lhs.ene >= rhs.ene) &&
0268 (lhs.rho >= rhs.rho) &&
0269 (lhs.eta >= rhs.eta) &&
0270 (lhs.phi >= rhs.phi) &&
0271 (lhs.px >= rhs.px) &&
0272 (lhs.py >= rhs.py) &&
0273 (lhs.pz >= rhs.pz) &&
0274 (lhs.rx >= rhs.rx) &&
0275 (lhs.ry >= rhs.ry) &&
0276 (lhs.rz >= rhs.rz)
0277 );
0278 return isGreaterThanOrEqualTo;
0279
0280 }
0281
0282
0283
0284
0285
0286
0287
0288
0289 Types::ClustInfo::ClustInfo() {
0290
0291
0292
0293 }
0294
0295
0296
0297
0298
0299
0300 Types::ClustInfo::~ClustInfo() {
0301
0302
0303
0304 }
0305
0306
0307
0308
0309
0310
0311 Types::ClustInfo::ClustInfo(const Const::Init init) {
0312
0313 switch (init) {
0314 case Const::Init::Minimize:
0315 Minimize();
0316 break;
0317 case Const::Init::Maximize:
0318 Maximize();
0319 break;
0320 default:
0321 Maximize();
0322 break;
0323 }
0324
0325 }
0326
0327
0328
0329
0330
0331
0332 Types::ClustInfo::ClustInfo(const RawCluster* clust, optional<ROOT::Math::XYZVector> vtx, optional<int> sys) {
0333
0334 SetInfo(clust, vtx, sys);
0335
0336 }
0337
0338 }
0339
0340