28 declareInterface<DerivationFramework::IThinningTool>(
this);
46 ATH_CHECK(m_trackParticleContainerName.initialize(m_streamName));
50 ATH_MSG_INFO(
"IgnoreFlags is set, all vertices in the container will be kept");
54 if (m_passFlags.empty()) {
56 return StatusCode::FAILURE;
58 for(
auto itr = m_passFlags.begin(); itr!=m_passFlags.end(); ++itr) {
59 ATH_MSG_INFO(
"Vertices must pass the \"" << *itr <<
"\" selection");
64 if (m_acceptanceR > 0.) {
65 ATH_MSG_INFO(
"Extra tracks must be within cone of "<<m_acceptanceR<<
" from vertex candidate.");
68 for(
auto &handle : m_vertexContainerName){
69 ATH_CHECK(handle.initialize(m_streamName));
71 for(
const auto &tracknames : m_vertexContainerName){
72 for(
const auto &
str : m_passFlags){
73 m_passArray.emplace_back(tracknames.key() +
'.' +
str);
77 return StatusCode::SUCCESS;
83 ATH_MSG_INFO(
"Processed "<< m_ntot <<
" tracks, "<< m_npass<<
" were retained ");
84 ATH_MSG_INFO(
"Processed "<< m_nVtxTot <<
" vertices, "<< m_nVtxPass<<
" were retained ");
86 return StatusCode::SUCCESS;
92 const EventContext& ctx = Gaudi::Hive::currentContext();
97 unsigned int nTracks = importedTrackParticles->size();
98 if (nTracks==0)
return StatusCode::SUCCESS;
101 std::vector<bool> trackMask(nTracks,
false);
106 std::unordered_map<std::string, SG::ReadDecorHandle<xAOD::VertexContainer, Char_t>> handles;
107 handles.reserve(m_passArray.size());
108 for(
const auto &
key : m_passArray){
109 auto it = handles.emplace(std::piecewise_construct, std::forward_as_tuple(
key.key()), std::forward_as_tuple(
key, ctx));
110 if(!(*
it.first).second.isPresent())
return StatusCode::FAILURE;
114 for(
const auto&
name : m_vertexContainerName){
116 std::vector<bool> vtxMask(vertexContainer->size(),
false);
120 for(
auto vtxItr = vertexContainer->begin(); vtxItr!=vertexContainer->end(); ++vtxItr, ++
k) {
126 for(std::vector<std::string>::const_iterator flagItr = m_passFlags.begin(); flagItr!=m_passFlags.end(); ++flagItr) {
127 std::string lookupstr =
name.key() +
'.' + (*flagItr);
128 const auto& handle = handles.at(lookupstr);
129 if(handle(*vtx) != 0) {
141 if(m_acceptanceR > 0.){
144 TLorentzVector centreCandidate;
149 for(
uint i=0;
i<nTracks; ++
i) {
152 if(centreCandidate.DeltaR(
track->p4()) < m_acceptanceR) trackMask[
i]=
true;
159 for(
uint i=0;
i<nTracks; ++
i) {
175 vertexContainer.
keep(vtxMask);
180 m_nVtxTot += nVtxTot;
181 m_nVtxPass+= nVtxPass;
182 if(m_thinTracks || m_acceptanceR > 0.) {
184 importedTrackParticles.
keep(trackMask);
187 return StatusCode::SUCCESS;