Changeset 12331 for trunk/FACT++
- Timestamp:
- 10/30/11 22:34:20 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/fadctrl.cc
r12250 r12331 760 760 { 761 761 ostringstream msg; 762 msg << hex << "Value " << num << " out of range, max=" << FAD::kMaxRunNumber;762 msg << "Run number " << num << " out of range (max=" << FAD::kMaxRunNumber << ")"; 763 763 T::Error(msg); 764 764 return false; 765 765 } 766 766 767 if (num>0 && num<GetRunNumber()) 768 { 769 ostringstream msg; 770 msg << "Given run number smaller than next run number which will be opened by the event builder (" << GetRunNumber() << ")"; 771 T::Error(msg); 772 return false; 773 } 774 775 IncreaseRunNumber(num); 776 767 777 for (BoardList::iterator i=fBoards.begin(); i!=fBoards.end(); i++) 768 778 i->second->CmdSetRunNumber(num); … … 1452 1462 } 1453 1463 1454 return FAD::kConnected;1464 return GetNumFilesOpen()>0 ? FAD::kWritingData : FAD::kConnected; 1455 1465 } 1456 1466 … … 1540 1550 1541 1551 T::AddStateName(FAD::kConfigured, "Configured", 1542 "The last header received through the command socket fits the requested configureation and has EventCounter==0."); 1552 "The configuration of all boards was successfully cross checked. Waiting for events with a new run number to receive."); 1553 1554 T::AddStateName(FAD::kWritingData, "WritingData", 1555 "The event builder has an open file (that does not mean that new events are currently received)"); 1543 1556 1544 1557 // FAD Commands 1545 T::AddEvent("SEND_CMD", "I:1", FAD::kConnecting, FAD::kConnected )1558 T::AddEvent("SEND_CMD", "I:1", FAD::kConnecting, FAD::kConnected, FAD::kWritingData) 1546 1559 (bind(&StateMachineFAD::SendCmd, this, placeholders::_1)) 1547 1560 ("Send a command to the FADs. Values between 0 and 0xffff are allowed." 1548 1561 "|command[uint16]:Command to be transmittted."); 1549 T::AddEvent("SEND_DATA", "I:2", FAD::kConnecting, FAD::kConnected )1562 T::AddEvent("SEND_DATA", "I:2", FAD::kConnecting, FAD::kConnected, FAD::kWritingData) 1550 1563 (bind(&StateMachineFAD::SendCmdData, this, placeholders::_1)) 1551 1564 ("Send a command with data to the FADs. Values between 0 and 0xffff are allowed." … … 1553 1566 "|data[uint16]:Data to be sent with the command."); 1554 1567 1555 T::AddEvent("ENABLE_SRCLK", "B:1", FAD::kConnecting, FAD::kConnected )1568 T::AddEvent("ENABLE_SRCLK", "B:1", FAD::kConnecting, FAD::kConnected, FAD::kWritingData) 1556 1569 (bind(&StateMachineFAD::CmdEnable, this, placeholders::_1, FAD::kCmdSrclk)) 1557 1570 ("Set SRCLK"); 1558 T::AddEvent("ENABLE_BUSY_OFF", "B:1", FAD::kConnecting, FAD::kConnected )1571 T::AddEvent("ENABLE_BUSY_OFF", "B:1", FAD::kConnecting, FAD::kConnected, FAD::kWritingData) 1559 1572 (bind(&StateMachineFAD::CmdEnable, this, placeholders::_1, FAD::kCmdBusyOff)) 1560 1573 ("Set BUSY continously low"); 1561 T::AddEvent("ENABLE_BUSY_ON", "B:1", FAD::kConnecting, FAD::kConnected )1574 T::AddEvent("ENABLE_BUSY_ON", "B:1", FAD::kConnecting, FAD::kConnected, FAD::kWritingData) 1562 1575 (bind(&StateMachineFAD::CmdEnable, this, placeholders::_1, FAD::kCmdBusyOn)) 1563 1576 ("Set BUSY constantly high (has priority over BUSY_OFF)"); 1564 T::AddEvent("ENABLE_SCLK", "B:1", FAD::kConnecting, FAD::kConnected )1577 T::AddEvent("ENABLE_SCLK", "B:1", FAD::kConnecting, FAD::kConnected, FAD::kWritingData) 1565 1578 (bind(&StateMachineFAD::CmdEnable, this, placeholders::_1, FAD::kCmdSclk)) 1566 1579 ("Set SCLK"); 1567 T::AddEvent("ENABLE_DRS", "B:1", FAD::kConnecting, FAD::kConnected )1580 T::AddEvent("ENABLE_DRS", "B:1", FAD::kConnecting, FAD::kConnected, FAD::kWritingData) 1568 1581 (bind(&StateMachineFAD::CmdEnable, this, placeholders::_1, FAD::kCmdDrsEnable)) 1569 1582 ("Switch Domino wave"); 1570 T::AddEvent("ENABLE_DWRITE", "B:1", FAD::kConnecting, FAD::kConnected )1583 T::AddEvent("ENABLE_DWRITE", "B:1", FAD::kConnecting, FAD::kConnected, FAD::kWritingData) 1571 1584 (bind(&StateMachineFAD::CmdEnable, this, placeholders::_1, FAD::kCmdDwrite)) 1572 1585 ("Set Dwrite (possibly high / always low)"); 1573 T::AddEvent("ENABLE_CONTINOUS_TRIGGER", "B:1", FAD::kConnecting, FAD::kConnected )1586 T::AddEvent("ENABLE_CONTINOUS_TRIGGER", "B:1", FAD::kConnecting, FAD::kConnected, FAD::kWritingData) 1574 1587 (bind(&StateMachineFAD::CmdEnable, this, placeholders::_1, FAD::kCmdContTrigger)) 1575 1588 ("Enable continous (internal) trigger."); 1576 T::AddEvent("ENABLE_TRIGGER_LINE", "B:1", FAD::kConnecting, FAD::kConnected )1589 T::AddEvent("ENABLE_TRIGGER_LINE", "B:1", FAD::kConnecting, FAD::kConnected, FAD::kWritingData) 1577 1590 (bind(&StateMachineFAD::CmdEnable, this, placeholders::_1, FAD::kCmdTriggerLine)) 1578 1591 ("Incoming triggers can be accepted/will not be accepted"); 1579 T::AddEvent("ENABLE_COMMAND_SOCKET_MODE", "B:1", FAD::kConnecting, FAD::kConnected )1592 T::AddEvent("ENABLE_COMMAND_SOCKET_MODE", "B:1", FAD::kConnecting, FAD::kConnected, FAD::kWritingData) 1580 1593 (bind(&StateMachineFAD::CmdEnable, this, placeholders::_1, FAD::kCmdSocket)) 1581 1594 ("Set debug mode (yes: dump events through command socket, no=dump events through other sockets)"); 1582 1595 1583 T::AddEvent("SET_TRIGGER_RATE", "I:1", FAD::kConnecting, FAD::kConnected )1596 T::AddEvent("SET_TRIGGER_RATE", "I:1", FAD::kConnecting, FAD::kConnected, FAD::kWritingData) 1584 1597 (bind(&StateMachineFAD::SetTriggerRate, this, placeholders::_1)) 1585 1598 ("Enable continous trigger"); … … 1587 1600 (bind(&StateMachineFAD::Trigger, this, 1)) 1588 1601 ("Issue software triggers"); 1589 T::AddEvent("SEND_N_TRIGGERS", "I", FAD::kConnecting, FAD::kConnected )1602 T::AddEvent("SEND_N_TRIGGERS", "I", FAD::kConnecting, FAD::kConnected, FAD::kWritingData) 1590 1603 (bind(&StateMachineFAD::SendTriggers, this, placeholders::_1)) 1591 1604 ("Issue software triggers"); 1592 T::AddEvent("START_RUN", "", FAD::kConnecting, FAD::kConnected )1605 T::AddEvent("START_RUN", "", FAD::kConnecting, FAD::kConnected, FAD::kWritingData) 1593 1606 (bind(&StateMachineFAD::StartRun, this, placeholders::_1, true)) 1594 1607 ("Set FAD DAQ mode. when started, no configurations must be send."); 1595 T::AddEvent("STOP_RUN", FAD::kConnecting, FAD::kConnected )1608 T::AddEvent("STOP_RUN", FAD::kConnecting, FAD::kConnected, FAD::kWritingData) 1596 1609 (bind(&StateMachineFAD::StartRun, this, placeholders::_1, false)) 1597 1610 (""); 1598 T::AddEvent("PHASE_SHIFT", "S:1", FAD::kConnecting, FAD::kConnected )1611 T::AddEvent("PHASE_SHIFT", "S:1", FAD::kConnecting, FAD::kConnected, FAD::kWritingData) 1599 1612 (bind(&StateMachineFAD::PhaseShift, this, placeholders::_1)) 1600 1613 ("Adjust ADC phase (in 'steps')"); 1601 1614 1602 T::AddEvent("RESET_EVENT_COUNTER", FAD::kConnecting, FAD::kConnected )1615 T::AddEvent("RESET_EVENT_COUNTER", FAD::kConnecting, FAD::kConnected, FAD::kWritingData) 1603 1616 (bind(&StateMachineFAD::Cmd, this, FAD::kCmdResetEventCounter)) 1604 1617 (""); 1605 1618 1606 T::AddEvent("SET_RUN_NUMBER", "X:1", FAD::kConnecting, FAD::kConnected )1619 T::AddEvent("SET_RUN_NUMBER", "X:1", FAD::kConnecting, FAD::kConnected, FAD::kWritingData) 1607 1620 (bind(&StateMachineFAD::SetRunNumber, this, placeholders::_1)) 1608 1621 (""); … … 1613 1626 "|memory[short]:Buffer size in Mega-bytes."); 1614 1627 1615 T::AddEvent("SET_REGISTER", "I:2", FAD::kConnecting, FAD::kConnected )1628 T::AddEvent("SET_REGISTER", "I:2", FAD::kConnecting, FAD::kConnected, FAD::kWritingData) 1616 1629 (bind(&StateMachineFAD::SetRegister, this, placeholders::_1)) 1617 1630 ("set register to value" … … 1620 1633 1621 1634 // FIXME: Maybe add a mask which channels should be set? 1622 T::AddEvent("SET_REGION_OF_INTEREST", "I:2", FAD::kConnecting, FAD::kConnected )1635 T::AddEvent("SET_REGION_OF_INTEREST", "I:2", FAD::kConnecting, FAD::kConnected, FAD::kWritingData) 1623 1636 (bind(&StateMachineFAD::SetRoi, this, placeholders::_1)) 1624 1637 ("Set region-of-interest to value" … … 1627 1640 1628 1641 // FIXME: Maybe add a mask which channels should be set? 1629 T::AddEvent("SET_DAC_VALUE", "I:2", FAD::kConnecting, FAD::kConnected )1642 T::AddEvent("SET_DAC_VALUE", "I:2", FAD::kConnecting, FAD::kConnected, FAD::kWritingData) 1630 1643 (bind(&StateMachineFAD::SetDac, this, placeholders::_1)) 1631 1644 ("Set DAC numbers in range to value" … … 1633 1646 "|val[short]:Value to be set"); 1634 1647 1635 T::AddEvent("CONFIGURE", "X:2;C", FAD::kConnected, FAD::kConfigured )1648 T::AddEvent("CONFIGURE", "X:2;C", FAD::kConnected, FAD::kConfigured, FAD::kWritingData) 1636 1649 (bind(&StateMachineFAD::StartConfigure, this, placeholders::_1)) 1637 1650 (""); … … 1706 1719 "|enable[bool]:Whether the event builder should ignore data from this slot (yes) or allowed (no)"); 1707 1720 1708 T::AddEvent("CLOSE_OPEN_FILES", FAD::kDisconnected, FAD::kConnecting, FAD::kConnected )1721 T::AddEvent("CLOSE_OPEN_FILES", FAD::kDisconnected, FAD::kConnecting, FAD::kConnected, FAD::kWritingData) 1709 1722 (bind(&StateMachineFAD::CloseOpenFiles, this)) 1710 1723 ("Close all run files opened by the EventBuilder."); … … 1721 1734 ("Start EventBuilder thread and connect all valid slots."); 1722 1735 1723 T::AddEvent("STOP", FAD::kDisconnected, FAD::kConnecting, FAD::kConnected )1736 T::AddEvent("STOP", FAD::kDisconnected, FAD::kConnecting, FAD::kConnected, FAD::kWritingData) 1724 1737 (bind(&StateMachineFAD::StopConnection, this)) 1725 1738 ("Stop EventBuilder thread (still write buffered events) and disconnect all slots."); 1726 1739 1727 T::AddEvent("ABORT", FAD::kDisconnected, FAD::kConnecting, FAD::kConnected )1740 T::AddEvent("ABORT", FAD::kDisconnected, FAD::kConnecting, FAD::kConnected, FAD::kWritingData) 1728 1741 (bind(&StateMachineFAD::AbortConnection, this)) 1729 1742 ("Immediately abort EventBuilder thread and disconnect all slots."); 1730 1743 1731 T::AddEvent("SOFT_RESET", FAD::kConnected )1744 T::AddEvent("SOFT_RESET", FAD::kConnected, FAD::kWritingData) 1732 1745 (bind(&StateMachineFAD::Reset, this, true)) 1733 1746 ("Wait for buffers to drain, close all files and reinitialize event builder thread."); 1734 1747 1735 T::AddEvent("HARD_RESET", FAD::kConnected )1748 T::AddEvent("HARD_RESET", FAD::kConnected, FAD::kWritingData) 1736 1749 (bind(&StateMachineFAD::Reset, this, false)) 1737 1750 ("Free all buffers, close all files and reinitialize event builder thread.");
Note:
See TracChangeset
for help on using the changeset viewer.