ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TVolumePosition.cxx
Go to the documentation of this file.
1 // @(#)root/table:$Id$
2 // Author: Valery Fine(fine@bnl.gov) 25/12/98
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 
13 #include "Riostream.h"
14 
15 #include "TCernLib.h"
16 #include "TVolumePosition.h"
17 #include "TVolume.h"
18 
19 #include "TROOT.h"
20 #include "TClass.h"
21 #include "TVirtualPad.h"
22 #include "TGeometry.h"
23 #include "TRotMatrix.h"
24 #include "TBrowser.h"
25 #include "X3DBuffer.h"
26 
27 #include "TTablePadView3D.h"
28 
29 //R__EXTERN Size3D gSize3D;
30 
32 
33 //______________________________________________________________________________
34 //*-*-*-*-*-*-*-*-* S T N O D E P O S I T I O N description *-*-*-*-*-*-*-*-*-
35 //*-* ===========================
36 //*-*
37 //*-* A TVolumePosition object is used to build the geometry hierarchy (see TGeometry).
38 //*-* A node may contain other nodes.
39 //*-*
40 //*-* A geometry node has attributes:
41 //*-* - name and title
42 //*-* - pointer to the referenced shape (see TShape).
43 //*-* - x,y,z offset with respect to the mother node.
44 //*-* - pointer to the rotation matrix (see TRotMatrix).
45 //*-*
46 //*-* A node can be drawn.
47 //*-*
48 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
49 
50 
51 ////////////////////////////////////////////////////////////////////////////////
52 ///*-*-*-*-*-*-*-*-*-*-*Node normal constructor*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
53 ///*-* ======================
54 ///*-*
55 ///*-* name is the name of the node
56 ///*-* title is title
57 ///*-* x,y,z are the offsets of the volume with respect to his mother
58 ///*-* matrixname is the name of the rotation matrix
59 ///*-*
60 ///*-* This new node is added into the list of sons of the current node
61 ///*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
62 
63 TVolumePosition::TVolumePosition(TVolume *node,Double_t x, Double_t y, Double_t z, const char *matrixname)
64 : fMatrix(0),fNode(node),fId(0)
65 {
66  SetMatrixOwner(kFALSE);
67  fX[0] = x; fX[1] =y; fX[2] = z;
68  if (!node) return;
69  static Int_t counter = 0;
70  counter++;
71  if(!(counter%1000))std::cout<<"TVolumePosition count="<<counter<<" name="<<node->GetName()<<std::endl;
72 
73  if (!gGeometry) new TGeometry;
74  if (matrixname && strlen(matrixname)) fMatrix = gGeometry->GetRotMatrix(matrixname);
75  if (!fMatrix) fMatrix = TVolume::GetIdentity();
76 }
77 
78 
79 ////////////////////////////////////////////////////////////////////////////////
80 ///*-*-*-*-*-*-*-*-*-*-*Node normal constructor*-*-*-*-*-*-*-*-*-*-*
81 ///*-* ================================
82 ///*-*
83 ///*-* name is the name of the node
84 ///*-* title is title
85 ///*-* x,y,z are the offsets of the volume with respect to his mother
86 ///*-* matrix is the pointer to the rotation matrix
87 ///*-*
88 ///*-* This new node is added into the list of sons of the current node
89 ///*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
90 
92  : fMatrix(matrix),fNode(node),fId(0)
93 {
95  if (!gGeometry) new TGeometry;
96  fX[0] = x; fX[1] = y; fX[2] = z;
98 }
99 ////////////////////////////////////////////////////////////////////////////////
100 /// Pick the "old" position by pieces
101 
102 TVolumePosition::TVolumePosition(const TVolumePosition* oldPosition, const TVolumePosition* curPosition){
103  fMatrix = 0;
105  TVolume *curNode = 0;
106  UInt_t curPositionId = 0;
107  TRotMatrix *curMatrix = 0;
108  if (curPosition) {
109  curNode = curPosition->GetNode();
110  curPositionId = curPosition->GetId();
111  curMatrix = (TRotMatrix *) curPosition->GetMatrix();
112  }
113  TRotMatrix *oldMatrix = 0;
114  fX[0] = 0; fX[1] = 0; fX[2] = 0;
115  Double_t oldTranslation[] = { 0, 0, 0 };
116  if (oldPosition) {
117  oldMatrix = (TRotMatrix *) oldPosition->GetMatrix();
118  oldTranslation[0] = oldPosition->GetX();
119  oldTranslation[1] = oldPosition->GetY();
120  oldTranslation[2] = oldPosition->GetZ();
121  }
122 
123  // Pick the "current" position by pieces
124 
125  // Create a new position
126  Double_t newMatrix[9];
127 
128  if(oldMatrix && curMatrix && curPosition) {
129  TGeometry::UpdateTempMatrix(oldTranslation,oldMatrix->GetMatrix(),
130  curPosition->GetX(),curPosition->GetY(),curPosition->GetZ(),
131  curMatrix->GetMatrix(),
132  fX,newMatrix);
134  Char_t anum[100];
135  snprintf(anum,100,"%d",num+1);
136  fMatrix = new TRotMatrix(anum,"NodeView",newMatrix);
138  } else {
139  if (curPosition) {
140  fX[0] = oldTranslation[0] + curPosition->GetX();
141  fX[1] = oldTranslation[1] + curPosition->GetY();
142  fX[2] = oldTranslation[2] + curPosition->GetZ();
143  fMatrix = curMatrix;
144  }
145  }
146  fId = curPositionId;
147  fNode = curNode;
148 }
149 //______________________________________________________________________________
150 //______________________________________________________________________________
152  , fMatrix(((TVolumePosition &)pos).GetMatrix()),fNode(pos.GetNode()),fId(pos.GetId())
153 {
154  //to be documented
155  for (int i=0;i<3;i++) fX[i] = pos.GetX(i);
156  // Transferring the ownership.
157  // The last created object owns the matrix if any.
158  // The source object gives up its ownership in favour of the destination object
159 
161  // !!! We have to break the "const'ness" at this point to take the ownerships
162  ((TVolumePosition &)pos).SetMatrixOwner(kFALSE);
163 }
164 
165 ////////////////////////////////////////////////////////////////////////////////
166 ///to be documented
167 
169 {
170  DeleteOwnMatrix();
171 }
172 ////////////////////////////////////////////////////////////////////////////////
173 ///to be documented
174 
176 {
177  if (GetNode()) {
178  TShape *shape = GetNode()->GetShape();
179  b->Add(GetNode(),shape?shape->GetName():GetNode()->GetName());
180  } else {
181  Draw();
182  gPad->Update();
183  }
184 }
185 
186 ////////////////////////////////////////////////////////////////////////////////
187 ///*-*-*-*-*-*-*-*-*-*-*Compute distance from point px,py to a Node*-*-*-*-*-*
188 ///*-* ===========================================
189 ///*-* Compute the closest distance of approach from point px,py to this node.
190 ///*-* The distance is computed in pixels units.
191 ///*-*
192 ///*-*
193 ///*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
194 
196 {
197  return 99999;
198 }
199 
200 ////////////////////////////////////////////////////////////////////////////////
201 ///*-*-*-*-*-*-*-*-*-*-*-*Draw Referenced node with current parameters*-*-*-*
202 ///*-* =============================================
203 
205 {
206  TVolume *node = GetNode();
207  if (node) node->Draw(option);
208 }
209 
210 
211 ////////////////////////////////////////////////////////////////////////////////
212 ///*-*-*-*-*-*-*-*-*-*-*Execute action corresponding to one event*-*-*-*
213 ///*-* =========================================
214 ///*-* This member function must be implemented to realize the action
215 ///*-* corresponding to the mouse click on the object in the window
216 ///*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
217 
219 {
220 // if (gPad->GetView())
221 // gPad->GetView()->ExecuteRotateView(event, px, py);
222 
223 // if (!gPad->GetListOfPrimitives()->FindObject(this)) gPad->SetCursor(kCross);
224  gPad->SetCursor(kHand);
225 }
226 
227 ////////////////////////////////////////////////////////////////////////////////
228 ///return VolumePosition name
229 
231 {
232  return GetNode()?GetNode()->GetName():IsA()->GetName();
233 }
234 
235 ////////////////////////////////////////////////////////////////////////////////
236 ///to be documented
237 
239 {
240  if (!gPad) return 0;
241  if (!GetNode()) return 0;
242  static char info[64];
243  snprintf(info,64,"%s/%s, shape=%s/%s",GetNode()->GetName(),GetNode()->GetTitle(),GetNode()->GetShape()->GetName(),GetNode()->GetShape()->ClassName());
244  return info;
245 }
246 
247 ////////////////////////////////////////////////////////////////////////////////
248 ///to be documented
249 
250 Double_t *TVolumePosition::Errmx2Master(const Double_t *localError, Double_t *masterError) const
251 {
252  Double_t error[6];
253  TCL::vzero(&error[1],4);
254  error[0] = localError[0]; error[2] = localError[1]; error[5] = localError[2];
255  return Cormx2Master(error, masterError);
256 }
257 
258 ////////////////////////////////////////////////////////////////////////////////
259 ///to be documented
260 
261 Float_t *TVolumePosition::Errmx2Master(const Float_t *localError, Float_t *masterError) const
262 {
263  Float_t error[6];
264  TCL::vzero(&error[1],4);
265  error[0] = localError[0]; error[2] = localError[1]; error[5] = localError[2];
266  return Cormx2Master(error, masterError);
267 }
268 
269 ////////////////////////////////////////////////////////////////////////////////
270 ///to be documented
271 
272 Double_t *TVolumePosition::Cormx2Master(const Double_t *localCorr, Double_t *masterCorr)const
273 {
274  Double_t *res = 0;
275  const TRotMatrix *rm = GetMatrix();
276  double *m = 0;
277  if (rm && ( m = ((TRotMatrix *)rm)->GetMatrix()) )
278  res = TCL::trasat(m,(Double_t *)localCorr,masterCorr,3,3);
279  else
280  res = TCL::ucopy(localCorr,masterCorr,6);
281  return res;
282 }
283 
284 ////////////////////////////////////////////////////////////////////////////////
285 ///to be documented
286 
287 Float_t *TVolumePosition::Cormx2Master(const Float_t *localCorr, Float_t *masterCorr) const
288 {
289  Float_t *res = 0;
290  const TRotMatrix *rm = GetMatrix();
291  Double_t *m = 0;
292  if (rm && (m = ((TRotMatrix *)rm)->GetMatrix()) ) {
293  double corLocal[6], corGlobal[6];
294  TCL::ucopy(localCorr,corLocal,6);
295  TCL::trasat(m,corLocal,corGlobal,3,3);
296  res = TCL::ucopy(corGlobal,masterCorr,6);
297  } else
298  res = TCL::ucopy(localCorr,masterCorr,6);
299  return res;
300 }
301 ////////////////////////////////////////////////////////////////////////////////
302 ///to be documented
303 
304 Double_t *TVolumePosition::Errmx2Local(const Double_t *masterError, Double_t *localError) const
305 {
306  Double_t error[6];
307  TCL::vzero(&error[1],4);
308  error[0] = masterError[0]; error[2] = masterError[1]; error[5] = masterError[2];
309  return Cormx2Local(error, localError);
310 }
311 ////////////////////////////////////////////////////////////////////////////////
312 ///to be documented
313 
314 Float_t *TVolumePosition::Errmx2Local(const Float_t *masterError, Float_t *localError) const
315 {
316  Float_t error[6];
317  TCL::vzero(&error[1],4);
318  error[0] = masterError[0]; error[2] = masterError[1]; error[5] = masterError[2];
319  return Cormx2Local(error, localError);
320 }
321 ////////////////////////////////////////////////////////////////////////////////
322 ///to be documented
323 
324 Double_t *TVolumePosition::Cormx2Local(const Double_t *localCorr, Double_t *masterCorr) const
325 {
326  Double_t *res = 0;
327  TRotMatrix *rm = (TRotMatrix *) GetMatrix();
328  double *m = 0;
329  if (rm && ( m = rm->GetMatrix()) )
330  res = TCL::tratsa(m,(Double_t *)localCorr,masterCorr,3,3);
331  else
332  res = TCL::ucopy(localCorr,masterCorr,6);
333  return res;
334 }
335 
336 ////////////////////////////////////////////////////////////////////////////////
337 ///to be documented
338 
339 Float_t *TVolumePosition::Cormx2Local(const Float_t *localCorr, Float_t *masterCorr) const
340 {
341  Float_t *res = 0;
342  TRotMatrix *rm = (TRotMatrix *) GetMatrix();
343  Double_t *m = 0;
344  if (rm && (m = rm->GetMatrix()) ) {
345  double corLocal[6], corGlobal[6];
346  TCL::ucopy(localCorr,corLocal,6);
347  TCL::tratsa(m,corLocal,corGlobal,3,3);
348  res = TCL::ucopy(corGlobal,masterCorr,6);
349  }
350  else
351  res = TCL::ucopy(localCorr,masterCorr,6);
352  return res;
353 }
354 
355 ////////////////////////////////////////////////////////////////////////////////
356 ///*-*-*-*-*Convert one point from local system to master reference system*-*-*
357 ///*-* ==============================================================
358 ///
359 /// Note that before invoking this function, the global rotation matrix
360 /// and translation vector for this node must have been computed.
361 /// This is automatically done by the Paint functions.
362 /// Otherwise TVolumePosition::UpdateMatrix should be called before.
363 
364 Double_t *TVolumePosition::Local2Master(const Double_t *local, Double_t *master, Int_t nPoints) const
365 {
366  Double_t *matrix = 0;
367  Double_t *trans = 0;
368  if (!fMatrix || fMatrix == TVolume::GetIdentity() || !(matrix = ((TRotMatrix *)fMatrix)->GetMatrix()) ) {
369  trans = master;
370  for (int i =0; i < nPoints; i++,local += 3, master += 3) TCL::vadd(local,fX,master,3);
371  } else {
372  trans = master;
373  for (int i =0; i < nPoints; i++, local += 3, master += 3) {
374  TCL::mxmpy2(matrix,local,master,3,3,1);
375  TCL::vadd(master,fX,master,3);
376  }
377  }
378  return trans;
379 }
380 
381 ////////////////////////////////////////////////////////////////////////////////
382 ///*-*-*-*Convert nPoints points from local system to master reference system*-*-*
383 ///*-* ==============================================================
384 ///
385 /// Note that before invoking this function, the global rotation matrix
386 /// and translation vector for this node must have been computed.
387 /// This is automatically done by the Paint functions.
388 /// Otherwise TVolumePosition::UpdateMatrix should be called before.
389 ///
390 
391 Float_t *TVolumePosition::Local2Master(const Float_t *local, Float_t *master, Int_t nPoints) const
392 {
393  Double_t *matrix = 0;
394  Float_t *trans = 0;
395  if (!fMatrix || fMatrix == TVolume::GetIdentity() || !(matrix = ((TRotMatrix *)fMatrix)->GetMatrix()) )
396  {
397  trans = master;
398  for (int i =0; i < nPoints; i++,local += 3, master += 3) TCL::vadd(local,fX,master,3);
399  } else {
400  trans = master;
401  for (int i =0; i < nPoints; i++, local += 3, master += 3) {
402  Double_t dlocal[3]; Double_t dmaster[3];
403  TCL::ucopy(local,dlocal,3);
404  TCL::mxmpy2(matrix,dlocal,dmaster,3,3,1);
405  TCL::vadd(dmaster,fX,dmaster,3);
406  TCL::ucopy(dmaster,master,3);
407  }
408  }
409  return trans;
410 }
411 ////////////////////////////////////////////////////////////////////////////////
412 ///*-*-*-*-*Convert one point from master system to local reference system*-*-*
413 ///*-* ==============================================================
414 ///
415 /// Note that before invoking this function, the global rotation matrix
416 /// and translation vector for this node must have been computed.
417 /// This is automatically done by the Paint functions.
418 /// Otherwise TVolumePosition::UpdateMatrix should be called before.
419 
420 Double_t *TVolumePosition::Master2Local(const Double_t *master, Double_t *local, Int_t nPoints) const
421 {
422  Double_t *matrix = 0;
423  Double_t *trans = 0;
424  if (!fMatrix || fMatrix == TVolume::GetIdentity() || !(matrix = ((TRotMatrix *)fMatrix)->GetMatrix()) ){
425  trans = local;
426  for (int i =0; i < nPoints; i++,master += 3, local += 3) TCL::vsub(master,fX,local,3);
427  } else {
428  trans = local;
429  for (int i =0; i < nPoints; i++, master += 3, local += 3) {
430  Double_t dlocal[3];
431  TCL::vsub(master,fX,dlocal,3);
432  TCL::mxmpy(matrix,dlocal,local,3,3,1);
433  }
434  }
435  return trans;
436 }
437 
438 ////////////////////////////////////////////////////////////////////////////////
439 ///*-*-*-*Convert nPoints points from master system to local reference system*-*-*
440 ///*-* ==============================================================
441 ///
442 /// Note that before invoking this function, the global rotation matrix
443 /// and translation vector for this node must have been computed.
444 /// This is automatically done by the Paint functions.
445 /// Otherwise TVolumePosition::UpdateMatrix should be called before.
446 ///
447 
448 Float_t *TVolumePosition::Master2Local(const Float_t *master, Float_t *local, Int_t nPoints) const
449 {
450  Double_t *matrix = 0;
451  Float_t *trans = 0;
452  if (!fMatrix || fMatrix == TVolume::GetIdentity() || !(matrix = ((TRotMatrix *)fMatrix)->GetMatrix()) ){
453  trans = local;
454  for (int i =0; i < nPoints; i++,master += 3, local += 3) TCL::vsub(master,fX,local,3);
455  } else {
456  trans = local;
457  for (int i =0; i < nPoints; i++, master += 3, local += 3) {
458  Double_t dmaster[3]; Double_t dlocal[3];
459  TCL::ucopy(master,dmaster,3);
460  TCL::vsub(dmaster,fX,dmaster,3);
461  TCL::mxmpy(matrix,dmaster,dlocal,3,3,1);
462  TCL::ucopy(dlocal,local,3);
463  }
464  }
465  return trans;
466 }
467 ////////////////////////////////////////////////////////////////////////////////
468 ///*-*-*-*-*-*-*-*-*-*-*-*Paint Referenced node with current parameters*-*-*-*
469 ///*-* ==============================================
470 ///*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
471 
473 {
474  Error("Paint","Position can not be painted");
475 }
476 
477 ////////////////////////////////////////////////////////////////////////////////
478 ///to be documented
479 
481 {
482  std::cout << *this << std::endl;
483 }
484 
485 ////////////////////////////////////////////////////////////////////////////////
486 ///*-*-*-*-*-*-*-*-*-*-*-*-*-*-* Reset this position *-*-*-*-*-*-*-*-*-*-*
487 ///*-* ===================
488 ///*-* x,y,z are the offsets of the volume with respect to his mother
489 ///*-* matrix is the pointer to the rotation matrix
490 ///*-*
491 ///*-* This method is to re-use the memory this object without delete/create steps
492 ///*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
493 
495 {
496 // This method has to be protected since it doesn't set properly kIsOwn bit.
497 
498  fNode = node;
499  SetPosition(x,y,z);
500  SetMatrix(matrix);
502  return this;
503 }
504 
505 ////////////////////////////////////////////////////////////////////////////////
506 ///to be documented
507 
508 void TVolumePosition::SavePrimitive(std::ostream &, Option_t * /*= ""*/)
509 {
510 #if 0
511  out << "TVolumePosition *CreatePosition() { " << std::endl;
512  out << " TVolumePosition *myPosition = 0; " << std::endl;
513  Double_t x = GetX();
514  Double_t y = GetY();
515  Double_t z = GetZ();
516  TRotMatrix *matrix =
517  myPosition = new TVolumePosition(TVolume *node,Double_t x, Double_t y, Double_t z, const char *matrixname)
518  : fNode(node),fX(x),fY(y),fZ(z),fMatrix(0)
519 {
520 /
521  out << " return myPosition; " << std::endl;
522  out << "} " << std::endl;
523 #endif
524 
525 }
526 ////////////////////////////////////////////////////////////////////////////////
527 ///to be documented
528 
530 {
531  TVolume *thisNode = GetNode();
532  if (thisNode) thisNode->SetLineAttributes();
533 }
534 ////////////////////////////////////////////////////////////////////////////////
535 ///to be documented
536 
538 {
539  if (matrix != fMatrix) {
540  DeleteOwnMatrix();
541  fMatrix = matrix;
542  }
543 }
544 ////////////////////////////////////////////////////////////////////////////////
545 ///to be documented
546 
548 {
549  TTablePadView3D *view3D=(TTablePadView3D *)gPad->GetView3D();
550 //*-*- Update translation vector and rotation matrix for new level
551  if (gGeometry->GeomLevel() && fMatrix) {
552  gGeometry->UpdateTempMatrix(fX[0],fX[1],fX[2]
553  ,((TRotMatrix *)fMatrix)->GetMatrix()
554  ,fMatrix->IsReflection());
555  if (view3D)
556  view3D->UpdatePosition(fX[0],fX[1],fX[2],((TRotMatrix *)fMatrix));
557  }
558 }
559 
560 ////////////////////////////////////////////////////////////////////////////////
561 ///to be documented
562 
564 {
565  TVolume *node = GetNode();
566  if (node) node->SetVisibility(TVolume::ENodeSEEN(vis));
567 }
568 ////////////////////////////////////////////////////////////////////////////////
569 
571  // This method mupltiply the position of this object to the position of the
572  // curPosition object.
573  // It doesn't change Id of either object involved.
574 
575 
576  // Pick the "old" position by pieces
577  TVolume *curNode = 0;
578  // UInt_t curPositionId = 0;
579  curNode = curPosition.GetNode();
580  // curPositionId = curPosition.GetId();
581  const TRotMatrix *oldMatrix = 0;
582  Double_t oldTranslation[] = { 0, 0, 0 };
583  oldMatrix = GetMatrix();
584  oldTranslation[0] = GetX();
585  oldTranslation[1] = GetY();
586  oldTranslation[2] = GetZ();
587 
588  // Pick the "current" position by pieces
589  const TRotMatrix *curMatrix = curPosition.GetMatrix();
590 
591  // Create a new position
592  Double_t newTranslation[3];
593  Double_t newMatrix[9];
594  if(oldMatrix){
595  TGeometry::UpdateTempMatrix(oldTranslation,((TRotMatrix *)oldMatrix)->GetMatrix()
596  ,curPosition.GetX(),curPosition.GetY(),curPosition.GetZ(),
597  ((TRotMatrix *)curMatrix)->GetMatrix()
598  ,newTranslation,newMatrix);
600  Char_t anum[100];
601  snprintf(anum,100,"%d",num+1);
602  SetMatrixOwner();
603  Reset(curNode
604  ,newTranslation[0],newTranslation[1],newTranslation[2]
605  ,new TRotMatrix(anum,"NodeView",newMatrix));
607  } else {
608  newTranslation[0] = oldTranslation[0] + curPosition.GetX();
609  newTranslation[1] = oldTranslation[1] + curPosition.GetY();
610  newTranslation[2] = oldTranslation[2] + curPosition.GetZ();
611  Reset(curNode,newTranslation[0],newTranslation[1],newTranslation[2]);
612  }
613 // SetId(curPositionId);
614  return *this;
615 }
616 
617 ////////////////////////////////////////////////////////////////////////////////
618 ///to be documented
619 
621 {
622  if (xyz) memcpy(fX,xyz,sizeof(fX));
623  else memset(fX,0,sizeof(fX));
624 }
625 
626 ////////////////////////////////////////////////////////////////////////////////
627 /// Stream an object of class TVolumePosition.
628 
629 void TVolumePosition::Streamer(TBuffer &R__b)
630 {
631  TRotMatrix *save = fMatrix;
632  if (R__b.IsReading()) {
633  fMatrix = 0;
635  if (!fMatrix) fMatrix = save;
636  } else {
637  if (save == TVolume::GetIdentity() ) fMatrix = 0;
639  fMatrix = save;
640  }
641 }
642 ////////////////////////////////////////////////////////////////////////////////
643 ///to be documented
644 
645 std::ostream& operator<<(std::ostream& s,const TVolumePosition &target)
646 {
647  s << " Node: ";
648  if (target.GetNode()) s << target.GetNode()->GetName() << std::endl;
649  else s << "NILL" << std::endl;
650  s << Form(" Position: x=%10.5f : y=%10.5f : z=%10.5f\n", target.GetX(), target.GetY(), target.GetZ());
651  TRotMatrix *rot = (TRotMatrix *) target.GetMatrix();
652  if (rot){
653  s << rot->IsA()->GetName() << "\t" << rot->GetName() << "\t" << rot->GetTitle() << std::endl;
654  Double_t *matrix = rot->GetMatrix();
655  Int_t i = 0;
656  for (i=0;i<3;i++) {
657  for (Int_t j=0;j<3;j++) s << Form("%10.5f:", *matrix++);
658  s << std::endl;
659  }
660  }
661  return s;
662 }
void Add(TObject *obj, const char *name=0, Int_t check=-1)
Add object with name to browser.
Definition: TBrowser.cxx:259
THashList * GetListOfMatrices() const
Definition: TGeometry.h:82
TRotMatrix * fMatrix
virtual void SetPosition(Double_t x=0, Double_t y=0, Double_t z=0)
virtual Double_t * GetMatrix()
Definition: TRotMatrix.h:56
virtual void Browse(TBrowser *b)
to be documented
Bool_t SetMatrixOwner(Bool_t ownerShips=kTRUE)
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
virtual void SetLineAttributes()
Invoke the DialogCanvas Line attributes.
Definition: TAttLine.cxx:277
virtual Double_t GetY() const
virtual TVolume * GetNode() const
Bool_t IsReading() const
Definition: TBuffer.h:83
ClassImp(TVolumePosition) TVolumePosition
*-*-*-*-*-*-*-*-*-*-*Node normal constructor*-*-*-*-*-*-*-*-*-*-*-*-*-*-* *-* ====================== ...
float Float_t
Definition: RtypesCore.h:53
const char Option_t
Definition: RtypesCore.h:62
virtual void Draw(Option_t *depth="3")
*-*-*-*-*-*-*-*-*-*-*-*Draw Referenced node with current parameters*-*-*-* *-* ======================...
virtual void UpdatePosition(Double_t x, Double_t y, Double_t z, TRotMatrix *matrix, Option_t *opt="")
ENodeSEEN
Definition: TVolume.h:44
virtual UInt_t GetId() const
virtual Double_t * Cormx2Master(const Double_t *localCorr, Double_t *masterCorr) const
to be documented
static float * tratsa(const float *a, const float *s, float *r, int m, int n)
Buffer base class used for serializing objects.
Definition: TBuffer.h:42
virtual Float_t * Errmx2Master(const Float_t *localError, Float_t *masterError) const
to be documented
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
*-*-*-*-*-*-*-*-*-*-*Compute distance from point px,py to a Node*-*-*-*-*-* *-* =====================...
Bool_t IsMatrixOwner() const
virtual Double_t GetZ() const
int Int_t
Definition: RtypesCore.h:41
const Bool_t kFALSE
Definition: Rtypes.h:92
virtual void Draw(Option_t *depth="3")
*-*-*-*-*-*-*-*-*-*-*-*Draw Referenced node with current parameters*-*-*-* *-* ======================...
Definition: TVolume.cxx:440
Double_t fX[3]
virtual TVolumePosition & Mult(const TVolumePosition &position)
Double_t x[n]
Definition: legend1.C:17
TRotMatrix * GetRotMatrix(const char *name) const
Return pointer to RotMatrix with name.
Definition: TGeometry.cxx:356
void Class()
Definition: Class.C:29
virtual void SetVisibility(ENodeSEEN vis=TVolume::kBothVisible)
*-*-*-*-*-*-*Set visibility for this volume and its sons*-*-*-*-*–*-*-*-*-*-* *-* ===================...
Definition: TVolume.cxx:768
virtual void SetXYZ(Double_t *xyz=0)
to be documented
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
to be documented
virtual Double_t * Local2Master(const Double_t *local, Double_t *master, Int_t nPoints=1) const
*-*-*-*-*Convert one point from local system to master reference system*-*-* *-* ====================...
const TRotMatrix * GetMatrix() const
virtual ~TVolumePosition()
to be documented
static TRotMatrix * GetIdentity()
Return a pointer the "identity" matrix.
Definition: TVolume.cxx:516
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:918
Float_t z[5]
Definition: Ifit.C:16
virtual void SetVisibility(Int_t vis=1)
to be documented
virtual Double_t * Cormx2Local(const Double_t *masterCorr, Double_t *localCorr) const
to be documented
char * out
Definition: TBase64.cxx:29
TGeometry description.
Definition: TGeometry.h:43
Using a TBrowser one can browse all ROOT objects.
Definition: TBrowser.h:41
virtual char * GetObjectInfo(Int_t px, Int_t py) const
to be documented
This is the base class for all geometry shapes.
Definition: TShape.h:47
virtual void SetLineAttributes()
to be documented
Manages a detector rotation matrix.
Definition: TRotMatrix.h:30
virtual void SetMatrix(TRotMatrix *matrix=0)
to be documented
static float * mxmpy(const float *a, const float *b, float *c, int i, int j, int k)
Definition: TCernLib.h:203
static int * ucopy(const int *a, int *b, int n)
Definition: TCernLib.h:352
virtual const char * ClassName() const
Returns name of class to which the object belongs.
Definition: TObject.cxx:187
TVolumePosition(TVolume *node=0, Double_t x=0, Double_t y=0, Double_t z=0, TRotMatrix *matrix=0)
*-*-*-*-*-*-*-*-*-*-*Node normal constructor*-*-*-*-*-*-*-*-*-*-* *-* ===============================...
TClass * IsA() const
virtual void UpdatePosition(Option_t *option="")
to be documented
unsigned int UInt_t
Definition: RtypesCore.h:42
TMarker * m
Definition: textangle.C:8
char * Form(const char *fmt,...)
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
*-*-*-*-*-*-*-*-*-*-*Execute action corresponding to one event*-*-*-* *-* ===========================...
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:51
virtual Double_t GetX(Int_t indx=0) const
static float * mxmpy2(const float *a, const float *b, float *c, int i, int j, int k)
Definition: TCernLib.h:215
virtual TVolumePosition * Reset(TVolume *node=0, Double_t x=0, Double_t y=0, Double_t z=0, TRotMatrix *matrix=0)
*-*-*-*-*-*-*-*-*-*-*-*-*-*-* Reset this position *-*-*-*-*-*-*-*-*-*-* *-* =================== *-* x...
static float * trasat(const float *a, const float *s, float *r, int m, int n)
Int_t GeomLevel() const
Definition: TGeometry.h:78
virtual Double_t * Master2Local(const Double_t *master, Double_t *local, Int_t nPoints=1) const
*-*-*-*-*Convert one point from master system to local reference system*-*-* *-* ====================...
TShape * GetShape() const
Definition: TVolume.h:85
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=0)=0
virtual Int_t GetSize() const
Definition: TCollection.h:95
double Double_t
Definition: RtypesCore.h:55
Double_t y[n]
Definition: legend1.C:17
static float * vzero(float *a, int n2)
Definition: TCernLib.h:504
static float * vadd(const float *b, const float *c, float *a, int n)
Definition: TCernLib.h:399
Mother of all ROOT objects.
Definition: TObject.h:58
virtual void UpdateTempMatrix(Double_t x=0, Double_t y=0, Double_t z=0, TRotMatrix *matrix=0)
Update temp matrix.
Definition: TGeometry.cxx:661
char Char_t
Definition: RtypesCore.h:29
std::ostream & operator<<(std::ostream &s, const TVolumePosition &target)
to be documented
#define gPad
Definition: TVirtualPad.h:288
virtual Float_t * Errmx2Local(const Float_t *masterError, Float_t *localError) const
to be documented
TGMatrixLayout * fMatrix
virtual void Print(Option_t *option="") const
to be documented
static float * vsub(const float *a, const float *b, float *x, int n)
Definition: TCernLib.h:453
const Bool_t kTRUE
Definition: Rtypes.h:91
virtual const char * GetTitle() const
Returns title of object.
Definition: TObject.cxx:459
R__EXTERN TGeometry * gGeometry
Definition: TGeometry.h:162
virtual Bool_t IsReflection() const
Definition: TRotMatrix.h:63
virtual void Paint(Option_t *option="")
*-*-*-*-*-*-*-*-*-*-*-*Paint Referenced node with current parameters*-*-*-* *-* =====================...
virtual const Char_t * GetName() const
return VolumePosition name