From 5b696022e78090e5b0a6bfa280f422c6dfc96fae Mon Sep 17 00:00:00 2001 From: lintao <lintao51@gmail.com> Date: Mon, 11 Oct 2021 22:06:10 +0800 Subject: [PATCH] Start to develop the Beam Background generator. --- Generator/CMakeLists.txt | 2 +- Generator/src/GtBeamBackgroundTool.cpp | 29 +++++++++++++ Generator/src/GtBeamBackgroundTool.h | 59 ++++++++++++++++++++++++++ 3 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 Generator/src/GtBeamBackgroundTool.cpp create mode 100644 Generator/src/GtBeamBackgroundTool.h diff --git a/Generator/CMakeLists.txt b/Generator/CMakeLists.txt index bf233d1b..9264abd8 100644 --- a/Generator/CMakeLists.txt +++ b/Generator/CMakeLists.txt @@ -15,7 +15,7 @@ gaudi_add_module(GenAlgo src/SLCIORdr.cpp src/HepMCRdr.cpp src/GtGunTool.cpp - + src/GtBeamBackgroundTool.cpp LINK ${ROOT_LIBRARIES} k4FWCore::k4FWCore Gaudi::GaudiAlgLib diff --git a/Generator/src/GtBeamBackgroundTool.cpp b/Generator/src/GtBeamBackgroundTool.cpp new file mode 100644 index 00000000..28f4f352 --- /dev/null +++ b/Generator/src/GtBeamBackgroundTool.cpp @@ -0,0 +1,29 @@ +#include "GtBeamBackgroundTool.h" + +DECLARE_COMPONENT(GtBeamBackgroundTool) + +StatusCode GtBeamBackgroundTool::initialize() { + // check the consistency of the properties + + // create the instances of the background parsers + + return StatusCode::SUCCESS; +} + +StatusCode GtBeamBackgroundTool::finalize() { + return StatusCode::SUCCESS; +} + + +bool GtBeamBackgroundTool::mutate(MyHepMC::GenEvent& event) { + return true; +} + +bool GtBeamBackgroundTool::finish() { + return true; +} + +bool GtBeamBackgroundTool::configure_gentool() { + + return true; +} diff --git a/Generator/src/GtBeamBackgroundTool.h b/Generator/src/GtBeamBackgroundTool.h new file mode 100644 index 00000000..4750a96a --- /dev/null +++ b/Generator/src/GtBeamBackgroundTool.h @@ -0,0 +1,59 @@ +#ifndef GtBeamBackgroundTool_h +#define GtBeamBackgroundTool_h + +/* + * Description: + * This tool is used to simulation the non-collision beam backgrounds. + * + * The properties: + * - InputFileMap + * this is a map to store the label and the input filename + * - InputFormatMap + * this is a map to store the label and the input format + * - InputRateMap + * this is a map to store the label and the rate + * + * Note: the label (key) should be consistent + * + * About the design: + * IBeamBackgroundFileParser is the interface to load the next event. + * Different file formats should be implemented in the corresponding parsers. + * The format will be used to create the corresponding instance. + * + * Author: + * Tao Lin <lintao AT ihep.ac.cn> + */ + +#include <GaudiKernel/AlgTool.h> +#include <Gaudi/Property.h> +#include "IGenTool.h" + +#include <vector> +#include <map> + +class IBeamBackgroundFileParser; + +class GtBeamBackgroundTool: public extends<AlgTool, IGenTool> { +public: + using extends::extends; + + // Overriding initialize and finalize + StatusCode initialize() override; + StatusCode finalize() override; + + // IGenTool + bool mutate(MyHepMC::GenEvent& event) override; + bool finish() override; + bool configure_gentool() override; + +private: + Gaudi::Property<std::map<std::string, std::string>> m_inputmaps{this, "InputFileMap"}; + Gaudi::Property<std::map<std::string, std::string>> m_fomatmaps{this, "InputFormatMap"}; + Gaudi::Property<std::map<std::string, double>> m_ratemaps {this, "InputRateMap"}; + +private: + std::map<std::string, std::shared_ptr<IBeamBackgroundFileParser>> m_beaminputs; + +}; + +#endif -- GitLab