Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TruthJetTagging.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file TruthJetTagging.h
1 // Tell emacs that this is a C++ source
2 // -*- C++ -*-.
3 #ifndef TRUTHJETTAGGING_H
4 #define TRUTHJETTAGGING_H
5 
6 #include <fun4all/SubsysReco.h>
7 #include <g4jets/Jet.h>
8 #include <g4jets/Jetv1.h>
10 
11 #pragma GCC diagnostic push
12 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
13 #include <HepMC/GenEvent.h>
14 #include <HepMC/GenVertex.h>
15 #pragma GCC diagnostic pop
18 #include <string>
19 #include <vector>
20 class PHCompositeNode;
21 
23 {
24  public:
25 
26  TruthJetTagging(const std::string &name = "TruthJetTagging");
27 
28  ~TruthJetTagging() override;
29 
35  int Init(PHCompositeNode *topNode) override;
36 
42  int InitRun(PHCompositeNode *topNode) override;
43 
47  int process_event(PHCompositeNode *topNode) override;
48 
50  int ResetEvent(PHCompositeNode *topNode) override;
51 
53  int EndRun(const int runnumber) override;
54 
56  int End(PHCompositeNode *topNode) override;
57 
59  int Reset(PHCompositeNode * /*topNode*/) override;
60 
61  void Print(const std::string &what = "ALL") const override;
62 
63 
64 
65  void add_algo(std::string algoname)
66  {
67  _algorithms.push_back(algoname);
68  }
69 
70  void add_radius(float radius)
71  {
72  _radii.push_back(radius);
73  }
74  void do_photon_tagging(bool dotag)
75  {
76  _do_photon_tagging = dotag;
77  }
78  void do_hf_tagging(bool dotag)
79  {
80  _do_hf_tagging = dotag;
81  }
82  void set_embedding_id(int id)
83  {
84  _embedding_id = id;
85  }
86 
87  float
88  deltaR(float eta1, float eta2, float phi1, float phi2)
89  {
90  float deta = eta1 - eta2;
91  float dphi = phi1 - phi2;
92  if (dphi > +3.14159)
93  dphi -= 2 * 3.14159;
94  if (dphi < -3.14159)
95  dphi += 2 * 3.14159;
96 
97  return sqrt(pow(deta, 2) + pow(dphi, 2));
98 
99  }
100 
101 
102 
103  float TruthPhotonTagging(PHG4TruthInfoContainer* truthnode, Jet* tjet);
104  int hadron_tagging(Jet* this_jet, HepMC::GenEvent* theEvent, const double match_radius);
105 
106 
107  private:
108 
109  std::vector<std::string> _algorithms;
110  std::vector<float> _radii;
114 
115 };
116 
117 #endif // TRUTHJETTAGGING_H