Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

External hipo #63

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
b2590cb
rm initDBs from SlaveBegin(), already done in constructor
dglazier Dec 12, 2023
9e913be
Merge branch 'master' of https://github.com/dglazier/clas12root
dglazier Jan 11, 2024
a97971e
testing CMake with advice from Chris
dglazier Jan 15, 2024
3207c49
update CMake for external hipo4
dglazier Jan 30, 2024
74db624
fix library load for external hipo
dglazier Jan 30, 2024
4c1838f
rootify external hipo classes
dglazier Jan 30, 2024
0965a91
tidy-up
dglazier Jan 30, 2024
38962fa
change to include hipo4/bank.h etc, use PkgConfig::Hipo4
dglazier Jan 31, 2024
1fa10bc
remove dglazier path
dglazier Feb 2, 2024
ec14329
setup HIPO linking via environment variable HIPO
dglazier Feb 5, 2024
a98ce88
update workflow check ofr external hipo
dglazier Feb 5, 2024
d6ead2f
update workflow check ofr external hipo
dglazier Feb 5, 2024
0411f62
update workflow check ofr external hipo
dglazier Feb 5, 2024
24d4e93
update workflow check ofr external hipo
dglazier Feb 5, 2024
2f5d9e1
update workflow check ofr external hipo
dglazier Feb 5, 2024
2a533c9
update workflow check ofr external hipo
dglazier Feb 5, 2024
d812ab6
update workflow check ofr external hipo
dglazier Feb 5, 2024
c553007
update workflow check ofr external hipo
dglazier Feb 5, 2024
d78427a
update workflow check ofr external hipo
dglazier Feb 5, 2024
6cbe0de
update workflow check ofr external hipo
dglazier Feb 5, 2024
00cdf44
update workflow check ofr external hipo
dglazier Feb 5, 2024
26d2671
protect qadb_reader::getChargeForRunlist from undefined QADB
dglazier Feb 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ name: C++ CI Testing
on: pull_request

jobs:
build_and_test:
build_and_test:
runs-on: ubuntu-latest
container: rootproject/root:${{ matrix.version }}
strategy:
matrix:
version: [6.22.02-ubuntu20.04]
version: [6.28.12-ubuntu22.04]

steps:
- name: system dependancies
Expand Down Expand Up @@ -36,6 +36,20 @@ jobs:
echo "PATH=$PWD/bin:$CCDB_HOME:$CCDB_HOME/bin:$RCDB_HOME/bin:$RCDB_HOME/cpp/bin:$PATH" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=$RCDB_HOME/cpp/lib:$CCDB_HOME/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV


- name: checkout hipo
uses: actions/checkout@v4
with:
repository: gavalian/hipo
ref: 4.0.1 # if you want to use a fixed tag; remove if you want to use `main`
path: ${HIPO}

- name: build hipo
run: |
cd $HIPO
cmake -DCMAKE_INSTALL_PREFIX=$HIPO
cmake --build . --target install

- name: build ccdb
run: |
cd $CCDB_HOME
Expand Down
51 changes: 22 additions & 29 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,28 @@ find_package(ROOT REQUIRED COMPONENTS Proof) ###########USEROOTSYS
include(${ROOT_USE_FILE}) ##########USEROOTSYS
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ROOT_CXX_FLAGS}")

#hipo expects lz4 includes to be in lib...
set(CMAKE_INSTALL_INCLUDEDIR ${CMAKE_CURRENT_SOURCE_DIR}/lib)
#set(ADD_COMPILER_FLAGS_PREPEND "-O3")
set(CMAKE_C_FLAGS "-O3 ${CMAKE_C_FLAGS}")
set(LZ4_BUNDLED_MODE OFF)
set(BUILD_SHARED_LIBS ON)
set(BUILD_STATIC_LIBS OFF)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/lz4/contrib/cmake_unofficial)
set(LZ4_LIBRARY lz4)
set(LZ4_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lz4/lib)
include_directories(${LZ4_INCLUDE_DIR})
add_definitions(-D__LZ4__)

