16 const IInterface*
p ) :
29 ATH_CHECK( m_inDetSGKey.initialize(m_streamName) );
30 ATH_MSG_INFO(
"Using " << m_inDetSGKey.key() <<
" as the source collection for inner detector track particles");
32 m_PFOChargedSGKey = m_PFOSGKey+
"ChargedParticleFlowObjects";
33 m_PFONeutralSGKey = m_PFOSGKey+
"NeutralParticleFlowObjects";
34 ATH_CHECK( m_PFONeutralSGKey.initialize(m_streamName));
35 ATH_CHECK( m_PFOChargedSGKey.initialize(m_streamName));
36 ATH_MSG_INFO(
"Using " << m_PFONeutralSGKey.key() <<
"and " << m_PFOChargedSGKey.key() <<
" as the source collection for the PFlow collection");
38 for(
unsigned int i = 0;
i < m_addPFOSGKey.size();
i++){
39 m_tmpAddPFOChargedSGKey = m_addPFOSGKey[
i]+
"ChargedParticleFlowObjects";
40 ATH_CHECK( m_tmpAddPFOChargedSGKey.initialize(m_streamName) );
41 m_addPFOChargedSGKey.push_back(m_tmpAddPFOChargedSGKey);
42 m_tmpAddPFONeutralSGKey = m_addPFOSGKey[
i]+
"NeutralParticleFlowObjects";
43 ATH_CHECK( m_tmpAddPFONeutralSGKey.initialize(m_streamName) );
44 m_addPFONeutralSGKey.push_back(m_tmpAddPFONeutralSGKey);
47 ATH_CHECK( m_ufoSGKey.initialize(m_streamName));
48 ATH_MSG_INFO(
"Using " << m_ufoSGKey.key()<<
" as the source collection for UFOs");
51 ATH_MSG_INFO(
"Using " << m_jetSGKey.key() <<
" as the source collection for UFOs");
53 if (!m_selectionString.empty()){
55 ATH_CHECK( initializeParser( m_selectionString ));
58 return StatusCode::SUCCESS;
63 return StatusCode::SUCCESS;
70 const EventContext& ctx = Gaudi::Hive::currentContext();
81 unsigned int nJets(importedJets->
size());
82 std::vector<const xAOD::Jet*> jetToCheck; jetToCheck.clear();
85 unsigned int nTracks = importedTrackParticles->size();
87 const size_t nPFONeutral = importedPFONeutral->size();
88 const size_t nPFOCharged = importedPFOCharged->size() ;
89 unsigned int nPFOs = nPFOCharged + nPFONeutral;
90 if (nPFOs==0 && nTracks==0)
return StatusCode::SUCCESS;
93 std::vector<bool> maskTracks;
94 maskTracks.assign(nTracks,
false);
97 std::vector< bool > pfomaskNeutral( nPFONeutral,
false );
98 std::vector< bool > pfomaskCharged( nPFOCharged,
false );
103 unsigned int nUFOs(importedUFOs->size());
106 std::vector<bool> maskUFOs;
107 maskUFOs.assign(nUFOs,
false);
110 if (m_selectionString!=
"") {
111 std::vector<int>
entries = m_parser->evaluateAsVector();
115 ATH_MSG_ERROR(
"Sizes incompatible! Are you sure your selection string used jets??");
116 return StatusCode::FAILURE;
119 for (
unsigned int i=0;
i<nJets; ++
i)
if (
entries[
i]==1) jetToCheck.push_back((*importedJets)[
i]);
123 if (m_selectionString==
"") {
124 for(
const auto *
jet : *importedJets){
125 for(
size_t j = 0; j <
jet->numConstituents(); ++j ) {
126 auto ufo =
jet->constituentLinks().at(j);
127 int index = ufo.index();
128 maskUFOs[
index] =
true;
136 maskTracks[index_trk] =
true;
143 if(index_pfo<0)
continue;
147 if(fe->
signalType()==xAOD::FlowElement::SignalType::ChargedPFlow){
148 pfomaskCharged.at( index_pfo ) =
true;
150 else if(fe->
signalType()==xAOD::FlowElement::SignalType::NeutralPFlow){
151 pfomaskNeutral.at( index_pfo ) =
true;
159 for (
auto & jetIt : jetToCheck) {
160 for(
size_t j = 0; j < jetIt->numConstituents(); ++j ) {
161 auto ufo = jetIt->constituentLinks().at(j);
162 int index = ufo.index();
163 maskUFOs[
index] =
true;
171 maskTracks[index_trk] =
true;
177 if(index_pfo<0)
continue;
181 if(fe->
signalType()==xAOD::FlowElement::SignalType::ChargedPFlow){
182 pfomaskCharged.at( index_pfo ) =
true;
184 else if(fe->
signalType()==xAOD::FlowElement::SignalType::NeutralPFlow){
185 pfomaskNeutral.at( index_pfo ) =
true;
194 importedTrackParticles.
keep (maskTracks);
196 importedPFONeutral.
keep (pfomaskNeutral);
197 importedPFOCharged.
keep (pfomaskCharged);
198 importedUFOs.
keep (maskUFOs);
200 for(
unsigned int i = 0;
i < m_addPFOChargedSGKey.size();
i++){
204 tempPFOCharged.
keep(pfomaskCharged);
205 tempPFONeutral.
keep(pfomaskNeutral);
208 return StatusCode::SUCCESS;