From 2e3e84a0e4c3b42c479ba27471fbb30ef3ab2a84 Mon Sep 17 00:00:00 2001 From: Justin Stevens Date: Wed, 20 Mar 2024 11:59:36 -0400 Subject: [PATCH 1/2] use first hit for TOF time rather than energy weighted time, which produces long tail not observed in data. follow example from ST --- src/GlueXSensitiveDetectorFTOF.cc | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/src/GlueXSensitiveDetectorFTOF.cc b/src/GlueXSensitiveDetectorFTOF.cc index 9c50478..e0f9c67 100644 --- a/src/GlueXSensitiveDetectorFTOF.cc +++ b/src/GlueXSensitiveDetectorFTOF.cc @@ -263,9 +263,16 @@ G4bool GlueXSensitiveDetectorFTOF::ProcessHits(G4Step* step, if (merge_hit) { // sum the charge, do energy weighting of the time - hiter->t_ns = (hiter->dE_GeV * hiter->t_ns + - dEnorth/GeV * tnorth/ns) / - (hiter->dE_GeV += dEnorth/GeV); + //hiter->t_ns = (hiter->dE_GeV * hiter->t_ns + + // dEnorth/GeV * tnorth/ns) / + //(hiter->dE_GeV += dEnorth/GeV); + + // Use the time from the earlier hit but add the charge + hiter->dE_GeV += dEnorth/GeV; + if (hiter->t_ns*ns > tnorth) { + hiter->t_ns = tnorth/ns; + } + std::vector::reverse_iterator xiter; xiter = hiter->extra.rbegin(); if (trackID != xiter->track_ || fabs(tin/ns - xiter->t_ns) > 0.1) { @@ -327,9 +334,16 @@ G4bool GlueXSensitiveDetectorFTOF::ProcessHits(G4Step* step, } if (merge_hit) { // sum the charge, do energy weighting of the time - hiter->t_ns = (hiter->dE_GeV * hiter->t_ns + - dEsouth/GeV * tsouth/ns) / - (hiter->dE_GeV += dEsouth/GeV); + //hiter->t_ns = (hiter->dE_GeV * hiter->t_ns + + // dEsouth/GeV * tsouth/ns) / + //(hiter->dE_GeV += dEsouth/GeV); + + // Use the time from the earlier hit but add the charge + hiter->dE_GeV += dEsouth/GeV; + if (hiter->t_ns*ns > tsouth) { + hiter->t_ns = tsouth/ns; + } + std::vector::reverse_iterator xiter; xiter = hiter->extra.rbegin(); if (trackID != xiter->track_ || fabs(tin/ns - xiter->t_ns) > 0.1) { From a78ca55efb56a1b43b0c056e845878362c6a1caa Mon Sep 17 00:00:00 2001 From: Justin Stevens Date: Wed, 20 Mar 2024 20:52:02 -0400 Subject: [PATCH 2/2] use leading edge time for TOF, CTOF, PS and PSC instead of hit energy weighted time --- src/GlueXSensitiveDetectorCTOF.cc | 17 ++++++++++------- src/GlueXSensitiveDetectorFTOF.cc | 10 ---------- src/GlueXSensitiveDetectorPS.cc | 9 +++++---- src/GlueXSensitiveDetectorPSC.cc | 9 +++++---- 4 files changed, 20 insertions(+), 25 deletions(-) diff --git a/src/GlueXSensitiveDetectorCTOF.cc b/src/GlueXSensitiveDetectorCTOF.cc index 09eade6..7a47ac2 100644 --- a/src/GlueXSensitiveDetectorCTOF.cc +++ b/src/GlueXSensitiveDetectorCTOF.cc @@ -233,9 +233,11 @@ G4bool GlueXSensitiveDetectorCTOF::ProcessHits(G4Step* step, } if (merge_hit) { - // sum the charge, do energy weighting of the time - hiter->t_ns = (hiter->dE_GeV * hiter->t_ns + dEtop/GeV * ttop/ns) / - (hiter->dE_GeV += dEtop/GeV); + // Use the time from the earlier hit but add the charge + hiter->dE_GeV += dEtop/GeV; + if (hiter->t_ns*ns > ttop) { + hiter->t_ns = ttop/ns; + } } else { // create new hit @@ -264,10 +266,11 @@ G4bool GlueXSensitiveDetectorCTOF::ProcessHits(G4Step* step, } } if (merge_hit) { - // sum the charge, do energy weighting of the time - hiter->t_ns = (hiter->dE_GeV * hiter->t_ns + - dEbottom/GeV * tbottom/ns) / - (hiter->dE_GeV += dEbottom/GeV); + // Use the time from the earlier hit but add the charge + hiter->dE_GeV += dEbottom/GeV; + if (hiter->t_ns*ns > tbottom) { + hiter->t_ns = tbottom/ns; + } } else { // create new hit diff --git a/src/GlueXSensitiveDetectorFTOF.cc b/src/GlueXSensitiveDetectorFTOF.cc index e0f9c67..238589a 100644 --- a/src/GlueXSensitiveDetectorFTOF.cc +++ b/src/GlueXSensitiveDetectorFTOF.cc @@ -262,11 +262,6 @@ G4bool GlueXSensitiveDetectorFTOF::ProcessHits(G4Step* step, } if (merge_hit) { - // sum the charge, do energy weighting of the time - //hiter->t_ns = (hiter->dE_GeV * hiter->t_ns + - // dEnorth/GeV * tnorth/ns) / - //(hiter->dE_GeV += dEnorth/GeV); - // Use the time from the earlier hit but add the charge hiter->dE_GeV += dEnorth/GeV; if (hiter->t_ns*ns > tnorth) { @@ -333,11 +328,6 @@ G4bool GlueXSensitiveDetectorFTOF::ProcessHits(G4Step* step, } } if (merge_hit) { - // sum the charge, do energy weighting of the time - //hiter->t_ns = (hiter->dE_GeV * hiter->t_ns + - // dEsouth/GeV * tsouth/ns) / - //(hiter->dE_GeV += dEsouth/GeV); - // Use the time from the earlier hit but add the charge hiter->dE_GeV += dEsouth/GeV; if (hiter->t_ns*ns > tsouth) { diff --git a/src/GlueXSensitiveDetectorPS.cc b/src/GlueXSensitiveDetectorPS.cc index 8b34c36..e231525 100644 --- a/src/GlueXSensitiveDetectorPS.cc +++ b/src/GlueXSensitiveDetectorPS.cc @@ -204,10 +204,11 @@ G4bool GlueXSensitiveDetectorPS::ProcessHits(G4Step* step, } } if (merge_hit) { - // Add the charge, do energy-weighted time averaging - hiter->t_ns = (hiter->t_ns * hiter->dE_GeV + t/ns * dEsum/GeV) / - (hiter->dE_GeV + dEsum/GeV); - hiter->dE_GeV += dEsum/GeV; + // Use the time from the earlier hit but add the charge + hiter->dE_GeV += dEsum/GeV; + if (hiter->t_ns*ns > t) { + hiter->t_ns = t/ns; + } } else { // create new hit diff --git a/src/GlueXSensitiveDetectorPSC.cc b/src/GlueXSensitiveDetectorPSC.cc index ffdbc85..2f4d47a 100644 --- a/src/GlueXSensitiveDetectorPSC.cc +++ b/src/GlueXSensitiveDetectorPSC.cc @@ -204,10 +204,11 @@ G4bool GlueXSensitiveDetectorPSC::ProcessHits(G4Step* step, } } if (merge_hit) { - // Add the charge, do energy-weighted time averaging - hiter->t_ns = (hiter->t_ns * hiter->dE_GeV + t/ns * dEsum/GeV) / - (hiter->dE_GeV + dEsum/GeV); - hiter->dE_GeV += dEsum/GeV; + // Use the time from the earlier hit but add the charge + hiter->dE_GeV += dEsum/GeV; + if (hiter->t_ns*ns > t) { + hiter->t_ns = t/ns; + } } else { // create new hit