diff --git a/inc/TRestDetectorVetoReadout.h b/inc/TRestDetectorVetoReadout.h new file mode 100644 index 00000000..1bcfc761 --- /dev/null +++ b/inc/TRestDetectorVetoReadout.h @@ -0,0 +1,51 @@ +/************************************************************************* + * 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_TRestDetectorVetoReadout +#define RestCore_TRestDetectorVetoReadout + +#include + +#include + +#include "TRestDetectorReadoutPlane.h" + +class TRestDetectorVetoReadout : public TRestMetadata { + private: + std::string fGeometry; + + std::vector fReadoutPlanes; + + std::vector fVetoVolumeNames; + std::vector fVetoBoundaryVolumeNames; /// aux volume used to identify the readout plane + std::map fVetoVolumeNamesToSignalIdMap; + + public: + TRestDetectorVetoReadout(); + TRestDetectorVetoReadout(const char* configFilename, const char* name); + + void PrintMetadata() override; + + ClassDefOverride(TRestDetectorVetoReadout, 1); +}; + +#endif diff --git a/src/TRestDetectorVetoReadout.cxx b/src/TRestDetectorVetoReadout.cxx new file mode 100644 index 00000000..a8604df9 --- /dev/null +++ b/src/TRestDetectorVetoReadout.cxx @@ -0,0 +1,22 @@ +#include "TRestDetectorVetoReadout.h" + +using namespace std; + +ClassImp(TRestDetectorVetoReadout); + +TRestDetectorVetoReadout::TRestDetectorVetoReadout(const char* configFilename, const char* name) + : TRestDetectorVetoReadout() { + // we call the base constructor instead of "Initialize" using constructor delegation + fConfigFileName = configFilename; + LoadConfigFromFile(fConfigFileName, name); + cout << "TRestDetectorVetoReadout::TRestDetectorVetoReadout: " << endl; +} + +TRestDetectorVetoReadout::TRestDetectorVetoReadout() { + cout << "TRestDetectorVetoReadout::TRestDetectorVetoReadout: base" << endl; + + SetSectionName(this->ClassName()); + SetLibraryVersion(LIBRARY_VERSION); +} + +void TRestDetectorVetoReadout::PrintMetadata() { cout << "Geometry: " << fGeometry << endl; } diff --git a/test/files/TRestDetectorVetoReadout.rml b/test/files/TRestDetectorVetoReadout.rml new file mode 100644 index 00000000..7c8047ab --- /dev/null +++ b/test/files/TRestDetectorVetoReadout.rml @@ -0,0 +1,6 @@ + + + + + + diff --git a/test/src/TRestDetectorVetoReadout.cxx b/test/src/TRestDetectorVetoReadout.cxx new file mode 100644 index 00000000..841c834b --- /dev/null +++ b/test/src/TRestDetectorVetoReadout.cxx @@ -0,0 +1,35 @@ + +#include +#include + +#include + +namespace fs = std::filesystem; + +using namespace std; + +const auto filesPath = fs::path(__FILE__).parent_path().parent_path() / "files"; +const auto readoutDefaultRml = filesPath / "TRestDetectorVetoReadout.rml"; + +TEST(TRestDetectorVetoReadout, TestFiles) { + cout << "FrameworkCore test files path: " << filesPath << endl; + + // Check dir exists and is a directory + EXPECT_TRUE(fs::is_directory(filesPath)); + // Check it's not empty + EXPECT_TRUE(!fs::is_empty(filesPath)); + + // All used files in this tests + EXPECT_TRUE(fs::exists(readoutDefaultRml)); +} + +TEST(TRestDetectorVetoReadout, Default) { + TRestDetectorVetoReadout readout; + + readout.PrintMetadata(); +} + +TEST(TRestDetectorVetoReadout, FromRml) { + TRestDetectorVetoReadout readout(readoutDefaultRml.c_str(), "vetoReadout"); + readout.PrintMetadata(); +}