ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
VP1VertexCollection::Imp::VertexHandle Class Reference
Collaboration diagram for VP1VertexCollection::Imp::VertexHandle:

Public Member Functions

 VertexHandle (const Trk::VxCandidate *v, VP1VertexCollection *collHandle)
 
 ~VertexHandle ()
 
VP1VertexCollectioncollHandle ()
 
void updateShapes (VertexSysController *controller)
 
SoMaterial * determineMaterial ()
 
void ensureAttached (SoSeparator *collSep, VertexSysController *controller)
 
void ensureDetached (SoSeparator *collSep)
 
const Trk::VxCandidatevertex () const
 
SoSeparator * sep () const
 
bool attached () const
 
VertexCommonFlags::ReconVertexTypeFlag type ()
 
void rerandomiseRandomMaterial ()
 

Private Member Functions

void actualBuildShape (VertexSysController *controller)
 

Private Attributes

VP1VertexCollectionm_collHandle
 
bool m_attached
 
const Trk::VxCandidatem_vertex
 
SoSeparator * m_sep
 
SoMaterial * m_randommaterial
 

Detailed Description

Definition at line 75 of file VP1VertexCollection.cxx.

Constructor & Destructor Documentation

◆ VertexHandle()

VP1VertexCollection::Imp::VertexHandle::VertexHandle ( const Trk::VxCandidate v,
VP1VertexCollection collHandle 
)
inline

Definition at line 77 of file VP1VertexCollection.cxx.

◆ ~VertexHandle()

VP1VertexCollection::Imp::VertexHandle::~VertexHandle ( )
inline

Definition at line 78 of file VP1VertexCollection.cxx.

78 { if (m_sep) m_sep->unref(); }

Member Function Documentation

◆ actualBuildShape()

void VP1VertexCollection::Imp::VertexHandle::actualBuildShape ( VertexSysController controller)
inlineprivate

Definition at line 198 of file VP1VertexCollection.cxx.

198  {
201  if (r==0) {
202  SoPointSet * points = new SoPointSet;
203  SoVertexProperty * vertices = new SoVertexProperty;
204  vertices->vertex.set1Value(0,pos.x(), pos.y(), pos.z());
205  points->numPoints=1;
206  points->vertexProperty.setValue(vertices);
207  m_sep->addChild(points);
208  return;
209  }
210 
211  SoTranslation * translation = new SoTranslation;
212  translation->translation.setValue ( pos.x(), pos.y(), pos.z() );
213  m_sep->addChild ( translation );
214 
215  if (r>0) {
216  //Transform sphere into an ellipsoid using the error matrix:
217 // const Trk::CovarianceMatrix& errMat = m_vertex->recVertex().errorPosition().covariance();
218  const AmgSymMatrix(3)& errMat = m_vertex->recVertex().covariancePosition(); // see https://svnweb.cern.ch/trac/atlasoff/browser/Tracking/TrkEvent/VxVertex/trunk/VxVertex/RecVertex.h
219 
220  //FIXME: std::min hack for now!!
221  double a(errMat(0,0)), b(errMat(0,1)), c(errMat(0,2)),
222  d(errMat(1,1)), e(errMat(1,2)),
223  f(errMat(2,2));
224  double det = a*(d*f-e*e) + 2*b*c*e - d*c*c-f*b*b;
225  if (det>0) {
226  double sixthrootofdet = exp(log(det)/6.0);
227  double invdet = 1.0/sixthrootofdet;
228  a *= invdet;
229  b *= invdet;
230  c *= invdet;
231  d *= invdet;
232  e *= invdet;
233  f *= invdet;
234  SbMatrix sbMat(a,b,c,0,
235  b,d,e,0,
236  c,e,f,0,
237  0,0,0,1);
238  SoMatrixTransform * matTrans = new SoMatrixTransform();
239  matTrans->matrix.setValue(sbMat);
240  m_sep->addChild (matTrans);
241  } else {
242  //fixme: warn
243  }
244  }
245 
246  SoSphere * sphere = new SoSphere;
247  sphere->radius = fabs(r);
248  m_sep->addChild ( sphere );
249  }

◆ attached()

bool VP1VertexCollection::Imp::VertexHandle::attached ( ) const
inline

