10 #include <calobase/RawCluster.h>
11 #include <calobase/RawClusterContainer.h>
12 #include <calobase/RawTower.h>
13 #include <calobase/RawTowerContainer.h>
38 : _jettrutheval(topNode, truthjetname)
39 , _recojetname(recojetname)
40 , _truthjetname(truthjetname)
51 std::cout <<
"JetRecoEval::~JetRecoEval() - Error Count: " <<
_errors << std::endl;
88 return std::set<PHG4Shower*>();
93 std::map<Jet*, std::set<PHG4Shower*> >::iterator iter =
101 std::set<PHG4Shower*> truth_showers;
108 unsigned int index = jter.second;
110 std::set<PHG4Shower*> new_showers;
116 std::cout <<
PHWHERE <<
"ERROR: can't find SvtxTrackMap" << std::endl;
132 std::cout <<
PHWHERE <<
"ERROR: can't find TOWER_CEMC" << std::endl;
154 std::cout <<
PHWHERE <<
"ERROR: can't find CLUSTER_CEMC" << std::endl;
176 std::cout <<
PHWHERE <<
"ERROR: can't find TOWER_EEMC" << std::endl;
198 std::cout <<
PHWHERE <<
"ERROR: can't find CLUSTER_EEMC" << std::endl;
220 std::cout <<
PHWHERE <<
"ERROR: can't find TOWER_HCALIN" << std::endl;
242 std::cout <<
PHWHERE <<
"ERROR: can't find CLUSTER_HCALIN" << std::endl;
264 std::cout <<
PHWHERE <<
"ERROR: can't find TOWER_HCALOUT" << std::endl;
286 std::cout <<
PHWHERE <<
"ERROR: can't find CLUSTER_HCALOUT" << std::endl;
308 std::cout <<
PHWHERE <<
"ERROR: can't find TOWER_FEMC" << std::endl;
330 std::cout <<
PHWHERE <<
"ERROR: can't find CLUSTER_FEMC" << std::endl;
352 std::cout <<
PHWHERE <<
"ERROR: can't find TOWER_FHCAL" << std::endl;
374 std::cout <<
PHWHERE <<
"ERROR: can't find CLUSTER_FHCAL" << std::endl;
393 for (
auto new_shower : new_showers)
395 truth_showers.insert(new_shower);
404 return truth_showers;
416 return std::set<PHG4Particle*>();
421 std::map<Jet*, std::set<PHG4Particle*> >::iterator iter =
429 std::set<PHG4Particle*> truth_particles;
436 unsigned int index = jter.second;
438 std::set<PHG4Particle*> new_particles;
444 std::cout <<
PHWHERE <<
"ERROR: can't find TrackMap" << std::endl;
466 std::cout <<
PHWHERE <<
"ERROR: can't find TOWER_CEMC" << std::endl;
488 std::cout <<
PHWHERE <<
"ERROR: can't find CLUSTER_CEMC" << std::endl;
510 std::cout <<
PHWHERE <<
"ERROR: can't find TOWER_EEMC" << std::endl;
532 std::cout <<
PHWHERE <<
"ERROR: can't find CLUSTER_EEMC" << std::endl;
554 std::cout <<
PHWHERE <<
"ERROR: can't find TOWER_HCALIN" << std::endl;
576 std::cout <<
PHWHERE <<
"ERROR: can't find CLUSTER_HCALIN" << std::endl;
598 std::cout <<
PHWHERE <<
"ERROR: can't find TOWER_HCALOUT" << std::endl;
620 std::cout <<
PHWHERE <<
"ERROR: can't find CLUSTER_HCALOUT" << std::endl;
642 std::cout <<
PHWHERE <<
"ERROR: can't find TOWER_FEMC" << std::endl;
664 std::cout <<
PHWHERE <<
"ERROR: can't find CLUSTER_FEMC" << std::endl;
686 std::cout <<
PHWHERE <<
"ERROR: can't find TOWER_FHCAL" << std::endl;
708 std::cout <<
PHWHERE <<
"ERROR: can't find CLUSTER_FHCAL" << std::endl;
727 for (
auto new_particle : new_particles)
729 truth_particles.insert(new_particle);
738 return truth_particles;
750 return std::set<Jet*>();
755 std::map<Jet*, std::set<Jet*> >::iterator iter =
763 std::set<Jet*> truth_jets;
787 truth_jets.insert(truth_jet);
812 std::map<Jet*, Jet*>::iterator iter =
820 Jet* truthjet =
nullptr;
821 float max_energy = FLT_MAX * -1.0;
824 for (
auto candidate : truthjets)
837 if (energy > max_energy)
839 truthjet = candidate;
861 return std::set<Jet*>();
866 std::map<Jet*, std::set<Jet*> >::iterator iter =
874 std::set<Jet*> recojets;
883 for (
auto truthcandidate : truthcandidates)
889 else if (!truthcandidate)
895 if (truthcandidate->get_id() == truthjet->
get_id())
897 recojets.insert(recojet);
925 std::map<Jet*, Jet*>::iterator iter =
933 Jet* bestrecojet =
nullptr;
934 float max_energy = FLT_MAX * -1.0;
937 for (
auto recojet : recojets)
950 if (energy > max_energy)
952 bestrecojet = recojet;
1038 else if (!recojet || !truthjet)
1046 std::map<std::pair<Jet*, Jet*>,
float>::iterator iter =
1050 return iter->second;
1054 float energy_contribution = 0.0;
1058 for (
auto truthparticle : truthjetcomp)
1064 else if (!truthparticle)
1073 unsigned int index = jter.second;
1093 if (maxtruthparticle ==
nullptr)
1098 else if (maxtruthparticle->
get_track_id() == truthparticle->get_track_id())
1100 energy = track->
get_p();
1296 energy_contribution +=
energy;
1305 return energy_contribution;
1323 std::map<std::pair<Jet*, Jet::SRC>,
float>::iterator iter =
1327 return iter->second;
1340 unsigned int index = jter->second;
1345 energy += track->
get_p();
1559 return std::set<PHG4Hit*>();
1564 std::map<Jet*, std::set<PHG4Hit*> >::iterator iter =
1568 return iter->second;
1572 std::set<PHG4Hit*> truth_hits;
1580 unsigned int index = jter.second;
1582 std::set<PHG4Hit*> new_hits;
1588 std::cout <<
PHWHERE <<
"ERROR: can't find SvtxTrackMap" << std::endl;
1610 std::cout <<
PHWHERE <<
"ERROR: can't find TOWER_CEMC" << std::endl;
1632 std::cout <<
PHWHERE <<
"ERROR: can't find CLUSTER_CEMC" << std::endl;
1654 std::cout <<
PHWHERE <<
"ERROR: can't find TOWER_EEMC" << std::endl;
1676 std::cout <<
PHWHERE <<
"ERROR: can't find CLUSTER_EEMC" << std::endl;
1698 std::cout <<
PHWHERE <<
"ERROR: can't find TOWER_HCALIN" << std::endl;
1720 std::cout <<
PHWHERE <<
"ERROR: can't find CLUSTER_HCALIN" << std::endl;
1742 std::cout <<
PHWHERE <<
"ERROR: can't find TOWER_HCALOUT" << std::endl;
1764 std::cout <<
PHWHERE <<
"ERROR: can't find CLUSTER_HCALOUT" << std::endl;
1786 std::cout <<
PHWHERE <<
"ERROR: can't find TOWER_FEMC" << std::endl;
1808 std::cout <<
PHWHERE <<
"ERROR: can't find CLUSTER_FEMC" << std::endl;
1830 std::cout <<
PHWHERE <<
"ERROR: can't find TOWER_FHCAL" << std::endl;
1852 std::cout <<
PHWHERE <<
"ERROR: can't find CLUSTER_FHCAL" << std::endl;
1871 for (
auto new_hit : new_hits)
1873 truth_hits.insert(new_hit);
1905 _trackmap = findNode::getClass<SvtxTrackMap>(topNode,
"TrackMap");
1907 _cemctowers = findNode::getClass<RawTowerContainer>(topNode,
"TOWER_CALIB_CEMC");
1908 _hcalintowers = findNode::getClass<RawTowerContainer>(topNode,
"TOWER_CALIB_HCALIN");
1909 _hcalouttowers = findNode::getClass<RawTowerContainer>(topNode,
"TOWER_CALIB_HCALOUT");
1910 _femctowers = findNode::getClass<RawTowerContainer>(topNode,
"TOWER_CALIB_FEMC");
1911 _fhcaltowers = findNode::getClass<RawTowerContainer>(topNode,
"TOWER_CALIB_FHCAL");
1912 _eemctowers = findNode::getClass<RawTowerContainer>(topNode,
"TOWER_CALIB_EEMC");
1913 _cemcclusters = findNode::getClass<RawClusterContainer>(topNode,
"CLUSTER_CEMC");
1914 _hcalinclusters = findNode::getClass<RawClusterContainer>(topNode,
"CLUSTER_HCALIN");
1915 _hcaloutclusters = findNode::getClass<RawClusterContainer>(topNode,
"CLUSTER_HCALOUT");
1916 _femcclusters = findNode::getClass<RawClusterContainer>(topNode,
"CLUSTER_FEMC");
1917 _fhcalclusters = findNode::getClass<RawClusterContainer>(topNode,
"CLUSTER_FHCAL");
1918 _eemcclusters = findNode::getClass<RawClusterContainer>(topNode,
"CLUSTER_EEMC");