AliPhysics  59e0e03 (59e0e03)
AliOADBForward Class Reference

#include <AliOADBForward.h>

Inheritance diagram for AliOADBForward:

Classes

class  Entry
 
class  Table
 

Public Types

enum  ERunSelectMode {
  kDefault = 0, kExact = 1, kNewest = 2, kNear = 3,
  kOlder = 4, kNewer = 5
}
 
enum  { kMaxNearDistance = 1000000, kInvalidField = 999 }
 

Public Member Functions

 AliOADBForward ()
 
 ~AliOADBForward ()
 
void Print (const Option_t *option="") const
 
void Browse (TBrowser *b)
 
TableFindTable (const TString &name, Bool_t quite=false) const
 
const TMap & GetTables () const
 
Input/output
Bool_t Open (const TString &fileName, const TString &tables="*", Bool_t rw=false, Bool_t verb=false, Bool_t fallback=false)
 
Bool_t Open (TFile *file, const TString &tables, Bool_t rw=false, Bool_t verb=false, Bool_t fallback=false)
 
Bool_t Close ()
 
Bool_t Update ()
 
Queries
EntryGet (const TString &table, ULong_t run=0, ERunSelectMode mode=kNear, UShort_t sys=0, UShort_t sNN=0, Short_t fld=0, Bool_t mc=false, Bool_t sat=false) const
 
TObjectGetData (const TString &table, ULong_t run=0, ERunSelectMode mode=kNear, UShort_t sys=0, UShort_t sNN=0, Short_t fld=0, Bool_t mc=false, Bool_t sat=false) const
 
Bool_t Insert (const TString &table, TObject *o, ULong_t runNo, UShort_t sys, UShort_t sNN, Short_t field, Bool_t mc=false, Bool_t sat=false, ULong_t aliRev=0, const TString &author="")
 
Bool_t CopyEntry (const TString &table, ULong_t oldRunNo, UShort_t oldSys, UShort_t oldSNN, Short_t oldField, ULong_t newRunNo, UShort_t newSys, UShort_t newSNN, Short_t newField, Bool_t mc, Bool_t sat)
 

Static Public Member Functions

static const char * Mode2String (ERunSelectMode mode)
 
static ERunSelectMode String2Mode (const TString &str)
 
static ERunSelectMode Int2Mode (Int_t mode)
 
Tests
static void TestGet (AliOADBForward &t, const TString &table, ULong_t runNo=0, ERunSelectMode mode=kNear, UShort_t sys=2, UShort_t sNN=2760, Short_t fld=-5, Bool_t mc=false, Bool_t sat=false)
 
static void TestInsert (AliOADBForward &t, const TString &table, ULong_t runNo=0, UShort_t sys=2, UShort_t sNN=2760, Short_t fld=-5, Bool_t mc=false, Bool_t sat=false)
 
static void Test ()
 

Protected Member Functions

Int_t GetFiles (TList &files) const
 
TableGetTableFromFile (TFile *file, Bool_t rw, const TString &name, const TString &mode) const
 
void OpenTable (TFile *file, Bool_t rw, const TString &name, const TString &mode, Bool_t verb, Bool_t fallback)
 

Static Protected Member Functions

static void AppendToQuery (TString &q, const TString &s, Bool_t andNotOr=true)
 
static TString Conditions (UShort_t sys=0, UShort_t sNN=0, Short_t fld=kInvalidField, Bool_t mc=false, Bool_t sat=false)
 

Protected Attributes

TMap fTables
 

Detailed Description

Container/handler of Forward calibration objects.

Definition at line 15 of file AliOADBForward.h.

Member Enumeration Documentation

anonymous enum

Various flags

Enumerator
kMaxNearDistance 

The maximum distance to the given run when selecting in kNear mode. Currently this is set to a large number to allow selection of any entry. This should change

kInvalidField 

Definition at line 79 of file AliOADBForward.h.

