QLCSlowConfigHandler Class Reference

List of all members.

Detailed Description

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

Author:
sergio.didomizio@ge.infn.it


Public Member Functions

virtual ~QLCSlowConfigHandler ()
 dtor
const QLCSlowConfigGetConfig (const unsigned short lg, const unsigned short id) const
 get configuration associated to the given id and for the given logical channel
bool GetCurrentBranch () const
 get current bias polarity branch (fale = neg, true = pos)
float GetExternalBias () const
 get external bias voltage in Volts
bool SetExternalBias (const float bias)
 set external bias voltage in Volts and remove scheduled measurements that do not match new value of external bias
bool AddConfig (const unsigned short lg, QLCSlowConfig *config)
 add a new configuration
bool Schedule (const unsigned short lg, QLCSlowConfig *config)
 schedule a measurement to be performed with the given electronics configuration
const QLCSlowConfigGetNextScheduled (const unsigned short lg) const
 get a read-only pointer to next scheduled measurement for a given channel
void EraseNextScheduled (const unsigned short lg)
 delete next scheduled measurement for the given logical channel
const QLCSlowConfigGetLastConfig (const unsigned short lg) const
 get last registered configuration
bool AddNextScheduled (const unsigned short lg)
 set next scheduled config as the next one to be applied
void SetConfDone (const unsigned short lg, const unsigned short 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
bool SetCurveDone (const unsigned short lg)
 notify that the curve for the given channel is complete
bool IsCurvesDone () const
 check wheter all curves are done
bool SetBranchDone (const unsigned short lg)
 notify that the curve branch for the given channel is complete
bool IsBranchDone () const
 check whether current curve branch is done for all channels
bool SetActiveChannels (const std::list< unsigned short > &channels)
 set the list of channels that will be handled
bool GoToPositiveBranch ()
 switch from negative to positive branch
const std::list< unsigned
short > & 
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)
void ClearMemory ()
 clear all maps
bool Consolidate ()
 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 short sleepTime)
unsigned short GetSleepTime () const

Static Public Member Functions

static QLCSlowConfigHandlerGetInstance ()
 singleton getter

Private Member Functions

 QLCSlowConfigHandler ()
 ctor
void InitSlowClient ()
bool ApplyConfig (const unsigned short lg, QLCSlowConfig *conf, const QLCSlowConfig *oldConf)
 apply slow config to hardware
void GetCratesToKill ()
 determine the daq crates the active channels belong to
void UpdateExternalBias ()
 set external bias to hardware
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

float fExternalBias
 bias voltage from exernal alimentation in Volts
std::map< unsigned short,
std::vector< QLCSlowConfig * > > 
fConfigMap
std::map< unsigned short,
std::list< QLCSlowConfig * > > 
fScheduled
std::map< unsigned short,
unsigned short > 
fCurrentConfig
std::list< unsigned short > fChannels
 list of channels for which loa curves are being drawn
std::list< unsigned short > fBranchDone
 list of logical channels that are at the end of a curve branch
bool fCurrentBranch
 current curve branch (false = neg bias, true = pos bias)
std::list< int > fCrates
 list of daq crates the active logical channels belong to
std::map< unsigned short,
QLCSlowConfig * > 
fNextConfig
 map of logical channel and corresponding 'next' configuration
unsigned short fSleepTime
 time in second to wait after applying new settings
QDaqClient fDaqClient
QSlowControlClient fSlowClient


Member Function Documentation

