class THaScaler: public TObject


   THaScaler

   Scaler Data in Hall A at Jlab.
   The usage covers several implementations:

   1. Works within context of full analyzer, or standalone.
   2. Time dependent channel mapping to account for movement
      of channels or addition of new channels (scaler.map).
   3. Source of data is either THaEvData, CODA file,
      online (VME), or scaler-history-file.
   4. Optional displays of rates, counts, history.

   Terminology:
      bankgroup = group of scaler banks, e.g. Left Spectrometer crate.
      bank  = group of scalers, e.g. S1L PMTs.
      slot  = slot of scaler channels (1 module in VME)
      channel = individual channel of scaler data
      normalization scaler =  bank assoc. with normalization (charge, etc)

   scaler.map file determines the layout.  See THaScalerDB class.
   *TO ADD A NEW SCALER* bank you need to add lines to DataMap in
   THaScaler::InitData

   author  Robert Michaels (rom@jlab.org)

   Modifications
   Jan 2, 2005    RWM      Added GeN scalers
   Mar 12, 2008   RWM     Added Bigbite scalers


Function Members (Methods)

public:
THaScaler(const char* Bankgroup)
virtual~THaScaler()
voidTObject::AbstractMethod(const char* method) const
virtual voidTObject::AppendPad(Option_t* option = "")
virtual voidTObject::Browse(TBrowser* b)
static TClass*Class()
virtual const char*TObject::ClassName() const
virtual TObject*TObject::Clone(const char* newname = "") const
virtual Int_tTObject::Compare(const TObject* obj) const
virtual voidTObject::Copy(TObject& object) const
virtual voidTObject::Delete(Option_t* option = "")MENU
virtual Int_tTObject::DistancetoPrimitive(Int_t px, Int_t py)
virtual voidTObject::Draw(Option_t* option = "")
virtual voidTObject::DrawClass() constMENU
virtual TObject*TObject::DrawClone(Option_t* option = "") constMENU
virtual voidTObject::Dump() constMENU
virtual voidTObject::Error(const char* method, const char* msgfmt) const
virtual voidTObject::Execute(const char* method, const char* params, Int_t* error = 0)
virtual voidTObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0)
virtual voidTObject::ExecuteEvent(Int_t event, Int_t px, Int_t py)
virtual voidTObject::Fatal(const char* method, const char* msgfmt) const
virtual TObject*TObject::FindObject(const char* name) const
virtual TObject*TObject::FindObject(const TObject* obj) const
Int_tGetBcm(const char* which)
Int_tGetBcm(Int_t helicity, const char* which, Int_t histor = 0)
Double_tGetBcmRate(const char* which)
Double_tGetBcmRate(Int_t helicity, const char* which)
Int_tGetChan(string which, Int_t helicity = 0, Int_t chan = 0)
Double_tGetClockRate() const
Int_tGetCrate() const
THaScalerDB*GetDataBase()
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
virtual const char*TObject::GetIconName() const
Double_tGetIRate(Int_t slot, Int_t chan)
virtual const char*GetName() const
Int_tGetNormData(Int_t helicity, const char* which, Int_t histor = 0)
Int_tGetNormData(Int_t helicity, Int_t chan, Int_t histor = 0)
Int_tGetNormData(Int_t tgtstate, Int_t helicity, const char* which, Int_t histor = 0)
Int_tGetNormData(Int_t tgtstate, Int_t helicity, Int_t chan, Int_t histor)
Double_tGetNormRate(Int_t helicity, const char* which)
Double_tGetNormRate(Int_t helicity, Int_t chan)
Double_tGetNormRate(Int_t tgtstate, Int_t helicity, const char* which)
Double_tGetNormRate(Int_t tgtstate, Int_t helicity, Int_t chan)
virtual char*TObject::GetObjectInfo(Int_t px, Int_t py) const
static Bool_tTObject::GetObjectStat()
virtual Option_t*TObject::GetOption() const
Int_tGetPulser(const char* which)
Int_tGetPulser(Int_t helicity, const char* which, Int_t histor = 0)
Double_tGetPulserRate(const char* which)
Double_tGetPulserRate(Int_t helicity, const char* which)
Int_tGetScaler(const char* detector, Int_t chan)
Int_tGetScaler(Int_t slot, Int_t chan, Int_t histor = 0)
Int_tGetScaler(const char* detector, const char* PMT, Int_t chan, Int_t histor = 0)
Double_tGetScalerRate(Int_t slot, Int_t chan)
Double_tGetScalerRate(const char* plane, Int_t chan)
Double_tGetScalerRate(const char* plane, const char* PMT, Int_t chan)
Int_tGetSlot(string which, Int_t helicity = 0)
Int_tGetSlot(Int_t tgtstate, Int_t helicity)
virtual const char*TObject::GetTitle() const
Int_tGetTrig(Int_t trigger)
Int_tGetTrig(Int_t helicity, Int_t trigger, Int_t histor = 0)
Double_tGetTrigRate(Int_t trigger)
Double_tGetTrigRate(Int_t helicity, Int_t trigger)
virtual UInt_tTObject::GetUniqueID() const
virtual Bool_tTObject::HandleTimer(TTimer* timer)
virtual ULong_tTObject::Hash() const
virtual voidTObject::Info(const char* method, const char* msgfmt) const
virtual Bool_tTObject::InheritsFrom(const char* classname) const
virtual Bool_tTObject::InheritsFrom(const TClass* cl) const
Int_tInit(const char* date = "now")
Int_tInit(const TDatime& date)
virtual voidTObject::Inspect() constMENU
voidTObject::InvertBit(UInt_t f)
virtual TClass*IsA() const
virtual Bool_tTObject::IsEqual(const TObject* obj) const
virtual Bool_tTObject::IsFolder() const
Bool_tTObject::IsOnHeap() const
Bool_tIsRenewed() const
virtual Bool_tTObject::IsSortable() const
Bool_tTObject::IsZombie() const
Int_tLoadData(const THaEvData& evdata)
Int_tLoadDataCodaFile(THaCodaFile* codafile)
Int_tLoadDataCodaFile(const char* filename)
Int_tLoadDataCodaFile(TString filename)
Int_tLoadDataHistoryFile(int run_num, int hdeci = 0)
Int_tLoadDataHistoryFile(const char* filename, int run_num, int hdeci = 0)
Int_tLoadDataOnline()
Int_tLoadDataOnline(const char* server, int port)
virtual voidTObject::ls(Option_t* option = "") const
voidTObject::MayNotUse(const char* method) const
virtual Bool_tTObject::Notify()
static voidTObject::operator delete(void* ptr)
static voidTObject::operator delete(void* ptr, void* vp)
static voidTObject::operator delete[](void* ptr)
static voidTObject::operator delete[](void* ptr, void* vp)
void*TObject::operator new(size_t sz)
void*TObject::operator new(size_t sz, void* vp)
void*TObject::operator new[](size_t sz)
void*TObject::operator new[](size_t sz, void* vp)
virtual voidTObject::Paint(Option_t* option = "")
virtual voidTObject::Pop()
virtual voidPrint(Option_t* opt = "") const
virtual voidPrintSummary()
virtual Int_tTObject::Read(const char* name)
virtual voidTObject::RecursiveRemove(TObject* obj)
voidTObject::ResetBit(UInt_t f)
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU
virtual voidTObject::SavePrimitive(basic_ostream<char,char_traits<char> >& out, Option_t* option = "")
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
voidSetClockLoc(Int_t slot, Int_t chan)
voidSetClockRate(Double_t clkrate)
virtual voidTObject::SetDrawOption(Option_t* option = "")MENU
static voidTObject::SetDtorOnly(void* obj)
voidSetIChan(Int_t slot, Int_t chan)
voidSetIpAddress(string ipaddress)
static voidTObject::SetObjectStat(Bool_t stat)
voidSetPort(Int_t port)
voidSetTimeInterval(Double_t time)
virtual voidTObject::SetUniqueID(UInt_t uid)
virtual voidShowMembers(TMemberInspector& insp, char* parent)
virtual voidStreamer(TBuffer& b)
voidStreamerNVirtual(TBuffer& b)
virtual voidTObject::SysError(const char* method, const char* msgfmt) const
Bool_tTObject::TestBit(UInt_t f) const
Int_tTObject::TestBits(UInt_t f) const
virtual voidTObject::UseCurrentStyle()
virtual voidTObject::Warning(const char* method, const char* msgfmt) const
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0)
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) const
protected:
Int_tCheckInit()
virtual voidClear(Option_t* opt = "")
voidClearAll()
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
voidDumpRaw(Int_t flag = 0)
Int_tExtractRaw(const Int_t* data, int len = 0)
Double_tGetTimeDiff(Int_t helicity)
Double_tGetTimeDiff(Int_t tgtstate, Int_t helicity)
Double_tGetTimeDiffSlot(Int_t slot, Int_t chan = 7)
UInt_theader_str_to_base16(const string& header)
Int_tInitData(const string& bankgroup, const Bdate& bd)
voidLoadPrevious()
voidTObject::MakeZombie()
voidSetupNormMap()
private:
THaScaler()
THaScaler(const THaScaler& bk)
THaScaler&operator=(const THaScaler& bk)

