Skip to content

Commit

Permalink
Merge branch 'develop' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
alekgajos committed Oct 20, 2020
2 parents 336abd2 + 1d08aed commit 289e065
Show file tree
Hide file tree
Showing 13 changed files with 365 additions and 255 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/ci-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-16.04]
os: [ubuntu-16.04, ubuntu-18.04]

steps:
- uses: actions/checkout@v2
Expand All @@ -16,10 +16,18 @@ jobs:
sudo apt-get -qq update
sudo apt-get install -y git libboost-all-dev libtbb-dev cmake
- name: download ROOT
- 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: cmake
run: |
source root/bin/thisroot.sh
Expand Down
38 changes: 24 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,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 @@ -97,18 +97,22 @@ if(ROOT_VERSION VERSION_LESS "6.10")
message(FATAL_ERROR "Only ROOT >= 6.10 is currently supported")
endif(ROOT_VERSION VERSION_LESS "6.10")

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
Expand Down Expand Up @@ -198,9 +202,15 @@ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libUnpacker2_rdict.pcm"
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)
export(EXPORT Unpacker2 FILE Unpacker2Targets.cmake NAMESPACE Unpacker2::)

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

export(EXPORT Unpacker2 FILE Unpacker2Targets.cmake NAMESPACE Unpacker2::)
add_custom_target(
copy_target
COMMAND ${CMAKE_COMMAND} -E copy "${PROJECT_BINARY_DIR}/Unpacker2Targets.cmake" "${PROJECT_BINARY_DIR}/cmake/Unpacker2Targets.cmake"
Expand Down
4 changes: 2 additions & 2 deletions Unpacker2_LinkDef.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#pragma link off all classes;
#pragma link off all functions;

#pragma link C++ class EventIII+;
#pragma link C++ class TDCChannel+;
#pragma link C++ class EventIII + ;
#pragma link C++ class TDCChannel + ;

#endif
32 changes: 15 additions & 17 deletions include/EventIII.h
Original file line number Diff line number Diff line change
@@ -1,38 +1,36 @@
#ifndef EventIII_h
#define EventIII_h

#include <fstream>
#include <TObject.h>
#include <TClonesArray.h>
#include "TDCChannel.h"
#include <iostream>
#include <TClonesArray.h>
#include <TObject.h>
#include <TTree.h>

#include <fstream>
#include <iostream>

class TDCChannel;

class EventIII : public TNamed {

class EventIII : public TNamed
{

private:
Int_t totalNTDCChannels;

public:
TClonesArray* TDCChannels;

EventIII();
virtual ~EventIII() { Clear(); }

TDCChannel* AddTDCChannel(int channel);

Int_t GetTotalNTDCChannels() { return totalNTDCChannels; }

TClonesArray* GetTDCChannelsArray() { return TDCChannels; }

void Clear(void);

ClassDef(EventIII,1);

};

ClassDef(EventIII, 1);
};

#endif
38 changes: 21 additions & 17 deletions include/TDCChannel.h
Original file line number Diff line number Diff line change
@@ -1,52 +1,56 @@
#ifndef TDCChannel_h
#define TDCChannel_h

#include <fstream>
#include <TObject.h>
#include <TClonesArray.h>
#include <TObject.h>
#include <fstream>
#include <iostream>
#include <vector>

class TDCChannel : public TObject {
class TDCChannel : public TObject
{

protected:
Int_t channel;

std::vector<double> leadTimes;
std::vector<double> trailTimes;

public:

public:
TDCChannel();
~TDCChannel();

void SetChannel(Int_t channel) { this->channel = channel; }
int GetChannel() { return channel; }
int GetLeadHitsNum() { return leadTimes.size(); }
int GetTrailHitsNum() { return trailTimes.size(); }

void AddLead(double lead);
void AddTrail(double trail);

double GetLeadTime(unsigned int mult) {
if( mult >= leadTimes.size() ){
std::cout<<"asked for lead time out of range."<<std::endl;
double GetLeadTime(unsigned int mult)
{
if (mult >= leadTimes.size())
{
std::cout << "asked for lead time out of range." << std::endl;
return 0.;
}
return leadTimes[mult];
}

double GetTrailTime(unsigned int mult) {
if( mult >= trailTimes.size() ){
std::cout<<"asked for trail time out of range."<<std::endl;
double GetTrailTime(unsigned int mult)
{
if (mult >= trailTimes.size())
{
std::cout << "asked for trail time out of range." << std::endl;
return 0.;
}
return trailTimes[mult];
}

void Clear(Option_t * opt);
ClassDef(TDCChannel,2);
void Clear(Option_t* opt);

ClassDef(TDCChannel, 2);
};

#endif
74 changes: 32 additions & 42 deletions include/TimeDateDecoder.h
Original file line number Diff line number Diff line change
@@ -1,46 +1,36 @@
#include <Rtypes.h>
#include <sstream>
#include <iomanip>
#include <sstream>

namespace TimeDateDecoder
{
static unsigned int day(UInt_t x) { return (x & 0x00FF); }

static unsigned int sec(UInt_t x) { return (x & 0x00FF); }

static unsigned int month(UInt_t x) { return ((x & 0x0F00) >> 8) + 1; }

namespace TimeDateDecoder{
static unsigned int day(UInt_t x){
return (x & 0x00FF);
}

static unsigned int sec(UInt_t x){
return (x & 0x00FF);
}

static unsigned int month(UInt_t x){
return ((x & 0x0F00)>>8) + 1;
}

static unsigned int min(UInt_t x){
return (x & 0xFF00)>>8;
}

static unsigned int hour(UInt_t x){
return (x & 0x00FF0000)>>16;
}

static unsigned int year(UInt_t x){
return ((x & 0xFFFF0000)>>16) - 100;
}

static std::string formatTimeString(UInt_t date_encoded, UInt_t time_encoded){
std::stringstream ss;
ss << std::setfill('0') << std::setw(2) << year(date_encoded);
ss << "-";
ss << std::setfill('0') << std::setw(2) << month(date_encoded);
ss << "-";
ss << std::setfill('0') << std::setw(2) << day(date_encoded);
ss << " ";
ss << std::setfill('0') << std::setw(2) << hour(time_encoded);
ss << ":";
ss << std::setfill('0') << std::setw(2) << min(time_encoded);
ss << ":";
ss << std::setfill('0') << std::setw(2) << sec(time_encoded);
return ss.str();
}

static unsigned int min(UInt_t x) { return (x & 0xFF00) >> 8; }

static unsigned int hour(UInt_t x) { return (x & 0x00FF0000) >> 16; }

static unsigned int year(UInt_t x) { return ((x & 0xFFFF0000) >> 16) - 100; }

static std::string formatTimeString(UInt_t date_encoded, UInt_t time_encoded)
{
std::stringstream ss;
ss << std::setfill('0') << std::setw(2) << year(date_encoded);
ss << "-";
ss << std::setfill('0') << std::setw(2) << month(date_encoded);
ss << "-";
ss << std::setfill('0') << std::setw(2) << day(date_encoded);
ss << " ";
ss << std::setfill('0') << std::setw(2) << hour(time_encoded);
ss << ":";
ss << std::setfill('0') << std::setw(2) << min(time_encoded);
ss << ":";
ss << std::setfill('0') << std::setw(2) << sec(time_encoded);
return ss.str();
}

} // namespace TimeDateDecoder
Loading

0 comments on commit 289e065

Please sign in to comment.