Placement of detector

Dear Experts need some help for the placement of filter. I have created a graphite filter just need to place it in front of detector. Code snippet is here Any advice is appreciated: ```

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 filterThickness = 5cm;
double filterDistanceZ = -10cm;
//
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);

Box fbox( 5.cm, 5.cm, 2.5*cm);
Volume filter(det_name + “_filter”, fbox, description.material( filterMat ) );
filter.setVisAttributes( x_det.visStr() );

Transform3D filter_pos( RotationZYX(rotX, rotY, rotZ), Position(posX, posY, posZ-filterDistanceZ) ); // Place the filter 10 cm away from the calorimeter

//PlacedVolume filter_phys = (filter, filter_pos);

return det;
}

DECLARE_DETELEMENT(LumiDirectPCAL, create_detector)``

Duplicate of Addition of filter in front of Photon Calorimeter