From 42f76d8139d1faca3f65d4db17d92c15a247d892 Mon Sep 17 00:00:00 2001
From: Chav Chhiv Chau <chav.chhiv.chau@cern.ch>
Date: Thu, 16 Sep 2021 15:01:41 -0400
Subject: [PATCH] Remove the timeJitter method in sTgcDigitMaker

timeJitter provides an incorrect description of the sTGC time
response. It is replaced by a more detailed model that parametrizes
the time as a function of the distance between a track and the nearest
wire, see merge request !46472. So timeJitter is not used anymore.
---
 .../sTGC_Digitization/sTgcDigitMaker.h        | 11 ---
 .../share/sTGC_Digitization_timejitter.dat    | 13 ---
 .../sTGC_Digitization/src/sTgcDigitMaker.cxx  | 79 -------------------
 3 files changed, 103 deletions(-)
 delete mode 100644 MuonSpectrometer/MuonDigitization/sTGC_Digitization/share/sTGC_Digitization_timejitter.dat

diff --git a/MuonSpectrometer/MuonDigitization/sTGC_Digitization/sTGC_Digitization/sTgcDigitMaker.h b/MuonSpectrometer/MuonDigitization/sTGC_Digitization/sTGC_Digitization/sTgcDigitMaker.h
index c7bc27353772..3885ae285249 100644
--- a/MuonSpectrometer/MuonDigitization/sTGC_Digitization/sTGC_Digitization/sTgcDigitMaker.h
+++ b/MuonSpectrometer/MuonDigitization/sTGC_Digitization/sTGC_Digitization/sTgcDigitMaker.h
@@ -87,15 +87,6 @@ class sTgcDigitMaker {
     double mostProbableTime;
   };
 
-  /**
-     Reads parameters for intrinsic time response from timejitter.dat.
-  */
-  void  readFileOfTimeJitter();
-  /**
-     Calculates intrinsic time response according to incident angle of a track based on time response parameters
-  */
-  float timeJitter(float inAngle_time) const;
-
   /**
      Determines whether a hit is detected or not.
   */
