reorganization of sources, moving cmt pertaining structures into HEP folder

This commit is contained in:
AndreaRigoni
2026-03-07 08:58:31 +00:00
parent 49cf0aeedd
commit e8f8e96521
70 changed files with 1468 additions and 1627 deletions

12
src/HEP/CMakeLists.txt Normal file
View File

@@ -0,0 +1,12 @@
################################################################################
##### HEP - High Energy Physics modules ########################################
################################################################################
include_directories(${SRC_DIR}/HEP)
add_subdirectory(Detectors)
add_subdirectory(Geant)
set(ULIB_SHARED_LIBRARIES ${ULIB_SHARED_LIBRARIES} PARENT_SCOPE)
set(ULIB_SELECTED_MODULES ${ULIB_SELECTED_MODULES} PARENT_SCOPE)

View File

@@ -0,0 +1,34 @@
set(HEADERS
ChamberHitEvent.h
DetectorChamber.h
ExperimentFitEvent.h
HierarchicalEncoding.h
Hit.h
HitMC.h
LinearFit.h
MuonError.h
MuonEvent.h
MuonScatter.h
)
set(libname ${PACKAGE_LIBPREFIX}Detectors)
set(ULIB_SHARED_LIBRARIES ${ULIB_SHARED_LIBRARIES} ${libname} PARENT_SCOPE)
set(ULIB_SELECTED_MODULES ${ULIB_SELECTED_MODULES} Detectors PARENT_SCOPE)
## Headers-only INTERFACE library
add_library(${libname} INTERFACE)
target_include_directories(${libname} INTERFACE
$<BUILD_INTERFACE:${SRC_DIR}>
$<INSTALL_INTERFACE:${INSTALL_INC_DIR}>
)
install(TARGETS ${libname}
EXPORT "uLibTargets")
install(FILES ${HEADERS}
DESTINATION ${INSTALL_INC_DIR}/HEP/Detectors)
if(BUILD_TESTING)
include(uLibTargetMacros)
add_subdirectory(testing)
endif()

View File

@@ -0,0 +1,56 @@
/*//////////////////////////////////////////////////////////////////////////////
// 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_CHAMBERHITEVENT_H
#define U_CHAMBERHITEVENT_H
#include "Core/Vector.h"
#include "Hit.h"
#include "ChamberDetector.h"
namespace uLib {
class ChamberHitEventData
{
public:
uLibConstRefMacro (Hits, Vector<HitData> )
uLibGetMacro (Idv, ChamberDetector::ID)
private:
friend class ChamberHitEvent;
Vector<HitData> m_Hits;
DetectorChamber::ID m_Idv; // -> chamber/view
};
class ChamberHitEvent : public ChamberHitEventData {
public:
uLibRefMacro (Hits, Vector<HitData> )
uLibSetMacro (Idv, ChamberDetector::ID)
};
}
#endif // CHAMBERHITEVENT_H

View File

@@ -0,0 +1,48 @@
/*//////////////////////////////////////////////////////////////////////////////
// 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_CHAMBERDETECTOR_H
#define U_CHAMBERDETECTOR_H
#include "Core/Types.h"
#include "Math/ContainerBox.h"
namespace uLib {
class DetectorChamber : public ContainerBox {
public:
private:
};
}
#endif // CHAMBERDETECTOR_H

View File

@@ -0,0 +1,48 @@
/*//////////////////////////////////////////////////////////////////////////////
// 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_EXPERIMENTFITEVENT_H
#define U_EXPERIMENTFITEVENT_H
namespace uLib {
class ExperimentFitEventData {
public:
private:
};
}
#endif // EXPERIMENTFITEVENT_H

View File

@@ -0,0 +1,41 @@
/*//////////////////////////////////////////////////////////////////////////////
// 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_DETECTORS_HIERARCHICALENCODING_H
#define U_DETECTORS_HIERARCHICALENCODING_H
#include <Core/BitCoding.h>
namespace uLib {
} // uLib
#endif // HIERARCHICALENCODING_H

70
src/HEP/Detectors/Hit.h Normal file
View File

