Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:13:20

0001 /// ---------------------------------------------------------------------------
0002 /*! \file   FlowInfo.h
0003  *  \author Derek Anderson
0004  *  \date   03.06.2024
0005  *
0006  *   Utility class to hold information from
0007  *   particle flow elements.
0008  */
0009 /// ---------------------------------------------------------------------------
0010 
0011 #define SCORRELATORUTILITIES_FLOWINFO_CC
0012 
0013 // class definition
0014 #include "FlowInfo.h"
0015 
0016 // make comon namespaces implicit
0017 using namespace std;
0018 
0019 
0020 
0021 namespace SColdQcdCorrelatorAnalysis {
0022 
0023   // private methods ==========================================================
0024 
0025   // --------------------------------------------------------------------------
0026   //! Set data members to absolute minima
0027   // --------------------------------------------------------------------------
0028   void Types::FlowInfo::Minimize() {
0029 
0030     id   = -1 * numeric_limits<int>::max();
0031     type = -1 * numeric_limits<int>::max();
0032     mass = -1. * numeric_limits<double>::max();
0033     eta  = -1. * numeric_limits<double>::max();
0034     phi  = -1. * numeric_limits<double>::max();
0035     ene  = -1. * numeric_limits<double>::max();
0036     px   = -1. * numeric_limits<double>::max();
0037     py   = -1. * numeric_limits<double>::max();
0038     pz   = -1. * numeric_limits<double>::max();
0039     pt   = -1. * numeric_limits<double>::max();
0040     return;
0041 
0042   }  // end 'Minimize()'
0043 
0044 
0045 
0046   // --------------------------------------------------------------------------
0047   //! Set data members to absolute maxima
0048   // --------------------------------------------------------------------------
0049   void Types::FlowInfo::Maximize() {
0050 
0051     id   = numeric_limits<int>::max();
0052     type = numeric_limits<int>::max();
0053     mass = numeric_limits<double>::max();
0054     eta  = numeric_limits<double>::max();
0055     phi  = numeric_limits<double>::max();
0056     ene  = numeric_limits<double>::max();
0057     px   = numeric_limits<double>::max();
0058     py   = numeric_limits<double>::max();
0059     pz   = numeric_limits<double>::max();
0060     pt   = numeric_limits<double>::max();
0061     return;
0062 
0063   }  // end 'Maximize()'
0064 
0065 
0066 
0067   // public methods ===========================================================
0068 
0069   // --------------------------------------------------------------------------
0070   //! Reset object by maximizing data members
0071   // --------------------------------------------------------------------------
0072   void Types::FlowInfo::Reset() {
0073 
0074     Maximize();
0075     return;
0076 
0077   }  // end 'Reset()'
0078 
0079 
0080 
0081   // --------------------------------------------------------------------------
0082   //! Pull relevant information from a F4A PFO
0083   // --------------------------------------------------------------------------
0084   void Types::FlowInfo::SetInfo(const ParticleFlowElement* flow) {
0085 
0086     id   = flow -> get_id();
0087     type = flow -> get_type();
0088     mass = flow -> get_mass();
0089     eta  = flow -> get_eta();
0090     phi  = flow -> get_phi();
0091     ene  = flow -> get_e();
0092     px   = flow -> get_px();
0093     py   = flow -> get_py();
0094     pz   = flow -> get_pz();
0095     pt   = flow -> get_pt();
0096     return;
0097  
0098  }  // end 'SetInfo(ParticleFlowElement*)'
0099 
0100 
0101 
0102   // --------------------------------------------------------------------------
0103   //! Check if object is within provided bounds (explicit minimum, maximum)
0104   // --------------------------------------------------------------------------
0105   bool Types::FlowInfo::IsInAcceptance(const FlowInfo& minimum, const FlowInfo& maximum) const {
0106 
0107     return ((*this >= minimum) && (*this <= maximum));
0108 
0109   }  // end 'IsInAcceptance(FlowInfo&, FlowInfo&)'
0110 
0111 
0112 
0113   // --------------------------------------------------------------------------
0114   //! Check if object is within provided bounds (set by pair)
0115   // --------------------------------------------------------------------------
0116   bool Types::FlowInfo::IsInAcceptance(const pair<FlowInfo, FlowInfo>& range) const {
0117 
0118     return ((*this >= range.first) && (*this <= range.second));
0119 
0120   }  // end 'IsInAcceptance(pair<FlowInfo, FlowInfo>&)'
0121 
0122 
0123 
0124   // static methods ===========================================================
0125 
0126   // --------------------------------------------------------------------------
0127   //! Get list of data fields
0128   // --------------------------------------------------------------------------
0129   vector<string> Types::FlowInfo::GetListOfMembers() {
0130 
0131     vector<string> members = {
0132       "id",
0133       "type",
0134       "mass",
0135       "eta",
0136       "phi",
0137       "ene",
0138       "px",
0139       "py",
0140       "pz",
0141       "pt"
0142     };
0143     return members;
0144 
0145   }  // end 'GetListOfMembers()'
0146 
0147 
0148 
0149   // overloaded operators =====================================================
0150 
0151   // --------------------------------------------------------------------------
0152   //! Overloaded less-than comparison
0153   // --------------------------------------------------------------------------
0154   bool Types::operator <(const FlowInfo& lhs, const FlowInfo& rhs) {
0155 
0156     // note that some quantities aren't relevant for this comparison
0157     const bool isLessThan = (
0158       (lhs.mass < rhs.mass) &&
0159       (lhs.ene  < rhs.ene)  &&
0160       (lhs.eta  < rhs.eta)  &&
0161       (lhs.phi  < rhs.phi)  &&
0162       (lhs.px   < rhs.px)   &&
0163       (lhs.py   < rhs.py)   &&
0164       (lhs.pz   < rhs.pz)   &&
0165       (lhs.pt   < rhs.pt)
0166     );
0167     return isLessThan;
0168 
0169   }  // end 'operator <(FlowInfo&, FlowInfo&)'
0170 
0171 
0172 
0173   // --------------------------------------------------------------------------
0174   //! Overloaded greater-than comparison
0175   // --------------------------------------------------------------------------
0176   bool Types::operator >(const FlowInfo& lhs, const FlowInfo& rhs) {
0177 
0178     // note that some quantities aren't relevant for this comparison
0179     const bool isGreaterThan = (
0180       (lhs.mass > rhs.mass) &&
0181       (lhs.ene  > rhs.ene)  &&
0182       (lhs.eta  > rhs.eta)  &&
0183       (lhs.phi  > rhs.phi)  &&
0184       (lhs.px   > rhs.px)   &&
0185       (lhs.py   > rhs.py)   &&
0186       (lhs.pz   > rhs.pz)   &&
0187       (lhs.pt   > rhs.pt)
0188     );
0189     return isGreaterThan;
0190 
0191   }  // end 'operator >(FlowInfo&, FlowInfo&)'
0192 
0193 
0194 
0195   // --------------------------------------------------------------------------
0196   //! Overloaded less-than-or-equal-to comparison
0197   // --------------------------------------------------------------------------
0198   bool Types::operator <=(const FlowInfo& lhs, const FlowInfo& rhs) {
0199 
0200     // note that some quantities aren't relevant for this comparison
0201     const bool isLessThanOrEqualTo = (
0202       (lhs.mass < rhs.mass) &&
0203       (lhs.ene  < rhs.ene)  &&
0204       (lhs.eta  < rhs.eta)  &&
0205       (lhs.phi  < rhs.phi)  &&
0206       (lhs.px   < rhs.px)   &&
0207       (lhs.py   < rhs.py)   &&
0208       (lhs.pz   < rhs.pz)   &&
0209       (lhs.pt   < rhs.pt)
0210     );
0211     return isLessThanOrEqualTo;
0212 
0213   }  // end 'operator <=(FlowInfo&, FlowInfo&)'
0214 
0215 
0216 
0217   // --------------------------------------------------------------------------
0218   //! Overloaded greater-than-or-equal-to comparison
0219   // --------------------------------------------------------------------------
0220   bool Types::operator >=(const FlowInfo& lhs, const FlowInfo& rhs) {
0221 
0222     // note that some quantities aren't relevant for this comparison
0223     const bool isGreaterThanOrEqualTo = (
0224       (lhs.mass > rhs.mass) &&
0225       (lhs.ene  > rhs.ene)  &&
0226       (lhs.eta  > rhs.eta)  &&
0227       (lhs.phi  > rhs.phi)  &&
0228       (lhs.px   > rhs.px)   &&
0229       (lhs.py   > rhs.py)   &&
0230       (lhs.pz   > rhs.pz)   &&
0231       (lhs.pt   > rhs.pt)
0232     );
0233     return isGreaterThanOrEqualTo;
0234 
0235   }  // end 'operator >=(FlowInfo&, FlowInfo&)'
0236 
0237 
0238 
0239   // ctor/dtor ================================================================
0240 
0241   // --------------------------------------------------------------------------
0242   //! Default class constructor
0243   // --------------------------------------------------------------------------
0244   Types::FlowInfo::FlowInfo() {
0245 
0246     /* nothing to do */
0247 
0248   }  // end ctor()
0249 
0250 
0251 
0252   // --------------------------------------------------------------------------
0253   //! Default class destructor
0254   // --------------------------------------------------------------------------
0255   Types::FlowInfo::~FlowInfo() {
0256 
0257     /* nothing to do */
0258 
0259   }  // end dtor()
0260 
0261 
0262 
0263   // --------------------------------------------------------------------------
0264   //! Constructor accepting initialization option (minimize or maximize)
0265   // --------------------------------------------------------------------------
0266   Types::FlowInfo::FlowInfo(const Const::Init init) {
0267 
0268     switch (init) {
0269       case Const::Init::Minimize:
0270         Minimize();
0271         break;
0272       case Const::Init::Maximize:
0273         Maximize();
0274         break;
0275       default:
0276         Maximize();
0277         break;
0278     }
0279 
0280   }  // end ctor(Const::init)
0281 
0282 
0283 
0284   // --------------------------------------------------------------------------
0285   //! Constructor accepting a F4A PFO
0286   // --------------------------------------------------------------------------
0287   Types::FlowInfo::FlowInfo(const ParticleFlowElement* flow) {
0288 
0289     SetInfo(flow);
0290 
0291   }  // end ctor(ParticleFlowElement*)'
0292 
0293 }  // end SColdQcdCorrelatorAnalysis namespace
0294 
0295 // end ------------------------------------------------------------------------