CMS 3D CMS Logo

DetGeomDesc.cc
Go to the documentation of this file.
1 /****************************************************************************
2 *
3 * This is a part of the TOTEM offline software.
4 * Authors:
5 * Jan Kašpar (jan.kaspar@gmail.com)
6 * CMSSW developers (based on GeometricDet class)
7 *
8 ****************************************************************************/
9 
11 
15 
17 
18 using namespace std;
19 
20 //----------------------------------------------------------------------------------------------------
21 
22 DetGeomDesc::DetGeomDesc(nav_type navtype, GeometricEnumType type) : _ddd(navtype), _type(type)
23 {
24  DDCompactView cpv;
25  DDExpandedView ev(cpv);
26  ev.goTo(_ddd);
27  _params = ((ev.logicalPart()).solid()).parameters();
28  _trans = ev.translation();
29  _rot = ev.rotation();
30  _shape = ((ev.logicalPart()).solid()).shape();
31  _ddname = ((ev.logicalPart()).ddname()).name();
32  _parents = ev.geoHistory();
33  _volume = ((ev.logicalPart()).solid()).volume();
34  _density = ((ev.logicalPart()).material()).density();
35  _weight = _density * ( _volume / 1000.); // volume mm3->cm3
36  _copy = ev.copyno();
37  _material = ((ev.logicalPart()).material()).name();
38 }
39 
40 //----------------------------------------------------------------------------------------------------
41 
43 {
44  _ddd = fv->navPos();
45  _params = ((fv->logicalPart()).solid()).parameters();
46  _trans = fv->translation();
47  _rot = fv->rotation();
48  _shape = ((fv->logicalPart()).solid()).shape();
49  _ddname = ((fv->logicalPart()).ddname()).name();
50  _parents = fv->geoHistory();
51  _volume = ((fv->logicalPart()).solid()).volume();
52  _density = ((fv->logicalPart()).material()).density();
53  _weight = _density * ( _volume / 1000.); // volume mm3->cm3
54  _copy = fv->copyno();
55  _material = ((fv->logicalPart()).material()).name();
56 }
57 
58 //----------------------------------------------------------------------------------------------------
59 
61 {
62  _ddd = fv->navPos();
63  _params = ((fv->logicalPart()).solid()).parameters();
64  _trans = fv->translation();
65  _rot = fv->rotation();
66  _shape = ((fv->logicalPart()).solid()).shape();
67  _ddname = ((fv->logicalPart()).ddname()).name();
68  _parents = fv->geoHistory();
69  _volume = ((fv->logicalPart()).solid()).volume();
70  _density = ((fv->logicalPart()).material()).density();
71  _weight = _density * ( _volume / 1000.); // volume mm3->cm3
72  _copy = fv->copyno();
73  _material = ((fv->logicalPart()).material()).name();
74 }
75 
76 //----------------------------------------------------------------------------------------------------
77 
79 {
80  (*this) = ref;
81 }
82 
83 //----------------------------------------------------------------------------------------------------
84 
86 {
87  _ddd = ref._ddd;
88  _params = ref._params;
89  _trans = ref._trans;
90  _rot = ref._rot;
91  _shape = ref._shape;
92  _ddname = ref._ddname;
93  _parents = ref._parents;
94  _volume = ref._volume;
95  _density = ref._density;
96  _weight = ref._weight;
97  _copy = ref._copy;
98  _material = ref._material;
100  _type = ref._type;
101 
102  return (*this);
103 }
104 
105 //----------------------------------------------------------------------------------------------------
106 
108 {
110 }
111 
112 //----------------------------------------------------------------------------------------------------
113 
115 {
116  return _container;
117 }
118 
119 //----------------------------------------------------------------------------------------------------
120 
122 {
123  ConstContainer _temp;
124  for (Container::const_iterator it = _container.begin(); it != _container.end(); it++) {
125  _temp.push_back(*it);
126  }
127  return _temp;
128 }
129 
130 //----------------------------------------------------------------------------------------------------
131 
133 {
134  ConstContainer _temp;
135  if (isLeaf())
136  _temp.push_back(const_cast<DetGeomDesc*>(this));
137  else {
138  for (Container::const_iterator it = _container.begin();
139  it != _container.end(); it++){
140  ConstContainer _temp2 = (**it).deepComponents();
141  copy(_temp2.begin(), _temp2.end(), back_inserter(_temp));
142  }
143  }
144  return _temp;
145 }
146 
147 
148 //----------------------------------------------------------------------------------------------------
149 
151 {
152  for( Container::iterator ig = cont.begin(); ig != cont.end();ig++) {
153  _container.push_back(*ig);
154  }
155 }
156 
157 //----------------------------------------------------------------------------------------------------
158 
160 {
161  _container.push_back(det);
162 }
163 
164 //----------------------------------------------------------------------------------------------------
165 
167 {
168  _container.erase(_container.begin(), _container.end());
169 }
170 
171 //----------------------------------------------------------------------------------------------------
172 
174 {
175  for (Container::iterator it = _container.begin(); it != _container.end(); it++) {
176  ( const_cast<DetGeomDesc*>(*it) )->deepDeleteComponents();
177  delete (*it);
178  }
179  clearComponents();
180 }
181 
182 //----------------------------------------------------------------------------------------------------
183 
185 {
186  //cout << " DetGeomDesc::ApplyAlignment > before: " << _trans << ", " << _rot << endl;
187  _rot = t.getRotationMatrix() * _rot;
188  _trans = t.getTranslation() + _trans;
189  //cout << " DetGeomDesc::ApplyAlignment > after: " << _trans << ", " << _rot << endl;
190 }
std::vector< DDExpandedNode > _parents
Definition: DetGeomDesc.h:112
type
Definition: HCALResponse.h:21
const DDRotationMatrix & rotation() const
The absolute rotation of the current node.
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
DetGeomDesc(nav_type navtype, GeometricEnumType dd=0)
Constructors to be used when looping over DDD.
Definition: DetGeomDesc.cc:22
DDSolidShape _shape
Definition: DetGeomDesc.h:107
void addComponents(Container cont)
Definition: DetGeomDesc.cc:150
RotationMatrix getRotationMatrix() const
DetId _geographicalID
Definition: DetGeomDesc.h:111
DetGeomDesc & operator=(const DetGeomDesc &)
Definition: DetGeomDesc.cc:85
const DDRotationMatrix & rotation() const
The absolute rotation of the current node.
DDRotationMatrix _rot
Definition: DetGeomDesc.h:106
virtual double density() const
Definition: DetGeomDesc.h:95
void clearComponents()
Definition: DetGeomDesc.h:78
bool ev
nav_type navPos() const
return the stack of sibling numbers
DDExpandedView::nav_type nav_type
Definition: DetGeomDesc.h:45
double _volume
Definition: DetGeomDesc.h:113
type of data representation of DDCompactView
Definition: DDCompactView.h:90
const DDGeoHistory & geoHistory() const
The list of ancestors up to the root-node of the current node.
void deepDeleteComponents()
deletes just the first daughters
Definition: DetGeomDesc.cc:173
nav_type navPos() const
return the stack of sibling numbers which indicates the current position in the DDExpandedView ...
const DDGeoHistory & geoHistory() const
The list of ancestors up to the root-node of the current node.
int copyno() const
Copy number associated with the current node.
virtual ~DetGeomDesc()
destructor
Definition: DetGeomDesc.cc:107
const math::XYZVectorD & getTranslation() const
void ApplyAlignment(const RPAlignmentCorrectionData &)
alignment
Definition: DetGeomDesc.cc:184
DDTranslation _trans
Definition: DetGeomDesc.h:105
virtual ConstContainer components() const
access to the tree structure
Definition: DetGeomDesc.cc:121
Geometrical description of a detector.
Definition: DetGeomDesc.h:40
std::vector< DetGeomDesc * > Container
Definition: DetGeomDesc.h:44
Alignment correction or result of alignment procedure for a single RP sensor. Within the geometry des...
DDName name() const
Definition: DetGeomDesc.h:90
virtual std::string material() const
Definition: DetGeomDesc.h:97
const DDTranslation & translation() const
The absolute translation of the current node.
GeometricEnumType _type
Definition: DetGeomDesc.h:109
virtual double volume() const
Definition: DetGeomDesc.h:94
void deleteComponents()
Definition: DetGeomDesc.cc:166
int copyno() const
Copy number associated with the current node.
double _density
Definition: DetGeomDesc.h:114
double _weight
Definition: DetGeomDesc.h:115
std::vector< double > _params
Definition: DetGeomDesc.h:110
nav_type _ddd
Definition: DetGeomDesc.h:104
std::vector< const DetGeomDesc * > ConstContainer
Definition: DetGeomDesc.h:43
unsigned int GeometricEnumType
a type (not used in the moment, left for the future)
Definition: DetGeomDesc.h:48
DDName _ddname
Definition: DetGeomDesc.h:108
bool goTo(const nav_type &)
transversed the DDExpandedView according to the given stack of sibling numbers
Container _container
Definition: DetGeomDesc.h:103
const DDTranslation & translation() const
The absolute translation of the current node.
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the expanded-view.
std::string _material
Definition: DetGeomDesc.h:117
virtual ConstContainer deepComponents() const
Definition: DetGeomDesc.cc:132
Provides an exploded view of the detector (tree-view)
void addComponent(DetGeomDesc *)
Definition: DetGeomDesc.cc:159
DDSolidShape shape() const
Definition: DetGeomDesc.h:88
bool isLeaf() const
traverses the treee and deletes all nodes.
Definition: DetGeomDesc.h:82