ATLAS Offline Software
SoGenericBox.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 
7 // //
8 // Header file for class SoGenericBox //
9 // //
10 // Description: Generic way to draw boxes with arbitrary //
11 // corners and possibly lines at the edges. //
12 // //
13 // Author: Thomas H. Kittelmann (Thomas.Kittelmann@cern.ch) //
14 // Initial version: December 2008 //
15 // //
17 
18 #ifndef SOGENERICBOX_H
19 #define SOGENERICBOX_H
20 
21 #include <Inventor/C/errors/debugerror.h>
22 #include <Inventor/fields/SoSFNode.h>
23 #include <Inventor/fields/SoSFBool.h>
24 #include <Inventor/nodes/SoShape.h>
25 
26 class SoGenericBox : public SoShape {
27 
29 
30 public:
31 
32  //Fields:
33  SoSFBool drawEdgeLines;//Default: False
34  SoSFBool forceEdgeLinesInBaseColour;//Default: True
35  SoSFNode alternateRep;
36 
37  //NB: For performance reason we deviate from the standard Inventor
38  //way here. We keep the points in an array, and the user must use
39  //one of the following setXXX(..) methods to ensure that they get
40  //sensible values (the fDrawEdgeLines field will be touched inside
41  //these methods, to ensure a proper cache-invalidation).
42 
43  // -> Axis-aligned box
44  void setParametersForBox( float dx, float dy, float dz,
45  float xcenter = 0.0, float ycenter = 0.0, float zcenter = 0.0 );//NB: These are half-lengths.
46 
47  // -> Barrel cell (i.e. fix inner face at cylinder around Z-axis, with r=cellDistance):
48  void setParametersForBarrelEtaPhiCell( double etaMin, double etaMax,
49  double phiMin, double phiMax,
50  double cellDepth, double cellDistance,
51  double etasqueezefact = 1.0,
52  double phisqueezefact = 1.0 );
53 
54  // -> EndCap cell (i.e. fix inner face at plane at |Z|=|cellDistance|):
55  void setParametersForEndCapEtaPhiCell( double etaMin, double etaMax,
56  double phiMin, double phiMax,
57  double cellDepth, double cellDistance,
58  double etasqueezefact = 1.0,
59  double phisqueezefact = 1.0 );
60 
61  // -> Trd
62  void setParametersForTrd( float dx1, float dx2,
63  float dy1, float dy2,
64  float dz );
65 
66  // -> Trapezoid
67  void setParametersForTrapezoid( float dz, float theta, float phi, float dy1,
68  float dx1, float dx2, float dy2, float dx3,
69  float dx4, float alp1, float alp2 );
70 
71  // -> Generic [NB: The 4 points around each face should lie in a common plane!!]
72  void setGenericParameters( float x0, float y0, float z0,
73  float x1, float y1, float z1,
74  float x2, float y2, float z2,
75  float x3, float y3, float z3,
76  float x4, float y4, float z4,
77  float x5, float y5, float z5,
78  float x6, float y6, float z6,
79  float x7, float y7, float z7 );
80 
81  //Todo: We could even add a transformation for the TRD (or anything
82  //else... perhaps an "applyTransform" method to call after the first
83  //setParameters...?)
84  //(i.e. specify in absolute coordinates, and thus avoid a
85  //transformation in the scenegraph!)
86 
87  //Required stuff:
88  SoGenericBox();
89  static void initClass();//You can call this as many times as you like
90  virtual void generateAlternateRep();
91  virtual void clearAlternateRep();
92 
93 protected:
94 
95  virtual void computeBBox(SoAction *action, SbBox3f &box, SbVec3f &center );
96  virtual void generatePrimitives(SoAction *action);
97  virtual ~SoGenericBox();
98 
99 private:
100 
101  void internalSetParametersForEtaPhiCell( bool barrel, double etaMin, double etaMax,
102  double phiMin, double phiMax,
103  double cellDepth, double cellDistance,
104  double etasqueezefact, double phisqueezefact );
105 
106  void ensurePointsAllocated();
107  void pointsUpdated();
108  void setupDefaultPoints();
109 
110  float * m_points;
111  float * m_normals;
112  SbBox3f m_bbox;
113  SbVec3f m_center;
114 };
115 
116 #endif
SoGenericBox::m_bbox
SbBox3f m_bbox
Definition: SoGenericBox.h:112
SoGenericBox::setParametersForTrapezoid
void setParametersForTrapezoid(float dz, float theta, float phi, float dy1, float dx1, float dx2, float dy2, float dx3, float dx4, float alp1, float alp2)
Definition: SoGenericBox.cxx:293
plotBeamSpotCompare.x1
x1
Definition: plotBeamSpotCompare.py:216
SoGenericBox::ensurePointsAllocated
void ensurePointsAllocated()
Definition: SoGenericBox.cxx:158
SoGenericBox::SO_NODE_HEADER
SO_NODE_HEADER(SoGenericBox)
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
SoGenericBox::m_normals
float * m_normals
Definition: SoGenericBox.h:111
SoGenericBox::computeBBox
virtual void computeBBox(SoAction *action, SbBox3f &box, SbVec3f &center)
Definition: SoGenericBox.cxx:171
plotBeamSpotCompare.x2
x2
Definition: plotBeamSpotCompare.py:218
theta
Scalar theta() const
theta method
Definition: AmgMatrixBasePlugin.h:75
SoGenericBox::setParametersForEndCapEtaPhiCell
void setParametersForEndCapEtaPhiCell(double etaMin, double etaMax, double phiMin, double phiMax, double cellDepth, double cellDistance, double etasqueezefact=1.0, double phisqueezefact=1.0)
Definition: SoGenericBox.cxx:266
SoGenericBox::setParametersForBarrelEtaPhiCell
void setParametersForBarrelEtaPhiCell(double etaMin, double etaMax, double phiMin, double phiMax, double cellDepth, double cellDistance, double etasqueezefact=1.0, double phisqueezefact=1.0)
Definition: SoGenericBox.cxx:256
xAOD::etaMax
etaMax
Definition: HIEventShape_v2.cxx:46
makeTRTBarrelCans.y1
tuple y1
Definition: makeTRTBarrelCans.py:15
SoGenericBox::initClass
static void initClass()
Definition: SoGenericBox.cxx:62
SoGenericBox::internalSetParametersForEtaPhiCell
void internalSetParametersForEtaPhiCell(bool barrel, double etaMin, double etaMax, double phiMin, double phiMax, double cellDepth, double cellDistance, double etasqueezefact, double phisqueezefact)
Definition: SoGenericBox.cxx:194
makeTRTBarrelCans.y2
tuple y2
Definition: makeTRTBarrelCans.py:18
SoGenericBox::~SoGenericBox
virtual ~SoGenericBox()
Definition: SoGenericBox.cxx:82
SoGenericBox::setupDefaultPoints
void setupDefaultPoints()
Definition: SoGenericBox.cxx:165
TRT::Track::z0
@ z0
Definition: InnerDetector/InDetCalibEvent/TRT_CalibData/TRT_CalibData/TrackInfo.h:63
SoGenericBox::setParametersForBox
void setParametersForBox(float dx, float dy, float dz, float xcenter=0.0, float ycenter=0.0, float zcenter=0.0)
Definition: SoGenericBox.cxx:179
SoGenericBox::generatePrimitives
virtual void generatePrimitives(SoAction *action)
Definition: SoGenericBox.cxx:89
SoGenericBox::setGenericParameters
void setGenericParameters(float x0, float y0, float z0, float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3, float x4, float y4, float z4, float x5, float y5, float z5, float x6, float y6, float z6, float x7, float y7, float z7)
Definition: SoGenericBox.cxx:353
SoGenericBox::clearAlternateRep
virtual void clearAlternateRep()
Definition: SoGenericBox.cxx:464
SoGenericBox::alternateRep
SoSFNode alternateRep
Definition: SoGenericBox.h:35
SoGenericBox::drawEdgeLines
SoSFBool drawEdgeLines
Definition: SoGenericBox.h:33
makeTRTBarrelCans.dy
tuple dy
Definition: makeTRTBarrelCans.py:21
SoGenericBox::generateAlternateRep
virtual void generateAlternateRep()
Definition: SoGenericBox.cxx:429
LArCellBinning.etaMin
etaMin
Definition: LArCellBinning.py:84
python.CaloScaleNoiseConfig.action
action
Definition: CaloScaleNoiseConfig.py:77
SoGenericBox::forceEdgeLinesInBaseColour
SoSFBool forceEdgeLinesInBaseColour
Definition: SoGenericBox.h:34
makeTRTBarrelCans.dx
tuple dx
Definition: makeTRTBarrelCans.py:20
SoGenericBox
Definition: SoGenericBox.h:26
DetectorZone::barrel
@ barrel
SoGenericBox::SoGenericBox
SoGenericBox()
Definition: SoGenericBox.cxx:71
SoGenericBox::m_points
float * m_points
Definition: SoGenericBox.h:110
SoGenericBox::m_center
SbVec3f m_center
Definition: SoGenericBox.h:113
SoGenericBox::pointsUpdated
void pointsUpdated()
Definition: SoGenericBox.cxx:375
SoGenericBox::setParametersForTrd
void setParametersForTrd(float dx1, float dx2, float dy1, float dy2, float dz)
Definition: SoGenericBox.cxx:276