Skip to content

Commit

Permalink
Merge branch 'master' into lobis-ci-image
Browse files Browse the repository at this point in the history
  • Loading branch information
lobis authored Feb 24, 2024
2 parents 4ac5695 + 45f7ef9 commit 04a3eb2
Show file tree
Hide file tree
Showing 102 changed files with 5,806 additions and 1,332 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"
65 changes: 64 additions & 1 deletion .github/workflows/validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,72 @@ 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
restRoot -b -q PrintReadout.C'("readout.root")'
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_library_version(LibraryVersion)
add_definitions(-DLIBRARY_VERSION="${LibraryVersion}")

# find garfield libs and includes
Expand Down
Binary file added images/rotation.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/specular.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/transformedHitmap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/translation.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions inc/TRestDetectorAvalancheProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ class TRestDetectorAvalancheProcess : public TRestEventProcess {
TRestDetectorGas* fGas; //!

public:
any GetInputEvent() const override { return fHitsInputEvent; }
any GetOutputEvent() const override { return fHitsOutputEvent; }
RESTValue GetInputEvent() const override { return fHitsInputEvent; }
RESTValue GetOutputEvent() const override { return fHitsOutputEvent; }

void InitProcess() override;
TRestEvent* ProcessEvent(TRestEvent* inputEvent) override;
Expand Down
4 changes: 2 additions & 2 deletions inc/TRestDetectorDaqChannelSwitchingProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ class TRestDetectorDaqChannelSwitchingProcess : public TRestEventProcess {
void Initialize() override;

public:
any GetInputEvent() const override { return fEvent; }
any GetOutputEvent() const override { return fEvent; }
RESTValue GetInputEvent() const override { return fEvent; }
RESTValue GetOutputEvent() const override { return fEvent; }

void InitProcess() override;
TRestEvent* ProcessEvent(TRestEvent* inputEvent) override;
Expand Down
30 changes: 14 additions & 16 deletions inc/TRestDetectorElectronDiffusionProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,17 @@
#include <TRestDetectorGas.h>
#include <TRestDetectorHitsEvent.h>
#include <TRestDetectorReadout.h>

#include "TRestEventProcess.h"
#include <TRestEventProcess.h>

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

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

TRandom3* fRandom; //!
#endif

void InitFromConfigFile() override;

Expand All @@ -41,19 +38,18 @@ class TRestDetectorElectronDiffusionProcess : public TRestEventProcess {
Double_t fElectricField;
Double_t fAttachment;
Double_t fGasPressure;
Double_t fWvalue;
Double_t fLonglDiffCoeff;
Double_t fTransDiffCoeff;
Double_t fWValue;
Double_t fLongitudinalDiffusionCoefficient;
Double_t fTransversalDiffusionCoefficient;
Bool_t fPoissonElectronExcitation;
Bool_t fUnitElectronEnergy;

Int_t fMaxHits;

UInt_t fMaxHits;
Double_t fSeed = 0;
Bool_t fCheckIsInside = true;

public:
any GetInputEvent() const override { return fInputHitsEvent; }
any GetOutputEvent() const override { return fOutputHitsEvent; }
RESTValue GetInputEvent() const override { return fInputHitsEvent; }
RESTValue GetOutputEvent() const override { return fOutputHitsEvent; }

void InitProcess() override;
TRestEvent* ProcessEvent(TRestEvent* inputEvent) override;
Expand All @@ -67,9 +63,11 @@ class TRestDetectorElectronDiffusionProcess : public TRestEventProcess {
RESTMetadata << " eField : " << fElectricField * units("V/cm") << " V/cm" << RESTendl;
RESTMetadata << " attachment coeficient : " << fAttachment << " V/cm" << RESTendl;
RESTMetadata << " gas pressure : " << fGasPressure << " atm" << RESTendl;
RESTMetadata << " longitudinal diffusion coefficient : " << fLonglDiffCoeff << " cm^1/2" << RESTendl;
RESTMetadata << " transversal diffusion coefficient : " << fTransDiffCoeff << " cm^1/2" << RESTendl;
RESTMetadata << " W value : " << fWvalue << " eV" << RESTendl;
RESTMetadata << " longitudinal diffusion coefficient : " << fLongitudinalDiffusionCoefficient
<< " cm^1/2" << RESTendl;
RESTMetadata << " transversal diffusion coefficient : " << fTransversalDiffusionCoefficient
<< " cm^1/2" << RESTendl;
RESTMetadata << " W value : " << fWValue << " eV" << RESTendl;

RESTMetadata << " Maximum number of hits : " << fMaxHits << RESTendl;

Expand All @@ -92,7 +90,7 @@ class TRestDetectorElectronDiffusionProcess : public TRestEventProcess {
// Destructor
~TRestDetectorElectronDiffusionProcess();

ClassDefOverride(TRestDetectorElectronDiffusionProcess, 3); // Template for a REST "event process" class
ClassDefOverride(TRestDetectorElectronDiffusionProcess, 4); // Template for a REST "event process" class
// inherited from TRestEventProcess
};
#endif
4 changes: 2 additions & 2 deletions inc/TRestDetectorFiducializationProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ class TRestDetectorFiducializationProcess : public TRestEventProcess {

protected:
public:
any GetInputEvent() const override { return fInputHitsEvent; }
any GetOutputEvent() const override { return fOutputHitsEvent; }
RESTValue GetInputEvent() const override { return fInputHitsEvent; }
RESTValue GetOutputEvent() const override { return fOutputHitsEvent; }

void InitProcess() override;
TRestEvent* ProcessEvent(TRestEvent* inputEvent) override;
Expand Down
4 changes: 2 additions & 2 deletions inc/TRestDetectorGarfieldDriftProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ class TRestDetectorGarfieldDriftProcess : public TRestEventProcess {

#endif
public:
any GetInputEvent() const override { return fInputHitsEvent; }
any GetOutputEvent() const override { return fOutputHitsEvent; }
RESTValue GetInputEvent() const override { return fInputHitsEvent; }
RESTValue GetOutputEvent() const override { return fOutputHitsEvent; }

TRestEvent* ProcessEvent(TRestEvent* inputEvent) 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
88 changes: 88 additions & 0 deletions inc/TRestDetectorHitmapAnalysisProcess.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
/*************************************************************************
* This file is part of the REST software framework. *
* *
* Copyright (C) 2016 GIFNA/TREX (University of Zaragoza) *
* For more information see http://gifna.unizar.es/trex *
* *
* REST is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* REST is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have a copy of the GNU General Public License along with *
* REST in $REST_PATH/LICENSE. *
* If not, see http://www.gnu.org/licenses/. *
* For the list of contributors see $REST_PATH/CREDITS. *
*************************************************************************/

#ifndef RestCore_TRestDetectorHitmapAnalysisProcess
#define RestCore_TRestDetectorHitmapAnalysisProcess

#include <TRestDetectorHitsEvent.h>

#include "TRestEventProcess.h"

/// A structure to define a given hit transformation
struct HitTransformation {
/// The center of rotation or a point contained in the specular plane
TVector3 position = {0, 0, 0};

/// The translation vector, the axis of rotation or the specular plane normal
TVector3 vector = {0, 0, 1};

/// The angle of rotation
Double_t angle = 0;

/// The type of transformation (specular/rotation/translation)
std::string type = "";

/// A given name that allows to place an order to the transformations
std::string name = "";
};

//! An analysis process to apply rotation/translation/specular to mean hit positions
class TRestDetectorHitmapAnalysisProcess : public TRestEventProcess {
private:
/// A pointer to the specific TRestDetectorHitsEvent input
TRestDetectorHitsEvent* fHitsEvent; //!

void InitFromConfigFile() override;

void Initialize() override;

protected:
/// A list of transformations that can be applied to the mean positions
std::vector<HitTransformation> fTransDefinitions;

/// An ordered list with the names of transformations that will be applied
std::vector<std::string> fTransformations;

/// It returns the transformation with a given name
HitTransformation GetTransformation(const std::string& name);

TVector3 Specular(const TVector3& pos, const HitTransformation& tr);
TVector3 Rotation(const TVector3& pos, const HitTransformation& tr);
TVector3 Translation(const TVector3& pos, const HitTransformation& tr);

public:
RESTValue GetInputEvent() const override { return fHitsEvent; }
RESTValue GetOutputEvent() const override { return fHitsEvent; }

TRestEvent* ProcessEvent(TRestEvent* inputEvent) override;

void PrintMetadata() override;

const char* GetProcessName() const override { return "hitsTransformation"; }

TRestDetectorHitmapAnalysisProcess();
TRestDetectorHitmapAnalysisProcess(const char* configFilename);
~TRestDetectorHitmapAnalysisProcess();

ClassDefOverride(TRestDetectorHitmapAnalysisProcess, 1);
};
#endif
4 changes: 2 additions & 2 deletions inc/TRestDetectorHits3DReconstructionProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ class TRestDetectorHits3DReconstructionProcess : public TRestEventProcess {
void Initialize() override;

public:
any GetInputEvent() const override { return fInputHitsEvent; }
any GetOutputEvent() const override { return fOutputHitsEvent; }
RESTValue GetInputEvent() const override { return fInputHitsEvent; }
RESTValue GetOutputEvent() const override { return fOutputHitsEvent; }

void InitProcess() override;
TRestEvent* ProcessEvent(TRestEvent* inputEvent) override;
Expand Down
7 changes: 3 additions & 4 deletions inc/TRestDetectorHitsAnalysisProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@
#include <TRestDetectorHitsEvent.h>
#include <TRestDetectorReadout.h>
#include <TRestDetectorSignalEvent.h>

#include "TRestEventProcess.h"
#include <TRestEventProcess.h>

//! An analysis REST process to extract valuable information from Hits type of data.
class TRestDetectorHitsAnalysisProcess : public TRestEventProcess {
Expand Down Expand Up @@ -58,8 +57,8 @@ class TRestDetectorHitsAnalysisProcess : public TRestEventProcess {
Double_t fFid_theta;

public:
any GetInputEvent() const override { return fInputHitsEvent; }
any GetOutputEvent() const override { return fOutputHitsEvent; }
RESTValue GetInputEvent() const override { return fInputHitsEvent; }
RESTValue GetOutputEvent() const override { return fOutputHitsEvent; }

void InitProcess() override;
TRestEvent* ProcessEvent(TRestEvent* inputEvent) override;
Expand Down
22 changes: 16 additions & 6 deletions inc/TRestDetectorHitsEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class TRestDetectorHitsEvent : public TRestEvent {

public:
void AddHit(Double_t x, Double_t y, Double_t z, Double_t en, Double_t t = 0, REST_HitType type = XYZ);
void AddHit(TVector3 pos, Double_t en, Double_t t = 0, REST_HitType type = XYZ);
void AddHit(const TVector3& position, Double_t energy, Double_t time, REST_HitType type = XYZ);

void Sort(bool(compareCondition)(const TRestHits::iterator& hit1,
const TRestHits::iterator& hit2) = nullptr);
Expand Down Expand Up @@ -102,9 +102,15 @@ class TRestDetectorHitsEvent : public TRestEvent {
inline Double_t GetSigmaX() const { return fHits->GetSigmaX(); }
inline Double_t GetSigmaY() const { return fHits->GetSigmaY(); }

inline Double_t GetGaussSigmaX() { return GetXZHits()->GetGaussSigmaX(); }
inline Double_t GetGaussSigmaY() { return GetYZHits()->GetGaussSigmaY(); }
inline Double_t GetGaussSigmaZ() const { return fHits->GetGaussSigmaZ(); }
inline Double_t GetGaussSigmaX(Double_t error, Int_t nHitsMin) {
return GetXZHits()->GetGaussSigmaX(error, nHitsMin);
}
inline Double_t GetGaussSigmaY(Double_t error, Int_t nHitsMin) {
return GetYZHits()->GetGaussSigmaY(error, nHitsMin);
}
inline Double_t GetGaussSigmaZ(Double_t error, Int_t nHitsMin) const {
return fHits->GetGaussSigmaZ(error, nHitsMin);
}

inline Double_t GetSigmaZ2() const { return fHits->GetSigmaZ2(); }
inline Double_t GetSkewXY() const { return fHits->GetSkewXY(); }
Expand All @@ -116,9 +122,9 @@ class TRestDetectorHitsEvent : public TRestEvent {

inline Double_t GetEnergyX() const { return fHits->GetEnergyX(); }
inline Double_t GetEnergyY() const { return fHits->GetEnergyY(); }
inline Double_t GetTotalDepositedEnergy() const { return fHits->GetTotalDepositedEnergy(); }
inline Double_t GetTotalEnergy() const { return fHits->GetTotalEnergy(); }
inline Double_t GetEnergy() const { return fHits->GetEnergy(); }
inline Double_t GetEnergy() const { return fHits->GetTotalEnergy(); }

inline Double_t GetEnergy(int n) const { return fHits->GetEnergy(n); }
inline Double_t GetTime(int n) const { return GetHits()->GetTime(n); } // return value in us

Expand Down Expand Up @@ -155,6 +161,10 @@ class TRestDetectorHitsEvent : public TRestEvent {

TPad* DrawEvent(const TString& option = "");

TH2F* GetXYHistogram(std::vector<float> ranges, Double_t pitch = 3, Double_t border = 5);
TH2F* GetXZHistogram(std::vector<float> ranges, Double_t pitch = 3, Double_t border = 5);
TH2F* GetYZHistogram(std::vector<float> ranges, Double_t pitch = 3, Double_t border = 5);

void DrawHistograms(Int_t& column, const TString& histOption = "", double pitch = 0);
void DrawGraphs(Int_t& column);

Expand Down
Loading

0 comments on commit 04a3eb2

Please sign in to comment.