35 m_resetViewConts(true),
41 m_inViewContNameListList(),
42 m_outViewContNameListList(),
50 "The name of the output container with the deep copy of input objects" );
53 "The string seperator between the output container name and the sytematic variation (default='___')" );
56 "The names of all suffixes for the input and output container names" );
59 "The names of all view containers that contain particles that we want to retain" );
62 "Boolean to decide if the existing view containers should be re-mapped (default: true)" );
65 "Prefix to be used for all created output view containers" );
87 ATH_MSG_ERROR(
"Wrong user setup! You need to give a valid name for both the Input, Output, and SelectedViewContainers!");
88 return StatusCode::FAILURE;
95 const std::size_t totSize = 1 +
m_suffixes.value().size();
101 for ( std::size_t
i=1;
i<totSize; ++
i ) {
102 const std::string& currentSuffix =
m_suffixes.value()[
i-1];
103 ATH_MSG_VERBOSE(
"Using current suffix " << currentSuffix <<
" to search for matching containers");
104 if ( currentSuffix.rfind(
m_separator.value(),0 ) == 0 ) {
131 for ( std::size_t
i=0;
i<totSize; ++
i ) {
135 std::vector<std::string> inViewNames;
136 std::vector<std::string> outViewNames;
138 ATH_MSG_VERBOSE(
"Looking at input view container name: " << inViewName);
140 if (
pos == std::string::npos ){
142 inViewNames.push_back(inViewName);
143 outViewNames.push_back(
m_outPrefix.value() + inViewName );
144 ATH_MSG_VERBOSE(
"Added input name " << inViewNames.back() <<
" and output name " << outViewNames.back());
148 const std::string foundSuffix = inViewName.substr(
pos, std::string::npos);
152 inViewNames.push_back(inViewName);
153 outViewNames.push_back(
m_outPrefix.value() + inViewName );
154 ATH_MSG_VERBOSE(
"Added2 input name " << inViewNames.back() <<
" and output name " << outViewNames.back());
162 const std::string& currentSuffix =
m_suffixes.value()[
i-1];
164 std::vector<std::string> inViewNames;
165 std::vector<std::string> outViewNames;
167 ATH_MSG_VERBOSE(
"Looking at current input view container name: " << inViewName);
168 if ( inViewName.find(
m_separator.value()+currentSuffix) != std::string::npos ){
169 inViewNames.push_back(inViewName);
170 outViewNames.push_back(
m_outPrefix.value() + inViewName );
171 ATH_MSG_VERBOSE(
"Added3 input name " << inViewNames.back() <<
" and output name " << outViewNames.back());
186 ATH_MSG_VERBOSE(
" Have " << inViewNameList.size() <<
" in view elements and " << outViewNameList.size() <<
" out view elements");
187 for ( std::size_t j=0; j<inViewNameList.size(); ++j ){
189 const std::string& inName = inViewNameList[j];
190 const std::string&
outName = outViewNameList[j];
196 return StatusCode::SUCCESS;
205 return StatusCode::SUCCESS;
234 ATH_MSG_FATAL(
"We couldn't determine the type of the container... abort!");
235 return StatusCode::FAILURE;
246 if ( inContSize != inCont->size() ){
247 ATH_MSG_FATAL(
"The input container and its shallow copies don't have the same size! Aborting...");
248 return StatusCode::FAILURE;
255 std::vector<bool> keepParticleVec (inContSize,
false);
262 if ( inViewCont->
size() > inContSize ){
263 ATH_MSG_FATAL(
"One of the input view containers is larger than the input container... aborting.");
264 return StatusCode::FAILURE;
267 const std::size_t
idx =
part->index();
268 keepParticleVec[
idx] =
true;
274 ATH_CHECK( this->removeParticles<xAOD::PhotonContainer>(keepParticleVec) );
277 ATH_CHECK( this->removeParticles<xAOD::ElectronContainer>(keepParticleVec) );
280 ATH_CHECK( this->removeParticles<xAOD::MuonContainer>(keepParticleVec) );
283 ATH_CHECK( this->removeParticles<xAOD::TauJetContainer>(keepParticleVec) );
286 ATH_CHECK( this->removeParticles<xAOD::JetContainer>(keepParticleVec) );
289 ATH_CHECK( this->removeParticles<xAOD::TruthParticleContainer>(keepParticleVec) );
292 ATH_CHECK( this->removeParticles<xAOD::CompositeParticleContainer>(keepParticleVec) );
295 ATH_CHECK( this->removeParticles<xAOD::PFOContainer>(keepParticleVec) );
298 ATH_CHECK( this->removeParticles<xAOD::NeutralParticleContainer>(keepParticleVec) );
301 ATH_CHECK( this->removeParticles<xAOD::TrackParticleContainer>(keepParticleVec) );
304 ATH_CHECK( this->removeParticles<xAOD::ParticleContainer>(keepParticleVec) );
307 ATH_CHECK( this->removeParticles<xAOD::CaloClusterContainer>(keepParticleVec) );
310 return StatusCode::SUCCESS;