From 49724711e9f57ce684c2bc8269a1feab1b6eb201 Mon Sep 17 00:00:00 2001 From: Jure Bericic <bericic@jlab.org> Date: Tue, 15 Nov 2016 14:22:19 -0500 Subject: [PATCH] Unified filling of the gHcDetectorMap for all detector classes. Some detector classes lacked the ability to get the appropriate Apparatus character and were only working for HMS. --- src/THcAerogel.cxx | 11 +++++------ src/THcCherenkov.cxx | 12 ++++++------ src/THcDC.cxx | 14 +++----------- src/THcHodoscope.cxx | 7 +++---- src/THcShower.cxx | 8 +++----- 5 files changed, 20 insertions(+), 32 deletions(-) diff --git a/src/THcAerogel.cxx b/src/THcAerogel.cxx index 385f17b..af259a3 100644 --- a/src/THcAerogel.cxx +++ b/src/THcAerogel.cxx @@ -150,13 +150,12 @@ THaAnalysisObject::EStatus THcAerogel::Init( const TDatime& date ) if( (status = THaNonTrackingDetector::Init( date )) ) return fStatus=status; - // Will need to determine which apparatus it belongs to and use the - // appropriate detector ID in the FillMap call - if( gHcDetectorMap->FillMap(fDetMap, "HAERO") < 0 ) { + char EngineDID[] = "xAERO"; + EngineDID[0] = toupper(GetApparatus()->GetName()[0]); + if( gHcDetectorMap->FillMap(fDetMap, EngineDID) < 0 ) { static const char* const here = "Init()"; - Error( Here(here), "Error filling detectormap for %s.", - "HAERO"); - return kInitError; + Error( Here(here), "Error filling detectormap for %s.", EngineDID ); + return kInitError; } return fStatus = kOK; diff --git a/src/THcCherenkov.cxx b/src/THcCherenkov.cxx index b14ceca..44531d9 100644 --- a/src/THcCherenkov.cxx +++ b/src/THcCherenkov.cxx @@ -123,12 +123,12 @@ THaAnalysisObject::EStatus THcCherenkov::Init( const TDatime& date ) if( (status = THaNonTrackingDetector::Init( date )) ) return fStatus=status; - // Will need to determine which apparatus it belongs to and use the - // appropriate detector ID in the FillMap call - if( gHcDetectorMap->FillMap(fDetMap, "HCER") < 0 ) { - Error( Here(here), "Error filling detectormap for %s.", - "HCER"); - return kInitError; + char EngineDID[] = "xCER"; + EngineDID[0] = toupper(GetApparatus()->GetName()[0]); + if( gHcDetectorMap->FillMap(fDetMap, EngineDID) < 0 ) { + static const char* const here = "Init()"; + Error( Here(here), "Error filling detectormap for %s.", EngineDID ); + return kInitError; } return fStatus = kOK; diff --git a/src/THcDC.cxx b/src/THcDC.cxx index 6a481fe..3bdbda0 100644 --- a/src/THcDC.cxx +++ b/src/THcDC.cxx @@ -217,20 +217,12 @@ THaAnalysisObject::EStatus THcDC::Init( const TDatime& date ) // }; // memcpy( fDataDest, tmp, NDEST*sizeof(DataDest) ); - // Will need to determine which apparatus it belongs to and use the - // appropriate detector ID in the FillMap call - char EngineDID[4]; - + char EngineDID[] = "xDC"; EngineDID[0] = toupper(GetApparatus()->GetName()[0]); - EngineDID[1] = 'D'; - EngineDID[2] = 'C'; - EngineDID[3] = '\0'; - if( gHcDetectorMap->FillMap(fDetMap, EngineDID) < 0 ) { static const char* const here = "Init()"; - Error( Here(here), "Error filling detectormap for %s.", - EngineDID); - return kInitError; + Error( Here(here), "Error filling detectormap for %s.", EngineDID ); + return kInitError; } return fStatus = kOK; diff --git a/src/THcHodoscope.cxx b/src/THcHodoscope.cxx index e9e571f..ed72787 100644 --- a/src/THcHodoscope.cxx +++ b/src/THcHodoscope.cxx @@ -199,13 +199,12 @@ THaAnalysisObject::EStatus THcHodoscope::Init( const TDatime& date ) // }; // memcpy( fDataDest, tmp, NDEST*sizeof(DataDest) ); - char EngineDID[]="xSCIN"; + char EngineDID[] = "xSCIN"; EngineDID[0] = toupper(GetApparatus()->GetName()[0]); if( gHcDetectorMap->FillMap(fDetMap, EngineDID) < 0 ) { static const char* const here = "Init()"; - Error( Here(here), "Error filling detectormap for %s.", - EngineDID); - return kInitError; + Error( Here(here), "Error filling detectormap for %s.", EngineDID ); + return kInitError; } fNScinHits = new Int_t [fNPlanes]; diff --git a/src/THcShower.cxx b/src/THcShower.cxx index c62c2f5..61cd8d2 100644 --- a/src/THcShower.cxx +++ b/src/THcShower.cxx @@ -150,14 +150,12 @@ THaAnalysisObject::EStatus THcShower::Init( const TDatime& date ) } } - char EngineDID[] = " CAL"; + char EngineDID[] = "xCAL"; EngineDID[0] = toupper(GetApparatus()->GetName()[0]); - if( gHcDetectorMap->FillMap(fDetMap, EngineDID) < 0 ) { static const char* const here = "Init()"; - Error( Here(here), "Error filling detectormap for %s.", - EngineDID); - return kInitError; + Error( Here(here), "Error filling detectormap for %s.", EngineDID ); + return kInitError; } if(fHasArray) { -- GitLab