ATLAS Offline Software
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
 
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),pps(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  StatusCode status = svcLoc->service( "PartPropSvc",pps );
54  if(!status.isSuccess()) {
55  pps=0;
56  theclass->message("Error: Could not retrieve PartPropSvc!!");
57  return;
58  }
59 
60 }

Member Function Documentation

◆ expand()

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

Definition at line 62 of file VP1MCSystem.cxx.

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

◆ handle()

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

Definition at line 95 of file VP1MCSystem.cxx.

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

◆ zeroFormat()

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

Definition at line 84 of file VP1MCSystem.cxx.

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

Member Data Documentation

◆ pps

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
VP1MCSystem::Imp::pps
IPartPropSvc * pps
Definition: VP1MCSystem.cxx:38
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:64
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
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:84
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:92
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
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::handle
void handle(QTreeWidgetItem *item, const HepMC::GenParticle &particle)
Definition: VP1MCSystem.cxx:95
plotBeamSpotMon.font
font
Definition: plotBeamSpotMon.py:80
merge.status
status
Definition: merge.py:17
HepMC::ConstGenVertexPtr
const HepMC::GenVertex * ConstGenVertexPtr
Definition: GenVertex.h:60
VP1MCSystem::Imp::expand
void expand(const QString &text, QTreeWidgetItem *item)
Definition: VP1MCSystem.cxx:62
GeV
#define GeV
Definition: CaloTransverseBalanceVecMon.cxx:30
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:128