@@ -0,0 +1,70 @@
/*//////////////////////////////////////////////////////////////////////////////
// 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 HIT_H
#define HIT_H
#include "Math/BitCode.h"
namespace uLib {
class HitRawCode_CMSDrift :
public BitCode4<unsigned short,6,3,2,5>
{
typedef unsigned short T;
public:
HitRawCode_CMSDrift() : BitCode4(0) {}
HitRawCode_CMSDrift(const Vector4i &v) : BitCode4(v) {}
HitRawCode_CMSDrift(T Chamber, T ROB, T TDC, T Channel ) {
(*this) << Chamber, ROB, TDC, Channel;
}
inline T Chamber() const { return m_data.bitf.field1; }
inline void SetChamber(const T data) { m_data.bitf.field1 = data; }
inline T ROB() const { return m_data.bitf.field2; }
inline void SetROB(const T data) { m_data.bitf.field2 = data; }
inline T TDC() const { return m_data.bitf.field3; }
inline void SetTDC(const T data) { m_data.bitf.field3 = data; }
inline T Channel() const { return m_data.bitf.field4; }
inline void SetChannel(const T data) { m_data.bitf.field4 = data; }
};
}
#endif // HIT_H

66
src/HEP/Detectors/HitMC.h Normal file
View File

@@ -0,0 +1,66 @@
/*//////////////////////////////////////////////////////////////////////////////
// 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_HITMC_H
#define U_HITMC_H
#include "Math/Dense.h"
#include "Hit.h"
namespace uLib {
class HitMCData : public HitData{
public:
enum Type {
PrimaryMu,
SecondaryMu,
DeltaRay
};
inline const HPoint3f & Position() const { return this->m_Position; }
inline enum Type GetType() const { return this->m_Type; }
protected:
HPoint3f m_Position;
enum Type m_Type;
};
class HitMC : public HitMCData {
public:
inline HPoint3f & Position() { return this->m_Position; }
inline void SetType(enum Type name) { this->m_Type = name; }
};
}
#endif // HITMC_H

View 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 U_LINEARFIT_H
#define U_LINEARFIT_H
#include "Math/Dense.h"
#include "ChamberDetector.h"
namespace uLib {
class LinearFitData {
public:
inline const Vector2f & Position() const { return this->m_Position; }
inline const Vector2f & Slope() const { return this->m_Slope; }
inline const Vector2f & PositionError() const { return this->m_PositionError; }
inline const Vector2f & SlopeError() const { return this->m_SlopeError; }
inline int GetHitsNumber() const { return this->m_HitsNumber; }
inline ChamberDetector::ID GetIdv() const { return this->m_Idv; }
protected:
Vector2f m_Position;
Vector2f m_Slope;
Vector2f m_PositionError;
Vector2f m_SlopeError;
int m_HitsNumber;
DetectorChamber::ID m_Idv;
};
class LinearFit : public LinearFitData {
public:
inline Vector2f & Position() { return this->m_Position; }
inline Vector2f & Slope() { return this->m_Slope; }
inline Vector2f & PositionError() { return this->m_PositionError; }
inline Vector2f & SlopeError() { return this->m_SlopeError; }
inline void SetHitsNumber(int name) { this->m_HitsNumber = name; }
inline void SetIdv(ChamberDetector::ID name) { this->m_Idv = name; }
};
}
#endif // LINEARFIT_H

View File

@@ -0,0 +1,25 @@
include $(top_srcdir)/Common.am
library_includedir = $(includedir)/libmutom-${PACKAGE_VERSION}/Detectors
library_include_HEADERS = DetectorChamber.h \
ExperimentFitEvent.h \
GeantEvent.h \
HitMC.h \
MuonScatter.h \
MuonEvent.h \
MuonError.h \
ChamberHitEvent.h \
Hit.h \
LinearFit.h \
Solid.h \
Matter.h \
Scene.h
_DETECTORS_SOURCES = \
Solid.cpp \
Scene.cpp
noinst_LTLIBRARIES = libmutomdetectors.la
libmutomdetectors_la_SOURCES = ${_DETECTORS_SOURCES}

View File

