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
| TaDataBase() | |
| virtual | ~TaDataBase() |
| void | Checkout() |
| static TClass* | Class() |
| void | DataMapReStart() |
| Double_t | GetAdcPed(const Int_t& adc, const Int_t& chan) const |
| TDatime* | GetAnaTDatime() const |
| string | GetAnaType() const |
| vector<Double_t> | GetBlindingParams() const |
| string | GetBlindingString() const |
| vector<Double_t> | GetBlumiWts() const |
| Bool_t | GetCalVar() const |
| vector<Double_t> | GetCavConst1() const |
| vector<Double_t> | GetCavConst2() const |
| vector<Double_t> | GetCavConst3() const |
| UInt_t | GetCksum() const |
| Int_t | GetCompress() const |
| string | GetCurMon() const |
| string | GetCurMonC() const |
| map<Int_t,vector<Int_t> > | GetCutInt() const |
| vector<string> | GetCutNames() const |
| Cut_t | GetCutNumber(TaString s) const |
| Double_t | GetCutValue(const string& cutname) const |
| vector<Double_t> | GetCutValueDVector(const string& cutname) const |
| Double_t | GetDacNoise(const Int_t& adc, const Int_t& chan, const string& key) const |
| Double_t | GetData(dtype* dat) const |
| Double_t | GetData(const string& key) const |
| vector<Double_t> | GetData(string table, vector<string> key) const |
| string | GetData(string table, string key, Int_t index) const |
| string | GetDataMapName() const |
| string | GetDataMapType() const |
| Int_t | GetDelay() const |
| vector<Double_t> | GetDetWts() const |
| vector<TaString> | GetEpicsKeys() const |
| vector<Int_t> | GetExtHi() const |
| vector<Int_t> | GetExtLo() const |
| string | GetFdbkMonitor(const string& fdbktype) const |
| string | GetFdbkSwitch(const string& fdbktype) const |
| Int_t | GetFdbkTimeScale(const string& fdbktype) const |
| vector<Double_t> | GetFlumiWts() const |
| UInt_t | GetHeader(const string& device) const |
| TaKeyMap | GetKeyMap(string device) const |
| UInt_t | GetMask(const string& device) const |
| Int_t | GetMaxEvents() const |
| Int_t | GetNumBadEv() const |
| Int_t | GetNumCuts() const |
| Int_t | GetOverSamp() const |
| string | GetPairType() const |
| vector<Double_t> | GetQpd1Const() const |
| string | GetRandomHeli() const |
| Int_t | GetRunNum() const |
| Double_t | GetScalPed(const Int_t& adc, const Int_t& chan) const |
| string | GetSimulationType() const |
| string | GetString(const string& table) const |
| vector<TaString> | GetStringVect(const string& table) const |
| string | GetTimestamp() const |
| TDatime | GetTimeTDatime() const |
| TString | GetTimeTString() const |
| Double_t | GetValue(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_t | NextDataMap() |
| void | Print() |
| void | PrintDataBase() |
| void | PrintDataMap() |
| void | PutAdcPed(const Int_t& adc, const Int_t& chan, const Double_t& value) |
| void | PutCutInt(const vector<Int_t> evint) |
| void | PutDacNoise(const Int_t& adc, const Int_t& chan, const Double_t& slope) |
| void | PutScalPed(const Int_t& scal, const Int_t& chan, const Double_t& value) |
| void | Read(int run, const vector<string>& dbcommand) |
| void | ReadRoot(TaString filename) |
| Bool_t | SelfCheck() |
| virtual void | ShowMembers(TMemberInspector& insp, char* parent) |
| virtual void | Streamer(TBuffer& b) |
| void | StreamerNVirtual(TBuffer& b) |
| void | Write() |
| void | WriteRoot() |
| TaDataBase(const TaDataBase& fn) | |
| Int_t | ChkDbCommand() |
| Int_t | FindFirstKey(const string& sb, const string& sc) |
| string | FindTable(string table) |
| void | InitDataMap() |
| void | InitDB() |
| void | LoadCksum(const string) |
| void | LoadTable(string table, vector<dtype*>) |
| void | Mysql(string action) |
| TaDataBase& | operator=(const TaDataBase& fn) |
| void | PutData(string table, vector<dtype*> dvect) |
| Int_t | RotateState(const string long_devname) |
| void | SetDbCommand() |
| string | StripRotate(const string long_devname) |
| void | ToRoot() |
| TDatime* | AnaTDatime | TDatime of when run was analyzed |
| Double_t* | adcped | |
| map<string,TaKeyMap,less<string>,allocator<pair<const string,TaKeyMap> > >::iterator | cdmapiter | |
| 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_t | didinit | |
| Bool_t | didput | |
| Bool_t | didread | |
| map<string,TaKeyMap,less<string>,allocator<pair<const string,TaKeyMap> > >::iterator | dmapiter | |
| UInt_t | fCksum | checksum |
| Bool_t* | fFirstAdcPed | |
| Bool_t* | fFirstScalPed | |
| Bool_t* | fFirstgdn | |
| string | fileRead | |
| Bool_t | firstiter | |
| Bool_t | initdm | |
| Int_t | nbadev | |
| TaRootRep* | rootdb | ROOT representation |
| Int_t | runnum | |
| Double_t* | scalped | |
| vector<string> | tables | |
| Bool_t | usectrl | |
| Bool_t | usemysql | |
| Bool_t | useroot |
| Inheritance Chart: | |||||
|
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()
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'.
Use the '-D' database command to over-ride table(s) of database. See comments for ChkDbCommand()
Return the blinding parameters -- sign, mean, and offscale. Return defaults if absent from database. Length of returned vector is always 3.
Return the Cavity monitor calibration parameters-
xcal, ycal.
Return defaults if absent from database.
Return the Cavity monitor calibration parameters-
xcal, ycal.
Return defaults if absent from database.
Return the Cavity monitor calibration parameters-
xcal, ycal.
Return defaults if absent from database.
get the feedback switch state corresponding to feedback type fdbktype.
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
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.
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.
Get Dac noise parameters for adc,chan with key = 'slope'
Get a cut value for 'value'. e.g. value = 'lobeam', 'burpcut'
Get a vector of values for 'value'. e.g. value = 'posburp'
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)
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.
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.
Put Dac noise parameters slope for adc,chan
Put Pedestals for adc, chan
Put Pedestals for scaler, chan
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)
Define the database structure. Table names correspond to first column in Ascii DB. Careful, an error here can lead to incomprehensible core dump.
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.
To reset the datamap iterator. Must be done before using NextDataMap() the first time.
Find the location in datamap of the first key, according to the rules in ./doc/DATABASE.TXT
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