FACT++  1.0
StateMachineRateScan::StateMachineRateScan ( ostream &  out = cout)
inline

Definition at line 439 of file ratescan.cc.

References ChangeMaximum(), ChangeStepSize(), HandleFtmStateChange(), HandleTriggerRates(), RateScan::State::kConfiguring, RateScan::State::kConnected, RateScan::State::kDimNetworkNA, RateScan::State::kDisconnected, RateScan::State::kInProgress, RateScan::State::kPaused, Pause(), Print(), Resume(), DimState::SetCallback(), SetReferenceBoard(), SetReferenceCamera(), SetReferencePatch(), StartRateScan(), StopRateScan(), DimState::Subscribe(), DimDescribedState::Subscribe(), and TriggerAutoPause().

439  : StateMachineDim(out, "RATE_SCAN"),
440  fDimFTM("FTM_CONTROL"),
441  fDimData("RATE_SCAN/DATA", "X:1;I:1;F:1;F:1;F:1;F:40;F:160",
442  "|Id[s]:Start time used to identify measurement (UnixTime)"
443  "|Threshold[dac]:Threshold in DAC counts"
444  "|ElapsedTime[s]:Real elapsed time"
445  "|RelOnTime[ratio]:Relative on time"
446  "|TriggerRate[Hz]:Camera trigger rate"
447  "|BoardRate[Hz]:Board trigger rates"
448  "|PatchRate[Hz]:Patch trigger rates"),
449  fDimProc("RATE_SCAN/PROCESS_DATA", "I:1;I:1;I:1",
450  "Rate scan process data"
451  "|min[DAC]:Value at which scan was started"
452  "|max[DAC]:Value at which scan will end"
453  "|step[DAC]:Step size for scan"),
455  {
456  // ba::io_service::work is a kind of keep_alive for the loop.
457  // It prevents the io_service to go to stopped state, which
458  // would prevent any consecutive calls to run()
459  // or poll() to do nothing. reset() could also revoke to the
460  // previous state but this might introduce some overhead of
461  // deletion and creation of threads and more.
462 
463  fDim.Subscribe(*this);
464  fDimFTM.Subscribe(*this);
466 
467  Subscribe("FTM_CONTROL/TRIGGER_RATES")
468  (bind(&StateMachineRateScan::HandleTriggerRates, this, placeholders::_1));
469 
470  // State names
471  AddStateName(RateScan::State::kDimNetworkNA, "DimNetworkNotAvailable",
472  "The Dim DNS is not reachable.");
473 
475  "The Dim DNS is reachable, but the required subsystems are not available.");
476 
478  "All needed subsystems are connected to their hardware, no action is performed.");
479 
481  "Waiting for FTM to get 'Configured'.");
482 
484  "Rate scan in progress.");
485 
487  "Rate scan in progress but paused.");
488 
489  AddEvent("START_THRESHOLD_SCAN", "I:3;C", RateScan::State::kConnected)
490  (bind(&StateMachineRateScan::StartRateScan, this, placeholders::_1, "SET_THRESHOLD"))
491  ("Start rate scan for the threshold in the defined range"
492  "|min[int]:Start value in DAC counts"
493  "|max[int]:Limiting value in DAC counts"
494  "|step[int]:Single step in DAC counts"
495  "|type[text]:Ratescan type");
496 
497  AddEvent("START_N_OUT_OF_4_SCAN", "I:3", RateScan::State::kConnected)
498  (bind(&StateMachineRateScan::StartRateScan, this, placeholders::_1, "SET_N_OUT_OF_4"))
499  ("Start rate scan for N-out-of-4 in the defined range"
500  "|min[int]:Start value in DAC counts"
501  "|max[int]:Limiting value in DAC counts"
502  "|step[int]:Single step in DAC counts");
503 
505  (bind(&StateMachineRateScan::ChangeStepSize, this, placeholders::_1))
506  ("Change the step size during a ratescan in progress"
507  "|step[int]:Single step in DAC counts");
508 
510  (bind(&StateMachineRateScan::ChangeMaximum, this, placeholders::_1))
511  ("Change the maximum limit during a ratescan in progress"
512  "|max[int]:Limiting value in DAC counts");
513 
516  ("Stop a ratescan in progress");
517 
520  ("Use the camera trigger rate as reference for the reolution");
522  (bind(&StateMachineRateScan::SetReferenceBoard, this, placeholders::_1))
523  ("Use the given board trigger-rate as reference for the reolution"
524  "|board[idx]:Index of the board (4*crate+board)");
526  (bind(&StateMachineRateScan::SetReferencePatch, this, placeholders::_1))
527  ("Use the given patch trigger-rate as reference for the reolution"
528  "|patch[idx]:Index of the patch (360*crate+36*board+patch)");
529 
532  ("Enable an automatic pause for the next ratescan, after it got configured.");
533 
535  (bind(&StateMachineRateScan::Pause, this))
536  ("Pause a ratescan in progress");
538  (bind(&StateMachineRateScan::Resume, this))
539  ("Resume a paused ratescan");
540 
541  AddEvent("PRINT")
542  (bind(&StateMachineRateScan::Print, this))
543  ("");
544  }
EventImp & AddEvent(const std::string &name, const std::string &states, const std::string &fmt)
virtual void Subscribe(StateMachineImp &imp)
Definition: DimState.h:134
int SetReferenceBoard(const EventImp &evt)
Definition: ratescan.cc:346
StateMachineDim(std::ostream &out=std::cout, const std::string &name="DEFAULT")
reference_t fReference
Definition: ratescan.cc:74
int HandleTriggerRates(const EventImp &evt)
Definition: ratescan.cc:99
DimDescribedService fDimData
Definition: ratescan.cc:43
int SetReferencePatch(const EventImp &evt)
Definition: ratescan.cc:363
int Print() const
Definition: ratescan.cc:225
int HandleFtmStateChange()
Definition: ratescan.cc:277
int ChangeStepSize(const EventImp &evt)
Definition: ratescan.cc:380
DimVersion fDim
Definition: ratescan.cc:40
int ChangeMaximum(const EventImp &evt)
Definition: ratescan.cc:396
virtual void Subscribe(StateMachineImp &imp)
Definition: DimState.h:68
int StartRateScan(const EventImp &evt, const string &command)
Definition: ratescan.cc:233
EventImp & Subscribe(const std::string &name)
uint16_t fReferenceIdx
Definition: ratescan.cc:75
DimDescribedService fDimProc
Definition: ratescan.cc:44
bool AddStateName(const int state, const std::string &name, const std::string &doc="")
void SetCallback(const callback &cb)
Definition: DimState.h:74
DimDescribedState fDimFTM
Definition: ratescan.cc:42

+ Here is the call graph for this function: