CMS 3D CMS Logo

GeometricDet.h
Go to the documentation of this file.
1 #ifndef Geometry_TrackerNumberingBuilder_GeometricDet_H
2 #define Geometry_TrackerNumberingBuilder_GeometricDet_H
3 
11 
12 #include <DD4hep/Shapes.h>
13 #include <Math/Rotation3D.h>
14 #include <Math/Vector3D.h>
15 
16 #include <vector>
17 #include <memory>
18 #include <ext/pool_allocator.h>
19 
20 class DDFilteredView;
21 
22 namespace cms {
23  class DDFilteredView;
24 }
25 
31 class GeometricDet {
32 public:
33  using NavRange = std::pair<int const*, size_t>;
34  using ConstGeometricDetContainer = std::vector<GeometricDet const*>;
35  using GeometricDetContainer = std::vector<GeometricDet*>;
36  using RotationMatrix = ROOT::Math::Rotation3D;
37  using Translation = ROOT::Math::DisplacementVector3D<ROOT::Math::Cartesian3D<double> >;
38 
39 #ifdef PoolAlloc
40  using nav_type = std::vector<int, PoolAlloc<int> >;
41 #else
42  using nav_type = std::vector<int>;
43 #endif
44 
47 
48  typedef enum GDEnumType {
49  unknown = 100,
50  Tracker = 0,
53  TIB = 3,
54  TID = 4,
55  TOB = 5,
56  TEC = 6,
57  layer = 8,
58  wheel = 9,
59  strng = 10,
60  rod = 11,
61  petal = 12,
62  ring = 13,
63  ladder = 14,
64  mergedDet = 15,
65  DetUnit = 16,
66  disk = 17,
67  panel = 18,
82 
83  // Constructors from Filtered View (called while looping over DD).
86  // Constructors from persistent data (from DB)
88 
89  // ACCESS GENERAL INFO
90  const std::string& name() const { return ddname_; }
91  const GeometricEnumType& type() const { return type_; }
92 
93  // NAVIGATION related info
94  const nav_type& navType() const { return ddd_; }
95  NavRange navpos() const { return NavRange(&ddd_.front(), ddd_.size()); }
96  const DetId& geographicalId() const { return geographicalID_; }
98 
99  // VOLUME POSITION in CMS frame of reference
100  const Translation& translation() const { return trans_; } // in mm
101  double rho() const { return rho_; } // in mm
102  double phi() const { return phi_; }
103  const RotationMatrix& rotation() const { return rot_; }
104 
105  // BOUNDS
106  std::unique_ptr<Bounds> bounds() const;
107  Position positionBounds() const; // in cm
108  Rotation rotationBounds() const;
109 
110  // SOLID SHAPE
111  // old DD
113  // DD4hep
114  const cms::DDSolidShape& shape_dd4hep() const { return shape_; }
115  // solid shape parameters
116  const std::vector<double>& params() const {
119  edm::LogError("GeometricDet::params()")
120  << "Called on a shape which is neither a box, a trap, nor a tub. This is not supported!";
121  }
122  return params_;
123  } // in mm
124 
125  // RADIATION LENGTH AND ENERGY LOSS
126  double radLength() const { return radLength_; }
127  double xi() const { return xi_; }
128 
129  // SENSOR INFO
130  // Only return meaningful results for pixels.
131  double pixROCRows() const { return pixROCRows_; }
132  double pixROCCols() const { return pixROCCols_; }
133  double pixROCx() const { return pixROCx_; }
134  double pixROCy() const { return pixROCy_; }
135  // Only return meaningful results for Outer Trackers.
136  bool stereo() const { return stereo_; }
137  bool isLowerSensor() const { return isLowerSensor_; }
138  bool isUpperSensor() const { return isUpperSensor_; }
139  double siliconAPVNum() const { return siliconAPVNum_; }
140 
141  // DETECTOR DESCRIPTION ORIGIN INFO
142  bool isFromDD4hep() const { return isFromDD4hep_; }
143 
144  // CHILDREN INFO
145  GeometricDet* component(size_t index) { return const_cast<GeometricDet*>(container_[index]); }
146  bool isLeaf() const { return container_.empty(); }
147  // direct children only
148  // if the current GeometricDet is a leaf, it returns nothing.
151  // all descendants
152  // if the current GeometricDet is a leaf, it returns itself!
155 
156  // PUBLIC SETTERS (they should obviously be as few as possible!!)
159  void addComponent(GeometricDet*);
160  void clearComponents() { container_.clear(); } // only empties the container, THE CHILDREN ARE NOT DELETED!
161  void deleteComponents(); // EXPLICITLY DELETES THE CHILDREN
162 
163  // CUSTOM DESTRUCTOR
164  ~GeometricDet();
165 
166 private:
167  std::vector<double> computeLegacyShapeParameters(const cms::DDSolidShape& mySolidShape,
168  const dd4hep::Solid& mySolid) const;
169 
172 
175 
176  Translation trans_; // in mm
177  double rho_; // in mm
178  double phi_;
180 
182  std::vector<double> params_; // in mm
183 
184  double radLength_;
185  double xi_;
186  double pixROCRows_;
187  double pixROCCols_;
188  double pixROCx_;
189  double pixROCy_;
190  bool stereo_;
194 
196 
198 };
199 
200 #undef PoolAlloc
201 #endif
GeometricDet::phi
double phi() const
Definition: GeometricDet.h:102
GeometricDet::ddname_
std::string ddname_
Definition: GeometricDet.h:170
TkRotation< float >
GeometricDet::OTPhase2Layer
Definition: GeometricDet.h:73
GeometricDet::rot_
RotationMatrix rot_
Definition: GeometricDet.h:179
GeometricDet::positionBounds
Position positionBounds() const
Definition: GeometricDet.cc:204
GeometricDet::PixelEndCap
Definition: GeometricDet.h:52
GeometricDet::geographicalID_
DetId geographicalID_
Definition: GeometricDet.h:174
GeometricDet::navpos
NavRange navpos() const
Definition: GeometricDet.h:95
DDSolidShape
DDSolidShape
Definition: DDSolidShapes.h:6
MessageLogger.h
GeometricDet::isLowerSensor
bool isLowerSensor() const
Definition: GeometricDet.h:137
cms::DDSolidShape::ddtubs
GeometricDet::PixelPhase2ReducedDisk
Definition: GeometricDet.h:79
GeometricDet::petal
Definition: GeometricDet.h:61
types.h
GeometricDet::isUpperSensor_
bool isUpperSensor_
Definition: GeometricDet.h:192
GeometricDet::rod
Definition: GeometricDet.h:60
GeometricDet::components
ConstGeometricDetContainer & components()
Definition: GeometricDet.h:149
GeometricDet::TID
Definition: GeometricDet.h:54
cms::LegacySolidShapeMap
const std::array< const cms::dd::ValuePair< LegacySolidShape, cms::DDSolidShape >, 20 > LegacySolidShapeMap
Definition: DDSolidShapes.h:118
GeometricDet::DetUnit
Definition: GeometricDet.h:65
GeometricDet::~GeometricDet
~GeometricDet()
Definition: GeometricDet.cc:64
GeometricDet::ladder
Definition: GeometricDet.h:63
GeometricDet::rho_
double rho_
Definition: GeometricDet.h:177
generateEDF.cont
cont
load Luminosity info ##
Definition: generateEDF.py:629
GeometricDet::pixROCx_
double pixROCx_
Definition: GeometricDet.h:188
GeometricDet::isFromDD4hep_
bool isFromDD4hep_
Definition: GeometricDet.h:195
GeometricDet::isLowerSensor_
bool isLowerSensor_
Definition: GeometricDet.h:191
GeometricDet::PixelBarrel
Definition: GeometricDet.h:51
GeometricDet::container_
ConstGeometricDetContainer container_
Definition: GeometricDet.h:197
GeometricDet::OTPhase2Barrel
Definition: GeometricDet.h:72
GeometricDet::ring
Definition: GeometricDet.h:62
GeometricDet::translation
const Translation & translation() const
Definition: GeometricDet.h:100
GeometricDet::pixROCCols_
double pixROCCols_
Definition: GeometricDet.h:187
cms::DDFilteredView
Definition: DDFilteredView.h:70
GeometricDet::rotationBounds
Rotation rotationBounds() const
Definition: GeometricDet.cc:211
GloballyPositioned< float >::RotationType
TkRotation< float > RotationType
Definition: GloballyPositioned.h:22
GeometricDet::wheel
Definition: GeometricDet.h:58
GeometricDet::shape
LegacySolidShape shape() const
Definition: GeometricDet.h:112
GeometricDet::xi_
double xi_
Definition: GeometricDet.h:185
GeometricDet::Tracker
Definition: GeometricDet.h:50
GeometricDet::phi_
double phi_
Definition: GeometricDet.h:178
DetId
Definition: DetId.h:17
GeometricDet::PixelPhase1Disk
Definition: GeometricDet.h:70
GeometricDet::PixelPhase1EndCap
Definition: GeometricDet.h:69
GeometricDet::name
const std::string & name() const
Definition: GeometricDet.h:90
GeometricDet::mergedDet
Definition: GeometricDet.h:64
GeometricDet::deleteComponents
void deleteComponents()
Definition: GeometricDet.cc:258
GeometricDet::params
const std::vector< double > & params() const
Definition: GeometricDet.h:116
Surface.h
GeometricDet::shape_dd4hep
const cms::DDSolidShape & shape_dd4hep() const
Definition: GeometricDet.h:114
GeometricDet::setGeographicalID
void setGeographicalID(DetId id)
Definition: GeometricDet.h:97
GeometricDet::rotation
const RotationMatrix & rotation() const
Definition: GeometricDet.h:103
GeometricDet::PixelPhase2Barrel
Definition: GeometricDet.h:75
GeometricDet::computeLegacyShapeParameters
std::vector< double > computeLegacyShapeParameters(const cms::DDSolidShape &mySolidShape, const dd4hep::Solid &mySolid) const
Definition: GeometricDet.cc:274
DDSolidShapes.h
GeometricDet::disk
Definition: GeometricDet.h:66
GeometricDet
Definition: GeometricDet.h:31
GeometricDet::PixelPhase2TDRDisk
Definition: GeometricDet.h:80
Bounds.h
Point3DBase< float, GlobalTag >
GeometricDet::unknown
Definition: GeometricDet.h:49
createTree.dd
string dd
Definition: createTree.py:154
GeometricDet::GeometricEnumType
enum GeometricDet::GDEnumType GeometricEnumType
GeometricDet::radLength
double radLength() const
Definition: GeometricDet.h:126
GeometricDet::GDEnumType
GDEnumType
Definition: GeometricDet.h:48
cms::dd::value
Mapping::value_type::value_type value(Mapping a, const std::string &name)
Definition: DDSolidShapes.h:42
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
cms::DDSolidShape
DDSolidShape
Definition: DDSolidShapes.h:73
PGeometricDet::Item
Definition: PGeometricDet.h:14
GeometricDet::PixelPhase2EndCap
Definition: GeometricDet.h:76
GeometricDet::nav_type
std::vector< int > nav_type
Definition: GeometricDet.h:42
GeometricDet::stereo
bool stereo() const
Definition: GeometricDet.h:136
GeometricDet::geographicalId
const DetId & geographicalId() const
Definition: GeometricDet.h:96
GeometricDet::ddd_
nav_type ddd_
Definition: GeometricDet.h:173
GeometricDet::isFromDD4hep
bool isFromDD4hep() const
Definition: GeometricDet.h:142
GeometricDet::PixelPhase1Barrel
Definition: GeometricDet.h:68
GeometricDet::pixROCRows
double pixROCRows() const
Definition: GeometricDet.h:131
GeometricDet::trans_
Translation trans_
Definition: GeometricDet.h:176
GeometricDet::OTPhase2EndCap
Definition: GeometricDet.h:71
GeometricDet::type_
GeometricEnumType type_
Definition: GeometricDet.h:171
GeometricDet::radLength_
double radLength_
Definition: GeometricDet.h:184
cms::DDSolidShape::ddtrap
GeometricDet::RotationMatrix
ROOT::Math::Rotation3D RotationMatrix
Definition: GeometricDet.h:36
cms::DDSolidShape::ddbox
GeometricDet::TIB
Definition: GeometricDet.h:53
GeometricDet::addComponents
void addComponents(GeometricDetContainer const &cont)
Definition: GeometricDet.cc:240
GeometricDet::pixROCx
double pixROCx() const
Definition: GeometricDet.h:133
GeometricDet::components
const ConstGeometricDetContainer & components() const
Definition: GeometricDet.h:150
GeometricDet::GeometricDet
GeometricDet(DDFilteredView *fv, GeometricEnumType dd)
Definition: GeometricDet.cc:69
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
GeometricDet::panel
Definition: GeometricDet.h:67
GeometricDet::deepComponents
ConstGeometricDetContainer deepComponents() const
Definition: GeometricDet.cc:226
GeometricDet::rho
double rho() const
Definition: GeometricDet.h:101
GeometricDet::stereo_
bool stereo_
Definition: GeometricDet.h:190
GeometricDet::Position
Surface::PositionType Position
Definition: GeometricDet.h:45
GeometricDet::Rotation
Surface::RotationType Rotation
Definition: GeometricDet.h:46
GeometricDet::OTPhase2Wheel
Definition: GeometricDet.h:77
GeometricDet::component
GeometricDet * component(size_t index)
Definition: GeometricDet.h:145
GeometricDet::OTPhase2Stack
Definition: GeometricDet.h:74
GeometricDet::PixelPhase2FullDisk
Definition: GeometricDet.h:78
GeometricDet::bounds
std::unique_ptr< Bounds > bounds() const
Definition: GeometricDet.cc:199
GeometricDet::Translation
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > Translation
Definition: GeometricDet.h:37
GloballyPositioned< float >::PositionType
Point3DBase< float, GlobalTag > PositionType
Definition: GloballyPositioned.h:21
GeometricDet::ConstGeometricDetContainer
std::vector< GeometricDet const * > ConstGeometricDetContainer
Definition: GeometricDet.h:34
GeometricDet::TOB
Definition: GeometricDet.h:55
DetId.h
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
GeometricDet::pixROCRows_
double pixROCRows_
Definition: GeometricDet.h:186
GeometricDet::siliconAPVNum
double siliconAPVNum() const
Definition: GeometricDet.h:139
GeometricDet::siliconAPVNum_
double siliconAPVNum_
Definition: GeometricDet.h:193
GeometricDet::pixROCCols
double pixROCCols() const
Definition: GeometricDet.h:132
GeometricDet::xi
double xi() const
Definition: GeometricDet.h:127
GeometricDet::shape_
cms::DDSolidShape shape_
Definition: GeometricDet.h:181
GeometricDet::pixROCy
double pixROCy() const
Definition: GeometricDet.h:134
GeometricDet::layer
Definition: GeometricDet.h:57
GeometricDet::pixROCy_
double pixROCy_
Definition: GeometricDet.h:189
GeometricDet::isLeaf
bool isLeaf() const
Definition: GeometricDet.h:146
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
GeometricDet::GeometricDetContainer
std::vector< GeometricDet * > GeometricDetContainer
Definition: GeometricDet.h:35
PGeometricDet.h
DDFilteredView
Definition: DDFilteredView.h:20
GeometricDet::type
const GeometricEnumType & type() const
Definition: GeometricDet.h:91
GeometricDet::clearComponents
void clearComponents()
Definition: GeometricDet.h:160
GeometricDet::addComponent
void addComponent(GeometricDet *)
Definition: GeometricDet.cc:250
GeometricDet::TEC
Definition: GeometricDet.h:56
GeometricDet::NavRange
std::pair< int const *, size_t > NavRange
Definition: GeometricDet.h:33
GeometricDet::isUpperSensor
bool isUpperSensor() const
Definition: GeometricDet.h:138
cms
Namespace of DDCMS conversion namespace.
Definition: ProducerAnalyzer.cc:21
GeometricDet::params_
std::vector< double > params_
Definition: GeometricDet.h:182
GeometricDet::strng
Definition: GeometricDet.h:59
GeometricDet::navType
const nav_type & navType() const
Definition: GeometricDet.h:94