mirror of
https://github.com/sesps/SPS_SABRE_EventBuilder.git
synced 2024-11-22 10:08:50 -05:00
Fixed issue with pch; in CMake do not include header, CMake force includes it. Added spdlog submodule, Logger class, beginning process of replacing all bland io with spdlog
This commit is contained in:
parent
04aa800c5c
commit
c6213aa1ef
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
[submodule "vendor/spdlog"]
|
||||
path = vendor/spdlog
|
||||
url = https://github.com/gabime/spdlog.git
|
|
@ -19,6 +19,7 @@ endif(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
|||
|
||||
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
|
||||
|
||||
set(PCH_DIR ${CMAKE_CURRENT_LIST_DIR}/src/)
|
||||
set(PCH_DIR ${CMAKE_CURRENT_LIST_DIR}/src)
|
||||
|
||||
add_subdirectory(vendor/spdlog)
|
||||
add_subdirectory(src)
|
|
@ -38,9 +38,11 @@ target_sources(EventBuilder
|
|||
evb/Stopwatch.h
|
||||
evb/ShiftMap.cpp
|
||||
evb/ShiftMap.h
|
||||
evb/Logger.h
|
||||
evb/Logger.cpp
|
||||
spsdict/DataStructs.h
|
||||
)
|
||||
target_include_directories(EventBuilder PUBLIC ${CMAKE_CURRENT_LIST_DIR} ${CMAKE_CURRENT_LIST_DIR}/evb ${CMAKE_CURRENT_LIST_DIR}/spsdict)
|
||||
target_include_directories(EventBuilder PUBLIC ${CMAKE_CURRENT_LIST_DIR} ${CMAKE_CURRENT_LIST_DIR}/evb ${CMAKE_CURRENT_LIST_DIR}/spsdict ${SPDLOG_INCLUDE})
|
||||
target_precompile_headers(EventBuilder PUBLIC ${PCH_DIR}/EventBuilder.h)
|
||||
target_link_libraries(EventBuilder
|
||||
PUBLIC
|
||||
|
@ -65,6 +67,7 @@ target_link_libraries(EventBuilder
|
|||
ROOT::Thread
|
||||
ROOT::TreePlayer
|
||||
ROOT::Tree
|
||||
spdlog::spdlog
|
||||
)
|
||||
|
||||
|
||||
|
@ -105,11 +108,13 @@ target_sources(EventBuilderGui
|
|||
evb/Stopwatch.h
|
||||
evb/ShiftMap.cpp
|
||||
evb/ShiftMap.h
|
||||
evb/Logger.h
|
||||
evb/Logger.cpp
|
||||
spsdict/DataStructs.h
|
||||
guidict/EVBMainFrame.h
|
||||
guidict/FileViewFrame.h
|
||||
)
|
||||
target_include_directories(EventBuilderGui PUBLIC ${CMAKE_CURRENT_LIST_DIR} ${CMAKE_CURRENT_LIST_DIR}/evb ${CMAKE_CURRENT_LISTDIR}/spsdict ${CMAKE_CURRENT_LIST_DIR}/guidict)
|
||||
target_include_directories(EventBuilderGui PUBLIC ${CMAKE_CURRENT_LIST_DIR} ${CMAKE_CURRENT_LIST_DIR}/evb ${CMAKE_CURRENT_LISTDIR}/spsdict ${CMAKE_CURRENT_LIST_DIR}/guidict ${SPDLOG_INCLUDE})
|
||||
target_precompile_headers(EventBuilderGui REUSE_FROM EventBuilder)
|
||||
target_link_libraries(EventBuilderGui
|
||||
PUBLIC
|
||||
|
@ -135,6 +140,7 @@ target_link_libraries(EventBuilderGui
|
|||
ROOT::Thread
|
||||
ROOT::TreePlayer
|
||||
ROOT::Tree
|
||||
spdlog::spdlog
|
||||
)
|
||||
|
||||
install(TARGETS EventBuilder EventBuilderGui RUNTIME DESTINATION bin)
|
|
@ -25,5 +25,8 @@
|
|||
#include <THashTable.h>
|
||||
#include <TCutG.h>
|
||||
|
||||
//Mine
|
||||
#include "evb/Logger.h"
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
|
||||
Written by G.W. McCann Oct. 2020
|
||||
*/
|
||||
#include "EventBuilder.h"
|
||||
#include "ChannelMap.h"
|
||||
|
||||
namespace EventBuilder {
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
|
||||
Written by G.W. McCann Oct. 2020
|
||||
*/
|
||||
#include "EventBuilder.h"
|
||||
#include "CompassFile.h"
|
||||
|
||||
namespace EventBuilder {
|
||||
|
@ -74,7 +73,7 @@ namespace EventBuilder {
|
|||
{
|
||||
if(!IsOpen())
|
||||
{
|
||||
std::cerr<<"Unable to get hit size due to file not being open!"<<std::endl;
|
||||
EVB_WARN("Unable to get hit size from file {0}, sending invalid value.", m_filename);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
Updated to also handle scaler data. -- GWM Oct. 2020
|
||||
*/
|
||||
#include "EventBuilder.h"
|
||||
#include "CompassRun.h"
|
||||
#include "RunCollector.h"
|
||||
#include "SlowSort.h"
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#include "EventBuilder.h"
|
||||
#include "CutHandler.h"
|
||||
|
||||
namespace EventBuilder {
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
|
||||
Written by G.W. McCann Oct. 2020
|
||||
*/
|
||||
#include "EventBuilder.h"
|
||||
#include <cstdlib>
|
||||
#include "EVBApp.h"
|
||||
#include "RunCollector.h"
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
|
||||
*/
|
||||
|
||||
#include "EventBuilder.h"
|
||||
#include <cmath>
|
||||
#include "MassLookup.h"
|
||||
#include "FP_kinematics.h"
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#include "EventBuilder.h"
|
||||
#include "FastSort.h"
|
||||
|
||||
namespace EventBuilder {
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#include "EventBuilder.h"
|
||||
#include "FlagHandler.h"
|
||||
|
||||
namespace EventBuilder {
|
||||
|
|
15
src/evb/Logger.cpp
Normal file
15
src/evb/Logger.cpp
Normal file
|
@ -0,0 +1,15 @@
|
|||
#include "spdlog/sinks/stdout_color_sinks.h"
|
||||
|
||||
namespace EventBuilder {
|
||||
|
||||
std::shared_ptr<spdlog::logger> Logger::s_logger;
|
||||
|
||||
void Logger::Init()
|
||||
{
|
||||
spdlog::set_pattern("%^[%T] %n: %v%$");
|
||||
|
||||
s_logger = spdlog::stdout_color_mt("EVB");
|
||||
s_logger->set_level(spdlog::level::trace);
|
||||
}
|
||||
|
||||
}
|
26
src/evb/Logger.h
Normal file
26
src/evb/Logger.h
Normal file
|
@ -0,0 +1,26 @@
|
|||
#ifndef LOGGER_H
|
||||
#define LOGGER_H
|
||||
|
||||
#include "spdlog/spdlog.h"
|
||||
|
||||
namespace EventBuilder {
|
||||
|
||||
class Logger
|
||||
{
|
||||
public:
|
||||
static void Init();
|
||||
|
||||
inline static std::shared_ptr<spdlog::logger> GetLogger() { return s_logger; }
|
||||
|
||||
private:
|
||||
static std::shared_ptr<spdlog::logger> s_logger;
|
||||
};
|
||||
|
||||
#define EVB_CRITICAL(...) ::EventBuilder::Logger::GetLogger()->critical(__VA_ARGS__)
|
||||
#define EVB_ERROR(...) ::EventBuilder::Logger::GetLogger()->error(__VA_ARGS__)
|
||||
#define EVB_WARN(...) ::EventBuilder::Logger::GetLogger()->warn(__VA_ARGS__)
|
||||
#define EVB_INFO(...) ::EventBuilder::Logger::GetLogger()->info(__VA_ARGS__)
|
||||
#define EVB_TRACE(...) ::EventBuilder::Logger::GetLogger()->trace(__VA_ARGS__)
|
||||
}
|
||||
|
||||
#endif
|
|
@ -8,7 +8,6 @@ of this map (MASS) for use throughout code it is included into.
|
|||
Written by G.W. McCann Aug. 2020
|
||||
|
||||
*/
|
||||
#include "EventBuilder.h"
|
||||
#include "MassLookup.h"
|
||||
|
||||
namespace EventBuilder {
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
Written by G.W. McCann Oct. 2020
|
||||
*/
|
||||
#include "EventBuilder.h"
|
||||
#include "OrderChecker.h"
|
||||
|
||||
namespace EventBuilder {
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#include "EventBuilder.h"
|
||||
#include "RunCollector.h"
|
||||
#include <TSystemDirectory.h>
|
||||
#include <TSystemFile.h>
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
*
|
||||
* Position calibrations swapped as of Aug. 2021 due to detector fixes -- GWM
|
||||
*/
|
||||
#include "EventBuilder.h"
|
||||
#include "SFPAnalyzer.h"
|
||||
|
||||
namespace EventBuilder {
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
*Created Jan 2020 by GWM
|
||||
*/
|
||||
|
||||
#include "EventBuilder.h"
|
||||
#include "SFPPlotter.h"
|
||||
#include <TSystem.h>
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
Written by G.W. McCann Oct. 2020
|
||||
*/
|
||||
#include "EventBuilder.h"
|
||||
#include "ShiftMap.h"
|
||||
|
||||
namespace EventBuilder {
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
*
|
||||
*Refurbished and updated Jan 2020 GWM
|
||||
*/
|
||||
#include "EventBuilder.h"
|
||||
#include "SlowSort.h"
|
||||
|
||||
namespace EventBuilder {
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
Written by G.W. McCann Oct. 2020
|
||||
*/
|
||||
#include "EventBuilder.h"
|
||||
#include "Stopwatch.h"
|
||||
|
||||
namespace EventBuilder {
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#include "EventBuilder.h"
|
||||
#include "spsdict/DataStructs.h"
|
||||
#include <TApplication.h>
|
||||
#include "guidict/EVBMainFrame.h"
|
||||
|
|
|
@ -5,7 +5,7 @@ add_custom_command(TARGET GUIDict
|
|||
POST_BUILD
|
||||
COMMAND cp ${CMAKE_CURRENT_BINARY_DIR}/libGUIDict_rdict.pcm ${CMAKE_INSTALL_PREFIX}/lib/
|
||||
VERBATIM)
|
||||
target_include_directories(GUIDict PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${PCH_DIR})
|
||||
target_include_directories(GUIDict PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${PCH_DIR} ${SPDLOG_INCLUDE})
|
||||
target_precompile_headers(GUIDict PUBLIC ${PCH_DIR}/EventBuilder.h)
|
||||
set_target_properties(GUIDict PROPERTIES PUBLIC_HEADER "EVBMainFrame.h;FileViewFrame.h")
|
||||
target_link_libraries(GUIDict
|
||||
|
@ -30,6 +30,7 @@ target_link_libraries(GUIDict
|
|||
ROOT::Thread
|
||||
ROOT::TreePlayer
|
||||
ROOT::Tree
|
||||
spdlog::spdlog
|
||||
)
|
||||
|
||||
install(TARGETS GUIDict
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#include <EventBuilder.h>
|
||||
#include "EVBMainFrame.h"
|
||||
#include "FileViewFrame.h"
|
||||
#include <TGLabel.h>
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
*/
|
||||
|
||||
#include "EventBuilder.h"
|
||||
#include "FileViewFrame.h"
|
||||
#include <TGTextBuffer.h>
|
||||
#include <TGLabel.h>
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#include "EventBuilder.h"
|
||||
#include "spsdict/DataStructs.h"
|
||||
#include "evb/EVBApp.h"
|
||||
#include "evb/Stopwatch.h"
|
||||
|
@ -6,10 +5,10 @@
|
|||
int main(int argc, char** argv)
|
||||
{
|
||||
EnforceDictionaryLinked();
|
||||
EventBuilder::Logger::Init();
|
||||
if(argc != 3)
|
||||
{
|
||||
std::cerr<<"Incorrect number of command line arguments!"<<std::endl;
|
||||
std::cerr<<"Need to specify type of operation (buildSlow, buildFast, etc.) and input file."<<std::endl;
|
||||
EVB_ERROR("Incorrcect number of commandline arguments! Need to specify type of operation and input file.");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -49,12 +48,12 @@ int main(int argc, char** argv)
|
|||
theBuilder.Convert2FastAnalyzedRoot();
|
||||
else
|
||||
{
|
||||
std::cerr<<"Unidentified type of operation! Check your first argument."<<std::endl;
|
||||
EVB_ERROR("Invalid operation {0} given to EventBuilder! Exiting.", operation);
|
||||
return 1;
|
||||
}
|
||||
|
||||
timer.Stop();
|
||||
std::cout<<"Elapsed time (ms): "<<timer.GetElapsedMilliseconds()<<std::endl;
|
||||
EVB_INFO("Elapsed time (ms): {0}", timer.GetElapsedMilliseconds());
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -5,7 +5,7 @@ add_custom_command(TARGET SPSDict
|
|||
POST_BUILD
|
||||
COMMAND cp ${CMAKE_CURRENT_BINARY_DIR}/libSPSDict_rdict.pcm ${CMAKE_INSTALL_PREFIX}/lib/
|
||||
VERBATIM)
|
||||
target_include_directories(SPSDict PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${PCH_DIR})
|
||||
target_include_directories(SPSDict PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${PCH_DIR} ${SPDLOG_INCLUDE})
|
||||
target_precompile_headers(SPSDict PUBLIC ${PCH_DIR}/EventBuilder.h)
|
||||
set_target_properties(SPSDict PROPERTIES PUBLIC_HEADER "DataStructs.h")
|
||||
target_link_libraries(SPSDict
|
||||
|
@ -30,6 +30,7 @@ target_link_libraries(SPSDict
|
|||
ROOT::Thread
|
||||
ROOT::TreePlayer
|
||||
ROOT::Tree
|
||||
spdlog::spdlog
|
||||
)
|
||||
|
||||
install(TARGETS SPSDict
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#include "EventBuilder.h"
|
||||
#include "DataStructs.h"
|
||||
|
||||
/*
|
||||
|
|
1
vendor/spdlog
vendored
Submodule
1
vendor/spdlog
vendored
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit 3f49f0f247067830d744b82381ddc41dac9711a1
|
Loading…
Reference in New Issue
Block a user