Data Members

public:
enum TObject::EStatusBits { kCanDelete
kMustCleanup
kObjInCanvas
kIsReferenced
kHasUUID
kCannotPick
kNoContextMenu
kInvalidObject
};
enum TObject::[unnamed] { kIsOnHeap
kNotDeleted
kZombie
kBitMask
kSingleKey
kOverwrite
kWriteDelete
};
protected:
stringbankgroup
Double_tcalib_d1
Double_tcalib_d10
Double_tcalib_d3
Double_tcalib_u1
Double_tcalib_u10
Double_tcalib_u3
intclkchan
intclkslot
Double_tclockrate
Bool_tcoda_open
Int_tcrate
THaScalerDB*database
Bool_tdid_init
Int_tevstr_type
static const Int_tfDebug
THaCodaFile*fcodafile
Bool_tfirst_loop
Bool_tfound_crate
Int_theader
inticurchan
inticurslot
Bool_tnew_load
multimap<std::string,Int_t>normmap
Int_t*normslot
Double_toff_d1
Double_toff_d10
Double_toff_d3
Double_toff_u1
Double_toff_u10
Double_toff_u3
Bool_tone_load
vector<Int_t>onlmap
Int_t*rawdata
Bool_tuse_clock
intvme_port
stringvme_server

Class Charts

