Skip to content

Commit

Permalink
Merge pull request #55 from rest-for-physics/lobis-minor-updates
Browse files Browse the repository at this point in the history
Update required from framework/TRestHits
  • Loading branch information
lobis authored Jul 12, 2022
2 parents 7c4e48c + 61e938a commit bc695a2
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 61 deletions.
93 changes: 45 additions & 48 deletions inc/TRestDetectorHitsEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,17 @@
#ifndef TRestSoft_TRestDetectorHitsEvent
#define TRestSoft_TRestDetectorHitsEvent

#include <TAxis.h>
#include <TGraph.h>
#include <TGraph2D.h>
#include <TH2F.h>
#include <TMath.h>
#include <TRestEvent.h>
#include <TRestHits.h>
#include <TVector3.h>

#include <iostream>

#include "TArrayI.h"
#include "TAxis.h"
#include "TGraph2D.h"
#include "TH2F.h"
#include "TMath.h"
#include "TObject.h"
#include "TRestEvent.h"
#include "TRestHits.h"
#include "TVector3.h"

//! An event data type that register a std::vector of TRestHits,
//! allowing us to save a 3-coordinate position and energy.
class TRestDetectorHitsEvent : public TRestEvent {
Expand Down Expand Up @@ -64,68 +61,68 @@ class TRestDetectorHitsEvent : public TRestEvent {
const TRestHits::iterator& hit2) = nullptr);
void Shuffle(int NLoop);

Int_t GetNumberOfHits() { return fHits->GetNumberOfHits(); }
inline size_t GetNumberOfHits() const { return fHits->GetNumberOfHits(); }

TRestHits* GetHits() const { return fHits; }
inline TRestHits* GetHits() const { return fHits; }

/// Returns the X-coordinate of hit entry `n` in mm.
Double_t GetX(int n) { return fHits->GetX(n); }
inline Double_t GetX(int n) const { return fHits->GetX(n); }

/// Returns the Y-coordinate of hit entry `n` in mm.
Double_t GetY(int n) { return fHits->GetY(n); }
inline Double_t GetY(int n) const { return fHits->GetY(n); }

/// Returns the Z-coordinate of hit entry `n` in mm.
Double_t GetZ(int n) { return fHits->GetZ(n); }
inline Double_t GetZ(int n) const { return fHits->GetZ(n); }

REST_HitType GetType(int n) { return fHits->GetType(n); }
inline REST_HitType GetType(int n) const { return fHits->GetType(n); }

/// Returns the squared distance between hits `n` and `m`.
Double_t GetDistance2(int n, int m) { return fHits->GetDistance2(n, m); }
inline Double_t GetDistance2(int n, int m) const { return fHits->GetDistance2(n, m); }

TRestHits* GetXZHits();
TRestHits* GetYZHits();
TRestHits* GetXYZHits();

virtual void Initialize();

virtual void PrintEvent() { TRestDetectorHitsEvent::PrintEvent(-1); };
virtual void PrintEvent(Int_t nHits);
inline virtual void PrintEvent() const { TRestDetectorHitsEvent::PrintEvent(-1); };
virtual void PrintEvent(Int_t nHits) const;

TVector3 GetPosition(int n) { return fHits->GetPosition(n); }
inline TVector3 GetPosition(int n) const { return fHits->GetPosition(n); }

TVector3 GetMeanPosition() { return fHits->GetMeanPosition(); }
inline TVector3 GetMeanPosition() const { return fHits->GetMeanPosition(); }

Int_t GetNumberOfHitsX() { return fHits->GetNumberOfHitsX(); }
Int_t GetNumberOfHitsY() { return fHits->GetNumberOfHitsY(); }
inline Int_t GetNumberOfHitsX() const { return fHits->GetNumberOfHitsX(); }
inline Int_t GetNumberOfHitsY() const { return fHits->GetNumberOfHitsY(); }

Double_t GetMeanPositionX() { return fHits->GetMeanPositionX(); }
Double_t GetMeanPositionY() { return fHits->GetMeanPositionY(); }
Double_t GetMeanPositionZ() { return fHits->GetMeanPositionZ(); }
Double_t GetSigmaXY2() { return fHits->GetSigmaXY2(); }
Double_t GetSigmaX() { return fHits->GetSigmaX(); }
Double_t GetSigmaY() { return fHits->GetSigmaY(); }
inline Double_t GetMeanPositionX() const { return fHits->GetMeanPositionX(); }
inline Double_t GetMeanPositionY() const { return fHits->GetMeanPositionY(); }
inline Double_t GetMeanPositionZ() const { return fHits->GetMeanPositionZ(); }
inline Double_t GetSigmaXY2() const { return fHits->GetSigmaXY2(); }
inline Double_t GetSigmaX() const { return fHits->GetSigmaX(); }
inline Double_t GetSigmaY() const { return fHits->GetSigmaY(); }

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

Double_t GetSigmaZ2() { return fHits->GetSigmaZ2(); }
Double_t GetSkewXY() { return fHits->GetSkewXY(); }
Double_t GetSkewZ() { return fHits->GetSkewZ(); }
inline Double_t GetSigmaZ2() const { return fHits->GetSigmaZ2(); }
inline Double_t GetSkewXY() const { return fHits->GetSkewXY(); }
inline Double_t GetSkewZ() const { return fHits->GetSkewZ(); }