Definition at line 134 of file VP1VertexCollection.cxx.

134 { return m_attached; }

◆ collHandle()

VP1VertexCollection* VP1VertexCollection::Imp::VertexHandle::collHandle ( )
inline

Definition at line 80 of file VP1VertexCollection.cxx.

80 {return m_collHandle;}

◆ determineMaterial()

SoMaterial* VP1VertexCollection::Imp::VertexHandle::determineMaterial ( )
inline

Definition at line 100 of file VP1VertexCollection.cxx.

100  {
101  switch(collHandle()->colourBy()) {
103  {
104  if (!m_randommaterial) {
105  m_randommaterial = new SoMaterial;
106  m_randommaterial->ref();
108  }
109  return m_randommaterial;
110  }
112  default:
113  return collHandle()->material();
114  }
115  }

◆ ensureAttached()

void VP1VertexCollection::Imp::VertexHandle::ensureAttached ( SoSeparator *  collSep,
VertexSysController controller 
)
inline

Definition at line 117 of file VP1VertexCollection.cxx.

117  {
118  if (m_attached)
119  return;
120  m_attached = true;
122  collSep->addChild(m_sep);
123  }

◆ ensureDetached()

void VP1VertexCollection::Imp::VertexHandle::ensureDetached ( SoSeparator *  collSep)
inline

Definition at line 124 of file VP1VertexCollection.cxx.

124  {
125  if (!m_attached)
126  return;
127  m_attached = false;
128  if (m_sep)
129  collSep->removeChild(m_sep);
130  }

◆ rerandomiseRandomMaterial()

void VP1VertexCollection::Imp::VertexHandle::rerandomiseRandomMaterial ( )
inline

Definition at line 150 of file VP1VertexCollection.cxx.

150  {
151  // std::cout<<"rerandomiseRandomMaterial"<<std::endl;
152  if ( !m_randommaterial )//We will anyway rerandomize it when we need it
153  return;
154 
155  double r2 = 0.3*0.3;
156  unsigned i(0);
157  double r,g,b;
158  bool ok;
159  while (true) {
160  r = (rand() / static_cast<double>(RAND_MAX));
161  g = (rand() / static_cast<double>(RAND_MAX));
162  b = (rand() / static_cast<double>(RAND_MAX));
163  ok = true;
164  //For now we make sure that we avoid black and red. This should be updated from bgd and highlight col automatically! (fixme).
165  // -> and we should probably also make sure that tracks close in (eta,phi) are well separated in colour-space.
166  if ( (r-1.0)*(r-1.0)+g*g+b*b < r2*0.5 )//avoid red (distance)
167  ok = false;
168  else if ( r*r/(r*r+g*g+b*b) > 0.8 )//avoid red (angle)
169  ok = false;
170  else if ( r*r+g*g+b*b < r2*2.0 )//avoid black
171  ok = false;
172  if (ok)
173  break;
174  ++i;
175  if (i>50 ) {
176  r2 *= 0.99;//To avoid problem in case we add too many forbidden spheres.
177  if (i>1000) {
178  //Just a safety
179  collHandle()->systemBase()->message("TrackHandleBase::rerandomiseRandomMaterial Warning: Random colour could"
180  " not be selected such as to satisfy all separation criteria");
181  break;
182  }
183  }
184  }
185  // std::cout<<"rerandomiseRandomMaterial - setting to"<<r<<","<<g<<","<<b<<std::endl;
186 
188  0.15, /*brightness*/
189  0.0 /*transparency*/);
190  }

◆ sep()

SoSeparator* VP1VertexCollection::Imp::VertexHandle::sep ( ) const
inline

Definition at line 133 of file VP1VertexCollection.cxx.

133 { return m_sep; }

◆ type()

VertexCommonFlags::ReconVertexTypeFlag VP1VertexCollection::Imp::VertexHandle::type ( )
inline

Definition at line 135 of file VP1VertexCollection.cxx.

135  {
136  switch(m_vertex->vertexType()) {
142  case Trk::V0Lambda:
143  case Trk::V0LambdaBar:
144  case Trk::V0KShort:
146  default:
148  }
149  }

◆ updateShapes()

