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>
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;
66 m_d->trackparticle = tp;
75 if (
m_d->line)
m_d->line->unref();
76 if (
m_d->sep)
m_d->sep->unref();
96 m_d->positionsToWrite.clear();
97 m_d->parametersAndPositions.clear();
104 VP1Msg::messageVerbose(
"IParticleHandle_TrackParticle::nodes() - already have sep so not doing anything.");
108 m_d->sep =
new SoSeparator();
112 bool fromTrack=
m_d->collHandle->collSettingsButton().useExistingParameters();
117 #ifndef BUILDVP1LIGHT
122 if (
m_d->collHandle->collSettingsButton().showParameters())
130 SoPointSet* parameterPoints = 0;
131 SoVertexProperty * vertices2 = 0;
136 parameterPoints =
new SoPointSet;
137 vertices2 =
new SoVertexProperty;
140 bool colourByParamType =
m_d->collHandle->collSettingsButton().colourParametersByType();
143 for (std::pair<xAOD::ParameterPosition, Amg::Vector3D> parpos : parAndPoses ) {
146 if (colourByParamType) {
148 m_d->sep->addChild(
m_d->collHandle->collSettingsButton().parameterMaterial(parpos.first));
149 vertices2->vertex.set1Value(0,pos.x(),pos.y(),pos.z());
150 parameterPoints->numPoints=1;
151 parameterPoints->vertexProperty = vertices2;
152 m_d->sep->addChild(parameterPoints);
153 parameterPoints =
new SoPointSet;
154 vertices2 =
new SoVertexProperty;
156 vertices2->vertex.set1Value(i++,pos.x(),pos.y(),pos.z());
160 if (colourByParamType) {
162 parameterPoints->unref();
166 parameterPoints->numPoints=i;
167 parameterPoints->vertexProperty = vertices2;
169 m_d->sep->addChild(parameterPoints);
175 std::vector<Amg::Vector3D> positions, momenta;
177#if defined BUILDVP1LIGHT
189 VP1Msg::messageVerbose(
"IParticleHandle_TrackParticle::addLine_FromTrackParticle - has "+QString::number(
m_d->trackparticle->numberOfParameters())+
" extra parameters.");
190 for (
unsigned int i=0; i<
m_d->trackparticle->numberOfParameters() ; ++i){
194 m_d->trackparticle->parameterY(i),
195 m_d->trackparticle->parameterZ(i)));
197 m_d->trackparticle->parameterPY(i),
198 m_d->trackparticle->parameterPZ(i)));
207 m_d->sep->addChild(
m_d->collHandle->material());
210 m_d->sep->addChild(
m_d->line);
214 float x =
a.x() + (b.x()-
a.x())*t;
215 float y =
a.y() + (b.y()-
a.y())*t;
216 float z =
a.z() + (b.z()-
a.z())*t;
228 linear(output, abbc,bccd,t);
233 unsigned int npointsused(0);
235 m_d->line =
new SoLineSet();
239 SoVertexProperty * vertices =
new SoVertexProperty();
248 bool useExistingParams =
m_d->collHandle->collSettingsButton().useExistingParameters();
250 for (
unsigned int i=1; i<positions.size(); ++i){
253 if (useExistingParams){
254 float scale = ( (positions[i]-positions[i-1]).mag() )/3.0;
264 unsigned int maxCount=
m_d->collHandle->collSettingsButton().numOfStepsForInterpolation();
266 float t=
static_cast<float>(
count)/
static_cast<float>(maxCount);
268 bezier(pos, p0, p1, p2, p3, t);
272 vertices->vertex.set1Value(iver++,pos.x(),pos.y(),pos.z());
273 m_d->positionsToWrite.append(pos);
278 vertices->vertex.set1Value(iver++,positions[i].
x(),positions[i].
y(),positions[i].
z());
279 m_d->positionsToWrite.append(positions[i]);
289 m_d->line->numVertices.set1Value(0,npointsused);
290 m_d->line->vertexProperty = vertices;
317 std::vector<Amg::Vector3D> positions;
318 std::vector<Amg::Vector3D> momenta;
340 positions.push_back(pos);
341 momenta.push_back(mom);
349 positions.push_back(pos);
350 momenta.push_back(mom);
358 m_d->sep->addChild(
m_d->collHandle->material());
362 m_d->sep->addChild(
m_d->line);
370 l <<
"TrackParticle:";
376#if defined BUILDVP1LIGHT
388 static constexpr double INVALID_P(10e9);
389 static constexpr double INVALID_QOP(10e-9);
416#if defined BUILDVP1LIGHT
444 return *(
m_d->trackparticle);
450 return m_d->trackparticle->charge();
457 if (
m_d->trackparticle->summaryValue(num,
type)){
509 l+=
"Muon prec. layers/holes [";
519 TSOSitem->setText(0, QString(
"Def. Parameters " ) );
520 QString dParameters(
"(");
521 dParameters+=QString::number(
m_d->trackparticle->d0());
523 dParameters+=QString::number(
m_d->trackparticle->z0());
525 dParameters+=QString::number(
m_d->trackparticle->phi0());
527 dParameters+=QString::number(
m_d->trackparticle->theta());
529 dParameters+=QString::number(
m_d->trackparticle->qOverP());
531 TSOSitem->setText(1, dParameters );
533 for (
unsigned int i=0; i<
m_d->trackparticle->numberOfParameters() ; ++i){
535 TSOSitem->setText(0, QString(
"Parameter "+QString::number( i+1 ) ) );
536 QString pos(
", Position = (");
537 pos+=QString::number(
m_d->trackparticle->parameterX(i));
539 pos+=QString::number(
m_d->trackparticle->parameterY(i));
541 pos+=QString::number(
m_d->trackparticle->parameterZ(i));
544 switch (
m_d->trackparticle->parameterPosition(i)){
546 TSOSitem->setText(1, QString(
"BeamLine" )+pos );
549 TSOSitem->setText(1, QString(
"FirstMeasurement")+pos );
552 TSOSitem->setText(1, QString(
"LastMeasurement" )+pos );
555 TSOSitem->setText(1, QString(
"CalorimeterEntrance")+pos );
558 TSOSitem->setText(1, QString(
"CalorimeterExit" )+pos );
561 TSOSitem->setText(1, QString(
"MuonSpectrometerEntrance")+pos );
564 TSOSitem->setText(1, QString(
"Undefined")+pos );
573 if (!
m_d->parametersAndPositions.isEmpty())
574 return m_d->parametersAndPositions;
576 typedef std::pair<xAOD::ParameterPosition, Amg::Vector3D> paramAndPos;
578#if defined BUILDVP1LIGHT
586 for (
unsigned int i=0; i<
m_d->trackparticle->numberOfParameters() ; ++i){
587 x =
m_d->trackparticle->parameterX(i);
588 y =
m_d->trackparticle->parameterY(i);
589 z =
m_d->trackparticle->parameterZ(i);
591 m_d->parametersAndPositions.append(paramAndPos(
m_d->trackparticle->parameterPosition(i),
Amg::Vector3D(
x,
y,
z)));
594 return m_d->parametersAndPositions;
598 str <<
"\"chi2\":"<<
m_d->trackparticle->chiSquared () <<
", ";
599 str <<
"\"dof\":" <<
m_d->trackparticle->numberDoF () <<
", ";
600 str <<
"\"dparams\": ["
601 <<
m_d->trackparticle->d0() <<
", "
602 <<
m_d->trackparticle->z0() <<
", "
603 <<
m_d->trackparticle->phi0() <<
", "
604 <<
m_d->trackparticle->theta() <<
", "
605 <<
m_d->trackparticle->qOverP()
608 for (
auto pos:
m_d->positionsToWrite){
614 str <<
"["<<pos.x()<<
","<<pos.y()<<
","<<pos.z()<<
"]";
Scalar phi() const
phi method
Scalar theta() const
theta method
const PlainObject unit() const
This is a plugin that makes Eigen look like CLHEP & defines some convenience methods.
const AODSysCommonData * common() const
const AODCollHandleBase * collHandle() const
QTreeWidgetItem * browserTreeItem() const
Return the QTreeWidgetItem;.
virtual void fillObjectBrowser(QList< QTreeWidgetItem * > &list)
Create and fill the object browser QTreeWidgetItem.
const Trk::IExtrapolationEngine * extrapolator() const
Base class for collections holding AOD objects of iParticle type Handles pt etc cuts Local data:
IParticleHandleBase(IParticleCollHandleBase *)
virtual QStringList baseInfo() const
IParticleHandle_TrackParticle * theclass
IParticleCollHandle_TrackParticle * collHandle
QList< Amg::Vector3D > positionsToWrite
QList< std::pair< xAOD::ParameterPosition, Amg::Vector3D > > parametersAndPositions
const xAOD::TrackParticle * trackparticle
virtual unsigned summaryValue(xAOD::SummaryType type) const
virtual Amg::Vector3D position() const
virtual ~IParticleHandle_TrackParticle()
virtual unsigned getNSCTHits() const
virtual void clear3DObjects()
Delete objects.
virtual double charge() const
Returns unknown() in case of trouble.
virtual void dumpToJSON(std::ofstream &) const
virtual bool has3DObjects()
Returns true if the 3D objects have been created.
virtual unsigned getNMuonPhiHoleLayers() const
QString shortInfo() const
This returns the information shown about the object in the object browser.
virtual SoNode * nodes()
Returns the 3Dobjects.
const QList< std::pair< xAOD::ParameterPosition, Amg::Vector3D > > & parametersAndPositions() const
virtual unsigned getNMuonPrecisionHoleLayers() const
void fillObjectBrowser(QList< QTreeWidgetItem * > &listOfItems)
Create and fill the object browser QTreeWidgetItem.
void fillLineFromSplineFit(const std::vector< Amg::Vector3D > &positions, const std::vector< Amg::Vector3D > &momenta)
Fill d->line with a SoLineSet made from a spline fit between the information in positions and momenta...
void addLine_FromTrackParticle()
Make the line, but only using information on the track (a spline fit will be done from the parameters...
virtual QString type() const
return very short word with type (maybe link with collection type?)
virtual unsigned getNPixelHits() const
virtual Amg::Vector3D momentum() const
virtual unsigned getNMuonPrecisionLayers() const
IParticleHandle_TrackParticle(IParticleCollHandleBase *, const xAOD::TrackParticle *)
void addParameterShapes()
void bezier(Amg::Vector3D &output, Amg::Vector3D &a, Amg::Vector3D &b, Amg::Vector3D &c, Amg::Vector3D &d, float t)
void linear(Amg::Vector3D &output, Amg::Vector3D &a, Amg::Vector3D &b, float t)
virtual QStringList clicked() const
Called when user selects the node (stringlist is displayed in messagebox).
void addLine_Extrapolated()
Extrapolate the initial track parameters to get the line (a spline fit is done between the extrapolat...
virtual unsigned getNMuonPhiLayers() const
const xAOD::IParticle & iParticle() const
virtual unsigned getNTRTHits() const
const Amg::Vector3D & momentum() const
Access method for the momentum.
const Amg::Vector3D & position() const
Access method for the position.
double charge() const
Returns the charge.
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.
float z0() const
Returns the parameter.
float theta() const
Returns the parameter, which has range 0 to .
float d0() const
Returns the parameter.
float qOverP() const
Returns the parameter.
float phi0() const
Returns the parameter, which has range to .
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
ParametersT< TrackParametersDim, Charged, PerigeeSurface > Perigee
CurvilinearParametersT< TrackParametersDim, Charged, PlaneSurface > CurvilinearParameters
ParametersBase< TrackParametersDim, Charged > TrackParameters
TrackParticle_v1 TrackParticle
Reference the current persistent version:
SummaryType
Enumerates the different types of information stored in Summary.
@ numberOfPrecisionLayers
layers with at least 3 hits [unit8_t].
@ numberOfPhiHoleLayers
layers with trigger phi holes but no hits [unit8_t].
@ numberOfTRTHits
number of TRT hits [unit8_t].
@ numberOfPhiLayers
layers with a trigger phi hit [unit8_t].
@ numberOfPrecisionHoleLayers
layers with holes AND no hits [unit8_t].
@ numberOfSCTHits
number of hits in SCT [unit8_t].
@ numberOfPixelHits
these are the pixel hits, including the b-layer [unit8_t].
@ 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.