From 365a585cee15e8806170c2f0af1a2ed7a3660668 Mon Sep 17 00:00:00 2001 From: David Nathan Brown Date: Thu, 7 Mar 2024 19:54:55 -0800 Subject: [PATCH] Minor tweaks to updaters --- Mu2eKinKal/fcl/prolog.fcl | 6 +++--- Mu2eKinKal/inc/KKStrawHit.hh | 2 +- Mu2eKinKal/src/BkgANNSHU.cc | 15 +++++++++------ Mu2eKinKal/src/CADSHU.cc | 4 +++- Mu2eKinKal/src/DriftANNSHU.cc | 9 ++++++--- Mu2eKinKal/src/WireHitState.cc | 1 + 6 files changed, 23 insertions(+), 14 deletions(-) diff --git a/Mu2eKinKal/fcl/prolog.fcl b/Mu2eKinKal/fcl/prolog.fcl index 377322e93c..2669451bc6 100644 --- a/Mu2eKinKal/fcl/prolog.fcl +++ b/Mu2eKinKal/fcl/prolog.fcl @@ -219,7 +219,7 @@ Mu2eKinKal : { [ 0.0, "CADSHU:DriftANNSHU" ], [ 0.0, "CADSHU:DriftANNSHU" ], [ 0.0, "CADSHU:DriftANNSHU" ], - [ 0.0, "CADSHU:DriftANNSHU:BkgANNSHU" ], + [ 0.0, "CADSHU:BkgANNSHU:DriftANNSHU" ], [ 0.0, "CADSHU:DriftANNSHU" ] ] CADSHUSettings : [ @@ -236,8 +236,8 @@ Mu2eKinKal : { ] BkgANNSHUSettings : [ - [ "Offline/Mu2eKinKal/data/TrainBkgSeed.dat",0.1,"Inactive", 1], - [ "Offline/Mu2eKinKal/data/TrainBkgFinal.dat",0.1,"Inactive", 1] + [ "Offline/Mu2eKinKal/data/TrainBkgSeed.dat",0.2,"Inactive", 1], + [ "Offline/Mu2eKinKal/data/TrainBkgFinal.dat",0.2,"Inactive", 1] ] DriftANNSHUSettings : [ diff --git a/Mu2eKinKal/inc/KKStrawHit.hh b/Mu2eKinKal/inc/KKStrawHit.hh index 4b038d4518..f44cc35255 100644 --- a/Mu2eKinKal/inc/KKStrawHit.hh +++ b/Mu2eKinKal/inc/KKStrawHit.hh @@ -148,8 +148,8 @@ namespace mu2e { if(ca.usable()){ auto dinfo = fillDriftInfo(); // there can be multiple updaters: apply them all - if(bkgshu)whstate_ = bkgshu->wireHitState(whstate_,ca.tpData(),dinfo,chit_); if(cashu)whstate_ = cashu->wireHitState(whstate_,ca.tpData(),dinfo); + if(bkgshu)whstate_ = bkgshu->wireHitState(whstate_,ca.tpData(),dinfo,chit_); if(driftshu)whstate_ = driftshu->wireHitState(whstate_,ca.tpData(),dinfo,chit_); if(whstate_.driftConstraint()){ dVar_ = dinfo.driftHitVar(); diff --git a/Mu2eKinKal/src/BkgANNSHU.cc b/Mu2eKinKal/src/BkgANNSHU.cc index 37c277ddc6..6bdf1d68c7 100644 --- a/Mu2eKinKal/src/BkgANNSHU.cc +++ b/Mu2eKinKal/src/BkgANNSHU.cc @@ -17,7 +17,7 @@ namespace mu2e { std::string freeze = std::get<2>(config); diag_ = std::get<3>(config); freeze_ = WHSMask(freeze); - if(diag_ > 0)std::cout << "BkgANNSHU weights " << std::get<0>(config) << " cut " << mvacut_ << " freeze " << freeze_ << std::endl; + if(diag_ > 0)std::cout << "BkgANNSHU weights " << std::get<0>(config) << " cut " << mvacut_ << " freezing " << freeze_ << std::endl; } WireHitState BkgANNSHU::wireHitState(WireHitState const& input, ClosestApproachData const& tpdata, DriftInfo const& dinfo, ComboHit const& chit) const { @@ -37,14 +37,17 @@ namespace mu2e { pars[5] = tpdata.particlePoca().Vect().Rho(); auto mvaout = mva_->infer(pars.data()); whstate.quality_[WireHitState::bkg] = mvaout[0]; - if(diag_ > 2){ - whstate.algo_ = StrawHitUpdaters::BkgANN; - } + whstate.algo_ = StrawHitUpdaters::BkgANN; if(mvaout[0] < mvacut_){ - whstate.algo_ = StrawHitUpdaters::BkgANN; whstate.state_ = WireHitState::inactive; - whstate.frozen_ = whstate.isIn(freeze_); + } else { + // re-activate the hit if it was inactive + if(whstate.isInactive())whstate.state_ = WireHitState::null; } + whstate.frozen_ = whstate.isIn(freeze_); + if (diag_ > 1)std::cout << "BkgANNSHU set hit " << whstate << std::endl; + } else if (diag_ > 1) { + std::cout << "BkgANNSHU skipping hit " << whstate << std::endl; } return whstate; } diff --git a/Mu2eKinKal/src/CADSHU.cc b/Mu2eKinKal/src/CADSHU.cc index 6174550791..d97be03cd8 100644 --- a/Mu2eKinKal/src/CADSHU.cc +++ b/Mu2eKinKal/src/CADSHU.cc @@ -48,7 +48,9 @@ namespace mu2e { whstate.flag_ = flag_; whstate.frozen_ = whstate.isIn(freeze_); } - } + if (diag_ > 1)std::cout << "CADSHU set hit " << whstate << std::endl; + } else if (diag_ > 1) { + std::cout << "CADSHU skipping hit " << whstate << std::endl; } return whstate; } diff --git a/Mu2eKinKal/src/DriftANNSHU.cc b/Mu2eKinKal/src/DriftANNSHU.cc index b25eda64d4..704152b760 100644 --- a/Mu2eKinKal/src/DriftANNSHU.cc +++ b/Mu2eKinKal/src/DriftANNSHU.cc @@ -34,7 +34,7 @@ namespace mu2e { WireHitState DriftANNSHU::wireHitState(WireHitState const& input, ClosestApproachData const& tpdata, DriftInfo const& dinfo, ComboHit const& chit) const { WireHitState whstate = input; - if(input.updateable(StrawHitUpdaters::DriftANN)){ + if(whstate.updateable(StrawHitUpdaters::DriftANN) && whstate.active()){ // infer the ANN values std::array spars; std::array cpars; @@ -55,8 +55,8 @@ namespace mu2e { double plen = sqrt(std::max(0.25, 6.25-dinfo.rDrift_*dinfo.rDrift_))/sint; cpars[3] = chit.energyDep()/plen; auto clustermvaout = clustermva_->infer(cpars.data()); - if(diag_ > 1)std::cout << std::setw(8) << std::setprecision(5) - << "ANN inputs: doca, cdrift, sigdoca, TOTdrift, EDep " + if(diag_ > 2)std::cout << std::setw(8) << std::setprecision(5) + << "Drift ANN inputs: doca, cdrift, sigdoca, TOTdrift, EDep " << spars[0] << " , " << spars[1] << " , " << spars[2] << " , " @@ -100,6 +100,9 @@ namespace mu2e { whstate.state_ = WireHitState::null; } whstate.frozen_ = whstate.isIn(freeze_); + if (diag_ > 1)std::cout << "DriftANNSHU set hit " << whstate << std::endl; + } else if (diag_ > 1) { + std::cout << "DriftANNSHU skipping hit " << whstate << std::endl; } return whstate; } diff --git a/Mu2eKinKal/src/WireHitState.cc b/Mu2eKinKal/src/WireHitState.cc index 8a777a0840..d23095d393 100644 --- a/Mu2eKinKal/src/WireHitState.cc +++ b/Mu2eKinKal/src/WireHitState.cc @@ -7,6 +7,7 @@ namespace mu2e { if(whs.frozen()) ost << " Frozen "; ost << WireHitState::StateNames_[whs.state_+3]; ost << " Flags " << whs.flag_; + ost << " algo " << StrawHitUpdaters::name(whs.algo_); return ost; }