Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:14:58

0001 //==========================================================================
0002 //  AIDA Detector description implementation 
0003 //--------------------------------------------------------------------------
0004 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
0005 // All rights reserved.
0006 //
0007 // For the licensing terms see $DD4hepINSTALL/LICENSE.
0008 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
0009 //
0010 // Author     : M.Frank
0011 //
0012 //==========================================================================
0013 //
0014 // Specialized generic detector constructor
0015 // 
0016 //==========================================================================
0017 #include "DD4hep/DetFactoryHelper.h"
0018 
0019 using namespace std;
0020 using namespace dd4hep;
0021 using namespace dd4hep::detail;
0022 
0023 static Ref_t create_element(Detector& description, xml_h e, Ref_t sens)  {
0024   xml_det_t  x_det  (e);
0025   xml_comp_t x_tube = x_det.tubs();
0026   xml_dim_t  pos    = x_det.position();
0027   xml_dim_t  rot    = x_det.rotation();
0028   string     name   = x_det.nameStr();
0029   Tube       tub    (x_tube.rmin(),x_tube.rmax(),x_tube.zhalf());
0030   Volume     vol    (name,tub,description.material(x_det.materialStr()));
0031 
0032   vol.setVisAttributes(description, x_det.visStr());
0033   vol.setLimitSet(description, x_det.limitsStr());
0034   vol.setRegion(description, x_det.regionStr());
0035   if ( x_det.isSensitive() )   {
0036     SensitiveDetector sd = sens;
0037     xml_dim_t sd_typ = x_det.child(_U(sensitive));
0038     vol.setSensitiveDetector(sens);
0039     sd.setType(sd_typ.typeStr());
0040   }
0041 
0042   DetElement   sdet(name,x_det.id());
0043   Volume       mother = description.pickMotherVolume(sdet);
0044   PlacedVolume phv = 
0045     mother.placeVolume(vol,Transform3D(RotationZYX(rot.z(),rot.y(),rot.x()),Position(-pos.x(),-pos.y(),pos.z())));
0046   if ( x_det.hasAttr(_U(id)) )  {
0047     phv.addPhysVolID("system",x_det.id());
0048   }
0049   sdet.setPlacement(phv);
0050   return sdet;
0051 }
0052 
0053 DECLARE_DETELEMENT(Lhe_TubeSegment,create_element)