Back to home page

EIC code displayed by LXR

 
 

    


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

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   string      name  = x_det.nameStr();
0026   xml_comp_t  box    (x_det.child(_U(box)));
0027   xml_dim_t   pos    (x_det.child(_U(position)));
0028   xml_dim_t   rot    (x_det.child(_U(rotation)));
0029   Material    mat    (description.material(x_det.materialStr()));
0030   DetElement  det    (name,x_det.id());
0031   Volume      det_vol(name+"_vol",Box(box.x(),box.y(),box.z()), mat);
0032   Volume      mother = description.pickMotherVolume(det);
0033   Transform3D transform(Rotation3D(RotationZYX(rot.z(),rot.y(),rot.x())),Position(pos.x(),pos.y(),pos.z()));
0034   PlacedVolume phv = mother.placeVolume(det_vol,transform);
0035 
0036   det_vol.setVisAttributes(description, x_det.visStr());
0037   det_vol.setLimitSet(description, x_det.limitsStr());
0038   det_vol.setRegion(description, x_det.regionStr());
0039   if ( x_det.isSensitive() )   {
0040     SensitiveDetector sd = sens;
0041     xml_dim_t sd_typ = x_det.child(_U(sensitive));
0042     det_vol.setSensitiveDetector(sens);
0043     sd.setType(sd_typ.typeStr());
0044   }
0045   if ( x_det.hasAttr(_U(id)) )  {
0046     phv.addPhysVolID("system",x_det.id());
0047   }
0048   det.setPlacement(phv);
0049   return det;
0050 }
0051 
0052 // first argument is the type from the xml file
0053 DECLARE_DETELEMENT(Lhe_BoxSegment,create_element)