QWPSlowConfigHandler Class Reference

Inheritance diagram for QWPSlowConfigHandler:

QWPSlowConfigContainer

List of all members.


Detailed Description

singleton class used to handle electronics configurations used in load curves procedure

Author:
Marco Vignati

Public Member Functions

virtual ~QWPSlowConfigHandler ()
 dtor
void KillDaqCrates (bool kill)
QError GetPresentConfig (const unsigned int lg, QEleChannelConfig &config)
const QEleChannelConfigGetConfig (const unsigned int lg, const unsigned int id) const
 get configuration associated to the given id and for the given logical channel
virtual bool AddConfig (const unsigned int lg, QEleChannelConfig *config)
 add a new configuration
bool Schedule (const unsigned int lg, QEleChannelConfig *config)
 schedule a measurement to be performed with the given electronics configuration
const QEleChannelConfigGetNextScheduled (const unsigned int lg) const
 get a read-only pointer to next scheduled measurement for a given channel
void EraseNextScheduled (const unsigned int lg)
 delete next scheduled measurement for the given logical channel
const QEleChannelConfigGetLastConfig (const unsigned int lg) const
 get last registered configuration
bool AddNextScheduled (const unsigned int lg)
 set next scheduled config as the next one to be applied
virtual void SetConfDone (const unsigned int lg, const unsigned int id)
 notfy that measurement with a certain configuration has been performed
bool IsConfDone () const
 check whether there are configurations for which a measurement is still to be performed
virtual bool SetActiveChannels (const std::list< unsigned int > &channels)
 set the list of channels that will be handled
const std::list< unsigned int > & GetActiveChannels () const
 get the list of channels that are being processed by the load curves procedure
void Clear ()
 clear all maps, reset current curve branch to negative and set external bias voltage to 0 (also in the hw)
bool Consolidate (bool triggerFlag)
 when this function is called all the new configurations added by mean of AddConfig() are applied to hardware
void Dump () const
bool SetSleepTime (const unsigned int sleepTime)
unsigned int GetSleepTime () const
void Update ()

Static Public Member Functions

static QWPSlowConfigHandlerGetInstance ()
 singleton getter

Protected Member Functions

 QWPSlowConfigHandler ()
 ctor

Protected Attributes

std::map< unsigned int,
std::vector< QEleChannelConfig * > > 
fConfigMap
std::list< unsigned int > fChannels
 list of channels for which loa curves are being drawn

Private Member Functions

void UpdateDaq (bool reset)
void InitSlowClient ()
bool ApplyConfig (const unsigned int lg, QEleChannelConfig *conf, const QEleChannelConfig *oldConf)
 apply slow config to hardware
void GetCratesToKill ()
 determine the daq crates the active channels belong to
bool CheckSlowStatus ()
 set slow serer to a status suitable for load curves (enable write mode and check that the correct settings basket is loaded)

Private Attributes

bool fKillDaq
bool fTriggerFlag
std::map< unsigned int,
std::list< QEleChannelConfig * > > 
fScheduled
std::map< unsigned int,
QEleChannelConfig
fPresentConfigs
std::map< unsigned int,
unsigned int > 
fCurrentConfig
std::list< unsigned int > fCrates
 list of daq crates the active logical channels belong to
std::map< unsigned int,
QEleChannelConfig * > 
fNextConfig
 map of logical channel and corresponding 'next' configuration
time_t fSleepTime
 time in second to wait after applying new settings
QDaqClient fDaqClient
QSlowControlClient fSlowClient

Member Function Documentation

const QEleChannelConfig * QWPSlowConfigHandler::GetConfig ( const unsigned int  lg,
const unsigned int  id 
) const

get configuration associated to the given id and for the given logical channel

Parameters:
lg logical channel
id config id
Returns:
const pointer to QEleChannelConfig object or NULL if requested id and logical channel do not exist.

References fConfigMap.

Referenced by MWPSlowController::Do(), MWPAnalyzer::Do(), and MGGAnalyzer::Do().

bool QWPSlowConfigHandler::AddConfig ( const unsigned int  lg,
QEleChannelConfig config 
) [virtual]

add a new configuration

Parameters:
lg logical channel the configuration is associated to
config pointer to the QEleChannelConfig to be added
Returns:
true on success, or false if:
  • bias polarity of config does not match polarity of current branch
  • external bias of config do not match current external bias
  • there are some configurations for which current measurement is still to be performed
  • lg does not belong to the list of channels set by mean of SetActiveChannels()
  • a new configuration for the same logical channel have already been added
Adding a new configuration will have no effect on harwdare until Consolidate() is called.

Reimplemented in QWPSlowConfigContainer.

References fChannels, fNextConfig, and IsConfDone().

Referenced by AddNextScheduled(), and MWPSlowController::PopulateNextConfig().

bool QWPSlowConfigHandler::Schedule ( const unsigned int  lg,
QEleChannelConfig config 
)

schedule a measurement to be performed with the given electronics configuration

Parameters:
lg logical channel
config requested electronics configuration
Returns:
true unless bias polarity of config does not match polarity of current branch or external bias of config do not match current external bias
This function is intended to be called by the load curves objects. Calling this function does not necessarily imply that a measurement with the requested configuration will be performed. As for AddConfig(), a configuration can be added only for registered logical channels, i.e. the ones that have been set by mean of SetActiveChannels().

References fScheduled.

const QEleChannelConfig * QWPSlowConfigHandler::GetNextScheduled ( const unsigned int  lg  )  const

get a read-only pointer to next scheduled measurement for a given channel