#after Lz4 change include to include
set(CMAKE_INSTALL_INCLUDEDIR ${CMAKE_CURRENT_SOURCE_DIR}/include)
#find_package(hipo4 REQUIRED) #for cmake
#find_package(PkgConfig REQUIRED) #for pkg
#pkg_check_modules(hipo4 REQUIRED IMPORTED_TARGET hipo4)

#currently load hipo via simple env paths
MESSAGE( CHECK_START "Checking for installed hipo..." )

if (DEFINED ENV{HIPO})

set(HIPOEXT $ENV{HIPO})
set(HIPO_INCLUDE_DIR ${HIPOEXT}/include/)
set(HIPO_LIBS -L${HIPOEXT}/ -lhipo4)

MESSAGE( STATUS "HIPO INCLUDE_DIR : " ${HIPO_INCLUDE_DIR} )
MESSAGE( STATUS "HIPO LIBRARIES : " ${HIPO_LIBS} )

else ()

MESSAGE( CHECK_FAIL "$HIPO not set" )
MESSAGE( FATAL_ERROR , "\n ... $HIPO must be set to local install of the hipo library\n ... see clas12root/README.md\n ... cmake exiting")

endif ()

#include clas12-qadb c++ library and rapidjson library
IF (DEFINED ENV{QADB})
Expand All @@ -46,25 +53,11 @@ ENDIF (DEFINED ENV{QADB})


set(CLAS12ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Clas12Root)
set(CLAS12HIPO_DIR ${CMAKE_CURRENT_SOURCE_DIR}/hipo4)
set(CLAS12BANKS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Clas12Banks)

include_directories(${CLAS12HIPO_DIR})
add_subdirectory (${CLAS12HIPO_DIR})

include_directories(${CLAS12BANKS_DIR})
add_subdirectory (${CLAS12BANKS_DIR})

include_directories(${CLAS12ROOT_DIR})
add_subdirectory (${CLAS12ROOT_DIR})

#include_directories(${CMAKE_CURRENT_SOURCE_DIR}/hipo4)
#add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR}/hipo4)

#include_directories(${CMAKE_CURRENT_SOURCE_DIR}/Clas12Banks)
#add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR}/Clas12Banks)

#include_directories(${CMAKE_CURRENT_SOURCE_DIR}/Clas12Root)
#add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR}/Clas12Root)


23 changes: 11 additions & 12 deletions Clas12Banks/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
set(CLAS12BANKS Clas12Banks)
set(HIPO4 hipo4)


set(CLASS_LIST_CPP helflip.cpp helonline.cpp vertdoca.cpp runconfig.cpp event.cpp ftbevent.cpp particle.cpp ftbparticle.cpp mcparticle.cpp mcevent.cpp mcmatch.cpp scaler.cpp vtp.cpp particle_detector.cpp scintillator.cpp scintextras.cpp tracker.cpp utracker.cpp traj.cpp forwardtagger.cpp cherenkov.cpp rich.cpp calorimeter.cpp calextras.cpp covmatrix.cpp region_particle.cpp region_ft.cpp region_fdet.cpp region_cdet.cpp region_band.cpp clas12writer.cpp clas12reader.cpp mesonex_trigger.cpp scaler_reader.cpp clas12databases.cpp qadb_reader.cpp ccdb_reader.cpp rcdb_reader.cpp)
Expand Down Expand Up @@ -56,23 +58,20 @@ IF (DEFINED ENV{RCDB_HOME})

ENDIF (DEFINED ENV{RCDB_HOME})


include_directories(${CLAS12ROOT_DIR})
include_directories(${HIPO_INCLUDE_DIR})
#include_directories(${hipo4_INCLUDE_DIRS})#in case change to pkg, this is needed to generate ROOT dict

ROOT_GENERATE_DICTIONARY(G__${CLAS12BANKS} ${CLASS_LIST_H} LINKDEF Clas12LinkDef.h)
add_library(${CLAS12BANKS} SHARED ${CLASS_LIST_CPP} G__${CLAS12BANKS}.cxx)

ROOT_GENERATE_DICTIONARY(G__Clas12Banks ${CLASS_LIST_H} LINKDEF Clas12LinkDef.h)
add_library(Clas12Banks SHARED ${CLASS_LIST_CPP} G__Clas12Banks.cxx)
target_link_libraries(${CLAS12BANKS} PUBLIC ${ROOT_LIBRARIES} ${HIPO_LIBS} )

