diff --git a/src/Root/CMakeLists.txt b/src/Root/CMakeLists.txt index abc3085..90073b1 100644 --- a/src/Root/CMakeLists.txt +++ b/src/Root/CMakeLists.txt @@ -1,12 +1,40 @@ set(HEADERS RootMathDense.h RootMuonScatter.h - RootHitRaw.h) + RootHitRaw.h + muCastorMCTrack.h + muCastorHit.h + muCastorInfo.h + muCastorSkinHit.h) -set(SOURCES ${HEADERS} RootMuonScatter.cpp) +set(SOURCES ${HEADERS} RootMuonScatter.cpp + muCastorMCTrack.cpp + muCastorHit.cpp + muCastorInfo.cpp + muCastorSkinHit.cpp) + +set(DICTIONARY_HEADERS muCastorMCTrack.h + muCastorHit.h + muCastorInfo.h + muCastorSkinHit.h) set(LIBRARIES ${ROOT_LIBRARIES} ${PACKAGE_LIBPREFIX}Math) +set(rDictName ${PACKAGE_LIBPREFIX}RootDict) +root_generate_dictionary(${rDictName} ${DICTIONARY_HEADERS} + LINKDEF Linkdef.h) +set_source_files_properties(${rDictName}.cxx + PROPERTIES GENERATED TRUE) +set_source_files_properties(${rDictName}.h + PROPERTIES GENERATED TRUE) +list(APPEND SOURCES ${rDictName}.cxx) + +# TODO use a custom target linked to root_generate_dictionary +set(R_ARTIFACTS ${CMAKE_CURRENT_BINARY_DIR}/lib${rDictName}_rdict.pcm + ${CMAKE_CURRENT_BINARY_DIR}/lib${rDictName}.rootmap) +install(FILES ${R_ARTIFACTS} + DESTINATION ${PACKAGE_INSTALL_LIB_DIR}) + set(libname ${PACKAGE_LIBPREFIX}Root) set(ULIB_SHARED_LIBRARIES ${ULIB_SHARED_LIBRARIES} ${libname} PARENT_SCOPE) set(ULIB_SELECTED_MODULES ${ULIB_SELECTED_MODULES} Root PARENT_SCOPE) diff --git a/src/Root/Linkdef.h b/src/Root/Linkdef.h index 473df4e..efe4969 100644 --- a/src/Root/Linkdef.h +++ b/src/Root/Linkdef.h @@ -79,6 +79,7 @@ using namespace ROOT::Mutom; #pragma link C++ class muCastorMCTrack+; #pragma link C++ class muCastorHit+; #pragma link C++ class muCastorInfo+; +#pragma link C++ class muCastorSkinHit+; #endif // __CINT__ diff --git a/src/Root/muCastorSkinHit.cpp b/src/Root/muCastorSkinHit.cpp new file mode 100644 index 0000000..a10079c --- /dev/null +++ b/src/Root/muCastorSkinHit.cpp @@ -0,0 +1,43 @@ +//---------------------------------------------------------- +// Class : CastorSkinHit +// Date: October 2020 +// Author: Germano Bonomi germano.bonomi@unibs.it +//---------------------------------------------------------- + +#include + +#include "muCastorSkinHit.h" + +/// \cond CLASSIMP +ClassImp(muCastorSkinHit) +/// \endcond + +using namespace std; + +//_____________________________________________________________________________ +muCastorSkinHit::muCastorSkinHit() : + fDetID(-1), + fPdgCode(-1), + fMotherID(-1), + fMomX(0.), + fMomY(0.), + fMomZ(0.), + fPosX(0.), + fPosY(0.), + fPosZ(0.) +{} + +//_____________________________________________________________________________ +muCastorSkinHit::~muCastorSkinHit() +{} +//_____________________________________________________________________________ +void muCastorSkinHit::Print(const Option_t* /*opt*/) const +{ + cout << " detID: " << fDetID + << " position (cm): (" + << fPosX << ", " << fPosY << ", " << fPosZ << ")" + << " momentum (MeV/c): (" + << fMomX << ", " << fMomY << ", " << fMomZ << ")" + << endl; +} + diff --git a/src/Root/muCastorSkinHit.h b/src/Root/muCastorSkinHit.h new file mode 100644 index 0000000..a81e4a4 --- /dev/null +++ b/src/Root/muCastorSkinHit.h @@ -0,0 +1,46 @@ +//---------------------------------------------------------- +// Class : CastorSkinHit +// Date: October 2020 +// Author: Germano Bonomi germano.bonomi@unibs.it +//---------------------------------------------------------- + +#ifndef muCastor_SKINHIT_H +#define muCastor_SKINHIT_H + + +#include +#include + +class muCastorSkinHit : public TObject +{ +public: + muCastorSkinHit(); + virtual ~muCastorSkinHit(); + + // methods + virtual void Print(const Option_t* option = "") const; + + // set methods + void SetDetID(Int_t id) { fDetID = id; }; + void SetPdgCode(Int_t pdg) { fPdgCode = pdg; }; + void SetMotherID(Int_t mid) { fMotherID = mid; }; + void SetMom(TVector3 xyz) { fMomX = xyz.X(); fMomY = xyz.Y(); fMomZ = xyz.Z(); }; + void SetPos(TVector3 xyz) { fPosX = xyz.X(); fPosY = xyz.Y(); fPosZ = xyz.Z(); }; + +private: + Int_t fDetID; // Detector module ID + Int_t fPdgCode; // Particle PDG Code + Int_t fMotherID; // Particle mother ID (-1 = primary, 0 = secondary, etc..) + Double_t fMomX; // Track momentum when releasing the hit (X) + Double_t fMomY; // Track momentum when releasing the hit (Y) + Double_t fMomZ; // Track momentum when releasing the hit (Z) + Double_t fPosX; // Hit coordinates (at the entrance of the detector) (X) + Double_t fPosY; // Hit coordinates (at the entrance of the detector) (Y) + Double_t fPosZ; // Hit coordinates (at the entrance of the detector) (Z) + + ClassDef(muCastorSkinHit,1) //muCastorSkinHit +}; + +#endif //muCastort_SKINHIT_H + +