The Gaudi Framework  master (b9786168)
Loading...
Searching...
No Matches
IParticlePropertySvc.h
Go to the documentation of this file.
1/***********************************************************************************\
2* (c) Copyright 1998-2023 CERN for the benefit of the LHCb and ATLAS collaborations *
3* *
4* This software is distributed under the terms of the Apache version 2 licence, *
5* copied verbatim in the file "LICENSE". *
6* *
7* In applying this licence, CERN does not waive the privileges and immunities *
8* granted to it by virtue of its status as an Intergovernmental Organization *
9* or submit itself to any jurisdiction. *
10\***********************************************************************************/
11#pragma once
12
14#include <GaudiKernel/Kernel.h>
15#include <vector>
16
17namespace Gaudi {
18 class ParticleID;
19 class ParticleProperty;
20} // namespace Gaudi
21
22namespace Gaudi::Interfaces {
30 public:
32
34 typedef std::vector<const Gaudi::ParticleProperty*> ParticleProperties;
36 typedef ParticleProperties::const_iterator iterator;
37
42 virtual iterator begin() const = 0;
47 virtual iterator end() const = 0;
49 virtual size_t size() const = 0;
64 virtual const ParticleProperty* find( const std::string& name ) const = 0; // find by particle name
79 virtual const ParticleProperty* find( const Gaudi::ParticleID& pid ) const = 0; // find by Gaudi::ParticleID
80
113 template <class PREDICATE, class OUTPUT>
114 OUTPUT get( const PREDICATE& cut, OUTPUT output ) const;
115
131 virtual std::string cc( const std::string& decay ) const = 0;
132 };
133} // namespace Gaudi::Interfaces
134
135namespace Gaudi {
166 size_t index( const Gaudi::ParticleProperty* property, const Gaudi::Interfaces::IParticlePropertySvc* service );
167
197 size_t index( const Gaudi::ParticleID& pid, const Gaudi::Interfaces::IParticlePropertySvc* service );
198
227 const Gaudi::ParticleProperty* particle( const size_t index,
229
259
281
302 const Gaudi::ParticleProperty* byEvtGenName( const std::string& evtGen,
304
387 template <class INPUT, class PREDICATE, class OUTPUT>
388 OUTPUT get( INPUT first, INPUT last, const PREDICATE& cut, OUTPUT output ) {
389 for ( ; first != last; ++first ) {
390 if ( cut( *first ) ) {
391 *output = *first;
392 ++output;
393 }
394 }
395 return output;
396 }
397
475 template <class PREDICATE, class OUTPUT>
476 OUTPUT get( const Gaudi::Interfaces::IParticlePropertySvc* service, const PREDICATE& cut, OUTPUT output ) {
477 if ( 0 == service ) { return output; }
478 return service->get( cut, output );
479 }
480
487 } // namespace ParticleProperties
488
489 namespace Interfaces {
490 // get the properties according to some criteria
491 template <class PREDICATE, class OUTPUT>
492 OUTPUT IParticlePropertySvc::get( const PREDICATE& cut, OUTPUT output ) const {
493 iterator first = this->begin();
494 iterator last = this->end();
495 return Gaudi::ParticleProperties::get( first, last, cut, output );
496 }
497 } // namespace Interfaces
498} // namespace Gaudi
#define GAUDI_API
Definition Kernel.h:49
The abstract interface to Particle Property Service.
virtual const ParticleProperty * find(const Gaudi::ParticleID &pid) const =0
Retrieve an object by Gaudi::ParticleID:
OUTPUT get(const PREDICATE &cut, OUTPUT output) const
get the properties according to some criteria
virtual iterator begin() const =0
get the begin-iterator for the container of particle properties It is assumed that the container is p...
virtual iterator end() const =0
get the end-iterator for the container of particle properties It is assumed that the container is pro...
virtual size_t size() const =0
get the container size.
DeclareInterfaceID(Gaudi::Interfaces::IParticlePropertySvc, 2, 0)
ParticleProperties::const_iterator iterator
the actual type of iterator over the (ordered) container of properties
virtual const ParticleProperty * find(const std::string &name) const =0
Retrieve an object by name:
std::vector< const Gaudi::ParticleProperty * > ParticleProperties
the actual type of (ordered) container of particle properties
virtual std::string cc(const std::string &decay) const =0
make the charge conjugation for the string/decay descriptor
Holds PDG + LHCb extension particle code, following the PDG particle numbering scheme (pdg....
Definition ParticleID.h:43
A trivial class to hold information about a single particle properties.
const Gaudi::ParticleProperty * byPythiaID(const int pythia, const Gaudi::Interfaces::IParticlePropertySvc *svc)
mapping by pythiaID
size_t index(const Gaudi::ParticleProperty *property, const Gaudi::Interfaces::IParticlePropertySvc *service)
helper utility for mapping of Gaudi::ParticleProperty object into non-negative integral sequential id...
Gaudi::Interfaces::IParticlePropertySvc::ParticleProperties allProperties(const Gaudi::Interfaces::IParticlePropertySvc *service)
get all the properties at once
OUTPUT get(INPUT first, INPUT last, const PREDICATE &cut, OUTPUT output)
get all particle properties which satisfy the certain criteria
const Gaudi::ParticleProperty * particle(const size_t index, const Gaudi::Interfaces::IParticlePropertySvc *service)
the inverse mapping of the integer sequential number onto Gaudi::ParticleID object
const Gaudi::ParticleProperty * byEvtGenName(const std::string &evtGen, const Gaudi::Interfaces::IParticlePropertySvc *svc)
mapping by EvtGen-name
const Gaudi::ParticleID particleID(const size_t index, const Gaudi::Interfaces::IParticlePropertySvc *service)
the inverse mapping of the integer sequential number onto Gaudi::ParticleID object
This file provides a Grammar for the type Gaudi::Accumulators::Axis It allows to use that type from p...
Definition __init__.py:1
Base class to be used to extend an interface.