Skip to content
Snippets Groups Projects
Commit 4b251dee authored by Stephen A. Wood's avatar Stephen A. Wood
Browse files

THcDetector is identical to THaDetector except that it inherits

from THcDetectorBase
parent 6e07ac14
No related branches found
No related tags found
No related merge requests found
......@@ -10,7 +10,7 @@
SRC = src/THcInterface.cxx src/THcParmList.cxx src/THcAnalyzer.cxx \
src/THcHodoscopeHit.cxx src/THcRawHit.cxx \
src/THcDetectorBase.cxx
src/THcDetectorBase.cxx src/THcDetector.cxx
# Name of your package.
# The shared library that will be built will get the name lib$(PACKAGE).so
......
......@@ -12,5 +12,6 @@
#pragma link C++ class THcRawHit+;
#pragma link C++ class THcHodoscopeHit+;
#pragma link C++ class THcDetectorBase+;
#pragma link C++ class THcDetector+;
#endif
//*-- Author : Ole Hansen 15-May-00
//////////////////////////////////////////////////////////////////////////
//
// THcDetector
//
//////////////////////////////////////////////////////////////////////////
#include "THcDetector.h"
#include "THaApparatus.h"
ClassImp(THcDetector)
//_____________________________________________________________________________
THcDetector::THcDetector( const char* name, const char* description,
THaApparatus* apparatus )
: THcDetectorBase(name,description), fApparatus(apparatus)
{
// Constructor
if( !name || !*name ) {
Error( "THcDetector()", "Must construct detector with valid name! "
"Object construction failed." );
MakeZombie();
return;
}
}
//_____________________________________________________________________________
THcDetector::THcDetector( ) : fApparatus(0) {
// for ROOT I/O only
}
//_____________________________________________________________________________
THcDetector::~THcDetector()
{
// Destructor
}
//_____________________________________________________________________________
void THcDetector::SetApparatus( THaApparatus* apparatus )
{
// Associate this detector with the given apparatus.
// Only possible before initialization.
if( IsInit() ) {
Warning( Here("SetApparatus()"), "Cannot set apparatus. "
"Object already initialized.");
return;
}
fApparatus = apparatus;
}
//_____________________________________________________________________________
void THcDetector::MakePrefix()
{
// Set up name prefix for global variables. Internal function called
// during initialization.
const char* basename = NULL;
THaApparatus *app = GetApparatus();
if( app )
basename = app->GetName();
THcDetectorBase::MakePrefix( basename );
}
#ifndef ROOT_THcDetector
#define ROOT_THcDetector
//////////////////////////////////////////////////////////////////////////
//
// THcDetector
//
// Abstract base class for a generic Hall C detector. This class
// describes an actual detector (not subdetector) and can be added to
// an apparatus.
//
//////////////////////////////////////////////////////////////////////////
#include "THcDetectorBase.h"
#include <TRef.h>
#include "THaApparatus.h"
//class THaApparatus;
class THcDetector : public THcDetectorBase {
public:
virtual ~THcDetector();
THaApparatus* GetApparatus() const {
return static_cast<THaApparatus*>(fApparatus.GetObject());
}
virtual void SetApparatus( THaApparatus* );
THcDetector(); // for ROOT I/O only
protected:
virtual void MakePrefix();
//Only derived classes may construct me
THcDetector( const char* name, const char* description,
THaApparatus* apparatus = NULL );
private:
TRef fApparatus; // Apparatus containing this detector
ClassDef(THcDetector,0) //Abstract base class for a Hall C detector
};
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment