From eae881c537e4605506af144aeb6eb5e5702653d8 Mon Sep 17 00:00:00 2001
From: "Stephen A. Wood" <saw@jlab.org>
Date: Tue, 14 Aug 2012 10:40:49 -0400
Subject: [PATCH] Autogenerate db_cratemap.dat in hodtest.C so that it always
 corresponds to the (Hall C ENGINE style) map file being used.

---
 .gitignore               |  2 ++
 examples/db_cratemap.dat | 48 ----------------------------------------
 examples/hodtest.C       |  8 +++++--
 3 files changed, 8 insertions(+), 50 deletions(-)
 delete mode 100644 examples/db_cratemap.dat

diff --git a/.gitignore b/.gitignore
index 4266162..c669174 100644
--- a/.gitignore
+++ b/.gitignore
@@ -15,6 +15,8 @@ hcana
 # Examples directory
 examples/*.root
 examples/*.log.*
+# This is auto generated by hodtest.C
+examples/db_cratemap.dat
 
 # Working directory
 work
diff --git a/examples/db_cratemap.dat b/examples/db_cratemap.dat
deleted file mode 100644
index 18cf0b7..0000000
--- a/examples/db_cratemap.dat
+++ /dev/null
@@ -1,48 +0,0 @@
-# Hall C Crate map
-==== Crate 1 type fastbus
-# slot  model   clear   header  mask    nchan   ndata
-  1     1881    1       0x0     0x0     64      64
-  3     1881    1       0x0     0x0     64      64
-  5     1881    1       0x0     0x0     64      64
-  7     1881    1       0x0     0x0     64      64
-  9     1881    1       0x0     0x0     64      64
- 11     1881    1       0x0     0x0     64      64
- 13     1881    1       0x0     0x0     64      64
- 18     1875    1       0x0     0x0     64      64
- 19     1875    1       0x0     0x0     64      64
- 21     1875    1       0x0     0x0     64      64
- 23     1875    1       0x0     0x0     64      64
-==== Crate 2 type fastbus
-# slot  model   clear   header  mask    nchan   ndata
-  2     1877    1       0x0     0x0     64      256
-  3     1877    1       0x0     0x0     64      256
-  5     1877    1       0x0     0x0     64      256
-  6     1877    1       0x0     0x0     64      256
-  8     1877    1       0x0     0x0     64      256
-  9     1877    1       0x0     0x0     64      256
- 15     1877    1       0x0     0x0     64      256
- 16     1877    1       0x0     0x0     64      256
- 18     1877    1       0x0     0x0     64      256
- 19     1877    1       0x0     0x0     64      256
- 21     1877    1       0x0     0x0     64      256
- 22     1877    1       0x0     0x0     64      256
-==== Crate 3 type fastbus
-# slot  model   clear   header  mask    nchan   ndata
-  1     1881    1       0x0     0x0     64      64
-  3     1881    1       0x0     0x0     64      64
-  5     1881    1       0x0     0x0     64      64
-  7     1881    1       0x0     0x0     64      64
-  9     1881    1       0x0     0x0     64      64
- 18     1875    1       0x0     0x0     64      64
- 20     1875    1       0x0     0x0     64      64
- 22     1875    1       0x0     0x0     64      64
-==== Crate 4 type fastbus
-# slot  model   clear   header  mask    nchan   ndata
-  1     1877    1       0x0     0x0     64      256
-  2     1877    1       0x0     0x0     64      256
-  4     1877    1       0x0     0x0     64      256
-  5     1877    1       0x0     0x0     64      256
-  8     1877    1       0x0     0x0     64      256
-  9     1877    1       0x0     0x0     64      256
- 11     1877    1       0x0     0x0     64      256
- 12     1877    1       0x0     0x0     64      256
diff --git a/examples/hodtest.C b/examples/hodtest.C
index 6a2ce5f..fea9131 100644
--- a/examples/hodtest.C
+++ b/examples/hodtest.C
@@ -17,13 +17,17 @@
 
   gHcParms->Load(gHcParms->GetString("g_ctp_parm_filename"));
 
-  // Load the Hall C style detector map
+  // Generate db_cratemap to correspond to map file contents
+  char command[100];
+  sprintf(command,"./make_cratemap.pl < %s > db_cratemap.dat",gHcParms->GetString("g_decode_map_filename"));
+  system(command);
 
+  // Load the Hall C style detector map
   gHcDetectorMap=new THcDetectorMap();
   gHcDetectorMap->Load(gHcParms->GetString("g_decode_map_filename"));
 
   // Set up the equipment to be analyzed.
-  
+
   THaApparatus* HMS = new THcHallCSpectrometer("H","HMS");
   gHaApps->Add( HMS );
 
-- 
GitLab