QLCSlowConfigHandler.hh
Go to the documentation of this file.00001
00008 #ifndef _QSLOW_CONFIG_HANDLER_HH_
00009 #define _QSLOW_CONFIG_HANDLER_HH_
00010
00011 #include "QCuore.hh"
00012 #include "QDaqClient.hh"
00013 #include "QSlowControlClient.hh"
00014
00015 #include <map>
00016 #include <list>
00017 #include <vector>
00018 #include <set>
00019
00020 class QEleChannelConfig;
00021
00022 class QLCSlowConfigHandler
00023 {
00024 public:
00025
00027 static QLCSlowConfigHandler& GetInstance();
00028
00030 virtual ~QLCSlowConfigHandler();
00031
00040 const QEleChannelConfig* GetConfig(const unsigned int lg,
00041 const unsigned int id) const;
00042
00044 bool GetCurrentBranch() const { return fCurrentBranch; }
00045
00047 float GetExternalBias() const { return fExternalBias; }
00048
00061 bool SetExternalBias(const float bias);
00062
00064 void SetMaxExternalBias(float bias) { fMaxExternalBias = bias; }
00065
00067 float GetMaxExternalBias() const { return fMaxExternalBias; }
00068
00069
00088 bool AddConfig(const unsigned int lg, QEleChannelConfig* config);
00089
00106 bool Schedule(const unsigned int lg, QEleChannelConfig* config);
00107
00115 const QEleChannelConfig* GetNextScheduled(const unsigned int lg) const;
00116
00126 void EraseNextScheduled(const unsigned int lg);
00127
00133 const QEleChannelConfig* GetLastConfig(const unsigned int lg) const;
00134
00142 bool AddNextScheduled(const unsigned int lg);
00143
00150 void SetConfDone(const unsigned int lg,const unsigned int id);
00151
00156 bool IsConfDone() const { return fCurrentConfig.empty(); }
00157
00166 bool SetCurveDone(const unsigned int lg);
00167
00172 bool IsCurvesDone() const { return fChannels.empty(); }
00173
00181 bool SetBranchDone(const unsigned int lg);
00182
00188 bool IsBranchDone() const;
00189
00196 bool SetActiveChannels(const std::list<unsigned int>& channels);
00197
00198
00205 void SetWrongPolarityChannels(const std::set<unsigned int>& wrongChannels)
00206 { fWrongPolarityChannels = wrongChannels; }
00207
00213 bool GoToPositiveBranch();
00214
00219 const std::list<unsigned int>& GetActiveChannels() const
00220 { return fChannels; }
00221
00226 void Clear();
00227
00230 void ClearMemory();
00231
00232
00250 bool Consolidate();
00251
00252 void Dump() const;
00253
00254 bool SetSleepTime(const unsigned int sleepTime);
00255
00256 unsigned int GetSleepTime() const { return fSleepTime; }
00257 private:
00259 QLCSlowConfigHandler();
00260
00261 void InitSlowClient();
00262
00263
00265 float fExternalBias;
00266
00271 float fMaxExternalBias;
00272
00273
00280 std::map<unsigned int,std::vector<QEleChannelConfig*> > fConfigMap;
00281
00288 std::map<unsigned int, std::list<QEleChannelConfig*> > fScheduled;
00289
00295 std::map<unsigned int,unsigned int> fCurrentConfig;
00296
00298 std::list<unsigned int> fChannels;
00299
00304 std::set<unsigned int> fWrongPolarityChannels;
00305
00307 std::list<unsigned int> fBranchDone;
00308
00318 bool fCurrentBranch;
00319
00327 std::list<unsigned int> fCrates;
00328
00335 std::map<unsigned int, QEleChannelConfig*> fNextConfig;
00336
00338 unsigned int fSleepTime;
00339
00340 QDaqClient fDaqClient;
00341 QSlowControlClient fSlowClient;
00342
00354 bool ApplyConfig(const unsigned int lg,
00355 QEleChannelConfig* conf,
00356 const QEleChannelConfig* oldConf);
00357
00358
00360 void GetCratesToKill();
00361
00365 bool HasWrongPolarityMapping(unsigned int lg) const
00366 { return (bool)(fWrongPolarityChannels.count(lg)); }
00367
00369 void UpdateExternalBias();
00370
00376 bool CheckSlowStatus();
00377 };
00378
00379 #endif