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

Fixing problems with RML parameters in TRestRawSignalChannelActivity #73

Merged
merged 4 commits into from
Sep 10, 2022
Merged
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
49 changes: 21 additions & 28 deletions inc/TRestRawSignalChannelActivityProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,6 @@
//! A pure analysis process to generate histograms with detector channels
//! activity
class TRestRawSignalChannelActivityProcess : public TRestEventProcess {
private:
/// A pointer to the specific TRestRawSignalEvent input
TRestRawSignalEvent* fSignalEvent; //!

#ifdef REST_DetectorLib
/// A pointer to the readout metadata information accessible to TRestRun
TRestDetectorReadout* fReadout; //!
#endif

void Initialize() override;

void LoadDefaultConfig();

protected:
/// The value of the lower signal threshold to add it to the histogram
Double_t fLowThreshold = 25;
Expand All @@ -75,34 +62,45 @@ class TRestRawSignalChannelActivityProcess : public TRestEventProcess {
Int_t fReadoutEndChannel = 128;

/// The daq channels histogram
TH1D* fDaqChannelsHisto; //!
TH1D* fDaqChannelsHisto = nullptr; //!

/// The readout channels histogram
TH1D* fReadoutChannelsHisto; //!
TH1D* fReadoutChannelsHisto = nullptr; //!

/// The readout channels histogram built with 1-signal events (low threshold)
TH1D* fReadoutChannelsHisto_OneSignal; //!
TH1D* fReadoutChannelsHisto_OneSignal = nullptr; //!

/// The readout channels histogram built with 1-signal events (high threshold)
TH1D* fReadoutChannelsHisto_OneSignal_High; //!
TH1D* fReadoutChannelsHisto_OneSignal_High = nullptr; //!

/// The readout channels histogram built with 2-signal events (low threshold)
TH1D* fReadoutChannelsHisto_TwoSignals; //!
TH1D* fReadoutChannelsHisto_TwoSignals = nullptr; //!

/// The readout channels histogram built with 2-signal events (high threshold)
TH1D* fReadoutChannelsHisto_TwoSignals_High; //!
TH1D* fReadoutChannelsHisto_TwoSignals_High = nullptr; //!

/// The readout channels histogram built with 3-signal events (low threshold)
TH1D* fReadoutChannelsHisto_ThreeSignals; //!
TH1D* fReadoutChannelsHisto_ThreeSignals = nullptr; //!

/// The readout channels histogram built with 3-signal events (high threshold)
TH1D* fReadoutChannelsHisto_ThreeSignals_High; //!
TH1D* fReadoutChannelsHisto_ThreeSignals_High = nullptr; //!

/// The readout channels histogram built more than 3-signal events (low threshold)
TH1D* fReadoutChannelsHisto_MultiSignals; //!
TH1D* fReadoutChannelsHisto_MultiSignals = nullptr; //!

/// The readout channels histogram built more than 3-signal events (high threshold)
TH1D* fReadoutChannelsHisto_MultiSignals_High; //!
TH1D* fReadoutChannelsHisto_MultiSignals_High = nullptr; //!

private:
/// A pointer to the specific TRestRawSignalEvent input
TRestRawSignalEvent* fSignalEvent = nullptr; //!

#ifdef REST_DetectorLib
/// A pointer to the readout metadata information accessible to TRestRun
TRestDetectorReadout* fReadout = nullptr; //!
#endif

void Initialize() override;

public:
any GetInputEvent() const override { return fSignalEvent; }
Expand All @@ -112,8 +110,6 @@ class TRestRawSignalChannelActivityProcess : public TRestEventProcess {
TRestEvent* ProcessEvent(TRestEvent* inputEvent) override;
void EndProcess() override;

void LoadConfig(const std::string& configFilename, const std::string& name = "");

/// It prints out the process parameters stored in the metadata structure
void PrintMetadata() override {
BeginPrintProcess();
Expand All @@ -139,10 +135,7 @@ class TRestRawSignalChannelActivityProcess : public TRestEventProcess {
/// Returns the name of this process
const char* GetProcessName() const override { return "rawSignalChannelActivity"; }

// Constructor
TRestRawSignalChannelActivityProcess();
TRestRawSignalChannelActivityProcess(const char* configFilename);
// Destructor
~TRestRawSignalChannelActivityProcess();

ClassDefOverride(TRestRawSignalChannelActivityProcess, 3);
Expand Down
49 changes: 7 additions & 42 deletions src/TRestRawSignalChannelActivityProcess.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -107,34 +107,11 @@ ClassImp(TRestRawSignalChannelActivityProcess);
///
TRestRawSignalChannelActivityProcess::TRestRawSignalChannelActivityProcess() { Initialize(); }

///////////////////////////////////////////////
/// \brief Constructor loading data from a config file
///
/// If no configuration path is defined using TRestMetadata::SetConfigFilePath
/// the path to the config file must be specified using full path, absolute or
/// relative.
///
/// The default behaviour is that the config file must be specified with
/// full path, absolute or relative.
///
/// \param configFilename A const char* giving the path to an RML file.
///
TRestRawSignalChannelActivityProcess::TRestRawSignalChannelActivityProcess(const char* configFilename) {
Initialize();

if (LoadConfigFromFile(configFilename)) LoadDefaultConfig();
}

///////////////////////////////////////////////
/// \brief Default destructor
///
TRestRawSignalChannelActivityProcess::~TRestRawSignalChannelActivityProcess() {}

///////////////////////////////////////////////
/// \brief Function to load the default config in absence of RML input
///
void TRestRawSignalChannelActivityProcess::LoadDefaultConfig() { SetTitle("Default config"); }

///////////////////////////////////////////////
/// \brief Function to initialize input/output event members and define the
/// section name
Expand All @@ -146,22 +123,6 @@ void TRestRawSignalChannelActivityProcess::Initialize() {
fSignalEvent = nullptr;
}

///////////////////////////////////////////////
/// \brief Function to load the configuration from an external configuration
/// file.
///
/// If no configuration path is defined in TRestMetadata::SetConfigFilePath
/// the path to the config file must be specified using full path, absolute or
/// relative.
///
/// \param configFilename A const char* giving the path to an RML file.
/// \param name The name of the specific metadata. It will be used to find the
/// corresponding TRestGeant4AnalysisProcess section inside the RML.
///
void TRestRawSignalChannelActivityProcess::LoadConfig(const string& configFilename, const string& name) {
if (LoadConfigFromFile(configFilename, name)) LoadDefaultConfig();
}

///////////////////////////////////////////////
/// \brief Process initialization. The ROOT TH1 histograms are created here
/// using
Expand All @@ -175,13 +136,16 @@ void TRestRawSignalChannelActivityProcess::InitProcess() {
#ifdef REST_DetectorLib
fReadout = GetMetadata<TRestDetectorReadout>();

RESTDebug << "TRestRawSignalChannelActivityProcess::InitProcess. Readout pointer : " << fReadout << RESTendl;
if (GetVerboseLevel() >= TRestStringOutput::REST_Verbose_Level::REST_Info && fReadout) fReadout->PrintMetadata();
RESTDebug << "TRestRawSignalChannelActivityProcess::InitProcess. Readout pointer : " << fReadout
<< RESTendl;
if (GetVerboseLevel() >= TRestStringOutput::REST_Verbose_Level::REST_Info && fReadout)
fReadout->PrintMetadata();
#endif

if (!fReadOnly) {
fDaqChannelsHisto = new TH1D("daqChannelActivityRaw", "daqChannelActivityRaw", fDaqChannels,
fDaqStartChannel, fDaqEndChannel);

#ifdef REST_DetectorLib
if (fReadout) {
fReadoutChannelsHisto = new TH1D("rChannelActivityRaw", "readoutChannelActivity",
Expand Down Expand Up @@ -263,7 +227,8 @@ TRestEvent* TRestRawSignalChannelActivityProcess::ProcessEvent(TRestEvent* input
}
}

if (GetVerboseLevel() >= TRestStringOutput::REST_Verbose_Level::REST_Debug) fAnalysisTree->PrintObservables();
if (GetVerboseLevel() >= TRestStringOutput::REST_Verbose_Level::REST_Debug)
fAnalysisTree->PrintObservables();

return fSignalEvent;
}
Expand Down