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 32 of file VP1MCSystem.cxx.

Constructor & Destructor Documentation

◆ Imp()

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

Definition at line 46 of file VP1MCSystem.cxx.

46 :theclass(tc),tw(0) {
47
48 ISvcLocator* svcLoc = theclass->serviceLocator();
49 if (!svcLoc) {
50 theclass->message("Error: Got NULL pointer to the service locator!");
51 return;
52 }
53 pps = svcLoc->service( "PartPropSvc" );
54 if(!pps) {
55 theclass->message("Error: Could not retrieve PartPropSvc!!");
56 return;
57 }
58
59}
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 61 of file VP1MCSystem.cxx.

61 {
62 QFont font = item->font(0);
63
64 if (item->text(0)==name) {
65 font.setBold(true);
66 for (int i=0;i<item->columnCount();++i) {
67 item->setFont(i,font);
68 }
69
70
71 QTreeWidgetItem *expandItem = item;
72 while (expandItem) {
73 expandItem->setExpanded(true);
74 expandItem=expandItem->parent();
75 if (!expandItem || expandItem->isExpanded()) break;
76 }
77 }
78 for (int i=0;i<item->childCount();++i) {
79 expand(name, item->child(i));
80 }
81}
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 94 of file VP1MCSystem.cxx.

94 {
95
96#ifdef PD
97 const HepPDT::ParticleDataTable * dataTable = pps->PDT();
98 const HepPDT::ParticleData * particleData = dataTable->particle(iabs(theParticle.pdg_id()));
99 // Generate text
100 if (particleData) {
101 }
102 else {
103 }
104#endif
105
106 std::ostringstream partStream, pidStream, massStream, ptStream, etaStream, phiStream;
107
108 bool ok;
109 QString name = VP1ParticleData::particleName(theParticle.pdg_id(),ok);
110 if (ok) {
111 partStream << name.toStdString();
112 }
113 else {
114 partStream << "PDG ID = " << theParticle.pdg_id();
115 }
116
117
118 item->setText(0,partStream.str().c_str());
119
120 double eta = 0;
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) {
125 eta =-log(tan(mom.theta()/2));
126 }
127 double phi = mom.phi();
128 while (phi<0) phi += 2*M_PI;
129 while (phi>2*M_PI) phi -= 2*M_PI;
130 double pt = mom.perp()/CLHEP::GeV;
131
132 pidStream << theParticle.pdg_id();
133 item->setText(1,pidStream.str().c_str());
134
135 massStream << theParticle.generated_mass()/CLHEP::GeV;
136 item->setText(2,massStream.str().c_str());
137
138 ptStream << pt;
139 item->setText(3,ptStream.str().c_str());
140
141 etaStream << eta;
142 item->setText(4,etaStream.str().c_str());
143
144 phiStream << phi;
145 item->setText(5,phiStream.str().c_str());
146
147 if (1) {
148 HepMC::ConstGenVertexPtr prodVertex = theParticle.production_vertex();
149
150 QBrush brush=item->foreground(0);
151 brush.setColor(Qt::gray);
152
153 if (prodVertex) {
154 int nParents=prodVertex->particles_in_size();
155 if (nParents==0) {
156 brush.setColor(Qt::black);
157 }
158 else if (nParents==1){
159 brush.setColor(Qt::blue);
160 }
161 else if (nParents>1) {
162 brush.setColor(Qt::red);
163 }
164 }
165
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);
171 }
172 if (1) {
173 HepMC::ConstGenVertexPtr decayVertex = theParticle.end_vertex();
174 if (decayVertex) {
175 // decayVertex->print();
176 for ( const HepMC::ConstGenParticlePtr& current : *decayVertex ) {
177 QTreeWidgetItem *newItem = new QTreeWidgetItem();
178 item->addChild(newItem);
179 handle(newItem,*current);
180 }
181 }
182 }
183}
#define M_PI
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
int iabs(int a)
void handle(QTreeWidgetItem *item, const HepMC::GenParticle &particle)
static QString particleName(const int &pdgcode, bool &ok)
const GenParticle * ConstGenParticlePtr
Definition GenParticle.h:38
const HepMC::GenVertex * ConstGenVertexPtr
Definition GenVertex.h:60

◆ zeroFormat()

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

Definition at line 83 of file VP1MCSystem.cxx.

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

Member Data Documentation

◆ pps

SmartIF<IPartPropSvc> VP1MCSystem::Imp::pps

Definition at line 38 of file VP1MCSystem.cxx.

◆ theclass

VP1MCSystem* VP1MCSystem::Imp::theclass

Definition at line 35 of file VP1MCSystem.cxx.

◆ tw

QTreeWidget* VP1MCSystem::Imp::tw

Definition at line 37 of file VP1MCSystem.cxx.

◆ ui

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

Definition at line 36 of file VP1MCSystem.cxx.

36{};

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