mirror of
https://github.com/OpenCMT/uLib.git
synced 2025-12-06 15:31:31 +01:00
[uLib Geometry]
non working version! + adds ProgrammableAccessor + renaming of some Image structures ...
This commit is contained in:
18
src/Detectors/testing/CMakeLists.txt
Normal file
18
src/Detectors/testing/CMakeLists.txt
Normal file
@@ -0,0 +1,18 @@
|
||||
# TESTS
|
||||
set( TESTS
|
||||
GDMLSolidTest
|
||||
HierarchicalEncodingTest
|
||||
)
|
||||
|
||||
#set(LIBRARIES
|
||||
# ${PACKAGE_LIBPREFIX}Core
|
||||
# ${PACKAGE_LIBPREFIX}Math
|
||||
# ${PACKAGE_LIBPREFIX}Detectors
|
||||
# ${Boost_SERIALIZATION_LIBRARY}
|
||||
# ${Boost_SIGNALS_LIBRARY}
|
||||
# ${Boost_PROGRAM_OPTIONS_LIBRARY}
|
||||
# ${Eigen_LIBRARY}
|
||||
# ${Geant4_LIBRARIES}
|
||||
# ${ROOT_LIBRARIES}
|
||||
#)
|
||||
uLib_add_tests(${uLib-module})
|
||||
72
src/Detectors/testing/GDMLSolidTest.cpp
Normal file
72
src/Detectors/testing/GDMLSolidTest.cpp
Normal file
@@ -0,0 +1,72 @@
|
||||
/*//////////////////////////////////////////////////////////////////////////////
|
||||
// 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 <Geant4/G4RunManager.hh>
|
||||
|
||||
#include <Geant4/G4Material.hh>
|
||||
#include <Geant4/G4NistManager.hh>
|
||||
|
||||
#include <Geant4/G4Box.hh>
|
||||
#include <Geant4/G4TessellatedSolid.hh>
|
||||
#include <Geant4/G4LogicalVolume.hh>
|
||||
#include <Geant4/G4PVPlacement.hh>
|
||||
|
||||
#include <Geant4/G4GDMLParser.hh>
|
||||
//#include <Geant4/G4GDMLRead.hh>
|
||||
//#include <Geant4/G4GDMLReadSolids.hh>
|
||||
|
||||
|
||||
#include "Detectors/Solid.h"
|
||||
#include "testing-prototype.h"
|
||||
|
||||
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
|
||||
// G4RunManager* runManager = new G4RunManager;
|
||||
|
||||
G4NistManager *nist = G4NistManager::Instance();
|
||||
G4Material *air = nist->FindOrBuildMaterial("G4_AIR");
|
||||
|
||||
|
||||
|
||||
G4Box *box = new G4Box("box",5,5,5);
|
||||
|
||||
G4LogicalVolume box_lv(NULL,NULL,"box test");
|
||||
box_lv.SetSolid(box);
|
||||
box_lv.SetMaterial(air);
|
||||
G4PVPlacement box_pl(0,G4ThreeVector(),&box_lv,"box test",0,0,0);
|
||||
|
||||
G4GDMLParser parser;
|
||||
|
||||
parser.Write("test_out.gdml",&box_lv);
|
||||
|
||||
|
||||
}
|
||||
50
src/Detectors/testing/HierarchicalEncodingTest.cpp
Normal file
50
src/Detectors/testing/HierarchicalEncodingTest.cpp
Normal file
@@ -0,0 +1,50 @@
|
||||
/*//////////////////////////////////////////////////////////////////////////////
|
||||
// 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 <Detectors/Hit.h>
|
||||
|
||||
#include "testing-prototype.h"
|
||||
|
||||
using namespace uLib;
|
||||
|
||||
int main() {
|
||||
BEGIN_TESTING(Hierarchical Encoding);
|
||||
|
||||
|
||||
HitRawCode_CMSDrift code;
|
||||
code = Vector4i(5,6,2,8);
|
||||
|
||||
|
||||
|
||||
Vector4i v = code;
|
||||
|
||||
|
||||
std::cout << code << "\n";
|
||||
std::cout << v << "\n";
|
||||
|
||||
END_TESTING;
|
||||
}
|
||||
|
||||
16
src/Detectors/testing/Makefile.am
Normal file
16
src/Detectors/testing/Makefile.am
Normal file
@@ -0,0 +1,16 @@
|
||||
|
||||
include $(top_srcdir)/Common.am
|
||||
|
||||
#AM_DEFAULT_SOURCE_EXT = .cpp
|
||||
|
||||
# if HAVE_CHECK
|
||||
TESTS = GDMLSolidTest
|
||||
|
||||
# else
|
||||
# TEST =
|
||||
# endif
|
||||
|
||||
LDADD = $(top_srcdir)/libmutom-${PACKAGE_VERSION}.la
|
||||
|
||||
check_PROGRAMS = $(TESTS)
|
||||
|
||||
37
src/Detectors/testing/testing-prototype.h
Normal file
37
src/Detectors/testing/testing-prototype.h
Normal file
@@ -0,0 +1,37 @@
|
||||
/*//////////////////////////////////////////////////////////////////////////////
|
||||
// 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 <stdio.h>
|
||||
|
||||
#define BEGIN_TESTING(name) \
|
||||
static int _fail = 0; \
|
||||
printf("..:: Testing " #name " ::..\n");
|
||||
|
||||
#define TEST1(val) _fail += (val)==0
|
||||
#define TEST0(val) _fail += (val)!=0
|
||||
#define END_TESTING return _fail;
|
||||
|
||||
Reference in New Issue
Block a user