diff --git a/Simulation/Tools/McEventCollectionFilter/src/CSC_HitsTruthRelink.cxx b/Simulation/Tools/McEventCollectionFilter/src/CSC_HitsTruthRelink.cxx index 5368f310d4c20537d9245e6e4b7c92e73ee7a926..d49eed3810f983760579810cec46163d36a73b39 100644 --- a/Simulation/Tools/McEventCollectionFilter/src/CSC_HitsTruthRelink.cxx +++ b/Simulation/Tools/McEventCollectionFilter/src/CSC_HitsTruthRelink.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #include "CSC_HitsTruthRelink.h" @@ -44,18 +44,11 @@ StatusCode CSC_HitsTruthRelink::execute(const EventContext &ctx) const ATH_MSG_DEBUG("Recorded output hits collection " << outputCollection.name() << " in store " << outputCollection.store()); // Do relinking - int referenceBarcode{}; - ATH_CHECK(getReferenceBarcode(ctx, &referenceBarcode)); // FIXME + int referenceId{}; + ATH_CHECK(getReferenceId(ctx, &referenceId)); for (const CSCSimHit &hit : *inputCollection) { - const HepMcParticleLink& oldLink = hit.particleLink(); - - int currentBarcode{}; - if (oldLink.barcode() != 0) { - currentBarcode = referenceBarcode; - } - - HepMcParticleLink particleLink(currentBarcode, oldLink.eventIndex(), HepMcParticleLink::IS_EVENTNUM, HepMcParticleLink::IS_BARCODE, ctx); // FIXME + HepMcParticleLink particleLink = updatedLink(ctx, hit.particleLink(), referenceId); int id = hit.CSCid(); double time = hit.globalTime(); double energyDeposit = hit.energyDeposit(); diff --git a/Simulation/Tools/McEventCollectionFilter/src/HitsTruthRelinkBase.cxx b/Simulation/Tools/McEventCollectionFilter/src/HitsTruthRelinkBase.cxx index 69deef5d7ac7335c2e53ff0ec36915b39b42a1df..bc47555661dec460b01c0cf414844427cbf611b8 100644 --- a/Simulation/Tools/McEventCollectionFilter/src/HitsTruthRelinkBase.cxx +++ b/Simulation/Tools/McEventCollectionFilter/src/HitsTruthRelinkBase.cxx @@ -1,9 +1,9 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #include "HitsTruthRelinkBase.h" - +#include "TruthUtils/MagicNumbers.h" HitsTruthRelinkBase::HitsTruthRelinkBase(const std::string &name, ISvcLocator *pSvcLocator) : AthReentrantAlgorithm(name, pSvcLocator) @@ -63,3 +63,62 @@ StatusCode HitsTruthRelinkBase::getReferenceBarcode(const EventContext &ctx, int return StatusCode::SUCCESS; } + + +StatusCode HitsTruthRelinkBase::getReferenceId(const EventContext &ctx, int *id) const +{ + SG::ReadHandle<McEventCollection> inputCollection(m_inputTruthCollectionKey, ctx); + if (!inputCollection.isValid()) { + ATH_MSG_ERROR("Could not get input truth collection " << inputCollection.name() << " from store " << inputCollection.store()); + return StatusCode::FAILURE; + } + ATH_MSG_DEBUG("Found input truth collection " << inputCollection.name() << " in store " << inputCollection.store()); + int barcode{0}; + const HepMC::GenEvent *genEvt = *(inputCollection->begin()); +#ifdef HEPMC3 + size_t nVertices = genEvt->vertices().size(); + if (nVertices == 0) { + ATH_MSG_ERROR("Truth collection should have at least one vertex!"); + return StatusCode::FAILURE; + } + const HepMC::ConstGenVertexPtr& genVtx = genEvt->vertices().back(); + size_t nParticles = genVtx->particles_out().size(); + if (nParticles == 0) { + ATH_MSG_ERROR("Truth vertex should have at least one particle!"); + return StatusCode::FAILURE; + } + *id = HepMC::uniqueID(genVtx->particles_out().front()); + barcode = HepMC::barcode(genVtx->particles_out().front()); +#else + size_t nVertices = genEvt->vertices_size(); + if (nVertices == 0) { + ATH_MSG_ERROR("Truth collection should have at least one vertex!"); + return StatusCode::FAILURE; + } + auto genVtx = *(genEvt->vertices_end()); + size_t nParticles = genVtx->particles_out_size(); + if (nParticles == 0) { + ATH_MSG_ERROR("Truth vertex should have at least one particle!"); + return StatusCode::FAILURE; + } + *id = HepMC::uniqueID(*(genVtx->particles_out_const_begin())); + barcode = HepMC::barcode(*(genVtx->particles_out_const_begin())); +#endif + + ATH_MSG_DEBUG("Reference id: " << *id); + ATH_MSG_DEBUG("Reference barcode: " << barcode); + + return StatusCode::SUCCESS; + +} + +HepMcParticleLink HitsTruthRelinkBase::updatedLink(const EventContext &ctx, const HepMcParticleLink& oldLink, int referenceId, int /*pdgId*/) const { + ATH_MSG_DEBUG ("oldLink.id() = " << oldLink.id()); + int currentId{}; + // Hits previously linked to truth particles should now be linked to the reference truthParticle + if (oldLink.id() != 0 || oldLink.barcode() !=0) { // FIXME barcode-based for now to work around reading in HepMcParticleLink_p2 based EDM + currentId = referenceId; + } + // TODO test using the ConstGenParticlePtr directly in the HepMcParticleLink constructor + return HepMcParticleLink(currentId, oldLink.eventIndex(), HepMcParticleLink::IS_EVENTNUM, HepMcParticleLink::IS_ID, ctx); +} diff --git a/Simulation/Tools/McEventCollectionFilter/src/HitsTruthRelinkBase.h b/Simulation/Tools/McEventCollectionFilter/src/HitsTruthRelinkBase.h index b6fa45d6fcba79df7a870a5c44e9e3e3ff03aa02..5c7a6943a291e943fa77ce30109c0fda9c936f18 100644 --- a/Simulation/Tools/McEventCollectionFilter/src/HitsTruthRelinkBase.h +++ b/Simulation/Tools/McEventCollectionFilter/src/HitsTruthRelinkBase.h @@ -1,13 +1,14 @@ /* - Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ -#ifndef HITSTRUTHRELINKBASE_H -#define HITSTRUTHRELINKBASE_H +#ifndef MCEVENTCOLLECTIONFILTER_HITSTRUTHRELINKBASE_H +#define MCEVENTCOLLECTIONFILTER_HITSTRUTHRELINKBASE_H // Base class include #include <AthenaBaseComps/AthReentrantAlgorithm.h> #include <GeneratorObjects/McEventCollection.h> +#include <GeneratorObjects/HepMcParticleLink.h> class HitsTruthRelinkBase : public AthReentrantAlgorithm @@ -19,8 +20,10 @@ public: protected: StatusCode getReferenceBarcode(const EventContext &ctx, int *barcode) const; + StatusCode getReferenceId(const EventContext &ctx, int *id) const; + virtual HepMcParticleLink updatedLink(const EventContext &ctx, const HepMcParticleLink& oldLink, int referenceId, int pdgID=0) const; SG::ReadHandleKey<McEventCollection> m_inputTruthCollectionKey {this, "InputTruthCollection", "TruthEvent", "Input truth collection name"}; }; -#endif +#endif // MCEVENTCOLLECTIONFILTER_HITSTRUTHRELINKBASE_H diff --git a/Simulation/Tools/McEventCollectionFilter/src/MDT_HitsTruthRelink.cxx b/Simulation/Tools/McEventCollectionFilter/src/MDT_HitsTruthRelink.cxx index a0d28016511832382587d716040c026889a46669..ebbce9cb31e174e36548f2156942b60043a921df 100644 --- a/Simulation/Tools/McEventCollectionFilter/src/MDT_HitsTruthRelink.cxx +++ b/Simulation/Tools/McEventCollectionFilter/src/MDT_HitsTruthRelink.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #include "MDT_HitsTruthRelink.h" @@ -44,18 +44,11 @@ StatusCode MDT_HitsTruthRelink::execute(const EventContext &ctx) const ATH_MSG_DEBUG("Recorded output hits collection " << outputCollection.name() << " in store " << outputCollection.store()); // Do relinking - int referenceBarcode{}; - ATH_CHECK(getReferenceBarcode(ctx, &referenceBarcode)); // FIXME + int referenceId{}; + ATH_CHECK(getReferenceId(ctx, &referenceId)); for (const MDTSimHit &hit : *inputCollection) { - const HepMcParticleLink& oldLink = hit.particleLink(); - - int currentBarcode{}; - if (oldLink.barcode() != 0) { - currentBarcode = referenceBarcode; - } - - HepMcParticleLink particleLink(currentBarcode, oldLink.eventIndex(), HepMcParticleLink::IS_EVENTNUM, HepMcParticleLink::IS_BARCODE, ctx); // FIXME + HepMcParticleLink particleLink = updatedLink(ctx, hit.particleLink(), referenceId); int id = hit.MDTid(); double time = hit.globalTime(); double radius = hit.driftRadius(); diff --git a/Simulation/Tools/McEventCollectionFilter/src/MM_HitsTruthRelink.cxx b/Simulation/Tools/McEventCollectionFilter/src/MM_HitsTruthRelink.cxx index 8761a7e01c9c5dd12f3f891ee52adb8d2cc7de7f..fa7aed282d8149c8fdf6da785ba4e1c8652918b6 100644 --- a/Simulation/Tools/McEventCollectionFilter/src/MM_HitsTruthRelink.cxx +++ b/Simulation/Tools/McEventCollectionFilter/src/MM_HitsTruthRelink.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #include "MM_HitsTruthRelink.h" @@ -44,19 +44,11 @@ StatusCode MM_HitsTruthRelink::execute(const EventContext &ctx) const ATH_MSG_DEBUG("Recorded output hits collection " << outputCollection.name() << " in store " << outputCollection.store()); // Do relinking - int referenceBarcode{}; - ATH_CHECK(getReferenceBarcode(ctx, &referenceBarcode)); // FIXME + int referenceId{}; + ATH_CHECK(getReferenceId(ctx, &referenceId)); for (const MMSimHit &hit : *inputCollection) { - const HepMcParticleLink& oldLink = hit.particleLink(); - - int currentBarcode{}; - if (oldLink.barcode() != 0) { - currentBarcode = referenceBarcode; - } - - HepMcParticleLink particleLink(currentBarcode, oldLink.eventIndex(), HepMcParticleLink::IS_EVENTNUM, HepMcParticleLink::IS_BARCODE, ctx); // FIXME - + HepMcParticleLink particleLink = updatedLink(ctx, hit.particleLink(), referenceId); int id = hit.MMId(); double time = hit.globalTime(); Amg::Vector3D position = hit.globalPosition(); diff --git a/Simulation/Tools/McEventCollectionFilter/src/RPC_HitsTruthRelink.cxx b/Simulation/Tools/McEventCollectionFilter/src/RPC_HitsTruthRelink.cxx index 6c3e090e396701ab6f20c24adf69e7bc1706d0ef..34ea982b5a86a01fbba42f57c7abdf56dca7f380 100644 --- a/Simulation/Tools/McEventCollectionFilter/src/RPC_HitsTruthRelink.cxx +++ b/Simulation/Tools/McEventCollectionFilter/src/RPC_HitsTruthRelink.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #include "RPC_HitsTruthRelink.h" @@ -44,18 +44,11 @@ StatusCode RPC_HitsTruthRelink::execute(const EventContext &ctx) const ATH_MSG_DEBUG("Recorded output hits collection " << outputCollection.name() << " in store " << outputCollection.store()); // Do relinking - int referenceBarcode{}; - ATH_CHECK(getReferenceBarcode(ctx, &referenceBarcode)); // FIXME + int referenceId{}; + ATH_CHECK(getReferenceId(ctx, &referenceId)); for (const RPCSimHit & hit : *inputCollection) { - const HepMcParticleLink& oldLink = hit.particleLink(); - - int currentBarcode{}; - if (oldLink.barcode() != 0) { - currentBarcode = referenceBarcode; - } - - HepMcParticleLink particleLink(currentBarcode, oldLink.eventIndex(), HepMcParticleLink::IS_EVENTNUM, HepMcParticleLink::IS_BARCODE, ctx); // FIXME + HepMcParticleLink particleLink = updatedLink(ctx, hit.particleLink(), referenceId); int id = hit.RPCid(); double time = hit.globalTime(); Amg::Vector3D prePos = hit.preLocalPosition(); diff --git a/Simulation/Tools/McEventCollectionFilter/src/SiliconHitsTruthRelink.cxx b/Simulation/Tools/McEventCollectionFilter/src/SiliconHitsTruthRelink.cxx index b96fb71189e5f48688d7c25951ecf586c3293aad..648353ba216cdf2a8238a1e1a0dfab04c9a826cb 100644 --- a/Simulation/Tools/McEventCollectionFilter/src/SiliconHitsTruthRelink.cxx +++ b/Simulation/Tools/McEventCollectionFilter/src/SiliconHitsTruthRelink.cxx @@ -44,23 +44,16 @@ StatusCode SiliconHitsTruthRelink::execute(const EventContext &ctx) const ATH_MSG_DEBUG("Recorded output hits collection " << outputCollection.name() << " in store " << outputCollection.store()); // Do relinking - int referenceBarcode{}; - ATH_CHECK(getReferenceBarcode(ctx, &referenceBarcode)); // FIXME + int referenceId{}; + ATH_CHECK(getReferenceId(ctx, &referenceId)); for (const SiHit &hit : *inputCollection) { - const HepMcParticleLink& oldLink = hit.particleLink(); - + HepMcParticleLink particleLink = updatedLink(ctx, hit.particleLink(), referenceId); HepGeom::Point3D<double> lP1 = hit.localStartPosition(); HepGeom::Point3D<double> lP2 = hit.localEndPosition(); double energyLoss = hit.energyLoss(); double meanTime = hit.meanTime(); unsigned int id = hit.identify(); - - int currentBarcode{}; - if (oldLink.barcode() != 0) { - currentBarcode = referenceBarcode; - } - HepMcParticleLink particleLink(currentBarcode, oldLink.eventIndex(), HepMcParticleLink::IS_EVENTNUM, HepMcParticleLink::IS_BARCODE, ctx); // FIXME outputCollection->Emplace(lP1, lP2, energyLoss, meanTime, particleLink, id); } diff --git a/Simulation/Tools/McEventCollectionFilter/src/TGC_HitsTruthRelink.cxx b/Simulation/Tools/McEventCollectionFilter/src/TGC_HitsTruthRelink.cxx index 028dd71a289ed57c8a12ec1ea6426d1e360eb72c..1e8f969b738828014d1c69286ece088d073f9b38 100644 --- a/Simulation/Tools/McEventCollectionFilter/src/TGC_HitsTruthRelink.cxx +++ b/Simulation/Tools/McEventCollectionFilter/src/TGC_HitsTruthRelink.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #include "TGC_HitsTruthRelink.h" @@ -44,19 +44,11 @@ StatusCode TGC_HitsTruthRelink::execute(const EventContext &ctx) const ATH_MSG_DEBUG("Recorded output hits collection " << outputCollection.name() << " in store " << outputCollection.store()); // Do relinking - int referenceBarcode{}; - ATH_CHECK(getReferenceBarcode(ctx, &referenceBarcode)); // FIXME + int referenceId{}; + ATH_CHECK(getReferenceId(ctx, &referenceId)); for (const TGCSimHit &hit : *inputCollection) { - const HepMcParticleLink& oldLink = hit.particleLink(); - - int currentBarcode{}; - if (oldLink.barcode() != 0) { - currentBarcode = referenceBarcode; - } - - HepMcParticleLink particleLink(currentBarcode, oldLink.eventIndex(), HepMcParticleLink::IS_EVENTNUM, HepMcParticleLink::IS_BARCODE, ctx); // FIXME - + HepMcParticleLink particleLink = updatedLink(ctx, hit.particleLink(), referenceId); int id = hit.TGCid(); double time = hit.globalTime(); Amg::Vector3D position = hit.localPosition(); diff --git a/Simulation/Tools/McEventCollectionFilter/src/TRT_HitsTruthRelink.cxx b/Simulation/Tools/McEventCollectionFilter/src/TRT_HitsTruthRelink.cxx index fe9b082144cb20b2c58c1467d7f41bb595b25643..376da99266f839d4a0157c1886a8105c76ae9057 100644 --- a/Simulation/Tools/McEventCollectionFilter/src/TRT_HitsTruthRelink.cxx +++ b/Simulation/Tools/McEventCollectionFilter/src/TRT_HitsTruthRelink.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #include "TRT_HitsTruthRelink.h" @@ -44,21 +44,12 @@ StatusCode TRT_HitsTruthRelink::execute(const EventContext &ctx) const ATH_MSG_DEBUG("Recorded output hits collection " << outputCollection.name() << " in store " << outputCollection.store()); // Do relinking - int referenceBarcode{}; - ATH_CHECK(getReferenceBarcode(ctx, &referenceBarcode)); // FIXME + int referenceId{}; + ATH_CHECK(getReferenceId(ctx, &referenceId)); for (const TRTUncompressedHit &hit : *inputCollection) { - const HepMcParticleLink& oldLink = hit.particleLink(); - int pdgID = hit.GetParticleEncoding(); - int currentBarcode = oldLink.barcode(); - if (currentBarcode != 0) { - if (!(m_keepElectronsLinkedToTRTHits && std::abs(pdgID) == 11)) { - currentBarcode = referenceBarcode; - } - } - - HepMcParticleLink particleLink(currentBarcode, oldLink.eventIndex(), HepMcParticleLink::IS_EVENTNUM, HepMcParticleLink::IS_BARCODE, ctx); // FIXME + HepMcParticleLink particleLink = updatedLink(ctx, hit.particleLink(), referenceId, pdgID); int id = hit.GetHitID(); float kineticEnergy = hit.GetKineticEnergy(); float energyDeposit = hit.GetEnergyDeposit(); @@ -75,3 +66,18 @@ StatusCode TRT_HitsTruthRelink::execute(const EventContext &ctx) const return StatusCode::SUCCESS; } + + +HepMcParticleLink TRT_HitsTruthRelink::updatedLink(const EventContext &ctx, const HepMcParticleLink& oldLink, int referenceId, int pdgId) const { + ATH_MSG_DEBUG ("oldLink.id() = " << oldLink.id()); + int currentId = oldLink.id(); + // Hits previously linked to truth particles should now be linked to the reference truthParticle + if (oldLink.id() != 0 || oldLink.barcode() !=0) { // FIXME barcode-based for now to work around reading in HepMcParticleLink_p2 based EDM + // For the TRT truth electrons may optionally be kept + if (!(m_keepElectronsLinkedToTRTHits && std::abs(pdgId) == 11)) { + currentId = referenceId; + } + } + + return HepMcParticleLink(currentId, oldLink.eventIndex(), HepMcParticleLink::IS_EVENTNUM, HepMcParticleLink::IS_ID, ctx); +} diff --git a/Simulation/Tools/McEventCollectionFilter/src/TRT_HitsTruthRelink.h b/Simulation/Tools/McEventCollectionFilter/src/TRT_HitsTruthRelink.h index 72106a35ee16cae6ee2f498473f4842d885a098c..18a57245ab738ee9c94b1e07f5ef53e840d95ce8 100644 --- a/Simulation/Tools/McEventCollectionFilter/src/TRT_HitsTruthRelink.h +++ b/Simulation/Tools/McEventCollectionFilter/src/TRT_HitsTruthRelink.h @@ -1,9 +1,9 @@ /* - Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ -#ifndef TRTHITSTRUTHRELINK_H -#define TRTHITSTRUTHRELINK_H +#ifndef MCEVENTCOLLECTIONFILTER_TRTHITSTRUTHRELINK_H +#define MCEVENTCOLLECTIONFILTER_TRTHITSTRUTHRELINK_H // Base class include #include "HitsTruthRelinkBase.h" @@ -11,19 +11,19 @@ #include <InDetSimEvent/TRTUncompressedHitCollection.h> -class TRT_HitsTruthRelink : public HitsTruthRelinkBase +class TRT_HitsTruthRelink final : public HitsTruthRelinkBase { public: TRT_HitsTruthRelink(const std::string &name, ISvcLocator *pSvcLocator); virtual StatusCode initialize() override; virtual StatusCode execute(const EventContext &ctx) const override; - private: + virtual HepMcParticleLink updatedLink(const EventContext &ctx, const HepMcParticleLink& oldLink, int referenceId, int pdgID=0) const override final; SG::ReadHandleKey<TRTUncompressedHitCollection> m_inputHitsKey {this, "InputHits", "TRTUncompressedHitsOLD", "Input TRT hits name"}; SG::WriteHandleKey<TRTUncompressedHitCollection> m_outputHitsKey {this, "OutputHits", "TRTUncompressedHits", "Output TRT hits name"}; Gaudi::Property<bool> m_keepElectronsLinkedToTRTHits {this, "KeepElectronsLinkedToTRTHits", false, "Keep electrons linked to TRT hits"}; }; -#endif +#endif // MCEVENTCOLLECTIONFILTER_TRTHITSTRUTHRELINK_H diff --git a/Simulation/Tools/McEventCollectionFilter/src/sTGC_HitsTruthRelink.cxx b/Simulation/Tools/McEventCollectionFilter/src/sTGC_HitsTruthRelink.cxx index 93d14a9c3ac9b80c42acde5e085fb85f86019290..2ffbb3546e9b117fd6716d172032a4801a93a9c8 100644 --- a/Simulation/Tools/McEventCollectionFilter/src/sTGC_HitsTruthRelink.cxx +++ b/Simulation/Tools/McEventCollectionFilter/src/sTGC_HitsTruthRelink.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #include "sTGC_HitsTruthRelink.h" @@ -44,19 +44,11 @@ StatusCode sTGC_HitsTruthRelink::execute(const EventContext &ctx) const ATH_MSG_DEBUG("Recorded output hits collection " << outputCollection.name() << " in store " << outputCollection.store()); // Do relinking - int referenceBarcode{}; - ATH_CHECK(getReferenceBarcode(ctx, &referenceBarcode)); // FIXME + int referenceId{}; + ATH_CHECK(getReferenceId(ctx, &referenceId)); for (const sTGCSimHit &hit : *inputCollection) { - const HepMcParticleLink& oldLink = hit.particleLink(); - - int currentBarcode{}; - if (oldLink.barcode() != 0) { - currentBarcode = referenceBarcode; - } - - HepMcParticleLink particleLink(currentBarcode, oldLink.eventIndex(), HepMcParticleLink::IS_EVENTNUM, HepMcParticleLink::IS_BARCODE, ctx); // FIXME - + HepMcParticleLink particleLink = updatedLink(ctx, hit.particleLink(), referenceId); int id = hit.sTGCId(); double time = hit.globalTime(); Amg::Vector3D position = hit.globalPosition();