// Author: Thomas Hadig (Group EB SLAC Stanford CA USA)
// Last update: $Date: 2003/08/27 19:51:12 $
// Copyright: Thomas Hadig, hadig@slac.stanford.edu

#ifndef __CRTMULTIMETER34401A_CXX
#define __CRTMULTIMETER34401A_CXX

////////////////////////////////////////////////////////////////////////////////
//
// Cosmic Ray Telescope Data Aquisition Software
//
// generic driver for GPIB crate: NI 34401A
//
//
////////////////////////////////////////////////////////////////////////////////

#include <iostream>
#include <sstream>

#include <gendriver/multimeter34401a.hh>
#include <gendriver/gpibcrate.hh>

namespace CRT
 { 
  //{{{}}}
  //{{{  constructor
   CrtMultimeter34401A::CrtMultimeter34401A() : CrtBoard()
   {
    // default constructor
    fOk=0;
   }
  //}}}
  //{{{  constructor CrtMultimeter34401A(const Char_t *inName, Int_t inBoardNumber, CrtGpibCrate *inCrate)
   CrtMultimeter34401A::CrtMultimeter34401A(const Char_t *inName, Int_t inBoardNumber, CrtGpibCrate *inCrate): CrtBoard(inName, inBoardNumber, (CrtCrate *)inCrate)
   {
    // constructor
    // inBoardNumber is the number of the Camac slot
    // inCrate       is a pointer to the Camac crate object
    fIdents[0]=inBoardNumber;
    //  Char_t buf[100];
    fOk = 1;
   }
  //}}}
  //{{{  destructor
   CrtMultimeter34401A::~CrtMultimeter34401A()
   {
    // destructor
   }
  //}}}

  //{{{  Send
   Int_t CrtMultimeter34401A::Send(Int_t inCommand) const
   {
    return -1;
   }
  //}}}
  //{{{  Enable
   Int_t CrtMultimeter34401A::Enable(Int_t inFlag, Int_t inChannel) const
   {
    // enables board features
    // Available features:
    // none

    return -1;
   }
  //}}}
  //{{{  Disable
   Int_t CrtMultimeter34401A::Disable(Int_t inFlag, Int_t inChannel) const
   {
    // disables board features
    // Available features:
    // none
    
    return -1;
   }
  //}}}
  //{{{  Clear
   Int_t CrtMultimeter34401A::Clear(Int_t inFlag, Int_t inChannel) const
   {
    // clears board features
    // Available features:
    // none

    return -1;
   }
  //}}}
  //{{{  Test
   Int_t CrtMultimeter34401A::Test(Int_t inFlag, Int_t inChannel) const
   {
    // tests board features
    // Available features:
    // none

    return -1;
   }
  //}}}
  //{{{  Query
   Int_t CrtMultimeter34401A::Query(Int_t inChannel, Int_t *outValue) const
   {
    return -1;
   }
  //}}}
  //{{{  Assign
   Int_t CrtMultimeter34401A::Assign(Int_t inChannel, Int_t inValue) const
   {
    return -1;
   }
  //}}}
  //{{{  GetDCCurrent
   Int_t CrtMultimeter34401A::GetDCCurrent(Double_t inDCRange, Double_t inDCResolution, Double_t *outDCCurrent) const
   {
    // gets the dc current 
    // values are only valid, if 1 is returned
  
    Int_t i;
  
    // Initial Data Check...
    if ((inDCRange<-50)||(inDCRange>50)||(inDCResolution<-0.00001)||(inDCResolution>1))
      return -1;
   
    // Give Command for measurement...
    std::string input_buffer = " MEAS:CURR:DC? ";
    std::stringstream ss;
    ss<<inDCRange;
    input_buffer += ss.str()+",";
    ss<<inDCResolution;
    input_buffer += ss.str();
    const Char_t* ptr = ((CrtGpibCrate *)fInCrate)->Send2(fIdents[0],input_buffer.c_str(), 0, &i, 200, 200);
   
    // Analyze output from previous command...
    if(i != 1)
     {
      std::cout<<"there was GPIB error or I/P data error or loops ended ! from getdc current or command error"<<std::endl;
      return 0;
     }
  
    // Now, we have the case of indicator i being 1..
    std::string buf = ptr;
    std::stringstream s;
    *outDCCurrent= 0;
    s>> *outDCCurrent;
    return 1;
   }
  //}}}
 }
 
ClassImp(CRT::CrtMultimeter34401A) //Joerger Output Register OR2/3/4 module driver

#endif


ROOT page - Class index - Class Hierarchy - Top of the page

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.