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;
59 return std::sqrt( v.x()*v.x() + v.y()*v.y() + v.z()*v.z() );
65 SoLineSet *
createCross(
const double&
x,
const double&
y,
const double&
z,
const double& extent = 10*Gaudi::Units::mm );
88 SoVertexProperty *
vertices =
static_cast<SoVertexProperty *
>(
m_line->vertexProperty.getValue());
91 m_line->numVertices.set1Value(0,2);
92 m_line->numVertices.set1Value(1,2);
93 m_line->numVertices.set1Value(2,2);
97 QPair<VertexCommonFlags::QUANTITY,double> p =
m_d->controller->truthCrossLength();
117 double px(0), py(0), pz(0), e(0);
118 for (
const auto& PartIn:
m_vertex->particles_in()){
119 px +=PartIn->momentum().px();
120 py +=PartIn->momentum().py();
121 pz +=PartIn->momentum().pz();
122 e += PartIn->momentum().e();
143 collsep->addChild(
m_line);
149 collsep->removeChild(
m_line);
153 if (
m_d->controller->truthCutPrimaryVertexOnly()&&
this!=
m_d->vertices.at(0))
156 if (!
m_d->controller->truthCutAllowedEta().contains(
m_vertex->position().eta()))
159 QPair<VertexCommonFlags::QUANTITY,VP1Interval> p =
m_d->controller->truthCutQuantity();
160 if (!p.second.isAllR()) {
167 for (
const VP1Interval& i :
m_d->controller->truthCutAllowedPhi()) {
188 m_d->theclass =
this;
189 m_d->controller = controller;
191 connect(controller,SIGNAL(truthCutAllowedPhiChanged(
const QList<VP1Interval>&)),
this,SLOT(
recheckAllCuts()));
192 connect(controller,SIGNAL(truthCutPrimaryVertexOnlyChanged(
bool)),
this,SLOT(
recheckAllCuts()));
193 connect(controller,SIGNAL(truthCutQuantityChanged(
const QPair<VertexCommonFlags::QUANTITY,VP1Interval>&)),
this,SLOT(
recheckAllCuts()));
194 connect(controller,SIGNAL(truthCrossLengthChanged(QPair<VertexCommonFlags::QUANTITY,double>)),
this,SLOT(
updateAllShapes()));
220 SoVertexProperty *
vertices =
new SoVertexProperty();
227 SoLineSet * line =
new SoLineSet();
228 line->numVertices.set1Value(0,2);
229 line->numVertices.set1Value(1,2);
230 line->numVertices.set1Value(2,2);
243 if (mcEventColl->
size()<1)
247 for (itEvent = mcEventColl->
begin(); itEvent != itEventEnd; ++itEvent) {
252 for (
const auto& vtx: genEvent->vertices()) {
268 SoNode * pickedNode = (pickedPath ? (pickedPath->getLength()>0?pickedPath->getNodeFromTail(0):0): 0);
272 if (vh->
line()==pickedNode) {
278 return QStringList() <<
"ERROR: Could not get truth vertex information for picked Node";
282 if (
m_d->controller->printInfoOnClick()) {
285 l <<
"Truth vertex from collection "+
text()+
":" ;
286 for (
const auto& PartIn: vtx->particles_in()) {
287 const int pdg = PartIn->pdg_id();
292 l <<
"--> In: "+name+
" ("+
str(pdg)+
") [ P = "+
str(
m_d->mag(PartIn->momentum())/Gaudi::Units::GeV)+
" GeV ]";
294 for (
const auto& PartOut: vtx->particles_out()) {
295 const int pdg = PartOut->pdg_id();
300 l <<
"--> Out: "+name+
" ("+
str(pdg)+
") [ P = "+
str(
m_d->mag(PartOut->momentum())/Gaudi::Units::GeV)+
" GeV ]";
303 if (
m_d->controller->printVerboseInfoOnClick()) {
304 l <<
"======== Dump ========";
305 std::ostringstream s;
306 HepMC::Print::line(s,vtx);
307 l << QString(s.str().c_str()).split(
'\n');
308 l <<
"======================";
312 if (
m_d->controller->zoomOnClick()) {
314 std::set<SoCamera*>::iterator it,itE = cameras.end();
315 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
double mag(const HepMC::FourVector &v) const
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