26 #include <TLorentzVector.h>
29 #include <TDatabasePDG.h>
44 SubsysReco(
"SoftLeptonTaggingTruth_" + truth_jet),
46 _truth_jet(truth_jet), _reco_jets(), _truth_container(NULL), _flags(flags),
48 _jet_match_dR(.7), _jet_match_dca(.2), _jet_match_E_Ratio(.0)
64 cout <<
"SoftLeptonTaggingTruth::InitRun - Fatal Error - "
65 <<
"unable to find DST node " <<
"G4TruthInfo" << endl;
76 _jettrutheval->set_strict(
true);
77 _jettrutheval->set_verbosity(
verbosity + 1);
100 cout <<
"SoftLeptonTaggingTruth::Init - Process TruthSpectrum "
113 cout <<
"SoftLeptonTaggingTruth::process_event() entered" << endl;
115 for (jetevalstacks_map::iterator it_jetevalstack =
_jetevalstacks.begin();
118 assert(it_jetevalstack->second);
119 it_jetevalstack->second->next_event(topNode);
127 cout <<
"SoftLeptonTaggingTruth::process_event - Process TruthSpectrum "
174 if (src_jet_name.length() > 0)
176 histo_prefix += src_jet_name;
179 if (reco_jet_name.length() > 0)
181 histo_prefix += reco_jet_name;
197 const int norm_size = 3;
199 TH1D * h_norm =
new TH1D(
201 " Normalization;Item;Count", norm_size, .5, norm_size + .5);
204 h_norm->GetXaxis()->SetBinLabel(i++,
"Event");
205 h_norm->GetXaxis()->SetBinLabel(i++,
"Inclusive Jets");
206 h_norm->GetXaxis()->SetBinLabel(i++,
"Leading Jets");
207 assert(norm_size >= i - 1);
208 h_norm->GetXaxis()->LabelsOption(
"v");
216 +
";E_{T} (GeV)", 100, 0, 100));
222 +
";#eta", 50, -1, 1));
228 +
";#phi", 50, -M_PI, M_PI));
230 TH1F * lcomp =
new TH1F(
234 +
";Number of component;", 100, 1, 3000);
243 +
";Jet Mass (GeV);", 100, 0, 20));
249 +
";Energy ratio CEMC/Total;", 100, 0, 1.01));
254 TString(jet_name) +
" leading jet EMCal+HCal_{IN} ratio, "
264 TString(jet_name) +
" leading jet leakage ratio, "
272 +
";Total jet energy (GeV)", 100, 1
e-3, 100);
280 +
";#eta;Jet energy density", 50, -1, 1));
286 +
";#phi;Jet energy density", 50, -M_PI, M_PI));
294 +
";j_{T} (GeV/c);Particle Selection", 100, 0, 10, 4, 0.5, 4.5);
296 h2->GetYaxis()->SetBinLabel(i++,
"Electron");
297 h2->GetYaxis()->SetBinLabel(i++,
"Muon");
298 h2->GetYaxis()->SetBinLabel(i++,
"Other Charged");
299 h2->GetYaxis()->SetBinLabel(i++,
"Other Neutral");
306 +
";DCA_{2D} (cm);Particle Selection", 200, -.2, .2, 4, 0.5, 4.5);
308 h2->GetYaxis()->SetBinLabel(i++,
"Electron");
309 h2->GetYaxis()->SetBinLabel(i++,
"Muon");
310 h2->GetYaxis()->SetBinLabel(i++,
"Other Charged");
311 h2->GetYaxis()->SetBinLabel(i++,
"Other Neutral");
318 +
";|P_{part.}|c/E_{Jet};Particle Selection", 120, 0, 1.2, 4, 0.5,
321 h2->GetYaxis()->SetBinLabel(i++,
"Electron");
322 h2->GetYaxis()->SetBinLabel(i++,
"Muon");
323 h2->GetYaxis()->SetBinLabel(i++,
"Other Charged");
324 h2->GetYaxis()->SetBinLabel(i++,
"Other Neutral");
331 +
";#DeltaR;Particle Selection", 100, 0, 1, 4, 0.5, 4.5);
333 h2->GetYaxis()->SetBinLabel(i++,
"Electron");
334 h2->GetYaxis()->SetBinLabel(i++,
"Muon");
335 h2->GetYaxis()->SetBinLabel(i++,
"Other Charged");
336 h2->GetYaxis()->SetBinLabel(i++,
"Other Neutral");
344 const std::string & jet_name,
const bool is_reco_jet)
346 JetMap* jets = findNode::getClass<JetMap>(topNode, jet_name.c_str());
350 <<
"SoftLeptonTaggingTruth::process_Spectrum - Error can not find DST JetMap node "
358 TH1D* h_norm =
dynamic_cast<TH1D*
>(hm->
getHisto(
361 h_norm->Fill(
"Event", 1);
362 h_norm->Fill(
"Inclusive Jets", jets->
size());
364 TH1F * ie =
dynamic_cast<TH1F*
>(hm->
getHisto(
368 TH1F * ieta =
dynamic_cast<TH1F*
>(hm->
getHisto(
372 TH1F * iphi =
dynamic_cast<TH1F*
>(hm->
getHisto(
377 Jet* leading_jet = NULL;
381 Jet* jet = iter->second;
387 if (jet->
get_et() > max_et)
393 ie->Fill(jet->
get_e());
403 <<
"SoftLeptonTaggingTruth::process_Spectrum - processing leading jet with # comp = "
408 h_norm->Fill(
"Leading Jets", 1);
410 TH1F * let =
dynamic_cast<TH1F*
>(hm->
getHisto(
414 TH1F * leta =
dynamic_cast<TH1F*
>(hm->
getHisto(
418 TH1F * lphi =
dynamic_cast<TH1F*
>(hm->
getHisto(
423 TH1F * lcomp =
dynamic_cast<TH1F*
>(hm->
getHisto(
427 TH1F * lmass =
dynamic_cast<TH1F*
>(hm->
getHisto(
431 TH1F * lcemcr =
dynamic_cast<TH1F*
>(hm->
getHisto(
435 TH1F * lemchcalr =
dynamic_cast<TH1F*
>(hm->
getHisto(
439 TH1F * lleak =
dynamic_cast<TH1F*
>(hm->
getHisto(
444 let->Fill(leading_jet->
get_et());
445 leta->Fill(leading_jet->
get_eta());
446 lphi->Fill(leading_jet->
get_phi());
448 lmass->Fill(leading_jet->
get_mass());
452 jetevalstacks_map::iterator it_stack =
_jetevalstacks.find(jet_name);
454 shared_ptr<JetEvalStack> eval_stack = it_stack->second;
456 JetRecoEval* recoeval = eval_stack->get_reco_eval();
464 ) / leading_jet->
get_e());
476 ) / leading_jet->
get_e());
491 for (set<PHG4Shower*>::const_iterator
it = showers.begin();
492 it != showers.end(); ++
it)
494 cemc_e += (*it)->get_edep(
496 cemc_e += (*it)->get_edep(
498 cemc_e += (*it)->get_edep(
501 hcalin_e += (*it)->get_edep(
503 hcalin_e += (*it)->get_edep(
507 bh_e += (*it)->get_edep(
509 bh_e += (*it)->get_edep(
513 lcemcr->Fill(cemc_e / leading_jet->
get_e());
514 lemchcalr->Fill((cemc_e + hcalin_e) / leading_jet->
get_e());
515 lleak->Fill(bh_e / leading_jet->
get_e());
519 TH2F * lptrel =
dynamic_cast<TH2F*
>(hm->
getHisto(
523 TH2F * ldca2d =
dynamic_cast<TH2F*
>(hm->
getHisto(
527 TH2F * lpoe =
dynamic_cast<TH2F*
>(hm->
getHisto(
531 TH2F * ldr =
dynamic_cast<TH2F*
>(hm->
getHisto(
537 TVector3 j_v(leading_jet->
get_px(), leading_jet->
get_py(),
543 primary_range.first; particle_iter != primary_range.second;
555 TVector3 v_v(primary_vtx->
get_x(), primary_vtx->
get_y(),
556 primary_vtx->
get_z());
558 const double dR = sqrt(
559 (p_v.Eta() - j_v.Eta()) * (p_v.Eta() - j_v.Eta())
560 + (p_v.Phi() - j_v.Phi()) * (p_v.Phi() - j_v.Phi()));
561 const double E_Ratio = p_v.Mag() / leading_jet->
get_e();
563 const double charge3 = TDatabasePDG::Instance()->GetParticle(
564 particle->
get_pid())->Charge();
565 TVector3 dca_v(cos(p_v.Phi() + TMath::Pi() / 2),
566 sin(p_v.Phi() + TMath::Pi() / 2), 0);
567 const double dca2d = v_v.Dot(dca_v) *
copysign(1, charge3);
579 == TDatabasePDG::Instance()->GetParticle(
"e-")->PdgCode())
580 histo_pid = ldr->GetYaxis()->FindBin(
"Electron");
581 else if (abs(particle->
get_pid())
582 == TDatabasePDG::Instance()->GetParticle(
"mu-")->PdgCode())
583 histo_pid = ldr->GetYaxis()->FindBin(
"Muon");
584 else if (charge3 != 0)
585 histo_pid = ldr->GetYaxis()->FindBin(
"Other Charged");
587 histo_pid = ldr->GetYaxis()->FindBin(
"Other Neutral");
593 <<
"SoftLeptonTaggingTruth::process_Spectrum - particle hist ID "
594 << histo_pid <<
", charge x 3 = " << charge3 <<
", dR = "
595 << dR <<
", E_Ratio = " << E_Ratio <<
"/"
600 const double pT_rel = p_v.Dot(j_v) / j_v.Mag();
602 ldr->Fill(dR, histo_pid);
603 lpoe->Fill(E_Ratio, histo_pid);
604 lptrel->Fill(pT_rel, histo_pid);
605 ldca2d->Fill(dca2d, histo_pid);
640 assert(axis->GetXmin()>0);
641 assert( axis->GetXmax()>0);
643 const int bins = axis->GetNbins();
645 Axis_t from = log10(axis->GetXmin());
646 Axis_t to = log10(axis->GetXmax());
647 Axis_t
width = (to - from) / bins;
648 vector<Axis_t> new_bins(bins + 1);
650 for (
int i = 0;
i <=
bins;
i++)
652 new_bins[
i] = TMath::Power(10, from +
i * width);
654 axis->Set(bins, new_bins.data());