Inheritance Chart:
TObject
THaScaler

Function documentation

THaScaler( const char* bankgr )
 Set up the scaler banks.  Each bank is a group of related scalers.
 'bankgr' is group of scaler banks, "Left"(L-arm), "Right"(R-arm), etc
~THaScaler()
Int_t Init( const TDatime& time )
 Initialize scalers for given date/time.
 Accuracy is 1 day. Only date is used, time is ignored.
Int_t Init(const char* thetime )
 Init() is required to be run once in the life of object.
 'thetime' is the Day-Month-Year to look up scaler map related to data.
 e.g. thetime = '21-05-1999' --> 21st of May 1999.
 'thetime' can also be "now"
Int_t InitData(const string& bankgroup, const Bdate& bd)
 Initialize data of the class for this bankgroup for the date wanted.
 While in principle this should come from a "database", it basically
 never changes.  However, to add a new scaler bank, imitate what is
 done for "Left" or "Right" HRS.
 Note: this routine must be called after database is new'd but
 before it is loaded.
void SetIpAddress(string ipaddress)
void SetPort(Int_t port)
void SetClockLoc(Int_t slot, Int_t chan)
 definition of "clock" in the scaler.map file.  If this is
 not called, then the "clock" is defined by scaler.map
void SetIChan(Int_t slot, Int_t chan)
void SetupNormMap()
void SetClockRate(Double_t clkrate)
void SetTimeInterval(Double_t time)
 Set the average time interval between events.
 Note, use this *ONLY IF* there is no clock in the datastream.
Int_t LoadData(const THaEvData& evdata)
 Load data from THaEvData object.  Return of 0 is ok.
 Note: GetEvBuffer is no faster than evdata.Get...
Int_t LoadDataCodaFile(const char* filename)
 from CODA file 'filename'.  We'll open it for you. Return of 0 is ok.
Int_t LoadDataCodaFile(TString filename)
 from CODA file 'filename'.  We'll open it for you. Return of 0 is ok.
Int_t LoadDataCodaFile(THaCodaFile *codafile)
 Load data from a CODA file, assumed to be already opened.
 Return of 0 means end of data, return of 1 means there is more data.
Int_t ExtractRaw(const Int_t* data, int len = 0)
 Extract rawdata from data if this event belongs to this scaler crate.
 This works for CODA event data or VME data format but not
 for scaler history file (strings).
Int_t LoadDataHistoryFile(int run_num, int hdeci = 0)
 Load data from scaler history file for run number
Int_t LoadDataHistoryFile(const char* filename, int run_num, int hdeci = 0)
 Load data from scaler history file 'filename' for run number run_num
Int_t LoadDataOnline()
 Load data from online VME server and port for this 'Bank Group'
Int_t LoadDataOnline(const char* server, int port)
 Load data from VME 'server' and 'port'.
void Print(Option_t* opt = "") const
 Print data contents
void PrintSummary()
 Print out a summary of important scalers
Int_t GetScaler(Int_t slot, Int_t chan, Int_t histor = 0)
 Get data by slot and channel.  This is the FASTEST method.
 Histor = 0 = present event.  Histor = 1 = previous event
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)
 Accum. counts on PMTs of detector = "s1", "s2", "gasc", "a1", "a2",
 "leadgl", "edtm".   PMT = "left" or "right" or "LR"
