ATLAS Offline Software
Loading...
Searching...
No Matches
ParticleSelectionAlg.h
Go to the documentation of this file.
1
2
3/*
4 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
5*/
6
7// ParticleSelectionAlg.h
8// Header file for class ParticleSelectionAlg
9// Author: Karsten Koeneke <karsten.koeneke@cern.ch>
11#ifndef EVENTUTILS_PARTICLESELECTIONALG_H
12#define EVENTUTILS_PARTICLESELECTIONALG_H 1
13
14// FrameWork includes
15#include "GaudiKernel/ToolHandle.h"
16// #include "GaudiKernel/ServiceHandle.h"
17// #include "AthenaBaseComps/AthAlgorithm.h"
21
22// STL includes
23#include <string>
24#include <vector>
25
27
28
30 : public ExpressionParserUser<::AthAnalysisAlgorithm>
31{
32
34 // Public methods:
36 public:
37
38 // Copy constructor:
39
41 ParticleSelectionAlg( const std::string& name, ISvcLocator* pSvcLocator );
42
44 virtual ~ParticleSelectionAlg();
45
46
48 virtual StatusCode initialize() override;
49
52 virtual StatusCode start() override;
53
55 virtual StatusCode execute() override;
56
58 virtual StatusCode finalize() override;
59
60 private:
62 template<class CONT, class AUXCONT>
63 StatusCode selectParticles(const xAOD::IParticleContainer* inContainer,
64 const std::vector<int>& resultVec) const;
65
66
68 // Private data:
70 private:
72 ToolHandleArray<IAsgSelectionTool> m_selTools;
73
75 Gaudi::Property<std::string> m_evtInfoName{this, "EventInfo", "EventInfo", "Input container name"};
76
78 Gaudi::Property<std::string> m_inCollKey{this, "InputContainer", "", "Input container name"};
79
81 Gaudi::Property<std::string> m_outCollKey{this, "OutputContainer", "", "The name of the output container with the deep copy of selected xAOD::IParticles"};
82
84 Gaudi::Property<bool> m_writeSplitAux{this, "WriteSplitOutputContainer", true, "Decide if we want to write a fully-split AuxContainer such that we can remove any variables"};
85
87 Gaudi::Property<std::string> m_outOwnPolicyName{this, "OutputContainerOwnershipPolicy", "VIEW_ELEMENTS", "Defines the ownership policy of the output container"};
88
91 Gaudi::Property<std::string> m_selection{this, "Selection", "", "The selection string that defines which xAOD::IParticles to select from the container"};
92
95 Gaudi::Property<bool> m_doCutFlow{this, "DoCutBookkeeping", false, "If true, do the bookkeeping of how many particles passed which selection cuts"};
96
99 Gaudi::Property<std::string> m_cutBKCName{this, "CutBookkeeperContainer", name(), "The name of the resulting xAOD::CutBookkeeperContainer"};
100
101
102
105
107 unsigned long m_nEventsProcessed{0};
108
111
128
131
133 std::size_t m_cutBKStartIdx{0};
134
137 std::vector<std::size_t> m_selToolIdxOffset;
138
141 std::size_t m_idxSelParster{0};
142
144
145};
146
147// Include the templated code here. This must be done from this header file.
149
150
151#endif //> !EVENTUTILS_PARTICLESELECTIONALG_H
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.
contType_t
An enumaration for the actual container type.
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.
OwnershipPolicy
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
DataVector< IParticle > IParticleContainer
Simple convenience declaration of IParticleContainer.