26#include <Inventor/nodes/SoLineSet.h>
27#include <Inventor/nodes/SoVertexProperty.h>
28#include <Inventor/SoPath.h>
29#include <Inventor/nodes/SoSeparator.h>
38#include "GaudiKernel/SystemOfUnits.h"
45 QList<VP1StdCollection*> l;
62 SoLineSet *
createCross(
const double&
x,
const double&
y,
const double&
z,
const double& extent = 10*Gaudi::Units::mm );
85 SoVertexProperty *
vertices =
static_cast<SoVertexProperty *
>(
m_line->vertexProperty.getValue());
88 m_line->numVertices.set1Value(0,2);
89 m_line->numVertices.set1Value(1,2);
90 m_line->numVertices.set1Value(2,2);
94 QPair<VertexCommonFlags::QUANTITY,double> p =
m_d->controller->truthCrossLength();
114 double px(0), py(0), pz(0), e(0);
115 for (
const auto& PartIn:
m_vertex->particles_in()){
116 px +=PartIn->momentum().px();
117 py +=PartIn->momentum().py();
118 pz +=PartIn->momentum().pz();
119 e += PartIn->momentum().e();
140 collsep->addChild(
m_line);
146 collsep->removeChild(
m_line);
150 if (
m_d->controller->truthCutPrimaryVertexOnly()&&
this!=
m_d->vertices.at(0))
153 if (!
m_d->controller->truthCutAllowedEta().contains(
m_vertex->position().eta()))
156 QPair<VertexCommonFlags::QUANTITY,VP1Interval> p =
m_d->controller->truthCutQuantity();
157 if (!p.second.isAllR()) {
164 for (
const VP1Interval& i :
m_d->controller->truthCutAllowedPhi()) {
185 m_d->theclass =
this;
186 m_d->controller = controller;
188 connect(controller,SIGNAL(truthCutAllowedPhiChanged(
const QList<VP1Interval>&)),
this,SLOT(
recheckAllCuts()));
189 connect(controller,SIGNAL(truthCutPrimaryVertexOnlyChanged(
bool)),
this,SLOT(
recheckAllCuts()));
190 connect(controller,SIGNAL(truthCutQuantityChanged(
const QPair<VertexCommonFlags::QUANTITY,VP1Interval>&)),
this,SLOT(
recheckAllCuts()));
191 connect(controller,SIGNAL(truthCrossLengthChanged(QPair<VertexCommonFlags::QUANTITY,double>)),
this,SLOT(
updateAllShapes()));
217 SoVertexProperty *
vertices =
new SoVertexProperty();
224 SoLineSet * line =
new SoLineSet();
225 line->numVertices.set1Value(0,2);
226 line->numVertices.set1Value(1,2);
227 line->numVertices.set1Value(2,2);
240 if (mcEventColl->
size()<1)
244 for (itEvent = mcEventColl->
begin(); itEvent != itEventEnd; ++itEvent) {
249 for (
const auto& vtx: genEvent->vertices()) {
265 SoNode * pickedNode = (pickedPath ? (pickedPath->getLength()>0?pickedPath->getNodeFromTail(0):0): 0);
269 if (vh->
line()==pickedNode) {
275 return QStringList() <<
"ERROR: Could not get truth vertex information for picked Node";
279 if (
m_d->controller->printInfoOnClick()) {
282 l <<
"Truth vertex from collection "+
text()+
":" ;
283 for (
const auto& PartIn: vtx->particles_in()) {
284 const int pdg = PartIn->pdg_id();
289 l <<
"--> In: "+name+
" ("+
str(pdg)+
") [ P = "+
str(PartIn->momentum().length()/Gaudi::Units::GeV)+
" GeV ]";
291 for (
const auto& PartOut: vtx->particles_out()) {
292 const int pdg = PartOut->pdg_id();
297 l <<
"--> Out: "+name+
" ("+
str(pdg)+
") [ P = "+
str(PartOut->momentum().length()/Gaudi::Units::GeV)+
" GeV ]";
300 if (
m_d->controller->printVerboseInfoOnClick()) {
301 l <<
"======== Dump ========";
302 std::ostringstream s;
303 HepMC::Print::line(s,vtx);
304 l << QString(s.str().c_str()).split(
'\n');
305 l <<
"======================";
309 if (
m_d->controller->zoomOnClick()) {
311 std::set<SoCamera*>::iterator it,itE = cameras.end();
312 for (it=cameras.begin();it!=itE;++it)
Scalar phi() const
phi method
DataModel_detail::const_iterator< DataVector > const_iterator
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
size_type size() const noexcept
Returns the number of elements in the collection.
This defines the McEventCollection, which is really just an ObjectVector of McEvent objectsFile: Gene...
static VP1CameraHelper * animatedZoomToPath(SoCamera *camera, SoGroup *sceneroot, SoPath *path, double duration_in_secs=1.0, double clipVolPercent=100.0, double slack=1.0, const SbVec3f &lookat=SbVec3f(999, 999, 999), const SbVec3f &upvec=SbVec3f(999, 999, 999), bool varySpeed=true, bool forceCircular=false)
IVP1System * systemBase() const
static QString particleName(const int &pdgcode, bool &ok)
QStringList getKeys() const
virtual void largeChangesEnd()
virtual void init(VP1MaterialButtonBase *button=0)
SoSeparator * collSep() const
All 3D objects from this coll.
virtual void largeChangesBegin()
VP1StdCollection(IVP1System *, const QString &helperClassName)
HepMC::ConstGenVertexPtr vertex() const
double quantityVal(const VertexCommonFlags::QUANTITY &q)
VertexHandle(HepMC::ConstGenVertexPtr v, VP1TruthVertexCollection::Imp *dd)
HepMC::ConstGenVertexPtr m_vertex
void ensureAttach(SoSeparator *collsep)
VP1TruthVertexCollection::Imp * m_d
void ensureDetach(SoSeparator *collsep)
VertexSysController * controller
QList< VertexHandle * > vertices
VP1TruthVertexCollection * theclass
SoLineSet * createCross(const double &x, const double &y, const double &z, const double &extent=10 *Gaudi::Units::mm)
std::map< SoNode *, HepMC::ConstGenVertexPtr > nodeToVertexMap
void assignDefaultMaterial(SoMaterial *) const
virtual ~VP1TruthVertexCollection()
VP1TruthVertexCollection(VertexSysController *, const QString &key)
QStringList infoOnClicked(SoPath *pickedPath)
QString provideText() const
static QList< VP1StdCollection * > createCollections(VertexSysController *)
HepMC3::FourVector FourVector
HepMC3::ConstGenVertexPtr ConstGenVertexPtr
HepMC3::GenEvent GenEvent