//*-- Author :    Vincent Sulkosky and R. Feuerbach,  Jan 2006
// Changed to an abstract base class, Ole Hansen, Aug 2006
////////////////////////////////////////////////////////////////////////
//
// THaHelicityDet
//
// Base class for a beam helicity detector.
//
////////////////////////////////////////////////////////////////////////


#include "THaHelicityDet.h"

using namespace std;

//_____________________________________________________________________________
THaHelicityDet::THaHelicityDet( const char* name, const char* description ,
				THaApparatus* apparatus )
  : THaDetector( name, description, apparatus ), fHelicity(kUnknown), fSign(1)
{
  // Constructor
}

//_____________________________________________________________________________
THaHelicityDet::~THaHelicityDet()
{
  // Destructor
}

//_____________________________________________________________________________
Int_t THaHelicityDet::DefineVariables( EMode mode )
{
  // Initialize global variables

  if( mode == kDefine && fIsSetup ) return kOK;
  fIsSetup = ( mode == kDefine );

  const RVarDef var[] = {
    { "helicity", "Beam helicity",  "fHelicity" },
    { 0 }
  };
  return DefineVarsFromList( var, mode );
}

//_____________________________________________________________________________
const char* THaHelicityDet::GetDBFileName() const
{
  // All helicity detectors read from db_hel.dat by default. Database
  // keys should (but do not have to) be prefixed by each detector's prefix,
  // e.g. L.adchel.detmap

  return "hel.";
}

//_____________________________________________________________________________
void THaHelicityDet::MakePrefix()
{
  // All helicity detectors use only their name, not apparatus.name, as
  // prefix.

  THaDetectorBase::MakePrefix( 0 );

}

//_____________________________________________________________________________
Int_t THaHelicityDet::ReadDatabase( const TDatime& date )
{
  // Read fSign

  FILE* file = OpenFile( date );
  if( !file ) return kFileError;

  fSign = 1;  // Default sign is +1
  const  DBRequest request[] = {
    { "helicity_sign", &fSign, kInt, 0, 1, -2 },
    { 0 }
  };
  Int_t err = LoadDB( file, date, request, fPrefix );
  fclose(file);
  if( err )
    return kInitError;

  return kOK;
}

ClassImp(THaHelicityDet)

Last change: Sat Nov 7 21:26:48 2009
Last generated: 2009-11-07 21:26

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.