Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 /// ---------------------------------------------------------------------------
0002 /*! \file   TwrInfo.h
0003  *  \author Derek Anderson
0004  *  \date   08.04.2024
0005  *
0006  *  Utility class to hold information from
0007  *  calorimeter towers.
0008  */
0009 /// ---------------------------------------------------------------------------
0010 
0011 #ifndef SCORRELATORUTILITIES_TWRINFO_H
0012 #define SCORRELATORUTILITIES_TWRINFO_H
0013 
0014 // c++ utilities
0015 #include <limits>
0016 #include <string>
0017 #include <vector>
0018 #include <utility>
0019 #include <optional>
0020 // root libraries
0021 #include <Rtypes.h>
0022 #include <Math/Vector3D.h>
0023 #include <Math/Vector4D.h>
0024 // phool libraries
0025 #include <phool/PHCompositeNode.h>
0026 // CaloBase libraries
0027 #include <calobase/RawTower.h>
0028 #include <calobase/TowerInfo.h>
0029 // analysis utilities
0030 #include "Constants.h"
0031 #include "TwrTools.h"
0032 
0033 // make common namespaces implicit
0034 using namespace std;
0035 
0036 
0037 
0038 namespace SColdQcdCorrelatorAnalysis {
0039   namespace Types {
0040 
0041     // ------------------------------------------------------------------------
0042     //! Tower info
0043     // ------------------------------------------------------------------------
0044     /*! A class to consolidate information
0045      *  about calorimeter towers. Can be
0046      *  built from F4A RawTower or
0047      *  TowerInfo objects.
0048      */
0049     class TwrInfo {
0050 
0051       private:
0052 
0053         // data members
0054         int     system  = numeric_limits<int>::max();
0055         int     status  = numeric_limits<int>::max();
0056         int     channel = numeric_limits<int>::max();
0057         int     id      = numeric_limits<int>::max();
0058         double  ene     = numeric_limits<double>::max();
0059         double  rho     = numeric_limits<double>::max();
0060         double  eta     = numeric_limits<double>::max();
0061         double  phi     = 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  rx      = numeric_limits<double>::max();
0066         double  ry      = numeric_limits<double>::max();
0067         double  rz      = numeric_limits<double>::max();
0068 
0069         // private methods
0070         void Minimize();
0071         void Maximize();
0072 
0073       public:
0074 
0075         // getters
0076         int     GetSystem()  const {return system;}
0077         int     GetStatus()  const {return status;}
0078         int     GetChannel() const {return channel;}
0079         int     GetID()      const {return id;}
0080         double  GetEne()     const {return ene;}
0081         double  GetRho()     const {return rho;}
0082         double  GetEta()     const {return eta;}
0083         double  GetPhi()     const {return phi;}
0084         double  GetPX()      const {return px;}
0085         double  GetPY()      const {return py;}
0086         double  GetPZ()      const {return pz;}
0087         double  GetRX()      const {return rx;}
0088         double  GetRY()      const {return ry;}
0089         double  GetRZ()      const {return rz;}
0090 
0091         // setters
0092         void SetSystem(const int arg_sys)    {system  = arg_sys;}
0093         void SetStatus(const int arg_stat)   {status  = arg_stat;}
0094         void SetChannel(const int arg_chan)  {channel = arg_chan;}
0095         void SetID(const int arg_id)         {id      = arg_id;}
0096         void SetEne(const double arg_ene)    {ene     = arg_ene;}
0097         void SetRho(const double arg_rho)    {rho     = arg_rho;}
0098         void SetEta(const double arg_eta)    {eta     = arg_eta;}
0099         void SetPhi(const double arg_phi)    {phi     = arg_phi;}
0100         void SetPX(const double arg_px)      {px      = arg_px;}
0101         void SetPY(const double arg_py)      {py      = arg_py;}
0102         void SetPZ(const double arg_pz)      {pz      = arg_pz;}
0103         void SetRX(const double arg_rx)      {rx      = arg_rx;}
0104         void SetRY(const double arg_ry)      {ry      = arg_ry;}
0105         void SetRZ(const double arg_rz)      {rz      = arg_rz;}
0106 
0107         // public methods
0108         void Reset();
0109         void SetInfo(const int sys, const RawTower* tower, PHCompositeNode* topNode, optional<ROOT::Math::XYZVector> vtx = nullopt);
0110         void SetInfo(const int sys, const int chan, TowerInfo* tower, PHCompositeNode* topNode, optional<ROOT::Math::XYZVector> vtx = nullopt);
0111         bool IsInAcceptance(const TwrInfo& minimum, const TwrInfo& maximum) const;
0112         bool IsInAcceptance(const pair<TwrInfo, TwrInfo>& range) const;
0113         bool IsGood() const;
0114 
0115         // static methods
0116         static vector<string> GetListOfMembers();
0117 
0118         // overloaded operators
0119         friend bool operator <(const TwrInfo& lhs, const TwrInfo& rhs);
0120         friend bool operator >(const TwrInfo& lhs, const TwrInfo& rhs);
0121         friend bool operator <=(const TwrInfo& lhs, const TwrInfo& rhs);
0122         friend bool operator >=(const TwrInfo& lhs, const TwrInfo& rhs);
0123 
0124         // default ctor/dtor
0125         TwrInfo();
0126         ~TwrInfo();
0127 
0128         // ctors accepting arguments
0129         TwrInfo(const Const::Init init);
0130         TwrInfo(const int sys, const RawTower* tower, PHCompositeNode* topNode, optional<ROOT::Math::XYZVector> vtx = nullopt);
0131         TwrInfo(const int sys, const int chan, TowerInfo* tower, PHCompositeNode* topNode, optional<ROOT::Math::XYZVector> vtx = nullopt);
0132 
0133       // identify this class to ROOT
0134       ClassDefNV(TwrInfo, 1)
0135 
0136     };  // end TwrInfo def
0137 
0138 
0139 
0140     // comparison operator definitions ----------------------------------------
0141 
0142     bool operator <(const TwrInfo& lhs, const TwrInfo& rhs);
0143     bool operator >(const TwrInfo& lhs, const TwrInfo& rhs);
0144     bool operator <=(const TwrInfo& lhs, const TwrInfo& rhs);
0145     bool operator >=(const TwrInfo& lhs, const TwrInfo& rhs);
0146 
0147   }  // end Types namespace
0148 }  // end SColdQcdCorrelatorAnalysis namespace
0149 
0150 #endif
0151 
0152 // end ------------------------------------------------------------------------