Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TreeMakerGetJets.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file TreeMakerGetJets.C
1 #include <TreeMaker.h>
2 
3 #include <phool/getClass.h>
5 
6 #include <TLorentzVector.h>
7 #include <g4jets/JetMap.h>
8 #include <g4jets/Jet.h>
10 
11 
12 
14 {
15 
16  // ------------------------------------------------------------------------------
17  // --- get truth jet information
18  // ------------------------------------------------------------------------------
19 
20  JetMap* truth2_jets = findNode::getClass<JetMap>(topNode,"AntiKt_Truth_r02");
21  //cout << "R = 0.2 truth jets has size " << truth2_jets->size() << endl;
22  for (JetMap::Iter iter = truth2_jets->begin(); iter != truth2_jets->end(); ++iter)
23  {
24  Jet* this_jet = iter->second;
25  float this_e = this_jet->get_e();
26  float this_pt = this_jet->get_pt();
27  float this_phi = this_jet->get_phi();
28  float this_eta = this_jet->get_eta();
29  if (this_jet->get_pt() < 5 || fabs(this_eta) > 5) continue;
30  b_truthjet2_e[ b_truthjet2_n ] = this_e;
31  b_truthjet2_pt[ b_truthjet2_n ] = this_pt;
32  b_truthjet2_eta[ b_truthjet2_n ] = this_eta;
33  b_truthjet2_phi[ b_truthjet2_n ] = this_phi;
34  //cout << " truth R=0.2 jet # " << b_truthjet2_n << " pt / eta / phi / m = " << this_pt << " / " << this_eta << " / " << this_phi << endl;
35  b_truthjet2_n++;
36  } // loop over R = 0.2 truth jets
37 
38  JetMap* truth3_jets = findNode::getClass<JetMap>(topNode,"AntiKt_Truth_r03");
39  //cout << "R = 0.3 truth jets has size " << truth3_jets->size() << endl;
40  for (JetMap::Iter iter = truth3_jets->begin(); iter != truth3_jets->end(); ++iter)
41  {
42  Jet* this_jet = iter->second;
43  float this_e = this_jet->get_e();
44  float this_pt = this_jet->get_pt();
45  float this_phi = this_jet->get_phi();
46  float this_eta = this_jet->get_eta();
47  if (this_jet->get_pt() < 5 || fabs(this_eta) > 5) continue;
48  b_truthjet3_e[ b_truthjet3_n ] = this_e;
49  b_truthjet3_pt[ b_truthjet3_n ] = this_pt;
50  b_truthjet3_eta[ b_truthjet3_n ] = this_eta;
51  b_truthjet3_phi[ b_truthjet3_n ] = this_phi;
52  //cout << " truth R=0.3 jet # " << b_truthjet3_n << " pt / eta / phi / m = " << this_pt << " / " << this_eta << " / " << this_phi << endl;
53  b_truthjet3_n++;
54  } // loop over R = 0.3 truth jets
55 
56  JetMap* truth4_jets = findNode::getClass<JetMap>(topNode,"AntiKt_Truth_r04");
57  //cout << "R = 0.4 truth jets has size " << truth4_jets->size() << endl;
58  for (JetMap::Iter iter = truth4_jets->begin(); iter != truth4_jets->end(); ++iter)
59  {
60  Jet* this_jet = iter->second;
61  float this_e = this_jet->get_e();
62  float this_pt = this_jet->get_pt();
63  float this_phi = this_jet->get_phi();
64  float this_eta = this_jet->get_eta();
65  if (this_jet->get_pt() < 5 || fabs(this_eta) > 5) continue;
66  b_truthjet4_e[ b_truthjet4_n ] = this_e;
67  b_truthjet4_pt[ b_truthjet4_n ] = this_pt;
68  b_truthjet4_eta[ b_truthjet4_n ] = this_eta;
69  b_truthjet4_phi[ b_truthjet4_n ] = this_phi;
70  //cout << " truth R=0.4 jet # " << b_truthjet4_n << " pt / eta / phi / m = " << this_pt << " / " << this_eta << " / " << this_phi << endl;
71  b_truthjet4_n++;
72  } // loop over R = 0.4 truth jets
73 
74  JetMap* truth5_jets = findNode::getClass<JetMap>(topNode,"AntiKt_Truth_r05");
75  //cout << "R = 0.5 truth jets has size " << truth5_jets->size() << endl;
76  for (JetMap::Iter iter = truth5_jets->begin(); iter != truth5_jets->end(); ++iter)
77  {
78  Jet* this_jet = iter->second;
79  float this_e = this_jet->get_e();
80  float this_pt = this_jet->get_pt();
81  float this_phi = this_jet->get_phi();
82  float this_eta = this_jet->get_eta();
83  if (this_jet->get_pt() < 5 || fabs(this_eta) > 5) continue;
84  b_truthjet5_e[ b_truthjet5_n ] = this_e;
85  b_truthjet5_pt[ b_truthjet5_n ] = this_pt;
86  b_truthjet5_eta[ b_truthjet5_n ] = this_eta;
87  b_truthjet5_phi[ b_truthjet5_n ] = this_phi;
88  //cout << " truth R=0.5 jet # " << b_truthjet5_n << " pt / eta / phi / m = " << this_pt << " / " << this_eta << " / " << this_phi << endl;
89  b_truthjet5_n++;
90  } // loop over R = 0.5 truth jets
91 
92  return 0;
93 
94 }
95 
96 
97 
99 {
100 
101  // ------------------------------------------------------------------------------
102  // --- get reconstructed jet information
103  // ------------------------------------------------------------------------------
104 
105  JetMap* nsreco2_jets = findNode::getClass<JetMap>(topNode,"AntiKt_Tower_r02");
106  //cout << "reco jets R=0.2 has size " << nsreco2_jets->size() << endl;
107  for (JetMap::Iter iter = nsreco2_jets->begin(); iter != nsreco2_jets->end(); ++iter)
108  {
109  Jet* this_jet = iter->second;
110  float this_e = this_jet->get_e();
111  float this_pt = this_jet->get_pt();
112  float this_phi = this_jet->get_phi();
113  float this_eta = this_jet->get_eta();
114  if (this_jet->get_pt() < 10 || fabs(this_eta) > 5) continue; // stricter pt cut for unsubtracted
115  b_jet2_e[ b_jet2_n ] = this_e;
116  b_jet2_pt[ b_jet2_n ] = this_pt;
117  b_jet2_eta[ b_jet2_n ] = this_eta;
118  b_jet2_phi[ b_jet2_n ] = this_phi;
119  //cout << " pp reco R=0.2 jet #" << b_jet2_n << ", pt / eta / phi = " << this_pt << " / " << this_eta << " / " << this_phi << endl;
120  b_jet2_n++;
121  } // loop over R=0.2 jets
122 
123  JetMap* nsreco3_jets = findNode::getClass<JetMap>(topNode,"AntiKt_Tower_r03");
124  //cout << "reco jets R=0.3 has size " << nsreco3_jets->size() << endl;
125  for (JetMap::Iter iter = nsreco3_jets->begin(); iter != nsreco3_jets->end(); ++iter)
126  {
127  Jet* this_jet = iter->second;
128  float this_e = this_jet->get_e();
129  float this_pt = this_jet->get_pt();
130  float this_phi = this_jet->get_phi();
131  float this_eta = this_jet->get_eta();
132  if (this_jet->get_pt() < 10 || fabs(this_eta) > 5) continue; // stricter pt cut for unsubtracted
133  b_jet3_e[ b_jet3_n ] = this_e;
134  b_jet3_pt[ b_jet3_n ] = this_pt;
135  b_jet3_eta[ b_jet3_n ] = this_eta;
136  b_jet3_phi[ b_jet3_n ] = this_phi;
137  //cout << " pp reco R=0.3 jet #" << b_jet3_n << ", pt / eta / phi = " << this_pt << " / " << this_eta << " / " << this_phi << endl;
138  b_jet3_n++;
139  } // loop over R=0.3 jets
140 
141  JetMap* nsreco4_jets = findNode::getClass<JetMap>(topNode,"AntiKt_Tower_r04");
142  //cout << "reco jets R=0.4 has size " << nsreco4_jets->size() << endl;
143  for (JetMap::Iter iter = nsreco4_jets->begin(); iter != nsreco4_jets->end(); ++iter)
144  {
145  Jet* this_jet = iter->second;
146  float this_e = this_jet->get_e();
147  float this_pt = this_jet->get_pt();
148  float this_phi = this_jet->get_phi();
149  float this_eta = this_jet->get_eta();
150  if (this_jet->get_pt() < 10 || fabs(this_eta) > 5) continue; // stricter pt cut for unsubtracted
151  b_jet4_e[ b_jet4_n ] = this_e;
152  b_jet4_pt[ b_jet4_n ] = this_pt;
153  b_jet4_eta[ b_jet4_n ] = this_eta;
154  b_jet4_phi[ b_jet4_n ] = this_phi;
155  //cout << " pp reco R=0.4 jet #" << b_jet4_n << ", pt / eta / phi = " << this_pt << " / " << this_eta << " / " << this_phi << endl;
156  b_jet4_n++;
157  } // loop over R=0.4 jets
158 
159  JetMap* nsreco5_jets = findNode::getClass<JetMap>(topNode,"AntiKt_Tower_r05");
160  //cout << "reco jets R=0.5 has size " << nsreco5_jets->size() << endl;
161  for (JetMap::Iter iter = nsreco5_jets->begin(); iter != nsreco5_jets->end(); ++iter)
162  {
163  Jet* this_jet = iter->second;
164  float this_e = this_jet->get_e();
165  float this_pt = this_jet->get_pt();
166  float this_phi = this_jet->get_phi();
167  float this_eta = this_jet->get_eta();
168  if (this_jet->get_pt() < 10 || fabs(this_eta) > 5) continue; // stricter pt cut for unsubtracted
169  b_jet5_e[ b_jet5_n ] = this_e;
170  b_jet5_pt[ b_jet5_n ] = this_pt;
171  b_jet5_eta[ b_jet5_n ] = this_eta;
172  b_jet5_phi[ b_jet5_n ] = this_phi;
173  //cout << " pp reco R=0.2 jet #" << b_jet5_n << ", pt / eta / phi = " << this_pt << " / " << this_eta << " / " << this_phi << endl;
174  b_jet5_n++;
175  } // loop over R=0.5 jets
176 
177 
178 
179  // ------------------------------------------------------------------------------
180  // --- get reconstructed jet information (modified)
181  // ------------------------------------------------------------------------------
182 
183  JetMap* modnsreco2_jets = findNode::getClass<JetMap>(topNode,"AntiKt_Tower_Mod_r02");
184  //cout << "reco jets R=0.2 has size " << modnsreco2_jets->size() << endl;
185  for (JetMap::Iter iter = modnsreco2_jets->begin(); iter != modnsreco2_jets->end(); ++iter)
186  {
187  Jet* this_jet = iter->second;
188  float this_e = this_jet->get_e();
189  float this_pt = this_jet->get_pt();
190  float this_phi = this_jet->get_phi();
191  float this_eta = this_jet->get_eta();
192  if (this_jet->get_pt() < 10 || fabs(this_eta) > 5) continue; // stricter pt cut for unsubtracted
193  b_modjet2_e[ b_modjet2_n ] = this_e;
194  b_modjet2_pt[ b_modjet2_n ] = this_pt;
195  b_modjet2_eta[ b_modjet2_n ] = this_eta;
196  b_modjet2_phi[ b_modjet2_n ] = this_phi;
197  //cout << " pp reco R=0.2 jet #" << b_jet2_n << ", pt / eta / phi = " << this_pt << " / " << this_eta << " / " << this_phi << endl;
198  b_modjet2_n++;
199  } // loop over R=0.2 jets
200 
201 
202 
203  return 0;
204 
205 }