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 detector object: DDCore/XML/XMLDetector.h
0022   xml_dim_t x_det = e;  
0023   //Create the DetElement for dd4hep
0024   DetElement d_det(x_det.nameStr(),x_det.id());
0025 
0026   // XML dimension object: DDCore/XML/XMLDimension.h
0027   xml_dim_t x_det_dim(x_det.dimensions());
0028   double    inner_r = x_det_dim.rmin();
0029   double    outer_r = x_det_dim.rmax();
0030   Assembly  calo_vol(x_det.nameStr()+"_envelope");
0031 
0032   // Set envelope volume attributes
0033   calo_vol.setAttributes(description,x_det.regionStr(),x_det.limitsStr(),x_det.visStr());
0034 
0035   // Declare this sensitive detector as a calorimeter
0036   Tube tub(inner_r,outer_r,x_det_dim.z()/2.0,0.0,2*M_PI);
0037   Volume tub_vol(x_det.nameStr()+"_tube",tub,description.material("Iron"));
0038   calo_vol.placeVolume(tub_vol).addPhysVolID("module",1);
0039   sens.setType("calorimeter");
0040   tub_vol.setSensitiveDetector(sens);
0041   d_det.setAttributes(description,tub_vol,x_det.regionStr(),x_det.limitsStr(),x_det.visStr());
0042 
0043   // Place the calo inside the world
0044   PlacedVolume  calo_plv = description.pickMotherVolume(d_det).placeVolume(calo_vol);
0045   calo_plv.addPhysVolID("system",x_det.id());
0046   calo_plv.addPhysVolID("barrel",0);
0047   d_det.setPlacement(calo_plv);
0048   return d_det;
0049 }
0050 
0051 DECLARE_DETELEMENT(IronCylinder,create_detector)