Back to home page

EIC code displayed by LXR

 
 

    


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

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 //--------------------------------------------------------------------
0011 //
0012 //  Author     : M.Frank
0013 //  Modified   : E.Pilicer ( tube + elliptical pipe layout )
0014 //
0015 //====================================================================
0016 #include "DD4hep/DetFactoryHelper.h"
0017 #include "XML/Layering.h"
0018 
0019 using namespace std;
0020 using namespace dd4hep;
0021 using namespace dd4hep::detail;
0022 
0023 static Ref_t create_detector(Detector& description, xml_h e, Ref_t)    {
0024   xml_det_t  x_det = e;
0025   string     name  = x_det.nameStr();
0026   DetElement sdet (name,x_det.id());
0027   Material   mat  (description.material(x_det.materialStr()));
0028 
0029   // multiplication factor for ellipse major radius
0030   double c0 = 3.5;
0031   double rmin = 0.0, rmax = 0.0, z = 0.0;
0032 
0033   for(xml_coll_t c(x_det,_U(zplane)); c; ++c)  {
0034     xml_comp_t dim(c);
0035     rmin = dim.rmin();
0036     rmax = dim.rmax();
0037     z    = dim.z();
0038   }
0039  
0040   double ra    = rmax * c0;      // elipse long radius
0041   double rb    = rmax;           // elipse short radius
0042   double thick = rmax - rmin;    // pipe wall thickness
0043  
0044   EllipticalTube bpElTubeOut(ra+thick, rb+thick, z);
0045   EllipticalTube bpElTubeInn(ra, rb, z+thick);
0046   SubtractionSolid bpElTube(bpElTubeOut,bpElTubeInn);
0047 
0048   Tube bpTube1(rb, rb+thick, z+thick, 3*M_PI/2, M_PI/2);
0049   UnionSolid beamTube1(bpElTube,bpTube1);
0050 
0051   Tube bpTube2(rb+thick, ra+thick, z+thick, 3*M_PI/2, M_PI/2);
0052   SubtractionSolid beamTube(beamTube1,bpTube2);
0053   
0054   Volume     volume(name, beamTube, mat);
0055   
0056   double z_offset = x_det.hasAttr(_U(z_offset)) ? x_det.z_offset() : 0.0;
0057 
0058   volume.setVisAttributes(description, x_det.visStr());
0059   PlacedVolume pv = description.pickMotherVolume(sdet).placeVolume(volume,Position(0,0,z_offset));
0060   sdet.setPlacement(pv);
0061   
0062   if ( x_det.hasAttr(_U(id)) )  {
0063     int det_id = x_det.id();
0064     pv.addPhysVolID("system",det_id);
0065   }
0066   return sdet;
0067 }
0068 
0069 DECLARE_DETELEMENT(LheD_tracker_BeamPipe,create_detector)
0070