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;
326 switch (
m_d->muon->muonType()){
327 case xAOD::Muon::Combined:
328 l <<
"Type = Combined";
330 case xAOD::Muon::MuonStandAlone:
331 l <<
"Type = MuonStandAlone";
333 case xAOD::Muon::SegmentTagged:
334 l <<
"Type = SegmentTagged";
336 case xAOD::Muon::CaloTagged:
337 l <<
"Type = CaloTagged";
339 case xAOD::Muon::SiliconAssociatedForwardMuon:
340 l <<
"Type = SiliconAssociatedForwardMuon";
343 l <<
"Type = Unknown";
346 switch (
m_d->muon->quality()){
347 case xAOD::Muon::Tight:
348 l <<
"Quality = Tight";
350 case xAOD::Muon::Medium:
351 l <<
"Quality = Medium";
353 case xAOD::Muon::Loose:
354 l <<
"Quality = Loose";
356 case xAOD::Muon::VeryLoose:
357 l <<
"Quality = VeryLoose";
360 l <<
"Quality = Unknown";
367#if defined BUILDVP1LIGHT
374 double phi =
m_d->muon->primaryTrackParticle()->phi0();
375 double theta =
m_d->muon->primaryTrackParticle()->theta();
378 double qop =
m_d->muon->primaryTrackParticle()->qOverP();
404 if( !(
m_d->collHandle->hasPrimaryTrackParticleInfo()) ) {
405 m_d->collHandle->printMsgNoTrackParticle();
409 const Trk::Perigee& p =
m_d->muon->primaryTrackParticle()->perigeeParameters();
416#if defined BUILDVP1LIGHT
423 double d0 =
m_d->muon->primaryTrackParticle()->d0();
424 double z0 =
m_d->muon->primaryTrackParticle()->z0();
425 double phi =
m_d->muon->primaryTrackParticle()->phi0();
439 if( !(
m_d->collHandle->hasPrimaryTrackParticleInfo()) ) {
440 m_d->collHandle->printMsgNoTrackParticle();
443 const Trk::Perigee& p =
m_d->muon->primaryTrackParticle()->perigeeParameters();
451 if( !(
m_d->collHandle->hasPrimaryTrackParticleInfo()) ) {
452 m_d->collHandle->printMsgNoTrackParticle();
454 return *(
m_d->muon->primaryTrackParticle());
460 if( !(
m_d->collHandle->hasPrimaryTrackParticleInfo()) ) {
461 m_d->collHandle->printMsgNoTrackParticle();
464 return m_d->muon->primaryTrackParticle()->charge();
470 if( !(
m_d->collHandle->hasPrimaryTrackParticleInfo()) ) {
471 m_d->collHandle->printMsgNoTrackParticle();
474 return static_cast<unsigned int>(
m_d->muon->quality());
483 switch (
m_d->muon->muonType()) {
484 case xAOD::Muon::Combined:
485 return QString(
"Combined");
486 case xAOD::Muon::MuonStandAlone:
487 return QString(
"MuonStandAlone");
488 case xAOD::Muon::SegmentTagged:
489 return QString(
"SegmentTagged");
490 case xAOD::Muon::CaloTagged:
491 return QString(
"CaloTagged");
492 case xAOD::Muon::SiliconAssociatedForwardMuon:
493 return QString(
"SiliconAssociatedForwardMuon");
495 return QString(
"Unknown Muon type");
500 switch (
m_d->muon->quality()) {
501 case xAOD::Muon::Tight:
502 return QString(
"Tight");
503 case xAOD::Muon::Medium:
504 return QString(
"Medium");
505 case xAOD::Muon::Loose:
506 return QString(
"Loose");
507 case xAOD::Muon::VeryLoose:
508 return QString(
"VeryLoose");
510 return QString(
"Unknown Muon quality");
542 if( !(
m_d->collHandle->hasPrimaryTrackParticleInfo()) ) {
543 m_d->collHandle->printMsgNoTrackParticle();
549 TSOSitem->setText(0, QString(
"Def. Parameters [d0,z0,phi0,theta,qOverP]" ) );
550 QString dParameters(
"(");
551 dParameters+=QString::number(
m_d->muon->primaryTrackParticle()->d0());
553 dParameters+=QString::number(
m_d->muon->primaryTrackParticle()->z0());
555 dParameters+=QString::number(
m_d->muon->primaryTrackParticle()->phi0());
557 dParameters+=QString::number(
m_d->muon->primaryTrackParticle()->theta());
559 dParameters+=QString::number(
m_d->muon->primaryTrackParticle()->qOverP());
561 TSOSitem->setText(1, dParameters );
563 for (
unsigned int i=0; i<
m_d->muon->primaryTrackParticle()->numberOfParameters() ; ++i){
565 TSOSitem->setText(0, QString(
"Parameter "+QString::number( i+1 ) ) );
566 QString pos(
", Position = (");
567 pos+=QString::number(
m_d->muon->primaryTrackParticle()->parameterX(i));
569 pos+=QString::number(
m_d->muon->primaryTrackParticle()->parameterY(i));
571 pos+=QString::number(
m_d->muon->primaryTrackParticle()->parameterZ(i));
574 switch (
m_d->muon->primaryTrackParticle()->parameterPosition(i)){
576 TSOSitem->setText(1, QString(
"BeamLine" )+pos );
579 TSOSitem->setText(1, QString(
"FirstMeasurement")+pos );
582 TSOSitem->setText(1, QString(
"LastMeasurement" )+pos );
585 TSOSitem->setText(1, QString(
"CalorimeterEntrance")+pos );
588 TSOSitem->setText(1, QString(
"CalorimeterExit" )+pos );
591 TSOSitem->setText(1, QString(
"MuonSpectrometerEntrance")+pos );
594 TSOSitem->setText(1, QString(
"Undefined")+pos );
603 if (!
m_d->parametersAndPositions.isEmpty())
604 return m_d->parametersAndPositions;
606 typedef std::pair<xAOD::ParameterPosition, Amg::Vector3D> paramAndPos;
608 #if defined BUILDVP1LIGHT
611 if( !(
m_d->collHandle->hasPrimaryTrackParticleInfo()) ) {
612 m_d->collHandle->printMsgNoTrackParticle();
613 return m_d->parametersAndPositions;
615 const Trk::Perigee& peri =
m_d->muon->primaryTrackParticle()->perigeeParameters ();
620 for (
unsigned int i=0; i<
m_d->muon->primaryTrackParticle()->numberOfParameters() ; ++i){
621 x =
m_d->muon->primaryTrackParticle()->parameterX(i);
622 y =
m_d->muon->primaryTrackParticle()->parameterY(i);
623 z =
m_d->muon->primaryTrackParticle()->parameterZ(i);
625 m_d->parametersAndPositions.append(paramAndPos(
m_d->muon->primaryTrackParticle()->parameterPosition(i),
Amg::Vector3D(
x,
y,
z)));
627 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
QString muonTypeString() 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
QString qualityString() 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.