16#include "Gaudi/Property.h"
59 ISvcLocator* pSvcLocator ) :
109 return StatusCode::FAILURE;
115 ATH_MSG_DEBUG (
"==> done with initialize " << name() <<
"..." );
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 ){
182 const ToolHandle<IAsgSelectionTool>& tool =
m_selTools[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);
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() );
318 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
This file contains the class definition for the EventStreamInfo class.
uint32_t CLID
The Class ID type.
const ServiceHandle< StoreGateSvc > & outputMetaStore() const
Const accessor for the output metadata store.
const ServiceHandle< StoreGateSvc > & inputMetaStore() const
Const accessor for the input metadata store.
AthAnalysisAlgorithm(const std::string &name)
Constructor taking just a name.
ServiceHandle< StoreGateSvc > & evtStore()
value_type push_back(value_type pElem)
Add an element to the end of the collection.
size_type size() const noexcept
Returns the number of elements in the collection.
StatusCode finalizeParser()
std::conditional< 1==1, std::unique_ptr< ExpressionParsing::ExpressionParser >, std::array< std::unique_ptr< ExpressionParsing::ExpressionParser >, 1 > >::type m_parser
ExpressionParserUser(Args &&...args)
StatusCode initializeParser(const ExpressionParsing::SelectionArg< 1 > &selection_string)
virtual StatusCode execute() override
Athena algorithm's execute hook.
virtual StatusCode start() override
Athena algorithm's beginRun hook (called once before running over the events, after initialize)
Gaudi::Property< std::string > m_outOwnPolicyName
Defines the ownership policy of the output container.
contType_t m_contType
The variable that holds the value that we find for the input container.
ToolHandleArray< IAsgSelectionTool > m_selTools
The list of IAsgSelectionTools.
Gaudi::Property< std::string > m_evtInfoName
Name of the EventInfo object.
std::size_t m_idxSelParster
Store the index of the CutBookKeeper in the CutBookkeeperContainer for the selection using the Expres...
SG::OwnershipPolicy m_outOwnPolicy
The internally used translation for the ownership policy.
virtual StatusCode finalize() override
Athena algorithm's finalize hook.
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...
virtual StatusCode initialize() override
Athena algorithm's initalize hook.
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_inCollKey
Input container name.
Gaudi::Property< bool > m_doCutFlow
If true (default: false), do the bookkeeping of how many particles passed which selection cuts.
Gaudi::Property< std::string > m_outCollKey
Output collection name (deep copies of the original ones)
ParticleSelectionAlg(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
unsigned long m_nEventsProcessed
Internal event counter.
Gaudi::Property< std::string > m_cutBKCName
The name of the resulting xAOD::CutBookkeeperContainer.
std::size_t m_cutBKStartIdx
The starting index of where in the CutBookkeeperContainer our new CutBookkeepers start.
virtual ~ParticleSelectionAlg()
Destructor:
StatusCode selectParticles(const xAOD::IParticleContainer *inContainer, const std::vector< int > &resultVec) const
Private function to perform the actualy work.
Gaudi::Property< bool > m_writeSplitAux
Decide if we want to write a fully-split AuxContainer such that we can remove any variables.
size_t index() const
Return the index of this element within its container.
unsigned int getNCuts() const
Get the number of cuts defined.
const std::string & getCutName(unsigned int cutPosition) const
Get the name of a cut, based on the cut position (slow, avoid usage)
const std::string & getCutDescription(const std::string &cutName) const
Get the description of a cut, based on the cut name.
int maxCycle() const
Get the maximum cycle number of any xAOD::CutBookkeepers in the container.
void setName(const std::string &name)
Set the name of this CutBookkeeper.
void setDescription(const std::string &description)
Set the description of this CutBookkeeper.
void setCutLogic(CutLogic logic)
Set the cut logic of this CutBookkeeper, e.g., ACCEPT, REQUIRE, VETO.
void setInputStream(const std::string &inputstream)
Set the name of the current input-file stream object for this CutBookkeeper.
void setCycle(int cycle)
Set the skimming cycle that this CutBookkeeper is running in.
bool contains(const std::string &s, const std::string ®x)
does a string contain the substring
@ OWN_ELEMENTS
this data object owns its elements
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
CutBookkeeperAuxContainer_v1 CutBookkeeperAuxContainer
Define the latest version of the CutBookkeeperAuxContainer class.
CutBookkeeper_v1 CutBookkeeper
Define the latest version of the CutBookkeeper class.
DataVector< IParticle > IParticleContainer
Simple convenience declaration of IParticleContainer.
CutBookkeeperContainer_v1 CutBookkeeperContainer
Define the latest version of the CutBookkeeperContainer class.