From c574ac3c9fb6fa917298dea19d74607d38ee52f2 Mon Sep 17 00:00:00 2001
From: Jahred Adelman <jahreda@gmail.com>
Date: Wed, 30 Nov 2016 14:38:32 +0100
Subject: [PATCH] 
 FastTrackSimRegionalWrap_64TowersIBL3D_HWModeID2_jobOptions.py
 (FastTrackSimWrap-04-00-14)

2016-11-30 Jahred Adelman
	* Add FastTrackSimRegionalWrap_64TowersIBL3D_HWModeID2_jobOptions.py
	* Tag as FastTrackSimWrap-04-00-14
2016-08-03  scott snyder  <snyder@bnl.gov>
---
 .../FastTrackSimWrap/FTKRegionalWrapper.h     |  3 +
 ...owersIBL3DTest_DFTestVectors_jobOptions.py | 57 +++++++++++++++++++
 ...Wrap_64TowersIBL3D_HWModeID2_jobOptions.py | 49 ++++++++++++++++
 ...FastTrackSimRegionalWrap_ITk_jobOptions.py | 15 +++--
 .../src/FTKRegionalWrapper.cxx                | 52 ++++++++++++-----
 5 files changed, 159 insertions(+), 17 deletions(-)
 create mode 100755 Trigger/TrigFTK/FastTrackSimWrap/share/FastTrackSimRegionalWrap_32TowersIBL3DTest_DFTestVectors_jobOptions.py
 create mode 100644 Trigger/TrigFTK/FastTrackSimWrap/share/FastTrackSimRegionalWrap_64TowersIBL3D_HWModeID2_jobOptions.py

diff --git a/Trigger/TrigFTK/FastTrackSimWrap/FastTrackSimWrap/FTKRegionalWrapper.h b/Trigger/TrigFTK/FastTrackSimWrap/FastTrackSimWrap/FTKRegionalWrapper.h
index ad254a2d61a..48207e279a5 100644
--- a/Trigger/TrigFTK/FastTrackSimWrap/FastTrackSimWrap/FTKRegionalWrapper.h
+++ b/Trigger/TrigFTK/FastTrackSimWrap/FastTrackSimWrap/FTKRegionalWrapper.h
@@ -131,6 +131,9 @@ private:
   std::vector<uint32_t> m_pix_rodIdlist;  /** List of RodIDs to be used to emulate DF output*/
   std::vector<uint32_t> m_sct_rodIdlist;  /** List of RodIDs to be used to emulate DF output*/
 
+  std::vector<std::string> m_spix_rodIdlist;  /** List of RodIDs to be used to emulate DF output*/
+  std::vector<std::string> m_ssct_rodIdlist;  /** List of RodIDs to be used to emulate DF output*/
+
   bool dumpFTKTestVectors(FTKPlaneMap *pmap, FTKRegionMap *rmap);
 
 