Double_t GetMaximumHitEnergy() { return fHits->GetMaximumHitEnergy(); }
Double_t GetMinimumHitEnergy() { return fHits->GetMinimumHitEnergy(); }
Double_t GetMeanHitEnergy() { return fHits->GetMeanHitEnergy(); }
inline Double_t GetMaximumHitEnergy() const { return fHits->GetMaximumHitEnergy(); }
inline Double_t GetMinimumHitEnergy() const { return fHits->GetMinimumHitEnergy(); }
inline Double_t GetMeanHitEnergy() const { return fHits->GetMeanHitEnergy(); }

Double_t GetEnergyX() { return fHits->GetEnergyX(); }
Double_t GetEnergyY() { return fHits->GetEnergyY(); }
Double_t GetTotalDepositedEnergy() const { return fHits->fTotEnergy; }
Double_t GetTotalEnergy() const { return fHits->fTotEnergy; }
Double_t GetEnergy() { return fHits->GetEnergy(); }
Double_t GetEnergy(int n) { return fHits->GetEnergy(n); }
Double_t GetTime(int n) { return GetHits()->GetTime(n); } // return value in us
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(int n) const { return fHits->GetEnergy(n); }
inline Double_t GetTime(int n) const { return GetHits()->GetTime(n); } // return value in us

Int_t GetClosestHit(const TVector3& position) { return fHits->GetClosestHit(position); }
inline Int_t GetClosestHit(const TVector3& position) const { return fHits->GetClosestHit(position); }

// Inside Cylinder methods
Bool_t anyHitInsideCylinder(TVector3 x0, TVector3 x1, Double_t radius);
Expand All @@ -143,12 +140,12 @@ class TRestDetectorHitsEvent : public TRestEvent {
Double_t theta);
TVector3 GetMeanPositionInPrism(TVector3 x0, TVector3 x1, Double_t sizeX, Double_t sizeY, Double_t theta);

// Get closest distance to cylinder walls methods
// Get distance to cylinder walls methods
Double_t GetClosestHitInsideDistanceToCylinderWall(TVector3 x0, TVector3 x1, Double_t radius);
Double_t GetClosestHitInsideDistanceToCylinderTop(TVector3 x0, TVector3 x1, Double_t radius);
Double_t GetClosestHitInsideDistanceToCylinderBottom(TVector3 x0, TVector3 x1, Double_t radius);

// Get closest distance to prism walls methods
// Get distance to prism walls methods
Double_t GetClosestHitInsideDistanceToPrismWall(TVector3 x0, TVector3 x1, Double_t sizeX, Double_t sizeY,
Double_t theta);
Double_t GetClosestHitInsideDistanceToPrismTop(TVector3 x0, TVector3 x1, Double_t sizeX, Double_t sizeY,
Expand Down
13 changes: 3 additions & 10 deletions inc/TRestDetectorSignal.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,18 @@
#define RestCore_TRestDetectorSignal

#include <TGraph.h>
#include <TObject.h>
#include <TString.h>
#include <TVector2.h>

#include <iostream>

class TRestDetectorSignal : public TObject {
class TRestDetectorSignal {
private:
Int_t GetMinIndex();
Int_t GetTimeIndex(Double_t t);

protected:
Int_t fSignalID;
Int_t fSignalID = -1;

std::vector<Float_t> fSignalTime; // Vector with the time of the signal
std::vector<Float_t> fSignalCharge; // Vector with the charge of the signal
Expand All @@ -51,12 +50,6 @@ class TRestDetectorSignal : public TObject {
std::vector<Int_t> fPointsOverThreshold; //!
#endif

void Initialize() {
fSignalCharge.clear();
fSignalTime.clear();
fSignalID = -1;
}

// TODO other objects should probably skip using GetMaxIndex direclty
Int_t GetMaxIndex(Int_t from = 0, Int_t to = 0);

Expand Down Expand Up @@ -172,6 +165,6 @@ Double_t GetIntegralWithThreshold(Int_t from, Int_t to, Double_t baseline, Doubl
// Destructor
~TRestDetectorSignal();

ClassDef(TRestDetectorSignal, 1);
ClassDef(TRestDetectorSignal, 2);
};
#endif
2 changes: 0 additions & 2 deletions inc/TRestDetectorSignalEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,9 @@
#ifndef RestDAQ_TRestDetectorSignalEvent
#define RestDAQ_TRestDetectorSignalEvent

#include <TArrayD.h>
#include <TAxis.h>
#include <TGraph.h>
#include <TMultiGraph.h>
#include <TObject.h>
#include <TPad.h>
#include <TRestEvent.h>

Expand Down
2 changes: 1 addition & 1 deletion src/TRestDetectorHitsEvent.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -943,7 +943,7 @@ void TRestDetectorHitsEvent::DrawHistograms(Int_t& column, const TString& histOp
column++;
}

void TRestDetectorHitsEvent::PrintEvent(Int_t nHits) {
void TRestDetectorHitsEvent::PrintEvent(Int_t nHits) const {
TRestEvent::PrintEvent();

cout << "Total energy : " << GetEnergy() << endl;
Expand Down

0 comments on commit bc695a2

Please sign in to comment.