Skip to content

Commit

Permalink
setup HIPO linking via environment variable HIPO
Browse files Browse the repository at this point in the history
  • Loading branch information
dglazier committed Feb 5, 2024
1 parent 1fa10bc commit ec14329
Show file tree
Hide file tree
Showing 12 changed files with 65 additions and 22 deletions.
26 changes: 21 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,28 @@ find_package(ROOT REQUIRED COMPONENTS Proof) ###########USEROOTSYS
include(${ROOT_USE_FILE}) ##########USEROOTSYS
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ROOT_CXX_FLAGS}")

#find_package(hipo4 REQUIRED)
find_package(PkgConfig REQUIRED)
pkg_check_modules(hipo4 REQUIRED IMPORTED_TARGET hipo4)
MESSAGE( STATUS "HIPO4 INCLUDE_DIR : " ${hipo4_INCLUDE_DIRS} )
MESSAGE( STATUS "HIPO4 LIBRARIES : " ${hipo4_LIBRARIES} )
#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 Down
9 changes: 6 additions & 3 deletions Clas12Banks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,16 @@ 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)

target_link_libraries(${CLAS12BANKS} PUBLIC ${ROOT_LIBRARIES} PkgConfig::${HIPO4} )
target_include_directories(${CLAS12BANKS} SYSTEM PUBLIC PkgConfig::${HIPO4})
target_link_libraries(${CLAS12BANKS} PUBLIC ${ROOT_LIBRARIES} ${HIPO_LIBS} )

#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}
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")
Expand Down
4 changes: 2 additions & 2 deletions Clas12Banks/clas12writer.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
#include "clas12reader.h"
#include <hipo4/writer.h>
#include <hipo4/bank.h>
#include "event.h"
#include <hipo4/event.h>
#include <hipo4/utils.h>
#include <hipo4/bank.h>
#include <hipo4/dictionary.h>

#include <algorithm>
#include <string>
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 <hipo4/bank.h>


