Other api/dybdbi/gphysad

Previous topic

DybDbi.Dbi

Next topic

DybDbi.GSimPmtSpec

This Page

Daya Bay Links

Content Skeleton

DybDbi.GPhysAd

class DybDbi.GPhysAd(const GPhysAd& from)

Bases: DybDbi.DbiTableRow

This table can be read/written using DybDbi.AdLogicalPhysical

(adapted from Dan/Zhimin email 2011-01-17)

There are two ways to identify an AD in the experiment:

  1. Location: SAB-AD1, ..., FAR-AD4
  2. Physical ID: AD1, AD2, ..., AD8

Convention references

Convention Reference
DCS doc:3198
DAQ doc:3442 page 6
The Offline convention can be found from:

Here is a summary of the Location names/IDs that each system uses:

Site (Name and ID)

DCS DAQ Offline DAQ_ID Offline_ID
DBNS DBN DayaBay 0x10 0x01
LANS LAN LingAo 0x20 0x02
FARS FAR Far 0x30 0x04
MIDS MID Mid . 0x08
. . Aberdeen . 0x10
SAB SAB SAB 0x60 0x20
. . PMTBenchTest . 0x40
LSH . . . .

Detector/MainSys (Name and ID)

DCS DAQ Offline DAQ_ID Offline_ID
AD1 AD1 AD1 0x01 0x01
AD2 AD2 AD2 0x02 0x02
AD3 AD3 AD3 0x03 0x03
AD4 AD4 AD4 0x04 0x04
IWP WPI IWS 0x05 0x05
OWP WPO OWS 0x06 0x06
RPC RPC RPC 0x07 0x07
Muon . . . .
GAS . . . .
PMT . . . .
FEE . . . .
SIS . . . .

GPhysAd::GPhysAd() GPhysAd::GPhysAd(const GPhysAd& from) GPhysAd::GPhysAd(int PhysAdId)

AssignTimeGate

static void GPhysAd::AssignTimeGate(Int_t seconds, char* alternateName = 0)

Cache

static DbiCache* GPhysAd::Cache(char* alternateName = 0)

CanL2Cache

bool GPhysAd::CanL2Cache()

Close

static void GPhysAd::Close(char* filepath = 0l)

Compare

bool GPhysAd::Compare(const GPhysAd& that)

classmethod Create(*args, **kwargs)

Provide pythonic instance creation classmethod:

i = GTableName.Create( AttributeName=100. , ... ) 
CreateTableRow

DbiTableRow* GPhysAd::CreateTableRow()

CurrentTimeGate

static int GPhysAd::CurrentTimeGate(char* alternateName = 0)

DoubleValueForKey

double GPhysAd::DoubleValueForKey(char* key, double defval = -0x00000000000000001)

Fill

void GPhysAd::Fill(DbiResultSet& rs, DbiValidityRec* vrec)

FloatValueForKey

float GPhysAd::FloatValueForKey(char* key, float defval = -0x00000000000000001)

GetDatabaseLayout

std::string GPhysAd::GetDatabaseLayout()

GetDigest

std::string GPhysAd::GetDigest()

GetFields

std::string GPhysAd::GetFields()

GetPhysAdId

int GPhysAd::GetPhysAdId()

GetTableDescr

static std::string GPhysAd::GetTableDescr(char* alternateName = 0)

GetTableProxy

static DbiTableProxy& GPhysAd::GetTableProxy(char* alternateName = 0)

GetValues

std::string GPhysAd::GetValues()

IntValueForKey

int GPhysAd::IntValueForKey(char* key, int defval = -0x00000000000000001)

IsA

TClass* GPhysAd::IsA()

Rpt

static DbiRpt<GPhysAd>* GPhysAd::Rpt(char* ctx = GPhysAd::MetaRctx)

Save

void GPhysAd::Save()

SetPhysAdId

void GPhysAd::SetPhysAdId(int PhysAdId)

ShowMembers

void GPhysAd::ShowMembers(TMemberInspector&, char*)

SpecKeys

static TList* GPhysAd::SpecKeys()

SpecList

static TList* GPhysAd::SpecList()

SpecMap

static TMap* GPhysAd::SpecMap()

Store

void GPhysAd::Store(DbiOutRowStream& ors, DbiValidityRec* vrec)

Wrt

static DbiWrt<GPhysAd>* GPhysAd::Wrt(char* ctx = GPhysAd::MetaWctx)

aggregateno

int DbiTableRow::GetAggregateNo()

classmethod csv_check(path, **kwargs)

Check the validity of CSV file and correspondence with CSV fields and DBI attributes:

from DybDbi import GCalibPmtSpec
GCalibPmtSpec.csv_check( "$DBWRITERROOT/share/DYB_%s_AD1.txt" % "SAB", afterPulse="AfterPulseProb", sigmaSpe="SigmaSpeHigh", prePulse="PrePulseProb", description="Describ" ) 

Manual mapping is required if field names do not match DBI attribute names (primitive case insensitive auto mapping is applied to avoid the need for tedious full mapping).

classmethod csv_compare(path, **kwargs)

compare entries in CSV file with those found in DB

classmethod csv_export(path, **kwargs)

Export the result of a default context DBI query as a CSV file

Parameters:
  • path – path of output file
  • fieldnames – optionally specifiy the field order with a list of fieldnames

Note

make the output more human readable with regular column widths

classmethod csv_import(path, **kwargs)

Import CSV file into Database Using default writer context for now

ContextRange::ContextRange(const int siteMask, const int simMask, const TimeStamp& tstart, const TimeStamp& tend)

ql> select * from CalibPmtSpecVld ; +——-+———————+———————+———-+———+———+——+————-+———————+———————+ | SEQNO | TIMESTART | TIMEEND | SITEMASK | SIMMASK | SUBSITE | TASK | AGGREGATENO | VERSIONDATE | INSERTDATE | +——-+———————+———————+———-+———+———+——+————-+———————+———————+ | 26 | 2011-01-22 08:15:17 | 2020-12-30 16:00:00 | 127 | 1 | 0 | 0 | -1 | 2011-01-22 08:15:17 | 2011-02-25 08:10:15 | | 18 | 2010-06-21 07:49:24 | 2038-01-19 03:14:07 | 32 | 1 | 1 | 0 | -1 | 2010-06-21 15:50:24 | 2010-07-19 12:49:29 |

HMM... Better to make this a classmethod on the writer rather than the Row class... OR do not shrinkwrap .. just leave as example
databaselayout

std::string GPhysAd::GetDatabaseLayout()

digest

std::string GPhysAd::GetDigest()

extracondition

std::string DbiTableRow::GetExtraCondition()

fields

std::string GPhysAd::GetFields()

name

std::string GPhysAd::name()

physadid

int GPhysAd::GetPhysAdId()

tabledescr

static std::string GPhysAd::GetTableDescr(char* alternateName = 0)

tableproxy

static DbiTableProxy& GPhysAd::GetTableProxy(char* alternateName = 0)

values

std::string GPhysAd::GetValues()