Skip to content

Commit

Permalink
Merge pull request #40 from JPETTomography/develop
Browse files Browse the repository at this point in the history
Release of Unpacker2 version 4.0.0
  • Loading branch information
alekgajos authored May 13, 2022
2 parents 23a853a + bf2962f commit e16e29d
Show file tree
Hide file tree
Showing 7 changed files with 703 additions and 25 deletions.
18 changes: 12 additions & 6 deletions .github/workflows/ci-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,26 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-16.04, ubuntu-18.04]
os: [ubuntu-22.04, ubuntu-20.04, ubuntu-18.04]

steps:
- uses: actions/checkout@v2
- name: system update
run: |
sudo apt-get -qq update
sudo apt-get install -y git libboost-all-dev libtbb-dev cmake
- name: download ROOT (for ubuntu 16.04)
- name: download ROOT (for ubuntu 22.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'
wget https://root.cern/download/root_v6.26.02.Linux-ubuntu22-x86_64-gcc11.2.tar.gz
tar xzf root_v6.26.02.Linux-ubuntu22-x86_64-gcc11.2.tar.gz
if: matrix.os == 'ubuntu-22.04'

- name: download ROOT (for ubuntu 20.04)
run: |
wget https://root.cern/download/root_v6.24.02.Linux-ubuntu20-x86_64-gcc9.3.tar.gz
tar xzf root_v6.24.02.Linux-ubuntu20-x86_64-gcc9.3.tar.gz
if: matrix.os == 'ubuntu-20.04'

- name: download ROOT (for ubuntu-18.04)
run: |
Expand Down
14 changes: 7 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ endif()
# MINOR version when you add functionality in a backwards-compatible manner, and
# PATCH version when you make backwards-compatible bug fixes.

project(Unpacker2 VERSION 3.0.0
project(Unpacker2 VERSION 4.0.0
LANGUAGES CXX)
set(PROJECT_DESCRIPTION "Unpacker2 module")

Expand Down Expand Up @@ -156,7 +156,7 @@ ROOT_GENERATE_DICTIONARY(${DICTIONARY_NAME} ${HEADERS_WITH_DICTIONARY_REQUIRED}
## End of configuration of ROOT

# Set all sources
set(SOURCES src/Unpacker2.cc src/EventIII.cc src/TDCChannel.cc ${DICTIONARY_NAME}.cxx)
set(SOURCES src/Unpacker2.cc src/Unpacker2D.cc src/EventIII.cc src/TDCChannel.cc ${DICTIONARY_NAME}.cxx)

add_library(Unpacker2 SHARED ${SOURCES})
#TODO: maybe change namespace to JPetTomography?
Expand Down Expand Up @@ -196,17 +196,17 @@ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/Unpacker2Config.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/Unpacker2ConfigVersion.cmake"
DESTINATION ${CMAKE_INSTALL_PREFIX}/cmake
)

install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libUnpacker2_rdict.pcm"
"${CMAKE_CURRENT_BINARY_DIR}/libUnpacker2.rootmap"
DESTINATION ${CMAKE_INSTALL_LIBDIR}
)

install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/thisunpacker.sh"
DESTINATION ${CMAKE_INSTALL_BINDIR})
configure_file("${PROJECT_BINARY_DIR}/Unpacker2Config.cmake" "${PROJECT_BINARY_DIR}/cmake/Unpacker2Config.cmake" COPYONLY)
configure_file("${PROJECT_BINARY_DIR}/Unpacker2ConfigVersion.cmake" "${PROJECT_BINARY_DIR}/cmake/Unpacker2ConfigVersion.cmake" COPYONLY)

configure_file("${PROJECT_BINARY_DIR}/Unpacker2Config.cmake" "${PROJECT_BINARY_DIR}/cmake/Unpacker2Config.cmake" COPYONLY)
configure_file("${PROJECT_BINARY_DIR}/Unpacker2ConfigVersion.cmake" "${PROJECT_BINARY_DIR}/cmake/Unpacker2ConfigVersion.cmake" COPYONLY)

configure_file("${CMAKE_CURRENT_SOURCE_DIR}/thisunpacker.sh" "${PROJECT_BINARY_DIR}/bin/thisunpacker.sh" COPYONLY)

Expand All @@ -215,7 +215,7 @@ add_custom_target(
copy_target
COMMAND ${CMAKE_COMMAND} -E copy "${PROJECT_BINARY_DIR}/Unpacker2Targets.cmake" "${PROJECT_BINARY_DIR}/cmake/Unpacker2Targets.cmake"
DEPENDS "${PROJECT_BINARY_DIR}/Unpacker2Targets.cmake")
add_dependencies(Unpacker2 copy_target)
add_dependencies(Unpacker2 copy_target)

#unit tests
option(PACKAGE_TESTS "Build the tests" ON)
Expand Down
9 changes: 2 additions & 7 deletions include/Unpacker2.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,8 @@ class Unpacker2 : public TObject
Unpacker2();
~Unpacker2() {}
void Init();
void UnpackSingleStep(
const std::string& inputFile, const std::string& inputPath,
const std::string& outputPath, const std::string& configFile,
int numberOfEvents, int refChannelOffset,
const std::string& TOTcalibFile, const std::string& TDCcalibFile
);
void UnpackSingleStep(const std::string& inputFile, const std::string& inputPath, const std::string& outputPath, const std::string& configFile,
int numberOfEvents, int refChannelOffset, const std::string& TOTcalibFile, const std::string& TDCcalibFile);