void VP1VertexCollection::Imp::VertexHandle::updateShapes ( VertexSysController controller)
inline

Definition at line 82 of file VP1VertexCollection.cxx.

82  {
83  if (!m_attached) {
84  if (m_sep)
85  m_sep->removeAllChildren();
86  return;
87  }
88  if (!m_sep) {
89  m_sep = new SoSeparator;
90  m_sep->ref();
91  }
92  if (m_sep->getNumChildren()>0)
93  m_sep->removeAllChildren();
94  SoMaterial* mat = determineMaterial();
95  // std::cout<<"This: "<<this<<" Got material at:"<<mat<<", m_randommaterial="<<m_randommaterial<<std::endl;
96  m_sep->addChild ( mat );
98  }

◆ vertex()

const Trk::VxCandidate* VP1VertexCollection::Imp::VertexHandle::vertex ( ) const
inline

Definition at line 132 of file VP1VertexCollection.cxx.

132 { return m_vertex; }

Member Data Documentation

◆ m_attached

bool VP1VertexCollection::Imp::VertexHandle::m_attached
private

Definition at line 194 of file VP1VertexCollection.cxx.

◆ m_collHandle

VP1VertexCollection* VP1VertexCollection::Imp::VertexHandle::m_collHandle
private

Definition at line 193 of file VP1VertexCollection.cxx.

◆ m_randommaterial

SoMaterial* VP1VertexCollection::Imp::VertexHandle::m_randommaterial
private

Definition at line 197 of file VP1VertexCollection.cxx.

◆ m_sep

SoSeparator* VP1VertexCollection::Imp::VertexHandle::m_sep
private

Definition at line 196 of file VP1VertexCollection.cxx.

◆ m_vertex

const Trk::VxCandidate* VP1VertexCollection::Imp::VertexHandle::m_vertex
private

Definition at line 195 of file VP1VertexCollection.cxx.