Options for selecting the entries according to the run number given in the query.

Enumerator
kDefault 
kExact 

Select only entries from exactly the run given.

kNewest 

Select the entry with the largest run number

kNear 

Select entries from the run nearest (possibly constrained to be older or newer) to the run given in the query

kOlder 

Select entries from runs that are older than the run given in the query. The oldest entry with the largest run number smaller than the given run is selected.

kNewer 

Select entries from runs that are newer than the run given. Select the entries with the smallest run number which is larger than the given run.

Definition at line 23 of file AliOADBForward.h.

Constructor & Destructor Documentation

AliOADBForward::AliOADBForward ( )

Constructor

Definition at line 622 of file AliOADBForward.cxx.

Referenced by Test().

AliOADBForward::~AliOADBForward ( )

Destructor

Definition at line 642 of file AliOADBForward.cxx.

Member Function Documentation

void AliOADBForward::AppendToQuery ( TString q,
const TString s,
Bool_t  andNotOr = true 
)
staticprotected

Helper function to append to query string

Parameters
qString to attach to
sWhat to attach
andNotOrIf true, assume and, otherwise or

Definition at line 1026 of file AliOADBForward.cxx.

Referenced by Conditions(), GetTables(), and AliOADBForward::Table::Query().

void AliOADBForward::Browse ( TBrowser *  b)

Browse this database

Parameters
bBrowser

Definition at line 910 of file AliOADBForward.cxx.

Referenced by AliOADBForward::Table::SetEnableFallBack().

Bool_t AliOADBForward::Close ( )

Close this database

Returns
true on success

Definition at line 758 of file AliOADBForward.cxx.

Referenced by AliOADBForward::Table::SetEnableFallBack(), AliCorrectionManagerBase::Correction::StoreIt(), Test(), and ~AliOADBForward().

TString AliOADBForward::Conditions ( UShort_t  sys = 0,
UShort_t  sNN = 0,
Short_t  fld = kInvalidField,
Bool_t  mc = false,
Bool_t  sat = false 
)
staticprotected

Helper function to build a query string

Parameters
sysCollision system (1:pp, 2: PbPb, 3:pPb)
sNNCollision energy in GeV
fldL3-Field strength and polarity
mcFor Monte-carlo
satFor satelitte collisions
Returns
Query string

Definition at line 1036 of file AliOADBForward.cxx.

Referenced by GetTables(), and AliOADBForward::Table::Query().

Bool_t AliOADBForward::CopyEntry ( const TString table,
ULong_t  oldRunNo,
UShort_t  oldSys,
UShort_t  oldSNN,
Short_t  oldField,
ULong_t  newRunNo,
UShort_t  newSys,
UShort_t  newSNN,
Short_t  newField,
Bool_t  mc,
Bool_t  sat 
)

Copy one entry to another entry

Parameters
tableTable name
oldRunNoOld run number
oldSysOld collision system
oldSNNOld center of mass energy
oldFieldOld L3 magnetic field strength
newRunNoNew run number
newSysNew collision system
newSNNNew center of mass energy
newFieldNew L3 magnetic field strength
mcTrue for MC only queries
satTrue for including satellite queries
Returns
true on success

Definition at line 867 of file AliOADBForward.cxx.

Referenced by CopyCorr().

AliOADBForward::Table * AliOADBForward::FindTable ( const TString name,
Bool_t  quite = false 
) const

Find a table by name

Parameters
nameName of table
quiteDo not print warning if not found
Returns
Table or null

Definition at line 926 of file AliOADBForward.cxx.

Referenced by AliCorrectionManagerBase::Correction::CleanIt(), CopyEntry(), Get(), GetData(), GetTableFromFile(), Insert(), and AliCorrectionManagerBase::Correction::OpenIt().

