diff --git a/CMakeLists.txt b/CMakeLists.txt index e17692d..099cb8a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,7 +20,15 @@ target_sources( include/SHiP/SimHit.hpp include/SHiP/SimParticle.hpp include/SHiP/SimResult.hpp + include/SHiP/RecHit.hpp + include/SHiP/TrackFitResult.hpp include/SHiP/RecParticle.hpp + include/SHiP/detectors/UBTHit.hpp + include/SHiP/detectors/SBTHit.hpp + include/SHiP/detectors/StrawTubesHit.hpp + include/SHiP/detectors/CaloHit.hpp + include/SHiP/detectors/TimeDetHit.hpp + include/SHiP/detectors/DetectorID.hpp ) target_link_libraries(SHiPDataModel PUBLIC ROOT::Core) set_target_properties(SHiPDataModel PROPERTIES LINKER_LANGUAGE CXX) @@ -47,7 +55,14 @@ root_generate_dictionary( SHiP/SimHit.hpp SHiP/SimParticle.hpp SHiP/SimResult.hpp + SHiP/RecHit.hpp + SHiP/TrackFitResult.hpp SHiP/RecParticle.hpp + SHiP/detectors/UBTHit.hpp + SHiP/detectors/SBTHit.hpp + SHiP/detectors/StrawTubesHit.hpp + SHiP/detectors/CaloHit.hpp + SHiP/detectors/TimeDetHit.hpp MODULE SHiPDataModel LINKDEF @@ -60,7 +75,10 @@ install( TARGETS SHiPDataModel EXPORT SHiPDataModelTargets LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - FILE_SET headers + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + FILE_SET headers DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) install(TARGETS SHiPUnits EXPORT SHiPDataModelTargets FILE_SET headers) install( @@ -93,6 +111,7 @@ install( DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/SHiPDataModel ) + include(CTest) if(BUILD_TESTING) add_subdirectory(tests) diff --git a/include/SHiP/LinkDef.h b/include/SHiP/LinkDef.h index 33ad6b5..cdaba9c 100644 --- a/include/SHiP/LinkDef.h +++ b/include/SHiP/LinkDef.h @@ -14,7 +14,23 @@ #pragma link C++ class std::vector+; #pragma link C++ class std::vector+; +// Digitisation +#pragma link C++ class SHiP::RecHit+; +#pragma link C++ class std::vector+; +#pragma link C++ class SHiP::UBTHit+; +#pragma link C++ class std::vector+; +#pragma link C++ class SHiP::SBTHit+; +#pragma link C++ class std::vector+; +#pragma link C++ class SHiP::TimeDetHit+; +#pragma link C++ class std::vector+; +#pragma link C++ class SHiP::StrawTubesHit+; +#pragma link C++ class std::vector+; +#pragma link C++ class SHiP::CaloHit+; +#pragma link C++ class std::vector+; + // Reconstruction +#pragma link C++ class SHiP::TrackFitResult+; +#pragma link C++ class std::vector+; #pragma link C++ class SHiP::RecParticle+; #pragma link C++ class std::vector+; #endif diff --git a/include/SHiP/RecHit.hpp b/include/SHiP/RecHit.hpp new file mode 100644 index 0000000..7916a14 --- /dev/null +++ b/include/SHiP/RecHit.hpp @@ -0,0 +1,33 @@ +#pragma once + +#include +#include + +#include "SHiP/SimHit.hpp" + +namespace SHiP { + +/// Reconstructed particle +struct RecHit { + std::int32_t detectorId{0}; + std::int32_t trackId{0}; + std::int32_t pdgCode{0}; + std::array position{0, 0, 0}; ///< Hit position [mm] + std::array momentum{0, 0, 0}; ///< Momentum at hit [GeV/c] + double energyDeposit{0}; ///< Energy deposited [GeV] + double time{0}; ///< Global time [ns] + double pathLength{0}; ///< Step length [mm] +}; + +inline RecHit fromSimHit(SimHit const& sp) { + return {.detectorId = sp.detectorId, + .trackId = sp.trackId, + .pdgCode = sp.pdgCode, + .position = sp.position, + .momentum = sp.momentum, + .energyDeposit = sp.energyDeposit, + .time = sp.time, + .pathLength = sp.pathLength}; +} + +} // namespace SHiP diff --git a/include/SHiP/RecParticle.hpp b/include/SHiP/RecParticle.hpp index 657b19a..2b979a7 100644 --- a/include/SHiP/RecParticle.hpp +++ b/include/SHiP/RecParticle.hpp @@ -2,7 +2,9 @@ #include #include +#include +#include "SHiP/RecHit.hpp" #include "SHiP/SimParticle.hpp" namespace SHiP { @@ -15,8 +17,9 @@ struct RecParticle { std::array vertex{0, 0, 0}; ///< Production vertex [mm] std::array endpoint{0, 0, 0}; ///< End point [mm] std::array momentum{0, 0, 0}; ///< Initial momentum [GeV/c] - double energy{0}; ///< Initial kinetic energy [GeV] - double time{0}; ///< Production time [ns] + std::vector hits{}; + double energy{0}; ///< Initial kinetic energy [GeV] + double time{0}; ///< Production time [ns] std::int32_t creatorProcess{0}; double ipPV{0}; ///< IP wrt to the PV (at 0,0,0) [mm] }; diff --git a/include/SHiP/TrackFitResult.hpp b/include/SHiP/TrackFitResult.hpp new file mode 100644 index 0000000..1555220 --- /dev/null +++ b/include/SHiP/TrackFitResult.hpp @@ -0,0 +1,27 @@ +#pragma once + +#include +#include +#include + +namespace SHiP { + +/// Reconstructed particle +struct TrackFitResult { + std::int32_t nMeas{0}; + std::int32_t fitStatus{1}; // 0 = success, 1 = failure + double chi2{0}; + std::int32_t ndf{0}; + double qoverp{0}; + double phi{0}; + double theta{0}; + double time{0}; + std::array refLoc{0,0,0}; + std::vector inputMeasurementsX{}; + std::vector inputMeasurementsY{}; + std::vector fittedMeasurementsX{}; + std::vector fittedMeasurementsY{}; + std::vector residualsX{}; + std::vector residualsY{}; +}; +} // namespace SHiP diff --git a/include/SHiP/detectors/CaloHit.hpp b/include/SHiP/detectors/CaloHit.hpp new file mode 100644 index 0000000..e86e3ff --- /dev/null +++ b/include/SHiP/detectors/CaloHit.hpp @@ -0,0 +1,11 @@ +#pragma once +#include "SHiP/RecHit.hpp" + +namespace SHiP { + +/// Hit reconstructed by the calorimeter +struct CaloHit{ + RecHit recHit; ///< The reconstructed hit +}; + +} // namespace SHiP diff --git a/include/SHiP/detectors/DetectorID.hpp b/include/SHiP/detectors/DetectorID.hpp new file mode 100644 index 0000000..c8b497b --- /dev/null +++ b/include/SHiP/detectors/DetectorID.hpp @@ -0,0 +1,16 @@ +// SHiP/DetectorID.hpp +#pragma once + +#include + +namespace SHiP { + +enum class DetectorID : std::int32_t { + StrawTubes = 2, + Calorimeter = 3, + UpstreamTagger = 0, + SurroundTagger = 1, + TimingDetector = 4 +}; + +} // namespace SHiP \ No newline at end of file diff --git a/include/SHiP/detectors/SBTHit.hpp b/include/SHiP/detectors/SBTHit.hpp new file mode 100644 index 0000000..1828e9c --- /dev/null +++ b/include/SHiP/detectors/SBTHit.hpp @@ -0,0 +1,11 @@ +#pragma once +#include "SHiP/RecHit.hpp" + +namespace SHiP { + +/// Hit reconstructed by the SBT (Surround Background Tagger) +struct SBTHit{ + RecHit recHit; ///< The reconstructed hit +}; + +} // namespace SHiP diff --git a/include/SHiP/detectors/StrawTubesHit.hpp b/include/SHiP/detectors/StrawTubesHit.hpp new file mode 100644 index 0000000..db4282c --- /dev/null +++ b/include/SHiP/detectors/StrawTubesHit.hpp @@ -0,0 +1,11 @@ +#pragma once +#include "SHiP/RecHit.hpp" + +namespace SHiP { + +/// Hit reconstructed by a layer of the straw tubes spectrometer +struct StrawTubesHit{ + RecHit recHit; ///< The reconstructed hit +}; + +} // namespace SHiP diff --git a/include/SHiP/detectors/TimeDetHit.hpp b/include/SHiP/detectors/TimeDetHit.hpp new file mode 100644 index 0000000..cfa3080 --- /dev/null +++ b/include/SHiP/detectors/TimeDetHit.hpp @@ -0,0 +1,11 @@ +#pragma once +#include "SHiP/RecHit.hpp" + +namespace SHiP { + +/// Hit reconstructed by the timing detector +struct TimeDetHit{ + RecHit recHit; ///< The reconstructed hit +}; + +} // namespace SHiP diff --git a/include/SHiP/detectors/UBTHit.hpp b/include/SHiP/detectors/UBTHit.hpp new file mode 100644 index 0000000..79792a4 --- /dev/null +++ b/include/SHiP/detectors/UBTHit.hpp @@ -0,0 +1,11 @@ +#pragma once +#include "SHiP/RecHit.hpp" + +namespace SHiP { + +/// Hit reconstructed by the UBT (Upstream Background Tagger) +struct UBTHit{ + RecHit recHit; ///< The reconstructed hit +}; + +} // namespace SHiP