23#include <Inventor/C/errors/debugerror.h>
24#include <Inventor/nodes/SoLineSet.h>
25#include <Inventor/nodes/SoPointSet.h>
26#include <Inventor/nodes/SoVertexProperty.h>
27#include <Inventor/nodes/SoMaterial.h>
28#include <Inventor/nodes/SoCone.h>
29#include <Inventor/nodes/SoSeparator.h>
30#include <Inventor/nodes/SoTranslation.h>
31#include <Inventor/nodes/SoRotationXYZ.h>
34 #include "CLHEP/Units/SystemOfUnits.h"
39 #include "GeoModelKernel/Units.h"
40 #define SYSTEM_OF_UNITS GeoModelKernelUnits
42 #include "GaudiKernel/SystemOfUnits.h"
43 #define SYSTEM_OF_UNITS Gaudi::Units
54 SoSeparator *
sep =
nullptr;
55 SoLineSet *
line =
nullptr;
73 if (
m_d->line)
m_d->line->unref();
74 if (
m_d->sep)
m_d->sep->unref();
187 m_d->sep =
new SoSeparator();
199 SoPointSet* parameterPoints =
new SoPointSet;
200 SoVertexProperty* vertices2 =
new SoVertexProperty;
205 for (std::pair<xAOD::ParameterPosition, Amg::Vector3D> parpos : parAndPoses ) {
207 vertices2->vertex.set1Value(i++,pos.x(),pos.y(),pos.z());
210 parameterPoints->numPoints=i;
211 parameterPoints->vertexProperty = vertices2;
214 m_d->sep->addChild(parameterPoints);
220 std::vector<Amg::Vector3D> positions, momenta;
223 if (!trackparticle) {
224 VP1Msg::message(
"ERROR : no primary track particle associated with this Muon. Can't visualise it.");
227#if defined BUILDVP1LIGHT
248 if ( positions.size()<2 ) {
249 VP1Msg::messageVerbose(
"IParticleHandle_Muon::addLine_FromTrackParticle - WARNING - not enough points to make a line.");
256 m_d->sep->addChild(
m_d->collHandle->material());
259 m_d->sep->addChild(
m_d->line);
263 float x =
a.x() + (b.x()-
a.x())*t;
264 float y =
a.y() + (b.y()-
a.y())*t;
265 float z =
a.z() + (b.z()-
a.z())*t;
277 linear(output, abbc,bccd,t);
282 unsigned int npointsused(0);
284 m_d->line =
new SoLineSet();
289 SoVertexProperty * vertices =
new SoVertexProperty();
291 for (
unsigned int i=1; i<positions.size(); ++i){
294 unsigned int maxCount=4;
295 float scale = ( (positions[i]-positions[i-1]).mag() )/2.0;
303 float t=
count/(float)maxCount;
305 bezier(pos, p0, p1, p2, p3, t);
309 vertices->vertex.set1Value(iver++,pos.x(),pos.y(),pos.z());
315 m_d->line->numVertices.set1Value(0,npointsused);
316 m_d->line->vertexProperty = vertices;
323 std::stringstream sstr{};
327 sstr <<
"Type = "<<
m_d->muon->muonType()<<
", ";
328 sstr <<
"Quality = "<<
m_d->muon->quality();
329 l<<sstr.str().c_str();
334#if defined BUILDVP1LIGHT
341 double phi =
m_d->muon->primaryTrackParticle()->phi0();
342 double theta =
m_d->muon->primaryTrackParticle()->theta();
345 double qop =
m_d->muon->primaryTrackParticle()->qOverP();
371 if( !(
m_d->collHandle->hasPrimaryTrackParticleInfo()) ) {
372 m_d->collHandle->printMsgNoTrackParticle();
376 const Trk::Perigee& p =
m_d->muon->primaryTrackParticle()->perigeeParameters();
383#if defined BUILDVP1LIGHT
390 double d0 =
m_d->muon->primaryTrackParticle()->d0();
391 double z0 =
m_d->muon->primaryTrackParticle()->z0();
392 double phi =
m_d->muon->primaryTrackParticle()->phi0();
403 if( !(
m_d->collHandle->hasPrimaryTrackParticleInfo()) ) {
404 m_d->collHandle->printMsgNoTrackParticle();
407 const Trk::Perigee& p =
m_d->muon->primaryTrackParticle()->perigeeParameters();
415 if( !(
m_d->collHandle->hasPrimaryTrackParticleInfo()) ) {
416 m_d->collHandle->printMsgNoTrackParticle();
418 return *(
m_d->muon->primaryTrackParticle());
424 if( !(
m_d->collHandle->hasPrimaryTrackParticleInfo()) ) {
425 m_d->collHandle->printMsgNoTrackParticle();
428 return m_d->muon->primaryTrackParticle()->charge();
434 if( !(
m_d->collHandle->hasPrimaryTrackParticleInfo()) ) {
435 m_d->collHandle->printMsgNoTrackParticle();
438 return static_cast<unsigned int>(
m_d->muon->quality());
460 if( !(
m_d->collHandle->hasPrimaryTrackParticleInfo()) ) {
461 m_d->collHandle->printMsgNoTrackParticle();
467 TSOSitem->setText(0, QString(
"Def. Parameters [d0,z0,phi0,theta,qOverP]" ) );
468 QString dParameters(
"(");
469 dParameters+=QString::number(
m_d->muon->primaryTrackParticle()->d0());
471 dParameters+=QString::number(
m_d->muon->primaryTrackParticle()->z0());
473 dParameters+=QString::number(
m_d->muon->primaryTrackParticle()->phi0());
475 dParameters+=QString::number(
m_d->muon->primaryTrackParticle()->theta());
477 dParameters+=QString::number(
m_d->muon->primaryTrackParticle()->qOverP());
479 TSOSitem->setText(1, dParameters );
481 for (
unsigned int i=0; i<
m_d->muon->primaryTrackParticle()->numberOfParameters() ; ++i){
483 TSOSitem->setText(0, QString(
"Parameter "+QString::number( i+1 ) ) );
484 QString pos(
", Position = (");
485 pos+=QString::number(
m_d->muon->primaryTrackParticle()->parameterX(i));
487 pos+=QString::number(
m_d->muon->primaryTrackParticle()->parameterY(i));
489 pos+=QString::number(
m_d->muon->primaryTrackParticle()->parameterZ(i));
492 switch (
m_d->muon->primaryTrackParticle()->parameterPosition(i)){
494 TSOSitem->setText(1, QString(
"BeamLine" )+pos );
497 TSOSitem->setText(1, QString(
"FirstMeasurement")+pos );
500 TSOSitem->setText(1, QString(
"LastMeasurement" )+pos );
503 TSOSitem->setText(1, QString(
"CalorimeterEntrance")+pos );
506 TSOSitem->setText(1, QString(
"CalorimeterExit" )+pos );
509 TSOSitem->setText(1, QString(
"MuonSpectrometerEntrance")+pos );
512 TSOSitem->setText(1, QString(
"Undefined")+pos );
521 if (!
m_d->parametersAndPositions.isEmpty())
522 return m_d->parametersAndPositions;
524 typedef std::pair<xAOD::ParameterPosition, Amg::Vector3D> paramAndPos;
526 #if defined BUILDVP1LIGHT
529 if( !(
m_d->collHandle->hasPrimaryTrackParticleInfo()) ) {
530 m_d->collHandle->printMsgNoTrackParticle();
531 return m_d->parametersAndPositions;
533 const Trk::Perigee& peri =
m_d->muon->primaryTrackParticle()->perigeeParameters ();
538 for (
unsigned int i=0; i<
m_d->muon->primaryTrackParticle()->numberOfParameters() ; ++i){
539 x =
m_d->muon->primaryTrackParticle()->parameterX(i);
540 y =
m_d->muon->primaryTrackParticle()->parameterY(i);
541 z =
m_d->muon->primaryTrackParticle()->parameterZ(i);
543 m_d->parametersAndPositions.append(paramAndPos(
m_d->muon->primaryTrackParticle()->parameterPosition(i),
Amg::Vector3D(
x,
y,
z)));
545 return m_d->parametersAndPositions;
Scalar phi() const
phi method
Scalar theta() const
theta method
Scalar mag() const
mag method
const PlainObject unit() const
This is a plugin that makes Eigen look like CLHEP & defines some convenience methods.
QTreeWidgetItem * browserTreeItem() const
Return the QTreeWidgetItem;.
virtual void fillObjectBrowser(QList< QTreeWidgetItem * > &list)
Create and fill the object browser QTreeWidgetItem.
Base class for collections holding AOD objects of iParticle type Handles pt etc cuts Local data:
bool hasPrimaryTrackParticleInfo()
void printMsgNoTrackParticle()
IParticleHandleBase(IParticleCollHandleBase *)
virtual QStringList baseInfo() const
IParticleHandle_Muon * theclass
QList< std::pair< xAOD::ParameterPosition, Amg::Vector3D > > parametersAndPositions
IParticleCollHandle_Muon * collHandle
const QList< std::pair< xAOD::ParameterPosition, Amg::Vector3D > > & parametersAndPositions() const
unsigned int quality() const
virtual QStringList clicked() const
Called when user selects the node (stringlist is displayed in messagebox).
void bezier(Amg::Vector3D &output, Amg::Vector3D &a, Amg::Vector3D &b, Amg::Vector3D &c, Amg::Vector3D &d, float t)
virtual void clear3DObjects()
Delete objects.
void fillObjectBrowser(QList< QTreeWidgetItem * > &listOfItems)
Create and fill the object browser QTreeWidgetItem.
virtual Amg::Vector3D position() const
void linear(Amg::Vector3D &output, Amg::Vector3D &a, Amg::Vector3D &b, float t)
virtual SoNode * nodes()
Returns the 3Dobjects.
virtual double charge() const
Returns unknown() in case of trouble.
void addParameterShapes()
virtual Amg::Vector3D momentum() const
const xAOD::IParticle & iParticle() const
void fillLineFromSplineFit(const std::vector< Amg::Vector3D > &positions, const std::vector< Amg::Vector3D > &momenta)
const xAOD::Muon & muon() const
IParticleHandle_Muon(IParticleCollHandleBase *, const xAOD::Muon *)
virtual bool has3DObjects()
Returns true if the 3D objects have been created.
QString shortInfo() const
This returns the information shown about the object in the object browser.
virtual ~IParticleHandle_Muon()
void addLine_FromTrackParticle()
const Amg::Vector3D & momentum() const
Access method for the momentum.
const Amg::Vector3D & position() const
Access method for the position.
static void messageVerbose(const QString &)
static void message(const QString &, IVP1System *sys=0)
static QString str(const QString &s)
Class providing the definition of the 4-vector interface.
const Trk::Perigee & perigeeParameters() const
Returns the Trk::MeasuredPerigee track parameters.
float parameterPX(unsigned int index) const
Returns the parameter x momentum component, for 'index'.
float parameterX(unsigned int index) const
Returns the parameter x position, for 'index'.
float parameterPY(unsigned int index) const
Returns the parameter y momentum component, for 'index'.
float parameterZ(unsigned int index) const
Returns the parameter z position, for 'index'.
size_t numberOfParameters() const
Returns the number of additional parameters stored in the TrackParticle.
float parameterY(unsigned int index) const
Returns the parameter y position, for 'index'.
float parameterPZ(unsigned int index) const
Returns the parameter z momentum component, for 'index'.
int count(std::string s, const std::string ®x)
count how many occurances of a regx are in a string
Eigen::Matrix< double, 3, 1 > Vector3D
constexpr double INVALID_P(10e9)
constexpr double INVALID_QOP(10e-9)
ParametersT< TrackParametersDim, Charged, PerigeeSurface > Perigee
TrackParticle_v1 TrackParticle
Reference the current persistent version:
Muon_v1 Muon
Reference the current persistent version:
@ MuonSpectrometerEntrance
Parameter defined at the entrance to the Muon Spectrometer.
@ BeamLine
Parameter defined at the Vertex/Beamline.
@ CalorimeterExit
Parameter defined at the exit of the calorimeter.
@ CalorimeterEntrance
Parameter defined at the entrance to the calorimeter.
@ FirstMeasurement
Parameter defined at the position of the 1st measurement.
@ LastMeasurement
Parameter defined at the position of the last measurement.