From 4359d3f91504b34c693b2e6d5ea3f21231d6c3e1 Mon Sep 17 00:00:00 2001
From: "Stephen A. Wood" <saw@jlab.org>
Date: Thu, 3 May 2012 17:00:39 -0400
Subject: [PATCH] Start work on creating a few simple hodoscope histograms.
 Follow SRC model and make a scintillator plane class.

---
 Makefile                     |  3 ++-
 src/HallC_LinkDef.h          |  1 +
 src/THcHodoscope.cxx         | 19 +++++++++++++++++++
 src/THcHodoscope.h           |  5 +++--
 src/THcScintillatorPlane.cxx | 28 ++++++++++++++++++++++++++++
 src/THcScintillatorPlane.h   | 36 ++++++++++++++++++++++++++++++++++++
 6 files changed, 89 insertions(+), 3 deletions(-)
 create mode 100644 src/THcScintillatorPlane.cxx
 create mode 100644 src/THcScintillatorPlane.h

diff --git a/Makefile b/Makefile
index 11cbf6d..f1f95c2 100644
--- a/Makefile
+++ b/Makefile
@@ -12,7 +12,8 @@ SRC  =  src/THcInterface.cxx src/THcParmList.cxx src/THcAnalyzer.cxx \
 	src/THcHodoscopeHit.cxx src/THcRawHit.cxx \
 	src/THcDCHit.cxx \
 	src/THcHitList.cxx src/THcDetectorMap.cxx src/THcHodoscope.cxx \
-	src/THcHallCSpectrometer.cxx src/THcDriftChamber.cxx
+	src/THcHallCSpectrometer.cxx src/THcDriftChamber.cxx \
+	src/THcScintillatorPlane.cxx
 
 # Name of your package. 
 # The shared library that will be built will get the name lib$(PACKAGE).so
diff --git a/src/HallC_LinkDef.h b/src/HallC_LinkDef.h
index 5ac786e..b939b51 100644
--- a/src/HallC_LinkDef.h
+++ b/src/HallC_LinkDef.h
@@ -18,5 +18,6 @@
 #pragma link C++ class THcDriftChamber+;
 #pragma link C++ class THcDetectorMap+;
 #pragma link C++ class THcHallCSpectrometer+;
+#pragma link C++ class THcScintillatorPlane+;
 
 #endif
diff --git a/src/THcHodoscope.cxx b/src/THcHodoscope.cxx
index b70ac6c..7606f76 100644
--- a/src/THcHodoscope.cxx
+++ b/src/THcHodoscope.cxx
@@ -55,6 +55,19 @@ THaAnalysisObject::EStatus THcHodoscope::Init( const TDatime& date )
   if( THaNonTrackingDetector::Init( date ) )
     return fStatus;
 
+  // Construct the planes
+  fPlane = new THcScintillatorPlane* [fNPlanes];
+  for(Int_t ip=0; ip<fNPlanes; ip++) {
+    // Create a name and description
+    // Is it going to be a problem that I create these object in init?
+    // I could actually do it in the constructor, since the parameters
+    // will already have been read.  Then I don't have to manually call
+    // ReadDatabase for each plane
+    GetTitle()
+    fPlane[ip] = THcScintillatorPlane( name, description); 
+  }
+
+
   // Replace with what we need for Hall C
   //  const DataDest tmp[NDEST] = {
   //    { &fRTNhit, &fRANhit, fRT, fRT_c, fRA, fRA_p, fRA_c, fROff, fRPed, fRGain },
@@ -191,6 +204,12 @@ Int_t THcHodoscope::DefineVariables( EMode mode )
 
   // Register variables in global list
 
+  //  RVarDef vars[] = {
+    //    hpostdc1 HMS s1x+ TDC hits
+    //    hnegtdc1 HMS s1x+ TDC hits
+    //...
+    //    hnegtdc4 HMS s2y- TDC hits
+
   //  RVarDef vars[] = {
   //    { "nlthit", "Number of Left paddles TDC times",  "fLTNhit" },
   //    { "nrthit", "Number of Right paddles TDC times", "fRTNhit" },
diff --git a/src/THcHodoscope.h b/src/THcHodoscope.h
index 31760f5..df56b53 100644
--- a/src/THcHodoscope.h
+++ b/src/THcHodoscope.h
@@ -3,7 +3,7 @@
 
 ///////////////////////////////////////////////////////////////////////////////
 //                                                                           //
-// THcHodoscope                                                           //
+// THcHodoscope                                                              //
 //                                                                           //
 ///////////////////////////////////////////////////////////////////////////////
 
@@ -11,6 +11,7 @@
 #include "THaNonTrackingDetector.h"
 #include "THcHitList.h"
 #include "THcHodoscopeHit.h"
+#include "THcScintillatorPlane.h"
 
 class THaScCalib;
 
@@ -49,7 +50,7 @@ protected:
   Double_t* fSpacing;		// Paddle spacing in cm
   Double_t** fCenter;           // Center position of each paddle
 
-
+  THcScintillatorPlane** fPlane; // List of plane objects
 
   TClonesArray*  fTrackProj;  // projection of track onto scintillator plane
                               // and estimated match to TOF paddle
diff --git a/src/THcScintillatorPlane.cxx b/src/THcScintillatorPlane.cxx
new file mode 100644
index 0000000..a2b30d0
--- /dev/null
+++ b/src/THcScintillatorPlane.cxx
@@ -0,0 +1,28 @@
+//*-- Author :
+
+//////////////////////////////////////////////////////////////////////////
+//
+// THcScintillatorPlane
+//
+//////////////////////////////////////////////////////////////////////////
+
+#include "THcScintillatorPlane.h"
+
+ClassImp(THcScintillatorPlane)
+
+//______________________________________________________________________________
+THcScintillatorPlane::THcScintillatorPlane( const char* name, 
+		    const char* description,
+		    THaApparatus* apparatus )
+  : THaNonTrackingDetector(name,description,apparatus)
+{
+  // Normal constructor with name and description
+
+}
+
+//______________________________________________________________________________
+THcScintillatorPlane::~THcScintillatorPlane()
+{
+  // Destructor
+
+}
diff --git a/src/THcScintillatorPlane.h b/src/THcScintillatorPlane.h
new file mode 100644
index 0000000..ce54668
--- /dev/null
+++ b/src/THcScintillatorPlane.h
@@ -0,0 +1,36 @@
+#ifndef ROOT_THcScintillatorPlane
+#define ROOT_THcScintillatorPlane
+
+//////////////////////////////////////////////////////////////////////////////
+//                         
+// THcScintillatorPlane
+//
+// A Hall C scintillator plane
+//
+// May want to later inherit from a THcPlane class if there are similarities
+// in what a plane is shared with other detector types (shower, etc.)
+// 
+//////////////////////////////////////////////////////////////////////////////
+
+#include "THaNonTrackingDetector.h"
+
+class THcScintillatorPlane : public THaNonTrackingDetector {
+  
+ public:
+  virtual ~THcScintillatorPlane();
+
+  THcScintillatorPlane( const char* name, const char* description,
+			  THaApparatus* a = NULL);
+
+  virtual Int_t CoarseProcess( TClonesArray& tracks ) = 0;
+  virtual Int_t    FineProcess( TClonesArray& tracks )  = 0;
+          Bool_t   IsTracking() { return kFALSE; }
+  virtual Bool_t   IsPid()      { return kFALSE; }
+
+ protected:
+
+  ClassDef(THcScintillatorPlane,0)
+};
+#endif
+
+
-- 
GitLab