AliOADBForward::Entry * AliOADBForward::Get ( const TString table,
ULong_t  run = 0,
ERunSelectMode  mode = kNear,
UShort_t  sys = 0,
UShort_t  sNN = 0,
Short_t  fld = 0,
Bool_t  mc = false,
Bool_t  sat = false 
) const

Query the table for an object. The strategy is as follows.

  • First query with all fields
    • If this returns a single entry, return that.
    • If not, then ignore the run number (if given)
      • If this returns a single entry, return that
      • Otherwise, give up and return null

This allow us to specify default objects for a period, and for collision system, energy, and field setting.

Parameters
tableTable name
runRun number
modeRun selection mode
sysCollision system (1: pp, 2: PbPb, 3: pPb)
sNNCenter of mass energy (GeV)
fldL3 magnetic field (kG)
mcFor MC only
satFor satellite interactions
Returns
Found entry, or null

Definition at line 811 of file AliOADBForward.cxx.

Referenced by AliCorrectionManagerBase::Correction::ReadIt(), AliOADBForward::Table::SetEnableFallBack(), and TestGet().

TObject * AliOADBForward::GetData ( const TString table,
ULong_t  run = 0,
ERunSelectMode  mode = kNear,
UShort_t  sys = 0,
UShort_t  sNN = 0,
Short_t  fld = 0,
Bool_t  mc = false,
Bool_t  sat = false 
) const

Query the table for an object. The strategy is as follows.

  • First query with all fields
    • If this returns a single entry, return that.
    • If not, then ignore the run number (if given)
      • If this returns a single entry, return that
      • Otherwise, give up and return null

This allow us to specify default objects for a period, and for collision system, energy, and field setting.

Parameters
tableTable name
runRun number
modeRun selection mode
sysCollision system (1: pp, 2: PbPb, 3: pPb)
sNNCenter of mass energy (GeV)
fldL3 magnetic field (kG)
mcFor MC only
satFor satellite interactions
Returns
Found data, or null

Definition at line 830 of file AliOADBForward.cxx.

Referenced by AliOADBForward::Table::SetEnableFallBack().

Int_t AliOADBForward::GetFiles ( TList files) const
protected

Get a list of associated files

Parameters
filesOn return, contains list of files
Returns
Number of associated files found

Definition at line 941 of file AliOADBForward.cxx.

Referenced by Close(), GetTables(), and Update().

AliOADBForward::Table * AliOADBForward::GetTableFromFile ( TFile *  file,
Bool_t  rw,
const TString name,
const TString mode 
) const
protected

Get a table (TTree) from a file

Parameters
fileFile to look in
rwIf true, open read/write, false read-only
nameName of the table
modeDefault mode for new table, or override mode for existing tables if not default
Returns
Table or (if rw=true) possibly newly created table

Definition at line 965 of file AliOADBForward.cxx.

Referenced by GetTables(), and OpenTable().

const TMap& AliOADBForward::GetTables ( ) const
inline

Get all tables

Returns
Map of all tables

Definition at line 648 of file AliOADBForward.h.

Bool_t AliOADBForward::Insert ( const TString table,
TObject o,
ULong_t  runNo,
UShort_t  sys,
UShort_t  sNN,
Short_t  field,
Bool_t  mc = false,
Bool_t  sat = false,
ULong_t  aliRev = 0,
const TString author = "" 
)

Insert a new entry into the table

Parameters
tableTable name
oObject to write
runNoRun number
sysCollision system (1: pp, 2:PbPb, 3:pPb)
sNNCenter of mass energy (GeV)
fieldL3 magnetic field (kG)
mcIf true, only for MC
satFor satellite interactions
aliRevAliROOT revision
authorCreater of this correction
Returns
true on success

Definition at line 846 of file AliOADBForward.cxx.

Referenced by AliOADBForward::Table::SetEnableFallBack(), NormExtractor::Store(), AliCorrectionManagerBase::Correction::StoreIt(), and TestInsert().

AliOADBForward::ERunSelectMode AliOADBForward::Int2Mode ( Int_t  mode)
static

