Skip to content
Snippets Groups Projects
Commit d05a1d19 authored by Robert Johannes Langenberg's avatar Robert Johannes Langenberg Committed by Graeme Stewart
Browse files

IMagFieldSvc.h fixing unsafe type conversion (MagFieldInterfaces-00-01-13)

parent 6cf8e9d8
No related branches found
No related tags found
No related merge requests found
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
///////////////////////////////////////////////////////////////////
// IMagFieldSvc.h, (c) ATLAS Detector software
///////////////////////////////////////////////////////////////////
#ifndef MAGFIELDINTERFACES_IMAGFIELDSVC_H
#define MAGFIELDINTERFACES_IMAGFIELDSVC_H
#include <cmath>
#include <iostream>
// Framework includes
#include "GaudiKernel/IInterface.h"
// Amg classes
#include "GeoPrimitives/GeoPrimitives.h"
/** Declaration of the interface ID ( interface id, major version, minor version) */
static const InterfaceID IID_IMagFieldSvc("IMagFieldSvc", 1, 0);
namespace MagField {
/** @ class IMagFieldSvc
@ author Elmar.Ritsch -at- cern.ch
*/
class IMagFieldSvc: virtual public IInterface {
///////////////////////////////////////////////////////////////////
// Public methods:
///////////////////////////////////////////////////////////////////
public:
/** constructor */
IMagFieldSvc() : m_solenoidCurrent(0.0), m_toroidCurrent(0.0) {;}
/** Retrieve interface ID */
static const InterfaceID& interfaceID() {
return IID_IMagFieldSvc;
}
/** get B field value at given position */
/** xyz[3] is in mm, bxyz[3] is in kT */
/** if deriv[9] is given, field derivatives are returned in kT/mm */
virtual void getField(const double *xyz, double *bxyz, double *deriv = 0) = 0;
/** a getField() wrapper for Amg classes */
void getField(const Amg::Vector3D *xyz, Amg::Vector3D *bxyz, Amg::RotationMatrix3D *deriv = 0) {
getField( xyz->data(), bxyz->data(), deriv->data() );
}
/** get B field value on the z-r plane at given position */
/** works only inside the solenoid; otherwise calls getField() above */
/** xyz[3] is in mm, bxyz[3] is in kT */
/** if deriv[9] is given, field derivatives are returned in kT/mm */
virtual void getFieldZR(const double *xyz, double *bxyz, double *deriv = 0) = 0;
/** status of the magnets */
bool solenoidOn() { return solenoidCurrent() > 0.0; }
bool toroidOn() { return toroidCurrent() > 0.0; }
float solenoidCurrent() { return m_solenoidCurrent; }
float toroidCurrent() { return m_toroidCurrent; }
protected:
void setSolenoidCurrent(float current) { m_solenoidCurrent = current; }
void setToroidCurrent (float current) { m_toroidCurrent = current; }
private:
float m_solenoidCurrent; // solenoid current in ampere
float m_toroidCurrent; // toroid current in ampere
};
}
#endif //> !MAGFIELDINTERFACES_IMAGFIELDSVC_H
package MagFieldInterfaces
author <elmar.ritsch@cern.ch>
manager Niels van Eldik <niels.van.eldik@cern.ch>
manager Robert Langenberg <robert.johannes.langenberg@cern.ch>
manager Masahiro Morii <masahiro_morii@harvard.edu>
manager Elmar Ritsch <elmar.ritsch@cern.ch>
#################################################################
# public use statements
#################################################################
public
use AtlasPolicy AtlasPolicy-*
use GaudiInterface GaudiInterface-* External
use GeoPrimitives GeoPrimitives-* DetectorDescription
#################################################################
# private use statements
#################################################################
private
end_private
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment