From 1c3cc18f9c9fafc24f0e6f372f8def8d37ef1d4d Mon Sep 17 00:00:00 2001 From: Javier Galan Date: Tue, 17 May 2022 14:44:38 +0200 Subject: [PATCH] Updating processes to latest updates at framework --- inc/TRestAxionAnalysisProcess.h | 16 +-- inc/TRestAxionDetectorResponseProcess.h | 19 ++-- inc/TRestAxionFieldPropagationProcess.h | 21 ++-- inc/TRestAxionGeneratorProcess.h | 21 ++-- inc/TRestAxionOpticsResponseProcess.h | 15 ++- inc/TRestAxionTemplateProcess.h | 72 -------------- inc/TRestAxionTransmissionProcess.h | 19 ++-- src/TRestAxionTemplateProcess.cxx | 127 ------------------------ 8 files changed, 48 insertions(+), 262 deletions(-) delete mode 100644 inc/TRestAxionTemplateProcess.h delete mode 100644 src/TRestAxionTemplateProcess.cxx diff --git a/inc/TRestAxionAnalysisProcess.h b/inc/TRestAxionAnalysisProcess.h index 4723662e..13c18cea 100644 --- a/inc/TRestAxionAnalysisProcess.h +++ b/inc/TRestAxionAnalysisProcess.h @@ -32,30 +32,30 @@ class TRestAxionAnalysisProcess : public TRestEventProcess { /// A pointer to the specific TRestAxionEvent TRestAxionEvent* fAxionEvent; //! - void InitFromConfigFile(); + void InitFromConfigFile() override; - void Initialize(); + void Initialize() override; void LoadDefaultConfig(); protected: public: - virtual RESTValue GetInputEvent() { return fAxionEvent; } - virtual RESTValue GetOutputEvent() { return fAxionEvent; } + RESTValue GetInputEvent() const override { return fAxionEvent; } + RESTValue GetOutputEvent() const override { return fAxionEvent; } - TRestEvent* ProcessEvent(TRestEvent* evInput); + TRestEvent* ProcessEvent(TRestEvent* evInput) override; void LoadConfig(std::string cfgFilename, std::string name = ""); /// It prints out the process parameters stored in the metadata structure - void PrintMetadata() { + void PrintMetadata() override { BeginPrintProcess(); EndPrintProcess(); } /// Returns the name of this process - virtual const char* GetProcessName() { return (TString) "axionAnalysis"; } + const char* GetProcessName() const override { return "axionAnalysis"; } // Constructor TRestAxionAnalysisProcess(); @@ -64,6 +64,6 @@ class TRestAxionAnalysisProcess : public TRestEventProcess { // Destructor ~TRestAxionAnalysisProcess(); - ClassDef(TRestAxionAnalysisProcess, 1); + ClassDefOverride(TRestAxionAnalysisProcess, 1); }; #endif diff --git a/inc/TRestAxionDetectorResponseProcess.h b/inc/TRestAxionDetectorResponseProcess.h index 09895c0d..88d8488b 100644 --- a/inc/TRestAxionDetectorResponseProcess.h +++ b/inc/TRestAxionDetectorResponseProcess.h @@ -44,23 +44,23 @@ class TRestAxionDetectorResponseProcess : public TRestEventProcess { /// A 2-dimensional histogram were we store temporally the response loaded from a data response file. TH2D* fDetectorResponse; //! - void InitFromConfigFile(); + void InitFromConfigFile() override; - void Initialize(); + void Initialize() override; void LoadDefaultConfig(); protected: public: - TRestEvent* ProcessEvent(TRestEvent* evInput); + TRestEvent* ProcessEvent(TRestEvent* evInput) override; - any GetInputEvent() { return fAxionEvent; } - any GetOutputEvent() { return fAxionEvent; } + RESTValue GetInputEvent() const override { return fAxionEvent; } + RESTValue GetOutputEvent() const override { return fAxionEvent; } void LoadConfig(std::string cfgFilename, std::string name = ""); /// It prints out the process parameters stored in the metadata structure - void PrintMetadata() { + void PrintMetadata() override { BeginPrintProcess(); metadata << "Response filename : " << fResponseFileName << endl; @@ -68,11 +68,8 @@ class TRestAxionDetectorResponseProcess : public TRestEventProcess { EndPrintProcess(); } - /// Returns a new instance of this class - TRestEventProcess* Maker() { return new TRestAxionDetectorResponseProcess; } - /// Returns the name of this process - TString GetProcessName() { return (TString) "axionDetectorResponse"; } + const char* GetProcessName() { return (TString) "axionDetectorResponse"; } // Constructor TRestAxionDetectorResponseProcess(); @@ -81,6 +78,6 @@ class TRestAxionDetectorResponseProcess : public TRestEventProcess { // Destructor ~TRestAxionDetectorResponseProcess(); - ClassDef(TRestAxionDetectorResponseProcess, 1); + ClassDefOverride(TRestAxionDetectorResponseProcess, 1); }; #endif diff --git a/inc/TRestAxionFieldPropagationProcess.h b/inc/TRestAxionFieldPropagationProcess.h index 3a438b2a..98e0332b 100644 --- a/inc/TRestAxionFieldPropagationProcess.h +++ b/inc/TRestAxionFieldPropagationProcess.h @@ -139,9 +139,9 @@ class TRestAxionFieldPropagationProcess : public TRestEventProcess { void PrintComplex(ComplexReal); - void InitFromConfigFile(); + void InitFromConfigFile() override; - void Initialize(); + void Initialize() override; void LoadDefaultConfig(); @@ -165,17 +165,17 @@ class TRestAxionFieldPropagationProcess : public TRestEventProcess { protected: public: - void InitProcess(); + void InitProcess() override; - any GetInputEvent() { return fAxionEvent; } - any GetOutputEvent() { return fAxionEvent; } + any GetInputEvent() const override { return fAxionEvent; } + any GetOutputEvent() const override { return fAxionEvent; } - TRestEvent* ProcessEvent(TRestEvent* evInput); + TRestEvent* ProcessEvent(TRestEvent* evInput) override; void LoadConfig(std::string cfgFilename, std::string name = ""); /// It prints out the process parameters stored in the metadata structure - void PrintMetadata() { + void PrintMetadata() override { BeginPrintProcess(); metadata << "mode: " << fMode << endl; @@ -238,11 +238,8 @@ class TRestAxionFieldPropagationProcess : public TRestEventProcess { ComplexReal& orthogonalPhotonAmplitude, mpfr::mpreal axionMass, mpfr::mpreal photonMass, mpfr::mpreal Ea, TVector3 from, TVector3 to); - /// Returns a new instance of this class - TRestEventProcess* Maker() { return new TRestAxionFieldPropagationProcess; } - /// Returns the name of this process - TString GetProcessName() { return (TString) "axionFieldPropagation"; } + const char* GetProcessName() const override { return "axionFieldPropagation"; } // Constructor TRestAxionFieldPropagationProcess(); @@ -251,6 +248,6 @@ class TRestAxionFieldPropagationProcess : public TRestEventProcess { // Destructor ~TRestAxionFieldPropagationProcess(); - ClassDef(TRestAxionFieldPropagationProcess, 1); + ClassDefOverride(TRestAxionFieldPropagationProcess, 1); }; #endif diff --git a/inc/TRestAxionGeneratorProcess.h b/inc/TRestAxionGeneratorProcess.h index 8ee70714..1034ab93 100644 --- a/inc/TRestAxionGeneratorProcess.h +++ b/inc/TRestAxionGeneratorProcess.h @@ -40,7 +40,7 @@ class TRestAxionGeneratorProcess : public TRestEventProcess { Int_t fCounter = 0; //! /// A pointer to the axion model stored in TRestRun - TRestAxionSpectrum *fAxionSpectrum; //! + TRestAxionSpectrum* fAxionSpectrum; //! /// Random number generator TRandom3* fRandom; //! @@ -79,9 +79,9 @@ class TRestAxionGeneratorProcess : public TRestEventProcess { /// Mode of rotated circle Wall construction TString fMode; //-> - void InitFromConfigFile(); + void InitFromConfigFile() override; - void Initialize(); + void Initialize() override; void LoadDefaultConfig(); @@ -93,15 +93,15 @@ class TRestAxionGeneratorProcess : public TRestEventProcess { public: void InitProcess(); - any GetInputEvent() { return (TRestEvent*)NULL; } - any GetOutputEvent() { return fOutputAxionEvent; } + virtual RESTValue GetInputEvent() const override { return nullptr; } + virtual RESTValue GetOutputEvent() const override { return fOutputAxionEvent; } - TRestEvent* ProcessEvent(TRestEvent* eventInput); + TRestEvent* ProcessEvent(TRestEvent* eventInput) override; void LoadConfig(std::string cfgFilename, std::string name = ""); /// It prints out the process parameters stored in the metadata structure - void PrintMetadata() { + void PrintMetadata() override { BeginPrintProcess(); metadata << "Energy distribution" << endl; @@ -126,11 +126,8 @@ class TRestAxionGeneratorProcess : public TRestEventProcess { EndPrintProcess(); } - /// Returns a new instance of this class - TRestEventProcess* Maker() { return new TRestAxionGeneratorProcess; } - /// Returns the name of this process - TString GetProcessName() { return (TString) "axionGenerator"; } + const char* GetProcessName() const override { return "axionGenerator"; } // Constructor TRestAxionGeneratorProcess(); @@ -139,6 +136,6 @@ class TRestAxionGeneratorProcess : public TRestEventProcess { // Destructor ~TRestAxionGeneratorProcess(); - ClassDef(TRestAxionGeneratorProcess, 1); + ClassDefOverride(TRestAxionGeneratorProcess, 1); }; #endif diff --git a/inc/TRestAxionOpticsResponseProcess.h b/inc/TRestAxionOpticsResponseProcess.h index 237c20a6..a63b3d79 100644 --- a/inc/TRestAxionOpticsResponseProcess.h +++ b/inc/TRestAxionOpticsResponseProcess.h @@ -32,15 +32,15 @@ class TRestAxionOpticsResponseProcess : public TRestEventProcess { /// A pointer to the specific TRestAxionEvent TRestAxionEvent* fAxionEvent; //! - void InitFromConfigFile(); + void InitFromConfigFile() override; - void Initialize(); + void Initialize() override; void LoadDefaultConfig(); protected: public: - TRestEvent* ProcessEvent(TRestEvent* evInput); + TRestEvent* ProcessEvent(TRestEvent* evInput) override; any GetInputEvent() { return fAxionEvent; } any GetOutputEvent() { return fAxionEvent; } @@ -48,17 +48,14 @@ class TRestAxionOpticsResponseProcess : public TRestEventProcess { void LoadConfig(std::string cfgFilename, std::string name = ""); /// It prints out the process parameters stored in the metadata structure - void PrintMetadata() { + void PrintMetadata() override { BeginPrintProcess(); EndPrintProcess(); } - /// Returns a new instance of this class - TRestEventProcess* Maker() { return new TRestAxionOpticsResponseProcess; } - /// Returns the name of this process - TString GetProcessName() { return (TString) "axionOpticsResponse"; } + const char* GetProcessName() const override { return "axionOpticsResponse"; } // Constructor TRestAxionOpticsResponseProcess(); @@ -67,6 +64,6 @@ class TRestAxionOpticsResponseProcess : public TRestEventProcess { // Destructor ~TRestAxionOpticsResponseProcess(); - ClassDef(TRestAxionOpticsResponseProcess, 1); + ClassDefOverride(TRestAxionOpticsResponseProcess, 1); }; #endif diff --git a/inc/TRestAxionTemplateProcess.h b/inc/TRestAxionTemplateProcess.h deleted file mode 100644 index ee55bf8f..00000000 --- a/inc/TRestAxionTemplateProcess.h +++ /dev/null @@ -1,72 +0,0 @@ -/************************************************************************* - * 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_TRestAxionTemplateProcess -#define RestCore_TRestAxionTemplateProcess - -#include "TRestAxionEvent.h" -#include "TRestEventProcess.h" - -//! A template process to serve as a copy/paste for creating new TRestAxion___Process -class TRestAxionTemplateProcess : public TRestEventProcess { - private: - /// A pointer to the specific TRestAxionEvent - TRestAxionEvent* fAxionEvent; //! - - void InitFromConfigFile(); - - void Initialize(); - - void LoadDefaultConfig(); - - protected: - public: - TRestEvent* ProcessEvent(TRestEvent* evInput); - - any GetInputEvent() { return fAxionEvent; } - any GetOutputEvent() { return fAxionEvent; } - - void LoadConfig(std::string cfgFilename, std::string name = ""); - - /// It prints out the process parameters stored in the metadata structure - void PrintMetadata() { - BeginPrintProcess(); - - EndPrintProcess(); - } - - /// Returns a new instance of this class - TRestEventProcess* Maker() { return new TRestAxionTemplateProcess; } - - /// Returns the name of this process - TString GetProcessName() { return (TString) "axionTemplate"; } - - // Constructor - TRestAxionTemplateProcess(); - TRestAxionTemplateProcess(char* cfgFileName); - - // Destructor - ~TRestAxionTemplateProcess(); - - ClassDef(TRestAxionTemplateProcess, 1); -}; -#endif diff --git a/inc/TRestAxionTransmissionProcess.h b/inc/TRestAxionTransmissionProcess.h index 34ed1d2a..e134f81f 100644 --- a/inc/TRestAxionTransmissionProcess.h +++ b/inc/TRestAxionTransmissionProcess.h @@ -33,33 +33,30 @@ class TRestAxionTransmissionProcess : public TRestEventProcess { /// A pointer to the specific TRestAxionEvent TRestAxionEvent* fAxionEvent; //! - void InitFromConfigFile(); + void InitFromConfigFile() override; - void Initialize(); + void Initialize() override; void LoadDefaultConfig(); protected: public: - any GetInputEvent() { return fAxionEvent; } - any GetOutputEvent() { return fAxionEvent; } + any GetInputEvent() const override { return fAxionEvent; } + any GetOutputEvent() const override { return fAxionEvent; } - TRestEvent* ProcessEvent(TRestEvent* evInput); + TRestEvent* ProcessEvent(TRestEvent* evInput) override; void LoadConfig(std::string cfgFilename, std::string name = ""); /// It prints out the process parameters stored in the metadata structure - void PrintMetadata() { + void PrintMetadata() override { BeginPrintProcess(); EndPrintProcess(); } - /// Returns a new instance of this class - TRestEventProcess* Maker() { return new TRestAxionTransmissionProcess; } - /// Returns the name of this process - TString GetProcessName() { return (TString) "axionTransmission"; } + const char* GetProcessName() const override { return "axionTransmission"; } // Constructor TRestAxionTransmissionProcess(); @@ -68,6 +65,6 @@ class TRestAxionTransmissionProcess : public TRestEventProcess { // Destructor ~TRestAxionTransmissionProcess(); - ClassDef(TRestAxionTransmissionProcess, 1); + ClassDefOverride(TRestAxionTransmissionProcess, 1); }; #endif diff --git a/src/TRestAxionTemplateProcess.cxx b/src/TRestAxionTemplateProcess.cxx deleted file mode 100644 index 422e2d40..00000000 --- a/src/TRestAxionTemplateProcess.cxx +++ /dev/null @@ -1,127 +0,0 @@ -/************************************************************************* - * 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. * - *************************************************************************/ - -////////////////////////////////////////////////////////////////////////// -/// TRestAxionTemplateProcess an empty TRestAxionEvent process to serve as -/// a copy/paste template to add future processes -/// -///-------------------------------------------------------------------------- -/// -/// RESTsoft - Software for Rare Event Searches with TPCs -/// -/// History of developments: -/// -/// 2019-March: First implementation -/// Javier Galan -/// -/// \class TRestAxionTemplateProcess -/// \author Javier Galan -/// -///
-/// -#include "TRestAxionTemplateProcess.h" -using namespace std; - -ClassImp(TRestAxionTemplateProcess); - -/////////////////////////////////////////////// -/// \brief Default constructor -/// -TRestAxionTemplateProcess::TRestAxionTemplateProcess() { 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 cfgFileName A const char* giving the path to an RML file. -/// -TRestAxionTemplateProcess::TRestAxionTemplateProcess(char* cfgFileName) { - Initialize(); - - LoadConfig(cfgFileName); -} - -/////////////////////////////////////////////// -/// \brief Default destructor -/// -TRestAxionTemplateProcess::~TRestAxionTemplateProcess() { delete fAxionEvent; } - -/////////////////////////////////////////////// -/// \brief Function to load the default config in absence of RML input -/// -void TRestAxionTemplateProcess::LoadDefaultConfig() { - SetName(this->ClassName()); - SetTitle("Default config"); -} - -/////////////////////////////////////////////// -/// \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 cfgFileName 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 -/// correspondig TRestGeant4AnalysisProcess section inside the RML. -/// -void TRestAxionTemplateProcess::LoadConfig(std::string cfgFilename, std::string name) { - if (LoadConfigFromFile(cfgFilename, name)) LoadDefaultConfig(); -} - -/////////////////////////////////////////////// -/// \brief Function to initialize input/output event members and define the section name -/// -void TRestAxionTemplateProcess::Initialize() { - SetSectionName(this->ClassName()); - SetLibraryVersion(LIBRARY_VERSION); - - fAxionEvent = new TRestAxionEvent(); -} - -/////////////////////////////////////////////// -/// \brief The main processing event function -/// -TRestEvent* TRestAxionTemplateProcess::ProcessEvent(TRestEvent* evInput) { - fAxionEvent = (TRestAxionEvent*)evInput; - - if (GetVerboseLevel() >= REST_Debug) { - fAxionEvent->PrintEvent(); - - if (GetVerboseLevel() >= REST_Extreme) GetChar(); - } - - // Modify here the fAxionEvent as necessary - - return fAxionEvent; -} - -/////////////////////////////////////////////// -/// \brief Function reading input parameters from the RML TRestAxionTemplateProcess metadata section -/// -void TRestAxionTemplateProcess::InitFromConfigFile() { - // Initialize any metadata class members from RML as necessary -}