5 #include "HepPDT/ParticleDataTable.hh"
6 #include "HepPDT/ParticleData.hh"
8 #include "ui_vp1mccontroller.h"
14 #include "GaudiKernel/IClassIDSvc.h"
15 #include "GaudiKernel/ISvcLocator.h"
16 #include <QListWidget>
17 #include <QListWidgetItem>
18 #include <QTreeWidget>
19 #include <QTreeWidgetItem>
23 #include "CLHEP/Vector/ThreeVector.h"
25 #include "GaudiKernel/IPartPropSvc.h"
27 #include "CLHEP/Units/SystemOfUnits.h"
36 Ui::VP1MCSystemControllerForm
ui{};
67 for (
int i=0;
i<
item->columnCount();++
i) {
72 QTreeWidgetItem *expandItem =
item;
74 expandItem->setExpanded(
true);
75 expandItem=expandItem->parent();
76 if (!expandItem || expandItem->isExpanded())
break;
79 for (
int i=0;
i<
item->childCount();++
i) {
87 for (
int i=0;
i<
item->columnCount();++
i) {
90 for (
int i=0;
i<
item->childCount();++
i) {
91 zeroFormat(
item->child(
i));
98 const HepPDT::ParticleDataTable * dataTable =
pps->PDT();
99 const HepPDT::ParticleData * particleData = dataTable->particle(
iabs(theParticle.pdg_id()));
107 std::ostringstream partStream, pidStream, massStream, ptStream, etaStream, phiStream;
112 partStream <<
name.toStdString();
115 partStream <<
"PDG ID = " << theParticle.pdg_id();
119 item->setText(0,partStream.str().c_str());
122 CLHEP::Hep3Vector
mom=CLHEP::Hep3Vector(theParticle.momentum().x(),
123 theParticle.momentum().y(),
124 theParticle.momentum().z());
125 if (
mom.x()!=0 ||
mom.y()!=0) {
133 pidStream << theParticle.pdg_id();
134 item->setText(1,pidStream.str().c_str());
136 massStream << theParticle.generated_mass()/
CLHEP::GeV;
137 item->setText(2,massStream.str().c_str());
140 item->setText(3,ptStream.str().c_str());
143 item->setText(4,etaStream.str().c_str());
146 item->setText(5,phiStream.str().c_str());
151 QBrush brush=
item->foreground(0);
155 int nParents=prodVertex->particles_in_size();
157 brush.setColor(Qt::black);
159 else if (nParents==1){
162 else if (nParents>1) {
167 item->setForeground(0,brush);
168 item->setForeground(1,brush);
169 item->setForeground(2,brush);
170 item->setForeground(3,brush);
171 item->setForeground(4,brush);
178 QTreeWidgetItem *newItem =
new QTreeWidgetItem();
179 item->addChild(newItem);
190 "System for browsing the MC Event",
191 "Joe Boudreau <boudreau@pitt.edu> (original), Thomas.Kittelmann@cern.ch (VP1 implementation)"),
208 QWidget * controller =
new QWidget;
209 m_d->
ui.setupUi(controller);
213 connect (
m_d->
ui.listWidget, SIGNAL (itemDoubleClicked (QListWidgetItem *)),
this, SLOT (
editItem (QListWidgetItem *)));
224 for (;iter!=endColl;++iter) {
226 for (
e=iter->begin();
e!=iter->end(); ++
e) {
228 if (!
particle->production_vertex() || !
particle->production_vertex()->particles_in_size()) {
229 QTreeWidgetItem *
item =
new QTreeWidgetItem();
252 for (
int i=0;
i<
m_d->
ui.listWidget->count();++
i) {
253 m_d->
ui.listWidget->setCurrentRow(
i);
265 if (
state.version()!=0) {
266 message(
"Warning: State data in .vp1 file is in wrong format - ignoring!");
270 qint32 itemCount=
state.restoreInt();
271 for (
int i=0;
i<itemCount;++
i) {
280 m_d->
tw->setColumnCount(5);
281 m_d->
tw->setHeaderLabels((QStringList()<<
"Type"<<
"ID" <<
"Mass (GeV) " <<
"Pt (GeV)"<<
"Eta"<<
"Phi"));
282 m_d->
tw->setAlternatingRowColors (
true );
283 m_d->
tw->setEditTriggers(QAbstractItemView::NoEditTriggers);
287 m_d->
ui.listWidget->addItem(
"<particleName>");
288 m_d->
ui.listWidget->setCurrentRow(
m_d->
ui.listWidget->count()-1);
295 QList<QListWidgetItem *> selectedItems =
m_d->
ui.listWidget->selectedItems();
296 for (
int i=0;
i<selectedItems.size();++
i) {
297 int row =
m_d->
ui.listWidget->row(selectedItems[
i]);
298 QListWidgetItem *
item =
m_d->
ui.listWidget->takeItem(
row);
304 m_d->
tw->collapseAll();
305 for (
int j=0;j<
m_d->
ui.listWidget->count();++j) {
306 m_d->
ui.listWidget->setCurrentRow(j);
307 QString
text =
m_d->
ui.listWidget->currentItem()->text();
308 for (
int i=0;
i<
m_d->
tw->topLevelItemCount();++
i) {
313 for (
int j=0;j<
m_d->
ui.listWidget->count();++j) {
314 m_d->
ui.listWidget->setCurrentRow(j);
315 QString
text =
m_d->
ui.listWidget->currentItem()->text();
316 for (
int i=0;
i<
m_d->
tw->topLevelItemCount();++
i) {
325 m_d->
ui.listWidget->openPersistentEditor(
item);