Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 /*!
0002  * \file DetermineEventRho.h
0003  * \brief UE background rho calculator.
0004  * \author Tanner Mengel <tmengel@bnl.gov>
0005  * \version $Verison: 2.0.1 $
0006  * \date $Date: 02/01/2024. Revised 09/19/2024$
0007  */
0008 
0009 #ifndef JETBACKGROUND_DETERMINEEVENTRHO_H
0010 #define JETBACKGROUND_DETERMINEEVENTRHO_H
0011 
0012 #include "EventRho.h"
0013 
0014 #include <fun4all/SubsysReco.h>
0015 
0016 #include <iostream>
0017 #include <string>
0018 #include <vector>
0019 
0020 class PHCompositeNode;
0021 class JetInput;
0022 class Jet;
0023 
0024 namespace fastjet
0025 {
0026   class PseudoJet;
0027   class Selector;
0028 }  // namespace fastjet
0029 
0030 class DetermineEventRho : public SubsysReco
0031 {
0032  public:
0033   DetermineEventRho(const std::string &name = "DetermineEventRho");
0034   ~DetermineEventRho() override;
0035 
0036   // standard Fun4All methods
0037   int InitRun(PHCompositeNode *topNode) override;
0038   int process_event(PHCompositeNode *topNode) override;
0039 
0040   // add rho method (Area or Multiplicity)
0041   void add_method(EventRho::Method rho_method, std::string output_node = "");
0042 
0043   // inputs for estimating background
0044   void add_input(JetInput *input) { m_inputs.push_back(input); }
0045   void add_tower_input(JetInput *input) { add_input(input); }  // for backwards compatibility
0046 
0047   // set the jet algorithm used to cluster background jets
0048   // default is KT
0049   void set_algo(const Jet::ALGO algo) { m_bkgd_jet_algo = algo; }
0050   Jet::ALGO get_algo() const { return m_bkgd_jet_algo; }
0051 
0052   // set the jet algorithm parameter for background jets
0053   // default is 0.4
0054   void set_par(const float val) { m_par = val; }
0055   float get_par() { return m_par; }
0056 
0057   // set the absolute eta range for tower acceptance
0058   // default is 1.1
0059   void set_abs_eta(const float val) { m_abs_input_eta_range = val; }
0060   float get_abs_eta() const { return m_abs_input_eta_range; }
0061 
0062   void set_tower_abs_eta(const float val) { set_abs_eta(val); }  // for backwards compatibility
0063   float get_tower_abs_eta() const { return get_abs_eta(); }      // for backwards compatibility
0064 
0065   // set the absolute eta range for jet acceptance
0066   // default is 1.1
0067   void set_jet_abs_eta(float abseta) { m_abs_jet_eta_range = abseta; }
0068   float get_jet_abs_eta() const { return m_abs_jet_eta_range; }
0069 
0070   // set the number of hardest towers to omit
0071   // default is 2
0072   void set_omit_nhardest(const unsigned int val) { m_omit_nhardest = val; }
0073   unsigned int get_omit_nhardest() const { return m_omit_nhardest; }
0074 
0075   // set the ghost area
0076   // default is 0.01
0077   void set_ghost_area(const float val) { m_ghost_area = val; }
0078   float get_ghost_area() const { return m_ghost_area; }
0079 
0080   // set the minimum pT for jets accepted in the background estimation
0081   // default is off (VOID_CUT)
0082   void set_jet_min_pT(const float val) { m_jet_min_pT = val; }
0083   float get_jet_min_pT() const { return m_jet_min_pT; }
0084 
0085   // print settings
0086   void print_settings(std::ostream &os = std::cout);
0087 
0088  private:
0089   // variables
0090   std::vector<JetInput *> m_inputs{};
0091   std::vector<std::string> m_output_nodes{};
0092   std::vector<EventRho::Method> m_rho_methods{};
0093 
0094   Jet::ALGO m_bkgd_jet_algo{Jet::ALGO::KT};  // default is KT
0095   float m_par{0.4};                          // default is 0.4
0096 
0097   float m_abs_input_eta_range{1.1};  // default is 1.1
0098   unsigned int m_omit_nhardest{2};   // default is 2
0099   float m_ghost_area{0.01};          // default is 0.01
0100 
0101   const float VOID_CUT{-999.0};
0102   float m_jet_min_pT{-999.0};         // default is off
0103   float m_abs_jet_eta_range{-999.0};  // default is off
0104 
0105   // internal methods
0106   int CreateNodes(PHCompositeNode *topNode);
0107 
0108   static float CalcPercentile(const std::vector<float> &sorted_vec,
0109                               const float percentile, const float nempty);
0110 
0111   static void CalcMedianStd(const std::vector<float> &vec,
0112                             float n_empty_jets, float &median, float &std_dev);
0113 
0114   fastjet::Selector get_jet_selector() const;
0115 };
0116 
0117 #endif  // JETBACKGROUND_DETERMINEEVENTRHO_H