diff --git a/DDG4/include/DDG4/Geant4FastSimShowerModel.inl.h b/DDG4/include/DDG4/Geant4FastSimShowerModel.inl.h index cb461c21063baa7850da6cd73a69a15374750148..7faea69cdd98db7b664b84fe9b65dd7e621b6418 100644 --- a/DDG4/include/DDG4/Geant4FastSimShowerModel.inl.h +++ b/DDG4/include/DDG4/Geant4FastSimShowerModel.inl.h @@ -85,4 +85,12 @@ namespace dd4hep { } } /* End namespace sim */ } /* End namespace dd4hep */ + +#include "G4Version.hh" +#if G4VERSION_NUMBER > 1070 +#include "G4FastSimHitMaker.hh" +#else +class G4FastSimHitMaker { public: void make(const G4FastHit&, const G4FastTrack&) { } }; +#endif + #endif // DDG4_GEANT4FASTSIMSHOWERMODEL_INL_H diff --git a/DDG4/include/DDG4/Geant4FastSimSpot.h b/DDG4/include/DDG4/Geant4FastSimSpot.h index 20b8aa129c1d2a041c78fa7dee1f335585059c68..5d827f0aaa71dbac1a7ccbc5d5152953cb75e538 100644 --- a/DDG4/include/DDG4/Geant4FastSimSpot.h +++ b/DDG4/include/DDG4/Geant4FastSimSpot.h @@ -88,6 +88,8 @@ namespace dd4hep { /// Primary track position G4ThreeVector trackPosition() const { return primary->GetPosition(); } + /// Primary track momentum + G4ThreeVector trackMomentum() const { return primary->GetMomentum(); } /// Primary track kinetic energy double kineticEnergy() const { return primary->GetKineticEnergy(); } /// Primary track particle definition diff --git a/DDG4/include/DDG4/Geant4Random.h b/DDG4/include/DDG4/Geant4Random.h index a1803cf4adec340a91f7aab9ba4be831f2433bbc..5c60d31a1b0533e1202450baa060711c181f90ac 100644 --- a/DDG4/include/DDG4/Geant4Random.h +++ b/DDG4/include/DDG4/Geant4Random.h @@ -153,12 +153,18 @@ namespace dd4hep { double exp(double tau); /// Create gaussian distributed random numbers double gauss(double mean=0, double sigma=1); + /// Create gamma distributed random numbers + double gamma(double k, double lambda); /// Create landau distributed random numbers double landau(double mean=0, double sigma=1); /// Create tuple of randum number around a circle with radius r void circle(double &x, double &y, double r); /// Create tuple of randum number on a sphere with radius r void sphere(double &x, double &y, double &z, double r); + /// Create poisson distributed random numbers + double poisson(double mean=1e0 ); + /// Create breit wigner distributed random numbers + double breit_wigner(double mean=0e0, double gamma=1e0); }; } // End namespace sim diff --git a/DDG4/plugins/Geant4CaloSmearShowerModel.cpp b/DDG4/plugins/Geant4CaloSmearShowerModel.cpp new file mode 100644 index 0000000000000000000000000000000000000000..fa8405969fe8a0d9ffba1c2f93a2497c0d622acf --- /dev/null +++ b/DDG4/plugins/Geant4CaloSmearShowerModel.cpp @@ -0,0 +1,129 @@ +//========================================================================== +// AIDA Detector description implementation +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +// +// Author : M.Frank +// +//========================================================================== +// +// Please note: +// +// These shower parametrizations is a generalized form of the Geant4 example: +// <geant4-source-dir>/examples/extended/parameterisations/Par02 +// +//========================================================================== + +// Framework include files +#include <DDG4/Geant4FastSimShowerModel.inl.h> +#include <DDG4/Geant4FastSimSpot.h> +#include <DDG4/Geant4Random.h> + +// Geant4 include files +#include "G4SystemOfUnits.hh" +#include "G4FastStep.hh" + +/// Namespace for the AIDA detector description toolkit +namespace dd4hep { + + /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit + namespace sim { + + ///=================================================================================================== + /// + /// Par02 electromagnetic shower model (e+, e-) + /// + ///=================================================================================================== + + /// Configuration structure for the fast simulation shower model Geant4FSShowerModel<par02_em_model> + class calo_smear_model { + public: + G4FastSimHitMaker hitMaker { }; + double StocasticEnergyResolution { -1e0 }; + double ConstantEnergyResolution { -1e0 }; + double NoiseEnergyResolution { -1e0 }; + + double resolution(double momentum) const { + double res = -1e0; + double mom = momentum/CLHEP::GeV; + if ( this->StocasticEnergyResolution > 0 && + this->ConstantEnergyResolution > 0 && + this->NoiseEnergyResolution > 0 ) { + res = std::sqrt(std::pow( this->StocasticEnergyResolution / std::sqrt( mom ), 2 ) + // stochastic + std::pow( this->ConstantEnergyResolution, 2 ) + // constant + std::pow( this->NoiseEnergyResolution / mom, 2 ) ); // noise + } + else if ( this->StocasticEnergyResolution > 0 && + this->ConstantEnergyResolution > 0 ) { + res = std::sqrt(std::pow( this->StocasticEnergyResolution / std::sqrt( mom ), 2 ) + // stochastic + std::pow( this->ConstantEnergyResolution, 2 ) ); // constant + } + else if ( this->StocasticEnergyResolution > 0 ) { + res = this->StocasticEnergyResolution / std::sqrt( mom ); // stochastic + } + else if ( this->ConstantEnergyResolution > 0 ) { + res = this->ConstantEnergyResolution; // constant + } + return res; + } + + double smearEnergy(double mom) const { + double resolution = this->resolution(mom); + double smeared = mom; + if ( resolution > 0e0 ) { + for( smeared = -1e0; smeared < 0e0; ) { // Ensure that the resulting value is not negative + smeared = mom * Geant4Random::instance()->gauss(1e0, resolution); + } + } + return smeared; + } + }; + + /// Declare optional properties from embedded structure + template <> + void Geant4FSShowerModel<calo_smear_model>::initialize() { + declareProperty("StocasticResolution", locals.StocasticEnergyResolution ); + declareProperty("ConstantResolution", locals.ConstantEnergyResolution ); + declareProperty("NoiseResolution", locals.NoiseEnergyResolution ); + } + + /// Sensitive detector construction callback. Called at "ConstructSDandField()" + template <> + void Geant4FSShowerModel<calo_smear_model>::constructSensitives(Geant4DetectorConstructionContext* ctxt) { + this->Geant4FastSimShowerModel::constructSensitives(ctxt); + } + + /// User callback to model the particle/energy shower + template <> + void Geant4FSShowerModel<calo_smear_model>::modelShower(const G4FastTrack& track, G4FastStep& step) { + auto* primary = track.GetPrimaryTrack(); + // Kill the parameterised particle: + this->killParticle(step, primary->GetKineticEnergy(), 0e0); + //----------------------------------------------------- + G4FastHit hit; + Geant4FastSimSpot spot(&hit, &track); + G4ThreeVector position = spot.trackPosition(); + double deposit = spot.kineticEnergy(); + + hit.SetPosition(spot.trackPosition()); + // Consider only primary tracks and smear according to the parametrized resolution + // ELSE: simply set the value of the (initial) energy of the particle is deposited in the step + if ( !spot.primary->GetParentID() ) { + deposit = locals.smearEnergy(deposit); + } + hit.SetEnergy(deposit); + step.ProposeTotalEnergyDeposited(deposit); + this->locals.hitMaker.make(hit, track); + } + + typedef Geant4FSShowerModel<calo_smear_model> Geant4CaloSmearShowerModel; + } +} + +#include <DDG4/Factories.h> +DECLARE_GEANT4ACTION_NS(dd4hep::sim,Geant4CaloSmearShowerModel) + diff --git a/DDG4/plugins/Geant4P1ShowerModel.cpp b/DDG4/plugins/Geant4P1ShowerModel.cpp index 315bbe07c56befe27d3da7ac4764f222f2932666..03328b46764c30aae89ebfbf9463201f59b775cb 100644 --- a/DDG4/plugins/Geant4P1ShowerModel.cpp +++ b/DDG4/plugins/Geant4P1ShowerModel.cpp @@ -30,17 +30,11 @@ // Framework include files #include <DDG4/Geant4FastSimShowerModel.inl.h> #include <DDG4/Geant4FastSimSpot.h> +#include <DDG4/Geant4Random.h> // Geant4 include files -#include "G4Version.hh" #include "G4Gamma.hh" -#include "Randomize.hh" #include "G4SystemOfUnits.hh" -#if G4VERSION_NUMBER > 1070 -#include "G4FastSimHitMaker.hh" -#else -class G4FastSimHitMaker { public: void make(const G4FastHit&, const G4FastTrack&) { } }; -#endif // C/C++ include files @@ -121,15 +115,16 @@ namespace dd4hep { xShower = zShower.orthogonal(); yShower = zShower.cross(xShower); // starting point of the shower: + Geant4Random* rndm = Geant4Random::instance(); G4ThreeVector sShower = spot.particleLocalPosition(); for (int i = 0; i < nSpots; i++) { // Longitudinal profile: -- shoot z according to Gamma distribution: - G4double bt = G4RandGamma::shoot(a,1.0); + G4double bt = rndm->gamma(a, 1e0); G4double t = bt/b; // t : reduced quantity = z/X0: G4double z = t*X0; // transverse profile: we set 90% of energy in one Rm, the rest between 1 and 3.5 Rm: - G4double xr = G4UniformRand(); - G4double phi = G4UniformRand()*twopi; + G4double xr = rndm->uniform(0e0,1e0); + G4double phi = rndm->uniform(0e0,twopi); G4double r; if (xr < 0.9) r = xr/0.9*Rm; else r = ((xr - 0.9)/0.1*2.5 + 1.0)*Rm; @@ -194,11 +189,11 @@ namespace dd4hep { G4double Energy = primary->GetKineticEnergy(); G4int nSpot = 50; G4double deposit = Energy/double(nSpot); - + Geant4Random* rndm = Geant4Random::instance(); for (int i = 0; i < nSpot; i++) { - double z = G4RandGauss::shoot(0,20*cm); - double r = G4RandGauss::shoot(0,10*cm); - double phi = G4UniformRand()*twopi; + double z = rndm->gauss(0, 20*cm); + double r = rndm->gauss(0, 10*cm); + double phi = rndm->uniform(0e0, twopi); G4ThreeVector position = showerCenter + z*zShower + r*std::cos(phi)*xShower + r*std::sin(phi)*yShower; /// Process spot and call sensitive detector G4FastHit hit(position, deposit); diff --git a/DDG4/src/Geant4Random.cpp b/DDG4/src/Geant4Random.cpp index d79c68cb6f13672de6c06ce827b6d311ce9427d9..464ff3c134516fa3accf1c1682c2bcdda9ced528 100644 --- a/DDG4/src/Geant4Random.cpp +++ b/DDG4/src/Geant4Random.cpp @@ -17,6 +17,7 @@ #include "DDG4/Geant4Random.h" #include "CLHEP/Random/EngineFactory.h" +#include "CLHEP/Random/RandGamma.h" #include "CLHEP/Random/Random.h" // ROOT include files @@ -324,3 +325,20 @@ void Geant4Random::sphere(double &x, double &y, double &z, double r) { gRandom->Sphere(x,y,z,r); } +/// Create poisson distributed random numbers +double Geant4Random::poisson(double mean) { + if ( !m_inited ) initialize(); + return gRandom->PoissonD(mean); +} + +/// Create breit wigner distributed random numbers +double Geant4Random::breit_wigner(double mean, double gamma) { + if ( !m_inited ) initialize(); + return gRandom->BreitWigner(mean, gamma); +} + +/// Create gamma distributed random numbers +double Geant4Random::gamma(double k, double lambda) { + if ( !m_inited ) initialize(); + return CLHEP::RandGamma::shoot(this->m_engine, k, lambda); +} diff --git a/examples/ClientTests/CMakeLists.txt b/examples/ClientTests/CMakeLists.txt index 3b124df17ab406272988b2f245524db2e04906f9..b16248d1b16e5fac19c368d46486ebb659aba466 100644 --- a/examples/ClientTests/CMakeLists.txt +++ b/examples/ClientTests/CMakeLists.txt @@ -430,13 +430,17 @@ if (DD4HEP_USE_GEANT4) REGEX_FAIL "Exception;EXCEPTION;ERROR;Error" ) endforeach(script) # - # Geant4 full simulation checks of multi-collection/segmentation detectors - foreach(script SiliconBlockGFlash SiliconBlockFastSim ) - dd4hep_add_test_reg( ClientTests_sim_${script}_LONGTEST - COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh" - EXEC_ARGS ${Python_EXECUTABLE} ${ClientTestsEx_INSTALL}/scripts/${script}.py -batch -events 2 - REGEX_PASS "Event 1 Begin event action. Access event related information" - REGEX_FAIL "Exception;EXCEPTION;ERROR;Error" ) - endforeach(script) - + if(Geant4_VERSION VERSION_LESS 10.7) + dd4hep_print("|++> Geant4 fast simulation not supported for Geant4 ${Geant4_VERSION}") + else() + # Geant4 full simulation checks of multi-collection/segmentation detectors + dd4hep_print("|++> Geant4 fast simulation tests enabled for Geant4 ${Geant4_VERSION}") + foreach(script SiliconBlockGFlash SiliconBlockFastSim ) + dd4hep_add_test_reg( ClientTests_sim_${script}_LONGTEST + COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh" + EXEC_ARGS ${Python_EXECUTABLE} ${ClientTestsEx_INSTALL}/scripts/${script}.py -batch -events 2 + REGEX_PASS "Event 1 Begin event action. Access event related information" + REGEX_FAIL "Exception;EXCEPTION;ERROR;Error" ) + endforeach(script) + endif() endif(DD4HEP_USE_GEANT4) diff --git a/examples/DDG4/scripts/TestProperties.py b/examples/DDG4/scripts/TestProperties.py index 623100aa07e9e1619d3a9e7bd51a4b69b7dcd15b..4e690bad24a557d12a057beb77175701415fd5ac 100644 --- a/examples/DDG4/scripts/TestProperties.py +++ b/examples/DDG4/scripts/TestProperties.py @@ -1,4 +1,3 @@ -<<<<<<< HEAD # ========================================================================== # AIDA Detector description implementation # -------------------------------------------------------------------------- @@ -13,33 +12,12 @@ from __future__ import absolute_import, unicode_literals import logging import DDG4 import os -<<<<<<< HEAD from g4units import GeV, m logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.INFO) logger = logging.getLogger(__name__) -||||||| parent of c61ce8aa (Fix python style according to Flake8) -from g4units import GeV, MeV, m -# -# -======= -from g4units import GeV, m -<<<<<<< HEAD -# -# ->>>>>>> c61ce8aa (Fix python style according to Flake8) -||||||| parent of 17dfd548 (Fix python style according to Flake8) -# -# -======= - -logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.INFO) -logger = logging.getLogger(__name__) - - ->>>>>>> 17dfd548 (Fix python style according to Flake8) """ dd4hep example setup using the python configuration @@ -62,163 +40,6 @@ def run(): ui = geant4.setupCshUI(vis=None) # Now the calorimeters -<<<<<<< HEAD - act = DDG4.Action(kernel, str('PropertyTestAction/Test')) - act.prop_str = 'Hello World!' - act.prop_bool = True - act.prop_int = 1234 - act.prop_long = 3456 - act.prop_ulong = 4567 - act.prop_float = 1234567.8 - act.prop_double = 1234567.8 - act.prop_XYZPoint = (1, 2, 3) - act.prop_XYZVector = (1 * m, 2 * m, 3 * m) - act.prop_PxPyPzEVector = (1 * GeV, 2 * GeV, 3 * GeV, 4 * GeV) - - act.map_str_str = {'a': 'AA', 'b': 'BB', 'c': 'CC'} - act.map_str_bool = {'a': 1, 'b': 0, 'c': 1} - act.map_str_int = {'a': 11, 'b': 22, 'c': 33} - act.map_str_long = {'a': 111, 'b': 222, 'c': 333} - # act.map_str_ulong = {'a': 1111, 'b': 2222, 'c': 3333} - act.map_str_float = {'a': 11.11, 'b': 22.22, 'c': 33.33} - act.map_str_double = {'a': 11.111, 'b': 22.222, 'c': 33.333} - - act.map_int_str = {100: 'AA', 200: 'BB', 300: 'CC'} - act.map_int_bool = {100: 1, 200: 0, 300: 1} - act.map_int_int = {100: 11, 200: 22, 300: 33} - act.map_int_long = {100: 111, 200: 222, 300: 333} - # act.map_int_ulong = {100: 1111, 200: 2222, 300: 3333} - act.map_int_float = {100: 11.11, 200: 22.22, 300: 33.33} - act.map_int_double = {100: 11.111, 200: 22.222, 300: 33.333} - - act.map_int_str = {100 * 10: 'AA', 200 * 10: 'BB', 300 * 10: 'CC'} - act.map_int_bool = {100 * 10: 1, 200 * 10: 0, 300 * 10: 1} - act.map_int_int = {100 * 10: 11, 200 * 10: 22, 300 * 10: 33} - act.map_int_long = {100 * 10: 111, 200 * 10: 222, 300 * 10: 333} - # act.map_int_ulong = {100 * 10: 1111, 200 * 10: 2222, 300 * 10: 3333} - act.map_int_float = {100 * 10: 11.11, 200 * 10: 22.22, 300 * 10: 33.33} - act.map_int_double = {100 * 10: 11.111, 200 * 10: 22.222, 300 * 10: 33.333} - - act.set_str = ['aa', 'bb', 'cc', 'dd'] - act.set_bool = [0, 0, 0, 1, 1, 1] - act.set_int = [0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 8] - act.set_long = [0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 8] - # act.set_ulong = [0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 8] - act.set_float = [0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 8] - act.set_double = [0 * m, 1 * m, 2 * m, 3 * m, 4 * m, 5 * m, 6 * m, 7 * m, 8 * m, 8 * m, 8 * m] - act.set_XYZPoint = [(1, 2, 3), (11, 22, 33), (111, 222, 333), (1111, 2222, 3333)] - act.set_XYZVector = [(1, 2, 3), (11, 22, 33), (111, 222, 333), (1111, 2222, 3333)] - act.set_PxPyPzEVector = [(1 * GeV, 2 * GeV, 3 * GeV, 4 * GeV), - (11 * GeV, 22 * GeV, 33 * GeV, 44 * GeV), - (111 * GeV, 222 * GeV, 333 * GeV, 444 * GeV)] - - act.list_str = ['aa', 'bb', 'cc', 'dd'] - act.list_bool = [0, 0, 0, 1, 1, 1] - act.list_int = [0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 8] - act.list_long = [0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 8] - act.list_ulong = [0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 8] - act.list_float = [0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 8] - act.list_double = [0 * m, 1 * m, 2 * m, 3 * m, 4 * m, 5 * m, 6 * m, 7 * m, 8 * m, 8 * m, 8 * m] - act.list_XYZPoint = [(1, 2, 3), (11, 22, 33), (111, 222, 333), (1111, 2222, 3333)] - act.list_XYZVector = [(1, 2, 3), (11, 22, 33), (111, 222, 333), (1111, 2222, 3333)] - act.list_PxPyPzEVector = [(1 * GeV, 2 * GeV, 3 * GeV, 4 * GeV), - (11 * GeV, 22 * GeV, 33 * GeV, 44 * GeV), - (111 * GeV, 222 * GeV, 333 * GeV, 444 * GeV)] - - act.vector_str = ['aa', 'bb', 'cc', 'dd'] - act.vector_bool = [0, 0, 0, 1, 1, 1] - act.vector_int = [0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 8] - act.vector_long = [0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 8] - act.vector_ulong = [0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 8] - act.vector_float = [0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 8] - act.vector_double = [0 * m, 1 * m, 2 * m, 3 * m, 4 * m, 5 * m, 6 * m, 7 * m, 8 * m, 8 * m, 8 * m] - act.vector_XYZPoint = [(1, 2, 3), (11, 22, 33), (111, 222, 333), (1111, 2222, 3333)] - act.vector_XYZVector = [(1, 2, 3), (11, 22, 33), (111, 222, 333), (1111, 2222, 3333)] - act.vector_PxPyPzEVector = [(1 * GeV, 2 * GeV, 3 * GeV, 4 * GeV), - (11 * GeV, 22 * GeV, 33 * GeV, 44 * GeV), - (111 * GeV, 222 * GeV, 333 * GeV, 444 * GeV)] -||||||| parent of c61ce8aa (Fix python style according to Flake8) - act = DDG4.Action(kernel, str('PropertyTestAction/Test')); - act.prop_str = 'Hello World!' - act.prop_bool = True - act.prop_int = 1234 - act.prop_long = 3456 - act.prop_ulong = 4567 - act.prop_float = 1234567.8 - act.prop_double = 1234567.8 - act.prop_XYZPoint = (1,2,3) - act.prop_XYZVector = (1*m,2*m,3*m) - act.prop_PxPyPzEVector = (1*GeV,2*GeV,3*GeV,4*GeV) - - act.map_str_str = {'a': 'AA', 'b': 'BB', 'c': 'CC'} - act.map_str_bool = {'a': 1, 'b': 0, 'c': 1} - act.map_str_int = {'a': 11, 'b': 22, 'c': 33} - act.map_str_long = {'a': 111, 'b': 222, 'c': 333} - #act.map_str_ulong = {'a': 1111, 'b': 2222, 'c': 3333} - act.map_str_float = {'a': 11.11, 'b': 22.22, 'c': 33.33} - act.map_str_double = {'a': 11.111, 'b': 22.222, 'c': 33.333} - - act.map_int_str = {100: 'AA', 200: 'BB', 300: 'CC'} - act.map_int_bool = {100: 1, 200: 0, 300: 1} - act.map_int_int = {100: 11, 200: 22, 300: 33} - act.map_int_long = {100: 111, 200: 222, 300: 333} - #act.map_int_ulong = {100: 1111, 200: 2222, 300: 3333} - act.map_int_float = {100: 11.11, 200: 22.22, 300: 33.33} - act.map_int_double = {100: 11.111, 200: 22.222, 300: 33.333} - - act.map_int_str = {100*10: 'AA', 200*10: 'BB', 300*10: 'CC'} - act.map_int_bool = {100*10: 1, 200*10: 0, 300*10: 1} - act.map_int_int = {100*10: 11, 200*10: 22, 300*10: 33} - act.map_int_long = {100*10: 111, 200*10: 222, 300*10: 333} - #act.map_int_ulong = {100*10: 1111, 200*10: 2222, 300*10: 3333} - act.map_int_float = {100*10: 11.11, 200*10: 22.22, 300*10: 33.33} - act.map_int_double = {100*10: 11.111, 200*10: 22.222, 300*10: 33.333} - - act.set_str = ['aa', 'bb', 'cc' ,'dd'] - act.set_bool = [0,0,0,1,1,1] - act.set_int = [0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 8] - act.set_long = [0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 8] - #act.set_ulong = [0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 8] - act.set_float = [0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 8] - act.set_double = [0*m, 1*m, 2*m, 3*m, 4*m, 5*m, 6*m, 7*m, 8*m, 8*m, 8*m] - act.set_XYZPoint = [(1,2,3),(11,22,33),(111,222,333),(1111,2222,3333)] - act.set_XYZVector = [(1,2,3),(11,22,33),(111,222,333),(1111,2222,3333)] - act.set_PxPyPzEVector = [(1*GeV,2*GeV,3*GeV,4*GeV), (11*GeV,22*GeV,33*GeV,44*GeV), (111*GeV,222*GeV,333*GeV,444*GeV)] - - act.list_str = ['aa', 'bb', 'cc' ,'dd'] - act.list_bool = [0,0,0,1,1,1] - act.list_int = [0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 8] - act.list_long = [0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 8] - act.list_ulong = [0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 8] - act.list_float = [0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 8] - act.list_double = [0*m, 1*m, 2*m, 3*m, 4*m, 5*m, 6*m, 7*m, 8*m, 8*m, 8*m] - act.list_XYZPoint = [(1,2,3),(11,22,33),(111,222,333),(1111,2222,3333)] - act.list_XYZVector = [(1,2,3),(11,22,33),(111,222,333),(1111,2222,3333)] - act.list_PxPyPzEVector = [(1*GeV,2*GeV,3*GeV,4*GeV), (11*GeV,22*GeV,33*GeV,44*GeV), (111*GeV,222*GeV,333*GeV,444*GeV)] - - act.vector_str = ['aa', 'bb', 'cc' ,'dd'] - act.vector_bool = [0,0,0,1,1,1] - act.vector_int = [0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 8] - act.vector_long = [0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 8] - act.vector_ulong = [0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 8] - act.vector_float = [0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 8] - act.vector_double = [0*m, 1*m, 2*m, 3*m, 4*m, 5*m, 6*m, 7*m, 8*m, 8*m, 8*m] - act.vector_XYZPoint = [(1,2,3),(11,22,33),(111,222,333),(1111,2222,3333)] - act.vector_XYZVector = [(1,2,3),(11,22,33),(111,222,333),(1111,2222,3333)] - act.vector_PxPyPzEVector = [(1*GeV,2*GeV,3*GeV,4*GeV), (11*GeV,22*GeV,33*GeV,44*GeV), (111*GeV,222*GeV,333*GeV,444*GeV)] - - # Check read access: - print('-------------------------------------------------------') - print(act.prop_str) # 'Hello World!' - print(act.prop_bool) # True - print(act.prop_int) # 1234 - print(act.prop_float) # 1234567.8 - print(act.prop_double) # 1234567.8 - print(act.prop_XYZPoint) # (1,2,3) - print(act.prop_XYZVector) # (1*m,2*m,3*m) - print(act.prop_PxPyPzEVector) # (1*GeV,2*GeV,3*GeV,4*GeV) - print('-------------------------------------------------------') -======= act = DDG4.Action(kernel, str('PropertyTestAction/Test')) act.prop_str = 'Hello World!' act.prop_bool = True @@ -297,130 +118,6 @@ def run(): act.enableUI() # Check read access: -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD - print('-------------------------------------------------------') - print(act.prop_str) # 'Hello World!' - print(act.prop_bool) # True - print(act.prop_int) # 1234 - print(act.prop_float) # 1234567.8 - print(act.prop_double) # 1234567.8 - print(act.prop_XYZPoint) # (1,2,3) - print(act.prop_XYZVector) # (1 * m,2 * m,3 * m) - print(act.prop_PxPyPzEVector) # (1 * GeV,2 * GeV,3 * GeV,4 * GeV) - print('-------------------------------------------------------') ->>>>>>> c61ce8aa (Fix python style according to Flake8) -||||||| parent of 131094de (Fix python style according to Flake8) - print('-------------------------------------------------------') - print(act.prop_str) # 'Hello World!' - print(act.prop_bool) # True - print(act.prop_int) # 1234 - print(act.prop_float) # 1234567.8 - print(act.prop_double) # 1234567.8 - print(act.prop_XYZPoint) # (1,2,3) - print(act.prop_XYZVector) # (1 * m,2 * m,3 * m) - print(act.prop_PxPyPzEVector) # (1 * GeV,2 * GeV,3 * GeV,4 * GeV) - print('-------------------------------------------------------') -======= - print('--> %s'%(str('-------------------------------------------------------'),)) - print('--> %s'%(str(act.prop_str),)) # 'Hello World!' - print('--> %s'%(str(act.prop_bool),)) # True - print('--> %s'%(str(act.prop_int),)) # 1234 - print('--> %s'%(str(act.prop_float),)) # 1234567.8 - print('--> %s'%(str(act.prop_double),)) # 1234567.8 - print('--> %s'%(str(act.prop_XYZPoint),)) # (1,2,3) - print('--> %s'%(str(act.prop_XYZVector),)) # (1 * m,2 * m,3 * m) - print('--> %s'%(str(act.prop_PxPyPzEVector),)) # (1 * GeV,2 * GeV,3 * GeV,4 * GeV) - print('--> %s'%(str('-------------------------------------------------------'),)) ->>>>>>> 131094de (Fix python style according to Flake8) -||||||| parent of d656762e (Fix python style according to Flake8) - print('--> %s'%(str('-------------------------------------------------------'),)) - print('--> %s'%(str(act.prop_str),)) # 'Hello World!' - print('--> %s'%(str(act.prop_bool),)) # True - print('--> %s'%(str(act.prop_int),)) # 1234 - print('--> %s'%(str(act.prop_float),)) # 1234567.8 - print('--> %s'%(str(act.prop_double),)) # 1234567.8 - print('--> %s'%(str(act.prop_XYZPoint),)) # (1,2,3) - print('--> %s'%(str(act.prop_XYZVector),)) # (1 * m,2 * m,3 * m) - print('--> %s'%(str(act.prop_PxPyPzEVector),)) # (1 * GeV,2 * GeV,3 * GeV,4 * GeV) - print('--> %s'%(str('-------------------------------------------------------'),)) -======= -||||||| parent of 297d253e (Fix python style according to Flake8) -======= - """ ->>>>>>> 297d253e (Fix python style according to Flake8) - print('--> {value}'.format(value='-------------------------------------------------------')) - print('--> {value}'.format(value=str(act.prop_str))) # 'Hello World!' - print('--> {value}'.format(value=str(act.prop_bool))) # True - print('--> {value}'.format(value=str(act.prop_int))) # 1234 - print('--> {value}'.format(value=str(act.prop_float))) # 1234567.8 - print('--> {value}'.format(value=str(act.prop_double))) # 1234567.8 - print('--> {value}'.format(value=str(act.prop_XYZPoint))) # (1,2,3) - print('--> {value}'.format(value=str(act.prop_XYZVector))) # (1 * m,2 * m,3 * m) - print('--> {value}'.format(value=str(act.prop_PxPyPzEVector))) # (1 * GeV,2 * GeV,3 * GeV,4 * GeV) - print('--> {value}'.format(value='-------------------------------------------------------')) -<<<<<<< HEAD ->>>>>>> d656762e (Fix python style according to Flake8) - - act.enableUI() -||||||| parent of 297d253e (Fix python style according to Flake8) - - act.enableUI() -======= - """ ->>>>>>> 297d253e (Fix python style according to Flake8) - - # Check read access: - logger.info('+{value}'.format(value='-------------------------------------------------------')) - logger.info('| {value}'.format(value=str(act.prop_str))) - logger.info('| {value}'.format(value=str(act.prop_bool))) - logger.info('| {value}'.format(value=str(act.prop_int))) - logger.info('| {value}'.format(value=str(act.prop_float))) - logger.info('| {value}'.format(value=str(act.prop_double))) - logger.info('| {value}'.format(value=str(act.prop_XYZPoint))) - logger.info('| {value}'.format(value=str(act.prop_XYZVector))) - logger.info('| {value}'.format(value=str(act.prop_PxPyPzEVector))) - logger.info('+{value}'.format(value='-------------------------------------------------------')) -||||||| parent of 17dfd548 (Fix python style according to Flake8) - """ - print('--> {value}'.format(value='-------------------------------------------------------')) - print('--> {value}'.format(value=str(act.prop_str))) # 'Hello World!' - print('--> {value}'.format(value=str(act.prop_bool))) # True - print('--> {value}'.format(value=str(act.prop_int))) # 1234 - print('--> {value}'.format(value=str(act.prop_float))) # 1234567.8 - print('--> {value}'.format(value=str(act.prop_double))) # 1234567.8 - print('--> {value}'.format(value=str(act.prop_XYZPoint))) # (1,2,3) - print('--> {value}'.format(value=str(act.prop_XYZVector))) # (1 * m,2 * m,3 * m) - print('--> {value}'.format(value=str(act.prop_PxPyPzEVector))) # (1 * GeV,2 * GeV,3 * GeV,4 * GeV) - print('--> {value}'.format(value='-------------------------------------------------------')) - """ -======= - logger.info('--> {value}'.format(value='-------------------------------------------------------')) - logger.info('--> {value}'.format(value=str(act.prop_str))) # 'Hello World!' - logger.info('--> {value}'.format(value=str(act.prop_bool))) # True - logger.info('--> {value}'.format(value=str(act.prop_int))) # 1234 - logger.info('--> {value}'.format(value=str(act.prop_float))) # 1234567.8 - logger.info('--> {value}'.format(value=str(act.prop_double))) # 1234567.8 - logger.info('--> {value}'.format(value=str(act.prop_XYZPoint))) # (1,2,3) - logger.info('--> {value}'.format(value=str(act.prop_XYZVector))) # (1 * m,2 * m,3 * m) - logger.info('--> {value}'.format(value=str(act.prop_PxPyPzEVector))) # (1 * GeV,2 * GeV,3 * GeV,4 * GeV) - logger.info('--> {value}'.format(value='-------------------------------------------------------')) ->>>>>>> 17dfd548 (Fix python style according to Flake8) -||||||| parent of 4671e80c (Fix python style according to Flake8) - logger.info('--> {value}'.format(value='-------------------------------------------------------')) - logger.info('--> {value}'.format(value=str(act.prop_str))) # 'Hello World!' - logger.info('--> {value}'.format(value=str(act.prop_bool))) # True - logger.info('--> {value}'.format(value=str(act.prop_int))) # 1234 - logger.info('--> {value}'.format(value=str(act.prop_float))) # 1234567.8 - logger.info('--> {value}'.format(value=str(act.prop_double))) # 1234567.8 - logger.info('--> {value}'.format(value=str(act.prop_XYZPoint))) # (1,2,3) - logger.info('--> {value}'.format(value=str(act.prop_XYZVector))) # (1 * m,2 * m,3 * m) - logger.info('--> {value}'.format(value=str(act.prop_PxPyPzEVector))) # (1 * GeV,2 * GeV,3 * GeV,4 * GeV) - logger.info('--> {value}'.format(value='-------------------------------------------------------')) -======= logger.info('+{value}'.format(value='-------------------------------------------------------')) logger.info('| {value}'.format(value=str(act.prop_str))) logger.info('| {value}'.format(value=str(act.prop_bool))) @@ -431,12 +128,15 @@ def run(): logger.info('| {value}'.format(value=str(act.prop_XYZVector))) logger.info('| {value}'.format(value=str(act.prop_PxPyPzEVector))) logger.info('+{value}'.format(value='-------------------------------------------------------')) ->>>>>>> 4671e80c (Fix python style according to Flake8) phys = geant4.setupPhysics('FTFP_BERT') phys.dump() ui.Commands = ['/ddg4/Test/show', '/ddg4/Test/dumpProperties', '/ddg4/UI/exit'] - geant4.execute() + kernel.NumEvents = 0 + kernel.configure() + kernel.initialize() + kernel.run() + kernel.terminate() if __name__ == "__main__":