Skip to content

Commit

Permalink
Merge branch 'master' into signal-ana
Browse files Browse the repository at this point in the history
  • Loading branch information
juanangp authored Jun 20, 2023
2 parents 8ca222a + 11822a7 commit 474dd4a
Show file tree
Hide file tree
Showing 37 changed files with 3,745 additions and 492 deletions.
2 changes: 1 addition & 1 deletion .github/pr-badge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
message: "Ok: $additions"
color: "green"
when: "$additions < 100"
- imageUrl: "https://github.com/rest-for-physics/detectorlib/actions/workflows/validation.yml/badge.svg?branch=$branchName"
- imageUrl: "https://github.com/rest-for-physics/detectorlib/actions/workflows/frameworkValidation.yml/badge.svg?branch=$branchName"
url: "https://github.com/rest-for-physics/detectorlib/commits/$branchName"
68 changes: 67 additions & 1 deletion .github/workflows/validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,75 @@ jobs:
- name: Build and install
uses: rest-for-physics/framework/.github/actions/build@master
with:
cmake-flags: "-DCMAKE_INSTALL_PREFIX=${{ env.REST_PATH }} -DCMAKE_BUILD_TYPE=${{ env.CMAKE_BUILD_TYPE }} -DREST_WELCOME=ON -DRESTLIB_DETECTOR=ON"
cmake-flags: "-DCMAKE_INSTALL_PREFIX=${{ env.REST_PATH }} -DCMAKE_BUILD_TYPE=${{ env.CMAKE_BUILD_TYPE }} -DREST_WELCOME=ON -DRESTLIB_DETECTOR=ON -DREST_GARFIELD=ON"
branch: ${{ env.BRANCH_NAME }}
- name: Load REST libraries
run: |
source ${{ env.REST_PATH }}/thisREST.sh
restRoot -b -q
- name: Cache framework installation
id: detectorlib-install-cache
uses: actions/cache@v3
with:
key: ${{ env.BRANCH_NAME }}-${{ github.sha }}
path: ${{ env.REST_PATH }}

#- name: Load Gas
# run: |
#source ${{ env.REST_PATH }}/thisREST.sh
#cd framework/pipeline/metadata/gas/
#restRoot -b -q LoadGasFromServerAndValidate.C
# Not working, not used in gitlab pipeline
#- name: Generate Gas
# run: |
# source ${{ env.REST_PATH }}/thisREST.sh
# source $(root-config --bindir)/thisroot.sh
# cd framework/pipeline/metadata/gas/
# restRoot -b -q GenerateDummyGas.C

readout:
name: "Readout"
runs-on: ubuntu-latest
container:
image: ghcr.io/lobis/root-geant4-garfield:rest-for-physics
needs: [ build-detectorlib ]
steps:
- uses: rest-for-physics/framework/.github/actions/checkout@master
with:
branch: ${{ env.BRANCH_NAME }}
repository: rest-for-physics/detectorlib
path: ${{ env.DETECTOR_LIB_PATH }}
- name: Restore cache
uses: actions/cache@v3
id: detectorlib-install-cache
with:
key: ${{ env.BRANCH_NAME }}-${{ github.sha }}
path: ${{ env.REST_PATH }}
- name: Manager readout generation
run: |
source ${{ env.REST_PATH }}/thisREST.sh
cd ${{ env.DETECTOR_LIB_PATH }}/pipeline/readout
restManager --c generateReadout.rml --o readout.root
echo "Generating print.txt"
restRoot -b -q PrintReadout.C'("readout.root")'
ls
echo "Validating"
python3 compareFiles.py
- name: Basic Readout repository tests
run: |
source ${{ env.REST_PATH }}/thisREST.sh
git clone https://github.com/rest-for-physics/basic-readouts.git
cd basic-readouts/
restRoot -b -q GenerateReadouts.C'("basic.root")'
restRoot -b -q BasicValidation.C'("basic.root", "pixelDecoding")'
# We need to introduce basic validation here
# - diff validation.txt print.txt
# - name: Basic Readout
# run: |
# source ${{ env.REST_PATH }}/thisREST.sh
# cd framework/projects/basic-examples/
# git submodule update --init .
# cd basic-readouts
# git submodule update --init .
# restRoot -b -q GenerateReadouts.C'("basic.root")'
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
set(LibraryVersion "1.9")
set(LibraryVersion "2.0")
add_definitions(-DLIBRARY_VERSION="${LibraryVersion}")

# find garfield libs and includes
Expand Down
2 changes: 0 additions & 2 deletions inc/TRestDetectorElectronDiffusionProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,13 @@

