Public Member Functions | |
virtual | ~QLCSlowConfigHandler () |
dtor | |
const QEleChannelConfig * | GetConfig (const unsigned int lg, const unsigned int 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 | |
void | SetMaxExternalBias (float bias) |
set max external bias in V | |
float | GetMaxExternalBias () const |
get max external bias in V | |
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 QEleChannelConfig * | GetNextScheduled (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 QEleChannelConfig * | GetLastConfig (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 | |
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 | |
bool | SetCurveDone (const unsigned int lg) |
notify that the curve for the given channel is complete | |
bool | IsCurvesDone () const |
check wheter all curves are done | |
bool | SetBranchDone (const unsigned int 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 int > &channels) |
set the list of channels that will be handled | |
void | SetWrongPolarityChannels (const std::set< unsigned int > &wrongChannels) |
set list of channels that have wrong bias polarity mapping | |
bool | GoToPositiveBranch () |
switch from negative to positive branch | |
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) | |
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 int sleepTime) |
unsigned int | GetSleepTime () const |
Static Public Member Functions | |
static QLCSlowConfigHandler & | GetInstance () |
singleton getter | |
Private Member Functions | |
QLCSlowConfigHandler () | |
ctor | |
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 | HasWrongPolarityMapping (unsigned int lg) const |
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 | |
float | fMaxExternalBias |
std::map< unsigned int, std::vector< QEleChannelConfig * > > | fConfigMap |
std::map< unsigned int, std::list< QEleChannelConfig * > > | fScheduled |
std::map< unsigned int, unsigned int > | fCurrentConfig |
std::list< unsigned int > | fChannels |
std::set< unsigned int > | fWrongPolarityChannels |
std::list< unsigned int > | 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< 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 | |
unsigned int | fSleepTime |
time in second to wait after applying new settings | |
QDaqClient | fDaqClient |
QSlowControlClient | fSlowClient |
const QEleChannelConfig * QLCSlowConfigHandler::GetConfig | ( | const unsigned int | lg, | |
const unsigned int | id | |||
) | const |
get configuration associated to the given id and for the given logical channel
lg | logical channel | |
id | config id |
References fConfigMap.
Referenced by MLCCurveAnalyzer::Do().
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
References fExternalBias, fNextConfig, fScheduled, and IsConfDone().
Referenced by MLCSlowController::IncrementExternalBias(), MLCSlowController::Init(), and MLCSlowController::PopulateNextConfig().
bool QLCSlowConfigHandler::AddConfig | ( | const unsigned int | lg, | |
QEleChannelConfig * | config | |||
) |
add a new configuration
lg | logical channel the configuration is associated to | |
config | pointer to the QEleChannelConfig to be added |
References fChannels, fCurrentBranch, fExternalBias, fNextConfig, QEleChannelConfig::GetBiasPolarity(), QEleChannelConfig::GetExternalBias(), and IsConfDone().
Referenced by AddNextScheduled(), MLCSlowController::Init(), and MLCSlowController::PopulateNextConfig().
bool QLCSlowConfigHandler::Schedule | ( | const unsigned int | lg, | |
QEleChannelConfig * | config | |||
) |
schedule a measurement to be performed with the given electronics configuration
lg | logical channel | |
config | requested electronics configuration |
References fCurrentBranch, fExternalBias, fScheduled, QEleChannelConfig::GetBiasPolarity(), and QEleChannelConfig::GetExternalBias().
const QEleChannelConfig * QLCSlowConfigHandler::GetNextScheduled | ( | const unsigned int | lg | ) | const |
get a read-only pointer to next scheduled measurement for a given channel
lg | logical channel |
References fScheduled.
Referenced by AddNextScheduled(), and MLCSlowController::PopulateNextConfig().
void QLCSlowConfigHandler::EraseNextScheduled | ( | const unsigned int | lg | ) |
delete next scheduled measurement for the given logical channel
lg | logical channel |
References fScheduled.
Referenced by MLCSlowController::PopulateNextConfig().
const QEleChannelConfig * QLCSlowConfigHandler::GetLastConfig | ( | const unsigned int | lg | ) | const |
get last registered configuration
lg | logical channel for whic last configuration is to be returned |
References fConfigMap.
Referenced by MLCSlowController::PopulateNextConfig().
bool QLCSlowConfigHandler::AddNextScheduled | ( | const unsigned int | lg | ) |
set next scheduled config as the next one to be applied
lg | logical channel |
References AddConfig(), fScheduled, and GetNextScheduled().
Referenced by MLCSlowController::PopulateNextConfig().
void QLCSlowConfigHandler::SetConfDone | ( | const unsigned int | lg, | |
const unsigned int | id | |||
) |
notfy that measurement with a certain configuration has been performed
lg | logical channel of performed measurement | |
id | configuration id of performed measurement |
References fCurrentConfig.
Referenced by SetBranchDone().
bool QLCSlowConfigHandler::SetCurveDone | ( | const unsigned int | lg | ) |
notify that the curve for the given channel is complete
lg | logical channel |
References fChannels, fCurrentBranch, fCurrentConfig, fNextConfig, fScheduled, and GetCratesToKill().
bool QLCSlowConfigHandler::IsCurvesDone | ( | ) | const [inline] |
check wheter all curves are done
References fChannels.
Referenced by MLCSlowController::PopulateNextConfig().
bool QLCSlowConfigHandler::SetBranchDone | ( | const unsigned int | lg | ) |
notify that the curve branch for the given channel is complete
lg | logical channel |
References fBranchDone, fChannels, fCurrentBranch, fCurrentConfig, and SetConfDone().
bool QLCSlowConfigHandler::IsBranchDone | ( | ) | const |
check whether current curve branch is done for all channels
References fBranchDone, fChannels, fCurrentBranch, and IsConfDone().
Referenced by GoToPositiveBranch(), and MLCSlowController::PopulateNextConfig().
bool QLCSlowConfigHandler::SetActiveChannels | ( | const std::list< unsigned int > & | channels | ) |
set the list of channels that will be handled
channels | list of channels to be handled |
References fChannels, fCrates, and GetCratesToKill().
Referenced by MLCSlowController::Init().
void QLCSlowConfigHandler::SetWrongPolarityChannels | ( | const std::set< unsigned int > & | wrongChannels | ) | [inline] |
set list of channels that have wrong bias polarity mapping
if a channel belongs to this list, then the requested bias polarity is inverted berofe being applied to the slow control server
References fWrongPolarityChannels.
Referenced by MLCSlowController::Init().
bool QLCSlowConfigHandler::GoToPositiveBranch | ( | ) |
switch from negative to positive branch
References fBranchDone, fCurrentBranch, and IsBranchDone().
Referenced by MLCSlowController::PopulateNextConfig().
bool QLCSlowConfigHandler::Consolidate | ( | ) |
when this function is called all the new configurations added by mean of AddConfig() are applied to hardware
References ApplyConfig(), CheckSlowStatus(), fChannels, fConfigMap, fCrates, fCurrentConfig, fExternalBias, fNextConfig, fSleepTime, QBaseClient::GetError(), QSlowControlClient::GetPSupplyVoutDiff(), QEleChannelConfig::SetExternalBias(), QEleChannelConfig::SetId(), QEleChannelConfig::SetRealExternalBias(), QDaqClient::SetTriggerFlag(), and UpdateExternalBias().
Referenced by MLCSlowController::Init(), and MLCSlowController::PopulateNextConfig().
bool QLCSlowConfigHandler::ApplyConfig | ( | const unsigned int | lg, | |
QEleChannelConfig * | conf, | |||
const QEleChannelConfig * | oldConf | |||
) | [private] |
apply slow config to hardware
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 |
References QSlowControlClient::AdjustFEOffset(), QEleChannelConfig::GetAdjustOffset(), QEleChannelConfig::GetBias(), QEleChannelConfig::GetBiasPolarity(), QBaseClient::GetError(), QSlowControlClient::GetFEOffsetDAC(), QSlowControlClient::GetFEOffsetMSB(), QSlowControlClient::GetFEOffsetPolarity(), QSlowControlClient::GetFEOffsetSpecialBit(), QEleChannelConfig::GetGain(), QEleChannelConfig::GetLoadResistance(), QEleChannelConfig::GetOffsetDac(), QEleChannelConfig::GetOffsetHiBits(), QEleChannelConfig::GetOffsetPolarity(), QEleChannelConfig::GetOffsetSBit(), HasWrongPolarityMapping(), QSlowControlClient::SetFEBias(), QSlowControlClient::SetFEBiasPolarity(), QSlowControlClient::SetFEGain(), QSlowControlClient::SetFELoadResistor(), QSlowControlClient::SetFEOffsetDAC(), QSlowControlClient::SetFEOffsetMSB(), QSlowControlClient::SetFEOffsetPolarity(), QSlowControlClient::SetFEOffsetSpecialBit(), and QEleChannelConfig::SetOffset().
Referenced by Consolidate().
bool QLCSlowConfigHandler::HasWrongPolarityMapping | ( | unsigned int | lg | ) | const [inline, private] |
searches for the requested channel in the fWrongPolarityMap data member
References fWrongPolarityChannels.
Referenced by ApplyConfig().
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)
References QSlowControlClient::GetBasket(), QDbDetector::GetCurrentRunNumber(), QSlowControlClient::GetMode(), QDbDetector::SettingsBasket(), QSlowControlClient::SetTuningMode(), and QSlowControlClient::SetWriteMode().
Referenced by Consolidate().
float QLCSlowConfigHandler::fMaxExternalBias [private] |
max value of external bias voltage (in V) to be reached when performing the load curves procedure
Referenced by GetMaxExternalBias(), and SetMaxExternalBias().
std::map<unsigned int,std::vector<QEleChannelConfig*> > QLCSlowConfigHandler::fConfigMap [private] |
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 Clear(), ClearMemory(), Consolidate(), GetConfig(), GetLastConfig(), and ~QLCSlowConfigHandler().
std::map<unsigned int, std::list<QEleChannelConfig*> > 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.
Referenced by AddNextScheduled(), Clear(), ClearMemory(), EraseNextScheduled(), GetNextScheduled(), Schedule(), SetCurveDone(), SetExternalBias(), and ~QLCSlowConfigHandler().
std::map<unsigned int,unsigned int> 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
Referenced by Clear(), ClearMemory(), Consolidate(), IsConfDone(), SetBranchDone(), SetConfDone(), SetCurveDone(), and ~QLCSlowConfigHandler().
std::list<unsigned int> QLCSlowConfigHandler::fChannels [private] |
list of channels for which loa curves are being drawn
Referenced by AddConfig(), Clear(), ClearMemory(), Consolidate(), GetActiveChannels(), GetCratesToKill(), IsBranchDone(), IsCurvesDone(), SetActiveChannels(), SetBranchDone(), SetCurveDone(), and ~QLCSlowConfigHandler().
std::set<unsigned int> QLCSlowConfigHandler::fWrongPolarityChannels [private] |
list of channels that have a wrong cabling, such that setting positive bias polarity would result in setting negative bias polarity
Referenced by HasWrongPolarityMapping(), and SetWrongPolarityChannels().
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 QEleChannelConfig 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.
Referenced by AddConfig(), Clear(), GetCurrentBranch(), GoToPositiveBranch(), IsBranchDone(), Schedule(), SetBranchDone(), and SetCurveDone().
std::list<unsigned 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
Referenced by Clear(), ClearMemory(), Consolidate(), GetCratesToKill(), SetActiveChannels(), and ~QLCSlowConfigHandler().
std::map<unsigned int, QEleChannelConfig*> 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.
Referenced by AddConfig(), Clear(), ClearMemory(), Consolidate(), SetCurveDone(), SetExternalBias(), and ~QLCSlowConfigHandler().