Public Interface for the Hall A Scaler Class Package

Robert Michaels, rom@jlab.org, Jefferson Lab Hall A, Aug 2001

This file:     hallaweb.jlab.org/equipment/daq/THaScalerHeader.html


The design and intended usage of the hana_scaler package is expressed through the public part of its interface (i.e. header file) which is shown below.   In principle, if a class package is well designed, the user only needs to look at public methods of one interface class, in this case THaScaler.

// Init() is *REQUIRED* to be run once in the life of this object.
// 'Time' is the Day-Month-Year to look up scaler map related to data taking.
// European format of Time: '21-05-1999' --> 21st of May 1999.
// 'Time' can also be "now"
// 'Bankgroup' is collection of scalers, "Left"(L-arm), "Right"(R-arm), "RCS"
   Int_t Init(const char* Time, const char* Bankgroup);   
   Int_t Init(const char* Bankgroup);    // default Time = "now".

// Various ways of loading data into this object, each load is for one
// 'event' of data.  Any CODA files are opened once, read sequentially
   Int_t LoadData(const THaEvData& evdata); // load from THaEvData (return if non-scaler evt)
// from CODA file (assumed opened already)
   Int_t LoadDataCodaFile(THaCodaFile *codafile);  
// from CODA file 'filename' (we'll open it for you)
   Int_t LoadDataCodaFile(const char* filename);      
   Int_t LoadDataCodaFile(TString filename);      
// Load data from scaler history file for run number
   Int_t LoadDataHistoryFile(int run_num); // default file "scaler_history.dat"
   Int_t LoadDataHistoryFile(const char* filename, int run_num);
// Online 'server' may be Name or IP of VME cpu, or
// 'server' may also be a mnemonic like "Left", "Right", "RCS", etc
   Int_t LoadDataOnline();    // server and port is known for 'Bankgroup'
   Int_t LoadDataOnline(const char* server, int port); 

   virtual Int_t InitPlots();    // Initialize plots (xscaler style)
   virtual void Print();         // Prints data contents
   virtual void PrintSummary();  // Print out a summary of important scalers.

// Get scaler data from slot #slot and channel #chan (slot >= 0, chan >= 0)
   Int_t GetScaler(Int_t slot, Int_t chan);
// Get accumulated COUNTS on detector and channel
// detector = "s1", "s2", "gasC", "a1", "a2", "leadgl", "rcslg", "edtm" 
   Int_t GetScaler(const char* detector, Int_t chan);  // if no L/R distinction.
// PMT = "left", "right", "LR" (LR means left.AND.right)
   Int_t GetScaler(const char* detector, const char* PMT, Int_t chan);  
   Int_t GetTrig(Int_t trigger);   // counts for trig# 1,2,3,4,5,etc
// Beam current, which= 'bcm_u1','bcm_d1','bcm_u3','bcm_d3','bcm_u10','bcm_d10'
   Int_t GetBcm(const char* which); 
   Int_t GetPulser(const char* which);  // which = 'clock', 'edt', 'edtat', 'strobe'
// Accumulated COUNTS by helicity state (-1, 0, +1),  0 is non-helicity gated
   Int_t GetTrig(Int_t helicity, Int_t trigger);   
   Int_t GetBcm(Int_t helicity, const char* which);    
   Int_t GetPulser(Int_t helicity, const char* which);  
   Int_t GetNormData(Int_t helicity, const char* which);
   Int_t GetNormData(Int_t helicity, Int_t chan);
// RATES (Hz) since last update, similar usage to above.
   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* detector, 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 helicity, const char* which);
   Double_t GetNormRate(Int_t helicity, Int_t chan);