The Gaudi Framework  master (37c0b60a)
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 
13 #include <GaudiKernel/IInterface.h>
14 #include <GaudiKernel/Kernel.h>
15 #include <vector>
16 
17 namespace Gaudi {
18  class ParticleID;
19  class ParticleProperty;
20 } // namespace Gaudi
21 
22 namespace Gaudi::Interfaces {
29  class GAUDI_API IParticlePropertySvc : public extend_interfaces<IInterface> {
30  public:
32 
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 
135 namespace Gaudi {
136  namespace ParticleProperties {
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 
258  const Gaudi::ParticleID particleID( const size_t index, const Gaudi::Interfaces::IParticlePropertySvc* service );
259 
280  const Gaudi::ParticleProperty* byPythiaID( const int pythia, const Gaudi::Interfaces::IParticlePropertySvc* svc );
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
Gaudi::Interfaces::IParticlePropertySvc::end
virtual iterator end() const =0
get the end-iterator for the container of particle properties It is assumed that the container is pro...
Gaudi::Interfaces
Definition: IFileSvc.h:20
std::string
STL class.
ParticleID
Definition: ParticleID.py:1
Gaudi::ParticleProperties::get
OUTPUT get(INPUT first, INPUT last, const PREDICATE &cut, OUTPUT output)
get all particle properties which satisfy the certain criteria
Definition: IParticlePropertySvc.h:388
Gaudi::ParticleProperties::allProperties
Gaudi::Interfaces::IParticlePropertySvc::ParticleProperties allProperties(const Gaudi::Interfaces::IParticlePropertySvc *service)
get all the properties at once
Definition: IParticlePropertySvc.cpp:201
std::vector
STL class.
ParticleProperty
Definition: ParticleProperty.py:1
Gaudi::Interfaces::IParticlePropertySvc
Definition: IParticlePropertySvc.h:29
extend_interfaces
Base class to be used to extend an interface.
Definition: extend_interfaces.h:15
gaudirun.output
output
Definition: gaudirun.py:521
Gaudi::Interfaces::IParticlePropertySvc::iterator
ParticleProperties::const_iterator iterator
the actual type of iterator over the (ordered) container of properties
Definition: IParticlePropertySvc.h:36
Gaudi::ParticleProperties::particle
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
Definition: IParticlePropertySvc.cpp:90
IInterface.h
Gaudi::ParticleProperties::byPythiaID
const Gaudi::ParticleProperty * byPythiaID(const int pythia, const Gaudi::Interfaces::IParticlePropertySvc *svc)
mapping by pythiaID
Definition: IParticlePropertySvc.cpp:144
Gaudi::Interfaces::IParticlePropertySvc::ParticleProperties
std::vector< const Gaudi::ParticleProperty * > ParticleProperties
the actual type of (ordered) container of particle properties
Definition: IParticlePropertySvc.h:34
Gaudi::ParticleProperties::byEvtGenName
const Gaudi::ParticleProperty * byEvtGenName(const std::string &evtGen, const Gaudi::Interfaces::IParticlePropertySvc *svc)
mapping by EvtGen-name
Definition: IParticlePropertySvc.cpp:180
Gaudi::Interfaces::IParticlePropertySvc::find
virtual const ParticleProperty * find(const Gaudi::ParticleID &pid) const =0
Retrieve an object by Gaudi::ParticleID:
Gaudi::Interfaces::IParticlePropertySvc::DeclareInterfaceID
DeclareInterfaceID(Gaudi::Interfaces::IParticlePropertySvc, 2, 0)
Gaudi::ParticleProperty
Definition: ParticleProperty.h:37
Gaudi
This file provides a Grammar for the type Gaudi::Accumulators::Axis It allows to use that type from p...
Definition: __init__.py:1
Gaudi::ParticleProperties::get
OUTPUT get(const Gaudi::Interfaces::IParticlePropertySvc *service, const PREDICATE &cut, OUTPUT output)
get all particle properties which satisfy the certain criteria
Definition: IParticlePropertySvc.h:476
Gaudi::Interfaces::IParticlePropertySvc::size
virtual size_t size() const =0
get the container size.
ConditionsStallTest.name
name
Definition: ConditionsStallTest.py:77
Gaudi::ParticleProperties::particleID
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
Definition: IParticlePropertySvc.cpp:117
Kernel.h
Gaudi::Interfaces::IParticlePropertySvc::get
OUTPUT get(const PREDICATE &cut, OUTPUT output) const
get the properties according to some criteria
Definition: IParticlePropertySvc.h:492
Gaudi::Interfaces::IParticlePropertySvc::find
virtual const ParticleProperty * find(const std::string &name) const =0
Retrieve an object by name:
Gaudi::ParticleID
Definition: ParticleID.h:43
Gaudi::Interfaces::IParticlePropertySvc::begin
virtual iterator begin() const =0
get the begin-iterator for the container of particle properties It is assumed that the container is p...
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:81
Gaudi::ParticleProperties::index
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...
Definition: IParticlePropertySvc.cpp:39
Gaudi::Interfaces::IParticlePropertySvc::cc
virtual std::string cc(const std::string &decay) const =0
make the charge conjugation for the string/decay descriptor