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{};
 
   38   SmartIF<IPartPropSvc> 
pps;
 
   53   pps = svcLoc->service( 
"PartPropSvc" );
 
   66     for (
int i=0;
i<
item->columnCount();++
i) {
 
   71     QTreeWidgetItem *expandItem = 
item;
 
   73       expandItem->setExpanded(
true);
 
   74       expandItem=expandItem->parent();
 
   75       if (!expandItem || expandItem->isExpanded()) 
break;
 
   78   for (
int i=0;
i<
item->childCount();++
i) {
 
   86   for (
int i=0;
i<
item->columnCount();++
i) {
 
   89   for (
int i=0;
i<
item->childCount();++
i) {
 
   90     zeroFormat(
item->child(
i));
 
   97   const HepPDT::ParticleDataTable * dataTable = 
pps->PDT();
 
   98   const HepPDT::ParticleData      * particleData = dataTable->particle(
iabs(theParticle.pdg_id()));
 
  106   std::ostringstream partStream, pidStream, massStream, ptStream, etaStream, phiStream;
 
  111     partStream << 
name.toStdString();
 
  114     partStream << 
"PDG ID = " << theParticle.pdg_id();
 
  118   item->setText(0,partStream.str().c_str());
 
  121   CLHEP::Hep3Vector 
mom=CLHEP::Hep3Vector(theParticle.momentum().x(),
 
  122                 theParticle.momentum().y(),
 
  123                 theParticle.momentum().z());
 
  124   if (
mom.x()!=0 || 
mom.y()!=0) {
 
  132   pidStream << theParticle.pdg_id();
 
  133   item->setText(1,pidStream.str().c_str());
 
  135   massStream << theParticle.generated_mass()/
CLHEP::GeV;
 
  136   item->setText(2,massStream.str().c_str());
 
  139   item->setText(3,ptStream.str().c_str());
 
  142   item->setText(4,etaStream.str().c_str());
 
  145   item->setText(5,phiStream.str().c_str());
 
  150     QBrush brush=
item->foreground(0);
 
  154       int nParents=prodVertex->particles_in_size();
 
  156     brush.setColor(Qt::black);
 
  158       else if (nParents==1){
 
  161       else if (nParents>1) {
 
  166     item->setForeground(0,brush);
 
  167     item->setForeground(1,brush);
 
  168     item->setForeground(2,brush);
 
  169     item->setForeground(3,brush);
 
  170     item->setForeground(4,brush);
 
  177         QTreeWidgetItem *newItem = 
new QTreeWidgetItem();
 
  178         item->addChild(newItem);
 
  189            "System for browsing the MC Event",
 
  190            "Joe Boudreau <boudreau@pitt.edu> (original), Thomas.Kittelmann@cern.ch (VP1 implementation)"),
 
  207   QWidget * controller = 
new QWidget;
 
  208   m_d->
ui.setupUi(controller);
 
  212   connect (
m_d->
ui.listWidget, SIGNAL (itemDoubleClicked (QListWidgetItem *)), 
this, SLOT (
editItem (QListWidgetItem *)));
 
  227           if (!
particle->production_vertex() || ! 
particle->production_vertex()->particles_in_size()) {
 
  228             QTreeWidgetItem *
item = 
new QTreeWidgetItem();
 
  251   for (
int i=0;
i<
m_d->
ui.listWidget->count();++
i) {
 
  252     m_d->
ui.listWidget->setCurrentRow(
i);
 
  264   if (
state.version()!=0) {
 
  265     message(
"Warning: State data in .vp1 file is in wrong format - ignoring!");
 
  269   qint32 itemCount=
state.restoreInt();
 
  270   for (
int i=0;
i<itemCount;++
i) {
 
  279   m_d->
tw->setColumnCount(5);
 
  280   m_d->
tw->setHeaderLabels((QStringList()<<
"Type"<< 
"ID" << 
"Mass (GeV) " << 
"Pt (GeV)"<<
"Eta"<<
"Phi"));
 
  281   m_d->
tw->setAlternatingRowColors ( 
true );
 
  282   m_d->
tw->setEditTriggers(QAbstractItemView::NoEditTriggers);
 
  286   m_d->
ui.listWidget->addItem(
"<particleName>");
 
  287   m_d->
ui.listWidget->setCurrentRow(
m_d->
ui.listWidget->count()-1);
 
  294   QList<QListWidgetItem *> selectedItems =
m_d->
ui.listWidget->selectedItems();
 
  295   for (
int i=0;
i<selectedItems.size();++
i) {
 
  296     int row = 
m_d->
ui.listWidget->row(selectedItems[
i]);
 
  297     QListWidgetItem *
item = 
m_d->
ui.listWidget->takeItem(
row);
 
  303   m_d->
tw->collapseAll();
 
  304   for (
int j=0;j<
m_d->
ui.listWidget->count();++j) {
 
  305     m_d->
ui.listWidget->setCurrentRow(j);
 
  306     QString 
text = 
m_d->
ui.listWidget->currentItem()->text();
 
  307     for (
int i=0;
i<
m_d->
tw->topLevelItemCount();++
i) {
 
  312   for (
int j=0;j<
m_d->
ui.listWidget->count();++j) {
 
  313     m_d->
ui.listWidget->setCurrentRow(j);
 
  314     QString 
text = 
m_d->
ui.listWidget->currentItem()->text();
 
  315     for (
int i=0;
i<
m_d->
tw->topLevelItemCount();++
i) {
 
  324   m_d->
ui.listWidget->openPersistentEditor(
item);