From 9d522f35447a93df7bf136546f7c72f0394c400a Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Thu, 21 Mar 2024 20:52:52 -0400 Subject: [PATCH] * add comments to document the change in how leading edge pulse times * are calculated [rtj] --- src/GlueXSensitiveDetectorCTOF.cc | 27 +++++++++++------ src/GlueXSensitiveDetectorFTOF.cc | 48 +++++++++++++++++++------------ src/GlueXSensitiveDetectorPS.cc | 15 ++++++---- src/GlueXSensitiveDetectorPSC.cc | 15 ++++++---- 4 files changed, 67 insertions(+), 38 deletions(-) diff --git a/src/GlueXSensitiveDetectorCTOF.cc b/src/GlueXSensitiveDetectorCTOF.cc index 7a47ac2..b0b491f 100644 --- a/src/GlueXSensitiveDetectorCTOF.cc +++ b/src/GlueXSensitiveDetectorCTOF.cc @@ -233,11 +233,15 @@ G4bool GlueXSensitiveDetectorCTOF::ProcessHits(G4Step* step, } if (merge_hit) { - // 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; - } + // sum the charge, do energy weighting of the time --disabled for bad behavior --rtj + //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 @@ -266,11 +270,16 @@ G4bool GlueXSensitiveDetectorCTOF::ProcessHits(G4Step* step, } } if (merge_hit) { + // sum the charge, do energy weighting of the time --disabled for bad behavior --rtj + // 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; - } + 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 238589a..e35c957 100644 --- a/src/GlueXSensitiveDetectorFTOF.cc +++ b/src/GlueXSensitiveDetectorFTOF.cc @@ -222,22 +222,22 @@ G4bool GlueXSensitiveDetectorFTOF::ProcessHits(G4Step* step, // column=0 is a full bar, column=1,2 are half paddles if (plane == 0) { if (column == 1) { - tnorth = 0; - dEnorth = 0; + tnorth = 0; + dEnorth = 0; } - else if (column == 2) { - tsouth = 0; - dEsouth =0; + else if (column == 2) { + tsouth = 0; + dEsouth =0; } } else { if (column == 2) { - tnorth = 0; - dEnorth = 0; + tnorth = 0; + dEnorth = 0; } else if (column == 1) { - tsouth = 0; - dEsouth = 0; + tsouth = 0; + dEsouth = 0; } } @@ -262,11 +262,16 @@ G4bool GlueXSensitiveDetectorFTOF::ProcessHits(G4Step* step, } if (merge_hit) { - // 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; - } + // sum the charge, do energy weighting of the time --disabled for bad behavior, rtj-- + //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(); @@ -328,11 +333,16 @@ G4bool GlueXSensitiveDetectorFTOF::ProcessHits(G4Step* step, } } if (merge_hit) { - // 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; - } + // sum the charge, do energy weighting of the time --disabled for bad behavior, rtj-- + //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(); diff --git a/src/GlueXSensitiveDetectorPS.cc b/src/GlueXSensitiveDetectorPS.cc index e231525..d64b801 100644 --- a/src/GlueXSensitiveDetectorPS.cc +++ b/src/GlueXSensitiveDetectorPS.cc @@ -204,11 +204,16 @@ G4bool GlueXSensitiveDetectorPS::ProcessHits(G4Step* step, } } if (merge_hit) { - // 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; - } + // Add the charge, do energy-weighted time averaging --disabled for bad behavior --rtj + //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 2f4d47a..105e0dc 100644 --- a/src/GlueXSensitiveDetectorPSC.cc +++ b/src/GlueXSensitiveDetectorPSC.cc @@ -204,11 +204,16 @@ G4bool GlueXSensitiveDetectorPSC::ProcessHits(G4Step* step, } } if (merge_hit) { - // 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; - } + // Add the charge, do energy-weighted time averaging --disabled for bad behavior + //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