ATLAS Offline Software
Loading...
Searching...
No Matches
VP1TriggerDecisionChannel.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
6// //
7// Implementation of class VP1TriggerDecisionChannel //
8// Weiyi Zhang <wyizhang@cern.ch> //
9// June 18 2007 //
10//
11// Major Updates:
12// - 2022/03, Riccardo Maria BIANCHI <riccardo.maria.bianchi@cern.ch>
13//
15
17#include "ui_trigdecchannelwidgetform.h"
19#include <QLabel>
20
21//_________________________________________________________
24 "This channel simply shows the trigger decision, provided by the VP1TrigDecSystem.",
25 "wyizhang@cern.ch, Riccardo.Maria.Bianchi@cern.ch"),
27{
28}
29
33
34//_________________________________________________________
36{
39
40 connect(m_trigdecsystem.get(),SIGNAL(entriesChanged(const QStringList&,const QStringList&)),
41 this, SLOT( entriesChanged(const QStringList&,const QStringList&)) );
42}
43
44//_________________________________________________________
46{
47
48 //Setup this widget
49 Ui::TrigDecChannelWidgetForm ui;
50 ui.setupUi(this);
51 m_tableWidget=ui.tableWidget;
52 m_tableWidget->setColumnCount(2);
53 m_tableWidget->setHorizontalHeaderLabels((QStringList()<<"Signature"<<"Passed?"));
54 m_tableWidget->setAlternatingRowColors ( true );
55 m_tableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers);
56
57 connect(m_tableWidget,SIGNAL(cellActivated(int,int)),this,SLOT(cellActivated(int,int)));
58}
59
60//_________________________________________________________
61void VP1TriggerDecisionChannel::entriesChanged( const QStringList& entry_key,const QStringList& entry_type )
62{
63 clearAll();
64
65 if (entry_key.count()!=entry_type.count())
66 {
67 message("Error: Received data has wrong format!");
68 return;
69 }
70
71 m_tableWidget->setUpdatesEnabled(false);
72
73 //Turn sorting off while inserting (otherwise the correct row index to use will likely change in the middle of insertions):
74 m_tableWidget->setSortingEnabled(false);
75
76 for (int irow = 0; irow<entry_key.count();++irow)
77 {
78 m_tableWidget->insertRow ( irow );
79 m_tableWidget->setItem(irow, 0, new QTableWidgetItem(entry_key.at(irow)));
80 m_tableWidget->setItem(irow, 1, new QTableWidgetItem(entry_type.at(irow)));
81 }
82
83 m_tableWidget->setSortingEnabled(true);
84 m_tableWidget->resizeColumnsToContents();
85 m_tableWidget->resizeRowsToContents();
86 m_tableWidget->setUpdatesEnabled(true);
87}
88
89//_________________________________________________________
94
95//_________________________________________________________
100
101//_________________________________________________________
103{
104 m_tableWidget->setUpdatesEnabled(false);
105 m_tableWidget->setSortingEnabled(false);
106 m_tableWidget->clearContents();
107
108 while (m_tableWidget->rowCount()>0)
109 m_tableWidget->removeRow(m_tableWidget->rowCount()-1);
110 m_tableWidget->setUpdatesEnabled(true);
111
112}
113
114//_________________________________________________________
115void VP1TriggerDecisionChannel::cellActivated( int row, int /*column*/ )
116{
117 QString key = m_tableWidget->item(row,0)->text();
118 QString type = m_tableWidget->item(row,1)->text();
119
120 QStringList info = m_trigdecsystem->getInfoForEntry(key,type);
121
122 message("===== "+key+" ("+(type.isEmpty()? 0 :type)+"):");
123
124 for (const QString& line : info)
125 message(line);
126
127}
#define VP1CHANNELNAMEINPLUGIN(cls, nme)
void registerSystem(IVP1System *)
void message(QString)
IVP1ChannelWidget(const QString &name, const QString &information, const QString &contact_info)
std::unique_ptr< VP1TriggerDecisionSystem > m_trigdecsystem
void cellActivated(int row, int column)
void entriesChanged(const QStringList &entry_key, const QStringList &entry_type)