diff --git a/src/THcDetMap.cxx b/src/THcDetMap.cxx
index feb8424ca7818147e153eeecfa0c53a887984a58..c8c38a52c5ec6fa1f4bbf72d7ab55bd152dea5c7 100644
--- a/src/THcDetMap.cxx
+++ b/src/THcDetMap.cxx
@@ -1,370 +1,370 @@
-//*-- Author :    Ole Hansen   16/05/00
-
-//////////////////////////////////////////////////////////////////////////
-//
-// THaDetMap
-//
-// The standard detector map for a Hall A detector.
-//
-//////////////////////////////////////////////////////////////////////////
-
-#include "THaDetMap.h"
-#include <iostream>
-#include <iomanip>
-#include <cstring>
-#include <cstdlib>
-
-using namespace std;
-
-const int THaDetMap::kDetMapSize;
-
-// FIXME: load from db_cratemap
-struct ModuleType {
-  UInt_t  model;       // model identifier
-  Bool_t  adc;         // true if ADC
-  Bool_t  tdc;         // true if TDC
-};
-
-static const ModuleType module_list[] = {
-  { 1875, 0, 1 },
-  { 1877, 0, 1 },
-  { 1881, 1, 0 },
-  { 1872, 0, 1 },
-  { 3123, 1, 0 },
-  { 1182, 1, 0 },
-  {  792, 1, 0 },
-  {  775, 0, 1 },
-  {  767, 0, 1 },
-  { 3201, 0, 1 },
-  { 6401, 0, 1 },
-  { 1190, 0, 1 },
-  { 0 }
-};
-
-//_____________________________________________________________________________
-void THaDetMap::Module::SetModel( UInt_t m )
-{
-  model = m & kModelMask;
-  const ModuleType* md = module_list;
-  while ( md->model && model != md->model ) md++;
-  if( md->adc ) MakeADC();
-  if( md->tdc ) MakeTDC();
-}
-
-//_____________________________________________________________________________
-void THaDetMap::Module::SetResolution( Double_t res )
-{
-  resolution = res;
-}
-
-//_____________________________________________________________________________
-THaDetMap::THaDetMap() : fNmodules(0), fMap(0), fMaplength(0)
-{
-  // Default constructor. Creates an empty detector map.
-}
-
-//_____________________________________________________________________________
-THaDetMap::THaDetMap( const THaDetMap& rhs )
-{
-  // Copy constructor
-
-  fMaplength = rhs.fMaplength;
-  fNmodules  = rhs.fNmodules;
-  if( fMaplength > 0 ) {
-    fMap = new Module[fMaplength];
-    memcpy(fMap,rhs.fMap,fNmodules*sizeof(Module));
-  }
-}
-
-//_____________________________________________________________________________
-THaDetMap& THaDetMap::operator=( const THaDetMap& rhs )
-{
-  // THaDetMap assignment operator
-
-  if ( this != &rhs ) {
-    if ( fMaplength != rhs.fMaplength ) {
-      delete [] fMap;
-      fMaplength = rhs.fMaplength;
-      if( fMaplength > 0 )
-	fMap = new Module[fMaplength];
-    }
-    fNmodules = rhs.fNmodules;
-    memcpy(fMap,rhs.fMap,fNmodules*sizeof(Module));
-  }
-  return *this;
-}
-
-//_____________________________________________________________________________
-THaDetMap::~THaDetMap()
-{
-  // Destructor
-
-  delete [] fMap;
-}
-
-//_____________________________________________________________________________
-Int_t THaDetMap::AddModule( UShort_t crate, UShort_t slot, 
-			    UShort_t chan_lo, UShort_t chan_hi,
-			    UInt_t first, UInt_t model, Int_t refindex,
-			    Int_t refchan )
-{
-  // Add a module to the map.
-
-  if( fNmodules >= kDetMapSize ) return -1;  //Map is full
-  // Logical channels can run either "with" or "against" the physical channel
-  // numbers:
-  // lo<=hi :    lo -> first
-  //             hi -> first+hi-lo
-  // 
-  // lo>hi  :    hi -> first
-  //             lo -> first+lo-hi
-  // 
-  // To indicate the second case, The flag "reverse" is set to true in the 
-  // module. The fields lo and hi are reversed so that lo<=hi always.
-  // 
-  bool reverse = ( chan_lo > chan_hi );
-
-  if ( fNmodules >= fMaplength ) { // need to expand the Map
-    Int_t oldlen = fMaplength;
-    fMaplength += 10;
-    Module* tmpmap = new Module[fMaplength];   // expand in groups of 10
-    if( oldlen > 0 ) {
-      memcpy(tmpmap,fMap,oldlen*sizeof(Module));
-      delete [] fMap;
-    }
-    fMap = tmpmap;
-  }
-
-  Module& m = fMap[fNmodules];
-  m.crate = crate;
-  m.slot  = slot;
-  if( reverse ) {
-    m.lo = chan_hi;
-    m.hi = chan_lo;
-  } else {
-    m.lo = chan_lo;
-    m.hi = chan_hi;
-  }
-  m.first = first;
-  m.SetModel( model );
-  m.refindex = refindex;
-  m.refchan  = refchan;
-  m.SetResolution( 0.0 );
-  m.reverse = reverse;
-
-  return ++fNmodules;
-}
-
-//_____________________________________________________________________________
-THaDetMap::Module* THaDetMap::Find( UShort_t crate, UShort_t slot,
-				    UShort_t chan )
-{
-  // Return the module containing crate, slot, and channel chan.
-  // If several matching modules exist (which mean the map is misconfigured),
-  // only the first one is returned. If none match, return NULL.
-  // Since the map is usually small and not necessarily sorted, a simple
-  // linear search is done.
-
-  Module* found = NULL;
-  for( UShort_t i = 0; i < fNmodules; ++i ) {
-    Module* d = uGetModule(i);
-    if( d->crate == crate && d->slot == slot && 
-	d->lo <= chan && chan <= d->hi ) {
-      found = d;
-      break;
-    }
-  }
-  return found;
-}
-
-//_____________________________________________________________________________
-Int_t THaDetMap::Fill( const vector<Int_t>& values, UInt_t flags )
-{
-  // Fill the map with 'values'. Depending on 'flags', the values vector
-  // is interpreted as a 4-, 5-, 6- or 7-tuple:
-  //
-  // The first 4 values are interpreted as (crate,slot,start_chan,end_chan)
-  // Each of the following flags causes one more value to be used as part of
-  // the tuple for each module:
-  // 
-  // kFillLogicalChannel - Logical channel number for 'start_chan'.
-  // kFillModel          - The module's hardware model number (see AddModule())
-  // kFillRefChan        - Reference channel (for pipeline TDCs etc.)
-  // kFillRefIndex       - Reference index (for pipeline TDCs etc.)
-  //
-  // If more than one flag is present, the numbers will be interpreted
-  // in the order the flags are listed above. 
-  // Example:
-  //      flags = kFillModel | kFillRefChan
-  // ==>
-  //      the vector is interpreted as a series of 6-tuples in the order
-  //      (crate,slot,start_chan,end_chan,model,refchan).
-  //
-  // If kFillLogicalChannel is not set then the first logical channel numbers
-  // are automatically calculated for each module, assuming the numbers are 
-  // sequential.
-  // 
-  // By default, an existing map is overwritten. If the flag kDoNotClear 
-  // is present, then the data are appended.
-  //
-  // The return value is the number of modules successfully added,
-  // or negative if an error occurred.
-
-  typedef vector<Int_t>::size_type vsiz_t;
-
-  if( (flags & kDoNotClear) == 0 )
-    Clear();
-
-  vsiz_t tuple_size = 4;
-  if( flags & kFillLogicalChannel )
-    tuple_size++;
-  if( flags & kFillModel )
-    tuple_size++;
-  if( flags & kFillRefChan )
-    tuple_size++;
-  if( flags & kFillRefIndex )
-    tuple_size++;
-
-  UInt_t prev_first = 0, prev_nchan = 0;
-  // Defaults for optional values
-  UInt_t first = 0, model = 0;
-  Int_t rchan = -1, ref = -1;
-
-  Int_t ret = 0;
-  for( vsiz_t i = 0; i < values.size(); i += tuple_size ) {
-    // For compatibility with older maps, crate < 0 means end of data
-    if( values[i] < 0 )
-      break;
-    // Now we require a full tuple
-    if( i+tuple_size > values.size() ) {
-      ret = -127;
-      break;
-    }
-
-    vsiz_t k = 4;
-    if( flags & kFillLogicalChannel )
-      first = values[i+k++];
-    else {
-      first = prev_first + prev_nchan;
-    }
-    if( flags & kFillModel )
-      model = values[i+k++];
-    if( flags & kFillRefChan )
-      rchan = values[i+k++];
-    if( flags & kFillRefIndex )
-      ref   = values[i+k++];
-
-    ret = AddModule( values[i], values[i+1], values[i+2], values[i+3],
-		     first, model, ref, rchan );
-    if( ret<=0 )
-      break;
-    prev_first = first;
-    prev_nchan = GetNchan( ret-1 );
-  }
-  
-  return ret;
-}
-
-//_____________________________________________________________________________
-Int_t THaDetMap::GetTotNumChan() const
-{
-  // Get sum of the number of channels of all modules in the map. This is 
-  // typically the total number of hardware channels used by the detector.
-
-  Int_t sum = 0;
-  for( UShort_t i = 0; i < fNmodules; i++ )
-    sum += GetNchan(i);
-    
-  return sum;
-}
-
-
-//_____________________________________________________________________________
-void THaDetMap::GetMinMaxChan( Int_t& min, Int_t& max, ECountMode mode ) const
-{
-  // Put the minimum and maximum logical or reference channel numbers 
-  // into min and max. If refidx is true, check refindex, else check logical
-  // channel numbers.
-
-  min = kMaxInt;
-  max = kMinInt;
-  bool do_ref = ( mode == kRefIndex );
-  for( UShort_t i = 0; i < fNmodules; i++ ) {
-    Module* m = GetModule(i);
-    Int_t m_min = do_ref ? m->refindex : m->first;
-    Int_t m_max = do_ref ? m->refindex : m->first + m->hi - m->lo;
-    if( m_min < min )
-      min = m_min;
-    if( m_max > max )
-      max = m_max;
-  }
-}
-
-
-//_____________________________________________________________________________
-void THaDetMap::Print( Option_t* ) const
-{
-  // Print the contents of the map
-
-  cout << "Size: " << fNmodules << endl;
-  for( UShort_t i=0; i<fNmodules; i++ ) {
-    Module* m = GetModule(i);
-    cout << " " 
-	 << setw(5) << m->crate
-	 << setw(5) << m->slot 
-	 << setw(5) << m->lo 
-	 << setw(5) << m->hi 
-	 << setw(5) << m->first
-	 << setw(5) << GetModel(m);
-    if( IsADC(m) )
-      cout << setw(4) << " ADC";
-    if( IsTDC(m) )
-      cout << setw(4) << " TDC";
-    cout << setw(5) << m->refchan
-	 << setw(5) << m->refindex
-	 << setw(8) << m->resolution
-	 << endl;
-  }
-}
-
-//_____________________________________________________________________________
-void THaDetMap::Reset()
-{
-  // Clear() the map and reset the array size to zero, freeing memory.
-
-  Clear();
-  delete [] fMap;
-  fMap = NULL;
-  fMaplength = 0;
-}
-
-//_____________________________________________________________________________
-static int compare_modules( const void* p1, const void* p2 )
-{
-  // Helper function for sort
-
-  const THaDetMap::Module* lhs = static_cast<const THaDetMap::Module*>(p1);
-  const THaDetMap::Module* rhs = static_cast<const THaDetMap::Module*>(p2);
-  
-  if( lhs->crate < rhs->crate )  return -1;
-  if( lhs->crate > rhs->crate )  return  1;
-  if( lhs->slot < rhs->slot )    return -1;
-  if( lhs->slot > rhs->slot )    return  1;
-  if( lhs->lo < rhs->lo )        return -1;
-  if( lhs->lo > rhs->lo )        return  1;
-  return 0;
-}
-
-//_____________________________________________________________________________
-void THaDetMap::Sort()
-{
-  // Sort the map by crate/slot/low channel
-  
-  if( fMap && fNmodules )
-    qsort( fMap, fNmodules, sizeof(Module), compare_modules );
-
-}
-
-//_____________________________________________________________________________
-ClassImp(THaDetMap)
-
+//*-- Author :    Ole Hansen   16/05/00
+
+//////////////////////////////////////////////////////////////////////////
+//
+// THcDetMap
+//
+// The standard detector map for a Hall A detector.
+//
+//////////////////////////////////////////////////////////////////////////
+
+#include "THcDetMap.h"
+#include <iostream>
+#include <iomanip>
+#include <cstring>
+#include <cstdlib>
+
+using namespace std;
+
+const int THcDetMap::kDetMapSize;
+
+// FIXME: load from db_cratemap
+struct ModuleType {
+  UInt_t  model;       // model identifier
+  Bool_t  adc;         // true if ADC
+  Bool_t  tdc;         // true if TDC
+};
+
+static const ModuleType module_list[] = {
+  { 1875, 0, 1 },
+  { 1877, 0, 1 },
+  { 1881, 1, 0 },
+  { 1872, 0, 1 },
+  { 3123, 1, 0 },
+  { 1182, 1, 0 },
+  {  792, 1, 0 },
+  {  775, 0, 1 },
+  {  767, 0, 1 },
+  { 3201, 0, 1 },
+  { 6401, 0, 1 },
+  { 1190, 0, 1 },
+  { 0 }
+};
+
+//_____________________________________________________________________________
+void THcDetMap::Module::SetModel( UInt_t m )
+{
+  model = m & kModelMask;
+  const ModuleType* md = module_list;
+  while ( md->model && model != md->model ) md++;
+  if( md->adc ) MakeADC();
+  if( md->tdc ) MakeTDC();
+}
+
+//_____________________________________________________________________________
+void THcDetMap::Module::SetResolution( Double_t res )
+{
+  resolution = res;
+}
+
+//_____________________________________________________________________________
+THcDetMap::THcDetMap() : fNmodules(0), fMap(0), fMaplength(0)
+{
+  // Default constructor. Creates an empty detector map.
+}
+
+//_____________________________________________________________________________
+THcDetMap::THcDetMap( const THcDetMap& rhs )
+{
+  // Copy constructor
+
+  fMaplength = rhs.fMaplength;
+  fNmodules  = rhs.fNmodules;
+  if( fMaplength > 0 ) {
+    fMap = new Module[fMaplength];
+    memcpy(fMap,rhs.fMap,fNmodules*sizeof(Module));
+  }
+}
+
+//_____________________________________________________________________________
+THcDetMap& THcDetMap::operator=( const THcDetMap& rhs )
+{
+  // THcDetMap assignment operator
+
+  if ( this != &rhs ) {
+    if ( fMaplength != rhs.fMaplength ) {
+      delete [] fMap;
+      fMaplength = rhs.fMaplength;
+      if( fMaplength > 0 )
+	fMap = new Module[fMaplength];
+    }
+    fNmodules = rhs.fNmodules;
+    memcpy(fMap,rhs.fMap,fNmodules*sizeof(Module));
+  }
+  return *this;
+}
+
+//_____________________________________________________________________________
+THcDetMap::~THcDetMap()
+{
+  // Destructor
+
+  delete [] fMap;
+}
+
+//_____________________________________________________________________________
+Int_t THcDetMap::AddModule( UShort_t crate, UShort_t slot, 
+			    UShort_t chan_lo, UShort_t chan_hi,
+			    UInt_t first, UInt_t model, Int_t refindex,
+			    Int_t refchan )
+{
+  // Add a module to the map.
+
+  if( fNmodules >= kDetMapSize ) return -1;  //Map is full
+  // Logical channels can run either "with" or "against" the physical channel
+  // numbers:
+  // lo<=hi :    lo -> first
+  //             hi -> first+hi-lo
+  // 
+  // lo>hi  :    hi -> first
+  //             lo -> first+lo-hi
+  // 
+  // To indicate the second case, The flag "reverse" is set to true in the 
+  // module. The fields lo and hi are reversed so that lo<=hi always.
+  // 
+  bool reverse = ( chan_lo > chan_hi );
+
+  if ( fNmodules >= fMaplength ) { // need to expand the Map
+    Int_t oldlen = fMaplength;
+    fMaplength += 10;
+    Module* tmpmap = new Module[fMaplength];   // expand in groups of 10
+    if( oldlen > 0 ) {
+      memcpy(tmpmap,fMap,oldlen*sizeof(Module));
+      delete [] fMap;
+    }
+    fMap = tmpmap;
+  }
+
+  Module& m = fMap[fNmodules];
+  m.crate = crate;
+  m.slot  = slot;
+  if( reverse ) {
+    m.lo = chan_hi;
+    m.hi = chan_lo;
+  } else {
+    m.lo = chan_lo;
+    m.hi = chan_hi;
+  }
+  m.first = first;
+  m.SetModel( model );
+  m.refindex = refindex;
+  m.refchan  = refchan;
+  m.SetResolution( 0.0 );
+  m.reverse = reverse;
+
+  return ++fNmodules;
+}
+
+//_____________________________________________________________________________
+THcDetMap::Module* THcDetMap::Find( UShort_t crate, UShort_t slot,
+				    UShort_t chan )
+{
+  // Return the module containing crate, slot, and channel chan.
+  // If several matching modules exist (which mean the map is misconfigured),
+  // only the first one is returned. If none match, return NULL.
+  // Since the map is usually small and not necessarily sorted, a simple
+  // linear search is done.
+
+  Module* found = NULL;
+  for( UShort_t i = 0; i < fNmodules; ++i ) {
+    Module* d = uGetModule(i);
+    if( d->crate == crate && d->slot == slot && 
+	d->lo <= chan && chan <= d->hi ) {
+      found = d;
+      break;
+    }
+  }
+  return found;
+}
+
+//_____________________________________________________________________________
+Int_t THcDetMap::Fill( const vector<Int_t>& values, UInt_t flags )
+{
+  // Fill the map with 'values'. Depending on 'flags', the values vector
+  // is interpreted as a 4-, 5-, 6- or 7-tuple:
+  //
+  // The first 4 values are interpreted as (crate,slot,start_chan,end_chan)
+  // Each of the following flags causes one more value to be used as part of
+  // the tuple for each module:
+  // 
+  // kFillLogicalChannel - Logical channel number for 'start_chan'.
+  // kFillModel          - The module's hardware model number (see AddModule())
+  // kFillRefChan        - Reference channel (for pipeline TDCs etc.)
+  // kFillRefIndex       - Reference index (for pipeline TDCs etc.)
+  //
+  // If more than one flag is present, the numbers will be interpreted
+  // in the order the flags are listed above. 
+  // Example:
+  //      flags = kFillModel | kFillRefChan
+  // ==>
+  //      the vector is interpreted as a series of 6-tuples in the order
+  //      (crate,slot,start_chan,end_chan,model,refchan).
+  //
+  // If kFillLogicalChannel is not set then the first logical channel numbers
+  // are automatically calculated for each module, assuming the numbers are 
+  // sequential.
+  // 
+  // By default, an existing map is overwritten. If the flag kDoNotClear 
+  // is present, then the data are appended.
+  //
+  // The return value is the number of modules successfully added,
+  // or negative if an error occurred.
+
+  typedef vector<Int_t>::size_type vsiz_t;
+
+  if( (flags & kDoNotClear) == 0 )
+    Clear();
+
+  vsiz_t tuple_size = 4;
+  if( flags & kFillLogicalChannel )
+    tuple_size++;
+  if( flags & kFillModel )
+    tuple_size++;
+  if( flags & kFillRefChan )
+    tuple_size++;
+  if( flags & kFillRefIndex )
+    tuple_size++;
+
+  UInt_t prev_first = 0, prev_nchan = 0;
+  // Defaults for optional values
+  UInt_t first = 0, model = 0;
+  Int_t rchan = -1, ref = -1;
+
+  Int_t ret = 0;
+  for( vsiz_t i = 0; i < values.size(); i += tuple_size ) {
+    // For compatibility with older maps, crate < 0 means end of data
+    if( values[i] < 0 )
+      break;
+    // Now we require a full tuple
+    if( i+tuple_size > values.size() ) {
+      ret = -127;
+      break;
+    }
+
+    vsiz_t k = 4;
+    if( flags & kFillLogicalChannel )
+      first = values[i+k++];
+    else {
+      first = prev_first + prev_nchan;
+    }
+    if( flags & kFillModel )
+      model = values[i+k++];
+    if( flags & kFillRefChan )
+      rchan = values[i+k++];
+    if( flags & kFillRefIndex )
+      ref   = values[i+k++];
+
+    ret = AddModule( values[i], values[i+1], values[i+2], values[i+3],
+		     first, model, ref, rchan );
+    if( ret<=0 )
+      break;
+    prev_first = first;
+    prev_nchan = GetNchan( ret-1 );
+  }
+  
+  return ret;
+}
+
+//_____________________________________________________________________________
+Int_t THcDetMap::GetTotNumChan() const
+{
+  // Get sum of the number of channels of all modules in the map. This is 
+  // typically the total number of hardware channels used by the detector.
+
+  Int_t sum = 0;
+  for( UShort_t i = 0; i < fNmodules; i++ )
+    sum += GetNchan(i);
+    
+  return sum;
+}
+
+
+//_____________________________________________________________________________
+void THcDetMap::GetMinMaxChan( Int_t& min, Int_t& max, ECountMode mode ) const
+{
+  // Put the minimum and maximum logical or reference channel numbers 
+  // into min and max. If refidx is true, check refindex, else check logical
+  // channel numbers.
+
+  min = kMaxInt;
+  max = kMinInt;
+  bool do_ref = ( mode == kRefIndex );
+  for( UShort_t i = 0; i < fNmodules; i++ ) {
+    Module* m = GetModule(i);
+    Int_t m_min = do_ref ? m->refindex : m->first;
+    Int_t m_max = do_ref ? m->refindex : m->first + m->hi - m->lo;
+    if( m_min < min )
+      min = m_min;
+    if( m_max > max )
+      max = m_max;
+  }
+}
+
+
+//_____________________________________________________________________________
+void THcDetMap::Print( Option_t* ) const
+{
+  // Print the contents of the map
+
+  cout << "Size: " << fNmodules << endl;
+  for( UShort_t i=0; i<fNmodules; i++ ) {
+    Module* m = GetModule(i);
+    cout << " " 
+	 << setw(5) << m->crate
+	 << setw(5) << m->slot 
+	 << setw(5) << m->lo 
+	 << setw(5) << m->hi 
+	 << setw(5) << m->first
+	 << setw(5) << GetModel(m);
+    if( IsADC(m) )
+      cout << setw(4) << " ADC";
+    if( IsTDC(m) )
+      cout << setw(4) << " TDC";
+    cout << setw(5) << m->refchan
+	 << setw(5) << m->refindex
+	 << setw(8) << m->resolution
+	 << endl;
+  }
+}
+
+//_____________________________________________________________________________
+void THcDetMap::Reset()
+{
+  // Clear() the map and reset the array size to zero, freeing memory.
+
+  Clear();
+  delete [] fMap;
+  fMap = NULL;
+  fMaplength = 0;
+}
+
+//_____________________________________________________________________________
+static int compare_modules( const void* p1, const void* p2 )
+{
+  // Helper function for sort
+
+  const THcDetMap::Module* lhs = static_cast<const THcDetMap::Module*>(p1);
+  const THcDetMap::Module* rhs = static_cast<const THcDetMap::Module*>(p2);
+  
+  if( lhs->crate < rhs->crate )  return -1;
+  if( lhs->crate > rhs->crate )  return  1;
+  if( lhs->slot < rhs->slot )    return -1;
+  if( lhs->slot > rhs->slot )    return  1;
+  if( lhs->lo < rhs->lo )        return -1;
+  if( lhs->lo > rhs->lo )        return  1;
+  return 0;
+}
+
+//_____________________________________________________________________________
+void THcDetMap::Sort()
+{
+  // Sort the map by crate/slot/low channel
+  
+  if( fMap && fNmodules )
+    qsort( fMap, fNmodules, sizeof(Module), compare_modules );
+
+}
+
+//_____________________________________________________________________________
+ClassImp(THcDetMap)
+
diff --git a/src/THcDetMap.h b/src/THcDetMap.h
index 317bc0072e3d7aa9faf52252783fde658aaf133a..f353909b355647f494f03ecd29a9afcf31d5c6e7 100644
--- a/src/THcDetMap.h
+++ b/src/THcDetMap.h
@@ -1,10 +1,10 @@
 
