11 using fastjet::PseudoJet;
22 struct ConstitPtComp {
24 return ptAcc(*
j1) > ptAcc(*
j2) ;
39 if (
j1->numConstituents() !=
j2->numConstituents() )
return 1;
40 if (
j1->numConstituents() == 0 )
return 2;
42 for(
size_t i=0;
i<
j1->numConstituents();
i++){
43 if(!hasConstituent(
j2,
j1->rawConstituent(
i)))
return 100+
i;
48 if (
j1->rawConstituent(0) ==
j2->rawConstituent(0))
return 0;
58 :
asg::AsgTool(
name), m_hpjr(
"",this) {
67 if ( !
m_hpjr.retrieve().isSuccess() ) {
69 return StatusCode::FAILURE;
71 return StatusCode::SUCCESS;
79 if ( !
m_hpjr.retrieve().isSuccess() ) {
86 if ( !
evtStore()->contains<PseudoJetMap>(pjmapname) ) {
104 std::list<const Jet*> sortedTarget(dstjets.begin(), dstjets.end());
105 sortedTarget.sort(ConstitPtComp());
106 std::list<const Jet*> sortedSource(srcjets.begin(), srcjets.end());
107 sortedSource.sort(ConstitPtComp());
109 size_t sourceIndex=0;
111 for (
auto sourceIt = sortedSource.begin(); sourceIt!=sortedSource.end(); ++sourceIt ) {
112 const Jet* pjetin = *sourceIt;
113 if ( pjetin ==
nullptr ) {
117 ATH_MSG_DEBUG(
" Checking jet " << sourceIndex <<
" pt=" << ptAcc(*pjetin) );
120 sortedTarget.remove_if([](
const Jet * pJetOut){
return pJetOut ==
nullptr;});
122 for (
auto targetIt=sortedTarget.begin(); targetIt!=sortedTarget.end(); ++targetIt ) {
123 const Jet* pjetout = *targetIt;
124 int jetdiff = differentJets(pjetin, pjetout);
125 bool isSame = jetdiff == 0;
126 ATH_MSG_DEBUG(
" vs pt="<<ptAcc(*pjetout) <<
" jetdiff= " << jetdiff );
128 ATH_MSG_DEBUG(
" -------> identical to pt="<< ptAcc(*pjetout));
129 const PseudoJet* ppj =
m_hpjr->pseudojet(*pjetin);
130 ATH_MSG_VERBOSE(
"Recording pseudojet " <<
long(ppj) <<
" for jet " <<
long(pjetout)
131 <<
" in map " << pjmapname);
132 pjmap[pjetout] = ppj;
134 sortedTarget.erase(targetIt);
137 ATH_MSG_VERBOSE(
"No match found for destination jet " <<
long(pjetout));
140 auto targetIt = sortedTarget.begin();
142 if ( targetIt == sortedTarget.end() )
break;
152 copy(
const JetContainer& srcjets,
const std::string& dstname,
const std::string& pjmapname)
const {
158 return copy(srcjets, *pdstjets, pjmapname);