Commit ec8435af authored by Adrien Matta's avatar Adrien Matta
Browse files

* changing a few things around in NPXml

parent debdf1e6
Pipeline #87092 passed with stages
in 12 minutes and 36 seconds
......@@ -4,4 +4,4 @@ add_custom_command(OUTPUT NPDeltaSpectraDict.cxx COMMAND ${CMAKE_BINARY_DIR}/sc
add_custom_command(OUTPUT NPVDetectorDict.cxx COMMAND ${CMAKE_BINARY_DIR}/scripts/build_dict.sh NPVDetector.h NPVDetectorDict.cxx NPVDetector.rootmap libNPCore.so NPCoreLinkdef.h)
add_library(NPCore SHARED NPCore.cxx NPRandom.cxx NPVAnalysis.cxx NPAnalysisFactory.cxx NPCalibrationManager.cxx NPOptionManager.cxx RootOutput.cxx RootInput.cxx TAsciiFile.cxx TAsciiFileDict.cxx NPDeltaSpectraDict.cxx NPDetectorManager.cxx NPVDetector.cxx NPVDetectorDict.cxx NPVSpectra.cxx NPDetectorFactory.cxx NPSpectraServer.cxx NPInputParser.cxx NPImage.cxx NPElog.cxx NPDeltaSpectra.cxx NPXmlParser.cxx)
target_link_libraries(NPCore ${ROOT_LIBRARIES} -lXMLIO)
install(FILES NPCore.h NPVAnalysis.h NPAnalysisFactory.h NPRandom.h NPCalibrationManager.h NPOptionManager.h RootInput.h RootOutput.h TAsciiFile.h NPDetectorManager.h NPVDetector.h NPGlobalSystemOfUnits.h NPPhysicalConstants.h NPSystemOfUnits.h NPVSpectra.h NPDetectorFactory.h NPSpectraServer.h NPInputParser.h NPImage.h NPElog.h NPDeltaSpectra.h NPXmlParser.cxx DESTINATION ${CMAKE_INCLUDE_OUTPUT_DIRECTORY})
install(FILES NPCore.h NPVAnalysis.h NPAnalysisFactory.h NPRandom.h NPCalibrationManager.h NPOptionManager.h RootInput.h RootOutput.h TAsciiFile.h NPDetectorManager.h NPVDetector.h NPGlobalSystemOfUnits.h NPPhysicalConstants.h NPSystemOfUnits.h NPVSpectra.h NPDetectorFactory.h NPSpectraServer.h NPInputParser.h NPImage.h NPElog.h NPDeltaSpectra.h NPXmlParser.h DESTINATION ${CMAKE_INCLUDE_OUTPUT_DIRECTORY})
......@@ -2,7 +2,7 @@
#include <stdio.h>
#include <iostream>
using namespace NPL;
using namespace NPL::XML;
////////////////////////////////////////////////////////////////////////////////
block::block(){};
block::~block(){};
......@@ -121,8 +121,8 @@ void XmlParser::LoadNode(TXMLEngine* xml, XMLNodePointer_t node, Int_t level){
}
//////////////////////////////////////////////////////////////////////////////////
std::vector<NPL::block*> XmlParser::GetAllBlocksWithName(std::string name){
std::vector<NPL::block*> res;
std::vector<NPL::XML::block*> XmlParser::GetAllBlocksWithName(std::string name){
std::vector<NPL::XML::block*> res;
auto it=m_blocks.find(name);
if(it!=m_blocks.end()){
......
......@@ -7,6 +7,7 @@
#include "TXMLEngine.h"
namespace NPL{
/////////////////////
namespace XML{
class parameter{
public:
parameter();
......@@ -38,6 +39,7 @@ namespace NPL{
};
/////////////////////
// Use for Riken data conversion only
class Channel{
public:
Channel();
......@@ -85,7 +87,7 @@ namespace NPL{
std::string m_name;
std::set<parameter> m_parameters;
};
}
/////////////////////
class XmlParser{
public:
......@@ -99,23 +101,24 @@ namespace NPL{
void LoadNode(TXMLEngine* xml, XMLNodePointer_t node, Int_t level);
public: // access by channel id
block* GetBlock(Channel c){
// this is used by mrdc to convert ridf file into nptool root file
XML::block* GetBlock(XML::Channel c){
auto it = m_Channels.find(c);
if(it!=m_Channels.end())
return it->second;
else
return NULL;
};
void SetBlock(const Channel& c,block* b){
void SetBlock(const XML::Channel& c,XML::block* b){
m_Channels[c]=b;
}
public:
std::vector<block*> GetAllBlocksWithName(std::string name) ;
std::vector<XML::block*> GetAllBlocksWithName(std::string name) ;
std::vector<std::string> GetAllBlocksName();
private:
std::map<std::string,std::vector<block>> m_blocks;
std::map<Channel,block*> m_Channels;
std::map<std::string,std::vector<XML::block>> m_blocks;
std::map<XML::Channel,XML::block*> m_Channels;
};
......
......@@ -411,7 +411,7 @@ void TSamuraiFDC2Physics::ReadConfiguration(NPL::InputParser parser){
///////////////////////////////////////////////////////////////////////////
void TSamuraiFDC2Physics::AddDC(string name, NPL::XmlParser& xml){
std::vector<NPL::block*> b = xml.GetAllBlocksWithName(name);
std::vector<NPL::XML::block*> b = xml.GetAllBlocksWithName(name);
// FDC2 case
if(name=="SAMURAIFDC2"){
unsigned int det=2;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment