Pan: The Parity Analyzer -- Class Index

Pan classes only
All classes


+
class TaDataBase
-
#include "TaDataBase.hh"
Display options:
Show inherited
Show non-public

class TaDataBase


HALL A C++/ROOT Parity Analyzer  Pan

       VaAnalysis.cc  (implementation)

 Author:  R. Holmes <http://mep1.phy.syr.edu/~rsholmes>, A. Vacheret <http://www.jlab.org/~vacheret>, R. Michaels <http://www.jlab.org/~rom>, K.Paschke
 @(#)pan/src:$Name:  $:$Id: TaDataBase.cc,v 1.38 2006/02/27 22:30:30 paschke Exp $



  Database class.  This always reads database from an ASCII file.
  For MYSQL access, it first executes a Perl script which generates
  the ASCII file.

  The database is organized in tables, see list below.
The tables are denoted by a string table name (e.g. 'dacnoise').
In each table is a series of columns of information.  The columns
  are 'typed' data, i.e. data of a type string, int, or double.

  Tables include:

      1. run  (the CODA run number)
      2. analysis type
      3. maxevents (the number of events to analyze)
      4. pair type ('pair' or 'quad')
      5. window delay
      6. oversampling factor
      7. dac noise parameters
8. pedestals
      9. datamap and header info
     10. named cuts ('lobeam', 'burpcut', etc, each a table)
     11. event intervals where data are cut.

  For usage instructions, syntax rules, and other details, see
          /doc/DATABASE.TXT


Function Members (Methods)

public:
TaDataBase()
virtual~TaDataBase()
voidCheckout()
static TClass*Class()
voidDataMapReStart()
Double_tGetAdcPed(const Int_t& adc, const Int_t& chan) const
TDatime*GetAnaTDatime() const
stringGetAnaType() const
vector<Double_t>GetBlindingParams() const
stringGetBlindingString() const
vector<Double_t>GetBlumiWts() const
Bool_tGetCalVar() const
vector<Double_t>GetCavConst1() const
vector<Double_t>GetCavConst2() const
vector<Double_t>GetCavConst3() const
UInt_tGetCksum() const
Int_tGetCompress() const
stringGetCurMon() const
stringGetCurMonC() const
map<Int_t,vector<Int_t> >GetCutInt() const
vector<string>GetCutNames() const
Cut_tGetCutNumber(TaString s) const
Double_tGetCutValue(const string& cutname) const
vector<Double_t>GetCutValueDVector(const string& cutname) const
Double_tGetDacNoise(const Int_t& adc, const Int_t& chan, const string& key) const
Double_tGetData(dtype* dat) const
Double_tGetData(const string& key) const
vector<Double_t>GetData(string table, vector<string> key) const
stringGetData(string table, string key, Int_t index) const
stringGetDataMapName() const
stringGetDataMapType() const
Int_tGetDelay() const
vector<Double_t>GetDetWts() const
vector<TaString>GetEpicsKeys() const
vector<Int_t>GetExtHi() const
vector<Int_t>GetExtLo() const
stringGetFdbkMonitor(const string& fdbktype) const
stringGetFdbkSwitch(const string& fdbktype) const
Int_tGetFdbkTimeScale(const string& fdbktype) const
vector<Double_t>GetFlumiWts() const
UInt_tGetHeader(const string& device) const
TaKeyMapGetKeyMap(string device) const
UInt_tGetMask(const string& device) const
Int_tGetMaxEvents() const
Int_tGetNumBadEv() const
Int_tGetNumCuts() const
Int_tGetOverSamp() const
stringGetPairType() const
vector<Double_t>GetQpd1Const() const
stringGetRandomHeli() const
Int_tGetRunNum() const
Double_tGetScalPed(const Int_t& adc, const Int_t& chan) const
stringGetSimulationType() const
stringGetString(const string& table) const
vector<TaString>GetStringVect(const string& table) const
stringGetTimestamp() const
TDatimeGetTimeTDatime() const
TStringGetTimeTString() const
Double_tGetValue(const string& table) const
vector<Double_t>GetValueDVector(const string& table) const
vector<Int_t>GetValueVector(const string& table) const
virtual TClass*IsA() const
Bool_tNextDataMap()
voidPrint()
voidPrintDataBase()
voidPrintDataMap()
voidPutAdcPed(const Int_t& adc, const Int_t& chan, const Double_t& value)
voidPutCutInt(const vector<Int_t> evint)
voidPutDacNoise(const Int_t& adc, const Int_t& chan, const Double_t& slope)
voidPutScalPed(const Int_t& scal, const Int_t& chan, const Double_t& value)
voidRead(int run, const vector<string>& dbcommand)
voidReadRoot(TaString filename)
Bool_tSelfCheck()
virtual voidShowMembers(TMemberInspector& insp, char* parent)
virtual voidStreamer(TBuffer& b)
voidStreamerNVirtual(TBuffer& b)
voidWrite()
voidWriteRoot()
private:
TaDataBase(const TaDataBase& fn)
Int_tChkDbCommand()
Int_tFindFirstKey(const string& sb, const string& sc)
stringFindTable(string table)
voidInitDataMap()
voidInitDB()
voidLoadCksum(const string)
voidLoadTable(string table, vector<dtype*>)
voidMysql(string action)
TaDataBase&operator=(const TaDataBase& fn)
voidPutData(string table, vector<dtype*> dvect)
Int_tRotateState(const string long_devname)
voidSetDbCommand()
stringStripRotate(const string long_devname)
voidToRoot()

Data Members

private:
TDatime*AnaTDatimeTDatime of when run was analyzed
Double_t*adcped
map<string,TaKeyMap,less<string>,allocator<pair<const string,TaKeyMap> > >::iteratorcdmapiter
map<string,int>colsize
Double_t*dacparam
multimap<string,vector<dtype*> >database
map<string,TaKeyMap>datamap
vector<string>dbcommand
map<string,int>dbinit
map<string,Bool_t>dbput
Bool_tdidinit
Bool_tdidput
Bool_tdidread
map<string,TaKeyMap,less<string>,allocator<pair<const string,TaKeyMap> > >::iteratordmapiter
UInt_tfCksumchecksum
Bool_t*fFirstAdcPed
Bool_t*fFirstScalPed
Bool_t*fFirstgdn
stringfileRead
Bool_tfirstiter
Bool_tinitdm
Int_tnbadev
TaRootRep*rootdbROOT representation
Int_trunnum
Double_t*scalped
vector<string>tables
Bool_tusectrl
Bool_tusemysql
Bool_tuseroot

Class Charts

Inheritance Chart:
TaDataBase

Function documentation

TaDataBase()
~TaDataBase()
void Read(int run, const vector<string>& dbcomm)
 Load the database for this run which is for example
     ./db/parity03_1441.db for run = 1441
 The flag 'usectrl' can be set via the '-D control.db' command
 line option; this forces us to use 'control.db' as the database.
 See also the comments in ChkDbCommand()
Int_t ChkDbCommand()
 Command line over-ride of database
 Logic does not allow infinite combinations, NOTE:
*  If  '-D control.db' we read from control.db.  Other
     '-D' command subsequently over-ride table(s).
  *  If  '-D useroot filename' we read database from ROOT
     file 'filename' and ignore all other commands.
  *  If  '-D mysql' we read database from MYSQL. Other '-D'
     commands subsequently over-ride table(s).
  *  It is an error to specify both mysql and useroot. If
     you try that, you'll get no data at all (ERROR).
  *  '-D table values'  will over-write the table with those
values, provided the line has proper syntax.  NOTE:  The
     table is dropped; therefore, you cannot add to a table,
     instead you must add all lines of a table when you start one.
     Normally this is ok for trivial tables like 'lobeam'.
void SetDbCommand()
Use the '-D' database command to over-ride table(s)
 of database.  See comments for ChkDbCommand()
ReadRoot(TaString filename)
 Load the database from a ROOT file 'filename'.
 This is done with '-D useroot filename' command line option.
 This choice, if chosen, takes precedence, i.e. all other source
 of data including command line is therefore ignored.
void Print()
 Human-readable printout for end-of-run summary
 This tells the user what variables were used for this run.
 Print() should be called BEFORE any Put() method is used
 because it shows the state of database at start of analysis.
Bool_t SelfCheck()
Returns kTRUE if the database makes good sense.
 This enforces some rules.
Checkout()
 Thorough debug checkout of database.  Ok, this is
 partly redundant with Print()
void PrintDataBase()
 Technical printout of entire database
void PrintDataMap()
 Technical printout of data map.
string GetAnaType()
Get analysis type, e.g. anatype = 'beam'
GetTimestamp()
 Get timestamp in format "yyyy-mm-dd hh:mm:ss"
GetTimeTDatime()
 Get timestamp as a TDatime object
GetTimeTString()
GetBlindingParams()
 Return the blinding parameters -- sign, mean, and offscale.
 Return defaults if absent from database.  Length of returned
 vector is always 3.
GetQpd1Const()
GetCavConst1()
 Return the Cavity monitor calibration parameters-
    xcal, ycal.
 Return defaults if absent from database.
GetCavConst2()
 Return the Cavity monitor calibration parameters-
    xcal, ycal.
 Return defaults if absent from database.
GetCavConst3()
 Return the Cavity monitor calibration parameters-
    xcal, ycal.
 Return defaults if absent from database.
string GetSimulationType()
 returns pair type (pair or quad) for this run.
string GetFdbkSwitch( const string &fdbktype )
 get the feedback switch state corresponding to feedback type fdbktype.
Int_t GetFdbkTimeScale( const string &fdbktype )
 get the timescale of feedback type fdbktype
string GetFdbkMonitor( const string &fdbktype )
 get the timescale of feedback type fdbktype
void Mysql(string action)
 Read or Write the database from Mysql server.
If reading, the ASCII database will be overwritten, so it is a
 good idea to keep backups.
 If writing, it is assumed the ASCII database was already written.
 Syntax of the Mysql script command is:
     $MYSQL_SCRIPT_DIR/mysql.pl  action  dbfile  run
 where
   $MYSQL_SCRIPT_DIR = environment variable pointing to script
   mysql.pl = Perl script that does all the work.
   action = "read" or "write"
   dbfile = name of ASCII database file to read or write
   run = run number
Write()
 Write the database for this run (if data was "Put").
 Output goes to both an ASCII file and to MYSQL.
 This method should be called AFTER all Put() methods are used.
Double_t GetData(const string& table)
 Return single value from table "table".  This assumes the data
 are in a pair  "table   value" where table is a unique string and
 value the single Double_t that belongs to it.
vector<Double_t> GetData(string table, vector<string> keys)
 Generic get method if you know the 'table' and 'keys' you want.
 Structure is 'table (key, data) (key, data)' i.e. a series of
 pairs of (string key, double data) after the string table
 The entire list of keys must be found, not a parital match.
string GetData(string table, string key, Int_t index)
 Return key'd data at index in dtype vector.
Double_t GetData(dtype *d)
Double_t GetDacNoise(const Int_t& adc, const Int_t& chan, const string& key)
 Get Dac noise parameters for adc,chan with key = 'slope'
Double_t GetAdcPed(const Int_t& adc, const Int_t& chan)
Get Pedestals for adc, chan
Double_t GetScalPed(const Int_t& scal, const Int_t& chan)
Get Pedestals for scaler, chan
UInt_t GetHeader(const string& device)
 Get Headers for decoding
UInt_t GetMask(const string& device)
Get Mask for decoding
Double_t GetCutValue(const string& cutname)
Get a cut value for 'value'.  e.g. value = 'lobeam', 'burpcut'
vector<Double_t> GetCutValueDVector(const string& cutname)
Get a vector of values for 'value'.  e.g. value = 'posburp'
Int_t GetNumCuts()
 Get number of cuts "ncuts" in the database.
vector<Int_t> GetExtLo()
Get cut extensions, low and high
vector<Int_t> GetExtHi()
Get cut evhi event intervals
vector<Double_t> GetDetWts()
 Get detector weights
vector<Double_t> GetBlumiWts()
 Get blumi weights
vector<Double_t> GetFlumiWts()
 Get flumi weights
Int_t GetNumBadEv()
 Get number of bad event intervals
map <Int_t, vector<Int_t> > GetCutInt()
For bad event intervals, get formatted results
 First element of map goes from 0 to GetNumBadEv(), second is a vector of
 results in prescribed order: (evlo, evhi, cut num, cut value)
Int_t GetCompress()
 returns ROOT file compression factor
Int_t GetMaxEvents()
 returns number of events to process
Int_t GetDelay()
 returns helicity delay (in windows)
Int_t GetOverSamp()
 returns oversample factor
string GetPairType()
 returns pair type (pair or quad) for this run.
string GetCurMon()
 Get current monitor to use for cuts and normalizations for this run
string GetCurMonC()
 Get current monitor to use for Hall C cuts for this run
Bool_t GetCalVar()
 Return true if calibration variables (not pedestal subtracted) are
 to be included in the raw data tree (default=false)
Double_t GetValue(const string& table)
 Return single value from table "table".  This assumes the data
 are in a pair  "table   value" where table is a unique string and
 value the single Double_t that belongs to it.
string GetString(const string& table)
 Return "string" from table "table".  This assumes the data
 are in a pair  "table  string" where table is unique and
 value the single string that belongs to it.
GetStringVect(const string& table)
GetEpicsKeys()
GetValueVector(const string& table)
GetValueDVector(const string& table)
void PutDacNoise(const Int_t& adc, const Int_t& chan, const Double_t& slope)
Put Dac noise parameters slope  for adc,chan
void PutAdcPed(const Int_t& adc, const Int_t& chan, const Double_t& ped)
Put Pedestals for adc, chan
void PutScalPed(const Int_t& scal, const Int_t& chan, const Double_t& ped)
Put Pedestals for scaler, chan
void PutCutInt(const vector<Int_t> myevint)
 Put a single bad event interval into the database.
 The user must call this for each cut interval.
The vector 'myevint' is a prescribed order:
   (evlo, evhi, cut num, cut value)
void PutData(string table, vector<dtype *> dvect)
 To put data into the database.
 PRIVATE method used by the public "Put" methods.
WARNINGS: PutData() will REPLACE the table.
 And, no, you do not want to set 'didput' here.
 Performance is poor but its ok because you will not call this often.
void InitDB()
 Define the database structure.
 Table names correspond to first column in Ascii DB.
 Careful, an error here can lead to incomprehensible core dump.
void LoadTable(string table, vector<dtype*> columns)
 Load the database for a 'table'
 The first call will set up the structure but load empty data.
 The 2nd call (loadflg==1) must overwrite the empty data of 1st call.
 Subsequent calls load data.
string FindTable(string table)
 Return 'case insensitive' table name if table exists
ToRoot()
Copy database to ROOT representation.
void DataMapReStart()
 To reset the datamap iterator.  Must be done before using
 NextDataMap() the first time.
Bool_t NextDataMap()
string GetDataMapName()
string GetDataMapType()
TaKeyMap GetKeyMap(string devicename)
void InitDataMap()
FindFirstKey(const string& sevb, const string& scrate)
 Find the location in datamap of the first key, according to the rules
 in ./doc/DATABASE.TXT
Int_t RotateState(const string long_devname)
 From the device name, recognize the suffix "_r" or "_ur"
 if it exists, and return an integer flag:
      1  -->  device is rotated
      0  -->  device is not rotated
     -1  -->  unknown
void WriteRoot()
Int_t GetRunNum()
{ return run_num; }
TDatime * GetAnaTDatime()
{ return AnaTDatime; }
TaKeyMap & operator=(const TaKeyMap& rhs)
TaDataBase()
string GetRandomHeli()
 Get random or toggle mode
 Get blinding parameters
string GetBlindingString()

Author: R. Holmes , A. Vacheret , R. Michaels , K.Paschke
Last update: pan/src:$Name: $:$Id: TaDataBase.cc,v 1.38 2006/02/27 22:30:30 paschke Exp $

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.