Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:15:58

0001 // SPDX-License-Identifier: LGPL-3.0-or-later
0002 // Copyright (C) 2022 Dhevan Gangadharan
0003 
0004 #include "DD4hep/DetFactoryHelper.h"
0005 #include "DD4hep/Printout.h"
0006 #include "DD4hep/Shapes.h"
0007 #include "DDRec/DetectorData.h"
0008 #include "DDRec/Surface.h"
0009 #include "XML/Layering.h"
0010 #include <XML/Helper.h>
0011 
0012 using namespace std;
0013 using namespace dd4hep;
0014 
0015 static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector /*sens*/) {
0016 
0017   xml_det_t x_det  = e;
0018   xml_comp_t x_dim = x_det.dimensions();
0019   xml_comp_t x_pos = x_det.position();
0020   xml_comp_t x_rot = x_det.rotation();
0021   //
0022   string det_name = x_det.nameStr();
0023   string mat_name = dd4hep::getAttrOrDefault<string>(x_det, _U(material), "Aluminum");
0024   //
0025   double sizeX = x_dim.x();
0026   double sizeY = x_dim.y();
0027   double sizeZ = x_dim.z();
0028   double posX  = x_pos.x();
0029   double posY  = x_pos.y();
0030   double posZ  = x_pos.z();
0031   double rotX  = x_rot.x();
0032   double rotY  = x_rot.y();
0033   double rotZ  = x_rot.z();
0034 
0035   Box box(sizeX, sizeY, sizeZ);
0036   Volume vol(det_name + "_vol_ExitWindow", box, description.material(mat_name));
0037   vol.setVisAttributes(description.visAttributes(x_det.visStr()));
0038 
0039   Transform3D pos(RotationZYX(rotX, rotY, rotZ), Position(posX, posY, posZ));
0040 
0041   DetElement det(det_name, x_det.id());
0042   Volume motherVol = description.pickMotherVolume(det);
0043   PlacedVolume phv = motherVol.placeVolume(vol, pos);
0044 
0045   det.setPlacement(phv);
0046 
0047   return det;
0048 }
0049 
0050 DECLARE_DETELEMENT(LumiWindow, create_detector)