FACT++  1.0
void UIConnector::currentEventHasChanged ( int  event)
slot

Definition at line 1463 of file RawEventsViewer.cc.

References first, i, NBOARDS, NPIX, NTMARK, str, xval, and yval.

1464 {
1465 
1466  RMS_window->SetData(GLWindow->RMSvalues);
1467  Mean_window->SetData(GLWindow->Meanvalues);
1468  PosOfMax_window->SetData(GLWindow->PosOfMaxvalues);
1469  Max_window->SetData(GLWindow->Maxvalues);
1470  threeD_Window->setData(GLWindow->eventData);//rawEventData);
1471 
1472  if (RMS_window->isVisible())
1473  RMS_window->updateGL();
1474  if (Mean_window->isVisible())
1475  Mean_window->updateGL();
1476  if (PosOfMax_window->isVisible())
1477  PosOfMax_window->updateGL();
1478  if (Max_window->isVisible())
1479  Max_window->updateGL();
1480  ostringstream str;
1481 // str << "Displaying Event " << cEvent;
1482 // QString qstr(str.str().c_str());
1483 // emit updateCurrentEventDisplay(qstr);
1485  {
1486  updateSpinnerDisplay = false;
1487  displayingEventBox->setValue(GLWindow->rowNum);
1488  updateSpinnerDisplay = true;
1489  }
1490 
1491  // GLWindow->doWaveLetOnCurrentEventPlease();
1492 
1493  //retrieve the data that we want to display
1494  boost::posix_time::ptime hrTime( boost::gregorian::date(1970, boost::gregorian::Jan, 1),
1495  boost::posix_time::seconds(GLWindow->pcTime[0]) + boost::posix_time::microsec(GLWindow->pcTime[1]));
1496 
1497  str.str("");
1498  str << "PC Time: " << boost::posix_time::to_iso_extended_string(hrTime);
1499  PCTimeLabel->setText(QString(str.str().c_str()));
1500 
1501  str.str("");
1502  str << "Software Trigger: " << GLWindow->softTrig;
1503  softwareTriggerLabel->setText(QString(str.str().c_str()));
1504 
1505  str.str("");
1506  str << "Trigger Type: " << GLWindow->triggerType;
1507  triggerTypeLabel->setText(QString(str.str().c_str()));
1508 
1510 
1511  if (autoScaleColor->isChecked())
1512  emit GLWindow->colorPaletteHasChanged();//autoScalePressed();
1513 
1514  boardsTimeList->clear();
1515  startPixelsList->clear();
1516  startTimeMarksList->clear();
1517  triggerDelayList->clear();
1518  std::map<int, int> boardsHistoMap;
1519  for (int i=0;i <NBOARDS; i++)
1520  {
1521  str.str("");
1522  str << i;
1523  if (i<10) str << " ";
1524  if (i<100) str << " ";
1525  if (i<1000) str << " ";
1526  str << ": " << GLWindow->boardTime[i];
1527  boardsTimeList->addItem(QString(str.str().c_str()));
1528  if (boardsHistoMap.find(GLWindow->boardTime[i]) != boardsHistoMap.end())
1529  boardsHistoMap[GLWindow->boardTime[i]]++;
1530  else
1531  boardsHistoMap[GLWindow->boardTime[i]] = 1;
1532  }
1533  std::map<int, int> pixelHistoMap;
1534  for (int i=0;i <NPIX; i++)
1535  {
1536  str.str("");
1537  str << i;
1538  if (i<10) str << " ";
1539  if (i<100) str << " ";
1540  if (i<1000) str << " ";
1541  str << ": " << GLWindow->startPix[i];
1542  startPixelsList->addItem(QString(str.str().c_str()));
1543  if (pixelHistoMap.find(GLWindow->startPix[i]) != pixelHistoMap.end())
1544  pixelHistoMap[GLWindow->startPix[i]]++;
1545  else
1546  pixelHistoMap[GLWindow->startPix[i]] = 1;
1547  }
1548 
1549  std::map<int, int> timeMarksMap;
1550  for (int i=0;i <NTMARK; i++)
1551  {
1552  str.str("");
1553  str << i;
1554  if (i<10) str << " ";
1555  if (i<100) str << " ";
1556  if (i<1000) str << " ";
1557  str << ": " << GLWindow->startTM[i];
1558  startTimeMarksList->addItem(QString(str.str().c_str()));
1559  if (timeMarksMap.find(GLWindow->startTM[i]) != timeMarksMap.end())
1560  timeMarksMap[GLWindow->startTM[i]]++;
1561  else
1562  timeMarksMap[GLWindow->startTM[i]] = 1;
1563  }
1564  std::map<int,int> delayMap;
1565  triggerDelayList->addItem(QString("Patch | Slice:Delay Slice:Delay..."));
1566  for (int i=0;i<NTMARK; i++)
1567  {
1568  str.str("");
1569  str << i << " | ";
1570  for (int j=0;j<GLWindow->nRoi;j++)
1571  {
1572  int value = GLWindow->eventData[1440*GLWindow->nRoi + i*GLWindow->nRoi + j];
1573  if (delayMap.find(value) != delayMap.end())
1574  delayMap[value]++;
1575  else
1576  delayMap[value] = 1;
1577  str << j << ":" << value << " ";
1578  }
1579  triggerDelayList->addItem(QString(str.str().c_str()));
1580  }
1581 
1582  std::map<int,int>::iterator it = boardsHistoMap.begin();
1583  int nsamples = 0;
1584  int previousValue = it->first-10;
1585  for (unsigned int i=0;i<boardsHistoMap.size();i++)
1586  {
1587  if (previousValue != it->first-1)
1588  {
1589  xval[nsamples] = previousValue+1;
1590  yval[nsamples] = 0;
1591  nsamples++;
1592  xval[nsamples] = it->first-1;
1593  yval[nsamples] = 0;
1594  nsamples++;
1595  }
1596  xval[nsamples] = it->first;
1597  yval[nsamples] = it->second;
1598  previousValue = it->first;
1599  it++;
1600  nsamples++;
1601  xval[nsamples] = previousValue;
1602  yval[nsamples] = 0;
1603  nsamples++;
1604  if (nsamples > 4090)
1605  {
1606  cout << "Error: Maximum number of samples reached for histograms. skipping what's remaining" << endl;
1607  break;
1608  }
1609  }
1610  xval[nsamples] = it==boardsHistoMap.begin() ? 0 : (--it)->first+1;
1611  yval[nsamples] = 0;
1612  nsamples++;
1613  // if (nsamples > 5)
1614 #if QWT_VERSION < 0x060000
1615  boardsTimeHistoItem.setData(xval, yval, nsamples);
1616 #else
1617  boardsTimeHistoItem.setSamples(xval, yval, nsamples);
1618 #endif
1619 
1620  it = pixelHistoMap.begin();
1621  nsamples = 0;
1622  previousValue = it->first-10;
1623  for (unsigned int i=0;i<pixelHistoMap.size();i++)
1624  {
1625  if (previousValue != it->first-1)
1626  {
1627  xval[nsamples] = previousValue+1;
1628  yval[nsamples] = 0;
1629  nsamples++;
1630  xval[nsamples] = it->first-1;
1631  yval[nsamples] = 0;
1632  nsamples++;
1633  }
1634  xval[nsamples] = it->first;
1635  yval[nsamples] = it->second;
1636  previousValue = it->first;
1637  it++;
1638  nsamples++;
1639  xval[nsamples] = previousValue;
1640  yval[nsamples] = 0;
1641  nsamples++;
1642  if (nsamples > 4090)
1643  {
1644  cout << "Error: Maximum number of samples reached for histograms. skipping what's remaining" << endl;
1645  break;
1646  }
1647  }
1648  xval[nsamples] = it==pixelHistoMap.begin() ? 0 : (--it)->first+1;
1649  yval[nsamples] = 0;
1650  nsamples++;
1651 // if (nsamples > 5)
1652 #if QWT_VERSION < 0x060000
1653  startCellHistoItem.setData(xval, yval, nsamples);
1654 #else
1655  startCellHistoItem.setSamples(xval, yval, nsamples);
1656 #endif
1657 
1658  it = timeMarksMap.begin();
1659  nsamples = 0;
1660  previousValue = it->first-10;
1661  for (unsigned int i=0;i<timeMarksMap.size();i++)
1662  {
1663  if (previousValue != it->first-1)
1664  {
1665  xval[nsamples] = previousValue+1;
1666  yval[nsamples] = 0;
1667  nsamples++;
1668  xval[nsamples] = it->first-1;
1669  yval[nsamples] = 0;
1670  nsamples++;
1671  }
1672  xval[nsamples] = it->first;
1673  yval[nsamples] = it->second;
1674  previousValue = it->first;
1675  it++;
1676  nsamples++;
1677  xval[nsamples] = previousValue;
1678  yval[nsamples] = 0;
1679  nsamples++;
1680  if (nsamples > 4090)
1681  {
1682  cout << "Error: Maximum number of samples reached for histograms. skipping what's remaining" << endl;
1683  break;
1684  }
1685  }
1686  xval[nsamples] = it==timeMarksMap.begin() ? 0 : (--it)->first+1;
1687  yval[nsamples] = 0;
1688  nsamples++;
1689  // if (nsamples > 5)
1690 #if QWT_VERSION < 0x060000
1691  startTimeMarkHistoItem.setData(xval, yval, nsamples);
1692 #else
1693  startTimeMarkHistoItem.setSamples(xval, yval, nsamples);
1694 #endif
1695 
1696  it = delayMap.begin();
1697  nsamples = 0;
1698  previousValue = it->first-10;
1699  for (unsigned int i=0;i<delayMap.size();i++)
1700  {
1701  if (previousValue != it->first-1)
1702  {
1703  xval[nsamples] = previousValue+1;
1704  yval[nsamples] = 0;
1705  nsamples++;
1706  xval[nsamples] = it->first-1;
1707  yval[nsamples] = 0;
1708  nsamples++;
1709  }
1710  xval[nsamples] = it->first;
1711  yval[nsamples] = it->second;
1712  previousValue = it->first;
1713  it++;
1714  nsamples++;
1715  xval[nsamples] = previousValue;
1716  yval[nsamples] = 0;
1717  nsamples++;
1718  if (nsamples > 4090)
1719  {
1720  cout << "Error: Maximum number of samples reached for histograms. skipping what's remaining" << endl;
1721  break;
1722  }
1723  }
1724  xval[nsamples] = it==delayMap.begin() ? 0 : (--it)->first+1;
1725  yval[nsamples] = 0;
1726  nsamples++;
1727  // if (nsamples > 5)
1728 #if QWT_VERSION < 0x060000
1729  triggerDelayHistoItem.setData(xval, yval, nsamples);
1730 #else
1731  triggerDelayHistoItem.setSamples(xval, yval, nsamples);
1732 #endif
1733  //WAVELETS HACK
1734 /* std::map<int, int> valuesHistoMap;
1735  std::map<int, int> waveletHistoMap;
1736  for (int i=0;i<1024*1440;i++)
1737  {
1738  if (valuesHistoMap.find(GLWindow->rawEventData[i]) != valuesHistoMap.end())
1739  valuesHistoMap[GLWindow->rawEventData[i]]++;
1740  else
1741  valuesHistoMap[GLWindow->rawEventData[i]] = 1;
1742  if (waveletHistoMap.find(GLWindow->waveLetArray[i]) != waveletHistoMap.end())
1743  waveletHistoMap[GLWindow->waveLetArray[i]]++;
1744  else
1745  waveletHistoMap[GLWindow->waveLetArray[i]] = 1;
1746  }
1747 
1748  it = valuesHistoMap.begin();
1749  nsamples = 0;
1750  previousValue = it->first-10;
1751  cout << "Num values Original: " << valuesHistoMap.size() << endl;
1752  for (unsigned int i=0;i<valuesHistoMap.size();i++)
1753  {
1754  if (previousValue != it->first-1)
1755  {
1756  xval[nsamples] = previousValue+1;
1757  yval[nsamples] = 0;
1758  nsamples++;
1759  xval[nsamples] = it->first-1;
1760  yval[nsamples] = 0;
1761  nsamples++;
1762  }
1763  xval[nsamples] = it->first;
1764  yval[nsamples] = it->second;
1765  previousValue = it->first;
1766  it++;
1767  nsamples++;
1768  xval[nsamples] = previousValue;
1769  yval[nsamples] = 0;
1770  nsamples++;
1771  if (nsamples > 50000)
1772  {
1773  cout << "Error: Maximum number of samples reached for histograms. skipping what's remaining" << endl;
1774  break;
1775  }
1776  }
1777  xval[nsamples] = it==valuesHistoMap.begin() ? 0 : (--it)->first+1;
1778  yval[nsamples] = 0;
1779  nsamples++;
1780  // if (nsamples > 5)
1781  #if QWT_VERSION < 0x060000
1782  triggerDelayHistoItem.setData(xval, yval, nsamples);
1783  #else
1784  triggerDelayHistoItem.setSamples(xval, yval, nsamples);
1785  #endif
1786 
1787  it = waveletHistoMap.begin();
1788  nsamples = 0;
1789  previousValue = it->first-10;
1790  cout << "Num values WaveLets: " << waveletHistoMap.size() << endl;
1791  for (unsigned int i=0;i<waveletHistoMap.size();i++)
1792  {
1793  if (previousValue != it->first-1)
1794  {
1795  xval[nsamples] = previousValue+1;
1796  yval[nsamples] = 0;
1797  nsamples++;
1798  xval[nsamples] = it->first-1;
1799  yval[nsamples] = 0;
1800  nsamples++;
1801  }
1802  xval[nsamples] = it->first;
1803  yval[nsamples] = it->second;
1804  previousValue = it->first;
1805  it++;
1806  nsamples++;
1807  xval[nsamples] = previousValue;
1808  yval[nsamples] = 0;
1809  nsamples++;
1810  if (nsamples > 50000)
1811  {
1812  cout << "Error: Maximum number of samples reached for histograms. skipping what's remaining" << endl;
1813  break;
1814  }
1815  }
1816  xval[nsamples] = it==waveletHistoMap.begin() ? 0 : (--it)->first+1;
1817  yval[nsamples] = 0;
1818  nsamples++;
1819  // if (nsamples > 5)
1820  #if QWT_VERSION < 0x060000
1821  startTimeMarkHistoItem.setData(xval, yval, nsamples);
1822  #else
1823  startTimeMarkHistoItem.setSamples(xval, yval, nsamples);
1824  #endif
1825 */
1826 //END OF WAVELETS HACK
1827  // startCellHistoZoom->setZoomBase(startCellHistoItem.boundingRect());
1828  QStack< QRectF > stack;
1829 // QRectF cRectangle = boardsTimeHistoItem.boundingRect();
1830  stack.push(scaleBoundingRectangle(boardsTimeHistoItem.boundingRect(), 1.05f));//cRectangle);//boardsTimeHistoItem.boundingRect());
1831  boardsTimeHistoZoom->setZoomStack(stack);
1832  stack.pop();
1833  stack.push(scaleBoundingRectangle(startCellHistoItem.boundingRect(), 1.05f));
1834  startCellHistoZoom->setZoomStack(stack);
1835  stack.pop();
1836  stack.push(scaleBoundingRectangle(startTimeMarkHistoItem.boundingRect(), 1.05f));
1837  startTimeMarkHistoZoom->setZoomStack(stack);
1838  stack.pop();
1839  stack.push(scaleBoundingRectangle(triggerDelayHistoItem.boundingRect(), 1.05f));
1840  triggerDelayHistoZoom->setZoomStack(stack);
1841  stack.pop();
1842 
1843  pixelChanged(GLWindow->selectedPixel);
1844 }
QwtPlotCurve startCellHistoItem
void pixelChanged(int)
QwtPlotZoomer * boardsTimeHistoZoom
int i
Definition: db_dim_client.c:21
char str[80]
Definition: test_client.c:7
QwtPlotZoomer * triggerDelayHistoZoom
bool updateSpinnerDisplay
int64_t first
Size of this column in the tile.
Definition: zofits.h:26
QwtPlotZoomer * startCellHistoZoom
double yval[50000]
void displaySliceValue()
double xval[50000]
#define NPIX
Definition: BasicGlCamera.h:5
QwtPlotCurve startTimeMarkHistoItem
QwtPlotZoomer * startTimeMarkHistoZoom
#define NTMARK
Definition: BasicGlCamera.h:6
#define NBOARDS
Definition: BasicGlCamera.h:4
QRectF scaleBoundingRectangle(QRectF rectangle, float scale)
QwtPlotCurve triggerDelayHistoItem
QwtPlotCurve boardsTimeHistoItem