10 February 2023 0 10K Report

have recently started working with particle Detector Simulation and need some help in c++ and xml

Actually I have a Direct Photon Calorimeter (LumiDirectPCAL) as obvious in the attached ROOT file and I need to place a 5cm carbon filter at a distance of 5-10 cm from the detector. There is cpp file and an xml file. Cpp file created this detector volume which is a cube of 10cm. I need to add a filter in the same file so that It can be placed in front of the Detector. Your help will be high appreciated.

codes are as follows:

  • XML FILE
  • system:8,sector:8,module:8

    and cpp file is:

    // SPDX-License-Identifier: LGPL-3.0-or-later // Copyright (C) 2022 Anna Kowalewska

    #include “DD4hep/DetFactoryHelper.h” #include “DD4hep/Printout.h” #include “DD4hep/Shapes.h” #include “DDRec/DetectorData.h” #include “DDRec/Surface.h” #include “XML/Layering.h” #include

    using namespace std; using namespace dd4hep;

    static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector sens) { sens.setType(“calorimeter”); xml_det_t x_det = e; xml_comp_t x_dim = x_det.dimensions(); xml_comp_t x_pos = x_det.position(); xml_comp_t x_rot = x_det.rotation(); // string det_name = x_det.nameStr(); string mat_name = dd4hep::getAttrOrDefault( x_det, _U(material), “PbWO4” ); string filterMat = dd4hep::getAttrOrDefault( x_det, _U(material), “Graphite” ); // double sizeX = x_dim.x(); double sizeY = x_dim.y(); double sizeZ = x_dim.z(); double posX = x_pos.x(); double posY = x_pos.y(); double posZ = x_pos.z(); double rotX = x_rot.x(); double rotY = x_rot.y(); double rotZ = x_rot.z(); //auto filterVis = desc.visAttributes(filterElem.attrstd::string(_Unicode(vis))); Box box( sizeX, sizeY, sizeZ ); Volume vol( det_name + “_vol”, box, description.material( mat_name ) ); vol.setVisAttributes( x_det.visStr() );

    Transform3D pos( RotationZYX(rotX, rotY, rotZ), Position(posX, posY, posZ) );

    DetElement det(det_name, x_det.id()); Volume motherVol = description.pickMotherVolume( det ); PlacedVolume phv = motherVol.placeVolume( vol, pos );

    det.setPlacement(phv);

    // - filter

    double filterThickness = 5*cm; Box filterSolid(sizeX, sizeY, filterThickness ); Volume filterVol(det_name + “_filter”, filterMat); filterVol.setVisAttributes(x_det.visStr()); Transform3D filter_pos( RotationZYX(rotX, rotY, rotZ), Position(posX, posY, posZ) ); //need to set its position

    DetElement filterDE(det, “filter_de”, 0); //Volume vol = description.pickFilterVolume( filterDE ); //PlacedVolume filterPV = vol.placeVolume( filterVol, filter_pos ); //filterDE.setPlacement(filterPV);

    return det; }

    DECLARE_DETELEMENT(LumiDirectPCAL, create_detector)

    More Y. Ali's questions See All
    Similar questions and discussions