Skip to content
Snippets Groups Projects

Ci testing

Merged Whitney Armstrong requested to merge (removed):ci_testing into master
2 files
+ 173
0
Compare changes
  • Side-by-side
  • Inline
Files
2
 
//==========================================================================
 
//
 
// <detector name ="DetName" type="Beampipe" >
 
// <layer id="#(int)" inner_r="#(double)" outer_z="#(double)" >
 
// <slice material="string" thickness="#(double)" >
 
// </layer>
 
// </detector>
 
//==========================================================================
 
#include "DD4hep/DetFactoryHelper.h"
 
#include "DD4hep/Printout.h"
 
#include "TMath.h"
 
 
using namespace std;
 
using namespace dd4hep;
 
 
static Ref_t create_detector(Detector& det, xml_h e, SensitiveDetector sens) {
 
 
using namespace ROOT::Math;
 
xml_det_t x_det = e;
 
string det_name = x_det.nameStr();
 
Material air = det.air();
 
DetElement sdet (det_name,x_det.id());
 
Assembly assembly (det_name+"_assembly");
 
Material m_Al = det.material("Aluminum");
 
Material m_Be = det.material("Beryllium");
 
 
PlacedVolume pv;
 
int n = 0;
 
std::cout << " BEAM PIPE \n";
 
 
struct {
 
double length = 0.60*m;
 
double inner_radius = 3.0*cm;
 
double Au_thickness = 0.01*mm;
 
double Be1_thickness = 0.5*mm;
 
double coolant_thickness = 1.0*mm;
 
double Be2_thickness = 0.6*mm;
 
double z_position = 0.0*mm;
 
} bp0_pars;
 
 
struct {
 
double length = 0.60*m;
 
double inner_radius = 3.0*cm;
 
double inner_radius2 = 5.0*cm;
 
double Au_thickness = 0.01*mm;
 
double Be1_thickness = 0.5*mm;
 
double coolant_thickness = 1.0*mm;
 
double Be2_thickness = 0.6*mm;
 
double z_position = 0.0*mm;
 
} bp1_pars;
 
bp1_pars.z_position = bp0_pars.length/2.0 + bp1_pars.length/2.0;
 
 
struct {
 
double length = 0.20*m;
 
double inner_radius = 5.0*cm;
 
double inner_radius2 = 3.1*cm;
 
double Au_thickness = 0.01*mm;
 
double Be1_thickness = 0.5*mm;
 
double coolant_thickness = 1.0*mm;
 
double Be2_thickness = 0.6*mm;
 
double z_position = 0.0*mm;
 
} bp2_pars;
 
 
bp2_pars.z_position = bp0_pars.length/2.0 + bp1_pars.length + bp2_pars.length/2.0;
 
 
for(xml_coll_t bp(x_det,"beampipe"); bp; ++bp) {
 
 
std::cout << bp << std::endl;
 
xml_comp_t beampipe_comp = bp;
 
if(beampipe_comp.nameStr() == std::string("CentralBeamPipe")) {
 
std::cout << " CentralBeamPipe\n";
 
bp0_pars.inner_radius = getAttrOrDefault<double>(beampipe_comp,"inner_raius",bp0_pars.inner_radius);
 
}
 
}
 
 
Tube s_bp0(bp0_pars.inner_radius, bp0_pars.inner_radius+2.0*mm, bp0_pars.length/2.0);//,2.0*TMath::Pi()+0.01);
 
Cone s_bp1( bp1_pars.length/2.0, bp1_pars.inner_radius, bp1_pars.inner_radius+2.0*mm, bp1_pars.inner_radius2, bp1_pars.inner_radius2+2.0*mm);
 
Cone s_bp2( bp2_pars.length/2.0, bp2_pars.inner_radius, bp2_pars.inner_radius+2.0*mm, bp2_pars.inner_radius2, bp2_pars.inner_radius2+2.0*mm);
 
 
Transform3D tr1( ROOT::Math::EulerAngles(0.0, 0.0*rad, 0.0), XYZVector{0,0,0} );
 
Transform3D tr_bp1( ROOT::Math::EulerAngles(0.0, 0.0*rad, 0.0), XYZVector{0,0,bp1_pars.z_position} );
 
Transform3D tr_bp2( ROOT::Math::EulerAngles(0.0, 0.0*rad, 0.0), XYZVector{0,0,bp2_pars.z_position} );
 
 
Volume v_bp0( "tub0", s_bp0, m_Be);
 
pv = assembly.placeVolume(v_bp0,tr1);
 
Volume v_bp1( "pb1", s_bp1, m_Al);
 
pv = assembly.placeVolume(v_bp1,tr_bp1);
 
Volume v_bp2( "pb2", s_bp2, m_Al);
 
pv = assembly.placeVolume(v_bp2,tr_bp2);
 
 
Transform3D tr_bp3( ROOT::Math::EulerAngles(0.0, 180.0*degree, 0.0), XYZVector{0,0,-bp1_pars.z_position} );
 
Transform3D tr_bp4( ROOT::Math::EulerAngles(0.0, 180.0*degree, 0.0), XYZVector{0,0,-bp2_pars.z_position} );
 
Volume v_bp3( "pb3", s_bp1, m_Al);
 
pv = assembly.placeVolume(v_bp3,tr_bp3);
 
Volume v_bp4( "pb4", s_bp2, m_Al);
 
pv = assembly.placeVolume(v_bp4,tr_bp4);
 
 
// Polycone s_det3_beamline_pipe_ionside_VertexFlare(
 
// 0.0*degree, 360.0*degree,
 
// {32.2*mm, 148.7*mm},
 
// {33.2*mm, 150.7*mm},
 
// {0.3362*m, 1.9179*m});
 
 
//det1_beamline_pipe_ionside_VertexTaper | root |det1_beamline_pipe_ionside_VertexTaper | 0*m 0*m 0*m | 0*rad 0.025*rad 0*rad | 8b9494 | Polycone |0*deg 360*deg 2*counts 148.7*mm 75.6*mm 150.7*mm 77.6*mm 1.9179*m 2.0445*m |det1_beamline_pipe_BeAl | no | 1 | 1 | 1 | 1 | 1 | no | no | no
 
//det1_beamline_pipe_ionside_VertexExitWindow | root |det1_beamline_pipe_ionside_VertexExitWindow | 0*m 0*m 0*m | 0*rad 0.025*rad 0*rad | 8b9494 | Polycone |0*deg 360*deg 2*counts 0*mm 0*mm 75.6*mm 75.6*mm 2.0435*m 2.0455*m | G4_Al | no | 1 | 1 | 1 | 1 | 1 | no | no | no
 
//det1_beamline_pipe_ionside_EleExitAperture |det1_beamline_pipe_ionside_VertexExitWindow |det1_beamline_pipe_ionside_EleExitAperture | 0.051123151100283*m 0*m 0*m | 0*rad 0*rad 0*rad | f5ecd9 | Polycone |0*deg 360*deg 2*counts 0*mm 0*mm 21*mm 21*mm 2.0435*m 2.0455*m | G4_Galactic | no | 1 | 1 | 1 | 1 | 1 | no | no | no
 
//det1_beamline_pipe_ionside_IonExtranceAperture |det1_beamline_pipe_ionside_VertexExitWindow |det1_beamline_pipe_ionside_IonExtranceAperture | -0.051123151100283*m 0*m 0*m | 0*rad 0*rad 0*rad | f5ecd9 | Polycone |0*deg 360*deg 2*counts 0*mm 0*mm 25.2*mm 25.2*mm 2.0435*m 2.0455*m | G4_Galactic | no | 1 | 1 | 1 | 1 | 1 | no | no | no
 
//det1_beamline_pipe_ionside_IonBeamPipe | root |det1_beamline_pipe_ionside_IonBeamPipe | 0*m 0*m 0*m | 0*rad 0.05*rad 0*rad | 8b9494 | Polycone |0*deg 360*deg 2*counts 24.2*mm 85.3*mm 25.2*mm 87.3*mm 2.0445*m 7*m | G4_Al | no | 1 | 1 | 1 | 1 | 1 | no | no | no
 
//det1_beamline_pipe_ionside_SynchrotronRadShield1 | root |det1_beamline_pipe_ionside_SynchrotronRadShield1 | 0*m 0*m 0*m | 0*rad 0*rad 0*rad | ff9494 | Polycone | 0*deg 360*deg 2*counts 15*mm 19*mm 17*mm 21*mm 1*m 2.0445*m | G4_Cu | no | 1 | 1 | 1 | 1 | 1 | no | no | no
 
//det1_beamline_pipe_ionside_SynchrotronRadShield2 | root |det1_beamline_pipe_ionside_SynchrotronRadShield2 | 0*m 0*m 0*m | 0*rad 0*rad 0*rad | ff9494 | Polycone |0*deg 360*deg 2*counts 19*mm 30*mm 21*mm 32*mm 2.0445*m 2.4*m | G4_Cu | no | 1 | 1 | 1 | 1 | 1 | no | no | no
 
//det1_beamline_pipe_eleside_VertexChamber | root |det1_beamline_pipe_eleside_VertexChamber | 0*m 0*m 0*m | 0*rad 0.025*rad 0*rad | 8b9494 | Polycone |0*deg 360*deg 2*counts 32.2*mm 32.2*mm 33.2*mm 33.2*mm -0.33615*m 0.33615*m | G4_Be | no | 1 | 1 | 1 | 1 | 1 | no | no | no
 
//det1_beamline_pipe_eleside_VertexFlare | root |det1_beamline_pipe_eleside_VertexFlare | 0*m 0*m 0*m | 0*rad 0.025*rad 0*rad | 8b9494 | Polycone |0*deg 360*deg 2*counts 102.1*mm 32.2*mm 104.1*mm 33.2*mm -1.2852*m -0.3362*m | G4_Be | no | 1 | 1 | 1 | 1 | 1 | no | no | no
 
//det1_beamline_pipe_eleside_VertexTaper | root |det1_beamline_pipe_eleside_VertexTaper | 0*m 0*m 0*m | 0*rad 0.025*rad 0*rad | 8b9494 | Polycone |0*deg 360*deg 2*counts 56*mm 102.1*mm 58*mm 104.1*mm -1.365*m -1.2852*m |det1_beamline_pipe_BeAl | no | 1 | 1 | 1 | 1 | 1 | no | no | no
 
//det1_beamline_pipe_eleside_VertexExitWindow | root |det1_beamline_pipe_eleside_VertexExitWindow | 0*m 0*m 0*m | 0*rad 0.025*rad 0*rad | 8b9494 | Polycone |0*deg 360*deg 2*counts 0*mm 0*mm 56*mm 56*mm -1.366*m -1.364*m | G4_Al | no | 1 | 1 | 1 | 1 | 1 | no | no | no
 
//det1_beamline_pipe_eleside_EleExitAperture |det1_beamline_pipe_eleside_VertexExitWindow |det1_beamline_pipe_eleside_EleExitAperture | -0.0341321111527935*m 0*m 0*m | 0*rad 0*rad 0*rad | f5ecd9 | Polycone |0*deg 360*deg 2*counts 0*mm 0*mm 21*mm 21*mm -1.366*m -1.364*m | G4_Galactic | no | 1 | 1 | 1 | 1 | 1 | no | no | no
 
//det1_beamline_pipe_eleside_IonExtranceAperture |det1_beamline_pipe_eleside_VertexExitWindow |det1_beamline_pipe_eleside_IonExtranceAperture | 0.0341321111527935*m 0*m 0*m | 0*rad 0*rad 0*rad | f5ecd9 | Polycone |0*deg 360*deg 2*counts 0*mm 0*mm 21*mm 21*mm -1.366*m -1.364*m | G4_Galactic | no | 1 | 1 | 1 | 1 | 1 | no | no | no
 
//det1_beamline_pipe_eleside_IonBeamPipe | root |det1_beamline_pipe_eleside_IonBeamPipe | 0*m 0*m 0*m | 0*rad 0.05*rad 0*rad | 8b9494 | Polycone |0*deg 360*deg 2*counts 30*mm 20*mm 32*mm 21*mm -3.5948*m -1.365*m | G4_Al | no | 1 | 1 | 1 | 1 | 1 | no | no | no
 
//det1_beamline_pipe_eleside_EleBeamPipe | root |det1_beamline_pipe_eleside_EleBeamPipe | 0*m 0*m 0*m | 0*rad 0*rad 0*rad | 8b9494 | Polycone |0*deg 360*deg 2*counts 20*mm 20*mm 21*mm 21*mm -1.6*m -1.365*m | G4_Al | no | 1 | 1 | 1 | 1 | 1 | no | no | no
 
 
//for(xml_coll_t i(x_det,_U(layer)); i; ++i, ++n) {
 
// xml_comp_t x_layer = i;
 
// string l_name = det_name+_toString(n,"_layer%d");
 
// double z = x_layer.outer_z();
 
// double rmin = x_layer.inner_r();
 
// double z_offset = 0.0;
 
// if(x_layer.hasAttr(_Unicode(z_offset))) {
 
// z_offset = x_layer.z_offset();
 
// }
 
// double r = rmin;
 
// DetElement layer(sdet,_toString(n,"layer%d"),x_layer.id());
 
// int m = 0;
 
 
// printout(INFO, "GenericShapeJLEIC", "Creating a Generic Layer");
 
// for(xml_coll_t j(x_layer,_U(slice)); j; ++j, ++m) {
 
// xml_comp_t x_slice = j;
 
// Material mat = det.material(x_slice.materialStr());
 
// string s_name= l_name+_toString(m,"_slice%d");
 
// double thickness = x_slice.thickness();
 
// Tube s_tub(r, r+thickness,z);//,2.0*TMath::Pi()+0.01);
 
// Volume s_vol(s_name, s_tub, mat);
 
 
// r += thickness;
 
// s_vol.setVisAttributes(det,x_det.visStr());
 
// pv = assembly.placeVolume(s_vol,Position(0, 0, z_offset));
 
// // Slices have no extra id. Take the ID of the layer!
 
// pv.addPhysVolID("slice",m);
 
// printout(INFO, "GenericShapeJLEIC", "Creating Generic Slice");
 
// }
 
// //cout << l_name << " " << rmin << " " << r << " " << z << endl;
 
//
 
//}
 
 
pv = det.pickMotherVolume(sdet).placeVolume(assembly);
 
pv.addPhysVolID("system",sdet.id()).addPhysVolID("barrel",0);
 
sdet.setPlacement(pv);
 
return sdet;
 
}
 
 
DECLARE_DETELEMENT(JLEICBeampipe,create_detector)
Loading