Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RandomConeAna.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file RandomConeAna.h
1 // Tell emacs that this is a C++ source
2 // -*- C++ -*-.
3 #ifndef RANDOMCONEANA_H
4 #define RANDOMCONEANA_H
5 
6 #include <fun4all/SubsysReco.h>
7 
8 #include <jetbase/Jetv1.h>
9 
10 #include <fastjet/PseudoJet.hh>
11 
12 #include <memory>
13 #include <string>
14 #include <utility> // std::pair, std::make_pair
15 #include <vector>
16 
17 #include <TRandom3.h> // for seed
18 
19 class PHCompositeNode;
20 
21 class TTree;
22 class TRandom3;
23 
24 class JetInput;
25 
26 class RandomConeAna : public SubsysReco
27 {
28 public:
29 
30 
31  // constructor
32  RandomConeAna(const std::string &outputfilename = "jettree.root");
33  ~RandomConeAna() override; // destructor
34 
35  void setEventSelection(double low, double high){
36  _doEventSelection = true;
37  m_eventSelection.first = low;
38  m_eventSelection.second = high;
39  }
40 
41  void addWeight(double w) {
42  _doWeight = true;
43  weight = w;
44  }
45 
46  void add_input(JetInput *input) { _inputs.push_back(input); }
47 
48  void add_iter_input(JetInput *input) { _iter_inputs.push_back(input); }
49 
50  void set_user_seed(const unsigned int seed) {
51  m_seed = seed;
52  m_user_set_seed = true;
53  }
54 
55 
56  // Standard Fun4All functions
57  int Init(PHCompositeNode *topNode) override;
58  int process_event(PHCompositeNode *topNode) override;
59  int End(PHCompositeNode *topNode) override;
60 
61 private:
62 
63  // event trigger (for simulation)
64  float LeadingR04TruthJet(PHCompositeNode *topNode);
65  bool EventSelect(PHCompositeNode *topNode);
66 
67  // cent info
68  void GetCentInfo(PHCompositeNode *topNode);
69 
70  std::pair<float,float> get_leading_jet_eta_phi(PHCompositeNode *topNode);
71  std::vector<fastjet::PseudoJet> jets_to_pseudojets(std::vector<Jet*>& particles, bool randomize_etaphi);
72 
73  std::vector<fastjet::PseudoJet> get_psuedojets(PHCompositeNode *topNode);
74  void EstimateRhos(PHCompositeNode *topNode);
75  float _percentile(const std::vector<float> & sorted_vec,
76  const float percentile,
77  const float nempty) const ;
78  void _median_stddev(const std::vector<float> & vec,
79  float n_empty_jets,
80  float & median,
81  float & std_dev) const ;
82 
83 
84  // output tree
87  std::pair<double, double> m_eventSelection;
88 
89  bool _doWeight;
91 
93  unsigned int m_seed;
94 
95  std::vector<JetInput *> _inputs;
96  std::vector<JetInput *> _iter_inputs;
97 
98  TRandom3* m_random { nullptr };
99 
100 
101  //____________________________________________________________________________..
102  // output tree
103  TTree *m_tree;
104 
105  int m_event;
106  double weight;
108 
109  float m_rho_area;
111  float m_rho_mult;
113 
114  float m_cone_area;
116 
119 
122 
125 
126 };
127 
128 #endif // RANDOMCONEANA_H