|
ATLAS Offline Software
|
Go to the documentation of this file.
16 #include "Gaudi/Property.h"
59 ISvcLocator* pSvcLocator ) :
62 m_evtInfoName(
"EventInfo"),
65 m_writeSplitAux(true),
66 m_outOwnPolicyName(
"VIEW_ELEMENTS"),
71 m_nEventsProcessed(0),
81 "The name of the output container with the deep copy of selected xAOD::IParticles");
83 "Decide if we want to write a fully-split AuxContainer such that we can remove any variables");
85 "Defines the ownership policy of the output container (default: 'OWN_ELEMENTS'; also allowed: 'VIEW_ELEMENTS')");
89 "The selection string that defines which xAOD::IParticles to select from the container");
92 "If true (deault: false), do the bookkeeping of how many particles passed which selection cuts");
94 "The name of the resulting xAOD::CutBookkeeperContainer");
141 return StatusCode::FAILURE;
148 return StatusCode::SUCCESS;
162 return StatusCode::SUCCESS;
175 std::string inputStreamName =
"Stream";
177 std::vector<std::string> streamNameList;
179 if ( streamNameList.size() >=1 ){ inputStreamName = streamNameList[0]; }
181 int maxInputCycle = -1;
186 maxInputCycle = inCutBKCont->
maxCycle();
189 if (maxInputCycle<0){ maxInputCycle = 0; }
190 else { maxInputCycle += 1; }
204 cutBKCont->setStore( cutBKAuxCont );
213 for ( std::size_t toolIdx=0; toolIdx <
m_selTools.size(); ++toolIdx ){
219 const std::string toolName =
tool->name();
221 const unsigned int nCuts = acceptInfo.
getNCuts();
222 for (
unsigned int iCut=0; iCut<nCuts; ++iCut ){
224 const std::string cutName = acceptInfo.
getCutName(iCut);
230 cutBK->
setName(toolName+
"_"+cutName);
232 cutBK->
setCutLogic(xAOD::CutBookkeeper::CutLogic::REQUIRE);
246 cutBK->
setCutLogic(xAOD::CutBookkeeper::CutLogic::REQUIRE);
252 return StatusCode::SUCCESS;
282 ATH_MSG_FATAL(
"We couldn't determine the type of the container... abort!");
283 return StatusCode::FAILURE;
290 <<
" retrieved from StoreGate which has " << inContainer->
size() <<
" entries." );
295 std::vector<int> resultVec;
296 resultVec.reserve(inContainer->
size());
298 resultVec =
m_parser->evaluateAsVector();
300 if ( inContainer->
size() != resultVec.size() ) {
302 <<
") doesn't match the size of the result vector: " << resultVec.size() );
303 return StatusCode::FAILURE;
306 <<
" and a result vector of size " << resultVec.size() );
314 ATH_CHECK( (this->selectParticles<xAOD::PhotonContainer,xAOD::PhotonAuxContainer>(inContainer,resultVec)) );
317 ATH_CHECK( (this->selectParticles<xAOD::ElectronContainer,xAOD::ElectronAuxContainer>(inContainer,resultVec)) );
320 ATH_CHECK( (this->selectParticles<xAOD::MuonContainer,xAOD::MuonAuxContainer>(inContainer,resultVec)) );
323 ATH_CHECK( (this->selectParticles<xAOD::TauJetContainer,xAOD::TauJetAuxContainer>(inContainer,resultVec)) );
326 ATH_CHECK( (this->selectParticles<xAOD::JetContainer,xAOD::JetAuxContainer>(inContainer,resultVec)) );
329 ATH_CHECK( (this->selectParticles<xAOD::TruthParticleContainer,xAOD::TruthParticleAuxContainer>(inContainer,resultVec)) );
332 ATH_CHECK( (this->selectParticles<xAOD::CompositeParticleContainer,xAOD::CompositeParticleAuxContainer>(inContainer,resultVec)) );
335 ATH_CHECK( (this->selectParticles<xAOD::PFOContainer,xAOD::PFOAuxContainer>(inContainer,resultVec)) );
338 ATH_CHECK( (this->selectParticles<xAOD::NeutralParticleContainer,xAOD::NeutralParticleAuxContainer>(inContainer,resultVec)) );
341 ATH_CHECK( (this->selectParticles<xAOD::TrackParticleContainer,xAOD::TrackParticleAuxContainer>(inContainer,resultVec)) );
344 ATH_CHECK( (this->selectParticles<xAOD::ParticleContainer,xAOD::ParticleAuxContainer>(inContainer,resultVec)) );
347 ATH_CHECK( (this->selectParticles<xAOD::CaloClusterContainer,xAOD::CaloClusterAuxContainer>(inContainer,resultVec)) );
350 return StatusCode::SUCCESS;
def retrieve(aClass, aKey=None)
StringProperty m_cutBKCName
The name of the resulting xAOD::CutBookkeeperContainer.
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.
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.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
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.
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)
StringProperty m_inCollKey
Input container name.
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)
StringProperty m_outOwnPolicyName
Defines the ownership policy of the output container (default: 'VIEW_ELEMENTS'; also allowed: 'OWN_EL...
static const CLID & ID()
the CLID of T
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.
CutBookkeeperAuxContainer_v1 CutBookkeeperAuxContainer
Define the latest version of the CutBookkeeperAuxContainer class.
StringProperty m_outCollKey
Output collection name (deep copies of the original ones)
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.
bool m_doCutFlow
If true (deault: 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:
StringProperty m_evtInfoName
Name of the EventInfo object.
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...
BooleanProperty m_writeSplitAux
Decide if we want to write a fully-split AuxContainer such that we can remove any variables.
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.
StringProperty m_selection
The selection string that will select which xAOD::IParticles to keep from an xAOD::IParticleContainer...