Int_t GetTrig(Int_t trigger)
 Non-helicity gated trigger counts for trig# 1,2,3...
Int_t GetTrig(Int_t helicity, Int_t trigger, Int_t histor = 0)
 Accum. counts for trig# 1,2,3,4,5, etc
 by helcity state (-1, 0, +1)  where 0 is non-helicity gated
 histor = 0 = this event.  1 = previous event.
Int_t GetBcm(const char* which)
 Non-helicity gated BCM counts for 'which' = 'bcm_u1','bcm_d1',
 'bcm_u3','bcm_d3','bcm_u10','bcm_d10'
Int_t GetBcm(Int_t helicity, const char* which, Int_t histor = 0)
 Get BCM counts for 'which' = 'bcm_u1','bcm_d1',
 'bcm_u3','bcm_d3','bcm_u10','bcm_d10'
 by helcity state (-1, 0, +1)  where 0 is non-helicity gated
 histor = 0 = this event.  1 = previous event.
Int_t GetPulser(const char* which)
Int_t GetPulser(Int_t helicity, const char* which, Int_t histor = 0)
 Obtain pulser values, by 'which' = 'clock', 'edt', 'edtat', 'strobe', etc
Int_t GetNormData(Int_t tgtstate, Int_t helicity, const char* which, Int_t histor)
 Get Normalization Data for channel 'which'
 by target and helcity states 0, 1, -1  where 0 is neither
 histor = 0 = this event.  1 = previous event.
Int_t GetNormData(Int_t helicity, const char* which, Int_t histor)
 Get Normalization Data for channel 'which'
 by helcity state (-1, 0, +1)  where 0 is non-helicity gated
 histor = 0 = this event.  1 = previous event.
Int_t GetNormData(Int_t tgtstate, Int_t helicity, Int_t chan, Int_t histor)
 Get Normalization Data for channel #chan = 0,1,2,...
 by target and helcity state (-1, 0, +1)  where 0 is neither
 histor = 0 = this event.  1 = previous event.
 Assumption: a slot with "TS-accept" is a normalization scaler.
Int_t GetNormData(Int_t helicity, Int_t chan, Int_t histor)
 Get Normalization Data for channel #chan = 0,1,2,...
 by helcity state (-1, 0, +1)  where 0 is non-helicity gated
 histor = 0 = this event.  1 = previous event.
 Assumption: a slot with "TS-accept" is a normalization scaler.
Int_t GetSlot(string detector, Int_t helicity)
Int_t GetSlot(Int_t tgtstate, Int_t helicity)
Int_t GetChan(string which, Int_t helicity = 0, Int_t chan = 0)
 No distinction by target state because it's assumed that diff tgt states
 share the same channel map since that's how we fan out the signals.
Double_t GetScalerRate(Int_t slot, Int_t chan)
 Return rates on scaler data, for slot #slot, channel #chan
Double_t GetScalerRate(const char* detector, Int_t chan)
Double_t GetScalerRate(const char* plane, const char* PMT, Int_t chan)
 Rates (Hz) since last update for detector 's1', 's2', 'gasC', etc
 PMT = "left", "right", "LR" (coinc),  and channel #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 GetIRate(Int_t slot, Int_t chan)
Double_t GetTimeDiffSlot(Int_t slot, Int_t chan = 7)
 Get the time difference in seconds based on a clock
 in (slot, chan).  Normally chan=7.
 See also comments in GetTimeDiff
Double_t GetTimeDiff(Int_t helicity)
 Get the time difference in seconds.  Must normalize to a clock.
 If we have "SetClockLoc" then we use the location it defined.
 Otherwise we use the clock location from the "clock" item in
 the scaler.map file (which is the usual way).
Double_t GetTimeDiff(Int_t tgtstate, Int_t helicity)
 Get time diff for target state 'tgtstate' and helicity.
 See overloaded implementation for comments.
UInt_t header_str_to_base16(const string& header)
 Utility to convert string header to base 16 integer
void DumpRaw(Int_t flag = 0)
Int_t CheckInit()
void Clear(Option_t* opt = "")
void ClearAll()
void LoadPrevious()
THaScaler( const char* Bankgroup )
 Constructors.
 'Bankgroup' is collection of scalers, "Left"(L-arm), "Right"(R-arm)
  "EvLeft" = event stream, Left HRS,  "EvRight" = event stream, Right HRS.
const char* GetName()
{ return bankgroup.c_str(); }
Int_t GetCrate()
{ return crate; }
Double_t GetClockRate()
{ return clockrate; }
Bool_t IsRenewed()
{ return new_load; }
THaScalerDB* GetDataBase()
{ return database; }
THaScaler()
THaScaler& operator=(const THaScaler& bk)

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.