Skip to content

Commit

Permalink
Merge branch 'develop' into master
Browse files Browse the repository at this point in the history
Version 6.0
  • Loading branch information
alekgajos committed Oct 21, 2020
2 parents 9f5cb75 + 71193ba commit a2a7ee2
Show file tree
Hide file tree
Showing 107 changed files with 4,254 additions and 2,429 deletions.
88 changes: 88 additions & 0 deletions .github/workflows/ci-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: j-pet-continuous-integration-tests
on: [push, pull_request]

jobs:
build_and_run_all_tests_on_ubuntu:

runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-16.04, ubuntu-18.04]

steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: system update
run: |
sudo apt-get -qq update
sudo apt-get install -y git libboost-all-dev libtbb-dev cmake libfftw3-3 libfftw3-dev sshpass
- name: download ROOT (for ubuntu 16.04)
run: |
wget https://root.cern/download/root_v6.12.06.Linux-ubuntu16-x86_64-gcc5.4.tar.gz
tar xzf root_v6.12.06.Linux-ubuntu16-x86_64-gcc5.4.tar.gz
if: matrix.os == 'ubuntu-16.04'

- name: download ROOT (for ubuntu-18.04)
run: |
wget http://sphinx.if.uj.edu.pl/framework/root-6-20-06-ubuntu18-jpet.tar.gz
tar xzf root-6-20-06-ubuntu18-jpet.tar.gz
if: matrix.os == 'ubuntu-18.04'

- name: build unpacker
run: |
source root/bin/thisroot.sh
git clone https://github.com/JPETTomography/Unpacker2.git --single-branch --branch develop unpacker
mkdir -p unpacker/build
cd unpacker/build
cmake ..
cmake --build .
sudo make install
cd ../..
- name: build j-pet framework
run: |
source root/bin/thisroot.sh
source unpacker/build/bin/thisunpacker.sh
rm -rf j-pet-framework || true
git clone --single-branch --branch develop https://github.com/JPETTomography/j-pet-framework.git
mkdir -p j-pet-framework/build
cd j-pet-framework/build
cmake ..
cmake --build .
cd ../..
- name: build framework examples
run: |
source root/bin/thisroot.sh
source unpacker/build/bin/thisunpacker.sh
source j-pet-framework/build/bin/thisframework.sh
mkdir build
cd build
cmake ..
make
make tests_largebarrel
make tests_imagereconstruction
- name: run image reconstruction test
run: |
source root/bin/thisroot.sh
source unpacker/build/bin/thisunpacker.sh
cd build/ImageReconstruction
ctest -j6 -C Debug -T test --output-on-failure
- name: run large barrel test
run: |
source root/bin/thisroot.sh
cd build/LargeBarrelAnalysis
ctest -j6 -C Debug -T test --output-on-failure
wget http://sphinx.if.uj.edu.pl/~alek/framework_integration_tests/dabc_17025151847.hld
wget http://sphinx.if.uj.edu.pl/~alek/framework_integration_tests/setupRun3.json
./LargeBarrelAnalysis.x -t hld -f dabc_17025151847.hld -l setupRun3.json -i 3 -r 0 100
mkdir outdir
./LargeBarrelAnalysis.x -t hld -f dabc_17025151847.hld -l setupRun3.json -i 3 -r 0 100 -o outdir
./LargeBarrelAnalysis.x -t root -f dabc_17025151847.hld.root -l setupRun3.json -i 3 -r 0 100
sed -i 's/manager.useTask("TimeWindowCreator", "hld", "tslot.calib");//' ../../LargeBarrelAnalysis/main.cpp
make LargeBarrelAnalysis.x
./LargeBarrelAnalysis.x -t root -f dabc_17025151847.tslot.calib.root -r 0 100
50 changes: 0 additions & 50 deletions .travis.yml

This file was deleted.

39 changes: 20 additions & 19 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ message(STATUS "")
message(STATUS " == ${PROJECT_NAME} Project configuration ==")
message(STATUS "")

