Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 /// ---------------------------------------------------------------------------
0002 /*! \file   ParInfo.h
0003  *  \author Derek Anderson
0004  *  \date   03.04.2024
0005  *
0006  *  Utility class to hold information from
0007  *  generated particles.
0008  */
0009 /// ---------------------------------------------------------------------------
0010 
0011 #ifndef SCORRELATORUTILITIES_PARINFO_H
0012 #define SCORRELATORUTILITIES_PARINFO_H
0013 
0014 #pragma GCC diagnostic push
0015 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
0016 
0017 // c++ utilities
0018 #include <limits>
0019 #include <string>
0020 #include <vector>
0021 #include <utility>
0022 // root libraries
0023 #include <Rtypes.h>
0024 #include <Math/Vector4D.h>
0025 // PHG4 libraries
0026 #include <g4main/PHG4Particle.h>
0027 // hepmc libraries
0028 #include <HepMC/GenParticle.h>
0029 // analysis utilities
0030 #include "Constants.h"
0031 
0032 #pragma GCC diagnostic pop
0033 
0034 // make common namespaces implicit
0035 using namespace std;
0036 
0037 
0038 
0039 namespace SColdQcdCorrelatorAnalysis {
0040   namespace Types {
0041 
0042     // ------------------------------------------------------------------------
0043     //! Particle info
0044     // ------------------------------------------------------------------------
0045     /*! A class to consolidate information
0046      *  about generated particles. Can be
0047      *  built from HepMC GenParticle or
0048      *  F4A PHG4Particle objects.
0049      */
0050     class ParInfo {
0051 
0052       private:
0053 
0054         // data members
0055         int    pid     = numeric_limits<int>::max();
0056         int    status  = numeric_limits<int>::max();
0057         int    barcode = numeric_limits<int>::max();
0058         int    embedID = numeric_limits<int>::max();
0059         float  charge  = numeric_limits<float>::max();
0060         double mass    = numeric_limits<double>::max();
0061         double eta     = numeric_limits<double>::max();
0062         double phi     = numeric_limits<double>::max();
0063         double ene     = numeric_limits<double>::max();
0064         double px      = numeric_limits<double>::max();
0065         double py      = numeric_limits<double>::max();
0066         double pz      = numeric_limits<double>::max();
0067         double pt      = numeric_limits<double>::max();
0068         double vx      = numeric_limits<double>::max();
0069         double vy      = numeric_limits<double>::max();
0070         double vz      = numeric_limits<double>::max();
0071         double vr      = numeric_limits<double>::max();
0072 
0073         // private methods
0074         void Minimize();
0075         void Maximize();
0076 
0077       public:
0078 
0079         // getters
0080         int    GetPID()     const {return pid;}
0081         int    GetStatus()  const {return status;}
0082         int    GetBarcode() const {return barcode;}
0083         int    GetEmbedID() const {return embedID;}
0084         float  GetCharge()  const {return charge;}
0085         double GetMass()    const {return mass;}
0086         double GetEta()     const {return eta;}
0087         double GetPhi()     const {return phi;}
0088         double GetEne()     const {return ene;}
0089         double GetPX()      const {return px;}
0090         double GetPY()      const {return py;}
0091         double GetPZ()      const {return pz;}
0092         double GetPT()      const {return pt;}
0093         double GetVX()      const {return vx;}
0094         double GetVY()      const {return vy;}
0095         double GetVZ()      const {return vz;}
0096         double GetVR()      const {return vr;}
0097 
0098         // setters
0099         void SetPID(const int arg_pid)         {pid     = arg_pid;}
0100         void SetStatus(const int arg_status)   {status  = arg_status;}
0101         void SetBarcode(const int arg_barcode) {barcode = arg_barcode;}
0102         void SetEmbedID(const int arg_embedID) {embedID = arg_embedID;}
0103         void SetCharge(const float arg_charge) {charge  = arg_charge;}
0104         void SetMass(const double arg_mass)    {mass    = arg_mass;}
0105         void SetEta(const double arg_eta)      {eta     = arg_eta;}
0106         void SetPhi(const double arg_phi)      {phi     = arg_phi;}
0107         void SetEne(const double arg_ene)      {ene     = arg_ene;}
0108         void SetPX(const double arg_px)        {px      = arg_px;}
0109         void SetPY(const double arg_py)        {py      = arg_py;}
0110         void SetPZ(const double arg_pz)        {pz      = arg_pz;}
0111         void SetPT(const double arg_pt)        {pt      = arg_pt;}
0112         void SetVX(const double arg_vx)        {vx      = arg_vx;}
0113         void SetVY(const double arg_vy)        {vy      = arg_vy;}
0114         void SetVZ(const double arg_vz)        {vz      = arg_vz;}
0115         void SetVR(const double arg_vr)        {vr      = arg_vr;}
0116 
0117         // public methods
0118         void Reset();
0119         void SetInfo(const HepMC::GenParticle* particle, const int event);
0120         void SetInfo(const PHG4Particle* particle, const int event);
0121         bool IsInAcceptance(const ParInfo& minimum, const ParInfo& maximum) const;
0122         bool IsInAcceptance(const pair<ParInfo, ParInfo>& range) const;
0123         bool IsFinalState() const;
0124         bool IsHardScatterProduct() const;
0125         bool IsParton() const;
0126         bool IsOutgoingParton() const;
0127 
0128         // static methods
0129         static vector<string> GetListOfMembers();
0130 
0131         // overloaded operators
0132         friend bool operator <(const ParInfo& lhs, const ParInfo& rhs);
0133         friend bool operator >(const ParInfo& lhs, const ParInfo& rhs);
0134         friend bool operator <=(const ParInfo& lhs, const ParInfo& rhs);
0135         friend bool operator >=(const ParInfo& lhs, const ParInfo& rhs);
0136 
0137         // default ctor/dtor
0138         ParInfo();
0139         ~ParInfo();
0140 
0141         // ctors accepting arguments
0142         ParInfo(const Const::Init init);
0143         ParInfo(HepMC::GenParticle* particle, const int event);
0144         ParInfo(PHG4Particle* particle, const int event);
0145 
0146       // identify this class to ROOT
0147       ClassDefNV(ParInfo, 1)
0148 
0149     };  // end ParInfo definition
0150 
0151 
0152 
0153     // overloaded operator definitions ----------------------------------------
0154 
0155     bool operator <(const ParInfo& lhs, const ParInfo& rhs);
0156     bool operator >(const ParInfo& lhs, const ParInfo& rhs);
0157     bool operator <=(const ParInfo& lhs, const ParInfo& rhs);
0158     bool operator >=(const ParInfo& lhs, const ParInfo& rhs);
0159 
0160   }  // end Types namespace
0161 }  // end SColdQcdCorrelatorAnalysis namespace
0162 
0163 #endif
0164 
0165 // end ------------------------------------------------------------------------