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 "GeoModelKernel/Units.h"
35 #define SYSTEM_OF_UNITS GeoModelKernelUnits
39 #define SYSTEM_OF_UNITS Gaudi::Units
49 SoSeparator *
sep =
nullptr;
50 SoLineSet *
line =
nullptr;
70 if (
m_d->line)
m_d->line->unref();
71 if (
m_d->sep)
m_d->sep->unref();
76 return *(
m_d->electron);
95 m_d->positionsToWrite.clear();
96 m_d->parametersAndPositions.clear();
107 m_d->sep =
new SoSeparator();
111 bool fromTrack=
m_d->collHandle->collSettingsButton().useExistingParameters();
116 #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;
178 if (!trackparticle) {
179 VP1Msg::message(
"ERROR : no primary track particle associated with this Electron. Can't visualise it.");
183#if defined BUILDVP1LIGHT
211 m_d->sep->addChild(
m_d->collHandle->material());
214 m_d->sep->addChild(
m_d->line);
218 float x =
a.x() + (b.x()-
a.x())*t;
219 float y =
a.y() + (b.y()-
a.y())*t;
220 float z =
a.z() + (b.z()-
a.z())*t;
232 linear(output, abbc,bccd,t);
237 unsigned int npointsused(0);
239 m_d->line =
new SoLineSet();
243 SoVertexProperty * vertices =
new SoVertexProperty();
252 bool useExistingParams =
m_d->collHandle->collSettingsButton().useExistingParameters();
254 for (
unsigned int i=1; i<positions.size(); ++i){
257 if (useExistingParams){
258 float scale = ( (positions[i]-positions[i-1]).mag() )/3.0;
268 unsigned int maxCount=
m_d->collHandle->collSettingsButton().numOfStepsForInterpolation();
270 float t=
static_cast<float>(
count)/
static_cast<float>(maxCount);
272 bezier(pos, p0, p1, p2, p3, t);
276 vertices->vertex.set1Value(iver++,pos.x(),pos.y(),pos.z());
277 m_d->positionsToWrite.append(pos);
282 vertices->vertex.set1Value(iver++,positions[i].
x(),positions[i].
y(),positions[i].
z());
283 m_d->positionsToWrite.append(positions[i]);
293 m_d->line->numVertices.set1Value(0,npointsused);
294 m_d->line->vertexProperty = vertices;
302 const Trk::Perigee& peri =
m_d->electron->trackParticle()->perigeeParameters();
321 std::vector<Amg::Vector3D> positions;
322 std::vector<Amg::Vector3D> momenta;
344 positions.push_back(pos);
345 momenta.push_back(mom);
353 positions.push_back(pos);
354 momenta.push_back(mom);
362 m_d->sep->addChild(
m_d->collHandle->material());
366 m_d->sep->addChild(
m_d->line);
380#if defined BUILDVP1LIGHT
392 static constexpr double INVALID_P(10e9);
393 static constexpr double INVALID_QOP(10e-9);
413 const Trk::Perigee& p =
m_d->electron->trackParticle()->perigeeParameters();
419#if defined BUILDVP1LIGHT
438 const Trk::Perigee& p =
m_d->electron->trackParticle()->perigeeParameters();
448 return *(
m_d->electron);
454 return m_d->electron->charge();
461 if (
m_d->electron->trackParticle()->summaryValue(num,
type)){
519 TSOSitem->setText(0, QString(
"Def. Parameters " ) );
520 QString dParameters(
"(");
521 dParameters+=QString::number(
m_d->electron->trackParticle()->d0());
523 dParameters+=QString::number(
m_d->electron->trackParticle()->z0());
525 dParameters+=QString::number(
m_d->electron->trackParticle()->phi0());
527 dParameters+=QString::number(
m_d->electron->trackParticle()->theta());
529 dParameters+=QString::number(
m_d->electron->trackParticle()->qOverP());
531 TSOSitem->setText(1, dParameters );
533 for (
unsigned int i=0; i<
m_d->electron->trackParticle()->numberOfParameters() ; ++i){
535 TSOSitem->setText(0, QString(
"Parameter "+QString::number( i+1 ) ) );
536 QString pos(
", Position = (");
537 pos+=QString::number(
m_d->electron->trackParticle()->parameterX(i));
539 pos+=QString::number(
m_d->electron->trackParticle()->parameterY(i));
541 pos+=QString::number(
m_d->electron->trackParticle()->parameterZ(i));
544 switch (
m_d->electron->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
581 const Trk::Perigee& peri =
m_d->electron->trackParticle()->perigeeParameters ();
586 for (
unsigned int i=0; i<
m_d->electron->trackParticle()->numberOfParameters() ; ++i){
587 x =
m_d->electron->trackParticle()->parameterX(i);
588 y =
m_d->electron->trackParticle()->parameterY(i);
589 z =
m_d->electron->trackParticle()->parameterZ(i);
591 m_d->parametersAndPositions.append(paramAndPos(
m_d->electron->trackParticle()->parameterPosition(i),
Amg::Vector3D(
x,
y,
z)));
594 return m_d->parametersAndPositions;
598 str <<
"\"chi2\":"<<
m_d->electron->trackParticle()->chiSquared () <<
", ";
599 str <<
"\"dof\":" <<
m_d->electron->trackParticle()->numberDoF () <<
", ";
600 str <<
"\"dparams\": ["
601 <<
m_d->electron->trackParticle()->d0() <<
", "
602 <<
m_d->electron->trackParticle()->z0() <<
", "
603 <<
m_d->electron->trackParticle()->phi0() <<
", "
604 <<
m_d->electron->trackParticle()->theta() <<
", "
605 <<
m_d->electron->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
Scalar mag() const
mag 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_Electron * theclass
QList< Amg::Vector3D > positionsToWrite
const xAOD::Electron * electron
QList< std::pair< xAOD::ParameterPosition, Amg::Vector3D > > parametersAndPositions
IParticleCollHandle_Electron * collHandle
virtual unsigned getNSCTHits() const
virtual double charge() const
Returns unknown() in case of trouble.
virtual unsigned getNMuonPhiHoleLayers() const
virtual ~IParticleHandle_Electron()
virtual QString type() const
return very short word with type (maybe link with collection type?)
virtual unsigned getNPixelHits() const
void addParameterShapes()
const QList< std::pair< xAOD::ParameterPosition, Amg::Vector3D > > & parametersAndPositions() 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)
void linear(Amg::Vector3D &output, Amg::Vector3D &a, Amg::Vector3D &b, float t)
virtual unsigned getNMuonPrecisionHoleLayers() const
virtual void dumpToJSON(std::ofstream &) const
virtual unsigned summaryValue(xAOD::SummaryType type) const
virtual unsigned getNTRTHits() const
virtual unsigned getNMuonPrecisionLayers() const
void addLine_FromElectron()
Make the line, but only using information on the track (a spline fit will be done from the parameters...
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...
virtual void clear3DObjects()
Delete objects.
virtual unsigned getNMuonPhiLayers() const
IParticleHandle_Electron(IParticleCollHandleBase *, const xAOD::Electron *)
void addLine_Extrapolated()
Extrapolate the initial track parameters to get the line (a spline fit is done between the extrapolat...
virtual Amg::Vector3D momentum() const
void fillObjectBrowser(QList< QTreeWidgetItem * > &listOfItems)
Create and fill the object browser QTreeWidgetItem.
const xAOD::IParticle & iParticle() const
QString shortInfo() const
This returns the information shown about the object in the object browser.
const xAOD::Electron & electron() const
virtual Amg::Vector3D position() const
virtual SoNode * nodes()
Returns the 3Dobjects.
virtual bool has3DObjects()
Returns true if the 3D objects have been created.
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)
const xAOD::TrackParticle * trackParticle(size_t index=0) const
Pointer to the xAOD::TrackParticle/s that match the electron candidate.
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 .
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'.
float d0() const
Returns the parameter.
size_t numberOfParameters() const
Returns the number of additional parameters stored in the TrackParticle.
float qOverP() const
Returns the parameter.
float parameterY(unsigned int index) const
Returns the parameter y position, for 'index'.
float phi0() const
Returns the parameter, which has range to .
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
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].
Electron_v1 Electron
Definition of the current "egamma 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.