From 51e240f37b3851a144a78206cf4efde215c27379 Mon Sep 17 00:00:00 2001
From: "Stephen A. Wood" <zviwood@gmail.com>
Date: Fri, 10 Aug 2012 21:06:17 -0400
Subject: [PATCH] Fix hitmaps for the drift chambers: Put map files in MAPS
 subdir. Define correct map for run 50017 in test.database. Add a script to
 display drift chamber hitmaps. Fix make_cratemap.pl so that it makes an entry
 in db_cratemap.dat   for all Fastbus slots.

---
 examples/DBASE/test.database   |  4 ++--
 examples/{ => MAPS}/jan03.map  |  0
 examples/{ => MAPS}/july04.map |  0
 examples/db_cratemap.dat       |  6 ++++++
 examples/dchitmaps.C           | 31 +++++++++++++++++++++++++++++++
 examples/make_cratemap.pl      |  2 +-
 examples/output.def            | 18 ++++++++++++++++++
 7 files changed, 58 insertions(+), 3 deletions(-)
 rename examples/{ => MAPS}/jan03.map (100%)
 rename examples/{ => MAPS}/july04.map (100%)
 create mode 100644 examples/dchitmaps.C

diff --git a/examples/DBASE/test.database b/examples/DBASE/test.database
index c9d3760..66bff4a 100644
--- a/examples/DBASE/test.database
+++ b/examples/DBASE/test.database
@@ -1,7 +1,7 @@
 # ENGINE style parameter vs. run number database
 50017
 g_ctp_parm_filename="PARAM/general.param"
-g_decode_map_filename="jan03.map"
+g_decode_map_filename="MAPS/july04.map"
 47000-48000
 g_ctp_parm_filename="PARAM/general.param"
-g_decode_map_filename="jan03.map"
+g_decode_map_filename="MAPS/jan03.map"
diff --git a/examples/jan03.map b/examples/MAPS/jan03.map
similarity index 100%
rename from examples/jan03.map
rename to examples/MAPS/jan03.map
diff --git a/examples/july04.map b/examples/MAPS/july04.map
similarity index 100%
rename from examples/july04.map
rename to examples/MAPS/july04.map
diff --git a/examples/db_cratemap.dat b/examples/db_cratemap.dat
index 8510d48..18cf0b7 100644
--- a/examples/db_cratemap.dat
+++ b/examples/db_cratemap.dat
@@ -16,7 +16,10 @@
 # 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
@@ -31,6 +34,7 @@
   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
@@ -39,4 +43,6 @@
   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/dchitmaps.C b/examples/dchitmaps.C
new file mode 100644
index 0000000..e291872
--- /dev/null
+++ b/examples/dchitmaps.C
@@ -0,0 +1,31 @@
+ {
+  TFile* f = new TFile("hodtest.root");
+ 
+  TCanvas *c1 = new TCanvas("c1", "Scintillator Hit Maps", 800, 800); 
+  c1->Divide(2, 6);
+
+  TH1F* h[12];
+
+  h[0] = hdc1x1_wm;
+  h[1] = hdc1y1_wm;
+  h[2] = hdc1u1_wm;
+  h[3] = hdc1v1_wm;
+  h[4] = hdc1y2_wm;
+  h[5] = hdc1x2_wm;
+  h[6] = hdc2x1_wm;
+  h[7] = hdc2y1_wm;
+  h[8] = hdc2u1_wm;
+  h[9] = hdc2v1_wm;
+  h[10] = hdc2y2_wm;
+  h[11] = hdc2x2_wm;
+  
+  for(Int_t ih=0;ih<12;ih++) {
+    Int_t ipad = 2*(ih%6)+1 + ih/6;
+    cout << ipad << endl;
+    TPad *pt = c1->cd(ipad);
+    h[ih]->SetFillColor(kBlue);
+    h[ih]->SetFillStyle(3354);
+    h[ih]->Draw();
+  }
+
+}
diff --git a/examples/make_cratemap.pl b/examples/make_cratemap.pl
index 429b866..6ee8d5e 100755
--- a/examples/make_cratemap.pl
+++ b/examples/make_cratemap.pl
@@ -32,7 +32,7 @@ while(<>) {
     } elsif ($line=/^\s*slot=\s*(\d*)/i) {
 	$slot = $1;
 	$modtype = 0;
-    } elsif ($line=/^\s*(\d)\s*,\s*(\d)\s*,\s*(\d)/) {
+    } elsif ($line=/^\s*(\d*)\s*,\s*(\d*)\s*,\s*(\d*)/) {
 	if($modtype == 0) {	# Slot not yet registered
 	    if($nsubadd == 96) {
 		$modtype = 1877;
diff --git a/examples/output.def b/examples/output.def
index 81063fa..7ed2b8a 100644
--- a/examples/output.def
+++ b/examples/output.def
@@ -46,3 +46,21 @@ TH1F calposadc1 'HMS Cal ADC1' H.Cal.1z.posadc1 150 -50 400
 # TH1F chposadc 'HMS Cal ADC11' H.Cal.1z.posadc11 150 -50 400
 # TH1F chposadc 'HMS Cal ADC12' H.Cal.1z.posadc12 150 -50 400
 # TH1F chposadc 'HMS Cal ADC13' H.Cal.1z.posadc13 150 -50 400
+
+#TH1F hdcrawtdc
+#TH1F hdccuttdc
+
+# Can we use variables for the constants.  In CTP we used hdc_nwire(i)
+#
+TH1F hdc1x1_wm 'HDC 1X1 Wiremap' H.dc.1.tdchits 113 0.5 113.5
+TH1F hdc1y1_wm 'HDC 1Y1 Wiremap' H.dc.2.tdchits 52 0.5 52.5
+TH1F hdc1u1_wm 'HDC 1U1 Wiremap' H.dc.3.tdchits 107 0.5 107.5
+TH1F hdc1v1_wm 'HDC 1V1 Wiremap' H.dc.4.tdchits 107 0.5 107.5
+TH1F hdc1y2_wm 'HDC 1Y2 Wiremap' H.dc.5.tdchits 52 0.5 52.5
+TH1F hdc1x2_wm 'HDC 1X2 Wiremap' H.dc.6.tdchits 113 0.5 113.5
+TH1F hdc2x1_wm 'HDC 2X1 Wiremap' H.dc.7.tdchits 113 0.5 113.5
+TH1F hdc2y1_wm 'HDC 2Y1 Wiremap' H.dc.8.tdchits 52 0.5 52.5
+TH1F hdc2u1_wm 'HDC 2U1 Wiremap' H.dc.9.tdchits 107 0.5 107.5
+TH1F hdc2v1_wm 'HDC 2V1 Wiremap' H.dc.10.tdchits 107 0.5 107.5
+TH1F hdc2y2_wm 'HDC 2Y2 Wiremap' H.dc.11.tdchits 52 0.5 52.5
+TH1F hdc2x2_wm 'HDC 2X2 Wiremap' H.dc.12.tdchits 113 0.5 113.5
-- 
GitLab