reorganization of sources, moving cmt pertaining structures into HEP folder
This commit is contained in:
52
src/HEP/Geant/CMakeLists.txt
Normal file
52
src/HEP/Geant/CMakeLists.txt
Normal file
@@ -0,0 +1,52 @@
|
||||
|
||||
################################################################################
|
||||
##### HEP/Geant - Geant4 integration library ###################################
|
||||
################################################################################
|
||||
|
||||
find_package(Geant4 QUIET)
|
||||
|
||||
if(NOT Geant4_FOUND)
|
||||
message(STATUS "Geant4 not found - skipping mutomGeant library")
|
||||
return()
|
||||
endif()
|
||||
|
||||
message(STATUS "Geant4 found: ${Geant4_VERSION}")
|
||||
include(${Geant4_USE_FILE})
|
||||
|
||||
set(HEADERS
|
||||
GeantEvent.h
|
||||
Matter.h
|
||||
Scene.h
|
||||
Solid.h
|
||||
)
|
||||
|
||||
set(SOURCES
|
||||
Scene.cpp
|
||||
Solid.cpp
|
||||
)
|
||||
|
||||
set(libname ${PACKAGE_LIBPREFIX}Geant)
|
||||
set(ULIB_SHARED_LIBRARIES ${ULIB_SHARED_LIBRARIES} ${libname} PARENT_SCOPE)
|
||||
set(ULIB_SELECTED_MODULES ${ULIB_SELECTED_MODULES} Geant PARENT_SCOPE)
|
||||
|
||||
add_library(${libname} SHARED ${SOURCES})
|
||||
set_target_properties(${libname} PROPERTIES
|
||||
VERSION ${PROJECT_VERSION}
|
||||
SOVERSION ${PROJECT_SOVERSION})
|
||||
|
||||
target_include_directories(${libname} PRIVATE ${Geant4_INCLUDE_DIRS})
|
||||
|
||||
target_link_libraries(${libname}
|
||||
${PACKAGE_LIBPREFIX}Core
|
||||
${PACKAGE_LIBPREFIX}Math
|
||||
${PACKAGE_LIBPREFIX}Detectors
|
||||
${Geant4_LIBRARIES}
|
||||
)
|
||||
|
||||
install(TARGETS ${libname}
|
||||
EXPORT "uLibTargets"
|
||||
RUNTIME DESTINATION ${INSTALL_BIN_DIR} COMPONENT bin
|
||||
LIBRARY DESTINATION ${INSTALL_LIB_DIR} COMPONENT lib)
|
||||
|
||||
install(FILES ${HEADERS}
|
||||
DESTINATION ${INSTALL_INC_DIR}/HEP/Geant)
|
||||
60
src/HEP/Geant/GeantEvent.h
Normal file
60
src/HEP/Geant/GeantEvent.h
Normal file
@@ -0,0 +1,60 @@
|
||||
/*//////////////////////////////////////////////////////////////////////////////
|
||||
// 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.
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
#ifndef U_GEANTEVENT_H
|
||||
#define U_GEANTEVENT_H
|
||||
|
||||
#include "Core/Types.h"
|
||||
#include "Core/Vector.h"
|
||||
#include "Math/Dense.h"
|
||||
|
||||
#include "ChamberHitEvent.h"
|
||||
|
||||
namespace uLib {
|
||||
|
||||
class GeantEventData {
|
||||
public:
|
||||
uLibGetMacro(EventID, Id_t) uLibGetMacro(Momentum, Scalarf)
|
||||
uLibConstRefMacro(GenPos, Vector3f) uLibConstRefMacro(GenDir, Vector3f)
|
||||
uLibConstRefMacro(ChEvents, Vector<ChamberHitEventData>)
|
||||
|
||||
private : friend class GeantEvent;
|
||||
Id_t m_EventID;
|
||||
Scalarf m_Momentum;
|
||||
Vector3f m_GenPos;
|
||||
Vector3f m_GenDir;
|
||||
Vector<ChamberHitEventData> m_ChEvents;
|
||||
};
|
||||
|
||||
class GeantEvent {
|
||||
public:
|
||||
uLibSetMacro(EventID, Id_t) uLibSetMacro(Momentum, Scalarf)
|
||||
uLibRefMacro(GenPos, Vector3f) uLibRefMacro(GenDir, Vector3f)
|
||||
uLibRefMacro(ChEvents, Vector<ChamberHitEventData>)
|
||||
};
|
||||
|
||||
} // namespace uLib
|
||||
|
||||
#endif // GEANTEVENT_H
|
||||
71
src/HEP/Geant/Matter.h
Normal file
71
src/HEP/Geant/Matter.h
Normal file
@@ -0,0 +1,71 @@
|
||||
/*//////////////////////////////////////////////////////////////////////////////
|
||||
// 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.
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
|
||||
|
||||
#ifndef MATTER_H
|
||||
#define MATTER_H
|
||||
|
||||
#include "Core/Object.h"
|
||||
|
||||
class G4Element;
|
||||
class G4Material;
|
||||
|
||||
namespace uLib {
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//// ELEMENT ///////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class Element {
|
||||
public:
|
||||
|
||||
uLibRefMacro(G4Data,G4Element *)
|
||||
private:
|
||||
G4Element *m_G4Data;
|
||||
};
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//// MATERIAL //////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
class Material : public Object {
|
||||
public:
|
||||
|
||||
uLibRefMacro(G4Data,G4Material *)
|
||||
private:
|
||||
G4Material *m_G4Data;
|
||||
};
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif // MATTER_H
|
||||
74
src/HEP/Geant/Scene.cpp
Normal file
74
src/HEP/Geant/Scene.cpp
Normal file
@@ -0,0 +1,74 @@
|
||||
/*//////////////////////////////////////////////////////////////////////////////
|
||||
// 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/G4Material.hh>
|
||||
#include <Geant4/G4NistManager.hh>
|
||||
#include <Geant4/G4LogicalVolume.hh>
|
||||
|
||||
#include "Core/Vector.h"
|
||||
#include "Matter.h"
|
||||
#include "Solid.h"
|
||||
|
||||
#include "Scene.h"
|
||||
|
||||
|
||||
namespace uLib {
|
||||
|
||||
|
||||
class DetectorsScenePimpl {
|
||||
|
||||
public:
|
||||
|
||||
|
||||
// members //
|
||||
//Vector<Solid> m_Solids;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
DetectorsScene::DetectorsScene() :
|
||||
d(new DetectorsScenePimpl())
|
||||
{}
|
||||
|
||||
DetectorsScene::~DetectorsScene()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
|
||||
void DetectorsScene::AddSolid(const Solid &solid)
|
||||
{
|
||||
// d->m_Solids.push_back(solid);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
52
src/HEP/Geant/Scene.h
Normal file
52
src/HEP/Geant/Scene.h
Normal file
@@ -0,0 +1,52 @@
|
||||
/*//////////////////////////////////////////////////////////////////////////////
|
||||
// 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.
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
|
||||
|
||||
#ifndef SCENE_H
|
||||
#define SCENE_H
|
||||
|
||||
#include "Core/Object.h"
|
||||
#include "Core/Vector.h"
|
||||
#include "Solid.h"
|
||||
|
||||
namespace uLib {
|
||||
|
||||
|
||||
class DetectorsScene : public Object {
|
||||
public:
|
||||
DetectorsScene();
|
||||
~DetectorsScene();
|
||||
|
||||
|
||||
void AddSolid(const Solid &solid);
|
||||
|
||||
private:
|
||||
class DetectorsScenePimpl *d;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
#endif // SCENE_H
|
||||
114
src/HEP/Geant/Solid.cpp
Normal file
114
src/HEP/Geant/Solid.cpp
Normal file
@@ -0,0 +1,114 @@
|
||||
/*//////////////////////////////////////////////////////////////////////////////
|
||||
// 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.
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
|
||||
|
||||
// G4 Solid //
|
||||
#include <Geant4/G4Material.hh>
|
||||
#include <Geant4/G4NistManager.hh>
|
||||
#include <Geant4/G4LogicalVolume.hh>
|
||||
|
||||
// Tessellated solid //
|
||||
#include <Geant4/G4TessellatedSolid.hh>
|
||||
#include <Geant4/G4TriangularFacet.hh>
|
||||
#include <Geant4/G4ThreeVector.hh>
|
||||
|
||||
|
||||
#include "Math/Dense.h"
|
||||
|
||||
#include "Solid.h"
|
||||
|
||||
namespace uLib {
|
||||
|
||||
class DetectorsSolidPimpl {
|
||||
public:
|
||||
static G4ThreeVector getG4Vector3f(const Vector3f &vector) {
|
||||
return G4ThreeVector( vector(0), vector(1), vector(2) );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
Solid::Solid() :
|
||||
m_Logical (new G4LogicalVolume(NULL,NULL,"unnamed_solid")),
|
||||
m_Material(NULL)
|
||||
{}
|
||||
|
||||
Solid::Solid(const char *name) :
|
||||
m_Logical(new G4LogicalVolume(NULL,NULL,name)),
|
||||
m_Material(NULL)
|
||||
{}
|
||||
|
||||
|
||||
|
||||
void Solid::SetNistMaterial(const char *name)
|
||||
{
|
||||
G4NistManager *nist = G4NistManager::Instance();
|
||||
if (m_Material) delete m_Material;
|
||||
m_Material = nist->FindOrBuildMaterial(name);
|
||||
m_Logical->SetMaterial(m_Material);
|
||||
}
|
||||
|
||||
void Solid::SetMaterial(G4Material *material)
|
||||
{
|
||||
if(material)
|
||||
{
|
||||
m_Material = material;
|
||||
m_Logical->SetMaterial(material);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
TessellatedSolid::TessellatedSolid(const char *name) :
|
||||
BaseClass(name),
|
||||
m_Solid(new G4TessellatedSolid(name))
|
||||
{}
|
||||
|
||||
|
||||
void TessellatedSolid::SetMesh(TriangleMesh &mesh)
|
||||
{
|
||||
G4TessellatedSolid *ts = this->m_Solid;
|
||||
for (int i=0; i<mesh.Triangles().size(); ++i) {
|
||||
const Vector3i &trg = mesh.Triangles().at(i);
|
||||
G4TriangularFacet *facet = new G4TriangularFacet(
|
||||
DetectorsSolidPimpl::getG4Vector3f(mesh.Points().at(trg(0))),
|
||||
DetectorsSolidPimpl::getG4Vector3f(mesh.Points().at(trg(1))),
|
||||
DetectorsSolidPimpl::getG4Vector3f(mesh.Points().at(trg(2))),
|
||||
ABSOLUTE);
|
||||
ts->AddFacet((G4VFacet *)facet);
|
||||
}
|
||||
this->m_Logical->SetSolid(ts);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
86
src/HEP/Geant/Solid.h
Normal file
86
src/HEP/Geant/Solid.h
Normal file
@@ -0,0 +1,86 @@
|
||||
/*//////////////////////////////////////////////////////////////////////////////
|
||||
// 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.
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
|
||||
|
||||
#ifndef SOLID_H
|
||||
#define SOLID_H
|
||||
|
||||
#include "Core/Object.h"
|
||||
#include "Math/Dense.h"
|
||||
#include "Math/TriangleMesh.h"
|
||||
#include "Detectors/Matter.h"
|
||||
|
||||
class G4Material;
|
||||
class G4LogicalVolume;
|
||||
class G4TessellatedSolid;
|
||||
|
||||
|
||||
namespace uLib {
|
||||
|
||||
class Solid : public Object {
|
||||
public:
|
||||
|
||||
Solid();
|
||||
Solid(const char *name);
|
||||
|
||||
void SetNistMaterial(const char *name);
|
||||
|
||||
void SetMaterial(G4Material *material);
|
||||
|
||||
uLibGetMacro(Material,G4Material *)
|
||||
uLibGetMacro(Logical,G4LogicalVolume *)
|
||||
|
||||
protected:
|
||||
G4Material *m_Material;
|
||||
G4LogicalVolume *m_Logical;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class TessellatedSolid : public Solid {
|
||||
typedef Solid BaseClass;
|
||||
|
||||
public:
|
||||
TessellatedSolid(const char *name);
|
||||
|
||||
void SetMesh(TriangleMesh &mesh);
|
||||
|
||||
uLibGetMacro(Solid,G4TessellatedSolid *)
|
||||
private:
|
||||
G4TessellatedSolid *m_Solid;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // SOLID_H
|
||||
Reference in New Issue
Block a user