Skip to content
Snippets Groups Projects
cb_CTD_Straw.cpp 1.16 KiB
Newer Older
  • Learn to ignore specific revisions
  • Jihee Kim's avatar
    Jihee Kim committed
    #include <XML/Helper.h>
    //////////////////////////////////
    // Central Barrel Tracker Straw
    //////////////////////////////////
    
    using namespace std;
    using namespace dd4hep;
    
    static Ref_t createDetector(Detector& desc, xml_h e, SensitiveDetector sens)
    {
      xml_det_t  x_det      = e;
      string     detName    = x_det.nameStr();
      int        detID      = x_det.id();
    
      xml_dim_t  dim        = x_det.dimensions();
      double     RIn        = dim.rmin();
      double     ROut       = dim.rmax();
      double     SizeZ      = dim.length();
      double     SizeZCut   = dim.zmax();
    
      Material   Vacuum     = desc.material("Vacuum");
    
      // Create Global Volume 
      Tube cb_CTD_GVol_Solid(RIn, ROut, SizeZ / 2.0, 0., 360.0 * deg);
      Volume detVol("cb_CTD_GVol_Logic", cb_CTD_GVol_Solid, Vacuum);
      detVol.setVisAttributes(desc.visAttributes(x_det.visStr()));
    
      DetElement   det(detName, detID);
      Volume       motherVol = desc.pickMotherVolume(det);
      Transform3D  tr(RotationZYX(0.0, 0.0, 0.0), Position(0.0, 0.0, 0.0));
      PlacedVolume detPV = motherVol.placeVolume(detVol, tr);
      detPV.addPhysVolID("system", detID);
      det.setPlacement(detPV);
      return det;
    }
    
    DECLARE_DETELEMENT(cb_CTD_Straw, createDetector)