Parameters:
lg logical channel
Returns:
pointer to requested configuration or NULL if there are no scheduled measurements for that channel

References fScheduled.

Referenced by AddNextScheduled(), and MWPSlowController::PopulateNextConfig().

void QWPSlowConfigHandler::EraseNextScheduled ( const unsigned int  lg  ) 

delete next scheduled measurement for the given logical channel

Parameters:
lg logical channel
This method not only remove the pointer from the list of scheduled measurements, but also deletes the object associated to it. This method does nothing if there are no scheduled measurements for the requested logical channel

References fScheduled.

const QEleChannelConfig * QWPSlowConfigHandler::GetLastConfig ( const unsigned int  lg  )  const

get last registered configuration

Parameters:
lg logical channel for whic last configuration is to be returned
Returns:
pinter to requested configuration or NULL if it doesn't exist

References fConfigMap.

bool QWPSlowConfigHandler::AddNextScheduled ( const unsigned int  lg  ) 

set next scheduled config as the next one to be applied

Parameters:
lg logical channel
Returns:
true on success, false if there are no scheduled measurements for the requested channel, or for any other reason that would have caused AddConfig called on the same lg to return false.

References AddConfig(), fScheduled, and GetNextScheduled().

Referenced by MWPSlowController::PopulateNextConfig().

void QWPSlowConfigHandler::SetConfDone ( const unsigned int  lg,
const unsigned int  id 
) [virtual]

notfy that measurement with a certain configuration has been performed

Parameters:
lg logical channel of performed measurement
id configuration id of performed measurement

Reimplemented in QWPSlowConfigContainer.

References fCurrentConfig.

Referenced by MWPSlowController::Do().

bool QWPSlowConfigHandler::SetActiveChannels ( const std::list< unsigned int > &  channels  )  [virtual]

set the list of channels that will be handled

Parameters:
channels list of channels to be handled
Returns:
true unless the list of channels has already been set and has not been previously cleared by calling Clear().

Reimplemented in QWPSlowConfigContainer.

References fChannels, fCrates, and GetCratesToKill().

Referenced by MWPSlowController::Init().

bool QWPSlowConfigHandler::Consolidate ( bool  triggerFlag  ) 

when this function is called all the new configurations added by mean of AddConfig() are applied to hardware

Returns:
true on success, or false if there is at least one configuration that has not yet been set as done
Before and after applying changes to hardware a signal is sent to involved DataReader processes, in order to notify the changes in the hardware configuration. In order to be consistent with the id counting system implemented in QLCTriggerFinder, the id must be changed for all channels at the same time. Since the AddConfig function is instead called on a channel basis, When Consolidate is called, in order to enforce id consistency, a fake config with the 'previous' parameters is created for all channels for which AddConfig has not been called.

References ApplyConfig(), CheckSlowStatus(), fChannels, fConfigMap, fCrates, fCurrentConfig, fNextConfig, QBaseClient::GetError(), QEleChannelConfig::SetId(), and QDaqClient::SetTriggerFlag().

Referenced by MWPSlowController::PopulateNextConfig().

bool QWPSlowConfigHandler::ApplyConfig ( const unsigned int  lg,
QEleChannelConfig conf,
const QEleChannelConfig oldConf 
) [private]

bool QWPSlowConfigHandler::CheckSlowStatus (  )  [private]

set slow serer to a status suitable for load curves (enable write mode and check that the correct settings basket is loaded)

Returns:
true on success or false if any error occurred

References QSlowControlClient::GetBasket(), QDbDetector::GetCurrentRunNumber(), QSlowControlClient::GetMode(), QDbDetector::SettingsBasket(), QSlowControlClient::SetTuningMode(), and QSlowControlClient::SetWriteMode().

Referenced by Consolidate().


Member Data Documentation

std::map<unsigned int,std::vector<QEleChannelConfig*> > QWPSlowConfigHandler::fConfigMap [protected]

Map of logical channels (key) and corresponding configurations (value). The value of this map is a vector of pointers to QEleChannelConfig objects Here I use a std::vector because I need random access and I do not need to remove front elements.

Referenced by QWPSlowConfigContainer::AddConfig(), Clear(), Consolidate(), GetConfig(), and GetLastConfig().

std::map<unsigned int, std::list<QEleChannelConfig*> > QWPSlowConfigHandler::fScheduled [private]

map of logical channels (key) and list of scheduled configurations (value) Here I use a std::list because I do not need random access and I have to remove front elements.

Referenced by AddNextScheduled(), Clear(), EraseNextScheduled(), GetNextScheduled(), and Schedule().

std::map<unsigned int,unsigned int> QWPSlowConfigHandler::fCurrentConfig [private]

map of logical channel (key) and config id that is currently active (value). This map is needed in order to know what channels are still performing measurement with current active configuration

Referenced by Clear(), Consolidate(), IsConfDone(), and SetConfDone().

std::list<unsigned int> QWPSlowConfigHandler::fCrates [private]

list of daq crates the active logical channels belong to

This list is needed to know which daq crates must be killed every time the electronics configuration are being modified. It is updated every time the list of active channels is modified

Referenced by Clear(), Consolidate(), GetCratesToKill(), and SetActiveChannels().

std::map<unsigned int, QEleChannelConfig*> QWPSlowConfigHandler::fNextConfig [private]

map of logical channel and corresponding 'next' configuration

Next configuration is the one that is set by mean of AddConfig() and which is then applied to hardware when Consolidate() is called.

Referenced by AddConfig(), Clear(), and Consolidate().


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

Generated on Tue Nov 16 10:50:09 2010 for CUORE Software by  doxygen 1.5.6