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 
10 #include <utility>
11 
13 
17 
19 
20 using namespace std;
21 
22 //----------------------------------------------------------------------------------------------------
23 
24 DetGeomDesc::DetGeomDesc(nav_type navtype, GeometricEnumType type) : _ddd(std::move(navtype)), _type(type)
25 {
26  DDCompactView cpv;
27  DDExpandedView ev(cpv);
28  ev.goTo(_ddd);
29  _params = ((ev.logicalPart()).solid()).parameters();
30  _trans = ev.translation();
31  _rot = ev.rotation();
32  _shape = ((ev.logicalPart()).solid()).shape();
33  _name = ((ev.logicalPart()).ddname()).name();
34  _parents = ev.geoHistory();
35  _volume = ((ev.logicalPart()).solid()).volume();
36  _density = ((ev.logicalPart()).material()).density();
37  _weight = _density * ( _volume / 1000.); // volume mm3->cm3
38  _copy = ev.copyno();
39  _material = ((ev.logicalPart()).material()).name().fullname();
40 }
41 
42 //----------------------------------------------------------------------------------------------------
43 
45 {
46  _ddd = fv->navPos();
47  _params = ((fv->logicalPart()).solid()).parameters();
48  _trans = fv->translation();
49  _rot = fv->rotation();
50  _shape = ((fv->logicalPart()).solid()).shape();
51  _name = ((fv->logicalPart()).ddname()).name();
52  _parents = fv->geoHistory();
53  _volume = ((fv->logicalPart()).solid()).volume();
54  _density = ((fv->logicalPart()).material()).density();
55  _weight = _density * ( _volume / 1000.); // volume mm3->cm3
56  _copy = fv->copyno();
57  _material = ((fv->logicalPart()).material()).name().fullname();
58 }
59 
60 //----------------------------------------------------------------------------------------------------
61 
63 {
64  _ddd = fv->navPos();
65  _params = ((fv->logicalPart()).solid()).parameters();
66  _trans = fv->translation();
67  _rot = fv->rotation();
68  _shape = ((fv->logicalPart()).solid()).shape();
69  _name = ((fv->logicalPart()).ddname()).name();
70  _parents = fv->geoHistory();
71  _volume = ((fv->logicalPart()).solid()).volume();
72  _density = ((fv->logicalPart()).material()).density();
73  _weight = _density * ( _volume / 1000.); // volume mm3->cm3
74  _copy = fv->copyno();
75  _material = ((fv->logicalPart()).material()).name().fullname();
76 }
77 
78 //----------------------------------------------------------------------------------------------------
79 
81 {
82  (*this) = ref;
83 }
84 
85 //----------------------------------------------------------------------------------------------------
86 
88 {
89  _ddd = ref._ddd;
90  _params = ref._params;
91  _trans = ref._trans;
92  _rot = ref._rot;
93  _shape = ref._shape;
94  _name = ref._name;
95  _parents = ref._parents;
96  _volume = ref._volume;
97  _density = ref._density;
98  _weight = ref._weight;
99  _copy = ref._copy;
100  _material = ref._material;
102  _type = ref._type;
103 
104  return (*this);
105 }
106 
107 //----------------------------------------------------------------------------------------------------
108 
110 {
112 }
113 
114 //----------------------------------------------------------------------------------------------------
115 
117 {
118  return _container;
119 }
120 
121 //----------------------------------------------------------------------------------------------------
122 
124 {
125  ConstContainer _temp;
126  for (auto it : _container) {
127  _temp.emplace_back(it);
128  }
129  return _temp;
130 }
131 
132 //----------------------------------------------------------------------------------------------------
133 
135 {
136  ConstContainer _temp;
137  if (isLeaf())
138  _temp.emplace_back(const_cast<DetGeomDesc*>(this));
139  else {
140  for (auto it : _container){
141  ConstContainer _temp2 = (*it).deepComponents();
142  copy(_temp2.begin(), _temp2.end(), back_inserter(_temp));
143  }
144  }
145  return _temp;
146 }
147 
148 
149 //----------------------------------------------------------------------------------------------------
150 
152 {
153  for(auto & ig : cont) {
154  _container.emplace_back(ig);
155  }
156 }
157 
158 //----------------------------------------------------------------------------------------------------
159 
161 {
162  _container.emplace_back(det);
163 }
164 
165 //----------------------------------------------------------------------------------------------------
166 
168 {
169  _container.erase(_container.begin(), _container.end());
170 }
171 
172 //----------------------------------------------------------------------------------------------------
173 
175 {
176  for (auto & it : _container) {
177  ( const_cast<DetGeomDesc*>(it) )->deepDeleteComponents();
178  delete it;
179  }
180  clearComponents();
181 }
182 
183 //----------------------------------------------------------------------------------------------------
184 
186 {
187  //cout << " DetGeomDesc::ApplyAlignment > before: " << _trans << ", " << _rot << endl;
188  _rot = t.getRotationMatrix() * _rot;
189  _trans = t.getTranslation() + _trans;
190  //cout << " DetGeomDesc::ApplyAlignment > after: " << _trans << ", " << _rot << endl;
191 }
std::vector< DDExpandedNode > _parents
Definition: DetGeomDesc.h:109
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:24
DDSolidShape _shape
Definition: DetGeomDesc.h:104
def copy(args, dbName)
void addComponents(Container cont)
Definition: DetGeomDesc.cc:151
DetId _geographicalID
Definition: DetGeomDesc.h:108
DetGeomDesc & operator=(const DetGeomDesc &)
Definition: DetGeomDesc.cc:87
const DDRotationMatrix & rotation() const
The absolute rotation of the current node.
DDRotationMatrix _rot
Definition: DetGeomDesc.h:103
virtual double density() const
Definition: DetGeomDesc.h:92
void clearComponents()
Definition: DetGeomDesc.h:75
bool ev
nav_type navPos() const
return the stack of sibling numbers
DDExpandedView::nav_type nav_type
Definition: DetGeomDesc.h:42
double _volume
Definition: DetGeomDesc.h:110
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:80
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:174
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:109
std::string _name
Definition: DetGeomDesc.h:105
math::XYZVectorD getTranslation() const
void ApplyAlignment(const RPAlignmentCorrectionData &)
alignment
Definition: DetGeomDesc.cc:185
DDTranslation _trans
Definition: DetGeomDesc.h:102
virtual ConstContainer components() const
access to the tree structure
Definition: DetGeomDesc.cc:123
const std::string fullname() const
Definition: DDName.h:43
Geometrical description of a sensor.
Definition: DetGeomDesc.h:37
std::vector< DetGeomDesc * > Container
Definition: DetGeomDesc.h:41
Alignment correction for an element of the CT-PPS detector. Within the geometry description, every sensor (more generally every element) is given its translation and rotation. These two quantities shall be understood in local-to-global coordinate transform. That is, if r_l is a point in local coordinate system and x_g in global, then it holds.
DDName name() const
Definition: DetGeomDesc.h:87
virtual std::string material() const
Definition: DetGeomDesc.h:94
ROOT::Math::Rotation3D getRotationMatrix() const
const DDTranslation & translation() const
The absolute translation of the current node.
GeometricEnumType _type
Definition: DetGeomDesc.h:106
virtual double volume() const
Definition: DetGeomDesc.h:91
void deleteComponents()
Definition: DetGeomDesc.cc:167
int copyno() const
Copy number associated with the current node.
double _density
Definition: DetGeomDesc.h:111
double _weight
Definition: DetGeomDesc.h:112
std::vector< double > _params
Definition: DetGeomDesc.h:107
nav_type _ddd
Definition: DetGeomDesc.h:101
std::vector< const DetGeomDesc * > ConstContainer
Definition: DetGeomDesc.h:40
unsigned int GeometricEnumType
a type (not used in the moment, left for the future)
Definition: DetGeomDesc.h:45
bool goTo(const nav_type &)
transversed the DDExpandedView according to the given stack of sibling numbers
Container _container
Definition: DetGeomDesc.h:100
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:114
virtual ConstContainer deepComponents() const
Definition: DetGeomDesc.cc:134
Provides an exploded view of the detector (tree-view)
void addComponent(DetGeomDesc *)
Definition: DetGeomDesc.cc:160
def move(src, dest)
Definition: eostools.py:511
DDSolidShape shape() const
Definition: DetGeomDesc.h:85
bool isLeaf() const
traverses the treee and deletes all nodes.
Definition: DetGeomDesc.h:79