#include "THaBeam.h"
#include "VarDef.h"
#include "THaRunBase.h"
#include "THaRunParameters.h"
#include "THaGlobals.h"
THaBeam::THaBeam( const char* name, const char* desc ) :
THaApparatus( name,desc )
{
fBeamIfo.SetBeam( this );
}
THaBeam::~THaBeam()
{
RemoveVariables();
}
THaAnalysisObject::EStatus THaBeam::Init( const TDatime& run_time )
{
if( !gHaRun || !gHaRun->IsInit() ) {
Error( Here("Init"), "Current run not initialized. "
"Failed to initialize beam apparatus %s (\"%s\"). ",
GetName(), GetTitle() );
return fStatus = kInitError;
}
fRunParam = gHaRun->GetParameters();
if( !fRunParam ) {
Error( Here("Init"), "Current run has no parameters?!? "
"Failed to initialize beam apparatus %s (\"%s\"). ",
GetName(), GetTitle() );
return fStatus = kInitError;
}
return THaApparatus::Init(run_time);
}
Int_t THaBeam::DefineVariables( EMode mode )
{
if( mode == kDefine && fIsSetup ) return kOK;
fIsSetup = ( mode == kDefine );
RVarDef vars[] = {
{ "x", "reconstructed x-position at nom. interaction point", "fPosition.fX"},
{ "y", "reconstructed y-position at nom. interaction point", "fPosition.fY"},
{ "z", "reconstructed z-position at nom. interaction point", "fPosition.fZ"},
{ "dir.x", "reconstructed x-component of beam direction", "fDirection.fX"},
{ "dir.y", "reconstructed y-component of beam direction", "fDirection.fY"},
{ "dir.z", "reconstructed z-component of beam direction", "fDirection.fZ"},
{ 0 }
};
DefineVarsFromList( vars, mode );
DefineVarsFromList( GetRVarDef(), mode );
return 0;
}
void THaBeam::Update()
{
THaRunParameters* rp = gHaRun->GetParameters();
if( rp )
fBeamIfo.Set( rp->GetBeamP(), fDirection, fPosition,
rp->GetBeamPol() );
else
fBeamIfo.Set( kBig, fDirection, fPosition, kBig );
}
ClassImp(THaBeam)
Last change: Sat Nov 7 21:26:42 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.