Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
JetTools.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file JetTools.h
1 // ----------------------------------------------------------------------------
2 // 'JetTools.h'
3 // Derek Anderson
4 // 10.22.2023
5 //
6 // Collection of frequent jet-related methods and types
7 // utilized in the sPHENIX cold QCD Energy-Energy
8 // Correlator analysis.
9 // ----------------------------------------------------------------------------
10 
11 #pragma once
12 
13 // c++ utilities
14 #include <limits>
15 #include <vector>
16 // analysis utilities
17 #include "CstTools.h"
18 
19 // make common namespaces implicit
20 using namespace std;
21 
22 
23 
24 namespace SColdQcdCorrelatorAnalysis {
25  namespace SCorrelatorUtilities {
26 
27  // JetInfo definition -----------------------------------------------------
28 
29  struct JetInfo {
30 
31  // data members
32  uint32_t jetID = numeric_limits<uint32_t>::max();
33  uint64_t nCsts = numeric_limits<uint64_t>::max();
34  double ene = numeric_limits<double>::max();
35  double pt = numeric_limits<double>::max();
36  double eta = numeric_limits<double>::max();
37  double phi = numeric_limits<double>::max();
38  double area = numeric_limits<double>::max();
39 
40  void SetInfo(uint32_t id, uint64_t nc, double e, double p, double h, double f, double a) {
41  jetID = id;
42  nCsts = nc;
43  ene = e;
44  pt = p;
45  eta = h;
46  phi = f;
47  area = a;
48  return;
49  } // end 'SetInfo(uint32_t, uint64_t, double, double, double, double, double)'
50 
51  void Reset() {
52  jetID = numeric_limits<uint32_t>::max();
53  nCsts = numeric_limits<uint64_t>::max();
54  ene = numeric_limits<double>::max();
55  pt = numeric_limits<double>::max();
56  eta = numeric_limits<double>::max();
57  phi = numeric_limits<double>::max();
58  area = numeric_limits<double>::max();
59  return;
60  } // end 'Reset()'
61 
62  static vector<string> GetListOfMembers() {
63  vector<string> members = {
64  "jetID",
65  "nCsts",
66  "ene",
67  "pt",
68  "eta",
69  "phi",
70  "area"
71  };
72  return members;
73  } // end 'GetListOfMembers()'
74 
75  // overloaded < operator
76  friend bool operator<(const JetInfo& lhs, const JetInfo& rhs) {
77 
78  // note that some quantities aren't relevant for this comparison
79  const bool isLessThan = (
80  (lhs.nCsts < rhs.nCsts) &&
81  (lhs.ene < rhs.ene) &&
82  (lhs.pt < rhs.pt) &&
83  (lhs.eta < rhs.eta) &&
84  (lhs.phi < rhs.phi) &&
85  (lhs.area < rhs.area)
86  );
87  return isLessThan;
88 
89  } // end 'operator<(JetInfo&, JetInfo&)'
90 
91  // overloaded > operator
92  friend bool operator>(const JetInfo& lhs, const JetInfo& rhs) {
93 
94  // note that some quantities aren't relevant for this comparison
95  const bool isGreaterThan = (
96  (lhs.nCsts > rhs.nCsts) &&
97  (lhs.ene > rhs.ene) &&
98  (lhs.pt > rhs.pt) &&
99  (lhs.eta > rhs.eta) &&
100  (lhs.phi > rhs.phi) &&
101  (lhs.area > rhs.area)
102  );
103  return isGreaterThan;
104 
105  } // end 'operator<(JetInfo&, JetInfo&)'
106 
107  // overloaded <=, >= operators
108  inline friend bool operator<=(const JetInfo& lhs, const JetInfo& rhs) {return !(lhs > rhs);}
109  inline friend bool operator>=(const JetInfo& lhs, const JetInfo& rhs) {return !(lhs < rhs);}
110 
111  // default ctor/dtor
112  JetInfo() {};
113  ~JetInfo() {};
114 
115  // ctor accepting arguments
116  JetInfo(uint32_t id, uint64_t nc, double e, double p, double h, double f, double a) {
117  SetInfo(id, nc, e, p, h, f, a);
118  }
119 
120  }; // end JetInfo def
121 
122 
123 
124  // jet methods ------------------------------------------------------------
125 
126  bool IsInAcceptance(const JetInfo& jet, const JetInfo& minimum, const JetInfo& maximum) {
127 
128  return ((jet >= minimum) && (jet <= maximum));
129 
130  } // end 'IsInAcceptance(JetInfo&, JetInfo&, JetInfo&)'
131 
132  } // end SCorrelatorUtilities namespace
133 } // end SColdQcdCorrealtorAnalysis namespace
134 
135 // end ------------------------------------------------------------------------