@@ -166,8 +157,6 @@ class sTgcDigitMaker {
   ///** Alignment ths constants. Rotation around the global phi direction */
   //double m_alignmentTHS[N_STATIONNAME][N_STATIONETA][N_STATIONPHI];
 
-  std::vector<std::vector<float> > m_vecAngle_Time;
-
   // Parameters of the gamma pdf required for determining digit time
   std::vector<GammaParameter> m_gammaParameter;
 
diff --git a/MuonSpectrometer/MuonDigitization/sTGC_Digitization/share/sTGC_Digitization_timejitter.dat b/MuonSpectrometer/MuonDigitization/sTGC_Digitization/share/sTGC_Digitization_timejitter.dat
deleted file mode 100644
index 1f4a23e117a1..000000000000
--- a/MuonSpectrometer/MuonDigitization/sTGC_Digitization/share/sTGC_Digitization_timejitter.dat
+++ /dev/null
@@ -1,13 +0,0 @@
-  0 41 0.0805 0.1412 0.0998 0.0782 0.0687 0.0646 0.0638 0.0623 0.0519 0.0447 0.0395 0.0348 0.0311 0.0231 0.0215 0.0194 0.0142 0.0139 0.0091 0.0075 0.0050 0.0045 0.0038 0.0034 0.0025 0.0024 0.0012 0.0015 0.0012 0.0010 0.0005 0.0005 0.0008 0.0009 0.0003 0.0002 0.0004 0.0001 0.0000 0.0000 0.0000
-  5 41 0.0772 0.1440 0.0972 0.0799 0.0736 0.0688 0.0646 0.0614 0.0505 0.0441 0.0383 0.0352 0.0317 0.0235 0.0230 0.0187 0.0138 0.0142 0.0120 0.0107 0.0091 0.0066 0.0012 0.0004 0.0001 0.0000 0.0000 0.0001 0.0000 0.0000 0.0000 0.0000 0.0001 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
- 10 41 0.0797 0.1456 0.0925 0.0827 0.0746 0.0668 0.0623 0.0591 0.0517 0.0485 0.0438 0.0372 0.0359 0.0299 0.0239 0.0206 0.0199 0.0166 0.0070 0.0013 0.0003 0.0001 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
- 15 41 0.0860 0.1486 0.1012 0.0832 0.0771 0.0709 0.0618 0.0563 0.0557 0.0453 0.0472 0.0381 0.0340 0.0350 0.0270 0.0250 0.0060 0.0007 0.0005 0.0002 0.0002 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
- 20 41 0.0894 0.1517 0.1000 0.0866 0.0734 0.0713 0.0650 0.0616 0.0556 0.0551 0.0480 0.0440 0.0369 0.0383 0.0197 0.0026 0.0006 0.0001 0.0001 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
- 25 41 0.0842 0.1597 0.1047 0.0925 0.0791 0.0746 0.0693 0.0644 0.0599 0.0570 0.0547 0.0442 0.0450 0.0087 0.0014 0.0002 0.0001 0.0002 0.0000 0.0001 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
- 30 41 0.0898 0.1682 0.1128 0.0938 0.0856 0.0781 0.0724 0.0693 0.0663 0.0607 0.0573 0.0392 0.0049 0.0011 0.0001 0.0003 0.0001 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
- 35 41 0.0946 0.1843 0.1212 0.1023 0.0864 0.0799 0.0769 0.0693 0.0730 0.0647 0.0416 0.0043 0.0009 0.0003 0.0002 0.0000 0.0000 0.0001 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
- 40 41 0.1029 0.1856 0.1318 0.1087 0.0984 0.0896 0.0865 0.0766 0.0755 0.0389 0.0037 0.0009 0.0004 0.0001 0.0000 0.0002 0.0002 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
- 45 41 0.1128 0.2075 0.1301 0.1191 0.1051 0.1026 0.0934 0.0891 0.0345 0.0032 0.0019 0.0003 0.0001 0.0001 0.0002 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
- 50 41 0.1214 0.2264 0.1512 0.1290 0.1183 0.1127 0.1038 0.0295 0.0049 0.0017 0.0006 0.0001 0.0002 0.0002 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
- 55 41 0.1365 0.2545 0.1686 0.1493 0.1411 0.1182 0.0255 0.0039 0.0013 0.0009 0.0001 0.0001 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
- 60 41 0.1558 0.2972 0.1983 0.1697 0.1373 0.0301 0.0075 0.0026 0.0007 0.0004 0.0002 0.0002 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
diff --git a/MuonSpectrometer/MuonDigitization/sTGC_Digitization/src/sTgcDigitMaker.cxx b/MuonSpectrometer/MuonDigitization/sTGC_Digitization/src/sTgcDigitMaker.cxx
index 685898b31a42..09648ea7582b 100644
--- a/MuonSpectrometer/MuonDigitization/sTGC_Digitization/src/sTgcDigitMaker.cxx
+++ b/MuonSpectrometer/MuonDigitization/sTGC_Digitization/src/sTgcDigitMaker.cxx
@@ -80,8 +80,6 @@ StatusCode sTgcDigitMaker::initialize(CLHEP::HepRandomEngine *rndmEngine, const
   // initialize the TGC identifier helper
   m_idHelper = m_mdManager->stgcIdHelper();
 
-  readFileOfTimeJitter();
-
   // Read share/sTGC_Digitization_timeArrivale.dat, containing the digit time of arrival
   readFileOfTimeArrival();
 
@@ -606,83 +604,6 @@ double sTgcDigitMaker::distanceToWire(Amg::Vector3D& position, Amg::Vector3D& di
   return (sign * distance);
 }
 
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-void sTgcDigitMaker::readFileOfTimeJitter()
-{
-
-  const char* const fileName = "sTGC_Digitization_timejitter.dat";
-  std::string fileWithPath = PathResolver::find_file (fileName, "DATAPATH");
-
-  std::ifstream ifs;
-  if (!fileWithPath.empty()) {
-    ifs.open(fileWithPath.c_str(), std::ios::in);
-  }
-  else {
-    ATH_MSG_FATAL("readFileOfTimeJitter(): Could not find file " << fileName );
-    exit(-1);
-  }
-
-  if(ifs.bad()){
-    ATH_MSG_FATAL("readFileOfTimeJitter(): Could not open file "<< fileName );
-    exit(-1);
-  }
-
-  int angle = 0;
-  int bins = 0;
-  int i = 0;
-  float prob = 0.;
-
-  while(ifs.good()){
-    ifs >> angle >> bins;
-    if (ifs.eof()) break;
-    if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "readFileOfTimeJitter(): Timejitter, angle, Number of bins, prob. dist.: " << angle << " " << bins << " ";
-    m_vecAngle_Time.resize(i + 1);
-    for (int j = 0; j < 41/*bins*/; j++) {
-      ifs >> prob;
-      m_vecAngle_Time[i].push_back(prob);
-      if (j == 0)
-        if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "readFileOfTimeJitter(): ";
-      if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << prob << " ";
-    }
-    if(msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << endmsg;
-    i++;
-  }
-  ifs.close();
-}
-
-//+++++++++++++++++++++++++++++++++++++++++++++++
-float sTgcDigitMaker::timeJitter(float inAngle_time) const
-{
-
-  int   ithAngle = static_cast<int>(inAngle_time/5.);
-  float wAngle = inAngle_time/5. - static_cast<float>(ithAngle);
-  int   jthAngle;
-  if (ithAngle > 11) {
-    ithAngle = 12;
-    jthAngle = 12;
-  }
-  else {
-    jthAngle = ithAngle+1;
-  }
-
-  float jitter;
-  float prob = 1.;
-  float probRef = 0.;
-
-  while (prob > probRef) {
-    prob   = CLHEP::RandFlat::shoot(m_engine, 0.0, 1.0);
-    jitter = CLHEP::RandFlat::shoot(m_engine, 0.0, 1.0)*40.; // trial time jitter in nsec
-    int ithJitter = static_cast<int>(jitter);
-    // probability distribution calculated from weighted sum between neighboring bins of angles
-    probRef = (1.-wAngle)*m_vecAngle_Time[ithAngle][ithJitter]
-      +    wAngle *m_vecAngle_Time[jthAngle][ithJitter];
-  }
-
-  ATH_MSG_VERBOSE("sTgcDigitMaker::timeJitter : angle = " << inAngle_time 
-                  << ";  timeJitterDetector = " << jitter );
-
-  return jitter;
-}
 //+++++++++++++++++++++++++++++++++++++++++++++++
 bool sTgcDigitMaker::efficiencyCheck(const int channelType) const {
   if(channelType == 0) { // wire group
-- 
GitLab