ATLAS Offline Software
ParticleSelectionAlg.h
Go to the documentation of this file.
1 
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>
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 
113  enum contType_t {
127  };
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.
148 #include "ParticleSelectionAlg.icc"
149 
150 
151 #endif //> !EVENTUTILS_PARTICLESELECTIONALG_H
ParticleSelectionAlg::m_outOwnPolicyName
Gaudi::Property< std::string > m_outOwnPolicyName
Defines the ownership policy of the output container.
Definition: ParticleSelectionAlg.h:87
ParticleSelectionAlg::TAU
@ TAU
Definition: ParticleSelectionAlg.h:118
ParticleSelectionAlg::JET
@ JET
Definition: ParticleSelectionAlg.h:119
ParticleSelectionAlg::m_selToolIdxOffset
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...
Definition: ParticleSelectionAlg.h:137
ParticleSelectionAlg::m_writeSplitAux
Gaudi::Property< bool > m_writeSplitAux
Decide if we want to write a fully-split AuxContainer such that we can remove any variables.
Definition: ParticleSelectionAlg.h:84
ParticleSelectionAlg::ParticleSelectionAlg
ParticleSelectionAlg(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
Definition: ParticleSelectionAlg.cxx:58
ParticleSelectionAlg::ELECTRON
@ ELECTRON
Definition: ParticleSelectionAlg.h:116
SG::VIEW_ELEMENTS
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
Definition: OwnershipPolicy.h:18
ParticleSelectionAlg::m_nEventsProcessed
unsigned long m_nEventsProcessed
Internal event counter.
Definition: ParticleSelectionAlg.h:107
ExpressionParserUser.h
ParticleSelectionAlg::m_contType
contType_t m_contType
The variable that holds the value that we find for the input container.
Definition: ParticleSelectionAlg.h:130
ParticleSelectionAlg::m_selection
Gaudi::Property< std::string > m_selection
The selection string that will select which xAOD::IParticles to keep from an xAOD::IParticleContainer...
Definition: ParticleSelectionAlg.h:91
ParticleSelectionAlg::m_evtInfoName
Gaudi::Property< std::string > m_evtInfoName
Name of the EventInfo object.
Definition: ParticleSelectionAlg.h:75
ParticleSelectionAlg::UNKNOWN
@ UNKNOWN
Definition: ParticleSelectionAlg.h:114
ParticleSelectionAlg::m_cutBKCName
Gaudi::Property< std::string > m_cutBKCName
The name of the resulting xAOD::CutBookkeeperContainer.
Definition: ParticleSelectionAlg.h:99
ParticleSelectionAlg::m_selTools
ToolHandleArray< IAsgSelectionTool > m_selTools
The list of IAsgSelectionTools.
Definition: ParticleSelectionAlg.h:72
ParticleSelectionAlg::selectParticles
StatusCode selectParticles(const xAOD::IParticleContainer *inContainer, const std::vector< int > &resultVec) const
Private function to perform the actualy work.
ParticleSelectionAlg::TRACKPARTICLE
@ TRACKPARTICLE
Definition: ParticleSelectionAlg.h:122
IAsgSelectionTool.h
ParticleSelectionAlg::execute
virtual StatusCode execute() override
Athena algorithm's execute hook.
Definition: ParticleSelectionAlg.cxx:226
SG::OwnershipPolicy
OwnershipPolicy
describes the possible element ownership policies (see e.g. DataVector)
Definition: OwnershipPolicy.h:16
ParticleSelectionAlg::CALOCLUSTER
@ CALOCLUSTER
Definition: ParticleSelectionAlg.h:126
ParticleSelectionAlg::TRUTHPARTICLE
@ TRUTHPARTICLE
Definition: ParticleSelectionAlg.h:123
ParticleSelectionAlg.icc
ParticleSelectionAlg::PARITCLEFLOW
@ PARITCLEFLOW
Definition: ParticleSelectionAlg.h:120
ParticleSelectionAlg::m_outOwnPolicy
SG::OwnershipPolicy m_outOwnPolicy
The internally used translation for the ownership policy.
Definition: ParticleSelectionAlg.h:110
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
IParticleContainer.h
ParticleSelectionAlg::m_outCollKey
Gaudi::Property< std::string > m_outCollKey
Output collection name (deep copies of the original ones)
Definition: ParticleSelectionAlg.h:81
ParticleSelectionAlg::COMPOSITEPARTICLE
@ COMPOSITEPARTICLE
Definition: ParticleSelectionAlg.h:124
ParticleSelectionAlg::m_inCollKey
Gaudi::Property< std::string > m_inCollKey
Input container name.
Definition: ParticleSelectionAlg.h:78
AthAnalysisAlgorithm.h
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
ParticleSelectionAlg::m_doCutFlow
Gaudi::Property< bool > m_doCutFlow
If true (default: false), do the bookkeeping of how many particles passed which selection cuts.
Definition: ParticleSelectionAlg.h:95
ExpressionParserUser
Definition: ExpressionParserUser.h:107
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
ParticleSelectionAlg::NEUTRALPARTICLE
@ NEUTRALPARTICLE
Definition: ParticleSelectionAlg.h:121
ParticleSelectionAlg::PHOTON
@ PHOTON
Definition: ParticleSelectionAlg.h:115
ParticleSelectionAlg::start
virtual StatusCode start() override
Athena algorithm's beginRun hook (called once before running over the events, after initialize)
Definition: ParticleSelectionAlg.cxx:135
ParticleSelectionAlg::~ParticleSelectionAlg
virtual ~ParticleSelectionAlg()
Destructor:
Definition: ParticleSelectionAlg.cxx:69
ParticleSelectionAlg::MUON
@ MUON
Definition: ParticleSelectionAlg.h:117
ParticleSelectionAlg::initialize
virtual StatusCode initialize() override
Athena algorithm's initalize hook.
Definition: ParticleSelectionAlg.cxx:76
ParticleSelectionAlg::PARTICLE
@ PARTICLE
Definition: ParticleSelectionAlg.h:125
ParticleSelectionAlg::contType_t
contType_t
An enumaration for the actual container type.
Definition: ParticleSelectionAlg.h:113
ParticleSelectionAlg
Definition: ParticleSelectionAlg.h:31
ParticleSelectionAlg::m_idxSelParster
std::size_t m_idxSelParster
Store the index of the CutBookKeeper in the CutBookkeeperContainer for the selection using the Expres...
Definition: ParticleSelectionAlg.h:141
ParticleSelectionAlg::finalize
virtual StatusCode finalize() override
Athena algorithm's finalize hook.
Definition: ParticleSelectionAlg.cxx:121
ParticleSelectionAlg::m_cutBKStartIdx
std::size_t m_cutBKStartIdx
The starting index of where in the CutBookkeeperContainer our new CutBookkeepers start.
Definition: ParticleSelectionAlg.h:133