Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:17:31

0001 #ifndef CALORECO_EMCCLUSTER_H
0002 #define CALORECO_EMCCLUSTER_H
0003 
0004 // Name: EmcCluster.h
0005 // Author: A. Bazilevsky (RIKEN-BNL)
0006 // Major modifications by M. Volkov (RRC KI) Jan 27 2000
0007 
0008 #include <TObject.h>
0009 
0010 #include <cmath>
0011 #include <cstdlib>
0012 #include <vector>
0013 
0014 // Forward declarations
0015 class BEmcRec;
0016 
0017 /** One tower information for internal clustering use.
0018 @ingroup clustering
0019 */
0020 
0021 class EmcModule
0022 {
0023  public:
0024   EmcModule() = default;
0025 
0026   //_____________________________________________________________________________
0027   EmcModule(int ich_, float amp_, float tof_)
0028     : ich(ich_)
0029       , amp(amp_)
0030       , tof(tof_)
0031   {
0032   }
0033   
0034   virtual ~EmcModule() {}
0035 
0036   int ich {0};    // module id (linear)
0037   float amp {0};  // module signal
0038   float tof {0};  // module time-of-flight
0039 
0040 
0041 };
0042 
0043 // ///////////////////////////////////////////////////////////////////////////
0044 
0045 /** The 1-st level of the EMCal clustering: cluster is a set of contiguous
0046     towers.
0047 
0048     Only used internally by clustering routines.
0049     @ingroup clustering
0050 */
0051 
0052 class EmcCluster : public TObject
0053 {
0054  public:
0055   /// Constructor (zero Hit List)
0056   EmcCluster()
0057     : fOwner(nullptr)
0058   {
0059   }
0060 
0061   explicit EmcCluster(BEmcRec* sector)
0062     : fOwner(sector)
0063   {
0064   }
0065 
0066   /// Constructor (inputs Hit List)
0067 
0068   EmcCluster(const std::vector<EmcModule>& hlist,
0069              BEmcRec* sector)
0070     : fHitList(hlist)
0071     , fOwner(sector)
0072   {
0073   }
0074 
0075   ///
0076   ~EmcCluster() override
0077   {
0078   }
0079 
0080   /// Reinitializes EmcCluster supplying new Hit List.
0081 
0082   void ReInitialize(const std::vector<EmcModule>& hlist)
0083   {
0084     fHitList = hlist;
0085   }
0086   /// Returns number of EmcModules in EmcCluster
0087   int GetNofHits() { return fHitList.size(); }
0088   /// Returns EmcCluster fHitList
0089   const std::vector<EmcModule> &GetHitList() { return fHitList; };
0090   /// Returns the EmcModule with the maximum energy
0091   EmcModule GetMaxTower();
0092   /// Returns the EmcModule corresponding to the reconstructed impact tower
0093   //  EmcModule GetImpactTower();
0094   /// Returns the energy of the ich-tower
0095   float GetTowerEnergy(int ich);
0096   /// Returns the energy of the tower ix,iy
0097   float GetTowerEnergy(int ix, int iy);
0098   /// Returns the ToF of the ich-tower
0099   float GetTowerToF(int ich);
0100   /// Returns the energy in 2x2 towers around the cluster Center of Gravity
0101   float GetE4();
0102   /// Returns the energy in 3x3 towers around the cluster Center of Gravity
0103   float GetE9();
0104   /// Returns the energy in 3x3 towers around the tower ich
0105   float GetE9(int ich);
0106   /// Returns the cluster energy taking into account towers with E>Ethresh
0107   float GetECore();
0108   /// Ecore corrected for energy leak sidewise core towers
0109   float GetECoreCorrected();
0110   /// Returns the EmcCluster total energy
0111   float GetTotalEnergy();
0112   /// Returns EmcCluster 1-st (pxcg,pycg) and 2-d momenta (pxx,pxy,pyy)
0113   void GetMoments(float& x, float& y,
0114                   float& pxx, float& pxy, float& pyy);
0115   /// Returns the EmcCluster corrected position in Sector (SM) frame
0116   void GetCorrPos(float& xc, float& yc);
0117   /// Returns the EmcCluster position in PHENIX global coord system
0118   void GetGlobalPos(float& xA, float& yA, float& zA);
0119   /// Splits the Cluster onto SubClusters; returns list of clusters and list of peak towers corresponding to subclusters
0120   int GetSubClusters(std::vector<EmcCluster>& PkList, std::vector<EmcModule>& ppeaks, bool dosubclustersplitting);
0121   float GetProb(float& chi2, int& ndf);
0122 
0123  protected:
0124   std::vector<EmcModule> fHitList;
0125 
0126   BEmcRec* fOwner;  // what sector it belongs to
0127 
0128   // static members
0129   static int const fgMaxNofPeaks;
0130   static int const fgPeakIter;
0131   static float const fgEmin;
0132 
0133  public:
0134   // MV 2002/02/28 moved these functions here from #define's
0135 
0136   static int max(int a, int b)
0137   {
0138     return a > b ? a : b;
0139   }
0140   static float max(float a, float b)
0141   {
0142     return a > b ? a : b;
0143   }
0144   static double max(double a, double b)
0145   {
0146     return a > b ? a : b;
0147   }
0148 
0149   static int min(int a, int b)
0150   {
0151     return a < b ? a : b;
0152   }
0153   static float min(float a, float b)
0154   {
0155     return a < b ? a : b;
0156   }
0157   static double min(double a, double b)
0158   {
0159     return a < b ? a : b;
0160   }
0161 
0162   static int ABS(int x)
0163   {
0164     return abs(x);
0165   }
0166   static float ABS(float x)
0167   {
0168     return fabsf(x);
0169   }
0170   static double ABS(double x)
0171   {
0172     return fabs(x);
0173   }
0174 
0175   static int lowint(float x)
0176   {
0177     return x < 0. ? int(x - 1) : int(x);
0178   }
0179 };
0180 
0181 // ///////////////////////////////////////////////////////////////////////////
0182 
0183 #endif