Skip to content
Snippets Groups Projects
Commit 087ab6fd authored by lintao@ihep.ac.cn's avatar lintao@ihep.ac.cn
Browse files

WIP: add the package MagneticFieldMap. It is not implemented yet.

parent d895fb22
No related branches found
No related tags found
No related merge requests found
......@@ -7,3 +7,4 @@ add_subdirectory(DetInterface)
add_subdirectory(DetSegmentation)
add_subdirectory(GeomSvc)
add_subdirectory(Identifier)
add_subdirectory(MagneticFieldMap)
#################################################################################
##Package : MagneticFieldMap
#################################################################################
gaudi_add_module(MagneticFieldMap
SOURCES src/GenericBFieldMapBrBz.cpp
LINK Gaudi::GaudiKernel
${DD4hep_COMPONENT_LIBRARIES}
${ROOT_LIBRARIES}
)
set(LIBRARY_OUTPUT_PATH ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
message(STATUS "LIBRARY_OUTPUT_PATH -> ${LIBRARY_OUTPUT_PATH}")
dd4hep_generate_rootmap(MagneticFieldMap)
install(TARGETS MagneticFieldMap
EXPORT CEPCSWTargets
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib
COMPONENT dev)
#include "GenericBFieldMapBrBz.h"
GenericBFieldMapBrBz::GenericBFieldMapBrBz()
: m_provider(nullptr) {
}
void GenericBFieldMapBrBz::fieldComponents(const double* pos, double* field) {
double curfield[3] = {0.0, 0.0, 0.0};
field[0] += curfield[0];
field[1] += curfield[1];
field[1] += curfield[2];
return;
}
#ifndef GenericBFieldMapBrBz_h
#define GenericBFieldMapBrBz_h
/*
* GenericBFieldMapBrBz is an extension of Cartesian Field in DD4hep.
* - It enables the DD4hep to access the Magnetic Service from Gaudi.
* - It also enables the calculation of Br/Bz at position X.
* - It will get the map from an abstract class IFieldMapProvider.
*
* -- Tao Lin <lintao AT ihep.ac.cn>
*/
#include <DD4hep/FieldTypes.h>
#include "IFieldMapProvider.h"
class GenericBFieldMapBrBz: public dd4hep::CartesianField::Object {
public:
GenericBFieldMapBrBz();
virtual void fieldComponents(const double* pos, double* field);
private:
IFieldMapProvider* m_provider;
};
#endif
#ifndef IFieldMapProvider_h
#define IFieldMapProvider_h
/*
* IFieldMapProvider will provide the B-Field at a 2D grid (r-z).
* The provider will return the bin index for r/z. Then the GenericBFieldMapBrBz
* will use this bin index to get the values at (r0,z0), (r1,z0), (r0,z1), (r1,z1).
* The interpolation is not computated IFieldMapProvider. Please see GenericBFieldMapBrBz.
*
* -- Tao Lin <lintao AT ihep.ac.cn>
*/
class IFieldMapProvider {
// Meta data about the map
virtual int rBinIdx(double r) = 0;
virtual int zBinIdx(double z) = 0;
// The Br and Bz
virtual void access(int rbin, int zbin, double& Br, double& Bz) = 0;
};
#endif
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