Return mode as an integer

Parameters
modeMode
Returns
Mode identifier

Definition at line 48 of file AliOADBForward.cxx.

const char * AliOADBForward::Mode2String ( ERunSelectMode  mode)
static
Bool_t AliOADBForward::Open ( const TString fileName,
const TString tables = "*",
Bool_t  rw = false,
Bool_t  verb = false,
Bool_t  fallback = false 
)

Open a file containing tables. Note, this member function can be called multiple times to open tables in different files.

If a table is already associated with this handler, it will not be re-associated.

Parameters
fileNamePath to file to get/write tables from/in
rwif true, open read+write, otherwise read-only
tablesTables to open
verbVerbosity flag
fallbackIf true allow for fall-backs
Returns
true on success

Definition at line 667 of file AliOADBForward.cxx.

Referenced by Browse(), CopyCorr(), AliCorrectionManagerBase::Correction::OpenIt(), NormExtractor::Store(), AliCorrectionManagerBase::Correction::StoreIt(), and Test().

Bool_t AliOADBForward::Open ( TFile *  file,
const TString tables,
Bool_t  rw = false,
Bool_t  verb = false,
Bool_t  fallback = false 
)

Open a file containing tables. Note, this member function can be called multiple times to open tables in different files.

If a table is already associated with this handler, it will not be re-associated.

Parameters
fileFile to get/write tables from/in
rwif true, open read+write, otherwise read-only
tablesTables to open
verbVerbosity flag
fallbackIf true allow for fall-backs
Returns
true on success

Definition at line 695 of file AliOADBForward.cxx.

void AliOADBForward::OpenTable ( TFile *  file,
Bool_t  rw,
const TString name,
const TString mode,
Bool_t  verb,
Bool_t  fallback 
)
protected

Get a table (TTree) from a file and attach

Parameters
fileFile to look in
rwIf true, open read/write, false read-only
nameName of the table
modeDefault mode for new table, or override mode for existing tables if not default
fallbackEnable fall-backs
verbIf true, be verbose
Returns
Table or (if rw=true) possibly newly created table

Definition at line 1004 of file AliOADBForward.cxx.

Referenced by GetTables(), and Open().

void AliOADBForward::Print ( const Option_t option = "") const

Print the content of all tables

Parameters
optionPassed on to tables

Definition at line 892 of file AliOADBForward.cxx.

Referenced by Test().

AliOADBForward::ERunSelectMode AliOADBForward::String2Mode ( const TString str)
static

Parse a string to get the mode

Parameters
strInput string
Returns
Mode

Definition at line 37 of file AliOADBForward.cxx.

Referenced by GetTableFromFile(), and AliOADBForward::Table::Table().

void AliOADBForward::Test ( )
static

Definition at line 1097 of file AliOADBForward.cxx.

void AliOADBForward::TestGet ( AliOADBForward t,
const TString table,
ULong_t  runNo = 0,
ERunSelectMode  mode = kNear,
UShort_t  sys = 2,
UShort_t  sNN = 2760,
Short_t  fld = -5,
Bool_t  mc = false,
Bool_t  sat = false 
)
static

Definition at line 1058 of file AliOADBForward.cxx.

Referenced by Test().

void AliOADBForward::TestInsert ( AliOADBForward t,
const TString table,
ULong_t  runNo = 0,
UShort_t  sys = 2,
UShort_t  sNN = 2760,
Short_t  fld = -5,
Bool_t  mc = false,
Bool_t  sat = false 
)
static

Definition at line 1078 of file AliOADBForward.cxx.

Referenced by Test().

Bool_t AliOADBForward::Update ( )

Flush to disk

Returns
true on success

Definition at line 784 of file AliOADBForward.cxx.

Referenced by AliOADBForward::Table::SetEnableFallBack().

Member Data Documentation

TMap AliOADBForward::fTables
protected

The documentation for this class was generated from the following files: