13#include <tracking/modules/genfitUtilities/SetupGenfitExtrapolationModule.h>
14#include <tracking/modules/genfitUtilities/Geant4MaterialInterface.h>
16#include <geometry/GeometryManager.h>
18#include <tracking/gfbfield/GFGeant4Field.h>
19#include <genfit/FieldManager.h>
20#include <genfit/MaterialEffects.h>
21#include <genfit/TGeoMaterialInterface.h>
24#include <boost/iostreams/stream_buffer.hpp>
25#include <boost/iostreams/concepts.hpp>
27#include <TGeoManager.h>
36 template<
size_t T_level>
37 class genfitSink :
public boost::iostreams::sink {
40 std::streamsize write(
const char* s, std::streamsize n)
48 genfitSink<200> debugSink;
50 boost::iostreams::stream_buffer<genfitSink<200> > debugStreamBuf(debugSink);
52 genfitSink<100> errorSink;
54 boost::iostreams::stream_buffer<genfitSink<100> > errorStreamBuf(errorSink);
56 genfitSink<150> printSink;
58 boost::iostreams::stream_buffer<genfitSink<150> > printStreamBuf(printSink);
61 void setupGenfitStreams()
63 genfit::debugOut.rdbuf(&debugStreamBuf);
64 genfit::errorOut.rdbuf(&errorStreamBuf);
65 genfit::printOut.rdbuf(&printStreamBuf);
73 setDescription(
"Sets up material handling for genfit extrapolation. Also setups up I/O streams for"
74 " genfit in order to integrate it into basf2 logging system. Also sets up update of VXDAlignment from DB (temporary).");
78 "If true this module will silently ignore if the geometry is already "
79 "present and do nothing in that case. If false a B2FATAL will be "
84 "Which geometry should be used, either 'TGeo' or 'Geant4'",
m_geometry);
96 "activate the material effect: NoiseBrems",
m_noiseBrems);
98 "switch off all material effects in Genfit. This overwrites all "
99 "individual material effects switches",
m_noEffects);
108 if (genfit::FieldManager::getInstance()->isInitialized() or genfit::MaterialEffects::getInstance()->isInitialized()) {
110 B2DEBUG(29,
"Magnetic field or material handling already initialized. Not touching settings.");
113 B2FATAL(
"Magnetic field or material handling already initialized. Not touching settings.");
117 setupGenfitStreams();
119 genfit::FieldManager::getInstance()->init(
new GFGeant4Field());
120 genfit::FieldManager::getInstance()->useCache();
123 B2FATAL(
"No geometry set up so far. Load the geometry module.");
128 B2INFO(
"Building TGeo representation.");
132 genfit::MaterialEffects::getInstance()->init(
new genfit::TGeoMaterialInterface());
136 B2FATAL(
"Invalid choice of geometry interface. Please use 'TGeo' or 'Geant4'.");
141 genfit::MaterialEffects::getInstance()->setNoEffects(
true);
145 genfit::MaterialEffects::getInstance()->setNoiseCoulomb(
m_noiseCoulomb);
147 genfit::MaterialEffects::getInstance()->setNoiseBrems(
m_noiseBrems);
148 genfit::MaterialEffects::getInstance()->setMscModel(
m_mscModel);
AbsMaterialInterface implementation for use with Geant4's navigator.
void setDescription(const std::string &description)
Sets the description of the module.
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
Class to manage the creation and conversion of the geometry.
static GeometryManager & getInstance()
Return a reference to the instance.
void createTGeoRepresentation()
Create a TGeo representation of the native geometry description.
Interface of the Belle II B-field with GenFit.
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.