From 0e623d167b67378cd0766e8aa0d85c74a1f5808a Mon Sep 17 00:00:00 2001 From: "Stephen A. Wood" <saw@jlab.org> Date: Thu, 12 Apr 2012 17:08:55 -0400 Subject: [PATCH] Start writing a THcDetectorMap class to fill a THaDetMap from the Hall C style detector map. --- src/THcDetectorMap.cxx | 6 ++++++ src/THcDetectorMap.h | 9 +++++++++ src/THcHodoscope.cxx | 5 +++++ 3 files changed, 20 insertions(+) diff --git a/src/THcDetectorMap.cxx b/src/THcDetectorMap.cxx index 16c5377..710c5d2 100644 --- a/src/THcDetectorMap.cxx +++ b/src/THcDetectorMap.cxx @@ -32,6 +32,12 @@ inline static bool IsComment( const string& s, string::size_type pos ) (s[pos] == '!') ); } +virtual Int_t THcDetectorMap::FillMap(THaDetMap *detmap, string *detectorname) { + Int_t detectorid=3; // Get this from detectorname + + // Loop through the list looking for all hardware channels that + // are detectorid. Sort and try to minimize AddModule calls +} void THcDetectorMap::Load(const char *fname) { diff --git a/src/THcDetectorMap.h b/src/THcDetectorMap.h index 0bb4255..9d1b8c2 100644 --- a/src/THcDetectorMap.h +++ b/src/THcDetectorMap.h @@ -17,6 +17,15 @@ class THcDetectorMap : public TObject { virtual void Load(const char *fname); + // Member variables needed + // List of detector IDs. + // Hardware to logical detector mapping for each detector + // Mapping between detector names and numbers + // Hardwire, but later configure + struct Detector { + UInt_t did; // Numberical Detector ID + TList* + protected: ClassDef(THcDetectorMap,0); diff --git a/src/THcHodoscope.cxx b/src/THcHodoscope.cxx index a6cec15..074c900 100644 --- a/src/THcHodoscope.cxx +++ b/src/THcHodoscope.cxx @@ -68,6 +68,11 @@ THaAnalysisObject::EStatus THcHodoscope::Init( const TDatime& date ) // maximum number of hits after setting up the detector map THcHitList::InitHitList(fDetMap, "THcHodoscopeHit", 100); + if( gHcDetectorMap->FillMap("detectorname",fDetMap) < 0 ) { + Error( Here(here), "Error filling detectormap for %s.", + "detectorname"); + return kInitError; + } return fStatus = kOK; } -- GitLab