Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Public Member Functions | Public Attributes | List of all members
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 }

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 }

◆ 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 }

◆ 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 }

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.


The documentation for this class was generated from the following file:
fillPileUpNoiseLumi.current
current
Definition: fillPileUpNoiseLumi.py:52
GeV
#define GeV
Definition: PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx:17
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
test_pyathena.pt
pt
Definition: test_pyathena.py:11
M_PI
#define M_PI
Definition: ActiveFraction.h:11
iabs
int iabs(int a)
Definition: SbPolyhedron.cxx:22
VP1MCSystem::Imp::zeroFormat
void zeroFormat(QTreeWidgetItem *item)
Definition: VP1MCSystem.cxx:83
PyPoolBrowser.item
item
Definition: PyPoolBrowser.py:129
ParticleGun_EoverP_Config.mom
mom
Definition: ParticleGun_EoverP_Config.py:63
VP1MCSystem::Imp::theclass
VP1MCSystem * theclass
Definition: VP1MCSystem.cxx:35
python.SystemOfUnits.gray
int gray
Definition: SystemOfUnits.py:257
lumiFormat.i
int i
Definition: lumiFormat.py:85
IVP1System::serviceLocator
ISvcLocator * serviceLocator() const
Definition: IVP1System.cxx:324
IVP1System::name
const QString & name() const
Definition: IVP1System.cxx:50
drawFromPickle.tan
tan
Definition: drawFromPickle.py:36
HepMC::ConstGenParticlePtr
const GenParticle * ConstGenParticlePtr
Definition: GenParticle.h:38
VP1MCSystem::Imp::tw
QTreeWidget * tw
Definition: VP1MCSystem.cxx:37
item
Definition: ItemListSvc.h:43
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
VP1MCSystem::Imp::pps
SmartIF< IPartPropSvc > pps
Definition: VP1MCSystem.cxx:38
VP1MCSystem::Imp::handle
void handle(QTreeWidgetItem *item, const HepMC::GenParticle &particle)
Definition: VP1MCSystem.cxx:94
plotBeamSpotMon.font
font
Definition: plotBeamSpotMon.py:80
HepMC::ConstGenVertexPtr
const HepMC::GenVertex * ConstGenVertexPtr
Definition: GenVertex.h:60
VP1MCSystem::Imp::expand
void expand(const QString &text, QTreeWidgetItem *item)
Definition: VP1MCSystem.cxx:61
red
@ red
Definition: BinsDiffFromStripMedian.h:18
IVP1System::message
void message(const QString &) const
Definition: IVP1System.cxx:336
TrackingGeometryValidation.blue
blue
Definition: TrackingGeometryValidation.py:33
VP1ParticleData::particleName
static QString particleName(const int &pdgcode, bool &ok)
Definition: VP1ParticleData.cxx:127