File indexing completed on 2025-08-06 08:14:20
0001
0002
0003 #ifndef RANDOMCONETREE_H
0004 #define RANDOMCONETREE_H
0005
0006 #include <fun4all/SubsysReco.h>
0007
0008 #include <memory>
0009 #include <string>
0010 #include <utility> // std::pair, std::make_pair
0011 #include <vector>
0012 #include <array>
0013
0014 class PHCompositeNode;
0015
0016 class TTree;
0017
0018 class RandomConeTree : public SubsysReco
0019 {
0020 public:
0021
0022
0023 RandomConeTree(const std::string &outputfilename = "conetree.root");
0024 ~RandomConeTree() override;
0025
0026
0027
0028 int Init(PHCompositeNode *topNode) override;
0029 int process_event(PHCompositeNode *topNode) override;
0030 int End(PHCompositeNode *topNode) override;
0031 int ResetEvent(PHCompositeNode *topNode) override;
0032
0033
0034
0035 void add_rho_node(const std::string &name)
0036 {
0037 m_rho_nodes.push_back(name);
0038 }
0039
0040
0041 void add_random_cone_node(const std::string &name)
0042 {
0043 m_random_cone_nodes.push_back(name);
0044 }
0045
0046
0047 void add_gvtx_cut(const double low, const double high)
0048 {
0049 m_do_gvtx_cut = true;
0050 m_gvtx_cut.first = low;
0051 m_gvtx_cut.second = high;
0052 }
0053
0054
0055 void do_centrality_info(bool b = true) { m_do_cent_info = b; }
0056
0057
0058
0059 void do_data(bool b = true)
0060 {
0061
0062 m_do_data = b;
0063
0064
0065 m_MC_do_event_selection = false;
0066
0067
0068 m_MC_add_weight_to_ttree = false;
0069 }
0070
0071
0072
0073
0074
0075 void do_event_selection_on_leading_truth_jet(float low, float high)
0076 {
0077 m_MC_do_event_selection = true;
0078 m_MC_event_selection_jetpT_range.first = low;
0079 m_MC_event_selection_jetpT_range.second = high;
0080 }
0081
0082
0083 void add_weight_to_ttree(double w)
0084 {
0085 m_MC_add_weight_to_ttree = true;
0086 m_MC_event_weight = w;
0087 }
0088
0089
0090
0091
0092
0093 private:
0094
0095
0096
0097 std::string m_outputfile_name{"conetree.root"};
0098
0099 std::vector<std::string> m_rho_nodes{};
0100 std::vector<std::string> m_random_cone_nodes{};
0101
0102
0103 bool m_do_gvtx_cut{false};
0104 std::pair<double, double> m_gvtx_cut{-100, 100};
0105
0106
0107 bool m_do_cent_info{false};
0108 void GetCentInfo(PHCompositeNode *topNode);
0109
0110
0111 bool m_MC_do_event_selection{false};
0112 std::pair<float, float> m_MC_event_selection_jetpT_range{-1,1000};
0113
0114
0115 bool m_MC_add_weight_to_ttree{false};
0116 double m_MC_event_weight{1.0};
0117
0118
0119 bool m_do_data{false};
0120
0121 bool GoodEvent(PHCompositeNode *topNode);
0122
0123
0124
0125 TTree * m_run_info_tree{nullptr};
0126 TTree * m_event_tree{nullptr};
0127
0128 int m_event_id{-1};
0129
0130 int m_centrality;
0131 float m_impactparam;
0132 float m_zvtx;
0133 double m_mbd_NS;
0134
0135 std::array<float, 10> m_rhos{{0,0,0,0,0,0,0,0,0,0}};
0136 std::array<float, 10> m_sigma_rhos{{0,0,0,0,0,0,0,0,0,0}};
0137
0138 std::array<float, 10> m_cone_R{{0,0,0,0,0,0,0,0,0,0}};
0139 std::array<float, 10> m_cone_etas{{0,0,0,0,0,0,0,0,0,0}};
0140 std::array<float, 10> m_cone_phis{{0,0,0,0,0,0,0,0,0,0}};
0141 std::array<float, 10> m_cone_pts{{0,0,0,0,0,0,0,0,0,0}};
0142 std::array<int, 10> m_cone_nclustereds{{0,0,0,0,0,0,0,0,0,0}};
0143
0144
0145 };
0146
0147 #endif