refactor: introduce PhysicalVolume class and update Geant scene hierarchy to use logical and physical volumes
This commit is contained in:
64
src/HEP/Geant/testing/MaterialTest.cpp
Normal file
64
src/HEP/Geant/testing/MaterialTest.cpp
Normal file
@@ -0,0 +1,64 @@
|
||||
/*//////////////////////////////////////////////////////////////////////////////
|
||||
// CMT Cosmic Muon Tomography project //////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Copyright (c) 2014, Universita' degli Studi di Padova, INFN sez. di Padova
|
||||
All rights reserved
|
||||
|
||||
Authors: Andrea Rigoni Garola < andrea.rigoni@pd.infn.it >
|
||||
|
||||
------------------------------------------------------------------
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 3.0 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library.
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
#include <iostream>
|
||||
#include "HEP/Geant/Matter.h"
|
||||
#include "testing-prototype.h"
|
||||
|
||||
using namespace uLib::Geant;
|
||||
|
||||
int test_nist_materials() {
|
||||
Material air("G4_AIR");
|
||||
if (!air.GetG4Material()) {
|
||||
std::cerr << "Failed to find G4_AIR" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
std::cout << "Air name: " << air.GetG4Material()->GetName() << std::endl;
|
||||
std::cout << "Air density: " << air.GetG4Material()->GetDensity() << " g/cm3" << std::endl;
|
||||
|
||||
Material lead("G4_Pb");
|
||||
if (!lead.GetG4Material()) {
|
||||
std::cerr << "Failed to find G4_Pb" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
std::cout << "Lead name: " << lead.GetG4Material()->GetName() << std::endl;
|
||||
std::cout << "Lead density: " << lead.GetG4Material()->GetDensity() << " g/cm3" << std::endl;
|
||||
|
||||
Material water("G4_WATER");
|
||||
if (!water.GetG4Material()) {
|
||||
std::cerr << "Failed to find G4_WATER" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
std::cout << "Water name: " << water.GetG4Material()->GetName() << std::endl;
|
||||
std::cout << "Water density: " << water.GetG4Material()->GetDensity() << " g/cm3" << std::endl;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int main() {
|
||||
BEGIN_TESTING(Material);
|
||||
TEST1(test_nist_materials());
|
||||
END_TESTING;
|
||||
}
|
||||
Reference in New Issue
Block a user