emcDataManager Class Reference
[DataManager]

#include <emcDataManager.h>

List of all members.


Detailed Description

(Singleton) Handles read/write of EMCAL objects to/from DB/ASCII files.

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).

Author:
Laurent Aphecetche

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.
emcManageableCollect (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 emcDataManagerGetInstance ()
 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.


Constructor & Destructor Documentation

emcDataManager::emcDataManager  )  [private]
 

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().

emcDataManager::~emcDataManager  )  [inline]
 

dtor.

Definition at line 44 of file emcDataManager.h.


Member Function Documentation

const char* emcDataManager::GetDestinationDir void   )  [inline]
 

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().

emcDataManager * emcDataManager::GetInstance  )  [static]
 

Get the unique instance of this class.

Definition at line 44 of file emcDataManager.C.

References emcDataManager().

Referenced by mEmcTOFCorr2Module::apply_tdcped(), emcQAs::BuildDeadMap(), PbScSector::BuildFromDB(), PbGlSector::BuildFromDB(), calfemCheckList(), emcCalibrationDataHelper::collectCalibData(), emcRawDataCalibratorV2::CollectForCDO(), emcRawDataCalibratorV1::CollectForCDO(), emcRawDataCalibrator::CollectForCDO(), emcRawDataCalibratorV2::CollectForMDO(), emcRawDataCalibratorV1::CollectForMDO(), emcRawDataCalibrator::CollectForMDO(), convertNormalization(), convertSector(), createDirectory(), emcObjectManager::DataManager(), DM(), emcCalibrationDataHelper::emcCalibrationDataHelper(), mEmcToolsModule::EmcCollectDeadMap(), emcRejectList_to_tex(), emcOMHelper::findOM(), EmcSimuRawDataReCal::GetGainFactorFromDB(), emcRawDataAccessor::GetInstance(), LongTermGains(), namer(), emcBadNormt::process(), emcChannelEvolution::produce(), emcOMRejectList::Read(), emcOMCalibrationDataTofSectorOffset::Read(), emcChannelEvolution::read(), reader(), mEmcGeometryModule::readFromDB(), ReadOneFEMFromFile(), emcGainEvolution::run(), emcChannelEvolution::save(), test(), emcOMRejectList::Write(), emcOMCalibrationDataIniCal::Write(), and emcQAs::WriteDataToFile().

const char* emcDataManager::GetSourceDir void   )  [inline]
 

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().

static int emcDataManager::GetVerboseLevel void   )  [inline, static]
 

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().

void emcDataManager::ls const char *  opt = ""  ) 
 

Shows the list of the supported object's type (i.e.

the plug-in list).

Definition at line 82 of file emcDataManager.C.

bool emcDataManager::Read emcManageable object,
int  runnumber
 

Read a manageable object from a given source (specified by the obj itself) valid for a given run.

Parameters:
object Object you want to read (must be a subclass of emcManageable)
runnumber The recovery runnumber

Definition at line 151 of file emcDataManager.C.

References emcObjectManagerRegister::GetInstance(), and emcObjectManagerRegister::GetObjectManagerMap().

bool emcDataManager::Read emcManageable object,
const PHTimeStamp &  tSearch,
int  id = -1
 

Read a manageable object from a given source.

(specified by the obj itself).

Parameters:
object Object you want to read (must be a subclass of emcManageable)
tSearch The recovery time
id An identifier of your object (e.g. FEMcode).\ This id might be used to compute a Bank Identifier (this bankid\ is the actual id which will be stored in the DB). To be deprecated (new one = Read(object,runnumber) ?) ? Not obvious how to deprecate it until the underlying technology (pdbcal) still relies on timestamps and not on run numbers...

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().

bool emcDataManager::ReadPreviousVersion emcManageable object,
const PHTimeStamp &  time_stamp,
int  id,
int  version = 0
 

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().

void emcDataManager::Reset void   ) 
 

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().

void emcDataManager::SetDestinationDir const char *  path  )  [inline]
 

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().

void emcDataManager::SetSourceDir const char *  path  )  [inline]
 

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().

static void emcDataManager::SetVerboseLevel int  level = 0  )  [inline, static]
 

Set the verbose level.

Definition at line 128 of file emcDataManager.h.

References fVerboseLevel.

Referenced by calfemCheckList().

bool emcDataManager::Write const emcManageable object,
const PHTimeStamp &  tStart = PHTimeStamp(0),
int  id = -1
 

Write a manageable object to a given destination.

Destination is driven by the object itself (i.e. the object knows where it should go).

Parameters:
object Object to write to db.
tStart Only starting time for the validity period is given. Value of ending time is chosen by the OM. It might be 'now' (e.g. for the Gains), 'infinity' (e.g. for the Pedestals), or whatever the plugins decides.
id As in the read method

Definition at line 267 of file emcDataManager.C.

References emcObjectManagerRegister::GetInstance(), and emcObjectManagerRegister::GetObjectManagerMap().

Referenced by calfemCheckList(), emcChannelEvolution::save(), and emcOMFEMtupleT< BM, FT >::Write().


Member Data Documentation

std::string emcDataManager::fDestinationDir [private]
 

Definition at line 147 of file emcDataManager.h.

Referenced by emcDataManager(), GetDestinationDir(), and SetDestinationDir().

std::string emcDataManager::fSourceDir [private]
 

Definition at line 146 of file emcDataManager.h.

Referenced by emcDataManager(), GetSourceDir(), and SetSourceDir().

int emcDataManager::fVerboseLevel = 0 [static, private]
 

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().


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