 |
ATLAS Offline Software
|
Go to the documentation of this file.
16 #include "Gaudi/Property.h"
59 ISvcLocator* pSvcLocator ) :
109 return StatusCode::FAILURE;
116 return StatusCode::SUCCESS;
130 return StatusCode::SUCCESS;
143 std::string inputStreamName =
"Stream";
145 std::vector<std::string> streamNameList;
147 if ( streamNameList.size() >=1 ){ inputStreamName = streamNameList[0]; }
149 int maxInputCycle = -1;
154 maxInputCycle = inCutBKCont->
maxCycle();
157 if (maxInputCycle<0){ maxInputCycle = 0; }
158 else { maxInputCycle += 1; }
172 cutBKCont->setStore( cutBKAuxCont );
181 for ( std::size_t toolIdx=0; toolIdx <
m_selTools.size(); ++toolIdx ){
187 const std::string toolName =
tool->name();
189 const unsigned int nCuts = acceptInfo.
getNCuts();
190 for (
unsigned int iCut=0; iCut<nCuts; ++iCut ){
192 const std::string cutName = acceptInfo.
getCutName(iCut);
198 cutBK->
setName(toolName+
"_"+cutName);
200 cutBK->
setCutLogic(xAOD::CutBookkeeper::CutLogic::REQUIRE);
214 cutBK->
setCutLogic(xAOD::CutBookkeeper::CutLogic::REQUIRE);
220 return StatusCode::SUCCESS;
250 ATH_MSG_FATAL(
"We couldn't determine the type of the container... abort!");
251 return StatusCode::FAILURE;
258 <<
" retrieved from StoreGate which has " << inContainer->
size() <<
" entries." );
263 std::vector<int> resultVec;
264 resultVec.reserve(inContainer->
size());
266 resultVec =
m_parser->evaluateAsVector();
268 if ( inContainer->
size() != resultVec.size() ) {
270 <<
") doesn't match the size of the result vector: " << resultVec.size() );
271 return StatusCode::FAILURE;
274 <<
" and a result vector of size " << resultVec.size() );
282 ATH_CHECK( (this->selectParticles<xAOD::PhotonContainer,xAOD::PhotonAuxContainer>(inContainer,resultVec)) );
285 ATH_CHECK( (this->selectParticles<xAOD::ElectronContainer,xAOD::ElectronAuxContainer>(inContainer,resultVec)) );
288 ATH_CHECK( (this->selectParticles<xAOD::MuonContainer,xAOD::MuonAuxContainer>(inContainer,resultVec)) );
291 ATH_CHECK( (this->selectParticles<xAOD::TauJetContainer,xAOD::TauJetAuxContainer>(inContainer,resultVec)) );
294 ATH_CHECK( (this->selectParticles<xAOD::JetContainer,xAOD::JetAuxContainer>(inContainer,resultVec)) );
297 ATH_CHECK( (this->selectParticles<xAOD::TruthParticleContainer,xAOD::TruthParticleAuxContainer>(inContainer,resultVec)) );
300 ATH_CHECK( (this->selectParticles<xAOD::CompositeParticleContainer,xAOD::CompositeParticleAuxContainer>(inContainer,resultVec)) );
303 ATH_CHECK( (this->selectParticles<xAOD::PFOContainer,xAOD::PFOAuxContainer>(inContainer,resultVec)) );
306 ATH_CHECK( (this->selectParticles<xAOD::NeutralParticleContainer,xAOD::NeutralParticleAuxContainer>(inContainer,resultVec)) );
309 ATH_CHECK( (this->selectParticles<xAOD::TrackParticleContainer,xAOD::TrackParticleAuxContainer>(inContainer,resultVec)) );
312 ATH_CHECK( (this->selectParticles<xAOD::ParticleContainer,xAOD::ParticleAuxContainer>(inContainer,resultVec)) );
315 ATH_CHECK( (this->selectParticles<xAOD::CaloClusterContainer,xAOD::CaloClusterAuxContainer>(inContainer,resultVec)) );
318 return StatusCode::SUCCESS;
def retrieve(aClass, aKey=None)
Gaudi::Property< std::string > m_outOwnPolicyName
Defines the ownership policy of the output container.
StatusCode finalizeParser()
CutBookkeeperContainer_v1 CutBookkeeperContainer
Define the latest version of the CutBookkeeperContainer class.
Auxiliary container for CutBookkeeper containers.
const ServiceHandle< StoreGateSvc > & outputMetaStore() const
Const accessor for the output metadata store.
void setCycle(int cycle)
Set the skimming cycle that this CutBookkeeper is running in.
void setName(const std::string &name)
Set the name of this CutBookkeeper.
std::vector< std::size_t > m_selToolIdxOffset
The list of pairs of the tool index of the AsgSelectionTools and the starting index of the correspond...
void setDescription(const std::string &description)
Set the description of this CutBookkeeper.
Gaudi::Property< bool > m_writeSplitAux
Decide if we want to write a fully-split AuxContainer such that we can remove any variables.
ParticleSelectionAlg(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
unsigned long m_nEventsProcessed
Internal event counter.
Description of the class that is used to keep track of event counts.
std::conditional< NUM_PARSER==1, std::unique_ptr< ExpressionParsing::ExpressionParser >, std::array< std::unique_ptr< ExpressionParsing::ExpressionParser >, NUM_PARSER > >::type m_parser
contType_t m_contType
The variable that holds the value that we find for the input container.
Gaudi::Property< std::string > m_selection
The selection string that will select which xAOD::IParticles to keep from an xAOD::IParticleContainer...
Gaudi::Property< std::string > m_evtInfoName
Name of the EventInfo object.
Gaudi::Property< std::string > m_cutBKCName
The name of the resulting xAOD::CutBookkeeperContainer.
ToolHandleArray< IAsgSelectionTool > m_selTools
The list of IAsgSelectionTools.
const ServiceHandle< StoreGateSvc > & inputMetaStore() const
Const accessor for the input metadata store.
#define ATH_MSG_VERBOSE(x)
virtual StatusCode execute() override
Athena algorithm's execute hook.
This file contains the class definition for the EventStreamInfo class.
const std::string & getCutName(unsigned int cutPosition) const
Get the name of a cut, based on the cut position (slow, avoid usage)
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
@ OWN_ELEMENTS
this data object owns its elements
SG::OwnershipPolicy m_outOwnPolicy
The internally used translation for the ownership policy.
::StatusCode StatusCode
StatusCode definition for legacy code.
unsigned int getNCuts() const
Get the number of cuts defined.
int maxCycle() const
Get the maximum cycle number of any xAOD::CutBookkeepers in the container.
Gaudi::Property< std::string > m_outCollKey
Output collection name (deep copies of the original ones)
CutBookkeeperAuxContainer_v1 CutBookkeeperAuxContainer
Define the latest version of the CutBookkeeperAuxContainer class.
Gaudi::Property< std::string > m_inCollKey
Input container name.
Container that holds the Container of all CutBookkeepers.
size_t index() const
Return the index of this element within its container.
uint32_t CLID
The Class ID type.
Gaudi::Property< bool > m_doCutFlow
If true (default: false), do the bookkeeping of how many particles passed which selection cuts.
StatusCode initializeParser(const ExpressionParsing::SelectionArg< 1 > &selection_string)
void setInputStream(const std::string &inputstream)
Set the name of the current input-file stream object for this CutBookkeeper.
CutBookkeeper_v1 CutBookkeeper
Define the latest version of the CutBookkeeper class.
virtual StatusCode start() override
Athena algorithm's beginRun hook (called once before running over the events, after initialize)
value_type push_back(value_type pElem)
Add an element to the end of the collection.
void setCutLogic(CutLogic logic)
Set the cut logic of this CutBookkeeper, e.g., ACCEPT, REQUIRE, VETO.
virtual ~ParticleSelectionAlg()
Destructor:
virtual StatusCode initialize() override
Athena algorithm's initalize hook.
std::size_t m_idxSelParster
Store the index of the CutBookKeeper in the CutBookkeeperContainer for the selection using the Expres...
virtual StatusCode finalize() override
Athena algorithm's finalize hook.
size_type size() const noexcept
Returns the number of elements in the collection.
std::size_t m_cutBKStartIdx
The starting index of where in the CutBookkeeperContainer our new CutBookkeepers start.
const std::string & getCutDescription(const std::string &cutName) const
Get the description of a cut, based on the cut name.