Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-12-19 09:15:56

0001 #ifndef STREAK_ANALYZER_H
0002 #define STREAK_ANALYZER_H
0003 
0004 #include <phool/PHCompositeNode.h>
0005 #include <phool/getClass.h>
0006 
0007 #include <TMath.h>
0008 #include <string>
0009 #include <vector>
0010 #include <cmath>
0011 
0012 namespace streak {
0013 
0014 struct Config {
0015   // Node name
0016   std::string photon_node = "PHOTONCLUSTER_CEMC";
0017   std::vector<std::string> jet_nodes = {
0018   
0019    "AntiKt_unsubtracted_r04",
0020   };
0021 
0022   //The Streak event selection cuts
0023 
0024   // Cluster cuts
0025   float et_min   = 10.0f;  // GeV
0026   float weta_min = 0.7f;
0027 
0028   // Dijet veto
0029   bool  apply_dijet_veto      = true;
0030   float jet_pt_min            = 10.0f;        // GeV
0031   float back_to_back_min_dphi = TMath::Pi()/2; // rad
0032 
0033   bool  verbose = false;
0034 };
0035 
0036 class StreakAnalyzer {
0037 public:
0038   explicit StreakAnalyzer(const Config& cfg = Config()) : m_cfg(cfg) {}
0039   bool isStreakEvent(PHCompositeNode* topNode, std::string* why = nullptr) const;
0040 
0041 private:
0042   Config m_cfg;
0043 
0044   // Helper to calculate  dphi value
0045   static inline float dphi_abs(float a, float b) {
0046     float d = a - b;
0047     while (d >  TMath::Pi()) d -= 2.f*TMath::Pi();
0048     while (d <= -TMath::Pi()) d += 2.f*TMath::Pi();
0049     return std::fabs(d);
0050   }
0051 
0052   // Cluster and dijets streak tag
0053   bool pass_cluster_selection(PHCompositeNode* topNode, std::string* why) const;
0054   bool pass_dijet_veto(PHCompositeNode* topNode, std::string* why) const;
0055 };
0056 
0057 // -----------------------------------------------------------
0058 //This the main function users will call to check if event is streak event
0059 // -----------------------------------------------------------
0060 inline bool isStreakEvent(PHCompositeNode* topNode, const Config& cfg = Config(), std::string* why = nullptr) {
0061   return StreakAnalyzer(cfg).isStreakEvent(topNode, why);
0062 }
0063 
0064 } // namespace streak
0065 
0066 #endif