DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
PolyhedraEndcapCalorimeter2_surfaces.cpp
Go to the documentation of this file.
1 //==========================================================================
2 // AIDA Detector description implementation
3 //--------------------------------------------------------------------------
4 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
5 // All rights reserved.
6 //
7 // For the licensing terms see $DD4hepINSTALL/LICENSE.
8 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
9 //
10 // Author : M.Frank
11 //
12 //==========================================================================
13 //
14 // Specialized generic detector constructor
15 //
16 //==========================================================================
17 // Framework include files
18 #define DD4HEP_USE_SURFACEINSTALL_HELPER DD4hep_PolyhedraEndcapCalorimeterSurfacePlugin
20 
22 template <typename UserData>
23 void Installer<UserData>::install(dd4hep::DetElement component, dd4hep::PlacedVolume pv) {
24  dd4hep::Volume comp_vol = pv.volume();
25  if ( comp_vol.isSensitive() ) {
26  dd4hep::Volume mod_vol = parentVolume(component);
27  dd4hep::PolyhedraRegular comp_shape(comp_vol.solid()), mod_shape(mod_vol.solid());
28 
29  if ( !comp_shape.isValid() || !mod_shape.isValid() ) {
30  invalidInstaller("Components and/or modules are not Trapezoid -- invalid shapes");
31  }
32  else if ( !handleUsingCache(component,comp_vol) ) {
33  dd4hep::DetElement par = component.parent();
34  dd4hep::Alignment nom = par.nominal();
35  const TGeoHMatrix& m = nom.worldTransformation();
36  double dz = m.GetTranslation()[2];
37  const double* trans = placementTranslation(component);
38  double half_mod_thickness = (mod_shape->GetZ(1)-mod_shape->GetZ(0))/2.0;
39  double half_comp_thickness = (comp_shape->GetZ(1)-comp_shape->GetZ(0))/2.0;
40  double si_position = trans[2]+half_mod_thickness;
41  double outer_thickness = half_mod_thickness - si_position;
42  double inner_thickness = half_mod_thickness + si_position;
43  Vector3D u(1.,0.,0.), v(0.,1.,0.), n(0.,0.,1.), o(100.,100.,0.);
44  std::cout << " Module: " << mod_shape.toString() << std::endl;
45  std::cout << " Component: " << comp_shape.toString() << std::endl;
46  std::cout << "dz:" << dz << " Si-pos:" << si_position
47  << " Mod-thickness:" << half_mod_thickness
48  << " Comp-thickness:" << half_comp_thickness
49  << std::endl;
50  VolPlane surf(comp_vol,Type(Type::Sensitive,Type::Measurement1D),
51  inner_thickness, outer_thickness, u, v, n, o);
52  addSurface(component,surf);
53  }
54  }
55 }
SurfaceInstaller.h
dd4hep::PolyhedraRegular
Class describing a regular polyhedron shape.
Definition: Shapes.h:1493
v
View * v
Definition: MultiView.cpp:28
dd4hep::DetElement::parent
DetElement parent() const
Access to the detector elements's parent.
Definition: DetElement.cpp:239
dd4hep::PlacedVolume
Handle class holding a placed volume (also called physical volume)
Definition: Volumes.h:173
dd4hep::Volume::solid
Solid solid() const
Access to Solid (Shape)
Definition: Volumes.cpp:1223
dd4hep::Handle::isValid
bool isValid() const
Check the validity of the object held by the handle.
Definition: Handle.h:128
dd4hep::Volume::isSensitive
bool isSensitive() const
Accessor if volume is sensitive (ie. is attached to a sensitive detector)
Definition: Volumes.cpp:1293
dd4hep::rec::VolPlane
VolSurfaceHandle< VolPlaneImpl > VolPlane
Definition: Surface.h:474
dd4hep::DetElement
Handle class describing a detector element.
Definition: DetElement.h:188
dd4hep::Volume
Handle class holding a placed volume (also called physical volume)
Definition: Volumes.h:378
dd4hep::Alignment::worldTransformation
const TGeoHMatrix & worldTransformation() const
Create cached matrix to transform to world coordinates.
Definition: Alignments.cpp:68
dd4hep::Alignment
Main handle class to hold an alignment object.
Definition: Alignments.h:115
dd4hep::DetElement::nominal
Alignment nominal() const
Access to the constant ideal (nominal) alignment information.
Definition: DetElement.cpp:185
dd4hep::Solid_type::toString
std::string toString(int precision=2) const
Conversion to string for pretty print.
Definition: Shapes.h:190
dd4hep::PlacedVolume::volume
Volume volume() const
Logical volume of this placement.
Definition: Volumes.cpp:452
dd4hep::sim::Setup::Sensitive
Geant4Handle< Geant4Sensitive > Sensitive
Definition: Geant4Config.h:73