target_link_libraries(Clas12Banks ${ROOT_LIBRARIES} Hipo4)
#target_link_libraries(${CLAS12BANKS} PUBLIC ${ROOT_LIBRARIES} PkgConfig::${HIPO4} ) #in case change to pkg
#target_include_directories(${CLAS12BANKS} SYSTEM PUBLIC PkgConfig::${HIPO4}) #in case change to pkg

install(TARGETS Clas12Banks
install(TARGETS ${CLAS12BANKS}
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")

#FILE(GLOB ROOT_CLAS12_PCM ${CMAKE_BINARY_DIR}/Clas12Banks/*pcm)

#install (FILES ${ROOT_CLAS12_PCM}
# DESTINATION "${CMAKE_INSTALL_LIBDIR}")


install (FILES ${CMAKE_CURRENT_BINARY_DIR}/libClas12Banks_rdict.pcm
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/lib${CLAS12BANKS}_rdict.pcm
DESTINATION "${CMAKE_INSTALL_LIBDIR}")
3 changes: 3 additions & 0 deletions Clas12Banks/Clas12LinkDef.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,7 @@
#pragma link C++ class clas12::jsonFileMerger+;
#pragma link C++ class clas12::qadb_reader+;
#pragma link C++ class clas12root::TRcdbVals+;
#pragma link C++ class hipo::bank+;
#pragma link C++ class hipo::reader+;
#pragma link C++ class hipo::writer+;
#endif
2 changes: 1 addition & 1 deletion Clas12Banks/calextras.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#ifndef CLAS12_CALEXTRAS_H
#define CLAS12_CALEXTRAS_H

#include "bank.h"
#include <hipo4/bank.h>
#include <memory>


Expand Down
4 changes: 2 additions & 2 deletions Clas12Banks/clas12reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include "clas12defs.h"
#include "clas12databases.h"
#include "reader.h"
#include <hipo4/reader.h>
#include "particle.h"
#include "ftbparticle.h"
#include "mcparticle.h"
Expand Down Expand Up @@ -37,7 +37,7 @@
#include "region_band.h"
#include "scaler_reader.h"
#include "rcdb_vals.h"
#include "dictionary.h"
#include <hipo4/dictionary.h>

#include <algorithm>
#include <set>
Expand Down
10 changes: 5 additions & 5 deletions Clas12Banks/clas12writer.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@

#include "clas12defs.h"
#include "clas12reader.h"
#include "writer.h"
#include "bank.h"
#include "event.h"
#include "utils.h"
#include "dictionary.h"
#include <hipo4/writer.h>
#include <hipo4/bank.h>
#include <hipo4/event.h>
#include <hipo4/utils.h>
#include <hipo4/dictionary.h>

#include <algorithm>
#include <string>
Expand Down
2 changes: 1 addition & 1 deletion Clas12Banks/covmatrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#ifndef CLAS12_COVMATRIX_H
#define CLAS12_COVMATRIX_H

#include "bank.h"
#include <hipo4/bank.h>
#include <vector>
#include <map>
#include <memory>
Expand Down
2 changes: 1 addition & 1 deletion Clas12Banks/detector.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include <stdint.h>
#include <stdlib.h>
#include <map>
#include "bank.h"
#include <hipo4/bank.h>


namespace clas12 {
Expand Down
2 changes: 1 addition & 1 deletion Clas12Banks/event.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include <iostream>
#include <vector>
#include <memory>
#include "bank.h"
#include <hipo4/bank.h>
#include "ftbevent.h"

namespace clas12 {
Expand Down
2 changes: 1 addition & 1 deletion Clas12Banks/ftbevent.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include <iostream>
#include <vector>
#include <memory>
#include "bank.h"
#include <hipo4/bank.h>

namespace clas12 {

Expand Down
1 change: 0 additions & 1 deletion Clas12Banks/ftbparticle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*/

#include "ftbparticle.h"
#include "dictionary.h"


namespace clas12 {
Expand Down
4 changes: 2 additions & 2 deletions Clas12Banks/ftbparticle.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
#ifndef FTBPARTICLE_H
#define FTBPARTICLE_H

#include "bank.h"
#include "dictionary.h"
#include <hipo4/bank.h>
#include <hipo4/dictionary.h>
#include <memory>

namespace clas12 {
Expand Down
2 changes: 1 addition & 1 deletion Clas12Banks/helflip.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include <iostream>
#include <vector>
#include <memory>
#include "bank.h"
#include <hipo4/bank.h>
#include "runconfig.h"

namespace clas12 {
Expand Down
2 changes: 1 addition & 1 deletion Clas12Banks/helonline.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include <iostream>
#include <vector>
#include <memory>
#include "bank.h"
#include <hipo4/bank.h>

namespace clas12 {

Expand Down
2 changes: 1 addition & 1 deletion Clas12Banks/mcevent.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#ifndef MCEVENT_H
#define MCEVENT_H

#include "bank.h"
#include <hipo4/bank.h>
#include <cmath>
#include <memory>

Expand Down
2 changes: 1 addition & 1 deletion Clas12Banks/mcmatch.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#ifndef MCMATCH_H
#define MCMATCH_H

#include "bank.h"
#include <hipo4/bank.h>
#include <cmath>
#include <memory>

Expand Down
2 changes: 1 addition & 1 deletion Clas12Banks/mcparticle.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#ifndef MCPARTICLE_H
#define MCPARTICLE_H

#include "bank.h"
#include <hipo4/bank.h>
#include "mcmatch.h"
#include <cmath>
#include <memory>
Expand Down
2 changes: 1 addition & 1 deletion Clas12Banks/mesonex_trigger.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <set>
#include "clas12defs.h"
#include "clas12reader.h"
#include "utils.h"
#include <hipo4/utils.h>

namespace clas12 {

Expand Down
1 change: 0 additions & 1 deletion Clas12Banks/particle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*/

#include "particle.h"
#include "dictionary.h"


namespace clas12 {
Expand Down
4 changes: 2 additions & 2 deletions Clas12Banks/particle.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
#ifndef PARTICLE_H
#define PARTICLE_H

#include "bank.h"
#include "dictionary.h"
#include <hipo4/bank.h>
#include <hipo4/dictionary.h>
#include "ftbparticle.h"
#include <cmath>
#include <memory>
Expand Down
2 changes: 1 addition & 1 deletion Clas12Banks/particle_detector.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include <string>
#include <memory>
#include "clas12defs.h"
#include "bank.h"
#include <hipo4/bank.h>


namespace clas12 {
Expand Down
48 changes: 27 additions & 21 deletions Clas12Banks/qadb_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,27 +62,7 @@ namespace clas12 {
return true;
}


#else
qadb_reader::qadb_reader(int runNb){
_runNb=runNb;
}


///////////////////////////////////////////////////////
///Checks if an event passes all the QA requirements

bool qadb_reader::passQAReqs(int evNb){
return true;
}

#endif
void qadb_reader::copySettings(const qadb_reader& other){
_reqsQA=other._reqsQA;
_reqOKAsymmetry=other._reqOKAsymmetry;
_reqGolden=other._reqGolden;
}
/*This function will take in a list of runs and return the accumulated charge
/*This function will take in a list of runs and return the accumulated charge
past specified requirements.
Note: This is done on a file per file basis*/
double qadb_reader::getChargeForRunlist(std::set<int> Runs){
Expand All @@ -109,4 +89,30 @@ namespace clas12 {
return _qa.GetAccumulatedCharge();
}

#else
qadb_reader::qadb_reader(int runNb){
_runNb=runNb;
}


///////////////////////////////////////////////////////
///Checks if an event passes all the QA requirements

bool qadb_reader::passQAReqs(int evNb){
return true;
}
/*This function will take in a list of runs and return the accumulated charge
past specified requirements.
Note: This is done on a file per file basis*/
double qadb_reader::getChargeForRunlist(std::set<int> Runs){
return 0; //qadb not defined
}

#endif
void qadb_reader::copySettings(const qadb_reader& other){
_reqsQA=other._reqsQA;
_reqOKAsymmetry=other._reqOKAsymmetry;
_reqGolden=other._reqGolden;
}

}
Loading