CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Protected Attributes | Private Member Functions
TEveEllipsoidProjectedGL Class Reference

#include <TEveEllipsoidGL.h>

Inheritance diagram for TEveEllipsoidProjectedGL:
TEveEllipsoidGL

Public Member Functions

 ClassDefOverride (TEveEllipsoidProjectedGL, 0)
 
void DirectDraw (TGLRnrCtx &rnrCtx) const override
 
void SetBBox () override
 
Bool_t SetModel (TObject *obj, const Option_t *opt=nullptr) override
 
 TEveEllipsoidProjectedGL ()
 
 ~TEveEllipsoidProjectedGL () override
 
- Public Member Functions inherited from TEveEllipsoidGL
 ClassDefOverride (TEveEllipsoidGL, 0)
 
void DirectDraw (TGLRnrCtx &rnrCtx) const override
 
Bool_t IgnoreSizeForOfInterest () const override
 
void SetBBox () override
 
Bool_t SetModel (TObject *obj, const Option_t *opt=nullptr) override
 
 TEveEllipsoidGL ()
 
 ~TEveEllipsoidGL () override
 

Protected Attributes

TEveEllipsoidProjectedfM
 
- Protected Attributes inherited from TEveEllipsoidGL
TEveEllipsoidfE
 

Private Member Functions

void drawArch (float pStart, float pEnd, float phiStep, TEveVector &v0, TEveVector &v1, TEveVector &v2) const
 
void DrawRhoPhi () const
 
void DrawRhoZ () const
 
void drawRhoZAxis (TEveVector &v, TEveVector &) const
 
TEveEllipsoidProjectedGLoperator= (const TEveEllipsoidProjectedGL &)
 
 TEveEllipsoidProjectedGL (const TEveEllipsoidProjectedGL &)
 

Detailed Description

Definition at line 42 of file TEveEllipsoidGL.h.

Constructor & Destructor Documentation

TEveEllipsoidProjectedGL::TEveEllipsoidProjectedGL ( const TEveEllipsoidProjectedGL )
private
TEveEllipsoidProjectedGL::TEveEllipsoidProjectedGL ( )

Definition at line 104 of file TEveEllipsoidGL.cc.

104  : fM(nullptr) {
105  // Constructor.
106 
107  // fDLCache = kFALSE; // Disable display list.
108  fMultiColor = kTRUE;
109 }
TEveEllipsoidProjected * fM
TEveEllipsoidProjectedGL::~TEveEllipsoidProjectedGL ( )
inlineoverride

Definition at line 58 of file TEveEllipsoidGL.h.

58 {}

Member Function Documentation

TEveEllipsoidProjectedGL::ClassDefOverride ( TEveEllipsoidProjectedGL  ,
 
)
void TEveEllipsoidProjectedGL::DirectDraw ( TGLRnrCtx &  rnrCtx) const
override

Definition at line 128 of file TEveEllipsoidGL.cc.

References DrawRhoPhi(), DrawRhoZ(), and fM.

128  {
129  // Render with OpenGL.
130 
131  TEveProjection* proj = fM->GetManager()->GetProjection();
132 
133  glPushAttrib(GL_ENABLE_BIT | GL_POLYGON_BIT | GL_LINE_BIT | GL_POINT_BIT);
134  glDisable(GL_LIGHTING);
135  glDisable(GL_CULL_FACE);
136 
137  glPushMatrix();
138  if (proj->GetType() == TEveProjection::kPT_RPhi)
139  DrawRhoPhi();
140  else
141  DrawRhoZ();
142 
143  glPopMatrix();
144  glPopAttrib();
145 }
TEveEllipsoidProjected * fM
void TEveEllipsoidProjectedGL::drawArch ( float  pStart,
float  pEnd,
float  phiStep,
TEveVector &  v0,
TEveVector &  v1,
TEveVector &  v2 
) const
private

Definition at line 148 of file TEveEllipsoidGL.cc.

References funct::cos(), fM, phi, funct::sin(), and findQualityFiles::v.

Referenced by DrawRhoPhi(), and DrawRhoZ().

