Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 /// ---------------------------------------------------------------------------
0002 /*! \file   TrkInfo.cc
0003  *  \author Derek Anderson
0004  *  \date   03.05.2024
0005  *
0006  *  Utility class to hold information from tracks.
0007  */
0008 /// ---------------------------------------------------------------------------
0009 
0010 #ifndef SCORRELATORUTILITIES_TRKINFO_H
0011 #define SCORRELATORUTILITIES_TRKINFO_H
0012 
0013 // c++ utilities
0014 #include <cmath>
0015 #include <limits>
0016 #include <string>
0017 #include <vector>
0018 #include <utility>
0019 // root libraries
0020 #include <TF1.h>
0021 #include <Rtypes.h>
0022 #include <Math/Vector3D.h>
0023 // phool libraries
0024 #include <phool/PHCompositeNode.h>
0025 // tracking libraries
0026 #include <trackbase_historic/SvtxTrack.h>
0027 // analysis utilities
0028 #include "TrkTools.h"
0029 #include "Constants.h"
0030 
0031 // make common namespaces implicit
0032 using namespace std;
0033 
0034 
0035 
0036 namespace SColdQcdCorrelatorAnalysis {
0037   namespace Types {
0038 
0039     // ------------------------------------------------------------------------
0040     //! Constituent info
0041     // ------------------------------------------------------------------------
0042     /*! A class to consolidate information
0043      *  about tracks. Can be built from a
0044      *  F4A SvtxTrack.
0045      */
0046     class TrkInfo {
0047 
0048       private:
0049 
0050         // data members
0051         int    id         = numeric_limits<int>::max();
0052         int    vtxID      = numeric_limits<int>::max();
0053         int    nMvtxLayer = numeric_limits<int>::max();
0054         int    nInttLayer = numeric_limits<int>::max();
0055         int    nTpcLayer  = numeric_limits<int>::max();
0056         int    nMvtxClust = numeric_limits<int>::max();
0057         int    nInttClust = numeric_limits<int>::max();
0058         int    nTpcClust  = numeric_limits<int>::max();
0059         double eta        = numeric_limits<double>::max();
0060         double phi        = numeric_limits<double>::max();
0061         double ene        = numeric_limits<double>::max();
0062         double px         = numeric_limits<double>::max();
0063         double py         = numeric_limits<double>::max();
0064         double pz         = numeric_limits<double>::max();
0065         double pt         = numeric_limits<double>::max();
0066         double dcaXY      = numeric_limits<double>::max();
0067         double dcaZ       = numeric_limits<double>::max();
0068         double ptErr      = numeric_limits<double>::max();
0069         double quality    = numeric_limits<double>::max();
0070         double vx         = numeric_limits<double>::max();
0071         double vy         = numeric_limits<double>::max();
0072         double vz         = numeric_limits<double>::max();
0073 
0074         // private methods
0075         void Minimize();
0076         void Maximize();
0077 
0078       public:
0079 
0080         // getters
0081         int    GetID()         const {return id;}
0082         int    GetVtxID()      const {return vtxID;}
0083         int    GetNMvtxLayer() const {return nMvtxLayer;}
0084         int    GetNInttLayer() const {return nInttLayer;}
0085         int    GetNTpcLayer()  const {return nTpcLayer;}
0086         int    GetNMvtxClust() const {return nMvtxClust;}
0087         int    GetNInttClust() const {return nInttClust;}
0088         int    GetNTpcClust()  const {return nTpcClust;}
0089         double GetEta()        const {return eta;}
0090         double GetPhi()        const {return phi;}
0091         double GetEne()        const {return ene;}
0092         double GetPX()         const {return px;}
0093         double GetPY()         const {return py;}
0094         double GetPZ()         const {return pz;}
0095         double GetPT()         const {return pt;}
0096         double GetDcaXY()      const {return dcaXY;}
0097         double GetDcaZ()       const {return dcaZ;}
0098         double GetPtErr()      const {return ptErr;}
0099         double GetQuality()    const {return quality;}
0100         double GetVX()         const {return vx;}
0101         double GetVY()         const {return vy;}
0102         double GetVZ()         const {return vz;}
0103 
0104         // setters
0105         void SetID(const int arg_id)                 {id         = arg_id;}
0106         void SetVtxID(const int arg_vtxID)           {vtxID      = arg_vtxID;}
0107         void SetNMvtxLayer(const int arg_nMvtxLayer) {nMvtxLayer = arg_nMvtxLayer;}
0108         void SetNInttLayer(const int arg_nInttLayer) {nInttLayer = arg_nInttLayer;}
0109         void SetNTpcLayer(const int arg_nTpcLayer)   {nTpcLayer  = arg_nTpcLayer;}
0110         void SetNMvtxClust(const int arg_nMvtxClust) {nMvtxClust = arg_nMvtxClust;}
0111         void SetNInttClust(const int arg_nInttClust) {nInttClust = arg_nInttClust;}
0112         void SetNTpcClust(const int arg_nTpcClust)   {nTpcClust  = arg_nTpcClust;}
0113         void SetEta(const double arg_eta)            {eta        = arg_eta;}
0114         void SetPhi(const double arg_phi)            {phi        = arg_phi;}
0115         void SetEne(const double arg_ene)            {ene        = arg_ene;}
0116         void SetPX(const double arg_px)              {px         = arg_px;}
0117         void SetPY(const double arg_py)              {py         = arg_py;}
0118         void SetPZ(const double arg_pz)              {pz         = arg_pz;}
0119         void SetPT(const double arg_pt)              {pt         = arg_pt;}
0120         void SetDcaXY(const double arg_dcaXY)        {dcaXY      = arg_dcaXY;}
0121         void SetDcaZ(const double arg_dcaZ)          {dcaZ       = arg_dcaZ;}
0122         void SetPtErr(const double arg_ptErr)        {ptErr      = arg_ptErr;}
0123         void SetQuality(const double arg_quality)    {quality    = arg_quality;}
0124         void SetVX(const double arg_vx)              {vx         = arg_vx;}
0125         void SetVY(const double arg_vy)              {vy         = arg_vy;}
0126         void SetVZ(const double arg_vz)              {vz         = arg_vz;}
0127 
0128         // public methods
0129         void Reset();
0130         void SetInfo(SvtxTrack* track, PHCompositeNode* topNode);
0131         bool IsInAcceptance(const TrkInfo& minimum, const TrkInfo& maximum) const;
0132         bool IsInAcceptance(const pair<TrkInfo, TrkInfo>& range) const;
0133         bool IsInSigmaDcaCut(const pair<float, float> nSigCut, const pair<float, float> ptFitMax, const pair<TF1*, TF1*> fSigmaDca) const;
0134         bool IsFromPrimaryVtx(PHCompositeNode* topNode);
0135 
0136         // static methods
0137         static vector<string> GetListOfMembers();
0138 
0139         // overloaded operators
0140         friend bool operator <(const TrkInfo& lhs, const TrkInfo& rhs);
0141         friend bool operator >(const TrkInfo& lhs, const TrkInfo& rhs);
0142         friend bool operator <=(const TrkInfo& lhs, const TrkInfo& rhs);
0143         friend bool operator >=(const TrkInfo& lhs, const TrkInfo& rhs);
0144 
0145         // default ctor/dtor
0146         TrkInfo();
0147         ~TrkInfo();
0148 
0149         // ctors accepting arguments
0150         TrkInfo(const Const::Init init);
0151         TrkInfo(SvtxTrack* track, PHCompositeNode* topNode);
0152 
0153       // identify this class to ROOT
0154       ClassDefNV(TrkInfo, 1);
0155 
0156     };  // end TrkInfo def
0157 
0158 
0159 
0160     // overloaded operator definitions ----------------------------------------
0161 
0162     bool operator <(const TrkInfo& lhs, const TrkInfo& rhs);
0163     bool operator >(const TrkInfo& lhs, const TrkInfo& rhs);
0164     bool operator <=(const TrkInfo& lhs, const TrkInfo& rhs);
0165     bool operator >=(const TrkInfo& lhs, const TrkInfo& rhs);
0166 
0167   }  // end Types namespace
0168 }  // end SColdQcdCorrelatorAnalysis namespace
0169 
0170 #endif
0171 
0172 // end ------------------------------------------------------------------------