BRAT 2.4.5
Class index
Full class index
brahmlib
BRAHMS
ROOT page
//--------------------------------------------------------------------
//
// BrDcCalibration is a BRAHMS data class providing storage and 
// access function for Drift Chamber specific calibration parameters.
// Note that all the DB access work is done in the Baseclass. The user
// code tells the Baseclass the name and element of the data
// 
// Code inspired by BrTofCalibration.cxx
//--------------------------------------------------------------------

//--------------------------------------------------------------------
//
// $Id: BrDcCalibration.cxx,v 1.2 2002/05/07 17:35:45 ouerdane Exp $
// $Author: ouerdane $
// $Date: 2002/05/07 17:35:45 $
// $Copyright: (C) 2001 BRAHMS Collaboration <brahmlib@rhic.bnl.gov>


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

#ifndef BRAT_BrDcCalibration
#include "BrDcCalibration.h"
#endif
#ifndef BRAT_BrCalibration
#include "BrCalibration.h"
#endif
#ifndef ROOT_TString
#include "TString.h"
#endif
#ifndef BRAT_BrParameterDbManager
#include "BrParameterDbManager.h"
#endif

ClassImp(BrDcCalibration);


 BrDcCalibration::BrDcCalibration()
{
  // Constructor. DO NOT USE
}

//_________________________________________________________________________
 BrDcCalibration::BrDcCalibration(Char_t *name, Char_t *title) :
  BrCalibration(name, title)
{
  // Standard constructor. 
  // the name should be that of the associated detector 
  // e.g. "T3", "T4", "T5"
  // Create the Db Objects needed for the specific tables.
  // Beware difference between constructor and Init. 
  
  AddParameterData("tdcOffset",      &fTdcOffset);
  AddParameterData("driftTime",      &fDriftTime);

}


//_________________________________________________________________________
  BrDcCalibration::~BrDcCalibration()
{
  // 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)
// 



//_____________________________________________________________________________
 Int_t BrDcCalibration::GetAccessMode(const Char_t* par) const
{
  // get the accessmode of the parameter data  
  TString s(par);
  Int_t mode = 0;

  if (s == "tdcOffset")
    mode = fTdcOffset.fAccessMode;
  if (s == "driftTime")
    mode = fDriftTime.fAccessMode;

  return mode;
}

//_____________________________________________________________________________
 void BrDcCalibration::SetTdcOffset(Int_t value) {
  if(fTdcOffset.fAccessMode){
    Int_t* array = (Int_t*)fTdcOffset.fRevision->GetArray();
    array[0]= value;
  }
}

//_____________________________________________________________________________
 void BrDcCalibration::SetDriftTime(Int_t value) {
  if(fDriftTime.fAccessMode){
    Int_t* array = (Int_t*)fDriftTime.fRevision->GetArray();
    array[0]= value;
  }
}

//_____________________________________________________________________________
 Int_t BrDcCalibration::GetTdcOffset() const {
  if (fTdcOffset.fAccessMode )
    return ((Int_t*) fTdcOffset.fRevision->GetArray())[0] ;
  else
    return kCalException;
}

//_____________________________________________________________________________
 Int_t BrDcCalibration::GetDriftTime() const {
  if (fDriftTime.fAccessMode )
    return ((Int_t*) fDriftTime.fRevision->GetArray())[0] ;
  else
    return kCalException;
}

//_____________________________________________________________________________
 Bool_t BrDcCalibration::ValidCalibration()
{
  
  if (GetTdcOffset() == kCalException || GetDriftTime() == kCalException)
    return kFALSE;
  
  return kTRUE;
}


//---------------------------------------------------------------
//
// $Log: BrDcCalibration.cxx,v $
// Revision 1.2  2002/05/07 17:35:45  ouerdane
// added driftTime parameter to DB and classes
//
// Revision 1.1  2002/03/07 17:48:20  ouerdane
// added DC calibration parameter 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