diff --git a/Trigger/TrigFTK/FastTrackSimWrap/share/FastTrackSimRegionalWrap_32TowersIBL3DTest_DFTestVectors_jobOptions.py b/Trigger/TrigFTK/FastTrackSimWrap/share/FastTrackSimRegionalWrap_32TowersIBL3DTest_DFTestVectors_jobOptions.py
new file mode 100755
index 00000000000..851cd4529c8
--- /dev/null
+++ b/Trigger/TrigFTK/FastTrackSimWrap/share/FastTrackSimRegionalWrap_32TowersIBL3DTest_DFTestVectors_jobOptions.py
@@ -0,0 +1,57 @@
+###############################################################
+#
+# FTKRegionalWrapper job options file
+#
+#==============================================================
+
+# Helper function from transforms 
+from PyJobTransforms.trfUtils import findFile
+pmap_path = findFile(os.environ['DATAPATH'], 'ftk_configuration/map_files/raw_12LiblHW3D.pmap')
+print "Using PMAP:", pmap_path
+rmap_path = findFile(os.environ['DATAPATH'], 'ftk_configuration/map_files/raw_12Libl32TmodB_3D_t13.tmap')
+print "Using RMAP:", rmap_path
+
+
+from AthenaCommon.AlgSequence import AlgSequence
+theJob = AlgSequence()
+
+from AthenaCommon.GlobalFlags import globalflags
+print globalflags
+
+
+from FastTrackSimWrap.FastTrackSimWrapConf import FTKRegionalWrapper
+if hasattr(runArgs,"outputNTUP_FTKIPFile") :
+    OutputNTUP_FTKIPFile = runArgs.outputNTUP_FTKIPFile
+else :
+    OutputNTUP_FTKIPFile = "ftksim_32Towers_wrap.root"
+
+from AthenaCommon.AppMgr import ToolSvc
+
+from TrigFTKSim.TrigFTKSimConf import FTK_SGHitInput
+FTKSGInput = FTK_SGHitInput( maxEta= 3.2, minPt= 0.8*GeV)
+FTKSGInput.OutputLevel = DEBUG
+FTKSGInput.ReadTruthTracks = False
+
+ToolSvc += FTKSGInput
+
+print "Output file", OutputNTUP_FTKIPFile
+wrapper = FTKRegionalWrapper(OutputLevel = DEBUG, 
+                             PMapPath = pmap_path,
+                             RMapPath = rmap_path,
+                             OutFileName = OutputNTUP_FTKIPFile)
+wrapper.IBLMode = 2
+wrapper.HitInputTool = FTKSGInput
+wrapper.Clustering = True
+wrapper.PixelClusteringMode=101
+wrapper.SavePerPlane=True
+wrapper.EmulateDF = True
+wrapper.SaveRawHits = True
+wrapper.SaveHits = True
+wrapper.DuplicateGanged = False
+print "FTKRegionalWrapper setting ROBS"
+wrapper.pixRodIds = ["0x112414", "0x140170", "0x111816", "0x112411", "0x112416", "0x140140", "0x140180", "0x130011"]
+wrapper.sctRodIds = ["0x210000", "0x210109", "0x210108", "0x230100", "0x220000", "0x220109", "0x22010a", "0x21010a"]
+theJob += wrapper
+
+print theJob
+###############################################################
diff --git a/Trigger/TrigFTK/FastTrackSimWrap/share/FastTrackSimRegionalWrap_64TowersIBL3D_HWModeID2_jobOptions.py b/Trigger/TrigFTK/FastTrackSimWrap/share/FastTrackSimRegionalWrap_64TowersIBL3D_HWModeID2_jobOptions.py
new file mode 100644
index 00000000000..3c955ad12ac
--- /dev/null
+++ b/Trigger/TrigFTK/FastTrackSimWrap/share/FastTrackSimRegionalWrap_64TowersIBL3D_HWModeID2_jobOptions.py
@@ -0,0 +1,49 @@
+###############################################################
+#
+# FTKRegionalWrapper job options file
+#
+#==============================================================
+
+# Helper function from transforms 
+from PyJobTransforms.trfUtils import findFile
+pmap_path = findFile(os.environ['DATAPATH'], 'ftk_configuration/map_files/raw_12LiblHW3D.pmap')
+print "Using PMAP:", pmap_path
+rmap_path = findFile(os.environ['DATAPATH'], 'ftk_configuration/map_files/raw_12Libl64TmodB_3D_t13.tmap')
+print "Using RMAP:", rmap_path
+
+
+from AthenaCommon.AlgSequence import AlgSequence
+theJob = AlgSequence()
+
+
+from FastTrackSimWrap.FastTrackSimWrapConf import FTKRegionalWrapper
+if hasattr(runArgs,"outputNTUP_FTKIPFile") :
+    OutputNTUP_FTKIPFile = runArgs.outputNTUP_FTKIPFile
+else :
+    OutputNTUP_FTKIPFile = "ftksim_64Towers_wrap.root"
+
+from AthenaCommon.AppMgr import ToolSvc
+
+from TrigFTKSim.TrigFTKSimConf import FTK_SGHitInput
+FTKSGInput = FTK_SGHitInput( maxEta= 3.2, minPt= 0.8*GeV)
+FTKSGInput.OutputLevel = DEBUG
+FTKSGInput.ReadTruthTracks = True
+
+ToolSvc += FTKSGInput
+
+print "Output file", OutputNTUP_FTKIPFile
+wrapper = FTKRegionalWrapper(OutputLevel = DEBUG, 
+                             PMapPath = pmap_path,
+                             RMapPath = rmap_path,
+                             OutFileName = OutputNTUP_FTKIPFile)
+wrapper.IBLMode = 2
+wrapper.FixEndcapL0 = False
+wrapper.HitInputTool = FTKSGInput
+wrapper.PixelClusteringMode = 101
+wrapper.SctClustering = True
+wrapper.Clustering = True
+
+theJob += wrapper
+
+print theJob
+###############################################################
diff --git a/Trigger/TrigFTK/FastTrackSimWrap/share/FastTrackSimRegionalWrap_ITk_jobOptions.py b/Trigger/TrigFTK/FastTrackSimWrap/share/FastTrackSimRegionalWrap_ITk_jobOptions.py
index 4c28a4b8386..4bc3eaa2ec0 100644
--- a/Trigger/TrigFTK/FastTrackSimWrap/share/FastTrackSimRegionalWrap_ITk_jobOptions.py
+++ b/Trigger/TrigFTK/FastTrackSimWrap/share/FastTrackSimRegionalWrap_ITk_jobOptions.py
@@ -4,6 +4,13 @@
 #
 #==============================================================
 
