BRAT 2.4.5
Class index
Full class index
brahmlib
BRAHMS
ROOT page
//--------------------------------------------------------------------
//
// BrTestCalibration is a BRAHMS data class providing storage and 
// access function for Testing different datatypes.
//--------------------------------------------------------------------

//--------------------------------------------------------------------
//
// $Id: BrTestCalibration.cxx,v 1.3 2001/11/26 22:14:48 videbaek Exp $
// $Author: videbaek $
// $Date: 2001/11/26 22:14:48 $
//

#ifndef WIN32
#include <iostream>
#include <iomanip>
#else
#include <iostream.h>
#include <iomanip.h>
#endif

#ifndef BRAT_BrTestCalibration
#include "BrTestCalibration.h"
#endif
#ifndef BRAT_BrCalibration
#include "BrCalibration.h"
#endif
#ifndef ROOT_TString
#include "TString.h"
#endif

ClassImp(BrTestCalibration);


 BrTestCalibration::BrTestCalibration()
{
  // Constructor. Set counter and list data members to zero.
  // Don't use this constructor unless you have to and know
  // what you are doing
  // Use BrCalibrationParams(Char_t, Char_t ) instead
}

//_________________________________________________________________________
 BrTestCalibration::BrTestCalibration(Char_t *name, Char_t *title) :
  BrCalibration(name, title)
{
  // Standard constructor. 
  // the name should be that of the associated detector e.g. "TOF1"
  // Create the Db Objects needed for the specific tables.
  // Beware difference between constructor and Init. 
  
  AddParameterData("TestInt",      &fTestInt);
  AddParameterData("TestShort",    &fTestShort);
  AddParameterData("TestFloat",    &fTestFloat);
  AddParameterData("TestDouble",   &fTestDouble);
  AddParameterData("TestLong",   &fTestLong);

}


//_________________________________________________________________________
  BrTestCalibration::~BrTestCalibration()
{
  // Default destructor
  //
}


//
// For each Table setup in the constructor via the AddParameterData
// an access method must be declared (in the .h files) and defined
// (here in the .cxx file). The fAccesMode test guarentees that the array has
// been setup, but does not make an index check. It is assumed the usercode
// knows how many data each calibration has (to make coding effecient)
// 


//_____________________________________________________________________________
 void BrTestCalibration::SetInt(Int_t slat, Int_t value) {
  CheckSlat(slat);
  if (fSlatOutOfBound)
    return;
  
  if(fTestInt.fAccessMode){
    Int_t* array = (Int_t*)fTestInt.fRevision->GetArray();
    array[slat-1]= value;
  }
}

//_____________________________________________________________________________
 void BrTestCalibration::SetShort(Int_t slat, Short_t value) {
  CheckSlat(slat);
  if (fSlatOutOfBound)
    return;
  
  if(fTestInt.fAccessMode){
    Short_t* array = (Short_t*)fTestShort.fRevision->GetArray();
    array[slat-1]= value;
  }
}


//_____________________________________________________________________________
 void BrTestCalibration::SetFloat(Int_t slat, Float_t value) {
  CheckSlat(slat);
  if (fSlatOutOfBound)
    return;
  
  if(fTestInt.fAccessMode){
    Float_t* array = (Float_t*)fTestFloat.fRevision->GetArray();
    array[slat-1]= value;
  }
}

//_____________________________________________________________________________
 void BrTestCalibration::SetDouble(Int_t slat, Double_t value) {
  CheckSlat(slat);
  if (fSlatOutOfBound)
    return;
  if(fTestInt.fAccessMode){
    Double_t* array = (Double_t*)fTestDouble.fRevision->GetArray();
    array[slat-1]= value;
  }
}

//_____________________________________________________________________________
 void BrTestCalibration::SetLong(Int_t slat, Long_t value) {
  CheckSlat(slat);
  if (fSlatOutOfBound)
    return;
  if(fTestInt.fAccessMode){
    Long_t* array = (Long_t*)fTestLong.fRevision->GetArray();
    array[slat-1]= value;
  }
}

//___________________________________________________________________________
 Int_t BrTestCalibration::GetInt(Int_t tube) const {
  CheckSlat(tube);
  if (fSlatOutOfBound)
    return 0;

  if(fTestInt.fAccessMode )
    return ((Int_t*) fTestInt.fRevision->GetArray())[tube-1] ;
  else
    return 0;
}

//___________________________________________________________________________
 Short_t BrTestCalibration::GetShort(Int_t tube) const {
  CheckSlat(tube);
  if (fSlatOutOfBound)
    return 0;

  if(fTestShort.fAccessMode )
    return ((Short_t*) fTestShort.fRevision->GetArray())[tube-1] ;
  else
    return 0;
}

//___________________________________________________________________________
 Long_t BrTestCalibration::GetLong(Int_t tube) const {
  CheckSlat(tube);
  if (fSlatOutOfBound)
    return 0;

  if(fTestLong.fAccessMode )
    return ((Long_t*) fTestLong.fRevision->GetArray())[tube-1] ;
  else
    return 0;
}

//___________________________________________________________________________
 Float_t BrTestCalibration::GetFloat(Int_t tube) const {
  CheckSlat(tube);
  if (fSlatOutOfBound)
    return 0;

  if(fTestFloat.fAccessMode )
    return ((Float_t*) fTestFloat.fRevision->GetArray())[tube-1] ;
  else
    return 0;
}

//___________________________________________________________________________
 Double_t BrTestCalibration::GetDouble(Int_t tube) const {
  CheckSlat(tube);
  if (fSlatOutOfBound)
    return 0;

  if(fTestDouble.fAccessMode )
    return ((Double_t*) fTestDouble.fRevision->GetArray())[tube-1] ;
  else
    return 0;
}



//_____________________________________________________________________________
 void BrTestCalibration::CheckSlat(Int_t slat) const
{
  fSlatOutOfBound = kFALSE;

  if (slat < 1 || slat > kMaxData) {
    cerr << GetName() << " slat number " << slat 
	 << " is out of bound" << endl;
    fSlatOutOfBound = kTRUE;
  }
}


//---------------------------------------------------------------

//
// $Log: BrTestCalibration.cxx,v $
// Revision 1.3  2001/11/26 22:14:48  videbaek
// fix prototype typo
//
// Revision 1.2  2001/11/26 21:41:53  videbaek
// Added TestLong to set of test types.
//
// Revision 1.1  2001/11/26 18:30:28  videbaek
// Test calibration class
//
//

This page automatically generated by script docBrat by Christian Holm

Copyright ; 2002 BRAHMS Collaboration <brahmlib@rcf.rhic.bnl.gov>
Last Update on by

Validate HTML
Validate CSS