namespace clas12 {
Expand Down
2 changes: 1 addition & 1 deletion Clas12Banks/ftbparticle.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#define FTBPARTICLE_H

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

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 <hipo4/bank.h>


namespace clas12 {
Expand Down
3 changes: 3 additions & 0 deletions Clas12Banks/scaler_reader.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#include "scaler_reader.h"
#include <hipo4/reader.h>
#include <hipo4/dictionary.h>
#include <hipo4/event.h>
#include <algorithm>

namespace clas12{
Expand Down
5 changes: 1 addition & 4 deletions Clas12Banks/scaler_reader.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
#pragma once

#include <hipo4/reader.h>
#include <hipo4/bank.h>
#include "event.h"
#include "scaler.h"
#include "runconfig.h"
#include "scaler.h"
#include <string>
#include <float.h>

Expand Down
11 changes: 8 additions & 3 deletions Clas12Root/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
set(CLAS12ROOT Clas12Root)
set(CLAS12BANKS Clas12Banks)
set(HIPO4 hipo4)
#set(HIPO4 hipo4)

#include rcdb c++ header library
IF (DEFINED ENV{RCDB_HOME})
Expand Down Expand Up @@ -35,13 +35,18 @@ ENDIF (DEFINED ENV{CCDB_HOME})


include_directories(${CLAS12BANKS_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__${CLAS12ROOT} BankHist.h HipoHist.h HipoTreeMaker.h HipoChain.h HipoChainWriter.h HipoRootAction.h HipoROOTOut.h ParticleHist.h HipoSelector.h ParticleTree.h LINKDEF Clas12RootLinkDef.h)

add_library(${CLAS12ROOT} SHARED BankHist.cpp HipoHist.cpp HipoTreeMaker.cpp HipoChain.cpp HipoChainWriter.cpp HipoRootAction.cpp HipoROOTOut.cpp ParticleHist.cpp HipoSelector.cpp ParticleTree.cpp G__${CLAS12ROOT}.cxx)

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

target_link_libraries(${CLAS12ROOT} PUBLIC ${ROOT_LIBRARIES} ${CLAS12BANKS} ${HIPO_LIBS})


install(TARGETS ${CLAS12ROOT}
Expand Down
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,19 @@ We now use an external hipo4 repository. This must be pointed at with the variab
A default hipo implementation is now packed with clas12root. If you prefer to use this do not set the enviroment variable HIPO. If you would like to use a different version of the hipo library set HIPO. You may get the most up to data hipo library from


For Hipo library see https://github.com/gavalian/hipo
For Hipo library see https://github.com/gavalian/hipo

##New : from version 1.9.0 an external hipo install is required before building clas12root

git clone --recurse-submodules https://github.com/gavalian/hipo
cd hipo/
git checkout 4.0.1
cmake -DCMAKE_INSTALL_PREFIX=$PWD/
cmake --build . --target install

The environment variable HIPO must be set to the path of the hipo install.

## Clas12Banks and Clas12Root

The Clas12Banks implementation can be used independent of ROOT, although currently ROOT dictionaries are created for the classes via cmake (this could be removed). This defines the specific CLAS12 DST banks and provides an interface to the data.

Expand Down Expand Up @@ -66,6 +78,8 @@ setenv CCDB_HOME /Where/Is/ccdb (e.g. setenv CCDB_HOME ${CLAS12ROOT}/ccdb )
source ${CCDB_HOME}/environment.csh
#To use clas12-qadb interface
setenv QADB /Where/Is/clas12-qadb (e.g. setenv QADB ${CLAS12ROOT}/clas12-qadb )
#Preinstalled hipo is a requirement
setenv HIPO /Where/Is/hipo
```

or for bash
Expand All @@ -79,6 +93,8 @@ export CCDB_HOME /Where/Is/ccdb
source ${CCDB_HOME}/environment.csh
#To use clas12-qadb interface
export QADB /Where/Is/clas12-qadb
#Preinstalled hipo is a requirement
export HIPO /Where/Is/hipo
```

## To install
Expand Down
3 changes: 3 additions & 0 deletions RunRoot/LoadClas12Root.C
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ using namespace clas12root;

void LoadClas12Root(){

TString HIPO=gSystem->Getenv("HIPO");
gSystem->Load(HIPO+"/lib/libhipo4");

TString CLAS12ROOT=gSystem->Getenv("CLAS12ROOT");
TString LIB=CLAS12ROOT+"/lib/";
gSystem->Load(LIB+"libClas12Banks");
Expand Down
4 changes: 3 additions & 1 deletion RunRoot/LoadProofLib.C
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@ void LoadProofLib(Int_t Nworkers=1){
gSystem->Exec(Form("cp $CLAS12ROOT/lib/libClas12Root_rdict.pcm %s/cache/.",sandbox.Data()));

if(!ISMAC){
gProof->Load(TString(gSystem->Getenv("HIPO"))+"/lib/libhipo4.so",kTRUE);
gProof->Load(TString(gSystem->Getenv("CLAS12ROOT"))+"/lib/libClas12Banks.so",kTRUE);
gProof->Load(TString(gSystem->Getenv("CLAS12ROOT"))+"/lib/libClas12Root.so",kTRUE);
}
else{
gProof->Load(TString(gSystem->Getenv("CLAS12ROOT"))+"/lib/libClas12Banks.dylib",kTRUE);
gProof->Load(TString(gSystem->Getenv("HIPO"))+"/lib/libhipo4.dylib",kTRUE);
gProof->Load(TString(gSystem->Getenv("CLAS12ROOT"))+"/lib/libClas12Banks.dylib",kTRUE);
gProof->Load(TString(gSystem->Getenv("CLAS12ROOT"))+"/lib/libClas12Root.dylib",kTRUE);

}
Expand Down

0 comments on commit ec14329

Please sign in to comment.