+# Locate the tmap and pmap files
+from PyJobTransforms.trfUtils import findFile
+pmap_path = findFile(os.environ['DATAPATH'], 'ftk_configuration/map_files/raw_ITkExample.pmap')
+rmap_path = findFile(os.environ['DATAPATH'], 'ftk_configuration/map_files/raw_ITkExample.tmap')
+print "Using PMAP:", pmap_path
+print "Using RMAP:", rmap_path
+
 from AthenaCommon.AlgSequence import AlgSequence
 theJob = AlgSequence()
 
@@ -19,14 +26,14 @@ from TrigFTKSim.TrigFTKSimConf import FTK_SGHitInput
 FTKSGInput = FTK_SGHitInput(maxEta=3.0, minPt=4*GeV)
 FTKSGInput.OutputLevel = DEBUG
 FTKSGInput.ReadTruthTracks = True
-FTKSGInput.DoOutFileRawHits = False
+FTKSGInput.DoOutFileRawHits = True
 
 ToolSvc += FTKSGInput
 
 print "Output file", OutputNTUP_FTKIPFile
-wrapper = FTKRegionalWrapper(OutputLevel = DEBUG, 
-                             PMapPath = 'maps/raw_l1track.pmap',
-                             RMapPath = 'maps/raw_l1track.tmap',
+wrapper = FTKRegionalWrapper(OutputLevel = DEBUG,
+                             PMapPath = pmap_path,
+                             RMapPath = rmap_path,
                              OutFileName = OutputNTUP_FTKIPFile)
 wrapper.IBLMode = 0
 wrapper.ITkMode = True
diff --git a/Trigger/TrigFTK/FastTrackSimWrap/src/FTKRegionalWrapper.cxx b/Trigger/TrigFTK/FastTrackSimWrap/src/FTKRegionalWrapper.cxx
index 7ab99f67317..f1c63d73902 100644
--- a/Trigger/TrigFTK/FastTrackSimWrap/src/FTKRegionalWrapper.cxx
+++ b/Trigger/TrigFTK/FastTrackSimWrap/src/FTKRegionalWrapper.cxx
@@ -23,6 +23,7 @@
 #include "SCT_Cabling/SCT_SerialNumber.h"
 
 #include <algorithm>
+#include <sstream> 
 
 FTKRegionalWrapper::FTKRegionalWrapper (const std::string& name, ISvcLocator* pSvcLocator) :
   AthAlgorithm(name, pSvcLocator), 
@@ -85,8 +86,15 @@ FTKRegionalWrapper::FTKRegionalWrapper (const std::string& name, ISvcLocator* pS
   //m_pix_rodIdlist({0x130007, 0x112510, 0x111816, 0x112508,0x112414}),
   //m_sct_rodIdlist({0x21010a, 0x210000}),
 
-  m_pix_rodIdlist({0x130007, 0x111510, 0x111816, 0x111508,0x112414,0x1400a3,0x130010,0x130011,0x112508,0x112510}),
-  m_sct_rodIdlist({0x21010a, 0x210000, 0x210109}),
+  //  m_pix_rodIdlist({0x130007, 0x111510, 0x111816, 0x111508,0x112414,0x1400a3,0x130010,0x130011,0x112508,0x112510}),
+  // m_sct_rodIdlist({0x21010a, 0x210000, 0x210109}),
+
+  m_pix_rodIdlist({0x112414, 0x140170, 0x111816, 0x112411, 0x112416, 0x140140, 0x140180, 0x130011}),
+  m_sct_rodIdlist({0x210000, 0x210109, 0x210108, 0x230100, 0x220000, 0x220109, 0x22010a, 0x21010a}),
+
+  m_spix_rodIdlist({"0x112414", "0x140170", "0x111816", "0x112411", "0x112416", "0x140140", "0x140180", "0x130011"}),
+  m_ssct_rodIdlist({"0x210000", "0x210109", "0x210108", "0x230100", "0x220000", "0x220109", "0x22010a", "0x21010a"}),
+
   m_FTKPxlClu_CollName("FTK_Pixel_Clusters"), 
   m_FTKPxlCluContainer(0x0),
   m_FTKSCTClu_CollName("FTK_SCT_Cluster"),
@@ -133,8 +141,8 @@ FTKRegionalWrapper::FTKRegionalWrapper (const std::string& name, ISvcLocator* pS
 
   //for DF board emulation 
   declareProperty("EmulateDF",m_EmulateDF);
-  declareProperty("pixRodIds", m_pix_rodIdlist);
-  declareProperty("sctRodIds", m_sct_rodIdlist);
+  declareProperty("pixRodIds", m_spix_rodIdlist);
+  declareProperty("sctRodIds", m_ssct_rodIdlist);
   declareProperty("L1IDToSave", m_L1ID_to_save);
 }
 
@@ -345,13 +353,22 @@ StatusCode FTKRegionalWrapper::initialize()
 	  ATH_MSG_DEBUG("SCT  offline map hashID to RobId "<<MSG::dec<<*mhit<<" "<<MSG::hex<<(*mit)<<MSG::dec);
       }
 
-    for (auto it = m_pix_rodIdlist.begin(); it < m_pix_rodIdlist.end(); it++){
+    m_pix_rodIdlist.clear();
+
+    for (auto it = m_spix_rodIdlist.begin(); it < m_spix_rodIdlist.end(); it++){
+      std::stringstream str;
+      str<<(*it);
+      int val;
+      str>>std::hex>>val;
+      
+      m_pix_rodIdlist.push_back(val);
+
       ATH_MSG_DEBUG("Going to test against the following Pix RODIDs "<< MSG::hex
-		    << (*it) <<MSG::dec);
+		    << val <<MSG::dec);
     
 	std::vector<IdentifierHash> offlineIdHashList;
-	m_pix_cabling_svc->getOfflineList(offlineIdHashList, m_pix_cabling_svc->getRobId(*it));
-	ATH_MSG_DEBUG("Trying m_pix_cabling_svc->getOfflineList(offlineIdHashList, m_pix_cabling_svc->getRobId("<<MSG::hex<<*it<<MSG::dec<<"));");
+	m_pix_cabling_svc->getOfflineList(offlineIdHashList, m_pix_cabling_svc->getRobId(val));
+	ATH_MSG_DEBUG("Trying m_pix_cabling_svc->getOfflineList(offlineIdHashList, m_pix_cabling_svc->getRobId("<<MSG::hex<<val<<MSG::dec<<"));");
 	for (auto oit = offlineIdHashList.begin(); oit != offlineIdHashList.end(); oit++){
 
 	    Identifier id = m_pixelId->wafer_id( *oit );
@@ -360,16 +377,25 @@ StatusCode FTKRegionalWrapper::initialize()
 	    int phi_module     = m_pixelId->phi_module(id);
 	    int eta_module     = m_pixelId->eta_module(id);
 
-	    ATH_MSG_DEBUG("hashId "<<*oit<<"for rodID "<<MSG::hex<<*it<<MSG::dec
+	    ATH_MSG_DEBUG("hashId "<<*oit<<"for rodID "<<MSG::hex<<val<<MSG::dec
 			  << "corresponds to b/ec lay_disk phi eta "<<barrel_ec
 			  << " "<<layer_disk<<" "<<phi_module<<" "<<eta_module);
 	}
     }
-    for (auto it = m_sct_rodIdlist.begin(); it < m_sct_rodIdlist.end(); it++)
+
+    m_sct_rodIdlist.clear();
+    for (auto it = m_ssct_rodIdlist.begin(); it < m_ssct_rodIdlist.end(); it++){
+      std::stringstream str;
+      str<<(*it);
+      int val;
+      str>>std::hex>>val;
+      m_sct_rodIdlist.push_back(val);
+      
       ATH_MSG_DEBUG("Going to test against the following SCT RODIDs "<< MSG::hex
-		    << (*it) <<MSG::dec);
-	
-	}
+		    << val <<MSG::dec);
+    }
+    
+  }
 
 
   return StatusCode::SUCCESS;
-- 
GitLab