-#ifndef ROOT_THaDetMap
-#define ROOT_THaDetMap
+#ifndef ROOT_THcDetMap
+#define ROOT_THcDetMap
 
 //////////////////////////////////////////////////////////////////////////
 //
-// THaDetMap
+// THcDetMap
 //
 // Standard detector map.
 // The detector map defines the hardware channels that correspond to a
@@ -23,7 +23,7 @@
 #include "Rtypes.h"
 #include <vector>
 
-class THaDetMap {
+class THcDetMap {
 
 protected:
   static const UInt_t kADCBit = BIT(31);
@@ -38,6 +38,8 @@ public:
     UShort_t lo;
     UShort_t hi;
     UInt_t   first;  // logical number of first channel
+    UInt_t   plane;  // Plane of detector
+    UInt_t   signal; // Signal type (ADC/TDC/Left/Right)
     UInt_t   model;  // model number of module (for ADC/TDC identification).
     Int_t    refchan;    // for pipeline TDCs: reference channel number
     Int_t    refindex;   // for pipeline TDCs: index into reference channel map
@@ -72,10 +74,10 @@ public:
     kFillRefChan         = BIT(13)    // Parse the reference channel
   };
 
-  THaDetMap();
-  THaDetMap( const THaDetMap& );
-  THaDetMap& operator=( const THaDetMap& );
-  virtual ~THaDetMap();
+  THcDetMap();
+  THcDetMap( const THcDetMap& );
+  THcDetMap& operator=( const THcDetMap& );
+  virtual ~THcDetMap();
   
   virtual Int_t     AddModule( UShort_t crate, UShort_t slot, 
 			       UShort_t chan_lo, UShort_t chan_hi,
@@ -115,44 +117,44 @@ protected:
   
   Module*      uGetModule( UShort_t i ) const { return fMap+i; }
 
-  ClassDef(THaDetMap,0)   //The standard detector map
+  ClassDef(THcDetMap,0)   //The standard detector map
 };
 
-inline THaDetMap::Module* THaDetMap::GetModule( UShort_t i ) const {
+inline THcDetMap::Module* THcDetMap::GetModule( UShort_t i ) const {
   return i<fNmodules ? uGetModule(i) : NULL; 
 }
 
-inline Bool_t THaDetMap::IsADC(Module* d) {
+inline Bool_t THcDetMap::IsADC(Module* d) {
   if( !d ) return kFALSE;
   return d->IsADC();
 }
 
-inline Bool_t THaDetMap::IsTDC(Module* d) {
+inline Bool_t THcDetMap::IsTDC(Module* d) {
   if( !d ) return kFALSE;
   return d->IsTDC();
 }
 
-inline UInt_t THaDetMap::GetModel(Module* d) {
+inline UInt_t THcDetMap::GetModel(Module* d) {
   if( !d ) return 0;
   return d->GetModel();
 }
 
-inline Bool_t THaDetMap::IsADC( UShort_t i ) const {
+inline Bool_t THcDetMap::IsADC( UShort_t i ) const {
   if( i >= fNmodules ) return kFALSE;
   return uGetModule(i)->IsADC();
 }
 
-inline Bool_t THaDetMap::IsTDC( UShort_t i ) const {
+inline Bool_t THcDetMap::IsTDC( UShort_t i ) const {
   if( i >= fNmodules ) return kFALSE;
   return uGetModule(i)->IsTDC();
 }
 
-inline UInt_t THaDetMap::GetModel( UShort_t i ) const {
+inline UInt_t THcDetMap::GetModel( UShort_t i ) const {
   if( i >= fNmodules ) return 0;
   return uGetModule(i)->GetModel();
 }
 
-inline Int_t THaDetMap::GetNchan( UShort_t i ) const {
+inline Int_t THcDetMap::GetNchan( UShort_t i ) const {
   // Return the number of channels of the i-th module
   if( i >= fNmodules ) return 0;
   return uGetModule(i)->GetNchan();
diff --git a/src/THcDetectorBase.cxx b/src/THcDetectorBase.cxx
index 08224b4c010faff0e2dc2c054d5cac5d6937a5e3..f3adde0c649559888127f4803783693a18d41555 100644
--- a/src/THcDetectorBase.cxx
+++ b/src/THcDetectorBase.cxx
@@ -5,17 +5,28 @@
 // THcDetectorBase
 //
 // Add hitlist to the Hall A detector base
+// May not need to inherit from THaDetectorBase since we may end up
+// replacing most of the methods
 //
 //////////////////////////////////////////////////////////////////////////
 
 #include "ThcDetectorBase.h"
+#include "THcDetMap.h"
 
 using namespace std;
 
 THcDetectorBase::THcDetectorBase( const char* name,
 				  const char* description ) :
-  THaDetectorBase(name, description)
+  THaAnalysisObject(name, description), fNelem(0)
 {
+  // Normal constructor. Creates an empty detector map.
+  // Later can use THaDetectorBase if signal and plane info
+  // is added to the THaDetMap in podd.
+
+  fSize[0] = fSize[1] = fSize[2] = 0.0;
+  fDetMap = new THcDetMap;
+  fRawHitList = NULL;
+
 }
 
 THcDetectorBase::THcDetectorBase() : THaDetectorBase() {
@@ -24,4 +35,54 @@ THcDetectorBase::THcDetectorBase() : THaDetectorBase() {
 THcDetectorBase::~THcDetectorBase() : ~THaDetectorBase() {
 }
 
+THcDetectorBase::InitHitlist(const char *hitclass, Int_T maxhits) {
+  // Probably called by ReadDatabase
+  fRawHitList = new TClonesArray(hitclass, maxhits);
+}
+   
+
+THcDetectorBase::Decode( THaEvData& evdata )
+{
+  THcRawHit* rawhit;
+  fRawHitList->Clear("C");
+  
+  for ( Int_t i=0; i < fDetMap->GetSize(); i++ ) {
+    THaDetMap::Module* d = fDetMap->GetModule(i);
+
+    // Loop over all channels that have a hit.
+    for ( Int_t j=0; j < evdata.GetNumChan( d->crate, d->slot); j++) {
+      
+      Int_t chan = evdata.GetNextChan( d->crate, d->slot, j );
+      if( chan < d->lo || chan > d->hi ) continue;     // Not one of my channels
+      
+      // Need to convert crate, slot, chan into plane, counter, signal
+      // Search hitlist for this plane,counter,signal
+      Int_t plane = d->plane;
+      Int_t signal = d->signal;
+      Int_t counter = d->reverse ? d->first + d->hi - chan : d->first + chan - d->lo;
+	
+      // Allow for multiple hits
+      Int_t nHits = evData.GetNumHits(d->crate, d->slot, chan);
+      // Get the data. Scintillators are assumed to have only single hit (hit=0)
+
+      
+
+      for (Int_t hit = 0; hit < nHits; hit++) {
+	Int_t data = evdata.GetData( d->crate, d->slot, chan, hit);
+
+
+  while( raw data) {
+    // Get a data word
+    // Get plane, counter, signal
+    // Search list for that plane counter
+    // if(plane,counter hit doesn't exist) {
+    //   rawhit = fRawHitList[i];
+    // } else {
+    //   rawhit = static_cast(THcRawHit*>( fRawHitClass->New() );
+    // }
+    // rawhit->AddSignal(isignal) = datavalue;
+  }
+}
+
+
 ClassImp(THcDetectorBase)
diff --git a/src/THcDetectorBase.h b/src/THcDetectorBase.h
index 91687beb036368db38cd9a8aebee3fcf0b9bdbec..a735568a73aba4caca75da7fb10e68f8dbfc0fa2 100644
--- a/src/THcDetectorBase.h
+++ b/src/THcDetectorBase.h
@@ -2,6 +2,11 @@
 #define ROOT_THcDetectorBase
 
 #include "THaDetectorBase.h"
+#include "THcRawHit.h"
+#include "TClonesArray.h"
+
+
+using namespace std;
 
 //////////////////////////////////////////////////////////////////////////
 //
@@ -9,6 +14,8 @@
 //
 //////////////////////////////////////////////////////////////////////////
 
+class THcDetMap;
+
 class THcDetectorBase : public THaDetectorBase {
 
  public:
@@ -17,6 +24,13 @@ class THcDetectorBase : public THaDetectorBase {
 
   THaDetectorBase(); // only for ROOT I/O
 
+  // This is a list of pointers to hit objects
+  // Instead should we have a list of the actual objects so that we are
+  // no delting and creating objects all the time.
+  //
+  TClonesArray* fRawHitList; // List of raw hits
+  TClass* fRawHitCLass;		  // Class of raw hit object to use
+
  protected:
 
   ClassDef(ThcDetectorBase,0)