From 425d2d87bfc117eda6f9d5268f87c0c4cc771b8a Mon Sep 17 00:00:00 2001 From: "Stephen A. Wood" <saw@jlab.org> Date: Wed, 23 Nov 2016 09:26:02 -0500 Subject: [PATCH] Do gHcDetectorMap->FillMap before InitHitList in detector classes Otherwise InitHistlist doesn't have the detector map and can't do setup of reference time stuff or sanity checks on the detector mapping --- src/THcAerogel.cxx | 17 +++++++++-------- src/THcCherenkov.cxx | 16 ++++++++-------- src/THcDC.cxx | 18 +++++++++--------- src/THcHodoscope.cxx | 19 +++++++++---------- src/THcRaster.cxx | 12 ++++++------ src/THcShower.cxx | 18 +++++++++--------- 6 files changed, 50 insertions(+), 50 deletions(-) diff --git a/src/THcAerogel.cxx b/src/THcAerogel.cxx index af259a3..4b2559c 100644 --- a/src/THcAerogel.cxx +++ b/src/THcAerogel.cxx @@ -140,15 +140,8 @@ void THcAerogel::DeleteArrays() //_____________________________________________________________________________ THaAnalysisObject::EStatus THcAerogel::Init( const TDatime& date ) { - cout << "THcAerogel::Init " << GetName() << endl; - - // Should probably put this in ReadDatabase as we will know the - // maximum number of hits after setting up the detector map - InitHitList(fDetMap, "THcAerogelHit", 100); - EStatus status; - if( (status = THaNonTrackingDetector::Init( date )) ) - return fStatus=status; + cout << "THcAerogel::Init " << GetName() << endl; char EngineDID[] = "xAERO"; EngineDID[0] = toupper(GetApparatus()->GetName()[0]); @@ -158,6 +151,14 @@ THaAnalysisObject::EStatus THcAerogel::Init( const TDatime& date ) return kInitError; } + // Should probably put this in ReadDatabase as we will know the + // maximum number of hits after setting up the detector map + InitHitList(fDetMap, "THcAerogelHit", fDetMap->GetTotNumChan()+1); + + EStatus status; + if( (status = THaNonTrackingDetector::Init( date )) ) + return fStatus=status; + return fStatus = kOK; } diff --git a/src/THcCherenkov.cxx b/src/THcCherenkov.cxx index 44531d9..6fc3c9d 100644 --- a/src/THcCherenkov.cxx +++ b/src/THcCherenkov.cxx @@ -115,14 +115,6 @@ THaAnalysisObject::EStatus THcCherenkov::Init( const TDatime& date ) cout << "THcCherenkov::Init " << GetName() << endl; - // Should probably put this in ReadDatabase as we will know the - // maximum number of hits after setting up the detector map - InitHitList(fDetMap, "THcCherenkovHit", 100); // 100 is max hits - - EStatus status; - if( (status = THaNonTrackingDetector::Init( date )) ) - return fStatus=status; - char EngineDID[] = "xCER"; EngineDID[0] = toupper(GetApparatus()->GetName()[0]); if( gHcDetectorMap->FillMap(fDetMap, EngineDID) < 0 ) { @@ -131,6 +123,14 @@ THaAnalysisObject::EStatus THcCherenkov::Init( const TDatime& date ) return kInitError; } + // Should probably put this in ReadDatabase as we will know the + // maximum number of hits after setting up the detector map + InitHitList(fDetMap, "THcCherenkovHit", fDetMap->GetTotNumChan()+1); + + EStatus status; + if( (status = THaNonTrackingDetector::Init( date )) ) + return fStatus=status; + return fStatus = kOK; } diff --git a/src/THcDC.cxx b/src/THcDC.cxx index 3bdbda0..1c686ca 100644 --- a/src/THcDC.cxx +++ b/src/THcDC.cxx @@ -178,9 +178,17 @@ THaAnalysisObject::EStatus THcDC::Init( const TDatime& date ) Setup(GetName(), GetTitle()); // Create the subdetectors here EffInit(); + char EngineDID[] = "xDC"; + 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; + } + // Should probably put this in ReadDatabase as we will know the // maximum number of hits after setting up the detector map - InitHitList(fDetMap, "THcRawDCHit", 1000); + InitHitList(fDetMap, "THcRawDCHit", fDetMap->GetTotNumChan()+1); EStatus status; // This triggers call of ReadDatabase and DefineVariables @@ -217,14 +225,6 @@ THaAnalysisObject::EStatus THcDC::Init( const TDatime& date ) // }; // memcpy( fDataDest, tmp, NDEST*sizeof(DataDest) ); - char EngineDID[] = "xDC"; - 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/THcHodoscope.cxx b/src/THcHodoscope.cxx index ed72787..c22b1d9 100644 --- a/src/THcHodoscope.cxx +++ b/src/THcHodoscope.cxx @@ -173,13 +173,20 @@ THaAnalysisObject::EStatus THcHodoscope::Init( const TDatime& date ) cout << "In THcHodoscope::Init()" << endl; Setup(GetName(), GetTitle()); + 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; + } + // Should probably put this in ReadDatabase as we will know the // maximum number of hits after setting up the detector map // But it needs to happen before the sub detectors are initialized // so that they can get the pointer to the hitlist. - - InitHitList(fDetMap, "THcRawHodoHit", 100); + InitHitList(fDetMap, "THcRawHodoHit", fDetMap->GetTotNumChan()+1); EStatus status; // This triggers call of ReadDatabase and DefineVariables @@ -199,14 +206,6 @@ THaAnalysisObject::EStatus THcHodoscope::Init( const TDatime& date ) // }; // memcpy( fDataDest, tmp, NDEST*sizeof(DataDest) ); - 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; - } - fNScinHits = new Int_t [fNPlanes]; fGoodPlaneTime = new Bool_t [fNPlanes]; fNPlaneTime = new Int_t [fNPlanes]; diff --git a/src/THcRaster.cxx b/src/THcRaster.cxx index ca66490..03bc550 100644 --- a/src/THcRaster.cxx +++ b/src/THcRaster.cxx @@ -139,12 +139,6 @@ THaAnalysisObject::EStatus THcRaster::Init( const TDatime& date ) { cout << "THcRaster::Init()" << endl; - THcHitList::InitHitList(fDetMap,"THcRasterRawHit",4); - - EStatus status; - if( (status = THaBeamDet::Init( date )) ) - return fStatus=status; - // Fill detector map with RASTER type channels if( gHcDetectorMap->FillMap(fDetMap, "RASTER") < 0 ) { static const char* const here = "Init()"; @@ -153,6 +147,12 @@ THaAnalysisObject::EStatus THcRaster::Init( const TDatime& date ) return kInitError; } + THcHitList::InitHitList(fDetMap,"THcRasterRawHit",fDetMap->GetTotNumChan()+1); + + EStatus status; + if( (status = THaBeamDet::Init( date )) ) + return fStatus=status; + return fStatus = kOK; } diff --git a/src/THcShower.cxx b/src/THcShower.cxx index 61cd8d2..1c7e447 100644 --- a/src/THcShower.cxx +++ b/src/THcShower.cxx @@ -130,10 +130,18 @@ THaAnalysisObject::EStatus THcShower::Init( const TDatime& date ) { Setup(GetName(), GetTitle()); + 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; + } + // Should probably put this in ReadDatabase as we will know the // maximum number of hits after setting up the detector map - InitHitList(fDetMap, "THcRawShowerHit", 100); + InitHitList(fDetMap, "THcRawShowerHit", fDetMap->GetTotNumChan()+1); EStatus status; if( (status = THaNonTrackingDetector::Init( date )) ) @@ -150,14 +158,6 @@ THaAnalysisObject::EStatus THcShower::Init( const TDatime& date ) } } - 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; - } - if(fHasArray) { cout << "THcShower::Init: adjustment of fiducial volume limits to the fly's eye part." << endl; cout << " Old limits:" << endl; -- GitLab