diff --git a/Calorimeter/CaloG4Sim/CMakeLists.txt b/Calorimeter/CaloG4Sim/CMakeLists.txt index 1d6c8725c1e9e98c35f31db8908198a276b0e4ce..e54a2b73d03f5c27b45c7ae4aa2c01daec360d8d 100644 --- a/Calorimeter/CaloG4Sim/CMakeLists.txt +++ b/Calorimeter/CaloG4Sim/CMakeLists.txt @@ -20,7 +20,7 @@ find_package( CLHEP ) find_package( Geant4 ) find_package( TBB ) find_package( XercesC ) - +find_package( GTest REQUIRED ) # Component(s) in the package: atlas_add_library( CaloG4SimLib src/*.cc @@ -39,3 +39,9 @@ atlas_add_component( CaloG4Sim # Install files from the package: atlas_install_python_modules( python/*.py ) +atlas_add_test( EscapedEnergyRegistry_gtest + SOURCES + test/EscapedEnergyRegistry_gtest.cxx + INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${TBB_INCLUDE_DIRS} ${GTEST_INCLUDE_DIRS} + LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} ${TBB_LIBRARIES} ${GTEST_LIBRARIES} AthenaBaseComps GaudiKernel G4AtlasInterfaces G4AtlasToolsLib + CxxUtils MCTruth CaloG4SimLib pthread ) diff --git a/Calorimeter/CaloG4Sim/CaloG4Sim/derivedVEscapedEnergyProcessing.h b/Calorimeter/CaloG4Sim/CaloG4Sim/derivedVEscapedEnergyProcessing.h new file mode 100644 index 0000000000000000000000000000000000000000..5ffd4a941a169bfe50ae39e9ba6123d699c1fa2b --- /dev/null +++ b/Calorimeter/CaloG4Sim/CaloG4Sim/derivedVEscapedEnergyProcessing.h @@ -0,0 +1,52 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// VEscapedEnergyProcessing +// 13-Jul-2004 William Seligman + +#ifndef CaloG4_derivedVEscapedEnergyProcessing_H +#define CaloG4_derivedVEscapedEnergyProcessing_H + +#include "G4Step.hh" +#include "globals.hh" +#include "CaloG4Sim/VEscapedEnergyProcessing.h" + +namespace CaloG4 +{ + + /// @class VEscapedEnergyProcessing + /// @brief Virtual interface for escaped energy processor classes. + /// + /// The SimulationEnergies class provides a common procedure for + /// categorizing the energy deposited in a given G4Step. However, + /// different detectors have different scheme for handling one of the + /// categories: escaped energy. + /// + /// The issue is that, if a particle's energy is lost by escaping the + /// simulation, you don't want to record that energy in the volume it + /// escapes; you want to record that energy in the volume in which the + /// particle was created. Neutrinos are a good example of this. + /// + /// In effect, the SimulationEnergies class has to issue an "interrupt" + /// to some other volume than the current G4Step, telling that other + /// volume to accumulate the energy of the escaped particle. The Tile + /// Simulation and the LAr simulation handle this interrupt + /// differently, since they organize sensitive detectors in a different + /// way. + /// + /// This interface "hides" the different escaped-energy processing + /// required by the different detectors in the simulation. + /// + class derivedVEscapedEnergyProcessing : public VEscapedEnergyProcessing + { + + public: + + virtual G4bool Process( G4Step* ) { return true; } + + }; + +} // namespace CaloG4 + +#endif // CaloG4_derivedVEscapedEnergyProcessing_H diff --git a/Calorimeter/CaloG4Sim/test/EscapedEnergyRegistry_gtest.cxx b/Calorimeter/CaloG4Sim/test/EscapedEnergyRegistry_gtest.cxx new file mode 100644 index 0000000000000000000000000000000000000000..349b580ddbe1d461a5392beaeb75d8d8057e7a0f --- /dev/null +++ b/Calorimeter/CaloG4Sim/test/EscapedEnergyRegistry_gtest.cxx @@ -0,0 +1,20 @@ +#include "CaloG4Sim/EscapedEnergyRegistry.h" +#include "CaloG4Sim/derivedVEscapedEnergyProcessing.h" +#include "gtest/gtest.h" + +TEST( testcase, test1 ) { + +const G4String name = "processing"; +CaloG4::EscapedEnergyRegistry* classToTest = CaloG4::EscapedEnergyRegistry::GetInstance(); +CaloG4::derivedVEscapedEnergyProcessing* classToOperate = new CaloG4::derivedVEscapedEnergyProcessing(); +classToTest->AddAndAdoptProcessing( name, classToOperate ); +ASSERT_EQ( classToOperate, classToTest->GetProcessing( name ) ); + +} + +int main(int argc, char **argv) { + + testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); + +}