Skip to content

Commit

Permalink
Merge pull request #283 from JPETTomography/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
alekgajos authored May 13, 2022
2 parents d0b03d4 + 2710fb2 commit af4c4c0
Show file tree
Hide file tree
Showing 65 changed files with 2,266 additions and 518 deletions.
17 changes: 11 additions & 6 deletions .github/workflows/ci-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,25 @@ 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.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.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.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: |
wget http://sphinx.if.uj.edu.pl/framework/root-6-20-06-ubuntu18-jpet.tar.gz
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ endif()
# MAJOR version when you make incompatible API changes,
# MINOR version when you add functionality in a backwards-compatible manner, and
# PATCH version when you make backwards-compatible bug fixes.
project(JPetFramework VERSION 9.0.0
project(JPetFramework VERSION 10.0.0
LANGUAGES CXX)
set(PROJECT_DESCRIPTION "JPetFramework module")

Expand Down
2 changes: 1 addition & 1 deletion NOTICE
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
J-PET Framework
Copyright 2010-2020 The J-PET Framework Authors. All rights reserved.
Copyright 2010-2021 The J-PET Framework Authors. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
10 changes: 7 additions & 3 deletions doc/doxygen/Doxyfile.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ QUIET = YES
# Basic settings:
PROJECT_NAME = "@CMAKE_PROJECT_NAME@"
PROJECT_NUMBER = @PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@@VERSION_TYPE@
STRIP_FROM_PATH = @CMAKE_CURRENT_SOURCE_DIR@ \
STRIP_FROM_PATH = @CMAKE_CURRENT_SOURCE_DIR@ \
@PROJECT_SOURCE_DIR@
INPUT = @PROJECT_SOURCE_DIR@/README.md \
@PROJECT_SOURCE_DIR@/INSTALL.md \
@CMAKE_CURRENT_SOURCE_DIR@ \
@CMAKE_CURRENT_SOURCE_DIR@ \
@PROJECT_SOURCE_DIR@/src \
@PROJECT_SOURCE_DIR@/include

FILE_PATTERNS = *.h \
*.hpp \
*.hh \
Expand Down Expand Up @@ -123,3 +123,7 @@ STRIP_CODE_COMMENTS = NO
# Side panel
# If you enable this, change .container max-width: 960px; to 1240px
GENERATE_TREEVIEW = YES

# Draw class inheritance graphs
CLASS_DIAGRAMS = YES
CLASS_GRAPH = YES
4 changes: 3 additions & 1 deletion include/Core/JPetTaskFactory/JPetTaskFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class JPetTaskFactory
* @return chain of task generators
*/
TaskGeneratorChain createTaskGeneratorChain(const std::map<std::string, boost::any>& options) const;

/**
* @brief Method to register the task generator. TDerived corresponds to the task type.
* The name string is also passed as string parameter to the class constructor.
Expand Down Expand Up @@ -145,6 +145,8 @@ TaskGeneratorChain generateTaskGeneratorChain(const std::vector<TaskInfo>& taskI
const std::map<std::string, boost::any>& options
);

TaskGeneratorChain generateDirectTaskGeneratorChain(const std::vector<TaskInfo>& taskInfoVect, const std::map<std::string, TaskGenerator>& generatorsMap, const std::map<std::string, boost::any>& options);

/**
* @brief Function adds the set of predefined task generators
* to the beginning of outChain based on the provided options.
Expand Down
36 changes: 15 additions & 21 deletions include/Core/JPetTaskIO/JPetTaskIO.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
#ifndef JPETTASKIO_H
#define JPETTASKIO_H

#include "./JPetProgressBarManager/JPetProgressBarManager.h"
#include "./JPetTaskInterface/JPetTaskInterface.h"
#include "./JPetParamManager/JPetParamManager.h"
#include "./JPetStatistics/JPetStatistics.h"
#include "./JPetTaskIO/JPetOutputHandler.h"
#include "./JPetTaskIO/JPetInputHandler.h"
#include "./JPetParams/JPetParams.h"
#include "./JPetProgressBarManager/JPetProgressBarManager.h"
#include "./JPetStatistics/JPetStatistics.h"
#include "./JPetTask/JPetTask.h"
#include "./JPetTaskIO/JPetInputHandler.h"
#include "./JPetTaskIO/JPetOutputHandler.h"
#include "./JPetTaskInterface/JPetTaskInterface.h"
#include <memory>
#include <string>

Expand All @@ -34,12 +34,10 @@ class JPetStatistics;
/**
* @brief Helper structure to encapsulate some fields
*/
struct TaskIOFileInfo {
TaskIOFileInfo(
const std::string& inType, const std::string& outType,
const std::string& outFullPath, bool resetOutPath):
fInFileType(inType), fOutFileType(outType),
fOutFileFullPath(outFullPath), fResetOutputPath(resetOutPath) {};
struct TaskIOFileInfo
{
TaskIOFileInfo(const std::string& inType, const std::string& outType, const std::string& outFullPath, bool resetOutPath)
: fInFileType(inType), fOutFileType(outType), fOutFileFullPath(outFullPath), fResetOutputPath(resetOutPath){};
std::string fInFileType;
std::string fOutFileType;
std::string fOutFileFullPath;
Expand All @@ -48,31 +46,27 @@ struct TaskIOFileInfo {

/**
* @brief Class representing computing task with input/output operations.
* In the current implementation the single entry that is read by the reader
* corresponds to a JPetTimeWindow object.
* It is not meant to be used directly, rather used as specialized classes
* that must provide an implementation of the method run().
*/
class JPetTaskIO: public JPetTask
class JPetTaskIO : public JPetTask
{
public:
JPetTaskIO(const char* name = "", const char* in_file_type = "", const char* out_file_type = "");
virtual ~JPetTaskIO();
virtual bool init(const JPetParams& inOptions) override;
virtual bool run(const JPetDataInterface& inData) override;
virtual bool run(const JPetDataInterface& inData) = 0;
virtual bool terminate(JPetParams& outOptions) override;
virtual void addSubTask(std::unique_ptr<JPetTaskInterface> subTask) override;
void displayProgressBar(std::string taskName, int currentEventNumber, int numberOfEvents) const;
virtual JPetParams mergeWithExtraParams(
const JPetParams& originalParams, const JPetParams& extraParams
) const ;
virtual JPetParams mergeWithExtraParams(const JPetParams& originalParams, const JPetParams& extraParams) const;
void setParams(const JPetParams& opts);
JPetParams getParams() const;
bool isOutput() const;
bool isInput() const;

protected:
virtual std::tuple<bool, std::string, std::string, bool> setInputAndOutputFile(
const jpet_options_tools::OptsStrAny options
) const;
virtual std::tuple<bool, std::string, std::string, bool> setInputAndOutputFile(const jpet_options_tools::OptsStrAny options) const;
virtual bool createInputObjects(const char* inputFilename);
virtual bool createOutputObjects(const char* outputFilename);
const JPetParamBank& getParamBank();
Expand Down
38 changes: 38 additions & 0 deletions include/Core/JPetTaskIOLoopPerSubTask/JPetTaskIOLoopPerSubTask.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/**
* @copyright Copyright 2020 The J-PET Framework Authors. All rights reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may find a copy of the License in the LICENCE file.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @file JPetTaskIOLoopPerSubTask.h
*/

#include "./JPetTaskIO/JPetTaskIO.h"

#ifndef JPETTASKIOLOOPPERSUBTASK_H
#define JPETTASKIOLOOPPERSUBTASK_H

/**
* @brief Class representing a stream of computing tasks (subtasks),
* executed by subsequently processing all events task by task.
* E.g. all events are first processed by the first subtask, next
* the results are processed by the second subtask and so on.
* The intermediate results are saved in the output root files and
* the subtasks are reading the events from those files.
*
* This class only overrides the "run" method of its base JPetTaskIO.
*/
class JPetTaskIOLoopPerSubTask : public JPetTaskIO
{
public:
JPetTaskIOLoopPerSubTask(const char* name = "", const char* in_file_type = "", const char* out_file_type = "");
virtual bool run(const JPetDataInterface& inData) override;
virtual ~JPetTaskIOLoopPerSubTask();
};
#endif /* !JPETTASKIOLOOPPERSUBTASK_H */
40 changes: 40 additions & 0 deletions include/Core/JPetTaskStreamIO/JPetTaskStreamIO.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/**
* @copyright Copyright 2020 The J-PET Framework Authors. All rights reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may find a copy of the License in the LICENCE file.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @file JPetTaskStreamIO.h
*/

#ifndef JPETTASKSTREAMIO_H
#define JPETTASKSTREAMIO_H

#include "./JPetTaskIO/JPetTaskIO.h"

/**
* @brief Class representing a stream of computing tasks (subtasks),
* executed on event by event basis (JPetTimeWindow object). E.g.
* first event is processed by all subtasks, then the next one and so on.
* The input and output is used only for the first and last task
* in the stream.
*
* This class only overrides the "run" method of its base JPetTaskIO.
*/
class JPetTaskStreamIO : public JPetTaskIO
{
public:
JPetTaskStreamIO(const char* name = "", const char* in_file_type = "", const char* out_file_type = "");
virtual bool run(const JPetDataInterface& inData) override;
virtual ~JPetTaskStreamIO();

protected:
private:
};
#endif /* !JPETTASKSTREAMIO_H */
57 changes: 32 additions & 25 deletions include/Core/JPetWriter/JPetWriter.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @copyright Copyright 2018 The J-PET Framework Authors. All rights reserved.
* @copyright Copyright 2021 The J-PET Framework Authors. All rights reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may find a copy of the License in the LICENCE file.
Expand All @@ -23,23 +23,29 @@ namespace boost;
class boost::noncopyable;
#endif /* __CINT __ */

#include "./JPetBarrelSlot/JPetBarrelSlot.h"
#include "./JPetPhysSignal/JPetPhysSignal.h"
#include "./JPetTimeWindow/JPetTimeWindow.h"
#include "./JPetSigCh/JPetSigCh.h"
#include "./JPetEvent/JPetEvent.h"
#include "./JPetLoggerInclude.h"
#include "./JPetScin/JPetScin.h"
#include "./JPetHit/JPetHit.h"
#include "./JPetLOR/JPetLOR.h"
#include "./JPetFEB/JPetFEB.h"
#include "./JPetTRB/JPetTRB.h"
#include "./JPetPM/JPetPM.h"
#include "JPetBarrelSlot/JPetBarrelSlot.h"
#include "JPetBaseHit/JPetBaseHit.h"
#include "JPetRawMCHit/JPetRawMCHit.h"
#include "JPetEvent/JPetEvent.h"
#include "JPetFEB/JPetFEB.h"
#include "JPetHit/JPetHit.h"
#include "JPetLOR/JPetLOR.h"
#include "JPetLoggerInclude.h"
#include "JPetMCRecoHit/JPetMCRecoHit.h"
#include "JPetPM/JPetPM.h"
#include "JPetPhysRecoHit/JPetPhysRecoHit.h"
#include "JPetPhysSignal/JPetPhysSignal.h"
#include "JPetRecoHit/JPetRecoHit.h"
#include "JPetScin/JPetScin.h"
#include "JPetSigCh/JPetSigCh.h"
#include "JPetTRB/JPetTRB.h"
#include "JPetTimeWindow/JPetTimeWindow.h"

#include <TFile.h>
#include <TList.h>
#include <TTree.h>
#include <vector>
#include <string>
#include <vector>

/**
* @brief A class responsible for writing any data to ROOT trees.
Expand All @@ -64,18 +70,17 @@ class JPetWriter : private boost::noncopyable
JPetWriter(const char* p_fileName);
virtual ~JPetWriter(void);
void closeFile();
template <class T> bool write(const T& obj);
template <class T>
bool write(const T& obj);
void writeHeader(TObject* header);
void writeCollection(const TCollection* hash, const char* dirname,
const char* subdirname = "");
int writeObject(const TObject* obj, const char* name)
{
return fFile->WriteTObject(obj, name);
}
void writeCollection(const TCollection* hash, const char* dirname, const char* subdirname = "");
int writeObject(const TObject* obj, const char* name) { return fFile->WriteTObject(obj, name); }
virtual bool isOpen() const
{
if (fFile) return (fFile->IsOpen() && !fFile->IsZombie());
else return false;
if (fFile)
return (fFile->IsOpen() && !fFile->IsZombie());
else
return false;
}

protected:
Expand All @@ -90,7 +95,8 @@ template <class T>
bool JPetWriter::write(const T& obj)
{
DEBUG("JPetWriter");
if ( !fFile->IsOpen() ) {
if (!fFile->IsOpen())
{
ERROR("Could not write to file. Have you closed it already?");
return false;
}
Expand All @@ -101,7 +107,8 @@ bool JPetWriter::write(const T& obj)
DEBUG("filler");
T* filler = const_cast<T*>(&obj);
assert(filler);
if (!fIsBranchCreated) {
if (!fIsBranchCreated)
{
DEBUG("Branch name:" + std::string(filler->GetName()));
assert(fTree);
fTree->Branch(filler->GetName(), filler->GetName(), &filler);
Expand Down
Loading

0 comments on commit af4c4c0

Please sign in to comment.