const QLCSlowConfig * QLCSlowConfigHandler::GetConfig ( const unsigned short  lg,
const unsigned short  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 QLCSlowConfig object or NULL if requested id and logical channel do not exist.

bool QLCSlowConfigHandler::SetExternalBias ( const float  bias  ) 

set external bias voltage in Volts and remove scheduled measurements that do not match new value of external bias

Returns:
true on success or false on failiure (see detailed description)
This method can be called only when IsConfDone() is true and before starting to add new measurements by mean of AddConfig() or AddNextScheduled(). The reason for this is that external bias must be the same for all channels and the best point to check this is when new measurements are being added.

bool QLCSlowConfigHandler::AddConfig ( const unsigned short  lg,
QLCSlowConfig config 
)

add a new configuration

Parameters:
lg logical channel the configuration is associated to
config pointer to the QLCSlowConfig 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.

bool QLCSlowConfigHandler::Schedule ( const unsigned short  lg,
QLCSlowConfig 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().

const QLCSlowConfig * QLCSlowConfigHandler::GetNextScheduled ( const unsigned short  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

void QLCSlowConfigHandler::EraseNextScheduled ( const unsigned short  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

const QLCSlowConfig * QLCSlowConfigHandler::GetLastConfig ( const unsigned short  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

bool QLCSlowConfigHandler::AddNextScheduled ( const unsigned short  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.

void QLCSlowConfigHandler::SetConfDone ( const unsigned short  lg,
const unsigned short  id 
)

notfy that measurement with a certain configuration has been performed

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

bool QLCSlowConfigHandler::SetCurveDone ( const unsigned short  lg  ) 

notify that the curve for the given channel is complete

Parameters:
lg logical channel
Returns:
true unless this method is called during negative curve branch
When this method is called, elements corresponding to the requested lg are deleted from fChannels, fNextConfig, fCurrentConfig, fScheduled.

bool QLCSlowConfigHandler::IsCurvesDone (  )  const [inline]

check wheter all curves are done

Returns:
true if all curves are done, false otherwise

bool QLCSlowConfigHandler::SetBranchDone ( const unsigned short  lg  ) 

notify that the curve branch for the given channel is complete

Parameters:
lg logical channel
Returns:
true unless this method is called during positive curve branch
This method will also set currently active configuration as done

bool QLCSlowConfigHandler::IsBranchDone (  )  const

check whether current curve branch is done for all channels

Returns:
true if current branch is negative and all channels are at the end of the branch, false otherwise

bool QLCSlowConfigHandler::SetActiveChannels ( const std::list< unsigned short > &  channels  ) 

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

bool QLCSlowConfigHandler::GoToPositiveBranch (  ) 

switch from negative to positive branch

Returns:
true if current branch is negative and all negative branches are done, false otherwise

bool QLCSlowConfigHandler::Consolidate (  ) 

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.

bool QLCSlowConfigHandler::ApplyConfig ( const unsigned short  lg,
QLCSlowConfig conf,
const QLCSlowConfig oldConf 
) [private]

apply slow config to hardware

Parameters:
lg logical channel the configuration will be applied to
conf set of configurations to be applied
oldConf set of electronics configuraions that are present before the settings that are going to be applied
If oldConf is not NULL only the settings that are different between conf and oldConf are actually applied to hardware. If oldConf is NULL, all the settings are applied.

bool QLCSlowConfigHandler::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


Member Data Documentation

std::map<unsigned short,std::vector<QLCSlowConfig*> > QLCSlowConfigHandler::fConfigMap [private]

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

std::map<unsigned short, std::list<QLCSlowConfig*> > QLCSlowConfigHandler::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.

std::map<unsigned short,unsigned short> QLCSlowConfigHandler::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

bool QLCSlowConfigHandler::fCurrentBranch [private]

current curve branch (false = neg bias, true = pos bias)

This variable is used as a cross consistency check: when applying settings to hardware the polarity in QLCSlowConfig objects must be the same as that of current branch, and also SetBranchDone() can be called only on the first (negative) branch, since calling it on the second branch means that the curve is done.

std::list<int> QLCSlowConfigHandler::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

std::map<unsigned short, QLCSlowConfig*> QLCSlowConfigHandler::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.


The documentation for this class was generated from the following files:
Generated on Fri Mar 6 13:40:44 2009 for CUORE Software by  doxygen 1.5.1