From ec94d5127eb6af8d5afd5ad40a55c46231349c21 Mon Sep 17 00:00:00 2001 From: Andrii Verbytskyi <andrii.verbytskyi@cern.ch> Date: Mon, 29 Jun 2020 12:16:38 +0000 Subject: [PATCH] Cleanup of HforTool --- .../AtlasHepMC/AtlasHepMC/GenParticle.h | 1 + Generators/AtlasHepMC/AtlasHepMC/GenVertex.h | 1 + Generators/HforTool/HforTool/HforTool.h | 6 +- Generators/HforTool/src/HforTool.cxx | 198 +++++++----------- 4 files changed, 75 insertions(+), 131 deletions(-) diff --git a/Generators/AtlasHepMC/AtlasHepMC/GenParticle.h b/Generators/AtlasHepMC/AtlasHepMC/GenParticle.h index 09dc38efc25..d34e18abb05 100644 --- a/Generators/AtlasHepMC/AtlasHepMC/GenParticle.h +++ b/Generators/AtlasHepMC/AtlasHepMC/GenParticle.h @@ -48,6 +48,7 @@ namespace Print { inline void line(std::ostream& os,const GenParticle& p){p.print(os);} inline void line(std::ostream& os,const GenParticle* p){p->print(os);} } +inline std::ostream& operator<<( std::ostream& os, const GenParticle* p ) { if (p) return os<<(*p); else return os;} } #endif #endif diff --git a/Generators/AtlasHepMC/AtlasHepMC/GenVertex.h b/Generators/AtlasHepMC/AtlasHepMC/GenVertex.h index a90b6c53159..501c2b58832 100644 --- a/Generators/AtlasHepMC/AtlasHepMC/GenVertex.h +++ b/Generators/AtlasHepMC/AtlasHepMC/GenVertex.h @@ -47,6 +47,7 @@ inline GenVertexPtr newGenVertexPtr(const HepMC::FourVector &pos = HepMC::FourVe } inline int barcode(ConstGenVertexPtr p){ return p->barcode();} inline void* raw_pointer(GenVertexPtr p){ return p;} +inline std::ostream& operator<<( std::ostream& os, const GenVertex* v ) { if (v) return os<<(*v); else return os;} } #endif #endif diff --git a/Generators/HforTool/HforTool/HforTool.h b/Generators/HforTool/HforTool/HforTool.h index 5e3c8fba753..659e2c99949 100644 --- a/Generators/HforTool/HforTool/HforTool.h +++ b/Generators/HforTool/HforTool/HforTool.h @@ -123,11 +123,11 @@ private: void findHFQuarks(); /// Specific fn for finding HF quarks in HERWIG6 event record - void findHFQuarksHerwig(const std::map< int,std::vector<const HepMC::GenParticle*> >& finalstate_q); + void findHFQuarksHerwig(const std::map< int,std::vector<HepMC::ConstGenParticlePtr> >& finalstate_q); /// Specific fn for finding HF quarks in PYTHIA6 event record - void findHFQuarksPythia(const std::map< int,std::vector<const HepMC::GenParticle*> >& finalstate_q); + void findHFQuarksPythia(const std::map< int,std::vector<HepMC::ConstGenParticlePtr> >& finalstate_q); /// If we don't know the shower generator, use this to set all to "unknown" - void findHFQuarksUnknown(const std::map< int,std::vector<const HepMC::GenParticle*> >& finalstate_q); + void findHFQuarksUnknown(const std::map< int,std::vector<HepMC::ConstGenParticlePtr> >& finalstate_q); void jetBasedRemoval(); void angularBasedRemoval(); diff --git a/Generators/HforTool/src/HforTool.cxx b/Generators/HforTool/src/HforTool.cxx index b296e319517..a72dc7b1af1 100644 --- a/Generators/HforTool/src/HforTool.cxx +++ b/Generators/HforTool/src/HforTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ ///////////////////////////////////////////////////////////// @@ -10,6 +10,8 @@ // Michiel Sanders, Ludwig-Maximilans-Universitaet Muenchen // ///////////////////////////////////////////////////////////// +#include <cmath> +#include <set> #include "GaudiKernel/Property.h" @@ -23,9 +25,6 @@ #include "EventInfo/EventInfo.h" #include "EventInfo/EventType.h" -#include <cmath> -#include <set> - HforTool::HforTool(const std::string& type, const std::string& name, const IInterface* parent) : AthAlgTool(type, name, parent), @@ -80,7 +79,6 @@ StatusCode HforTool::execute() { testSampleType(); - //checkSampleType(); if (m_sampleType == "") { ATH_MSG_DEBUG("Used sample doesn't need any heavy flavor overlap removal!"); return StatusCode::FAILURE; @@ -224,7 +222,6 @@ void HforTool::findHFQuarks() { m_Quarks_unknown.clear() ; m_ShowerGenerator.clear() ; - // AtlasReconstruction/15.6.6/PhysicsAnalysis/AnalysisCommon/ParticleJetTools/src/JetQuarkLabel.cxx // get the McEventCollection from StoreGate // if we don't know yet which store gate key to use, find it here @@ -274,51 +271,44 @@ void HforTool::findHFQuarks() { m_ShowerGenerator = "HERWIG" ; if ( !m_ShowerGenerator.size() ) { if ( m_DefaultShowerGenerator.size() ) { - ATH_MSG_INFO("Shower generator type not found in the event; using " - << m_DefaultShowerGenerator << " instead") ; + ATH_MSG_INFO("Shower generator type not found in the event; using "<< m_DefaultShowerGenerator << " instead") ; m_ShowerGenerator = m_DefaultShowerGenerator ; } else { - ATH_MSG_WARNING("Shower generator type unknown (" - << gen1 << "," << gen2 << "," << gen3 << ")") ; + ATH_MSG_WARNING("Shower generator type unknown ("<< gen1 << "," << gen2 << "," << gen3 << ")") ; return ; } } // vectors with the initial and final state b/c quarks; ie, initial or final // in the parton shower; ignore b/c quarks from b/c-hadron decays - std::map< int,std::vector<const HepMC::GenParticle*> > finalstate_q ; + std::map< int,std::vector<HepMC::ConstGenParticlePtr> > finalstate_q ; // get the GenEvent, assume it's the first one in the McEventCollection - HepMC::GenEvent::particle_const_iterator pitr = evt->particles_begin(); - for (; pitr != evt->particles_end(); ++pitr) { - int pdg = (*pitr)->pdg_id(); + for (auto bcpart: *evt) { + int pdg = bcpart->pdg_id(); int apdg = std::abs(pdg) ; if (apdg == 5 || apdg == 4) { // b or c quark - const HepMC::GenParticlePtr bcpart = (*pitr) ; - ATH_MSG_DEBUG("pdg = " << pdg << ": " << *bcpart); + ATH_MSG_DEBUG("pdg = " << pdg << ": " << bcpart); // find the production vertex and parents - HepMC::GenVertexPtr prodvtx = bcpart->production_vertex() ; + auto prodvtx = bcpart->production_vertex() ; bool hasbchadronparent(false) ; bool hasmpiparent(false) ; bool hastopparent(false) ; bool hasWparent(false) ; if ( prodvtx ) { - ATH_MSG_DEBUG(" prod vtx: " << *prodvtx); - + ATH_MSG_DEBUG(" prod vtx: " << prodvtx); // check that there is no b/c-hadron as a parent // also find mpi and top parents - HepMC::GenVertex::particle_iterator pin = - prodvtx->particles_begin(HepMC::parents) ; - for (; pin != prodvtx->particles_end(HepMC::parents) && !hasbchadronparent; pin++) { + for (auto pin = prodvtx->particles_begin(HepMC::parents); pin != prodvtx->particles_end(HepMC::parents) && !hasbchadronparent; pin++) + { ATH_MSG_DEBUG(" incoming: " << *(*pin)); int pdgin(abs((*pin)->pdg_id())) ; if ( (pdgin%10000)/1000 == apdg || (pdgin%1000)/100 == apdg ) hasbchadronparent = true ; // also reject the c-quarks from a b-quark/hadron decay - if ( apdg == 4 && ( pdgin == 5 || (pdgin%10000)/1000 == 5 || - (pdgin%1000)/100 == 5 ) ) + if ( apdg == 4 && ( pdgin == 5 || (pdgin%10000)/1000 == 5 ||(pdgin%1000)/100 == 5 ) ) hasbchadronparent = true ; // Herwig specific if ( pdgin == 0 && (*pin)->status() == 120 ) @@ -343,14 +333,13 @@ void HforTool::findHFQuarks() { auto decayvtx = bcpart->end_vertex() ; bool hasbcquarkdaughter(false) ; if ( !hasbchadronparent && decayvtx ) { - ATH_MSG_DEBUG(" decay vtx: " << *decayvtx); + ATH_MSG_DEBUG(" decay vtx: " << decayvtx); // check whether there are only non-b/c-quark daughters - HepMC::GenVertex::particle_iterator pout = - decayvtx->particles_begin(HepMC::children) ; - for (; pout != decayvtx->particles_end(HepMC::children) && !hasbcquarkdaughter; pout++) { - ATH_MSG_DEBUG(" outgoing: " << *(*pout)); - int pdgout(abs((*pout)->pdg_id())) ; + for (auto pout = decayvtx->particles_begin(HepMC::children) ; pout != decayvtx->particles_end(HepMC::children) && !hasbcquarkdaughter; pout++) + { + ATH_MSG_DEBUG(" outgoing: " << (*pout)); + int pdgout(std::abs((*pout)->pdg_id())) ; if ( pdgout == apdg ) hasbcquarkdaughter = true ; } @@ -360,7 +349,7 @@ void HforTool::findHFQuarks() { // if no b/c-hadron parent and no b/c-quark daughter, keep it! if (!hasbchadronparent && !hasbcquarkdaughter) { - ATH_MSG_DEBUG(" final state b/c-quark, barcode = "<< bcpart->barcode()); + ATH_MSG_DEBUG(" final state b/c-quark, barcode = "<< HepMC::barcode(bcpart)); finalstate_q[apdg].push_back(bcpart) ; } @@ -376,8 +365,8 @@ void HforTool::findHFQuarks() { } // particle is a b or a c quark } // loop over all particles in the GenEvent - - // the rest of the classification depends on whether the shower + + // the rest of the classification depends on whether the shower // was generated with Pythia or with Herwig if ( m_ShowerGenerator == "HERWIG" ) findHFQuarksHerwig(finalstate_q) ; @@ -385,18 +374,13 @@ void HforTool::findHFQuarks() { findHFQuarksPythia(finalstate_q) ; // print out vtx -5 (the Alpgen ME process) if there are HF quarks and // only in DEBUG mode + // Actually it does not make much sense. if ( msgLvl(MSG::DEBUG) && finalstate_q.size() ) { ATH_MSG_DEBUG("print out vertex -5") ; - auto vtx5(evt->barcode_to_vertex(-5)) ; + auto vtx5=HepMC::barcode_to_vertex(evt,-5) ; if (vtx5) { - for ( HepMC::GenVertex::particle_iterator pin = - vtx5->particles_begin(HepMC::parents) ; - pin != vtx5->particles_end(HepMC::parents); pin++) - ATH_MSG_DEBUG(" incoming: " << *(*pin)); - for ( HepMC::GenVertex::particle_iterator pout = - vtx5->particles_begin(HepMC::children) ; - pout != vtx5->particles_end(HepMC::children); pout++) - ATH_MSG_DEBUG(" outgoing: " << *(*pout)); + for ( auto pin = vtx5->particles_begin(HepMC::parents) ; pin != vtx5->particles_end(HepMC::parents); pin++) ATH_MSG_DEBUG(" incoming: " << (*pin)); + for ( auto pout = vtx5->particles_begin(HepMC::children) ; pout != vtx5->particles_end(HepMC::children); pout++) ATH_MSG_DEBUG(" outgoing: " << (*pout)); } } // print out vtx -5 if there are HF quarks and in DEBUG mode } // Pythia shower @@ -415,7 +399,7 @@ void HforTool::findHFQuarks() { //////////////////////////////////////////////////////////////////////// // Find the specifics for HF quarks in a Herwig shower void HforTool::findHFQuarksHerwig - (const std::map< int,std::vector<const HepMC::GenParticle*> > + (const std::map< int,std::vector<HepMC::ConstGenParticlePtr> > & finalstate_q ) //////////////////////////////////////////////////////////////////////// { @@ -429,8 +413,8 @@ void HforTool::findHFQuarksHerwig // second loop over the final state quarks for ( auto bcpart: ipdg.second) { - ATH_MSG_DEBUG("final state b/c " << *bcpart); - auto prodvtx(bcpart->production_vertex()) ; + ATH_MSG_DEBUG("final state b/c " << bcpart); + auto prodvtx=bcpart->production_vertex() ; bool isMPI(false) ; bool isGS(false) ; bool isME(false) ; @@ -450,7 +434,7 @@ void HforTool::findHFQuarksHerwig for (auto pin=prodvtx_particles_begin; pin!= prodvtx_particles_end && !iscquarkfromb && !isPDF ; pin++ ) { int apdgin = std::abs((*pin)->pdg_id()) ; if (apdgin != apdg ) { - ATH_MSG_DEBUG(" non b/c parent " << *(*pin)); + ATH_MSG_DEBUG(" non b/c parent " << (*pin)); // if MPI as a non-b parent, label it if ( apdgin == 0 && (*pin)->status() == 120 ) { ATH_MSG_DEBUG(" MPI !!"); @@ -487,7 +471,7 @@ void HforTool::findHFQuarksHerwig isWDecay = true ; } } else { - ATH_MSG_DEBUG(" b/c parent " << *(*pin)); + ATH_MSG_DEBUG(" b/c parent " << (*pin)); // if the status of a b-quark is 123 or 124, then it is a ME b-quark if ( (*pin)->status() == 123 || (*pin)->status() == 124 ) { ATH_MSG_DEBUG(" ME !!"); @@ -544,7 +528,7 @@ void HforTool::findHFQuarksHerwig //////////////////////////////////////////////////////////////////////// // Find the specifics for HF quarks in a Pythia shower void HforTool::findHFQuarksPythia - (const std::map< int,std::vector<const HepMC::GenParticle*> > + (const std::map< int,std::vector<HepMC::ConstGenParticlePtr> > & finalstate_q) //////////////////////////////////////////////////////////////////////// { @@ -560,14 +544,12 @@ void HforTool::findHFQuarksPythia // included in the event record with stat=3 particles // the partons that we need are *not* these ones, but if // these stat=3 partons exist, then the correct partons are in the event too - std::set<const HepMC::GenParticle*> MEParton ; - std::set<const HepMC::GenParticle*> PDFParton ; - + std::set<HepMC::ConstGenParticlePtr> MEParton ; + std::set<HepMC::ConstGenParticlePtr> PDFParton ; // loop over the stat=3 final state quarks for ( auto bcpart: ipdg.second) { if ( bcpart->status() == 3 ) { - ATH_MSG_DEBUG("final state b/c (stat=3) " << *bcpart - << ", m = " << bcpart->momentum().m() ); + ATH_MSG_DEBUG("final state b/c (stat=3) " << bcpart << ", m = " << bcpart->momentum().m() ); // if this parton has no descendants, then it's a ME parton if ( !bcpart->end_vertex() ) { ATH_MSG_DEBUG(" ME parton") ; @@ -575,14 +557,13 @@ void HforTool::findHFQuarksPythia MEParton.insert(bcpart) ; // if there is a direct stat=3 ancestor with the same flavour, // then there is PDF parton too (eg, qc->q'Wc) - auto prodvtx(bcpart->production_vertex()) ; + auto prodvtx=bcpart->production_vertex() ; if ( prodvtx ) { - HepMC::GenVertex::particle_iterator pin = - prodvtx->particles_begin(HepMC::parents) ; - for (; pin != prodvtx->particles_end(HepMC::parents); pin++) { - ATH_MSG_DEBUG(" incoming: " << *(*pin)); + for (auto pin=prodvtx->particles_begin(HepMC::parents); pin != prodvtx->particles_end(HepMC::parents); pin++) + { + ATH_MSG_DEBUG(" incoming: " << (*pin)); int pdgin((*pin)->pdg_id()) ; - if ( abs(pdgin) == apdg && (*pin)->status() == 3 ) { + if ( std::abs(pdgin) == apdg && (*pin)->status() == 3 ) { ATH_MSG_DEBUG(" PDF parton") ; PDFParton.insert((*pin)) ; } @@ -602,9 +583,8 @@ void HforTool::findHFQuarksPythia // loop over the other final state quarks for ( auto bcpart: ipdg.second) { if ( bcpart->status() != 3 ) { - ATH_MSG_DEBUG("final state b/c " << *bcpart - << ", m = " << bcpart->momentum().m() ); - auto prodvtx(bcpart->production_vertex()) ; + ATH_MSG_DEBUG("final state b/c " << bcpart << ", m = " << bcpart->momentum().m() ); + auto prodvtx=bcpart->production_vertex() ; bool isTopDecay(false) ; bool isWDecay(false) ; // subset of top-decays, for hadronic top-decays bool iscquarkfromb(false) ; @@ -618,29 +598,26 @@ void HforTool::findHFQuarksPythia if ( prodvtx ) { // check whether there is a proton ancestor, // and how many ancestors there are - HepMC::GenVertex::particle_iterator pin = prodvtx->particles_begin(HepMC::ancestors) ; - for ( ; pin != prodvtx->particles_end(HepMC::ancestors) && !iscquarkfromb ; pin++ ) { + for ( auto pin = prodvtx->particles_begin(HepMC::ancestors); pin != prodvtx->particles_end(HepMC::ancestors) && !iscquarkfromb ; pin++ ) + { int apdgin = std::abs((*pin)->pdg_id()) ; if ( apdgin != apdg ) { - ATH_MSG_DEBUG(" non b/c ancestor " << *(*pin)); + ATH_MSG_DEBUG(" non b/c ancestor " << (*pin)); // proton parent if ( apdgin == 2212 ) { - // ATH_MSG_DEBUG(" Proton!") ; hasPAncestor = true ; } // count number of ancestors nAncestors += 1 ; // c quark from a b quark (in b-hadron decays) - if ( apdg == 4 && ( apdgin == 5 || (apdgin%10000)/1000 == 5 || - (apdgin%1000)/100 == 5 ) ) { + if ( apdg == 4 && ( apdgin == 5 || (apdgin%10000)/1000 == 5 || (apdgin%1000)/100 == 5 ) ) { ATH_MSG_WARNING(" c quark from b quark or b hadron"); iscquarkfromb = true ; } // b quark from a b-hadron decay // (b directly from b-hadron already rejected) - if ( apdg == 5 && ( (apdgin%10000)/1000 == 5 || - (apdgin%1000)/100 == 5 ) ) { + if ( apdg == 5 && ( (apdgin%10000)/1000 == 5 || (apdgin%1000)/100 == 5 ) ) { ATH_MSG_WARNING(" b quark from b hadron"); iscquarkfromb = true ; } @@ -655,7 +632,7 @@ void HforTool::findHFQuarksPythia isWDecay = true ; } } else { - ATH_MSG_DEBUG(" b/c or ME/PDF parent " << *(*pin)); + ATH_MSG_DEBUG(" b/c or ME/PDF parent " << (*pin)); } // b/c or non-b/c quark as parent } // loop over all ancestors @@ -695,22 +672,15 @@ void HforTool::findHFQuarksPythia // prod vtx of stat=3 PDF parton, and opposite pdgid // first check that showered ME/PDF parton has prod. vtx -3 or -4 - HepMC::GenVertexPtr pvtx34(prodvtx) ; - bool bc34(pvtx34->barcode()==-3 || pvtx34->barcode()==-4) ; + auto pvtx34=prodvtx ; + bool bc34=(HepMC::barcode(pvtx34)==-3 || HepMC::barcode(pvtx34)==-4) ; if ( !bc34 ) { - // ATH_MSG_DEBUG("Production vtx with barcode not -3 or -4") ; - HepMC::GenVertex::particle_iterator pin = - prodvtx->particles_begin(HepMC::ancestors) ; - for (;pin!=prodvtx->particles_end(HepMC::ancestors)&&!bc34 ; - pin++ ) { + for (auto pin=prodvtx->particles_begin(HepMC::ancestors);pin!=prodvtx->particles_end(HepMC::ancestors)&&!bc34 ; pin++ ) + { int bcpv(-1) ; if ( (*pin)->production_vertex() ) - bcpv = (*pin)->production_vertex()->barcode() ; - // ATH_MSG_DEBUG(" ancestor particle barcode " - // <<(*pin)->barcode() << ", prodvtx " - // << bcpv) ; + bcpv = HepMC::barcode((*pin)->production_vertex()) ; if ( (*pin)->pdg_id() == pdg && (bcpv==-3 || bcpv==-4) ) { - // ATH_MSG_DEBUG(" found vtx with barcode -3 or -4") ; pvtx34 = (*pin)->production_vertex() ; bc34 = true ; } @@ -731,14 +701,12 @@ void HforTool::findHFQuarksPythia // ME parton bool isME(false) ; for ( auto ime: MEParton) { if (isME) break; - HepMC::GenVertex* mepvtx(ime->production_vertex()) ; + auto mepvtx=ime->production_vertex() ; // check the prod.vertices of the parents if ( mepvtx ) { - HepMC::GenVertex::particle_iterator pin = - mepvtx->particles_begin(HepMC::parents) ; - for (; pin != mepvtx->particles_end(HepMC::parents); pin++) { - if ( (*pin)->production_vertex() == pvtx34 && - ime->pdg_id() == pdg ) { + for (auto pin = mepvtx->particles_begin(HepMC::parents) ; pin != mepvtx->particles_end(HepMC::parents); pin++) + { + if ( (*pin)->production_vertex() == pvtx34 && ime->pdg_id() == pdg ) { ATH_MSG_DEBUG(" -> ME parton") ; nid += 1 ; isME = true ; @@ -780,20 +748,15 @@ void HforTool::findHFQuarksPythia // print out wrongly identified PDF/GS partons if ( msgLvl(MSG::WARNING) ) { if ( m_Quarks_PDF[apdg].size() != PDFParton.size() ) { - ATH_MSG_WARNING("Mismatch in number of id-d PDF partons, apdg = " - << apdg ) ; + ATH_MSG_WARNING("Mismatch in number of id-d PDF partons, apdg = "<< apdg ) ; ATH_MSG_DEBUG("PDF partons from ME:") ; for ( auto ipdf: PDFParton) { const HepMC::FourVector & mom(ipdf->momentum()) ; - ATH_MSG_DEBUG(mom.px()<<", "<< mom.py()<<", "<<mom.pz()<< - " pT = "<<mom.perp()/1000.<<", eta = "<<mom.eta()) ; + ATH_MSG_DEBUG(mom.px()<<", "<< mom.py()<<", "<<mom.pz()<<" pT = "<<mom.perp()/1000.<<", eta = "<<mom.eta()) ; } ATH_MSG_DEBUG("PDF partons identified:") ; - for ( std::vector<HepMC::FourVector>::const_iterator iq = - m_Quarks_PDF[apdg].begin(); iq!=m_Quarks_PDF[apdg].end();iq++) { - const HepMC::FourVector & mom((*iq)) ; - ATH_MSG_DEBUG(mom.px()<<", "<< mom.py()<<", "<<mom.pz()<< - " pT = "<<mom.perp()/1000.<<", eta = "<<mom.eta()) ; + for ( auto mom: m_Quarks_PDF[apdg]) { + ATH_MSG_DEBUG(mom.px()<<", "<< mom.py()<<", "<<mom.pz()<<" pT = "<<mom.perp()/1000.<<", eta = "<<mom.eta()); } // Could move the pdf parton with smaller eta to gs, but only if @@ -810,7 +773,7 @@ void HforTool::findHFQuarksPythia //////////////////////////////////////////////////////////////////////// // Label all the final state partons to "unknown" void HforTool::findHFQuarksUnknown - (const std::map< int,std::vector<const HepMC::GenParticle*> > + (const std::map< int,std::vector<HepMC::ConstGenParticlePtr> > & finalstate_q ) //////////////////////////////////////////////////////////////////////// { @@ -826,29 +789,27 @@ void HforTool::findHFQuarksUnknown // second loop over the final state quarks for ( auto bcpart: ipdg.second) { - ATH_MSG_DEBUG("final state b/c " << *bcpart); + ATH_MSG_DEBUG("final state b/c " << bcpart); // still filter out the b/c partons directly from a b/c/bhadron // or from top or W decay - HepMC::GenVertexPtr prodvtx(bcpart->production_vertex()) ; + auto prodvtx=bcpart->production_vertex(); bool isTopDecay(false) ; bool isWDecay(false) ; // subset of top-decays, for hadronic top-decays bool iscquarkfromb(false) ; if ( prodvtx ) { - HepMC::GenVertex::particle_iterator pin = prodvtx->particles_begin(HepMC::ancestors) ; - for ( ; pin != prodvtx->particles_end(HepMC::ancestors) && !iscquarkfromb ; pin++ ) { + for ( auto pin = prodvtx->particles_begin(HepMC::ancestors); pin != prodvtx->particles_end(HepMC::ancestors) && !iscquarkfromb ; pin++ ) + { int apdgin = std::abs((*pin)->pdg_id()) ; if (apdgin != apdg ) { - ATH_MSG_DEBUG(" non b/c parent " << *(*pin)); + ATH_MSG_DEBUG(" non b/c parent " << (*pin)); // c quark from a b quark (in b-hadron decays) - if ( apdg == 4 && ( apdgin == 5 || (apdgin%10000)/1000 == 5 || - (apdgin%1000)/100 == 5 ) ) { + if ( apdg == 4 && ( apdgin == 5 || (apdgin%10000)/1000 == 5 ||(apdgin%1000)/100 == 5 ) ) { ATH_MSG_DEBUG(" c quark from b quark or b hadron"); iscquarkfromb = true ; } // b quark from a b-hadron decay // (b directly from b-hadron already rejected) - if ( apdg == 5 && ( (apdgin%10000)/1000 == 5 || - (apdgin%1000)/100 == 5 ) ) { + if ( apdg == 5 && ( (apdgin%10000)/1000 == 5 ||(apdgin%1000)/100 == 5 ) ) { ATH_MSG_DEBUG(" b quark from b hadron"); iscquarkfromb = true ; } @@ -921,18 +882,13 @@ void HforTool::jetBasedRemoval() StatusCode sc = evtStore()->retrieve( aod_jets, m_JetContainer ); if ( sc.isFailure() ) { ATH_MSG_WARNING("No ESD/AOD/DPD jet container found: key = " <<m_JetContainer); - // return StatusCode::SUCCESS ; return ; } m_jets = aod_jets; ATH_MSG_DEBUG(" Size of Jet Collection " << aod_jets->size()); - // JetCollection::const_iterator jetItr = aod_jets->begin(); - // JetCollection::const_iterator jetItrE = aod_jets->end(); - ATH_MSG_DEBUG("There are " << m_jets->size()<<" jets in this event"); - for ( JetCollection::const_iterator jetItr = m_jets->begin(); - jetItr != m_jets->end(); jetItr++ ) { + for ( JetCollection::const_iterator jetItr = m_jets->begin(); jetItr != m_jets->end(); jetItr++ ) { const Jet* thisjet = *jetItr; @@ -1077,16 +1033,8 @@ void HforTool::jetBasedRemoval() m_result = "kill"; } - - - - - - } - - //////////////////////////////////////////////////////////////////////// // Do the angular based overlap removal void HforTool::angularBasedRemoval() @@ -1372,14 +1320,8 @@ void HforTool::checkSampleType() ) m_sampleType = "isBB"; - - - - } - HforTool::~HforTool() { } - -- GitLab