Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to TRestDetectorReadout #83

Closed
wants to merge 15 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
15 changes: 6 additions & 9 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 @@ -65,16 +62,16 @@ class TRestDetectorReadout : public TRestMetadata {
TRestDetectorReadoutChannel* GetReadoutChannelWithDaqID(int daqId);
/////////////////////////////////////

Int_t GetNumberOfReadoutPlanes();
Int_t GetNumberOfModules();
Int_t GetNumberOfChannels();
size_t GetNumberOfReadoutPlanes();
size_t GetNumberOfModules();
size_t GetNumberOfChannels();

Int_t GetModuleDefinitionId(TString name);

/////////////////////////////////////
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
11 changes: 5 additions & 6 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 All @@ -61,12 +60,12 @@ class TRestDetectorReadoutChannel : public TObject {
inline Int_t GetChannelId() const { return fChannelId; }

/// Returns the total number of pixels inside the readout channel
Int_t GetNumberOfPixels() { return fReadoutPixel.size(); }
size_t GetNumberOfPixels() const { return fReadoutPixel.size(); }

TRestDetectorReadoutPixel& operator[](int n) { return fReadoutPixel[n]; }

/// Returns a pointer to the pixel *n* by index.
TRestDetectorReadoutPixel* GetPixel(int n) {
const TRestDetectorReadoutPixel* GetPixel(size_t n) const {
if (n >= GetNumberOfPixels()) return nullptr;
return &fReadoutPixel[n];
}
Expand All @@ -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
23 changes: 11 additions & 12 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,31 +50,31 @@ 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)
Int_t GetChannelByNode(Int_t i, Int_t j) { return fChannel[i][j]; }
/// Gets the channel id corresponding to a given node (i,j)
Int_t GetChannelByNode(Int_t i, Int_t j) const { return fChannel[i][j]; }

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

Bool_t isNodeSet(Int_t i, Int_t j);

Bool_t AllNodesSet();

Int_t GetNumberOfNodesNotSet();

Int_t GetNodeX_ForChannelAndPixel(Int_t ch, Int_t px);
Int_t GetNodeX_ForChannelAndPixel(Int_t ch, Int_t px) const;

Int_t GetNodeY_ForChannelAndPixel(Int_t ch, Int_t px);
Int_t GetNodeY_ForChannelAndPixel(Int_t ch, Int_t px) const;

Int_t GetNodeX(Double_t x);
Int_t GetNodeX(Double_t x) const;

Int_t GetNodeY(Double_t y);
Int_t GetNodeY(Double_t y) const;

Double_t GetX(Int_t nodeX);

Double_t GetY(Int_t nodeY);

Int_t GetChannel(Double_t x, Double_t y);
Int_t GetChannel(Double_t x, Double_t y) const;

Int_t GetPixel(Double_t x, Double_t y);

Expand All @@ -88,6 +87,6 @@ class TRestDetectorReadoutMapping : public TObject {
// Destructor
~TRestDetectorReadoutMapping();

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