The documentation for this class was generated from the following file:
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
beamspotman.r
def r
Definition: beamspotman.py:676
VP1VertexCollection::Imp::VertexHandle::determineMaterial
SoMaterial * determineMaterial()
Definition: VP1VertexCollection.cxx:100
Trk::VxCandidate::recVertex
const Trk::RecVertex & recVertex(void) const
Returns a reference to reconstructed vertex.
Definition: VxCandidate.h:132
VP1StdCollection::material
SoMaterial * material() const
Definition: VP1StdCollection.cxx:220
VertexCommonFlags::RVT_Primary
@ RVT_Primary
Definition: VertexCommonFlags.h:26
TRTCalib_Extractor.det
det
Definition: TRTCalib_Extractor.py:36
hist_file_dump.d
d
Definition: hist_file_dump.py:137
mat
GeoMaterial * mat
Definition: LArDetectorConstructionTBEC.cxx:55
Trk::KinkVtx
@ KinkVtx
Kink Vertex.
Definition: VertexType.h:32
VertexCommonFlags::RVT_Kink
@ RVT_Kink
Definition: VertexCommonFlags.h:30
Trk::VxCandidate::vertexType
VertexType vertexType() const
return the type of the vertex
Definition: VxCandidate.h:120
VP1VertexCollection::Imp::VertexHandle::updateShapes
void updateShapes(VertexSysController *controller)
Definition: VP1VertexCollection.cxx:82
MCP::ScaleSmearParam::r2
@ r2
drawFromPickle.exp
exp
Definition: drawFromPickle.py:36
VP1VertexCollection::Imp::VertexHandle::m_collHandle
VP1VertexCollection * m_collHandle
Definition: VP1VertexCollection.cxx:193
AmgSymMatrix
#define AmgSymMatrix(dim)
Definition: EventPrimitives.h:50
VertexCommonFlags::RVT_Other
@ RVT_Other
Definition: VertexCommonFlags.h:32
VertexCommonFlags::RVT_Secondary
@ RVT_Secondary
Definition: VertexCommonFlags.h:27
LArG4FSStartPointFilter.rand
rand
Definition: LArG4FSStartPointFilter.py:80
VP1VertexCollection::Imp::VertexHandle::m_randommaterial
SoMaterial * m_randommaterial
Definition: VP1VertexCollection.cxx:197
VertexCommonFlags::RVT_V0
@ RVT_V0
Definition: VertexCommonFlags.h:28
VP1VertexCollection::Imp::controller
VertexSysController * controller
Definition: VP1VertexCollection.cxx:67
lumiFormat.i
int i
Definition: lumiFormat.py:85
Trk::V0LambdaBar
@ V0LambdaBar
Temporary addition for V0 LambdaBar.
Definition: VertexType.h:34
VP1MaterialButton::setMaterialParameters
static void setMaterialParameters(SoMaterial *m, const QColor &, const double &brightness=0.0, const double &transp=0.0)
Definition: VP1MaterialButton.cxx:802
python.CaloCondTools.g
g
Definition: CaloCondTools.py:15
VP1VertexCollection::Imp::vertices
QList< VertexHandle * > vertices
Definition: VP1VertexCollection.cxx:262
hist_file_dump.f
f
Definition: hist_file_dump.py:135
VP1VertexCollection::Imp::VertexHandle::m_sep
SoSeparator * m_sep
Definition: VP1VertexCollection.cxx:196
Trk::Vertex::position
const Amg::Vector3D & position() const
return position of vertex
Definition: Vertex.cxx:72
Trk::V0KShort
@ V0KShort
Temporary addition for KShort.
Definition: VertexType.h:35
VertexCommonFlags::RVT_Conversion
@ RVT_Conversion
Definition: VertexCommonFlags.h:29
VP1VertexCollection::COLOUR_PERCOLLECTION
@ COLOUR_PERCOLLECTION
Definition: VP1VertexCollection.h:48
VP1HelperClassBase::systemBase
IVP1System * systemBase() const
Definition: VP1HelperClassBase.h:50
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
Trk::V0Vtx
@ V0Vtx
Vertex from V0 Decay.
Definition: VertexType.h:31
VP1VertexCollection::Imp::VertexHandle::rerandomiseRandomMaterial
void rerandomiseRandomMaterial()
Definition: VP1VertexCollection.cxx:150
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
Trk::SecVtx
@ SecVtx
Secondary Vertex.
Definition: VertexType.h:28
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
VP1VertexCollection::colourBy
COLOURBY colourBy() const
Definition: VP1VertexCollection.h:49
python.PyAthena.v
v
Definition: PyAthena.py:154
VP1VertexCollection::Imp::VertexHandle::m_attached
bool m_attached
Definition: VP1VertexCollection.cxx:194
a
TList * a
Definition: liststreamerinfos.cxx:10
VP1VertexCollection::Imp::VertexHandle::actualBuildShape
void actualBuildShape(VertexSysController *controller)
Definition: VP1VertexCollection.cxx:198
VP1StdCollection::collSep
SoSeparator * collSep() const
All 3D objects from this coll.
Definition: VP1StdCollection.cxx:212
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
VP1VertexCollection::COLOUR_RANDOM
@ COLOUR_RANDOM
Definition: VP1VertexCollection.h:48
VertexSysController::reconVertexRepresentation
double reconVertexRepresentation() const
Definition: VertexSysController.cxx:308
VP1VertexCollection::Imp::VertexHandle::collHandle
VP1VertexCollection * collHandle()
Definition: VP1VertexCollection.cxx:80
Trk::PriVtx
@ PriVtx
Primary Vertex.
Definition: VertexType.h:27
Trk::ConvVtx
@ ConvVtx
Converstion Vertex.
Definition: VertexType.h:30
VertexCommonFlags::RVT_Pileup
@ RVT_Pileup
Definition: VertexCommonFlags.h:31
python.compressB64.c
def c
Definition: compressB64.py:93
IVP1System::message
void message(const QString &) const
Definition: IVP1System.cxx:336
jobOptions.points
points
Definition: jobOptions.GenevaPy8_Zmumu.py:97
VP1VertexCollection::Imp::VertexHandle::m_vertex
const Trk::VxCandidate * m_vertex
Definition: VP1VertexCollection.cxx:195
Trk::PileUp
@ PileUp
Pile Up Vertex.
Definition: VertexType.h:29
Trk::V0Lambda
@ V0Lambda
Temporary addition for V0 Lambda.
Definition: VertexType.h:33