set(CMAKE_CXX_STANDARD 11) # maybe not best solution to set it globally? upgrate minimal cmake version to 3.8 or find another way to set it only for target with interface
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_PLATFORM_INDEPENDENT_CODE ON)
Expand Down Expand Up @@ -64,7 +64,7 @@ find_package(Threads REQUIRED)
set(Boost_USE_STATIC_LIBS OFF)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
find_package(Boost 1.50 REQUIRED
find_package(Boost 1.50 REQUIRED
COMPONENTS filesystem
program_options
regex
Expand Down Expand Up @@ -92,19 +92,24 @@ if(ROOT_FOUND)
message(STATUS "ROOT (version ${ROOT_VERSION}) was found using ROOTConfig")
endif()

if(EXISTS "${ROOT_DIR}/modules/RootNewMacros.cmake")
include("${ROOT_DIR}/modules/RootNewMacros.cmake")
message(STATUS "Found RootNewMacros.cmake in: ${ROOT_DIR}/modules!")
elseif(EXISTS "${ROOT_DIR}/cmake/modules/RootNewMacros.cmake")
include("${ROOT_DIR}/cmake/modules/RootNewMacros.cmake")
message(STATUS "Found RootNewMacros.cmake in: ${ROOT_DIR}/cmake/modules!")
elseif(EXISTS "${ROOT_DIR}/../cmake/modules/RootNewMacros.cmake")
include("${ROOT_DIR}/../cmake/modules/RootNewMacros.cmake")
message(STATUS "Found RootNewMacros.cmake in: ${ROOT_DIR}/../cmake/modules!")
else()
message("ERROR! Could not find RootNewMacros.cmake file! Aborting..")
return(1)
# the RootNewMacros.cmake file has to be found and included manually
# only for ROOT versions prior to 6.20
if(ROOT_VERSION VERSION_LESS "6.20")
if(EXISTS "${ROOT_DIR}/modules/RootNewMacros.cmake")
include("${ROOT_DIR}/modules/RootNewMacros.cmake")
message(STATUS "Found RootNewMacros.cmake in: ${ROOT_DIR}/modules!")
elseif(EXISTS "${ROOT_DIR}/cmake/modules/RootNewMacros.cmake")
include("${ROOT_DIR}/cmake/modules/RootNewMacros.cmake")
message(STATUS "Found RootNewMacros.cmake in: ${ROOT_DIR}/cmake/modules!")
elseif(EXISTS "${ROOT_DIR}/../cmake/modules/RootNewMacros.cmake")
include("${ROOT_DIR}/../cmake/modules/RootNewMacros.cmake")
message(STATUS "Found RootNewMacros.cmake in: ${ROOT_DIR}/../cmake/modules!")
else()
message("ERROR! Could not find RootNewMacros.cmake file! Aborting..")
return(1)
endif()
endif()

# fix missing include directories property in versions < ROOT 6.12
set_target_properties(ROOT::Core PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${ROOT_INCLUDE_DIRS}")
Expand Down Expand Up @@ -145,7 +150,7 @@ endif(JPetFramework_FOUND)
## The script shouldn't do anything if the data is present and correct.
option(DOWNLOAD_DATA "Download data" ON)
if(DOWNLOAD_DATA)
set(DOWNLOAD_BASE_PATH ${PROJECT_SOURCE_DIR})
set(DOWNLOAD_BASE_PATH ${PROJECT_SOURCE_DIR})

file(DOWNLOAD "http://sphinx.if.uj.edu.pl/framework/examples_reformed.sha" ${DOWNLOAD_BASE_PATH}/examples_reformed.sha)
file(READ ${DOWNLOAD_BASE_PATH}/examples_reformed.sha SHA_HASHES)
Expand All @@ -167,10 +172,6 @@ if(DOWNLOAD_DATA)
file(REMOVE ${DOWNLOAD_BASE_PATH}/examples_reformed.sha)
endif()

################################################################################
## Add general modules files
add_subdirectory(modules)

################################################################################
## Directories with examples
add_subdirectory(InterThresholdCalibration)
Expand Down
4 changes: 4 additions & 0 deletions CosmicAnalysis/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ set(HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/EventCategorizerCosmic.h
${use_modules_from}/SignalFinder.h
${use_modules_from}/SignalFinderTools.h
${use_modules_from}/SignalTransformer.h
${use_modules_from}/ToTEnergyConverter.h
${use_modules_from}/ToTEnergyConverterFactory.h
${use_modules_from}/HitFinder.h
${use_modules_from}/HitFinderTools.h
${use_modules_from}/EventFinder.h
Expand All @@ -56,6 +58,8 @@ set(SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/EventCategorizerCosmic.cpp
${use_modules_from}/SignalFinder.cpp
${use_modules_from}/SignalFinderTools.cpp
${use_modules_from}/SignalTransformer.cpp
${use_modules_from}/ToTEnergyConverter.cpp
${use_modules_from}/ToTEnergyConverterFactory.cpp
${use_modules_from}/HitFinder.cpp
${use_modules_from}/HitFinderTools.cpp
${use_modules_from}/EventFinder.cpp
Expand Down
36 changes: 23 additions & 13 deletions CosmicAnalysis/EventCategorizerCosmic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
*/

#include "../LargeBarrelAnalysis/EventCategorizerTools.h"
#include "../LargeBarrelAnalysis/HitFinderTools.h"
#include <JPetOptionsTools/JPetOptionsTools.h>
#include "EventCategorizerCosmic.h"
#include <JPetWriter/JPetWriter.h>
Expand All @@ -36,19 +37,13 @@ bool EventCategorizerCosmic::init()
} else {
WARNING(Form("No value of the %s parameter provided by the user. Using default value of %lf.", kMinCosmicTOTParamKey.c_str(), fMinCosmicTOT));
}
if (fSaveControlHistos) {
getStatistics().createHistogram(
new TH1F("Cosmic_TOT", "TOT of Cosmic Hits", 200, fMinCosmicTOT/1000.0, 100.0)
);
getStatistics().getHisto1D("Cosmic_TOT")->SetXTitle("TOT [ns]");
getStatistics().getHisto1D("Cosmic_TOT")->SetYTitle("Counts");

getStatistics().createHistogram(
new TH1F("CosmicHitsPerEvent", "Number of Cosmic Hits in Event", 50, -0.5, 49.5)
);
getStatistics().getHisto1D("CosmicHitsPerEvent")->SetXTitle("Number of Cosmic Hits in Event");
getStatistics().getHisto1D("CosmicHitsPerEvent")->SetYTitle("Counts");
if (isOptionSet(fParams.getOptions(), kTOTCalculationType)) {
fTOTCalculationType = getOptionAsString(fParams.getOptions(), kTOTCalculationType);
} else {
WARNING("No TOT calculation option given by the user. Using standard sum.");
}

if(fSaveControlHistos) initialiseHistograms();
return true;
}

Expand Down Expand Up @@ -88,7 +83,7 @@ JPetEvent EventCategorizerCosmic::cosmicAnalysis(vector<JPetHit> hits)
{
JPetEvent cosmicEvent;
for (unsigned i = 0; i < hits.size(); i++) {
double TOTofHit = EventCategorizerTools::calculateTOT(hits[i]);
double TOTofHit = HitFinderTools::calculateTOT(hits[i], HitFinderTools::getTOTCalculationType(fTOTCalculationType));
if (TOTofHit >= fMinCosmicTOT) {
cosmicEvent.addHit(hits[i]);
//Uncomment if kCosmic type will be avalible
Expand All @@ -104,3 +99,18 @@ JPetEvent EventCategorizerCosmic::cosmicAnalysis(vector<JPetHit> hits)
}
return cosmicEvent;
}

void EventCategorizerCosmic::initialiseHistograms(){

getStatistics().createHistogram(
new TH1F("Cosmic_TOT", "TOT of Cosmic Hits", 200, fMinCosmicTOT/1000.0, 100.0)
);
getStatistics().getHisto1D("Cosmic_TOT")->SetXTitle("TOT [ns]");
getStatistics().getHisto1D("Cosmic_TOT")->SetYTitle("Counts");

getStatistics().createHistogram(
new TH1F("CosmicHitsPerEvent", "Number of Cosmic Hits in Event", 50, -0.5, 49.5)
);
getStatistics().getHisto1D("CosmicHitsPerEvent")->SetXTitle("Number of Cosmic Hits in Event");
getStatistics().getHisto1D("CosmicHitsPerEvent")->SetYTitle("Counts");
}
3 changes: 3 additions & 0 deletions CosmicAnalysis/EventCategorizerCosmic.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,12 @@ class EventCategorizerCosmic : public JPetUserTask

protected:
const std::string kMinCosmicTOTParamKey = "EventCategorizer_MinCosmicTOT_float";
const std::string kTOTCalculationType = "HitFinder_TOTCalculationType_std::string";
void saveEvents(const std::vector<JPetEvent>& event);
double fMinCosmicTOT = 55000.0;
bool fSaveControlHistos = true;
std::string fTOTCalculationType = "";
void initialiseHistograms();
};

#endif /* !EVENTCATEGORIZERCOSMIC_H */
3 changes: 3 additions & 0 deletions CosmicAnalysis/PARAMETERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ time window for matching Signals on the same scintillator and different sides. D
- `HitFinder_RefDetScinID_int`
`ID` of Reference Detector Scintillator, needed for creating reference hits

- `HitFinder_TOTCalculationType_std::string`
Type of the calculations of the TOT - it can be standard sum (option "standard"), a extended sum taking into account thresholds differences and calculated as rectangulars (option "rectangular"), additional extension that add also differences between the TOTs on different thresholds and calculates sum as sum of the trapezes (option "trapeze"). Default value: 'standard'

- `EventFinder_EventTime_float`
time window for grouping hits in one event. Default value `5 000 ps`

Expand Down
14 changes: 8 additions & 6 deletions ImageReconstruction/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,26 +35,28 @@ set(HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/FilterEvents.h
${CMAKE_CURRENT_SOURCE_DIR}/ImageReco.h
${CMAKE_CURRENT_SOURCE_DIR}/MLEMRunner.h
${CMAKE_CURRENT_SOURCE_DIR}/SinogramCreator.h
${CMAKE_CURRENT_SOURCE_DIR}/SinogramCreatorMC.h
${CMAKE_CURRENT_SOURCE_DIR}/ReconstructionTask.h
${CMAKE_CURRENT_SOURCE_DIR}/SinogramCreatorTools.h
${CMAKE_CURRENT_SOURCE_DIR}/../j-pet-mlem/src/util/png_writer.h)

set(SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/FilterEvents.cpp
${CMAKE_CURRENT_SOURCE_DIR}/ImageReco.cpp
${CMAKE_CURRENT_SOURCE_DIR}/MLEMRunner.cpp
${CMAKE_CURRENT_SOURCE_DIR}/SinogramCreator.cpp
${CMAKE_CURRENT_SOURCE_DIR}/SinogramCreatorMC.cpp
${CMAKE_CURRENT_SOURCE_DIR}/ReconstructionTask.cpp
${CMAKE_CURRENT_SOURCE_DIR}/SinogramCreatorTools.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../j-pet-mlem/src/util/png_writer.cpp
${CMAKE_CURRENT_SOURCE_DIR}/main.cpp)

add_subdirectory(Reconstruction)

################################################################################
## Add options from j-pet-mlem as compile flags removing PET_ prefix
## j-pet-mlem sets some parameters of the CMake build by using definitions,
## that are limited to project, it is necessary to copy them here
# configuration time options
set(PET_MAX_DETECTORS 512
CACHE INTEGER
CACHE STRING
"maximum number of detectors allowed in the scanner (impacts performance)" )
set(PET_GRANULARITY_TYPE "WARP"
CACHE STRING
Expand All @@ -75,13 +77,13 @@ set(PET_THROW_ON_ZERO_DENOMINATOR OFF
CACHE BOOL
"throw on zero denominator (event outside FOV)" )
set(PET_MAX_PIXELS_PER_THREAD 12
CACHE INTEGER
CACHE STRING
"chosen arbitrarily, no more than 11 pixels per thread in current config" )
set(PET_WARP_SIZE 32
CACHE INTEGER
CACHE STRING
"normally it should not be changed to anything else than 32" )
set(PET_MAX_THREADS_PER_BLOCK 512
CACHE INTEGER
CACHE STRING
"not used in current implementation" )
set(PET_USE_FAST_TEXT_PARSER ON
CACHE BOOL
Expand Down
Loading

0 comments on commit a2a7ee2

Please sign in to comment.