7 #include "GaudiKernel/ThreadLocalContext.h"
14 const IInterface*
p) :
22 ATH_CHECK( m_taus.initialize(m_streamName) );
23 ATH_CHECK( m_tauTracks.initialize(m_streamName) );
24 ATH_CHECK( m_trackParticles.initialize(m_streamName) );
25 ATH_CHECK( m_neutralPFOs.initialize(m_streamName) );
26 ATH_CHECK( m_secondaryVertices.initialize(m_streamName) );
29 if (!m_selectionString.empty()) {
30 ATH_MSG_INFO(
"Selection string for " << m_taus.key() <<
": " << m_selectionString);
31 ATH_CHECK( initializeParser(m_selectionString) );
33 return StatusCode::SUCCESS;
39 ATH_MSG_INFO(
"Processed " << m_ntot <<
" taus, " << m_npass <<
" were kept");
41 return StatusCode::SUCCESS;
47 const EventContext& ctx = Gaudi::Hive::currentContext();
52 size_t nTaus = taus->size();
67 std::vector<const xAOD::TauJet*> tausToKeep;
70 if (!m_selectionString.empty()) {
71 std::vector<int>
entries = m_parser->evaluateAsVector();
74 ATH_MSG_ERROR(
"Incompatible sizes: " << nTaus <<
" vs " <<
nEntries <<
"! Please check your selection string uses the appropriate tau container.");
75 return StatusCode::FAILURE;
78 for (
size_t i=0;
i<nTaus; ++
i)
if (
entries[
i]==1) tausToKeep.push_back(taus->at(
i));
82 for (
size_t i=0;
i<nTaus; ++
i) tausToKeep.push_back(taus->at(
i));
86 if(tausToKeep.size() >0) {
87 for(
size_t i=0;
i < tausToKeep.size()-1;
i++){
88 for (
size_t j=
i+1; j < tausToKeep.size(); j++){
89 if( (tausToKeep.at(
i)->p4().DeltaR(tausToKeep.at(j)->p4())) < 0.01){
90 ATH_MSG_WARNING(
"Found duplicated tau with eta " << tausToKeep.at(j)->eta() <<
" phi " << tausToKeep.at(j)->phi() <<
" pt " << tausToKeep.at(j)->pt() <<
". Removing it ...");
91 tausToKeep.erase( tausToKeep.begin()+j);
99 for (
const auto* tau : tausToKeep) {
101 taus.
keep(tau->index());
108 trackParticles.
keep(
track->track()->index());
112 for (
size_t i=0;
i<tau->nNeutralPFOs();
i++) {
113 neutralPFOs.
keep(tau->neutralPFO(
i)->index());
117 if (tau->secondaryVertex() !=
nullptr) {
118 secondaryVertices.
keep(tau->secondaryVertex()->index());
123 m_npass += tausToKeep.size();
126 return StatusCode::SUCCESS;