@@ -0,0 +1,56 @@
/*//////////////////////////////////////////////////////////////////////////////
// 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_MUONERROR_H
#define U_MUONERROR_H
#include "Math/Dense.h"
namespace uLib {
class MuonErrorData {
public:
inline const Scalarf & Theta() const { return this->m_Theta; }
inline const Scalarf & Phi() const { return this->m_Phi; }
protected:
Scalarf m_Theta;
Scalarf m_Phi;
};
class MuonError : public MuonErrorData {
public:
inline Scalarf & Theta() { return this->m_Theta; }
inline Scalarf & Phi() { return this->m_Phi; }
};
} // end ulib space
#endif // U_MUONERROR_H

View File

@@ -0,0 +1,73 @@
/*//////////////////////////////////////////////////////////////////////////////
// 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_MUONEVENT_H
#define U_MUONEVENT_H
#include "Math/Dense.h"
namespace uLib {
class MuonEventData {
public:
inline const HLine3f & LineIn() const { return this->m_LineIn; }
inline const HLine3f & LineOut() const { return this->m_LineOut; }
inline Scalarf GetMomentum() const { return this->m_Momentum; }
protected:
HLine3f m_LineIn;
HLine3f m_LineOut;
Scalarf m_Momentum;
};
class MuonEvent : public MuonEventData {
public:
inline HLine3f & LineIn() { return this->m_LineIn; }
inline HLine3f & LineOut() { return this->m_LineOut; }
inline Scalarf & Momentum() { return this->m_Momentum; }
};
inline std::ostream&
operator<< (std::ostream& stream, const MuonEventData &mu) {
stream << " MuonEventData: --------------- \n"
<< " P: " << mu.GetMomentum() << "\n"
<< " IN: " << mu.LineIn() << "\n"
<< " OUT: " << mu.LineOut() << "\n"
<< " ------------------------------ \n";
return stream;
}
} // end ulib space
#endif // U_MUONEVENT_H

View File

@@ -0,0 +1,80 @@
/*//////////////////////////////////////////////////////////////////////////////
// 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_MUONSCATTER_H
#define U_MUONSCATTER_H
#include "Math/Dense.h"
namespace uLib {
class MuonScatter {
public:
inline const HLine3f & LineIn() const { return this->m_LineIn; }
inline const HError3f & ErrorIn() const { return this->m_ErrorIn; }
inline const HLine3f & LineOut() const { return this->m_LineOut; }
inline const HError3f & ErrorOut() const { return this->m_ErrorOut; }
inline HLine3f & LineIn() { return this->m_LineIn; }
inline HError3f & ErrorIn() { return this->m_ErrorIn; }
inline HLine3f & LineOut() { return this->m_LineOut; }
inline HError3f & ErrorOut() { return this->m_ErrorOut; }
inline void SetMomentum(Scalarf name) { this->m_Momentum = name; }
inline void SetMomentumPrime(Scalarf name) { this->m_MomentumPrime = name; }
inline Scalarf GetMomentum() const { return this->m_Momentum; }
inline Scalarf GetMomentumPrime() const { return this->m_MomentumPrime; }
protected:
HLine3f m_LineIn;
HLine3f m_LineOut;
HError3f m_ErrorIn;
HError3f m_ErrorOut;
Scalarf m_Momentum;
Scalarf m_MomentumPrime;
};
typedef MuonScatter MuonScatterData;
inline std::ostream&
operator<< (std::ostream& stream, const MuonScatterData &mu) {
stream << " MuonScatterData: ------------- \n"
<< " P: " << mu.GetMomentum() << " Pprim: " << mu.GetMomentumPrime() << "\n"
<< " IN: " << mu.LineIn() << "\n"
<< " " << mu.ErrorIn() << "\n"
<< " OUT: " << mu.LineOut() << "\n"
<< " " << mu.ErrorOut() <<"\n"
<< " ------------------------------ \n";
return stream;
}
}
#endif // U_MUONSCATTER_H

View File

@@ -0,0 +1,15 @@
# TESTS
set( TESTS
# GDMLSolidTest
HierarchicalEncodingTest
)
set(LIBRARIES
${PACKAGE_LIBPREFIX}Core
${PACKAGE_LIBPREFIX}Math
Boost::serialization
Boost::program_options
Eigen3::Eigen
${ROOT_LIBRARIES}
)
uLib_add_tests(Detectors)

View 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);
}

View 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;
}

View 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)

View 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;

View 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)

View 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
View 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
View 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
View 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
View 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
View 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

View File

@@ -0,0 +1,47 @@
/*//////////////////////////////////////////////////////////////////////////////
// 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_PP_MUTOM_DETECTORCHAMBER_H
#define U_PP_MUTOM_DETECTORCHAMBER_H
#include <Core/Object.h>
namespace uLib {
class ContainerBox;
class DetectorChamber : public Object {
public:
virtual ContainerBox & Geometry() {}
protected:
virtual ~DetectorChamber() {}
};
} // uLib
#endif // DETECTORCHAMBER_H