149  {
150  TEveProjection* proj = fM->GetManager()->GetProjection();
151  float phi = phiStart;
152  while (phi < phiEnd) {
153  TEveVector v = v0 + v1 * ((float)cos(phi)) + v2 * ((float)sin(phi));
154  proj->ProjectVector(v, fM->fDepth);
155  glVertex3fv(v.Arr());
156 
157  phi += phiStep;
158  }
159  TEveVector v = v0 + v1 * ((float)cos(phiEnd)) + v2 * ((float)sin(phiEnd));
160  proj->ProjectVector(v, fM->fDepth);
161  glVertex3fv(v.Arr());
162 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
TEveEllipsoidProjected * fM
void TEveEllipsoidProjectedGL::DrawRhoPhi ( ) const
private

Definition at line 165 of file TEveEllipsoidGL.cc.

References Abs(), drawArch(), TEveEllipsoidGL::fE, TEveEllipsoid::fEScale, fM, mps_fire::i, dqmiolumiharvest::j, fireworks::p1, fireworks::p2, TEveEllipsoid::RefEMtx(), TEveEllipsoid::RefPos(), mathSSE::sqrt(), and TwoPi.

Referenced by DirectDraw().

165  {
166  // printf("TEveEllipsoidProjectedGL::DirectDraw [%s ]\n", fE->GetName() );
167 
168  TMatrixDSym xxx(3);
169  for (int i = 0; i < 2; i++)
170  for (int j = 0; j < 2; j++) {
171  xxx(i, j) = fE->RefEMtx()(i + 1, j + 1);
172  }
173 
174  TMatrixDEigen eig(xxx);
175  TVectorD xxxEig(eig.GetEigenValuesRe());
176 
177  // Projection supports only floats :(
178  TEveVector v0(fE->RefPos()[0], fE->RefPos()[1], 0);
179  TEveVector v1(eig.GetEigenVectors()(0, 0), eig.GetEigenVectors()(0, 1), 0);
180  v1 *= fE->fEScale * sqrt(TMath::Abs(xxxEig[0]));
181  TEveVector v2(eig.GetEigenVectors()(1, 0), eig.GetEigenVectors()(1, 1), 0);
182  v2 *= fE->fEScale * sqrt(TMath::Abs(xxxEig[1]));
183 
184  TEveProjection* proj = fM->GetManager()->GetProjection();
185 
186  // fill
187  glBegin(GL_POLYGON);
188  drawArch(0, TMath::TwoPi(), TMath::TwoPi() / 20, v0, v1, v2);
189  glEnd();
190 
191  // frame
192  TGLUtil::LineWidth(fE->fLineWidth);
193  TGLUtil::Color(fE->fLineColor);
194 
195  glBegin(GL_LINE_LOOP);
196  drawArch(0, TMath::TwoPi(), TMath::TwoPi() / 20, v0, v1, v2);
197  glEnd();
198 
199  glBegin(GL_LINES);
200  {
201  // glColor3f(1, 0, 0);
202  TEveVector p1 = v0 - v1;
203  TEveVector p2 = v0 + v1;
204  proj->ProjectVector(p1, fM->fDepth);
205  proj->ProjectVector(p2, fM->fDepth);
206  glVertex3fv(p1.Arr());
207  glVertex3fv(p2.Arr());
208  }
209  {
210  // glColor3f(0, 1, 0);
211  TEveVector p1 = v0 - v2;
212  TEveVector p2 = v0 + v2;
213  proj->ProjectVector(p1, fM->fDepth);
214  proj->ProjectVector(p2, fM->fDepth);
215  glVertex3fv(p1.Arr());
216  glVertex3fv(p2.Arr());
217  }
218  glEnd();
219 }
const double TwoPi
TEveVector & RefPos()
Definition: TEveEllipsoid.h:36
void drawArch(float pStart, float pEnd, float phiStep, TEveVector &v0, TEveVector &v1, TEveVector &v2) const
const TString p2
Definition: fwPaths.cc:13
TEveEllipsoid * fE
T sqrt(T t)
Definition: SSEVec.h:19
TEveTrans & RefEMtx()
Definition: TEveEllipsoid.h:38
T Abs(T a)
Definition: MathUtil.h:49
const TString p1
Definition: fwPaths.cc:12
TEveEllipsoidProjected * fM
void TEveEllipsoidProjectedGL::DrawRhoZ ( ) const
private

Definition at line 222 of file TEveEllipsoidGL.cc.

References Abs(), cms::cuda::bs, funct::cos(), plotBeamSpotDB::da, EcalCondDB::db, drawArch(), drawRhoZAxis(), alignCSCRings::e, TEveEllipsoidGL::fE, TEveEllipsoid::fEScale, fM, mps_fire::i, dqmiolumiharvest::j, Max(), Min(), N, L1TMuonDQMOffline_cfi::phiMax, L1TMuonDQMOffline_cfi::phiMin, TEveEllipsoid::RefEMtx(), TEveEllipsoid::RefPos(), funct::sin(), mathSSE::sqrt(), and TwoPi.

Referenced by DirectDraw().

222  {
223  // printf("TEveEllipsoidProjectedGL::DirectDraw [%s ]\n", fE->GetTitle() );
224 
225  TEveVector v0(fE->RefPos()[0], fE->RefPos()[1], fE->RefPos()[2]);
226 
227  TMatrixDSym xxx(3);
228  xxx(0, 0) = 1;
229  for (int i = 1; i < 3; i++)
230  for (int j = 1; j < 3; j++) {
231  xxx(i, j) = fE->RefEMtx()(i + 1, j + 1);
232  }
233  TMatrixDEigen eig(xxx);
234  TVectorD xxxEig(eig.GetEigenValuesRe());
235 
236  TEveVector v1(0, eig.GetEigenVectors()(1, 2), eig.GetEigenVectors()(2, 2));
237  v1 *= fE->fEScale * sqrt(TMath::Abs(xxxEig[2]));
238 
239  TEveVector v2(0, eig.GetEigenVectors()(1, 1), eig.GetEigenVectors()(2, 1));
240  v2 *= fE->fEScale * sqrt(TMath::Abs(xxxEig[1]));
241  if (v1[1] * v2[2] > v1[2] * v2[1])
242  v2 *= -1;
243 
244  TEveProjection* proj = fM->GetManager()->GetProjection();
245 
246  // ellipse intersection with projection center
247  bool splitted = false;
248  int N = 20;
249  double phiStep = TMath::TwoPi() / N;
250 
251  // projection center can be moved in beam-spot
252  float bs = 0;
253  if (proj->GetDisplaceOrigin())
254  bs = proj->RefCenter()[1];
255 
256  float da = v2[1] * v2[1] + v1[1] * v1[1];
257  float db = 2 * v1[1] * (v0[1] - bs);
258  float dc = (v0[1] - bs) * (v0[1] - bs) - v2[1] * v2[1];
259  float disc = (db * db - 4 * da * dc);
260 
261  if (disc > 0) {
262  disc = sqrt(disc);
263  float cosS1 = (-db + disc) / (2 * da);
264  float cosS2 = (-db - disc) / (2 * da);
265  if (TMath::Abs(cosS1) < 1) {
266  splitted = true;
267  // printf("splitted \n");
268 
269  double phi1 = acos(cosS1);
270  double phi2 = acos(cosS2);
271  TEveVector ps1 = v0 + v1 * ((float)cos(phi1)) + v2 * ((float)sin(phi1));
272  TEveVector ps2 = v0 + v1 * ((float)cos(phi2)) + v2 * ((float)sin(phi2));
273 
274  // acos has values [0, Pi] , check the symetry over x axis (mirroring)
275  if (TMath::Abs(ps1[1] - bs) > 1e-5)
276  phi1 = TMath::TwoPi() - phi1;
277 
278  if (TMath::Abs(ps2[1] - bs) > 1e-5)
279  phi2 = TMath::TwoPi() - phi2;
280 
281  int N = 20;
282  double phiStep = TMath::TwoPi() / N;
283  double phiOffset = phiStep * 0.1;
284  double phiMin = TMath::Min(phi1, phi2);
285  double phiMax = TMath::Max(phi1, phi2);
286  // printf(" %f %f \n",phi1*TMath::RadToDeg(), phi2*TMath::RadToDeg() );
287 
288  // fill
289  // upper clothing
290  glBegin(GL_POLYGON);
291  drawArch(phiMin + phiOffset, phiMax - phiOffset, phiStep, v0, v1, v2);
292  glEnd();
293  // bottom clothing
294  glBegin(GL_POLYGON);
295  drawArch(phiMax + phiOffset, phiMax + TMath::TwoPi() - (phiMax - phiMin) - phiOffset, phiStep, v0, v1, v2);
296  glEnd();
297 
298  // frame
299  TGLUtil::LineWidth(fE->fLineWidth);
300  TGLUtil::Color(fE->fLineColor);
301  // upper clothing
302  glBegin(GL_LINE_LOOP);
303  drawArch(phiMin + phiOffset, phiMax - phiOffset, phiStep, v0, v1, v2);
304  glEnd();
305  // bottom clothing
306  glBegin(GL_LINE_LOOP);
307  drawArch(phiMax + phiOffset, phiMax + TMath::TwoPi() - (phiMax - phiMin) - phiOffset, phiStep, v0, v1, v2);
308  glEnd();
309  }
310  }
311 
312  if (!splitted) {
313  glBegin(GL_POLYGON);
314  drawArch(0, TMath::TwoPi(), phiStep, v0, v1, v2);
315  glEnd();
316  TGLUtil::LineWidth(fE->fLineWidth);
317  TGLUtil::Color(fE->fLineColor);
318  glBegin(GL_LINE_LOOP);
319  drawArch(0, TMath::TwoPi(), phiStep, v0, v1, v2);
320  glEnd();
321  }
322 
323  drawRhoZAxis(v0, v2);
324  drawRhoZAxis(v0, v1);
325 }
const double TwoPi
TEveVector & RefPos()
Definition: TEveEllipsoid.h:36
void drawArch(float pStart, float pEnd, float phiStep, TEveVector &v0, TEveVector &v1, TEveVector &v2) const
TEveEllipsoid * fE
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
tuple db
Definition: EcalCondDB.py:153
T Min(T a, T b)
Definition: MathUtil.h:39
void drawRhoZAxis(TEveVector &v, TEveVector &) const
T sqrt(T t)
Definition: SSEVec.h:19
TEveTrans & RefEMtx()
Definition: TEveEllipsoid.h:38
if(conf_.getParameter< bool >("UseStripCablingDB"))
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
T Abs(T a)
Definition: MathUtil.h:49
T Max(T a, T b)
Definition: MathUtil.h:44
#define N
Definition: blowfish.cc:9
TEveEllipsoidProjected * fM
void TEveEllipsoidProjectedGL::drawRhoZAxis ( TEveVector &  v,
TEveVector &  v2 
) const
private

Definition at line 328 of file TEveEllipsoidGL.cc.

References Abs(), cms::cuda::bs, and fM.

Referenced by DrawRhoZ().

328  {
329  glBegin(GL_LINES);
330  TEveProjection* proj = fM->GetManager()->GetProjection();
331 
332  float bs = 0;
333  if (proj->GetDisplaceOrigin())
334  bs = proj->RefCenter()[1];
335 
336  float off = (v2[1] > v0[1]) ? 0.01 : -0.01;
337  TEveVector alu = v0 + v2;
338  proj->ProjectVector(alu, fM->fDepth);
339  glVertex3fv(alu.Arr());
340 
341  if (TMath::Abs(v0[1] / v2[1]) < 1) {
342  alu = v0 - ((float)((1 - off) * (v0[1] - bs) / v2[1])) * v2;
343  proj->ProjectVector(alu, fM->fDepth);
344  glVertex3fv(alu.Arr());
345 
346  //============================
347 
348  alu = v0 - ((float)((1 + off) * (v0[1] - bs) / v2[1])) * v2;
349  proj->ProjectVector(alu, fM->fDepth);
350  glVertex3fv(alu.Arr());
351  }
352 
353  alu = v0 - v2;
354  proj->ProjectVector(alu, fM->fDepth);
355  glVertex3fv(alu.Arr());
356 
357  glEnd();
358 }
T Abs(T a)
Definition: MathUtil.h:49
TEveEllipsoidProjected * fM
TEveEllipsoidProjectedGL& TEveEllipsoidProjectedGL::operator= ( const TEveEllipsoidProjectedGL )
private
void TEveEllipsoidProjectedGL::SetBBox ( )
override

Definition at line 121 of file TEveEllipsoidGL.cc.

121  {
122  // Set bounding box.
123 
124  SetAxisAlignedBBox(((TEveEllipsoidProjected*)fExternalObj)->AssertBBox());
125 }
Bool_t TEveEllipsoidProjectedGL::SetModel ( TObject *  obj,
const Option_t *  opt = nullptr 
)
override

Definition at line 112 of file TEveEllipsoidGL.cc.

References TEveEllipsoidGL::fE, fM, and getGTfromDQMFile::obj.

112  {
113  // Set model object.
114 
115  fM = SetModelDynCast<TEveEllipsoidProjected>(obj);
116  fE = dynamic_cast<TEveEllipsoid*>(fM->GetProjectable());
117  return fE != nullptr;
118 }
TEveEllipsoid * fE
TEveEllipsoidProjected * fM

Member Data Documentation

TEveEllipsoidProjected* TEveEllipsoidProjectedGL::fM
protected

Definition at line 54 of file TEveEllipsoidGL.h.

Referenced by DirectDraw(), drawArch(), DrawRhoPhi(), DrawRhoZ(), drawRhoZAxis(), and SetModel().