TH1F* loadCalibHisto(const char* calibFile);
bool loadTDCcalibFile(const char* calibFile);
Expand Down Expand Up @@ -52,7 +48,6 @@ class Unpacker2 : public TObject
UInt_t* pHdr;
UInt_t* subPHdr;


protected:
void ParseConfigFile();
void DistributeEventsSingleStep();
Expand Down
30 changes: 30 additions & 0 deletions include/Unpacker2D.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#ifndef __UNPACKER2D__
#define __UNPACKER2D__

#include <TObject.h>
#include <map>
#include <string>

#include "Unpacker2.h"

class Unpacker2D : public Unpacker2
{
public:
void UnpackSingleStep(std::string inputFile, std::string inputPath, std::string outputPath, std::string configFile, int numberOfEvents,
int refChannelOffset, std::string TDCcalibFile);

protected:
void ParseConfigFile();
void DistributeEventsSingleStep();
void BuildEvent(EventIII* e, std::map<UInt_t, std::vector<UInt_t>>* m, std::map<UInt_t, UInt_t>* refTimes);
bool loadTDCcalibFile(const char* calibFile);

const double kCoarseConstant = 2.5;
const double kFineConstant = 0.0201612903;
const int kModularOffset = 2100;
const int kNumberOfChannels = 105;
const int kNumberOfModules = 24;
const int kReferenceChannel = 104;
};

#endif
128 changes: 128 additions & 0 deletions jenkins/Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
pipeline {
agent any

stages {
stage('BuildMatrix') {
matrix {
agent any
axes {
axis {
name 'ROOT'
values 'root611', 'root612', 'root616', 'root618'
}
axis {
name 'GCC'
values 'default_gcc'
}
axis {
name 'BOOST'
values 'boost_1_58'
}
axis {
name 'OS'
values 'ubuntu16'
}
axis {
name 'CMAKE'
values 'cmake351', 'cmake36', 'cmake315'
}
}
excludes {
exclude {
axis {
name 'ROOT'
values 'root611'
}
axis {
name 'CMAKE'
values 'cmake315'
}
}
exclude {
axis {
name 'ROOT'
values 'root612'
}
axis {
name 'CMAKE'
values 'cmake315'
}
}
exclude {
axis {
name 'ROOT'
values 'root616'
}
axis {
name 'CMAKE'
values 'cmake351'
}
}
exclude {
axis {
name 'ROOT'
values 'root616'
}
axis {
name 'CMAKE'
values 'cmake315'
}
}
exclude {
axis {
name 'ROOT'
values 'root618'
}
axis {
name 'CMAKE'
values 'cmake351'
}
}
exclude {
axis {
name 'ROOT'
values 'root618'
}
axis {
name 'CMAKE'
values 'cmake36'
}
}
}
stages {
stage('Build') {
environment {
WORKSPACE_JENKINS=sh(returnStdout: true, script: "echo $WORKSPACE | sed --expression='s/r\\/j/r\\/www\\/j/g'").trim()
}
steps {
echo "Building..\nStarting build job: <${JOB_NAME}> in workspace: <${WORKSPACE}> for ${ROOT}, ${GCC}, ${BOOST}, ${OS}, ${CMAKE}"
echo "Jenkins workspace: <${WORKSPACE_JENKINS}>"
dir("jenkins/${env.OS},${env.CMAKE},${env.GCC},${env.ROOT}") {
sh label: 'docker-build', script: 'docker-compose build'
}
sh label: 'build framework', script: "docker-compose -f jenkins/${OS},${CMAKE},${GCC},${ROOT}/docker-compose.yml run --rm ${OS}${CMAKE}${GCC}${ROOT}_unpacker2"
}
}

stage('Test') {
steps {
echo 'Testing..'
sh label: 'mkdir', script: 'mkdir -p CPPCheckRaport'
sh label: 'cppcheck', script: 'cppcheck --inline-suppr --enable=all --inconclusive --xml --suppress="*:${WORKSPACE}/build/*.*" --xml-version=2 ${WORKSPACE} 2> CPPCheckRaport/cppcheck.xml'
}
}
stage('Deploy') {
steps {
echo 'Deploying....'
}
}
}
}
}
}
post {
always {
cleanWs()
}
}
}
8 changes: 3 additions & 5 deletions src/Unpacker2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,9 @@ void Unpacker2::Init()
fileSize = 0;
}

void Unpacker2::UnpackSingleStep(
const string& inputFile, const string& inputPath, const string& outputPath,
const string& configFile, int numberOfEvents, int refChannelOffset,
const string& totCalibFile, const string& tdcCalibFile
) {
void Unpacker2::UnpackSingleStep(const string& inputFile, const string& inputPath, const string& outputPath, const string& configFile,
int numberOfEvents, int refChannelOffset, const string& totCalibFile, const string& tdcCalibFile)
{

fInputFile = inputFile;
fInputFilePath = inputPath;
Expand Down
Loading

0 comments on commit e16e29d

Please sign in to comment.