2 #include "fastjet/AreaDefinition.hh"
3 #include "fastjet/ClusterSequenceArea.hh"
4 #include "fastjet/Selector.hh"
5 #include "fastjet/tools/BackgroundEstimatorBase.hh"
6 #include "fastjet/tools/JetMedianBackgroundEstimator.hh"
21 #include <fastjet/ClusterSequence.hh>
22 #include <fastjet/JetDefinition.hh>
23 #include <fastjet/PseudoJet.hh>
45 ,
const float min_lead_truth_pt
48 , m_outputfilename { _outputfilename }
66 std::cout <<
"JetRhoMedian::Init - Outoput to " <<
m_outputfilename << std::endl;
72 m_T =
new TTree(
"T",
"JetRhoMedian Tree");
105 std::cout <<
"JetRhoMedian::End - Output to " <<
m_outputfilename << std::endl;
115 std::cout <<
" Input Selections:" << std::endl;
126 GlobalVertexMap *mapVtx = findNode::getClass<GlobalVertexMap>(topNode,
"GlobalVertexMap");
130 CentralityInfo* cent_node = findNode::getClass<CentralityInfo>(topNode,
"CentralityInfo");
139 const double ghost_max_rap = 1.1;
140 const double ghost_R = 0.01;
141 const double max_jet_rap = 1.1;
156 <<
"MyJetAnalysis::process_event - Error can not find DST Truth JetMap node "
163 auto vjets = jetsMC->
vec();
167 std::cout <<
" NEW EVENT[" << (
outevent++) <<
"]" << std::endl;
168 std::cout <<
" --- Truth Jets [set(" <<
outevent <<
")]" << std::endl;
171 for (
auto& jet : vjets) {
172 float pt = jet->get_pt();
173 if (pt < 5.)
continue;
174 float eta = jet->get_eta();
175 if (eta < -max_jet_rap || eta > max_jet_rap)
continue;
177 std::cout << Form(
"k[%i] pt:phi:eta[%5.2f:%5.2f:%5.2f]", fixmek++, jet->get_pt(), jet->get_phi(), jet->get_eta()) << std::endl;
191 std::cout <<
" --- Sub1 Jets [set(" <<
outevent <<
")]" << std::endl;
195 if (jets_sub1 !=
nullptr) {
196 vjets = jets_sub1->
vec();
200 for (
auto& jet : jets_sub1->
vec()) {
202 float pt = jet->get_pt();
203 float eta = jet->get_eta();
204 if (eta < -max_jet_rap || eta > max_jet_rap)
continue;
205 if (pt < 5.)
continue;
206 if (
Verbosity()>100 &&
m_cent_mdb<10) std::cout << Form(
"k[%i] pt:phi:eta[%5.2f:%5.2f:%5.2f]", fixmek++, jet->get_pt(), jet->get_phi(), jet->get_eta()) << std::endl;
213 const int TOW_PRINT_INT = 8000;
216 std::vector<fastjet::PseudoJet> calo_pseudojets;
218 if (
Verbosity()>TOW_PRINT_INT) std::cout <<
" Input Tower Set("<<n_inputs++<<
"): ";
221 std::vector<Jet *>
particles = inp->get_input(topNode);
222 for (
unsigned int i = 0;
i < particles.size(); ++
i)
224 auto& part = particles[
i];
225 float this_e = part->get_e();
226 if (this_e == 0.)
continue;
227 float this_px = particles[
i]->get_px();
228 float this_py = particles[
i]->get_py();
229 float this_pz = particles[
i]->get_pz();
233 float e_ratio = 0.001 / this_e;
234 this_e = this_e * e_ratio;
235 this_px = this_px * e_ratio;
236 this_py = this_py * e_ratio;
237 this_pz = this_pz * e_ratio;
239 fastjet::PseudoJet pseudojet(this_px, this_py, this_pz, this_e);
241 calo_pseudojets .push_back(pseudojet);
243 sum_pt += pseudojet.perp();
247 if (
Verbosity()>TOW_PRINT_INT) std::cout <<
" sumpt(" << sum_pt <<
") from ntowers("<<
n_towers <<
")" << std::endl;
248 for (
auto &
p : particles)
delete p;
253 fastjet::Selector not_pure_ghost = !fastjet::SelectorIsPureGhost();
255 fastjet::Selector selection = jetrap && not_pure_ghost;
256 fastjet::AreaDefinition area_def(
257 fastjet::active_area_explicit_ghosts, fastjet::GhostedAreaSpec(ghost_max_rap, 1, ghost_R));
265 fastjet::JetMedianBackgroundEstimator bge_rm2 {selector_rm2, jet_def_bkgd, area_def};
266 bge_rm2.set_particles(calo_pseudojets);
268 m_rho = bge_rm2.rho();
277 fastjet::ClusterSequenceArea clustSeq(calo_pseudojets, jet_def_antikt, area_def);
278 std::vector<fastjet::PseudoJet> jets
279 =
sorted_by_pt( selection( clustSeq.inclusive_jets(5.) ));
283 std::cout <<
" --- rhoA jets [set("<<
outevent<<
")]" << std::endl;
284 for (
auto jet : jets) {
285 if (jet.perp()-
m_rho*jet.area() > 5.) {
286 auto phi = jet.phi();
287 while (
phi > M_PI)
phi -= 2*M_PI;
288 std::cout << Form(
"k[%i] pt:phi:eta[%5.2f:%5.2f:%5.2f]", fixmek++, (jet.perp()-
m_rho*jet.area()),
phi, jet.eta()) << std::endl;
293 for (
auto jet : jets) {
298 if (
p.is_pure_ghost())
continue;
299 std::cout << Form(
" %3i|%4.2f",i++,
p.perp());
300 if (i%7==0) std::cout << std::endl;
302 std::cout << std::endl;