diff --git a/Simulation/DetSimInterface/CMakeLists.txt b/Simulation/DetSimInterface/CMakeLists.txt index b5fd14616a4bf34b98f3d4545d6c398954423bda..21963df1a8e0fd3289849181995d25908f69641e 100644 --- a/Simulation/DetSimInterface/CMakeLists.txt +++ b/Simulation/DetSimInterface/CMakeLists.txt @@ -5,6 +5,7 @@ gaudi_add_library(DetSimInterface SOURCES src/IDetSimSvc.cpp src/CommonUserEventInfo.cc + src/CommonUserTrackInfo.cc LINK Gaudi::GaudiKernel ${Geant4_LIBRARIES} ) diff --git a/Simulation/DetSimInterface/include/DetSimInterface/CommonUserTrackInfo.hh b/Simulation/DetSimInterface/include/DetSimInterface/CommonUserTrackInfo.hh new file mode 100644 index 0000000000000000000000000000000000000000..ce63e602d26267dd87465406d454c7d558eb83ad --- /dev/null +++ b/Simulation/DetSimInterface/include/DetSimInterface/CommonUserTrackInfo.hh @@ -0,0 +1,35 @@ +#ifndef CommonUserTrackInfo_hh +#define CommonUserTrackInfo_hh + +/* Description: + * This class is a part of simulation framework to extend the G4Track. + * + * Some secondaries are created due to decay. However, their G4 Track IDs are + * not valid until the tracks are tracking by geant4. In order to associate + * these tracks and their edm4hep MC particle, we use the track information + * to record the extra track information. + * + * Author: + * Tao Lin <lintao AT ihep.ac.cn> + */ + +#include "G4VUserTrackInformation.hh" + +class CommonUserTrackInfo: public G4VUserTrackInformation { +public: + CommonUserTrackInfo(); + ~CommonUserTrackInfo(); + +public: + + virtual void Print() const; + + // get the idx in the EDM4hep MC particle collection + bool setIdxEdm4hep(int idxEdm4hep); + int idxEdm4hep() const; + +private: + int m_idxEdm4hep = -1; +}; + +#endif diff --git a/Simulation/DetSimInterface/src/CommonUserTrackInfo.cc b/Simulation/DetSimInterface/src/CommonUserTrackInfo.cc new file mode 100644 index 0000000000000000000000000000000000000000..9a923a35a22e7fafe496c827e066e591864f3c50 --- /dev/null +++ b/Simulation/DetSimInterface/src/CommonUserTrackInfo.cc @@ -0,0 +1,22 @@ +#include "DetSimInterface/CommonUserTrackInfo.hh" +#include <iostream> + +CommonUserTrackInfo::CommonUserTrackInfo() { + +} + +CommonUserTrackInfo::~CommonUserTrackInfo() { + +} + +void CommonUserTrackInfo::Print() const { + +} + +bool CommonUserTrackInfo::setIdxEdm4hep(int idxEdm4hep) { + m_idxEdm4hep = idxEdm4hep; +} + +int CommonUserTrackInfo::idxEdm4hep() const { + return m_idxEdm4hep; +}