Skip to content

Commit 474dd4a

Browse files
authored
Merge branch 'master' into signal-ana
2 parents 8ca222a + 11822a7 commit 474dd4a

37 files changed

+3745
-492
lines changed

.github/pr-badge.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@
1313
message: "Ok: $additions"
1414
color: "green"
1515
when: "$additions < 100"
16-
- imageUrl: "https://github.com/rest-for-physics/detectorlib/actions/workflows/validation.yml/badge.svg?branch=$branchName"
16+
- imageUrl: "https://github.com/rest-for-physics/detectorlib/actions/workflows/frameworkValidation.yml/badge.svg?branch=$branchName"
1717
url: "https://github.com/rest-for-physics/detectorlib/commits/$branchName"

.github/workflows/validation.yml

Lines changed: 67 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,75 @@ jobs:
5555
- name: Build and install
5656
uses: rest-for-physics/framework/.github/actions/build@master
5757
with:
58-
cmake-flags: "-DCMAKE_INSTALL_PREFIX=${{ env.REST_PATH }} -DCMAKE_BUILD_TYPE=${{ env.CMAKE_BUILD_TYPE }} -DREST_WELCOME=ON -DRESTLIB_DETECTOR=ON"
58+
cmake-flags: "-DCMAKE_INSTALL_PREFIX=${{ env.REST_PATH }} -DCMAKE_BUILD_TYPE=${{ env.CMAKE_BUILD_TYPE }} -DREST_WELCOME=ON -DRESTLIB_DETECTOR=ON -DREST_GARFIELD=ON"
5959
branch: ${{ env.BRANCH_NAME }}
6060
- name: Load REST libraries
6161
run: |
6262
source ${{ env.REST_PATH }}/thisREST.sh
6363
restRoot -b -q
64+
- name: Cache framework installation
65+
id: detectorlib-install-cache
66+
uses: actions/cache@v3
67+
with:
68+
key: ${{ env.BRANCH_NAME }}-${{ github.sha }}
69+
path: ${{ env.REST_PATH }}
70+
71+
#- name: Load Gas
72+
# run: |
73+
#source ${{ env.REST_PATH }}/thisREST.sh
74+
#cd framework/pipeline/metadata/gas/
75+
#restRoot -b -q LoadGasFromServerAndValidate.C
76+
# Not working, not used in gitlab pipeline
77+
#- name: Generate Gas
78+
# run: |
79+
# source ${{ env.REST_PATH }}/thisREST.sh
80+
# source $(root-config --bindir)/thisroot.sh
81+
# cd framework/pipeline/metadata/gas/
82+
# restRoot -b -q GenerateDummyGas.C
83+
84+
readout:
85+
name: "Readout"
86+
runs-on: ubuntu-latest
87+
container:
88+
image: ghcr.io/lobis/root-geant4-garfield:rest-for-physics
89+
needs: [ build-detectorlib ]
90+
steps:
91+
- uses: rest-for-physics/framework/.github/actions/checkout@master
92+
with:
93+
branch: ${{ env.BRANCH_NAME }}
94+
repository: rest-for-physics/detectorlib
95+
path: ${{ env.DETECTOR_LIB_PATH }}
96+
- name: Restore cache
97+
uses: actions/cache@v3
98+
id: detectorlib-install-cache
99+
with:
100+
key: ${{ env.BRANCH_NAME }}-${{ github.sha }}
101+
path: ${{ env.REST_PATH }}
102+
- name: Manager readout generation
103+
run: |
104+
source ${{ env.REST_PATH }}/thisREST.sh
105+
cd ${{ env.DETECTOR_LIB_PATH }}/pipeline/readout
106+
restManager --c generateReadout.rml --o readout.root
107+
echo "Generating print.txt"
108+
restRoot -b -q PrintReadout.C'("readout.root")'
109+
ls
110+
echo "Validating"
111+
python3 compareFiles.py
112+
- name: Basic Readout repository tests
113+
run: |
114+
source ${{ env.REST_PATH }}/thisREST.sh
115+
git clone https://github.com/rest-for-physics/basic-readouts.git
116+
cd basic-readouts/
117+
restRoot -b -q GenerateReadouts.C'("basic.root")'
118+
restRoot -b -q BasicValidation.C'("basic.root", "pixelDecoding")'
119+
120+
# We need to introduce basic validation here
121+
# - diff validation.txt print.txt
122+
# - name: Basic Readout
123+
# run: |
124+
# source ${{ env.REST_PATH }}/thisREST.sh
125+
# cd framework/projects/basic-examples/
126+
# git submodule update --init .
127+
# cd basic-readouts
128+
# git submodule update --init .
129+
# restRoot -b -q GenerateReadouts.C'("basic.root")'

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
set(LibraryVersion "1.9")
1+
set(LibraryVersion "2.0")
22
add_definitions(-DLIBRARY_VERSION="${LibraryVersion}")
33

44
# find garfield libs and includes

inc/TRestDetectorElectronDiffusionProcess.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,13 @@
2121