class TRestDetectorElectronDiffusionProcess : public TRestEventProcess {
private:
#ifndef __CINT__
TRestDetectorHitsEvent* fInputHitsEvent; //!
TRestDetectorHitsEvent* fOutputHitsEvent; //!

TRestDetectorGas* fGas; //!
TRestDetectorReadout* fReadout; //!

TRandom3* fRandom; //!
#endif

void InitFromConfigFile() override;

Expand Down
2 changes: 0 additions & 2 deletions inc/TRestDetectorGas.h
Original file line number Diff line number Diff line change
Expand Up @@ -236,10 +236,8 @@ class TRestDetectorGas : public TRestDetectorDriftVolume {
return fGasComponentFraction[n];
}

#ifndef __CINT__
/// Return pointer to Garfield::MediumGas for gas properties
inline MediumMagboltz* GetGasMedium() const { return fGasMedium; };
#endif

/// Return reference name of the corresponding material in GDML file
inline TString GetGDMLMaterialRef() const { return fGDMLMaterialRef; };
Expand Down
5 changes: 1 addition & 4 deletions inc/TRestDetectorHitsShuffleProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,8 @@

class TRestDetectorHitsShuffleProcess : public TRestEventProcess {
private:
#ifndef __CINT__
TRestDetectorHitsEvent* fHitsEvent; //!

TRandom3* fRandom; //!
#endif
TRandom3* fRandom; //!

void InitFromConfigFile() override;

Expand Down
2 changes: 1 addition & 1 deletion inc/TRestDetectorPositionMappingProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class TRestDetectorPositionMappingProcess : public TRestEventProcess {
TRestDetectorPositionMappingProcess();
TRestDetectorPositionMappingProcess(const char* configFilename);

~TRestDetectorPositionMappingProcess();
~TRestDetectorPositionMappingProcess() override;

ClassDefOverride(TRestDetectorPositionMappingProcess, 1);
};
Expand Down
9 changes: 3 additions & 6 deletions inc/TRestDetectorReadout.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#ifndef RestCore_TRestDetectorReadout
#define RestCore_TRestDetectorReadout

#include <TObject.h>
#include <TRestMetadata.h>

#include <iostream>
Expand All @@ -44,12 +43,10 @@ class TRestDetectorReadout : public TRestMetadata {
std::vector<TRestDetectorReadoutPlane>
fReadoutPlanes; ///< A std::vector storing the TRestDetectorReadoutPlane definitions.

#ifndef __CINT__
Int_t fMappingNodes; //!///< Number of nodes per axis used on the readout
//! coordinate mapping. See also TRestDetectorReadoutMapping.
std::vector<TRestDetectorReadoutModule> fModuleDefinitions; //!///< A std::vector storing the different
//! TRestDetectorReadoutModule definitions.
#endif

void ValidateReadout();

Expand All @@ -74,7 +71,7 @@ class TRestDetectorReadout : public TRestMetadata {
/////////////////////////////////////
TRestDetectorReadoutModule* ParseModuleDefinition(TiXmlElement* moduleDefinition);
void GetPlaneModuleChannel(Int_t daqID, Int_t& planeID, Int_t& moduleID, Int_t& channelID);
Int_t GetHitsDaqChannel(const TVector3& hitPosition, Int_t& planeID, Int_t& moduleID, Int_t& channelID);
Int_t GetHitsDaqChannel(const TVector3& position, Int_t& planeID, Int_t& moduleID, Int_t& channelID);
Int_t GetHitsDaqChannelAtReadoutPlane(const TVector3& hitPosition, Int_t& moduleID, Int_t& channelID,
Int_t planeId = 0);
Double_t GetX(Int_t signalID);
Expand All @@ -97,10 +94,10 @@ class TRestDetectorReadout : public TRestMetadata {

// Constructor
TRestDetectorReadout();
TRestDetectorReadout(const char* configFilename);
explicit TRestDetectorReadout(const char* configFilename);
TRestDetectorReadout(const char* configFilename, std::string name);
// Destructor
virtual ~TRestDetectorReadout();
~TRestDetectorReadout() override;

ClassDefOverride(TRestDetectorReadout, 1);
};
Expand Down
7 changes: 3 additions & 4 deletions inc/TRestDetectorReadoutChannel.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#ifndef RestCore_TRestDetectorReadoutChannel
#define RestCore_TRestDetectorReadoutChannel

#include <TObject.h>
#include <TRestMetadata.h>

#include <iostream>
Expand All @@ -42,7 +41,7 @@ enum TRestDetectorReadoutChannelType {

/// A class to store the readout channel definition used in TRestDetectorReadoutModule.
/// It allows to integrate any number of independent readout pixels.
class TRestDetectorReadoutChannel : public TObject {
class TRestDetectorReadoutChannel {
private:
Int_t fDaqID; ///< Defines the corresponding daq channel id. See decoding
///< details at TRestDetectorReadout.
Expand Down Expand Up @@ -87,7 +86,7 @@ class TRestDetectorReadoutChannel : public TObject {
void SetChannelID(Int_t id) { fChannelId = id; }

/// Adds a new pixel to the readout channel
void AddPixel(TRestDetectorReadoutPixel pix) { fReadoutPixel.push_back(pix); }
void AddPixel(const TRestDetectorReadoutPixel& pixel) { fReadoutPixel.emplace_back(pixel); }

Int_t isInside(Double_t x, Double_t y);

Expand All @@ -98,6 +97,6 @@ class TRestDetectorReadoutChannel : public TObject {
// Destructor
virtual ~TRestDetectorReadoutChannel();

ClassDef(TRestDetectorReadoutChannel, 3); // REST run class
ClassDef(TRestDetectorReadoutChannel, 4); // REST run class
};
#endif
18 changes: 8 additions & 10 deletions inc/TRestDetectorReadoutEventViewer.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,17 @@

#include <TCanvas.h>
#include <TPad.h>
#include <TRestEventViewer.h>

#include "TRestDetectorSignalEvent.h"
#include "TRestEventViewer.h"
// #include "TRestDecoding.h"
#include "TH2Poly.h"
#include "TRestDetectorReadout.h"
#include "TRestDetectorSignalEvent.h"

class TRestDetectorReadoutEventViewer : public TRestEventViewer {
protected:
TCanvas* fCanvasXY;
TCanvas* fCanvasXZYZ;

// TRestDecoding *fDecoding;
TRestDetectorReadout* fReadout;

TRestDetectorSignalEvent* fSignalEvent;
Expand All @@ -38,26 +36,26 @@ class TRestDetectorReadoutEventViewer : public TRestEventViewer {
TH2D* fHistoXZ;
TH2D* fHistoYZ;

bool isfirstEvent;
bool isFirstevent;

double xmin, xmax, ymin, ymax, zmin, zmax;

public:
void Initialize();
void Initialize() override;
// Finalize initialization based on arg. TRestDetectorReadout
void SetReadout(TRestDetectorReadout* readout);

void AddEvent(TRestEvent* ev);
void AddEvent(TRestEvent* ev) override;
void DrawReadoutPulses();
TRestDetectorReadoutChannel* GetChannel(int readoutChannel);
TRestDetectorReadoutModule* GetModule(int readoutChannel);

// Constructor
TRestDetectorReadoutEventViewer();
// Destructor
~TRestDetectorReadoutEventViewer();
~TRestDetectorReadoutEventViewer() override;

ClassDef(TRestDetectorReadoutEventViewer, 1); // class inherited from
// TRestEventViewer
ClassDefOverride(TRestDetectorReadoutEventViewer, 1); // class inherited from
// TRestEventViewer
};
#endif
9 changes: 4 additions & 5 deletions inc/TRestDetectorReadoutMapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,12 @@
#define RestCore_TRestDetectorReadoutMapping

#include <TMatrixD.h>
#include <TObject.h>

#include <iostream>

/// This class defines a uniform 2-dimensional grid relating its nodes to the
/// pixels of a readout.
class TRestDetectorReadoutMapping : public TObject {
class TRestDetectorReadoutMapping {
private:
Int_t fNodesX; ///< The number of nodes in the x-axis.
Int_t fNodesY; ///< The number of nodes in the y-axis.
Expand All @@ -51,10 +50,10 @@ class TRestDetectorReadoutMapping : public TObject {
/// Returns the number of nodes in Y.
inline Int_t GetNumberOfNodesY() const { return fNodesY; }

/// Gets the channel id correspoding to a given node (i,j)
/// Gets the channel id corresponding to a given node (i,j)
Int_t GetChannelByNode(Int_t i, Int_t j) { return fChannel[i][j]; }

/// Gets the pixel id correspoding to a given node (i,j)
/// Gets the pixel id corresponding to a given node (i,j)
Int_t GetPixelByNode(Int_t i, Int_t j) { return fPixel[i][j]; }

Bool_t isNodeSet(Int_t i, Int_t j);
Expand Down Expand Up @@ -88,6 +87,6 @@ class TRestDetectorReadoutMapping : public TObject {
// Destructor
~TRestDetectorReadoutMapping();

ClassDef(TRestDetectorReadoutMapping, 1);
ClassDef(TRestDetectorReadoutMapping, 2);
};
#endif
Loading

0 comments on commit 474dd4a

Please sign in to comment.