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

register Guinea-Pig parser in GtBeamBackgroundTool.

parent 18d2a302
No related branches found
No related tags found
No related merge requests found
#include "GtBeamBackgroundTool.h"
#include "IBeamBackgroundFileParser.h"
#include "BeamBackgroundFileParserV0.h"
#include "GuineaPigPairsFileParser.h"
#include "TVector3.h" // for rotation
DECLARE_COMPONENT(GtBeamBackgroundTool)
......@@ -11,17 +13,21 @@ StatusCode GtBeamBackgroundTool::initialize() {
// create the instances of the background parsers
for (auto& [label, inputfn]: m_inputmaps) {
double beamE = 120.;
auto itBeamE = m_Ebeammaps.find(label);
if (itBeamE != m_Ebeammaps.end()) {
beamE = itBeamE->second;
std::string format = "BeamBackgroundFileParserV0";
auto itFormat = m_formatmaps.find(label);
if (itFormat != m_formatmaps.end()) {
format = itFormat->second;
}
if (format == "BeamBackgroundFileParserV0") {
init_BeamBackgroundFileParserV0(label, inputfn);
} else if (format == "GuineaPigPairsFileParser") {
init_GuineaPigPairsFileParser(label, inputfn);
} else {
init_BeamBackgroundFileParserV0(label, inputfn);
}
info() << "Initializing beam background ... "
<< label << " "
<< beamE << " "
<< inputfn
<< endmsg;
m_beaminputs[label] = std::make_shared<BeamBackgroundFileParserV0>(inputfn, 11, beamE);
}
// check the size
......@@ -89,3 +95,28 @@ bool GtBeamBackgroundTool::configure_gentool() {
return true;
}
bool GtBeamBackgroundTool::init_BeamBackgroundFileParserV0(const std::string& label,
const std::string& inputfn) {
double beamE = 120.;
auto itBeamE = m_Ebeammaps.find(label);
if (itBeamE != m_Ebeammaps.end()) {
beamE = itBeamE->second;
}
info() << "Initializing beam background ... "
<< label << " "
<< beamE << " "
<< inputfn
<< endmsg;
m_beaminputs[label] = std::make_shared<BeamBackgroundFileParserV0>(inputfn, 11, beamE);
return true;
}
bool GtBeamBackgroundTool::init_GuineaPigPairsFileParser(const std::string& label,
const std::string& inputfn) {
m_beaminputs[label] = std::make_shared<GuineaPigPairsFileParser>(inputfn);
return true;
}
......@@ -46,9 +46,14 @@ public:
bool finish() override;
bool configure_gentool() override;
private:
bool init_BeamBackgroundFileParserV0(const std::string& label, const std::string& inputfn);
bool init_GuineaPigPairsFileParser(const std::string& label, const std::string& inputfn);
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, std::string>> m_formatmaps{this, "InputFormatMap"};
Gaudi::Property<std::map<std::string, double>> m_ratemaps {this, "InputRateMap"};
// unit of beam energy: GeV
......
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