#ifndef THaScaler_
#define THaScaler_
#define SCAL_NUMCHAN 32
#define SCAL_NUMBANK 12
#define SCAL_EVTYPE 140
#define SCAL_ERROR -1
#define SCAL_VERBOSE 1 // verbose warnings (0 = silent, recommend = 1)
#include "TObject.h"
#include "TString.h"
#include <cstdlib>
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <fstream>
#include <time.h>
class Bdate;
class THaScalerDB;
class THaCodaFile;
class THaEvData;
class TDatime;
class THaScaler : public TObject {
public:
THaScaler( const char* Bankgroup );
virtual ~THaScaler();
Int_t Init( const char* date = "now" );
Int_t Init( const TDatime& date );
Int_t LoadData(const THaEvData& evdata);
Int_t LoadDataCodaFile(THaCodaFile *codafile);
Int_t LoadDataCodaFile(const char* filename);
Int_t LoadDataCodaFile(TString filename);
Int_t LoadDataHistoryFile(int run_num, int hdeci=0);
Int_t LoadDataHistoryFile(const char* filename, int run_num, int hdeci=0);
Int_t LoadDataOnline();
Int_t LoadDataOnline(const char* server, int port);
virtual void Print( Option_t* opt="" ) const;
virtual void PrintSummary();
const char* GetName() const { return bankgroup.c_str(); };
Int_t GetCrate() const { return crate; };
Int_t GetScaler(Int_t slot, Int_t chan, Int_t histor=0);
Int_t GetScaler(const char* detector, Int_t chan);
Int_t GetScaler(const char* detector, const char* PMT, Int_t chan, Int_t histor=0);
Int_t GetTrig(Int_t trigger);
Int_t GetBcm(const char* which);
Int_t GetPulser(const char* which);
Int_t GetTrig(Int_t helicity, Int_t trigger, Int_t histor=0);
Int_t GetBcm(Int_t helicity, const char* which, Int_t histor=0);
Int_t GetPulser(Int_t helicity, const char* which, Int_t histor=0);
Int_t GetNormData(Int_t tgtstate, Int_t helicity, const char* which, Int_t histor=0);
Int_t GetNormData(Int_t helicity, const char* which, Int_t histor=0);
Int_t GetNormData(Int_t tgtstate, Int_t helicity, Int_t chan, Int_t histor);
Int_t GetNormData(Int_t helicity, Int_t chan, Int_t histor=0);
Double_t GetScalerRate(Int_t slot, Int_t chan);
Double_t GetScalerRate(const char* plane, const char* PMT, Int_t chan);
Double_t GetScalerRate(const char* plane, Int_t chan);
Double_t GetTrigRate(Int_t trigger);
Double_t GetTrigRate(Int_t helicity, Int_t trigger);
Double_t GetBcmRate(const char* which);
Double_t GetBcmRate(Int_t helicity, const char* which);
Double_t GetPulserRate(const char* which);
Double_t GetPulserRate(Int_t helicity, const char* which);
Double_t GetNormRate(Int_t tgtstate, Int_t helicity, const char* which);
Double_t GetNormRate(Int_t helicity, const char* which);
Double_t GetNormRate(Int_t helicity, Int_t chan);
Double_t GetNormRate(Int_t tgtstate, Int_t helicity, Int_t chan);
Double_t GetClockRate() const { return clockrate; }
Double_t GetIRate(Int_t slot, Int_t chan);
Bool_t IsRenewed() const { return new_load; }
void SetIpAddress(std::string ipaddress);
void SetPort(Int_t port);
void SetClockLoc(Int_t slot, Int_t chan);
void SetClockRate(Double_t clkrate);
void SetTimeInterval(Double_t time);
void SetIChan(Int_t slot, Int_t chan);
Int_t GetSlot(std::string which, Int_t helicity=0);
Int_t GetSlot(Int_t tgtstate, Int_t helicity);
Int_t GetChan(std::string which, Int_t helicity=0, Int_t chan=0);
THaScalerDB* GetDataBase() { return database; };
protected:
std::string bankgroup;
THaCodaFile *fcodafile;
std::vector<Int_t> onlmap;
THaScalerDB *database;
std::multimap<std::string, Int_t> normmap;
Int_t *rawdata;
Bool_t coda_open;
Int_t header, crate, evstr_type;
std::string vme_server;
int vme_port, clkslot, clkchan;
int icurslot, icurchan;
Bool_t found_crate,first_loop;
Bool_t did_init, new_load, one_load, use_clock;
Int_t *normslot;
Double_t clockrate;
Int_t InitData(const std::string& bankgroup, const Bdate& bd);
Int_t CheckInit();
void Clear(Option_t* opt="");
void ClearAll();
void LoadPrevious();
Int_t ExtractRaw(const Int_t* data, int len=0);
void DumpRaw(Int_t flag=0);
UInt_t header_str_to_base16(const std::string& header);
Double_t calib_u1,calib_u3,calib_u10,calib_d1,calib_d3,calib_d10;
Double_t off_u1,off_u3,off_u10,off_d1,off_d3,off_d10;
Double_t GetTimeDiff(Int_t tgtstate, Int_t helicity);
Double_t GetTimeDiff(Int_t helicity);
Double_t GetTimeDiffSlot(Int_t slot, Int_t chan=7);
void SetupNormMap();
static const Int_t fDebug = 0;
private:
THaScaler();
THaScaler(const THaScaler &bk);
THaScaler& operator=(const THaScaler &bk);
public:
ClassDef(THaScaler,0)
};
#endif
Last change: Sat Nov 7 21:26:51 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.