View File

@@ -0,0 +1,53 @@
/*//////////////////////////////////////////////////////////////////////////////
// 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_PPHY_DRIFTDETECTOR_H
#define U_PPHY_DRIFTDETECTOR_H
#include <Core/Types.h>
#include <MMath/ContainerBox.h>
#include "ParticlePhysics/MuonTomography/DetectorChamber.h"
namespace uLib {
class DriftDetectorChamber : public DetectorChamber {
uLibRefMacro(Geometry,ContainerBox)
private:
ContainerBox m_Geometry;
};
} // uLib
#endif // U_PPHY_DRIFTDETECTOR_H

View File

@@ -0,0 +1,65 @@
/*//////////////////////////////////////////////////////////////////////////////
// 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_PPMUTOM_HIT_H
#define U_PPMUTOM_HIT_H
#include <Core/Types.h>
#include <Math/Dense.h>
namespace uLib {
template <typename Type, typename Code>
class Hit {
Code m_Code;
Type m_DriftTime;
};
class HitMC {
public:
virtual Id_t GetChamber() = 0;
virtual Vector3f GetPosition() = 0;
virtual Scalarf GetDritfTime() = 0;
protected:
virtual ~HitMC() {}
};
} // uLib
#endif // HIT_H

View File

@@ -0,0 +1,11 @@
include $(top_srcdir)/Common.am
library_includedir = $(includedir)/libmutom-${PACKAGE_VERSION}/ParticlePhysics/MuonTomography
library_include_HEADERS =
_PPMUTOM_SOURCES =
noinst_LTLIBRARIES = libmutomppmutom.la
libmutomppmutom_la_SOURCES = ${_PPMUTOM_SOURCES}

View File

@@ -0,0 +1,89 @@
/*//////////////////////////////////////////////////////////////////////////////
// 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_PPMUTOM_MUONSCATTER_H
#define U_PPMUTOM_MUONSCATTER_H
#include "Core/Macros.h"
#include "Core/Serializable.h"
#include "Math/Dense.h"
namespace uLib {
class MuonTrack {
ULIB_SERIALIZE_ACCESS
public:
HLine3f track;
Scalarf momentum;
};
class MuonScatter {
ULIB_SERIALIZE_ACCESS
public:
MuonTrack in, out;
MuonTrack error_in, error_out;
};
} // uLib
ULIB_SERIALIZABLE(uLib::MuonTrack)
ULIB_SERIALIZE(uLib::MuonTrack) {
ar & AR(line);
}
ULIB_SERIALIZABLE(uLib::MuonScatter)
ULIB_SERIALIZE(uLib::MuonScatter) {
ar
& " MuonScatter: ----------------- \n"
& "IN : " & AR(in) & "\n"
& "OUT: " & AR(out) & "\n"
& " ------------------------------ \n";
}
std::ostream &
operator << (std::ostream &o, const uLib::MuonScatter &d) {
uLib::Archive::hrt_oarchive(o) << d;
return o;
}
inline std::istream &
operator >> (std::istream &is, uLib::MuonScatter &d)
{
uLib::Archive::hrt_iarchive(is) >> d;
return is;
}
#endif // MUONSCATTER_H