JANA2
JCalibrationFile Class Reference
Inheritance diagram for JCalibrationFile:
Collaboration diagram for JCalibrationFile:

Public Member Functions

 JCalibrationFile (string url, int32_t run, string context="default")
 
virtual const char * className (void)
 
bool GetCalib (string namepath, map< string, string > &svals, uint64_t event_number=0)
 
bool GetCalib (string namepath, vector< string > &svals, uint64_t event_number=0)
 
bool GetCalib (string namepath, vector< map< string, string > > &svals, uint64_t event_number=0)
 
bool GetCalib (string namepath, vector< vector< string > > &svals, uint64_t event_number=0)
 
bool PutCalib (string namepath, int32_t run_min, int32_t run_max, uint64_t event_min, uint64_t event_max, string &author, map< string, string > &svals, string comment="")
 
bool PutCalib (string namepath, int32_t run_min, int32_t run_max, uint64_t event_min, uint64_t event_max, string &author, vector< map< string, string > > &svals, string comment="")
 
void GetListOfNamepaths (vector< string > &namepaths)
 
- Public Member Functions inherited from JCalibration
 JCalibration (string url, int run, string context="default")
 
virtual void GetEventBoundaries (vector< uint64_t > &event_boundaries)
 User-callable access to event boundaries. More...
 
template<class T >
bool Get (string namepath, map< string, T > &vals, uint64_t event_number=0)
 
template<class T >
bool Get (string namepath, vector< T > &vals, uint64_t event_number=0)
 
template<class T >
bool Get (string namepath, vector< map< string, T > > &vals, uint64_t event_number=0)
 
template<class T >
bool Get (string namepath, vector< vector< T > > &vals, uint64_t event_number=0)
 
template<class T >
bool Put (string namepath, int32_t run_min, int32_t run_max, uint64_t event_min, uint64_t event_max, string &author, map< string, T > &vals, const string &comment="")
 
template<class T >
bool Put (string namepath, int32_t run_min, int32_t run_max, uint64_t event_min, uint64_t event_max, string &author, vector< T > &vals, const string &comment="")
 
template<class T >
bool Put (string namepath, int32_t run_min, int32_t run_max, uint64_t event_min, uint64_t event_max, string &author, vector< map< string, T > > &vals, const string &comment="")
 
template<class T >
bool Put (string namepath, int32_t run_min, int32_t run_max, uint64_t event_min, uint64_t event_max, string &author, vector< vector< T > > &vals, const string &comment="")
 
template<class T >
bool Get (string namepath, const T *&vals, uint64_t event_number=0)
 
const int32_t & GetRun (void) const
 
const string & GetContext (void) const
 
const string & GetURL (void) const
 
void GetAccesses (map< string, vector< string > > &accesses)
 
string GetVariation (void)
 
containerType_t GetContainerType (string typeid_name)
 
void DumpCalibrationsToFiles (string basedir="./")
 
void WriteCalibFileVector (string dir, string fname, string pathname)
 
void WriteCalibFileMap (string dir, string fname, string pathname)
 
void WriteCalibFileVectorVector (string dir, string fname, string pathname)
 
void WriteCalibFileVectorMap (string dir, string fname, string pathname)
 

Static Public Member Functions

static const char * static_className (void)
 
- Static Public Member Functions inherited from JCalibration
static const char * static_className (void)
 

Protected Member Functions

std::ofstream * CreateItemFile (string namepath, int32_t run_min, int32_t run_max, string &author, string &comment)
 
void MakeDirectoryPath (string namepath)
 
- Protected Member Functions inherited from JCalibration
template<typename T >
containerType_t TrycontainerType (string typeid_name)
 
virtual void RetrieveEventBoundaries (void)
 Optional for DBs that support event-level boundaries.
 

Additional Inherited Members

- Public Types inherited from JCalibration
enum  containerType_t {
  kUnknownType,
  kVector,
  kMap,
  kVectorVector,
  kVectorMap
}
 
- Protected Attributes inherited from JCalibration
int32_t run_number
 
pthread_mutex_t accesses_mutex
 
pthread_mutex_t stored_mutex
 
pthread_mutex_t boundaries_mutex
 

Member Function Documentation

bool JCalibrationFile::GetCalib ( string  namepath,
map< string, string > &  svals,
uint64_t  event_number = 0 
)
virtual

Open file specified by namepath (and the url passed to us in the constructor) and read in the calibration constants in plain ascii from it. Values are copied into svals.

File format can be one of two forms. Either one value per line or one key/value pair per line. If only one value is found, the line number is used as the key. When both key and value are present, they must be separated by white space. Lines starting with # are considered comments and are ignored.

Implements JCalibration.

bool JCalibrationFile::GetCalib ( string  namepath,
vector< string > &  svals,
uint64_t  event_number = 0 
)
virtual

Open file specified by namepath (and the url passed to us in the constructor) and read in the calibration constants in plain ascii from it. Values are copied into svals.

File format can be one of two forms. Either one value per line or one key/value pair per line. If only one value is found, the line number is used as the key. When both key and value are present, they must be separated by white space. Lines starting with # are considered comments and are ignored.

Implements JCalibration.

bool JCalibrationFile::GetCalib ( string  namepath,
vector< map< string, string > > &  svals,
uint64_t  event_number = 0 
)
virtual

Open file specified by namepath (and the url passed to us in the constructor) and read in a table of calibration constants in plain ascii. Values are copied into svals.

File format must be in a table form with the same number of items on every line. Items should be separated by white space. Lines starting with # are considered comments and are ignored except for the last commented line before the first line containing data. This is parsed (if present) to determine the column names that will be used to index the map. If an appropriate column names line is not found, numerical column names will be assigned starting from zero.

Implements JCalibration.

bool JCalibrationFile::GetCalib ( string  namepath,
vector< vector< string > > &  svals,
uint64_t  event_number = 0 
)
virtual

Open file specified by namepath (and the url passed to us in the constructor) and read in a table of calibration constants in plain ascii. Values are copied into svals.

File format must be in a table form with the same number of items on every line. Items should be separated by white space. Lines starting with # are considered comments and are ignored except for the last commented line before the first line containing data. This is parsed (if present) to determine the column names that will be used to index the map. If an appropriate column names line is not found, numerical column names will be assigned starting from zero.

Implements JCalibration.

void JCalibrationFile::GetListOfNamepaths ( vector< string > &  namepaths)
virtual

Get a list of the available namepaths by traversing the directory stucture looking for files. Note that this does NOT check whether the files are of a vaild format.

Implements JCalibration.

void JCalibrationFile::MakeDirectoryPath ( string  namepath)
protected

Create all subdirectories of basedir needed to hold the item identified by the given namepath.


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