ATLAS Offline Software
Loading...
Searching...
No Matches
VP1MCSystem::Imp Class Reference
Collaboration diagram for VP1MCSystem::Imp:

Public Member Functions

 Imp (VP1MCSystem *tc)
void handle (QTreeWidgetItem *item, const HepMC::GenParticle &particle)
void expand (const QString &text, QTreeWidgetItem *item)
void zeroFormat (QTreeWidgetItem *item)

Public Attributes

VP1MCSystemtheclass
Ui::VP1MCSystemControllerForm ui {}
QTreeWidget * tw
SmartIF< IPartPropSvc > pps

Detailed Description

Definition at line 30 of file VP1MCSystem.cxx.

Constructor & Destructor Documentation

◆ Imp()

VP1MCSystem::Imp::Imp ( VP1MCSystem * tc)

Definition at line 44 of file VP1MCSystem.cxx.

44 :theclass(tc),tw(0) {
45
46 ISvcLocator* svcLoc = theclass->serviceLocator();
47 if (!svcLoc) {
48 theclass->message("Error: Got NULL pointer to the service locator!");
49 return;
50 }
51 pps = svcLoc->service( "PartPropSvc" );
52 if(!pps) {
53 theclass->message("Error: Could not retrieve PartPropSvc!!");
54 return;
55 }
56
57}
static Double_t tc
QTreeWidget * tw
SmartIF< IPartPropSvc > pps
VP1MCSystem * theclass

Member Function Documentation

◆ expand()

void VP1MCSystem::Imp::expand ( const QString & text,
QTreeWidgetItem * item )

Definition at line 59 of file VP1MCSystem.cxx.

59 {
60 QFont font = item->font(0);
61
62 if (item->text(0)==name) {
63 font.setBold(true);
64 for (int i=0;i<item->columnCount();++i) {
65 item->setFont(i,font);
66 }
67
68
69 QTreeWidgetItem *expandItem = item;
70 while (expandItem) {
71 expandItem->setExpanded(true);
72 expandItem=expandItem->parent();
73 if (!expandItem || expandItem->isExpanded()) break;
74 }
75 }
76 for (int i=0;i<item->childCount();++i) {
77 expand(name, item->child(i));
78 }
79}
const QString & name() const
void expand(const QString &text, QTreeWidgetItem *item)

◆ handle()

void VP1MCSystem::Imp::handle ( QTreeWidgetItem * item,
const HepMC::GenParticle & particle )

Definition at line 92 of file VP1MCSystem.cxx.

92 {
93
94 std::ostringstream partStream, pidStream, massStream, ptStream, etaStream, phiStream;
95
96 bool ok;
97 QString name = VP1ParticleData::particleName(theParticle.pdg_id(),ok);
98 if (ok) {
99 partStream << name.toStdString();
100 }
101 else {
102 partStream << "PDG ID = " << theParticle.pdg_id();
103 }
104
105
106 item->setText(0,partStream.str().c_str());
107
108 double eta = 0;
109 CLHEP::Hep3Vector mom=CLHEP::Hep3Vector(theParticle.momentum().x(),
110 theParticle.momentum().y(),
111 theParticle.momentum().z());
112 if (mom.x()!=0 || mom.y()!=0) {
113 eta =-log(tan(mom.theta()/2));
114 }
115 double phi = mom.phi();
116 while (phi<0) phi += 2*M_PI;
117 while (phi>2*M_PI) phi -= 2*M_PI;
118 double pt = mom.perp()/CLHEP::GeV;
119
120 pidStream << theParticle.pdg_id();
121 item->setText(1,pidStream.str().c_str());
122
123 massStream << theParticle.generated_mass()/CLHEP::GeV;
124 item->setText(2,massStream.str().c_str());
125
126 ptStream << pt;
127 item->setText(3,ptStream.str().c_str());
128
129 etaStream << eta;
130 item->setText(4,etaStream.str().c_str());
131
132 phiStream << phi;
133 item->setText(5,phiStream.str().c_str());
134
135 if (1) {
136 HepMC::ConstGenVertexPtr prodVertex = theParticle.production_vertex();
137
138 QBrush brush=item->foreground(0);
139 brush.setColor(Qt::gray);
140
141 if (prodVertex) {
142 int nParents=prodVertex->particles_in_size();
143 if (nParents==0) {
144 brush.setColor(Qt::black);
145 }
146 else if (nParents==1){
147 brush.setColor(Qt::blue);
148 }
149 else if (nParents>1) {
150 brush.setColor(Qt::red);
151 }
152 }
153
154 item->setForeground(0,brush);
155 item->setForeground(1,brush);
156 item->setForeground(2,brush);
157 item->setForeground(3,brush);
158 item->setForeground(4,brush);
159 }
160 if (1) {
161 HepMC::ConstGenVertexPtr decayVertex = theParticle.end_vertex();
162 if (decayVertex) {
163 // decayVertex->print();
164 for ( const HepMC::ConstGenParticlePtr& current : *decayVertex ) {
165 QTreeWidgetItem *newItem = new QTreeWidgetItem();
166 item->addChild(newItem);
167 handle(newItem,*current);
168 }
169 }
170 }
171}
#define M_PI
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
void handle(QTreeWidgetItem *item, const HepMC::GenParticle &particle)
static QString particleName(const int &pdgcode, bool &ok)
HepMC3::ConstGenParticlePtr ConstGenParticlePtr
Definition GenParticle.h:20
HepMC3::ConstGenVertexPtr ConstGenVertexPtr
Definition GenVertex.h:24

◆ zeroFormat()

void VP1MCSystem::Imp::zeroFormat ( QTreeWidgetItem * item)

Definition at line 81 of file VP1MCSystem.cxx.

81 {
82 QFont font = item->font(0);
83 font.setBold(false);
84 for (int i=0;i<item->columnCount();++i) {
85 item->setFont(i,font);
86 }
87 for (int i=0;i<item->childCount();++i) {
88 zeroFormat(item->child(i));
89 }
90}
void zeroFormat(QTreeWidgetItem *item)

Member Data Documentation

◆ pps

SmartIF<IPartPropSvc> VP1MCSystem::Imp::pps

Definition at line 36 of file VP1MCSystem.cxx.

◆ theclass

VP1MCSystem* VP1MCSystem::Imp::theclass

Definition at line 33 of file VP1MCSystem.cxx.

◆ tw

QTreeWidget* VP1MCSystem::Imp::tw

Definition at line 35 of file VP1MCSystem.cxx.

◆ ui

Ui::VP1MCSystemControllerForm VP1MCSystem::Imp::ui {}

Definition at line 34 of file VP1MCSystem.cxx.

34{};

The documentation for this class was generated from the following file: