From 3925ca82ac17903c9342dcf1b8f71beeac777634 Mon Sep 17 00:00:00 2001
From: FU Chengdong <fucd@ihep.ac.cn>
Date: Wed, 7 Aug 2024 05:54:41 +0000
Subject: [PATCH] Digi: add efficiency option for silicon tracker

---
 Digitisers/SimpleDigi/src/PlanarDigiAlg.cpp | 1 +
 Digitisers/SimpleDigi/src/PlanarDigiAlg.h   | 1 +
 2 files changed, 2 insertions(+)

diff --git a/Digitisers/SimpleDigi/src/PlanarDigiAlg.cpp b/Digitisers/SimpleDigi/src/PlanarDigiAlg.cpp
index 9c073a70..23e6b9a5 100644
--- a/Digitisers/SimpleDigi/src/PlanarDigiAlg.cpp
+++ b/Digitisers/SimpleDigi/src/PlanarDigiAlg.cpp
@@ -174,6 +174,7 @@ StatusCode PlanarDigiAlg::execute()
   int i = 0;
   for( auto SimTHit : *STHcol ) {
     if (SimTHit.getEDep()<=_eThreshold) continue;
+    if (gsl_ran_flat(_rng, 0, 1)>_efficiency) continue;
     debug() << "MCParticle id " << SimTHit.getMCParticle().id() << endmsg;
 
     const int celId = SimTHit.getCellID() ;
diff --git a/Digitisers/SimpleDigi/src/PlanarDigiAlg.h b/Digitisers/SimpleDigi/src/PlanarDigiAlg.h
index 981a171c..3f9dafe5 100644
--- a/Digitisers/SimpleDigi/src/PlanarDigiAlg.h
+++ b/Digitisers/SimpleDigi/src/PlanarDigiAlg.h
@@ -83,6 +83,7 @@ protected:
   // cov[0]=thetaU, cov[1]=phiU, cov[2]=resU, cov[0]=thetaV, cov[1]=phiV, cov[2]=resV
   Gaudi::Property<bool> _usePlanarTag{ this, "UsePlanarTag", true };
   Gaudi::Property<float> _eThreshold{ this, "EnergyThreshold", 0 };
+  Gaudi::Property<float> _efficiency{ this, "Efficiency", 1 };
   Gaudi::Property<float> _maxPull{ this, "PullCutToRetry", 1000. };
   Gaudi::Property<bool> _parameterize{ this, "ParameterizeResolution", false};
   Gaudi::Property<FloatVec> _parU{ this, "ParametersU", {0} };
-- 
GitLab