33 template<
typename Type> StatusCode AsgViewFromSelectionAlg ::
36 const Type *input =
nullptr;
39 for (
const auto particle : *input)
44 if ((accessor.first->getBits (*particle) | accessor.second) !=
selectionAccept())
52 viewCopy->push_back (particle);
77 return StatusCode::SUCCESS;
81 auto deepCopy = std::make_unique<Type> ();
82 auto aux = std::make_unique<xAOD::AuxContainerBase> ();
83 deepCopy->setStore (aux.get());
84 deepCopy->reserve (viewCopy->size());
85 for (
auto particle : *viewCopy)
87 auto pcopy = std::make_unique<typename Type::base_value_type> ();
88 typename Type::value_type pcopyPtr = pcopy.get();
89 deepCopy->push_back (std::move (pcopy));
90 *pcopyPtr = *particle;
99 return StatusCode::SUCCESS;
105 StatusCode AsgViewFromSelectionAlg ::
112 return StatusCode::SUCCESS;
160 ANA_MSG_ERROR (
"unknown type contained in AsgViewFromSelectionAlg, please extend it");
161 return StatusCode::FAILURE;
169 StatusCode AsgViewFromSelectionAlg ::
172 return StatusCode::SUCCESS;
178 StatusCode AsgViewFromSelectionAlg ::
188 ANA_MSG_ERROR (
"ignore property can't have more properties than selection property");
189 return StatusCode::FAILURE;
191 for (std::size_t iter = 0, end =
m_selection.size(); iter != end; ++ iter)
196 std::unique_ptr<ISelectionReadAccessor> accessor;
198 m_accessors.push_back (std::make_pair (std::move (accessor), ignore));
201#ifndef XAOD_STANDALONE
204 std::function<void(
const DataObjID&, Gaudi::DataHandle::Mode)> addAlgDependency = [
this] (
const DataObjID& id, Gaudi::DataHandle::Mode mode) {
205 this->addDependency(
id, mode);
214 return StatusCode::SUCCESS;
219 StatusCode AsgViewFromSelectionAlg ::
220 execute (
const EventContext& )
226 return StatusCode::SUCCESS;
DataVector adapter that acts like it holds const pointers.
uint32_t CLID
The Class ID type.
ServiceHandle< StoreGateSvc > & evtStore()
Gaudi::Property< std::vector< std::string > > m_selection
StatusCode executeTemplate(const CP::SystematicSet &sys)
the templated version of execute for a single systematic
Gaudi::Property< bool > m_sortPt
Sort the output (view) container by pT.
Gaudi::Property< std::size_t > m_sizeLimit
StatusCode(AsgViewFromSelectionAlg::* m_function)(const CP::SystematicSet &sys)
SysReadHandle< xAOD::IParticleContainer > m_inputHandle
the input collection we run on
Gaudi::Property< bool > m_allowMissing
Allow the input container to be missing.
StatusCode executeMissing(const CP::SystematicSet &sys)
The version of execute for missing input containers.
SysWriteHandle< xAOD::IParticleContainer > m_outputHandle
the output view container we produce
Gaudi::Property< std::vector< SelectionType > > m_ignore
Gaudi::Property< bool > m_deepCopy
Perform a deep copy for creating the output container.
std::vector< std::pair< std::unique_ptr< ISelectionReadAccessor >, SelectionType > > m_accessors
the list of accessors and cut ignore list
SysListHandle m_systematicsList
the systematics list we run
Class to wrap a set of SystematicVariations.
Class providing the definition of the 4-vector interface.
Workaround x86 precision issues for FP inequality comparisons.
bool contains(const std::string &s, const std::string ®x)
does a string contain the substring
CLID getClidForDependency(const std::string &typeName, const std::string &decoName, bool decoWrite)
StatusCode addSysDependency(MsgStream &msg, const ISystematicsSvc &svc, const std::function< void(const DataObjID &, Gaudi::DataHandle::Mode)> &addAlgDependency, const CLID clid, const std::string &name, Gaudi::DataHandle::Mode mode, const std::string &decoName, bool decoWrite)
Select isolated Photons, Electrons and Muons.
StatusCode makeSelectionReadAccessor(const std::string &expr, std::unique_ptr< ISelectionReadAccessor > &accessor, bool defaultToChar)
make the ISelectionReadAccessor for the given name
uint32_t SelectionType
the type for selection decorations that are meant to hold a asg::AcceptData
constexpr SelectionType selectionAccept()
the selection decoration to apply for objects that are selected
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
PhotonContainer_v1 PhotonContainer
Definition of the current "photon container version".
ElectronContainer_v1 ElectronContainer
Definition of the current "electron container version".
DiTauJetContainer_v1 DiTauJetContainer
Definition of the current DiTauJet container version.
TrackParticleContainer_v1 TrackParticleContainer
Definition of the current "TrackParticle container version".
JetContainer_v1 JetContainer
Definition of the current "jet container version".
TauJetContainer_v3 TauJetContainer
Definition of the current "taujet container version".
MuonContainer_v1 MuonContainer
Definition of the current "Muon container version".
TruthParticleContainer_v1 TruthParticleContainer
Declare the latest version of the truth particle container.
DataVector< IParticle > IParticleContainer
Simple convenience declaration of IParticleContainer.