diff --git a/CMakeLists.txt b/CMakeLists.txt index 2603691..411d982 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -52,6 +52,33 @@ if (NOT ${REST_EVE} MATCHES "ON") set(excludes ${excludes} TRestGeant4EventViewer) endif () +if (DEFINED REST_CRY_PATH) + find_path(CRY_LIB_PATH libCRY.a HINTS ${REST_CRY_PATH}/lib) + + find_path(CRY_INC_PATH CRYGenerator.h HINTS ${REST_CRY_PATH}/src) + + if (CRY_LIB_PATH AND CRY_INC_PATH) + message(STATUS "Found CRY includes in ${CRY_INC_PATH}") + message(STATUS "Found CRY library in ${CRY_LIB_PATH}") + + add_compile_definitions("USE_CRY") + add_compile_definitions("CRY_DATA_PATH=\"${REST_CRY_PATH}/data\"") + + set(external_include_dirs ${external_include_dirs} ${CRY_INC_PATH}) + set(external_libs "${external_libs} -L${CRY_LIB_PATH} -lCRY") + + set(feature_added "Cry") + set(feature_added + ${feature_added} + PARENT_SCOPE) + else () + message( + FATAL_ERROR + "REST_CRY_PATH was defined with path ${REST_CRY_PATH}, but CRY library was not found there!\n" + ) + endif () +endif (DEFINED REST_CRY_PATH) + compilelib("") file(GLOB_RECURSE MAC "${CMAKE_CURRENT_SOURCE_DIR}/macros/*") diff --git a/inc/TRestGeant4Particle.h b/inc/TRestGeant4Particle.h index 3722d57..733fad9 100644 --- a/inc/TRestGeant4Particle.h +++ b/inc/TRestGeant4Particle.h @@ -1,17 +1,24 @@ -////////////////////////////////////////////////////////////////////////// -/// -/// RESTSoft : Software for Rare Event Searches with TPCs -/// -/// TRestGeant4Particle.h -/// -/// Class to store a particle definition -/// -/// jul 2015: First concept -/// Created as part of the conceptualization of existing REST -/// software. -/// J. Galan -/// -////////////////////////////////////////////////////////////////////////// +/************************************************************************* + * 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_TRestGeant4Particle #define RestCore_TRestGeant4Particle @@ -21,6 +28,7 @@ #include +/// A class used to store particle properties class TRestGeant4Particle { protected: TString fParticleName; @@ -38,15 +46,10 @@ class TRestGeant4Particle { inline Int_t GetParticleCharge() const { return fCharge; } inline TVector3 GetOrigin() const { return fOrigin; } - void SetParticle(TRestGeant4Particle particle) { - fExcitationLevel = particle.GetExcitationLevel(); - fParticleName = particle.GetParticleName(); - fEnergy = particle.GetEnergy(); - fDirection = particle.GetMomentumDirection(); - fOrigin = particle.fOrigin; - } + void SetParticle(TRestGeant4Particle particle); void SetParticleName(TString particle) { fParticleName = particle; } + void SetExcitationLevel(Double_t excitationEnergy) { fExcitationLevel = excitationEnergy; if (fExcitationLevel < 0) fExcitationLevel = 0; @@ -58,6 +61,8 @@ class TRestGeant4Particle { void SetEnergy(Double_t en) { fEnergy = en; } void SetOrigin(TVector3 pos) { fOrigin = pos; } + void Print() const; + // Constructor TRestGeant4Particle(); // Destructor diff --git a/inc/TRestGeant4ParticleSource.h b/inc/TRestGeant4ParticleSource.h index 87a0999..d9086c1 100644 --- a/inc/TRestGeant4ParticleSource.h +++ b/inc/TRestGeant4ParticleSource.h @@ -62,7 +62,7 @@ class TRestGeant4ParticleSource : public TRestGeant4Particle, public TRestMetada public: virtual void Update(); - virtual void InitFromConfigFile(); + virtual void InitFromConfigFile() override; static TRestGeant4ParticleSource* instantiate(std::string model = ""); inline TVector3 GetDirection() const { @@ -194,13 +194,13 @@ class TRestGeant4ParticleSource : public TRestGeant4Particle, public TRestMetada fParticles.clear(); } - virtual void PrintParticleSource(); + virtual void PrintMetadata() override; // Constructor TRestGeant4ParticleSource(); // Destructor virtual ~TRestGeant4ParticleSource(); - ClassDef(TRestGeant4ParticleSource, 5); + ClassDefOverride(TRestGeant4ParticleSource, 5); }; #endif diff --git a/inc/TRestGeant4ParticleSourceCry.h b/inc/TRestGeant4ParticleSourceCry.h new file mode 100644 index 0000000..da779d9 --- /dev/null +++ b/inc/TRestGeant4ParticleSourceCry.h @@ -0,0 +1,80 @@ +#ifndef TRestParticleSourceCry_Class +#define TRestParticleSourceCry_Class + +#include + +#include + +#ifdef USE_CRY +#include +#include +#endif + +#include + +class TRestGeant4ParticleSourceCry : public TRestGeant4ParticleSource { + private: + /// It defines if secondary neutrons will be produced by the generator + Int_t fReturnNeutrons = 1; + /// It defines if secondary protons will be produced by the generator + Int_t fReturnProtons = 1; + /// It defines if secondary photons will be produced by the generator + Int_t fReturnGammas = 1; + /// It defines if secondary gammas will be produced by the generator + Int_t fReturnElectrons = 1; + /// It defines if secondary electrons will be produced by the generator + Int_t fReturnPions = 1; + /// It defines if secondary pions will be produced by the generator + Int_t fReturnKaons = 1; + /// It defines if secondary muons will be produced by the generator + Int_t fReturnMuons = 1; + + /// Showers with number of particles below this number will be truncated. + Int_t fNParticlesMin = 1; + /// Showers with number of particles above this number will be truncated. + Int_t fNParticlesMax = 1000000; + + /// This is likely the X-coordinate where the box of generated particles is centered. + Double_t fXOffset = 0; + /// This is likely the Y-coordinate where the box of generated particles is centered. + Double_t fYOffset = 0; + /// This is likely the Z-coordinate where the box of generated particles is centered. + Double_t fZOffset = 0; + + /// It will adjust the cosmic-ray distributions to the 11-year solar cycle. + std::string fDate = "7\1\2012"; + + /// The allowed range is -90 to 90. 0 defines the magnetic equator. + Double_t fLatitude = 90.0; + ; + + /// Allowed values are 0, 2100 and 11300 m. + Double_t fAltitude = 0.0; + ; + + /// The size of the box where the CRY generator produces particles (in m). + Double_t fSubBoxLength = 100.0; + ; + + /// Seed used in random generator + Int_t fSeed = 0; //< + + /// Internal process random generator + TRandom3* fRandom = nullptr; //! + + protected: +#ifdef USE_CRY + CRYGenerator* fCRYGenerator = nullptr; +#endif + + public: + void Update() override; + void InitFromConfigFile() override; + inline Int_t GetNumberOfParticles() const { return fParticles.size(); } + void PrintMetadata() override; + + TRestGeant4ParticleSourceCry(); + ~TRestGeant4ParticleSourceCry() {} + ClassDefOverride(TRestGeant4ParticleSourceCry, 1); +}; +#endif diff --git a/inc/TRestGeant4ParticleSourceDecay0.h b/inc/TRestGeant4ParticleSourceDecay0.h index b892c93..5998e6e 100644 --- a/inc/TRestGeant4ParticleSourceDecay0.h +++ b/inc/TRestGeant4ParticleSourceDecay0.h @@ -27,7 +27,7 @@ class TRestGeant4ParticleSourceDecay0 : public TRestGeant4ParticleSource { void Update() override; void InitFromConfigFile() override; inline Int_t GetNumberOfParticles() const { return fParticles.size(); } - void PrintParticleSource() override; + void PrintMetadata() override; TRestGeant4ParticleSourceDecay0(); ~TRestGeant4ParticleSourceDecay0() { delete fDecay0Model; } diff --git a/inc/TRestGeant4PrimaryGeneratorInfo.h b/inc/TRestGeant4PrimaryGeneratorInfo.h index e5a49cb..761ca92 100644 --- a/inc/TRestGeant4PrimaryGeneratorInfo.h +++ b/inc/TRestGeant4PrimaryGeneratorInfo.h @@ -17,6 +17,7 @@ enum class SpatialGeneratorTypes { SURFACE, POINT, COSMIC, + SOURCE, }; std::string SpatialGeneratorTypesToString(const SpatialGeneratorTypes&); diff --git a/src/TRestGeant4Metadata.cxx b/src/TRestGeant4Metadata.cxx index 184bb3b..d537d01 100644 --- a/src/TRestGeant4Metadata.cxx +++ b/src/TRestGeant4Metadata.cxx @@ -255,6 +255,9 @@ /// x, y, nothing length the rectangle. "rectangle" shape works only for "surface" /// generator type. The initial direction of the rectangle is in parallel to x-y plane. /// +/// * **source**: The positions of the particles will be defined by the particle source +/// generator, see for example TRestGeant4ParticleSourceCry. +/// /// Rotation of the virtual body defined previously is also supported. We need to define /// parameter "rotationAxis" and "rotationAngle" to do this job. The TVector3 parameter /// "rotationAxis" is a virtual axis passing through the center of the virtual body, @@ -289,7 +292,7 @@ /// /// \endcode /// -/// * the in-simulation decay0 generator package +/// * the geant4lib encoded generators, such as decay0 or cry generators /// \code /// // 2. decay0 package /// @@ -1453,7 +1456,7 @@ void TRestGeant4Metadata::PrintMetadata() { RESTMetadata << "Number of generated events: " << GetNumberOfEvents() << RESTendl; fGeant4PrimaryGeneratorInfo.Print(); - for (int i = 0; i < GetNumberOfSources(); i++) GetParticleSource(i)->PrintParticleSource(); + for (int i = 0; i < GetNumberOfSources(); i++) GetParticleSource(i)->PrintMetadata(); RESTMetadata << " " << RESTendl; RESTMetadata << " ++++++++++ Detector +++++++++++ " << RESTendl; diff --git a/src/TRestGeant4Particle.cxx b/src/TRestGeant4Particle.cxx index b0ab323..22ddcd4 100644 --- a/src/TRestGeant4Particle.cxx +++ b/src/TRestGeant4Particle.cxx @@ -1,20 +1,42 @@ -///_______________________________________________________________________________ -///_______________________________________________________________________________ -///_______________________________________________________________________________ +/************************************************************************* + * 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. * + *************************************************************************/ + +////////////////////////////////////////////////////////////////////////// +/// TRestGeant4Particle is just a container class to store particle properties /// /// -/// RESTSoft : Software for Rare Event Searches with TPCs +///-------------------------------------------------------------------------- /// -/// TRestGeant4Particle.cxx +/// RESTsoft - Software for Rare Event Searches with TPCs /// -/// Base class from which to inherit all other event classes in REST +/// History of developments: +/// +/// 2015-July: First concept and implementation +/// \author Javier Galan +/// +/// \class TRestGeant4Particle +/// +///
/// -/// jul 2015: First concept -/// Created as part of the conceptualization of existing REST -/// software. -/// J. Galan -///_______________________________________________________________________________ - #include "TRestGeant4Particle.h" using namespace std; @@ -28,3 +50,30 @@ TRestGeant4Particle::TRestGeant4Particle() { TRestGeant4Particle::~TRestGeant4Particle() { // TRestGeant4Particle destructor } + +/////////////////////////////////////////////// +/// \brief A copy method +/// +void TRestGeant4Particle::SetParticle(TRestGeant4Particle particle) { + fExcitationLevel = particle.GetExcitationLevel(); + fParticleName = particle.GetParticleName(); + fEnergy = particle.GetEnergy(); + fDirection = particle.GetMomentumDirection(); + fOrigin = particle.fOrigin; +} + +/////////////////////////////////////////////// +/// \brief Prints on screen the details about the Geant4 simulation +/// conditions, stored in TRestGeant4Metadata. +/// +void TRestGeant4Particle::Print() const { + std::cout << "Particle name : " << GetParticleName() << std::endl; + std::cout << "Charge : " << GetParticleCharge() << std::endl; + std::cout << "Energy : " << GetEnergy() << " keV" << std::endl; + std::cout << "Excitation level : " << GetExcitationLevel() << std::endl; + std::cout << "X : " << GetOrigin().X() << "mm Y : " << GetOrigin().Y() << "mm Z : " << GetOrigin().Z() + << "mm" << std::endl; + std::cout << "Px : " << GetMomentumDirection().X() << " Py : " << GetMomentumDirection().Y() + << " Pz : " << GetMomentumDirection().Z() << std::endl; + std::cout << " ---------------------- " << std::endl; +} diff --git a/src/TRestGeant4ParticleSource.cxx b/src/TRestGeant4ParticleSource.cxx index c764041..35ae00b 100644 --- a/src/TRestGeant4ParticleSource.cxx +++ b/src/TRestGeant4ParticleSource.cxx @@ -32,7 +32,7 @@ TRestGeant4ParticleSource::TRestGeant4ParticleSource() = default; TRestGeant4ParticleSource::~TRestGeant4ParticleSource() = default; -void TRestGeant4ParticleSource::PrintParticleSource() { +void TRestGeant4ParticleSource::PrintMetadata() { RESTMetadata << " " << RESTendl; if (GetParticleName() != "" && GetParticleName() != "NO_SUCH_PARA") RESTMetadata << "Particle Source Name: " << GetParticleName() << RESTendl; @@ -97,8 +97,8 @@ TRestGeant4ParticleSource* TRestGeant4ParticleSource::instantiate(std::string mo } else { // use specific generator // naming convention: TRestGeant4ParticleSourceXXX - // currently supported generator: decay0 - // in future we may add wrapper of generators: cry(for muon), pythia(for HEP), etc. + // currently supported generators: decay0, source + // in future we may add wrapper of generators: pythia(for HEP), etc. model[0] = *REST_StringHelper::ToUpper(std::string(&model[0], 1)).c_str(); TClass* c = TClass::GetClass(("TRestGeant4ParticleSource" + model).c_str()); if (c) // this means we have the package installed diff --git a/src/TRestGeant4ParticleSourceCry.cxx b/src/TRestGeant4ParticleSourceCry.cxx new file mode 100644 index 0000000..519a4d3 --- /dev/null +++ b/src/TRestGeant4ParticleSourceCry.cxx @@ -0,0 +1,200 @@ +#include "TRestGeant4ParticleSourceCry.h" + +using namespace std; + +ClassImp(TRestGeant4ParticleSourceCry); + +TRestGeant4ParticleSourceCry::TRestGeant4ParticleSourceCry() {} + +/////////////////////////////////////////////// +/// \brief It will print on screen the settings used for the CRY generator setup. +/// +void TRestGeant4ParticleSourceCry::PrintMetadata() { + TRestGeant4ParticleSource::PrintMetadata(); + + RESTMetadata << "Return Neutrons : " << fReturnNeutrons << RESTendl; + RESTMetadata << "Return Protons : " << fReturnProtons << RESTendl; + RESTMetadata << "Return Gammas : " << fReturnGammas << RESTendl; + RESTMetadata << "Return Electrons : " << fReturnElectrons << RESTendl; + RESTMetadata << "Return Pions : " << fReturnPions << RESTendl; + RESTMetadata << "Return Kaons : " << fReturnKaons << RESTendl; + RESTMetadata << "Return Muons : " << fReturnMuons << RESTendl; + RESTMetadata << " ======= " << RESTendl; + + RESTMetadata << "N particles min : " << fNParticlesMin << RESTendl; + RESTMetadata << "N particles max : " << fNParticlesMax << RESTendl; + RESTMetadata << " ======= " << RESTendl; + + RESTMetadata << "X-offset : " << fXOffset << "m" << RESTendl; + RESTMetadata << "Y-offset : " << fYOffset << "m" << RESTendl; + RESTMetadata << "Z-offset : " << fZOffset << "m" << RESTendl; + RESTMetadata << "SubBoxLength : " << fSubBoxLength << "m" << RESTendl; + RESTMetadata << " ======= " << RESTendl; + + RESTMetadata << "Date : " << fDate << RESTendl; + RESTMetadata << "Latitude : " << fLatitude << RESTendl; + RESTMetadata << "Altitude : " << fAltitude << RESTendl; + RESTMetadata << "----------------------" << RESTendl; +} + +/////////////////////////////////////////////// +/// \brief Initialization of TRestGeant4ParticleSourceCry members through a RML file +/// +void TRestGeant4ParticleSourceCry::InitFromConfigFile() { + fReturnNeutrons = StringToInteger(GetParameter("returnNeutrons", "1")); + fReturnProtons = StringToInteger(GetParameter("returnProtons", "1")); + fReturnGammas = StringToInteger(GetParameter("returnGammas", "1")); + fReturnElectrons = StringToInteger(GetParameter("returnElectrons", "1")); + fReturnPions = StringToInteger(GetParameter("returnPions", "1")); + fReturnKaons = StringToInteger(GetParameter("returnKaons", "1")); + fReturnMuons = StringToInteger(GetParameter("returnMuons", "1")); + + fNParticlesMin = StringToInteger(GetParameter("nParticlesMin", "1")); + fNParticlesMax = StringToInteger(GetParameter("nParticlesMax", "1000000")); + + fXOffset = StringToDouble(GetParameter("xoffset", "0.0")); + fYOffset = StringToDouble(GetParameter("yoffset", "0.0")); + fZOffset = StringToDouble(GetParameter("zoffset", "0.0")); + fSubBoxLength = StringToDouble(GetParameter("subBoxLength", "100.0")); + + fDate = GetParameter("date", "7\\1\\2012"); + fDate = REST_StringHelper::Replace(fDate, "\\", "-"); + fLatitude = StringToDouble(GetParameter("latitude", "90.0")); + fAltitude = StringToDouble(GetParameter("altitude", "0.0")); + + PrintMetadata(); + + std::string setupString = ""; + setupString += "returnNeutrons " + IntegerToString(fReturnNeutrons); + setupString += " returnProtons " + IntegerToString(fReturnProtons); + setupString += " returnGammas " + IntegerToString(fReturnGammas); + setupString += " returnElectrons " + IntegerToString(fReturnElectrons); + setupString += " returnPions " + IntegerToString(fReturnPions); + setupString += " returnKaons " + IntegerToString(fReturnKaons); + setupString += " returnMuons " + IntegerToString(fReturnMuons); + + setupString += " xoffset " + DoubleToString(fXOffset); + setupString += " yoffset " + DoubleToString(fYOffset); + setupString += " zoffset " + DoubleToString(fZOffset); + setupString += " subboxLength " + DoubleToString(fSubBoxLength); + + setupString += " date " + fDate; + setupString += " latitude " + DoubleToString(fLatitude); + setupString += " altitude " + DoubleToString(fAltitude); + + setupString += " nParticlesMin " + IntegerToString(fNParticlesMin); + setupString += " nParticlesMax " + IntegerToString(fNParticlesMax); + +#ifdef USE_CRY + CRYSetup* setup = new CRYSetup(setupString, CRY_DATA_PATH); + fCRYGenerator = new CRYGenerator(setup); +#endif + + Update(); +} + +/////////////////////////////////////////////// +/// \brief It is used by restG4 PrimaryGeneratorAction to update the particle source +/// +void TRestGeant4ParticleSourceCry::Update() { + RemoveParticles(); + +#ifdef USE_CRY + std::vector* ev = new std::vector; + ev->clear(); + fCRYGenerator->genEvent(ev); + + // std::cout << "CRY particles : " << ev->size() << std::endl; + // std::cout << "-----" << std::endl; + + for (const auto& cryParticle : *ev) { + // std::cout << "id: " << cryParticle->id() << std::endl; + // std::cout << "x: " << cryParticle->x() << " y: " << cryParticle->y() << " z: " << cryParticle->z() + // << std::endl; std::cout << "u: " << cryParticle->u() << " v: " << cryParticle->v() << " w: " << + // cryParticle->w() << std::endl; std::cout << "charge: " << cryParticle->charge() << " energy: " << + // cryParticle->ke() << std::endl; + + TRestGeant4Particle particle; + + /// Particle charge + particle.SetParticleCharge(cryParticle->charge()); + particle.SetExcitationLevel(0); + + /// Particle position + TVector3 position(cryParticle->x(), cryParticle->y(), cryParticle->z()); + particle.SetOrigin(1000. * position); // In mm (default REST units) + + /// Momentum direction + TVector3 momDirection(cryParticle->u(), cryParticle->v(), cryParticle->w()); + momDirection = momDirection.Unit(); + particle.SetDirection(momDirection); + + /// Kinetic energy + particle.SetEnergy(1000. * cryParticle->ke()); // In keV (default REST units) + + /* + * 0 : Neutron + * 1 : Proton + * 2 : Pion + * 3 : Kaon + * 4 : Muon + * 5 : Electron + * 6 : Gamma + */ + + int id = cryParticle->id(); + if (id == 0) particle.SetParticleName("neutron"); + if (id == 1) particle.SetParticleName("proton"); + if (id == 2) { + if (cryParticle->charge() > 0) + particle.SetParticleName("pi+"); + else if (cryParticle->charge() == 0) + particle.SetParticleName("pi0"); + else if (cryParticle->charge() < 0) + particle.SetParticleName("pi-"); + } + if (id == 3) { + if (cryParticle->charge() > 0) + particle.SetParticleName("kaon+"); + else if (cryParticle->charge() == 0) + particle.SetParticleName("kaon0"); + else if (cryParticle->charge() < 0) + particle.SetParticleName("kaon-"); + } + if (id == 4) { + if (cryParticle->charge() > 0) + particle.SetParticleName("mu+"); + else if (cryParticle->charge() < 0) + particle.SetParticleName("mu-"); + } + if (id == 5) { + if (cryParticle->charge() > 0) + particle.SetParticleName("e+"); + else if (cryParticle->charge() < 0) + particle.SetParticleName("e-"); + } + if (id == 6) particle.SetParticleName("gamma"); + + AddParticle(particle); + } + // std::cout << "-----" << std::endl; +#else + cout << "TRestGeant4ParticleSourceCry - ERROR: Geant4lib was not linked to CRY libraries" << endl; + cout << " " << endl; + cout << "Please, compile REST using `cmake -DREST_CRY_PATH=/path/to/cry/installation/directory" << endl; + cout << " " << endl; + cout + << "By default CRY libraries will generate just the static library, but REST needs the shared library" + << endl; + cout << "In order to generate the SHARED object from the STATIC libCRY.a object, execute the following " + "command" + << endl; + cout << "inside the CRY lib directory" << endl; + cout << " " << endl; + cout << "```" << endl; + cout << "gcc -shared -o libCRY.so -Wl,--whole-archive libCRY.a -Wl,--no-whole-archive" << endl; + cout << "```" << endl; + + exit(1); +#endif +} diff --git a/src/TRestGeant4ParticleSourceDecay0.cxx b/src/TRestGeant4ParticleSourceDecay0.cxx index be8e250..e1fc15d 100644 --- a/src/TRestGeant4ParticleSourceDecay0.cxx +++ b/src/TRestGeant4ParticleSourceDecay0.cxx @@ -9,14 +9,14 @@ TRestGeant4ParticleSourceDecay0::TRestGeant4ParticleSourceDecay0() fDecay0Model = new bxdecay0::decay0_generator(); } -void TRestGeant4ParticleSourceDecay0::PrintParticleSource() { - metadata << "---------------------------------------" << endl; +void TRestGeant4ParticleSourceDecay0::PrintMetadata() { + RESTMetadata << "---------------------------------------" << RESTendl; if (!fParticleName.empty() && fParticleName != "NO_SUCH_PARA") - metadata << "Particle Source Name: " << fParticleName << endl; - metadata << "Parent Nuclide: " << fParentName << endl; - metadata << "Decay Mode: " << fDecayType << endl; - metadata << "Daughter Level: " << fDaughterLevel << endl; - metadata << "Seed: " << fSeed << endl; + RESTMetadata << "Particle Source Name: " << fParticleName << RESTendl; + RESTMetadata << "Parent Nuclide: " << fParentName << RESTendl; + RESTMetadata << "Decay Mode: " << fDecayType << RESTendl; + RESTMetadata << "Daughter Level: " << fDaughterLevel << RESTendl; + RESTMetadata << "Seed: " << fSeed << RESTendl; } void TRestGeant4ParticleSourceDecay0::InitFromConfigFile() { diff --git a/src/TRestGeant4PrimaryGeneratorInfo.cxx b/src/TRestGeant4PrimaryGeneratorInfo.cxx index 5101473..1f69cfe 100644 --- a/src/TRestGeant4PrimaryGeneratorInfo.cxx +++ b/src/TRestGeant4PrimaryGeneratorInfo.cxx @@ -28,6 +28,8 @@ string TRestGeant4PrimaryGeneratorTypes::SpatialGeneratorTypesToString(const Spa return "Point"; case SpatialGeneratorTypes::COSMIC: return "Cosmic"; + case SpatialGeneratorTypes::SOURCE: + return "Source"; } cout << "TRestGeant4PrimaryGeneratorTypes::SpatialGeneratorTypesToString - Error - Unknown " "SpatialGeneratorTypes" @@ -51,6 +53,9 @@ SpatialGeneratorTypes TRestGeant4PrimaryGeneratorTypes::StringToSpatialGenerator } else if (TString(type).EqualTo(SpatialGeneratorTypesToString(SpatialGeneratorTypes::COSMIC), TString::ECaseCompare::kIgnoreCase)) { return SpatialGeneratorTypes::COSMIC; + } else if (TString(type).EqualTo(SpatialGeneratorTypesToString(SpatialGeneratorTypes::SOURCE), + TString::ECaseCompare::kIgnoreCase)) { + return SpatialGeneratorTypes::SOURCE; } else { cout << "TRestGeant4PrimaryGeneratorTypes::StringToSpatialGeneratorTypes - Error - Unknown " "SpatialGeneratorTypes: "