Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 /// ---------------------------------------------------------------------------
0002 /*! \file   CstInfo.h
0003  *  \author Derek Anderson
0004  *  \date   03.03.2024
0005  *
0006  *  Utility class to hold information from
0007  *  jet constituents.
0008  */
0009 /// ---------------------------------------------------------------------------
0010 
0011 #ifndef SCORRELATORUTILITIES_CSTINFO_H
0012 #define SCORRELATORUTILITIES_CSTINFO_H
0013 
0014 // c++ utilities
0015 #include <cmath>
0016 #include <limits>
0017 #include <string>
0018 #include <vector>
0019 #include <cassert>
0020 #include <utility>
0021 #include <optional>
0022 // root libraries
0023 #include <Rtypes.h>
0024 #include <Math/Vector3D.h>
0025 #include <Math/Vector4D.h>
0026 // fastjet libraries
0027 #include <fastjet/PseudoJet.hh>
0028 // phool libraries
0029 #include <phool/PHCompositeNode.h>
0030 // PHG4 libraries
0031 #include <g4main/PHG4Particle.h>
0032 // calobase libraries
0033 #include <calobase/RawTower.h>
0034 #include <calobase/TowerInfo.h>
0035 #include <calobase/RawCluster.h>
0036 // trackbase libraries
0037 #include <trackbase_historic/SvtxTrack.h>
0038 // particle flow libraries
0039 #include <particleflowreco/ParticleFlowElement.h>
0040 // jetbase libraries
0041 #include <jetbase/Jet.h>
0042 #include <jetbase/JetContainer.h>
0043 // analysis utilities
0044 #include "JetInfo.h"
0045 #include "TwrTools.h"
0046 #include "Constants.h"
0047 #include "ClustTools.h"
0048 #include "CstInterfaces.h"
0049 
0050 // make common namespaces implicit
0051 using namespace std;
0052 
0053 
0054 
0055 namespace SColdQcdCorrelatorAnalysis {
0056   namespace Types {
0057 
0058     // ------------------------------------------------------------------------
0059     //! Constituent info
0060     // ------------------------------------------------------------------------
0061     /*! A class to consolidate information
0062      *  about jet constituents. Can be built
0063      *  from FastJet PseudoJets's or F4A
0064      *  tracks, clusters, or particles.
0065      */
0066     class CstInfo {
0067 
0068       private:
0069 
0070         // data members
0071         int    type    = numeric_limits<int>::max();
0072         int    cstID   = numeric_limits<int>::max();
0073         int    jetID   = numeric_limits<int>::max();
0074         int    embedID = numeric_limits<int>::max();
0075         int    pid     = numeric_limits<int>::max();
0076         double z       = numeric_limits<double>::max();
0077         double dr      = numeric_limits<double>::max();
0078         double jt      = numeric_limits<double>::max();
0079         double ene     = numeric_limits<double>::max();
0080         double px      = numeric_limits<double>::max();
0081         double py      = numeric_limits<double>::max();
0082         double pz      = numeric_limits<double>::max();
0083         double pt      = numeric_limits<double>::max();
0084         double eta     = numeric_limits<double>::max();
0085         double phi     = numeric_limits<double>::max();
0086 
0087         // private methods
0088         void Minimize();
0089         void Maximize();
0090 
0091       public:
0092 
0093         // getters
0094         int    GetType()    const {return type;}
0095         int    GetCstID()   const {return cstID;}
0096         int    GetJetID()   const {return jetID;}
0097         int    GetEmbedID() const {return embedID;}
0098         int    GetPID()     const {return pid;}
0099         double GetZ()       const {return z;}
0100         double GetDR()      const {return dr;}
0101         double GetJT()      const {return jt;}
0102         double GetEne()     const {return ene;}
0103         double GetPX()      const {return px;}
0104         double GetPY()      const {return py;}
0105         double GetPZ()      const {return pz;}
0106         double GetPT()      const {return pt;}
0107         double GetEta()     const {return eta;}
0108         double GetPhi()     const {return phi;}
0109 
0110         // setters
0111         void SetType(const int arg_type)       {type    = arg_type;}
0112         void SetCstID(const int arg_cstID)     {cstID   = arg_cstID;}
0113         void SetJetID(const int arg_jetID)     {jetID   = arg_jetID;}
0114         void SetEmbedID(const int arg_embedID) {embedID = arg_embedID;}
0115         void SetPID(const int arg_pid)         {pid     = arg_pid;}
0116         void SetZ(const double arg_z)          {z       = arg_z;}
0117         void SetDR(const double arg_dr)        {dr      = arg_dr;}
0118         void SetJT(const double arg_jt)        {jt      = arg_jt;}
0119         void SetEne(const double arg_ene)      {ene     = arg_ene;}
0120         void SetPX(const double arg_px)        {px      = arg_px;}
0121         void SetPY(const double arg_py)        {py      = arg_py;}
0122         void SetPZ(const double arg_pz)        {pz      = arg_pz;}
0123         void SetPT(const double arg_pt)        {pt      = arg_pt;}
0124         void SetEta(const double arg_eta)      {eta     = arg_eta;}
0125         void SetPhi(const double arg_phi)      {phi     = arg_phi;}
0126 
0127         // public methods
0128         void Reset();
0129         void SetInfo(fastjet::PseudoJet& pseudojet);
0130         void SetInfo(SvtxTrack* track);
0131         void SetInfo(const ParticleFlowElement* flow);
0132         void SetInfo(const int sys, RawTower* tower, PHCompositeNode* topNode, optional<ROOT::Math::XYZVector> vtx = nullopt);
0133         void SetInfo(const int sys, const int chan, TowerInfo* info, PHCompositeNode* topNode, optional<ROOT::Math::XYZVector> vtx = nullopt);
0134         void SetInfo(const RawCluster* cluster, optional<ROOT::Math::XYZVector> vtx = nullopt);
0135         void SetInfo(PHG4Particle* particle, const int event);
0136         void SetInfo(const pair<Jet::SRC, unsigned int>& itCst, PHCompositeNode* topNode, optional<ROOT::Math::XYZVector> vtx = nullopt, optional<int> event = nullopt);
0137         void SetJetInfo(const int id, const Types::JetInfo& jet);
0138         bool IsInAcceptance(const CstInfo& minimum, const CstInfo& maximum) const;
0139         bool IsInAcceptance(const pair<CstInfo, CstInfo>& range) const;
0140 
0141         // static methods
0142         static vector<string> GetListOfMembers();
0143 
0144         // overloaded operators
0145         friend bool operator <(const CstInfo& lhs, const CstInfo& rhs);
0146         friend bool operator >(const CstInfo& lhs, const CstInfo& rhs);
0147         friend bool operator <=(const CstInfo& lhs, const CstInfo& rhs);
0148         friend bool operator >=(const CstInfo& lhs, const CstInfo& rhs);
0149 
0150         // default ctor/dtor
0151         CstInfo();
0152         ~CstInfo();
0153 
0154         // ctors accepting arguments
0155         CstInfo(const Const::Init init);
0156         CstInfo(fastjet::PseudoJet& pseudojet);
0157         CstInfo(SvtxTrack* track);
0158         CstInfo(const ParticleFlowElement* flow);
0159         CstInfo(const int sys, RawTower* tower, PHCompositeNode* topNode, optional<ROOT::Math::XYZVector> vtx = nullopt);
0160         CstInfo(const int sys, const int chan, TowerInfo* info, PHCompositeNode* topNode, optional<ROOT::Math::XYZVector> vtx = nullopt);
0161         CstInfo(const RawCluster* cluster, optional<ROOT::Math::XYZVector> vtx = nullopt);
0162         CstInfo(PHG4Particle* particle, const int event);
0163         CstInfo(const pair<Jet::SRC, unsigned int>& itCst, PHCompositeNode* topNode, optional<ROOT::Math::XYZVector> vtx = nullopt, optional<int> event = nullopt);
0164 
0165       // identify this class to ROOT
0166       ClassDefNV(CstInfo, 1)
0167 
0168     };  // end CstInfo def
0169 
0170 
0171 
0172     // comparison operator definitions ----------------------------------------
0173 
0174     bool operator <(const CstInfo& lhs, const CstInfo& rhs);
0175     bool operator >(const CstInfo& lhs, const CstInfo& rhs);
0176     bool operator <=(const CstInfo& lhs, const CstInfo& rhs);
0177     bool operator >=(const CstInfo& lhs, const CstInfo& rhs);
0178 
0179   }  // end Types namespace
0180 }  // end SColdQcdCorrelatorAnalysis namespace
0181 
0182 #endif
0183 
0184 // end ------------------------------------------------------------------------