Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:16:28

0001 // This file is really -*- C++ -*-.
0002 #ifndef CLUSTERISO_CLUSTERISO_H
0003 #define CLUSTERISO_CLUSTERISO_H
0004 
0005 #include <fun4all/SubsysReco.h>
0006 
0007 #include <CLHEP/Vector/ThreeVector.h>
0008 
0009 #include <cmath>
0010 #include <string>
0011 
0012 class PHCompositeNode;
0013 class RawTowerGeom;
0014 class TowerInfo;
0015 
0016 /** \Brief Tool to find isolation energy of each EMCal cluster.
0017  *
0018  * This tool finds isoET of clusters by summing towers energy
0019  * in a cone of radius R around the cluster and subtracting
0020  * the cluster from the sum
0021  */
0022 
0023 class ClusterIso : public SubsysReco
0024 {
0025  public:
0026   /**
0027    * Constructor for ClusterIso Class
0028    * the coneSize is taken in as an integer multiple of .1 ie if you want R=.2 pass 2
0029    */
0030   ClusterIso(const std::string&, float eTCut, int coneSize, bool do_subtracted, bool do_unsubtracted);
0031 
0032   int Init(PHCompositeNode*) override;
0033   int process_event(PHCompositeNode*) override;
0034   int End(PHCompositeNode*) override;
0035 
0036   void seteTCut(float x);
0037   void setConeSize(int x);
0038   /*const*/ float geteTCut();
0039   //! returns coneSize*10 as an int
0040   /*const*/ int getConeSize();
0041   /*const*/ CLHEP::Hep3Vector getVertex();
0042   void set_use_towerinfo(bool usetowerinfo)
0043   {
0044     m_use_towerinfo = usetowerinfo;
0045   };
0046 
0047   void set_cluster_node_name(const std::string& name)
0048   {
0049     m_cluster_node_name = name;
0050   }
0051 
0052  private:
0053   double getTowerEta(RawTowerGeom* tower_geom, double vx, double vy, double vz);
0054   bool IsAcceptableTower(TowerInfo* tower);
0055   float m_eTCut{};     ///< The minimum required transverse energy in a cluster for ClusterIso to be run
0056   float m_coneSize{};  ///< Size of the cone used to isolate a given cluster
0057   float m_vx;          ///< Correct vertex x coordinate
0058   float m_vy;          ///< Correct vertex y coordinate
0059   float m_vz;          ///< Correct vertex z coordinate
0060   bool m_do_subtracted;
0061   bool m_do_unsubtracted;
0062   bool m_use_towerinfo = true;
0063   std::string m_cluster_node_name = "CLUSTERINFO_CEMC";
0064 };
0065 
0066 /** \Brief Function to find delta R between 2 objects
0067  *
0068  * Takes the eta and phi of each object and returns the difference
0069  * of the etas and phis added in quadrature. Used to find towers
0070  * inside a cone of delta R around a cluster.
0071  */
0072 inline /*const*/ float deltaR(float eta1, float eta2, float phi1, float phi2)
0073 {
0074   float deta = eta1 - eta2;
0075   float dphi = phi1 - phi2;
0076   if (dphi > M_PI) dphi -= 2 * M_PI;       // corrects to keep range -pi to pi
0077   if (dphi < -1 * M_PI) dphi += 2 * M_PI;  // corrects to keep range -pi to pi
0078   return sqrt(deta * deta + dphi * dphi);
0079 }
0080 
0081 #endif