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 // Author     : M.Frank
0011 //
0012 //==========================================================================
0013 
0014 // Framework includes
0015 #include "DD4hep/DetFactoryHelper.h"
0016 
0017 using namespace dd4hep;
0018 using namespace dd4hep::detail;
0019 
0020 static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector sens)  {
0021   xml_dim_t x_det = e;  
0022   DetElement det(x_det.nameStr(),x_det.id());
0023 
0024   Volume node(       "node",        Box(170, 70, 70), description.air());
0025   Volume otherParent("otherparent", Box( 50, 50, 50), description.air());
0026   Volume otherNode(  "othernode",   Box(100, 50, 50), description.material("Iron"));
0027   Volume parent(     "parent",      Box(90,  40, 40), description.material("Iron"));
0028   Volume container(  "container",   Box(30,  30, 30), description.air());
0029   Volume child(      "child",       Box(20,  20, 20), description.material("Iron"));
0030 
0031   sens.setType("tracker");
0032   
0033   node.setVisAttributes(        description, x_det.visStr());
0034   otherParent.setVisAttributes( description, "Shape0_vis");
0035   otherNode.setVisAttributes(   description, "Shape1_vis");
0036   parent.setVisAttributes(      description, "Shape2_vis");
0037   container.setVisAttributes(   description, "Shape3_vis");
0038   child.setVisAttributes(       description, "Shape4_vis");
0039   child.setSensitiveDetector(sens);
0040   
0041   auto pv = container.placeVolume( child );
0042   pv.addPhysVolID( "child", 0);
0043   pv = parent.placeVolume( container, Position( 45, 0, 0) );
0044   pv.addPhysVolID( "container", 0);
0045   pv = parent.placeVolume( container, Position(-45, 0, 0) );
0046   pv.addPhysVolID( "container", 1);
0047   pv = otherNode.placeVolume( parent );
0048   pv.addPhysVolID( "parent", 0);
0049   pv = node.placeVolume( otherNode,   Position( 60, 0, 0) );
0050   pv.addPhysVolID( "node", 0);
0051 
0052   pv = otherParent.placeVolume( container );
0053   pv.addPhysVolID( "container",3);
0054   pv.addPhysVolID( "parent", 1);
0055   pv = node.placeVolume( otherParent, Position(-110, 0, 0) );
0056   pv.addPhysVolID( "node", 1);
0057 
0058   // Place the calo inside the world
0059   auto mother = description.pickMotherVolume(det);
0060   pv = mother.placeVolume(node);
0061   pv.addPhysVolID( "system",x_det.id() );
0062   det.setPlacement(pv);
0063   return det;
0064 }
0065 
0066 DECLARE_DETELEMENT(Issue_786,create_detector)