Commit 85487e0d authored by Whitney Armstrong's avatar Whitney Armstrong
Browse files

Resolve "Particle data information/library"

parent e1bf6765
......@@ -37,6 +37,7 @@ gaudi_add_module(JugBasePlugins
SOURCES
src/components/EICDataSvc.cpp
src/components/GeoSvc.cpp
src/components/ParticleSvc.cpp
src/components/InputCopier.cpp
src/components/MC2DummyParticle.cpp
src/components/PodioInput.cpp
......
#ifndef IParticleSvc_H
#define IParticleSvc_H
#include "GaudiKernel/IService.h"
#include <unordered_map>
namespace Jug::Base {
/** Simple particle data.
*
*/
struct ParticleData {
int pdgCode;
int charge;
double mass; //std::string name;
};
} // namespace Jug::Base
/** Particle interface.
*
* \ingroup base
*/
class GAUDI_API IParticleSvc : virtual public IService {
public:
using Particle = Jug::Base::ParticleData;
using ParticleMap = std::map<int, Particle>;
public:
/// InterfaceID
DeclareInterfaceID(IParticleSvc, 1, 0);
virtual ~IParticleSvc() {}
virtual ParticleMap particleMap() const = 0;
virtual Particle particle(int pdg) const = 0;
};
#endif // IParticleSvc_H
This diff is collapsed.
//
// GeoSvc.cxx
//
//
// Created by Julia Hrdinka on 30/03/15.
//
//
#include "GeoSvc.h"
#include "GaudiKernel/Service.h"
//#include "GeoConstruction.h"
......
This diff is collapsed.
#ifndef PARTICLESVC_H
#define PARTICLESVC_H
#include "JugBase/IParticleSvc.h"
#include "GaudiKernel/Service.h"
/** Simple particle service.
*
* This meant to provide basic particle information for reconstruction purposes.
* If particle data is needed, be sure to grab everything you can in an initialization
* step. Currently the returned Particle/ParticleMap are by value.
*/
class ParticleSvc : public extends<Service, IParticleSvc> {
public:
using Particle = Jug::Base::ParticleData;
using ParticleMap = std::map<int, Particle>;
ParticleMap m_particleMap;
public:
ParticleSvc(const std::string& name, ISvcLocator* svc) ;
virtual ~ParticleSvc();
virtual StatusCode initialize() final;
virtual StatusCode finalize() final { return StatusCode::SUCCESS; }
virtual ParticleMap particleMap() const { return m_particleMap; }
virtual Particle particle(int pdg) const
{
if (m_particleMap.count(pdg) == 0) {
// error
}
return m_particleMap.at(pdg);
}
};
#endif
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment