#include <emcDataManager.h>
The basic idea is that all data traffic to/from a database (Objy, Pg, or even some ascii files) should go through this object. The interface of the Data Manager (DM) has 2 main methods : Read
and Write
. The Read
method is used to retrieve objects from a datasource (mainly Postgres or ASCII file, nowadays) usually by packets of 144 items (but this is driven by the object to be read really). The Write
method can write objects of any size which is usually (but it's not mandatory) a multiple of 144 items (as long as the underlying plugin is able to do the job, of course...)
It is of prime importance to realize that the DM does nothing by itself. It uses Object Managers (OM or plugins hereafter) to handle Read/Write requests. DM and OM can only handle objects which derive from type emcManageable
. OM are added to the DM via a plug-in mechanism (see documentation on emcObjectManager
class for more information).
Definition at line 35 of file emcDataManager.h.
Public Member Functions | |
~emcDataManager () | |
dtor. | |
void | ls (const char *opt="") |
Shows the list of the supported object's type (i.e. | |
emcManageable * | Collect (const emcManageable &object, const PHTimeStamp &when) |
const char * | GetDestinationDir (void) |
Get the directory where to put the calibration data files. | |
const char * | GetSourceDir (void) |
Get the directory where to find the calibration data files. | |
bool | Read (emcManageable &object, const PHTimeStamp &tSearch, int id=-1) |
Read a manageable object from a given source. | |
bool | Read (emcManageable &object, int runnumber) |
Read a manageable object from a given source (specified by the obj itself) valid for a given run. | |
bool | ReadPreviousVersion (emcManageable &object, const PHTimeStamp &time_stamp, int id, int version=0) |
Special read method to retrieve shadowed banks. | |
void | Reset (void) |
Reset DM and underlying plugins. | |
void | SetDestinationDir (const char *path) |
Set the directory where to put the calibration data files. | |
void | SetSourceDir (const char *path) |
Set the directory where to find the calibration data files. | |
bool | Write (const emcManageable &object, const PHTimeStamp &tStart=PHTimeStamp(0), int id=-1) |
Write a manageable object to a given destination. | |
Static Public Member Functions | |
static emcDataManager * | GetInstance () |
Get the unique instance of this class. | |
static int | GetVerboseLevel (void) |
Get the verbose level. | |
static void | SetVerboseLevel (int level=0) |
Set the verbose level. | |
Private Member Functions | |
emcDataManager () | |
not to be used. This class is a singleton. | |
Private Attributes | |
std::string | fSourceDir |
std::string | fDestinationDir |
Static Private Attributes | |
static int | fVerboseLevel = 0 |
Here are some implementation notes. |
|
not to be used. This class is a singleton.
Definition at line 28 of file emcDataManager.C. References fDestinationDir, fSourceDir, SetDestinationDir(), and SetSourceDir(). Referenced by GetInstance(). |
|
dtor.
Definition at line 44 of file emcDataManager.h. |
|
Get the directory where to put the calibration data files. (in case calibration data has to go on files instead of DB). Definition at line 68 of file emcDataManager.h. References fDestinationDir. Referenced by emcChannelEvolution::save(), emcOMRejectList::Write(), emcOMCalibrationDataIniCal::Write(), and emcQAs::WriteDataToFile(). |
|
|
Get the directory where to find the calibration data files. (in case calibration data has to be fetched from files instead of DB). Definition at line 73 of file emcDataManager.h. References fSourceDir. Referenced by emcOMRejectList::Read(), emcOMCalibrationDataTofSectorOffset::Read(), emcChannelEvolution::read(), and reader(). |
|
Get the verbose level.
Definition at line 76 of file emcDataManager.h. References fVerboseLevel. Referenced by emcQAs::BuildDeadMap(), emcCalibrationDataHelper::collectCalibData(), createDirectory(), emcOMHelper::findOM(), emcOMCalibrationDataTofSectorOffset::Read(), and ReadOneFEMFromFile(). |
|
Shows the list of the supported object's type (i.e. the plug-in list). Definition at line 82 of file emcDataManager.C. |
|
Read a manageable object from a given source (specified by the obj itself) valid for a given run.
Definition at line 151 of file emcDataManager.C. References emcObjectManagerRegister::GetInstance(), and emcObjectManagerRegister::GetObjectManagerMap(). |
|
Read a manageable object from a given source. (specified by the obj itself).
Definition at line 88 of file emcDataManager.C. References emcObjectManagerRegister::GetInstance(), and emcObjectManagerRegister::GetObjectManagerMap(). Referenced by calfemCheckList(), convertNormalization(), convertSector(), emcCalibrationDataHelper::emcCalibrationDataHelper(), emcRejectList_to_tex(), EmcSimuRawDataReCal::GetGainFactorFromDB(), LongTermGains(), emcBadNormt::process(), emcChannelEvolution::produce(), emcOMFEMtupleT< BM, FT >::Read(), emcChannelEvolution::read(), mEmcGeometryModule::readFromDB(), and emcGainEvolution::run(). |
|
Special read method to retrieve shadowed banks. Same parameters as for Read method, plus version which is : 0 for latest version (completely equivalent of Read) -1 for previous version, -2 for previous to previous, etc... Definition at line 198 of file emcDataManager.C. References emcObjectManagerRegister::GetInstance(), and emcObjectManagerRegister::GetObjectManagerMap(). |
|
Reset DM and underlying plugins. Call this method if you would like to have the same behavior of the DM as if it was freshly created. Definition at line 250 of file emcDataManager.C. References emcObjectManagerRegister::GetInstance(), and emcObjectManagerRegister::GetObjectManagerMap(). |
|
Set the directory where to put the calibration data files. (in case calibration data has to go on files instead of DB). Definition at line 120 of file emcDataManager.h. References fDestinationDir. Referenced by calfemCheckList(), emcDataManager(), and emcChannelEvolution::save(). |
|
Set the directory where to find the calibration data files. (in case calibration data has to be fetched from files instead of DB). Definition at line 125 of file emcDataManager.h. References fSourceDir. Referenced by calfemCheckList(), emcDataManager(), emcRejectList_to_tex(), LongTermGains(), and emcChannelEvolution::read(). |
|
Set the verbose level.
Definition at line 128 of file emcDataManager.h. References fVerboseLevel. Referenced by calfemCheckList(). |
|
Write a manageable object to a given destination. Destination is driven by the object itself (i.e. the object knows where it should go).
Definition at line 267 of file emcDataManager.C. References emcObjectManagerRegister::GetInstance(), and emcObjectManagerRegister::GetObjectManagerMap(). Referenced by calfemCheckList(), emcChannelEvolution::save(), and emcOMFEMtupleT< BM, FT >::Write(). |
|
Definition at line 147 of file emcDataManager.h. Referenced by emcDataManager(), GetDestinationDir(), and SetDestinationDir(). |
|
Definition at line 146 of file emcDataManager.h. Referenced by emcDataManager(), GetSourceDir(), and SetSourceDir(). |
|
Here are some implementation notes. The Read,Write and Create methods are implemented the very same way. So we could probably have make a couple of methods to iterate over the object manager register, and use those methods in Read, Write and Create instead of having 3 times the same kind of loop. But we still don't know if this class will have to run in a multi-threaded environment. If so, we might want to think a little more about what this implies for a single looping mechanism. I've not give it a though yet. Just have to... Definition at line 145 of file emcDataManager.h. Referenced by GetVerboseLevel(), and SetVerboseLevel(). |