2222
class TRestDetectorElectronDiffusionProcess : public TRestEventProcess {
2323
private:
24-
#ifndef __CINT__
2524
TRestDetectorHitsEvent* fInputHitsEvent; //!
2625
TRestDetectorHitsEvent* fOutputHitsEvent; //!
2726

2827
TRestDetectorGas* fGas; //!
2928
TRestDetectorReadout* fReadout; //!
3029

3130
TRandom3* fRandom; //!
32-
#endif
3331

3432
void InitFromConfigFile() override;
3533

inc/TRestDetectorGas.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,10 +236,8 @@ class TRestDetectorGas : public TRestDetectorDriftVolume {
236236
return fGasComponentFraction[n];
237237
}
238238

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

244242
/// Return reference name of the corresponding material in GDML file
245243
inline TString GetGDMLMaterialRef() const { return fGDMLMaterialRef; };

inc/TRestDetectorHitsShuffleProcess.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,8 @@
1919

2020
class TRestDetectorHitsShuffleProcess : public TRestEventProcess {
2121
private:
22-
#ifndef __CINT__
2322
TRestDetectorHitsEvent* fHitsEvent; //!
24-
25-
TRandom3* fRandom; //!
26-
#endif
23+
TRandom3* fRandom; //!
2724

2825
void InitFromConfigFile() override;
2926

inc/TRestDetectorPositionMappingProcess.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ class TRestDetectorPositionMappingProcess : public TRestEventProcess {
8181
TRestDetectorPositionMappingProcess();
8282
TRestDetectorPositionMappingProcess(const char* configFilename);
8383

84-
~TRestDetectorPositionMappingProcess();
84+
~TRestDetectorPositionMappingProcess() override;
8585

8686
ClassDefOverride(TRestDetectorPositionMappingProcess, 1);
8787
};

inc/TRestDetectorReadout.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
#ifndef RestCore_TRestDetectorReadout
2424
#define RestCore_TRestDetectorReadout
2525

26-
#include <TObject.h>
2726
#include <TRestMetadata.h>
2827

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

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

5451
void ValidateReadout();
5552

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

9895
// Constructor
9996
TRestDetectorReadout();
100-
TRestDetectorReadout(const char* configFilename);
97+
explicit TRestDetectorReadout(const char* configFilename);
10198
TRestDetectorReadout(const char* configFilename, std::string name);
10299
// Destructor
103-
virtual ~TRestDetectorReadout();
100+
~TRestDetectorReadout() override;
104101

105102
ClassDefOverride(TRestDetectorReadout, 1);
106103
};

inc/TRestDetectorReadoutChannel.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
#ifndef RestCore_TRestDetectorReadoutChannel
2424
#define RestCore_TRestDetectorReadoutChannel
2525

26-
#include <TObject.h>
2726
#include <TRestMetadata.h>
2827

2928
#include <iostream>
@@ -42,7 +41,7 @@ enum TRestDetectorReadoutChannelType {
4241

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

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

9291
Int_t isInside(Double_t x, Double_t y);
9392

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

101-
ClassDef(TRestDetectorReadoutChannel, 3); // REST run class
100+
ClassDef(TRestDetectorReadoutChannel, 4); // REST run class
102101
};
103102
#endif

inc/TRestDetectorReadoutEventViewer.h

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,17 @@
1717

1818
#include <TCanvas.h>
1919
#include <TPad.h>
20+
#include <TRestEventViewer.h>
2021

21-
#include "TRestDetectorSignalEvent.h"
22-
#include "TRestEventViewer.h"
23-
// #include "TRestDecoding.h"
2422
#include "TH2Poly.h"
2523
#include "TRestDetectorReadout.h"
24+
#include "TRestDetectorSignalEvent.h"
2625

2726
class TRestDetectorReadoutEventViewer : public TRestEventViewer {
2827
protected:
2928
TCanvas* fCanvasXY;
3029
TCanvas* fCanvasXZYZ;
3130

32-
// TRestDecoding *fDecoding;
3331
TRestDetectorReadout* fReadout;
3432

3533
TRestDetectorSignalEvent* fSignalEvent;
@@ -38,26 +36,26 @@ class TRestDetectorReadoutEventViewer : public TRestEventViewer {
3836
TH2D* fHistoXZ;
3937
TH2D* fHistoYZ;
4038

41-
bool isfirstEvent;
39+
bool isFirstevent;
4240

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

4543
public:
46-
void Initialize();
44+
void Initialize() override;
4745
// Finalize initialization based on arg. TRestDetectorReadout
4846
void SetReadout(TRestDetectorReadout* readout);
4947

50-
void AddEvent(TRestEvent* ev);
48+
void AddEvent(TRestEvent* ev) override;
5149
void DrawReadoutPulses();
5250
TRestDetectorReadoutChannel* GetChannel(int readoutChannel);
5351
TRestDetectorReadoutModule* GetModule(int readoutChannel);
5452

5553
// Constructor
5654
TRestDetectorReadoutEventViewer();
5755
// Destructor
58-
~TRestDetectorReadoutEventViewer();
56+
~TRestDetectorReadoutEventViewer() override;
5957

60-
ClassDef(TRestDetectorReadoutEventViewer, 1); // class inherited from
61-
// TRestEventViewer
58+
ClassDefOverride(TRestDetectorReadoutEventViewer, 1); // class inherited from
59+
// TRestEventViewer
6260
};
6361
#endif

inc/TRestDetectorReadoutMapping.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,12 @@
2424
#define RestCore_TRestDetectorReadoutMapping
2525

2626
#include <TMatrixD.h>
27-
#include <TObject.h>
2827

2928
#include <iostream>
3029

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

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

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

6059
Bool_t isNodeSet(Int_t i, Int_t j);
@@ -88,6 +87,6 @@ class TRestDetectorReadoutMapping : public TObject {
8887
// Destructor
8988
~TRestDetectorReadoutMapping();
9089

91-
ClassDef(TRestDetectorReadoutMapping, 1);
90+
ClassDef(TRestDetectorReadoutMapping, 2);
9291
};
9392
#endif

0 commit comments

Comments
 (0)