diff --git a/macro/pipe/fair/create_bpipe_geometry_gen.C b/macro/pipe/fair/create_bpipe_geometry_gen.C index 6fbd192555647eac0f7f05e9322959ceb81aba8f..ca2d3c84d125ebc4de5f980948a1c1ed0d35b008 100644 --- a/macro/pipe/fair/create_bpipe_geometry_gen.C +++ b/macro/pipe/fair/create_bpipe_geometry_gen.C @@ -111,8 +111,10 @@ void create_bpipe_geometry_gen(const char* geoTag = "v24f", double beam_deflecti // //--- define some media TGeoMedium* Vacuum = new TGeoMedium("BP_vacuum", 1,matAir); - // TGeoMedium* Al = new TGeoMedium("BP_aluminium", 2, matAl); + TGeoMedium* Ti = new TGeoMedium("BP_ti", 2, matTi); TGeoMedium* CF = new TGeoMedium("BP_carbonfiber", 3, matCarbonFiber); + TGeoMedium* LDPE = new TGeoMedium("BP_ldpe", 4, matLDPE); + TGeoMedium* He = new TGeoMedium("BP_he", 5, matHe); // TGeoMedium* Stainless = new TGeoMedium("BP_stainless", 4, matStainless); // Conus part dimensions @@ -153,6 +155,32 @@ void create_bpipe_geometry_gen(const char* geoTag = "v24f", double beam_deflecti const Double_t coupling_foil_rmin = 0 * mm; const Double_t coupling_foil_rmax = 50 * mm; + const Double_t downstream_foil_length = 0.1 * mm; + const Double_t downstream_foil_rmin = 0 * mm; + const Double_t downstream_foil_rmax = 92 * mm; + + Double_t c_wall_t = 2 * mm; + + if (bpipe_type==conical){ + beam_pipe_length = 4640 * mm; + } + else if (bpipe_type==bag){ + beam_pipe_length = 4640 * mm; + c_wall_t=0.05 * mm; + } + + // CONICAL beampipe / helium bag envelope + const Double_t c_beam_pipe_length = 9800 * mm; + const Double_t c_beam_pipe_r1min = 50 * mm; + const Double_t c_beam_pipe_r1max = c_beam_pipe_r1min + c_wall_t; + const Double_t c_beam_pipe_r2min = 90 * mm; + const Double_t c_beam_pipe_r2max = c_beam_pipe_r2min + c_wall_t; + + // Helium bag endcaps + const Double_t hbag_endcap_length = c_wall_t; + const Double_t hbag_endcap_upstream_r = c_beam_pipe_r1max; + const Double_t hbag_endcap_downstream_r = c_beam_pipe_r2max; + beam_deflection_angle = beam_deflection_angle/radian; // from deg to rad Double_t pipe_deflection_radius = bending_radius+(flange_thickness/2)+(beam_pipe_length/2); @@ -176,44 +204,21 @@ void create_bpipe_geometry_gen(const char* geoTag = "v24f", double beam_deflecti TVector3 b5(short_segment*sin((alpha/4)+bellow_deflection_angle),0,short_segment*cos((alpha/4)+bellow_deflection_angle)); // axis vector of the fifth bellow segment TVector3 b6(flange_thickness*sin(bellow_deflection_angle),0,flange_thickness*cos(bellow_deflection_angle)); // axis vector of the downstream flange b3 = (p_b6-(1./2)*b6-b5-b4)-(p_b0+(1./2)*b0+b1+b2); // axis vector of the third (middle) bellow segment + Double_t middle_segment = b3.Mag(); - Double_t c_wall_t = 2 * mm; + TVector3 pipe_vec(beam_pipe_length*sin(bellow_deflection_angle),0,beam_pipe_length*cos(bellow_deflection_angle)); TVector3 coupling_1_vec(coupling_1_length*sin(bellow_deflection_angle),0,coupling_1_length*cos(bellow_deflection_angle)); TVector3 coupling_2_vec(coupling_2_length*sin(bellow_deflection_angle),0,coupling_2_length*cos(bellow_deflection_angle)); TVector3 coupling_3_vec(coupling_3_length*sin(bellow_deflection_angle),0,coupling_3_length*cos(bellow_deflection_angle)); TVector3 coupling_foil_vec(coupling_foil_length*sin(bellow_deflection_angle),0,coupling_foil_length*cos(bellow_deflection_angle)); + TVector3 hbag_endcap_vec(hbag_endcap_length*sin(bellow_deflection_angle),0,hbag_endcap_length*cos(bellow_deflection_angle)); + TVector3 c_pipe_vec(c_beam_pipe_length*sin(bellow_deflection_angle),0,c_beam_pipe_length*cos(bellow_deflection_angle)); + TVector3 downstream_foil_vec(downstream_foil_length*sin(bellow_deflection_angle),0,downstream_foil_length*cos(bellow_deflection_angle)); - if (bpipe_type==conical){ - beam_pipe_length = 4640 * mm; - } - else if (bpipe_type==bag){ - beam_pipe_length = 4640 * mm; - c_wall_t=0.01 * mm; - } - - // CONICAL beampipe / helium bag envelope - Double_t c_beam_pipe_length = 9800 * mm; - Double_t c_beam_pipe_r1min = 50 * mm; - Double_t c_beam_pipe_r1max = c_beam_pipe_r1min + c_wall_t; - Double_t c_beam_pipe_r2min = 90 * mm; - Double_t c_beam_pipe_r2max = c_beam_pipe_r2min + c_wall_t; - - // Helium bag endcaps - Double_t hbag_endcap_upstream_length = c_wall_t; - Double_t hbag_endcap_upstream_r = c_beam_pipe_r1min; - - - TVector3 pipe_vec(beam_pipe_length*sin(bellow_deflection_angle),0,beam_pipe_length*cos(bellow_deflection_angle)); - - - - TVector3 c_pipe_vec(c_beam_pipe_length*sin(bellow_deflection_angle),0,c_beam_pipe_length*cos(bellow_deflection_angle)); - - Double_t middle_segment = b3.Mag(); // Angles of separate part of bellow @@ -357,6 +362,69 @@ void create_bpipe_geometry_gen(const char* geoTag = "v24f", double beam_deflecti TGeoHMatrix ctr_pipe_coupling_3_aux = orig_combi*tr_tube_coupling_3*rot_tube_coupling_3; TGeoHMatrix* ctr_pipe_coupling_3 = new TGeoHMatrix(ctr_pipe_coupling_3_aux); + TGeoHMatrix* ctr_pipe_coupling_foil; + TGeoHMatrix* ctr_hbag_endcap_upstream; + TGeoHMatrix* ctr_hbag; + TGeoHMatrix* ctr_hbag_endcap_downstream; + + if (bpipe_type==bag){ + aux_vec=aux_vec+(1./2)*(coupling_3_vec+coupling_foil_vec); + TGeoRotation rot_tube_coupling_foil("rot_tube_coupling_foil"); + rot_tube_coupling_foil.RotateY(beta6*radian); + TGeoTranslation tr_tube_coupling_foil("tr_pipe_coupling_foil", aux_vec.X(),aux_vec.Y(),aux_vec.Z()); + + TGeoHMatrix ctr_pipe_coupling_foil_aux = orig_combi*tr_tube_coupling_foil*rot_tube_coupling_foil; + ctr_pipe_coupling_foil = new TGeoHMatrix(ctr_pipe_coupling_foil_aux); + + aux_vec=aux_vec+(1./2)*(coupling_foil_vec+hbag_endcap_vec); + TGeoRotation rot_hbag_endcap_upstream("rot_hbag_endcap_upstream"); + rot_hbag_endcap_upstream.RotateY(beta6*radian); + TGeoTranslation tr_hbag_endcap_upstream("tr_hbag_endcap_upstream", aux_vec.X(),aux_vec.Y(),aux_vec.Z()); + + TGeoHMatrix ctr_hbag_endcap_upstream_aux = orig_combi*tr_hbag_endcap_upstream*rot_hbag_endcap_upstream; + ctr_hbag_endcap_upstream = new TGeoHMatrix(ctr_hbag_endcap_upstream_aux); + + aux_vec=aux_vec+(1./2)*(hbag_endcap_vec+c_pipe_vec); + TGeoRotation rot_hbag("hbag"); + rot_hbag.RotateY(beta6*radian); + TGeoTranslation tr_hbag("tr_hbag", aux_vec.X(),aux_vec.Y(),aux_vec.Z()); + + TGeoHMatrix ctr_hbag_aux = orig_combi*tr_hbag*rot_hbag; + ctr_hbag = new TGeoHMatrix(ctr_hbag_aux); + + aux_vec=aux_vec+(1./2)*(c_pipe_vec+hbag_endcap_vec); + TGeoRotation rot_hbag_endcap_downstream("rot_hbag_endcap_downstream"); + rot_hbag_endcap_downstream.RotateY(beta6*radian); + TGeoTranslation tr_hbag_endcap_downstream("tr_hbag_endcap_downstream", aux_vec.X(),aux_vec.Y(),aux_vec.Z()); + + TGeoHMatrix ctr_hbag_endcap_downstream_aux = orig_combi*tr_hbag_endcap_downstream*rot_hbag_endcap_downstream; + ctr_hbag_endcap_downstream = new TGeoHMatrix(ctr_hbag_endcap_downstream_aux); + + } + + + TGeoHMatrix* ctr_c_pipe; + TGeoHMatrix* ctr_foil_downstream; + + if (bpipe_type==conical){ + aux_vec=aux_vec+(1./2)*(coupling_3_vec+c_pipe_vec); + TGeoRotation rot_c_pipe("c_pipe"); + rot_c_pipe.RotateY(beta6*radian); + TGeoTranslation tr_c_pipe("tr_c_pipe", aux_vec.X(),aux_vec.Y(),aux_vec.Z()); + + TGeoHMatrix ctr_c_pipe_aux = orig_combi*tr_c_pipe*rot_c_pipe; + ctr_c_pipe = new TGeoHMatrix(ctr_c_pipe_aux); + + aux_vec=aux_vec+(1./2)*(c_pipe_vec+downstream_foil_vec); + TGeoRotation rot_foil_downstream("rot_foil_downstream"); + rot_foil_downstream.RotateY(beta6*radian); + TGeoTranslation tr_foil_downstream("tr_foil_downstream", aux_vec.X(),aux_vec.Y(),aux_vec.Z()); + + TGeoHMatrix ctr_foil_downstream_aux = orig_combi*tr_foil_downstream*rot_foil_downstream; + ctr_foil_downstream = new TGeoHMatrix(ctr_foil_downstream_aux); + + } + @@ -535,7 +603,7 @@ void create_bpipe_geometry_gen(const char* geoTag = "v24f", double beam_deflecti //------------------------------PSD TUBE COUPLING 1--------------------------------------------------------------------- TGeoTube* psd_tube_coupling_1_s = new TGeoTube("psd_tube_coupling_1_s", coupling_1_rmin, coupling_1_rmax, coupling_1_length/2); TGeoVolume* psd_tube_coupling_1 = new TGeoVolume("psd_tube_coupling_1", psd_tube_coupling_1_s, CF); - psd_tube_coupling_1->SetLineColor(kOrange); + psd_tube_coupling_1->SetLineColor(kGray); //------------------------------VACUUM PSD TUBE COUPLING 1--------------------------------------------------------------- TGeoTube* vacuum_psd_tube_coupling_1_s = new TGeoTube("vacuum_psd_tube_coupling_1_s", 0. * mm, coupling_1_rmin, coupling_1_length/2); @@ -546,7 +614,7 @@ void create_bpipe_geometry_gen(const char* geoTag = "v24f", double beam_deflecti //------------------------------PSD TUBE COUPLING 2--------------------------------------------------------------------- TGeoTube* psd_tube_coupling_2_s = new TGeoTube("psd_tube_coupling_2_s", coupling_2_rmin, coupling_2_rmax, coupling_2_length/2); TGeoVolume* psd_tube_coupling_2 = new TGeoVolume("psd_tube_coupling_2", psd_tube_coupling_2_s, CF); - psd_tube_coupling_1->SetLineColor(kOrange); + psd_tube_coupling_1->SetLineColor(kGray); //------------------------------VACUUM PSD TUBE COUPLING 1--------------------------------------------------------------- TGeoTube* vacuum_psd_tube_coupling_2_s = new TGeoTube("vacuum_psd_tube_coupling_2_s", 0. * mm, coupling_2_rmin, coupling_2_length/2); @@ -557,13 +625,54 @@ void create_bpipe_geometry_gen(const char* geoTag = "v24f", double beam_deflecti //------------------------------PSD TUBE COUPLING 3--------------------------------------------------------------------- TGeoTube* psd_tube_coupling_3_s = new TGeoTube("psd_tube_coupling_3_s", coupling_3_rmin, coupling_3_rmax, coupling_3_length/2); TGeoVolume* psd_tube_coupling_3 = new TGeoVolume("psd_tube_coupling_3", psd_tube_coupling_3_s, CF); - psd_tube_coupling_3->SetLineColor(kOrange); + psd_tube_coupling_3->SetLineColor(kGray); //------------------------------VACUUM PSD TUBE COUPLING 3--------------------------------------------------------------- TGeoTube* vacuum_psd_tube_coupling_3_s = new TGeoTube("vacuum_psd_tube_coupling_3_s", 0. * mm, coupling_3_rmin, coupling_3_length/2); TGeoVolume* vacuum_psd_tube_coupling_3 = new TGeoVolume("vacuum_psd_tube_coupling_3", vacuum_psd_tube_coupling_3_s, Vacuum); vacuum_psd_tube_coupling_3->SetLineColor(kGreen); + //------------------------------Upstream foil--------------------------------------------------------------------- + TGeoTube* upstream_foil_s = new TGeoTube("upstream_foil_s", coupling_foil_rmin, coupling_foil_rmax, coupling_foil_length/2); + TGeoVolume* upstream_foil = new TGeoVolume("upstream_foil", upstream_foil_s, Ti); + upstream_foil->SetLineColor(kBlack); + + //------------------------------Upstream bag endcap--------------------------------------------------------------------- + TGeoTube* upstream_bag_endcap_s = new TGeoTube("upstream_bag_endcap_s", 0., hbag_endcap_upstream_r, hbag_endcap_length/2); + TGeoVolume* upstream_bag_endcap = new TGeoVolume("upstream_bag_endcap", upstream_foil_s, LDPE); + upstream_bag_endcap->SetLineColor(kOrange); + + //------------------------CONICAL BEAM PIPE Downstream------------------------------------------------------------------------- + TGeoCone* c_pipe_s = new TGeoCone("c_pipe_s", c_beam_pipe_length/2, c_beam_pipe_r1min, c_beam_pipe_r1max, c_beam_pipe_r2min, c_beam_pipe_r2max); + TGeoVolume* c_pipe = new TGeoVolume("c_pipe", c_pipe_s, CF); + c_pipe->SetLineColor(kGray); + + //-------------------------------VACUUM IN CONE------------------------------------------------------------------- + TGeoCone* c_pipe_vacuum_s = new TGeoCone("c_pipe_vacuum_s", c_beam_pipe_length/2, 0, c_beam_pipe_r1min, 0, c_beam_pipe_r2min); + TGeoVolume* c_pipe_vacuum = new TGeoVolume("c_pipe_vacuum", c_pipe_vacuum_s, Vacuum); + c_pipe_vacuum->SetLineColor(kGreen); + + //------------------------HBAG------------------------------------------------------------------------- + TGeoCone* hbag_s = new TGeoCone("hbag_s", c_beam_pipe_length/2, c_beam_pipe_r1min, c_beam_pipe_r1max, c_beam_pipe_r2min, c_beam_pipe_r2max); + TGeoVolume* hbag = new TGeoVolume("hbag", hbag_s, LDPE); + hbag->SetLineColor(kOrange); + + //------------------------HBAG - helium------------------------------------------------------------------------- + TGeoCone* hbag_helium_s = new TGeoCone("hbag_helium_s", c_beam_pipe_length/2, 0., c_beam_pipe_r1min, 0., c_beam_pipe_r2min); + TGeoVolume* hbag_helium = new TGeoVolume("hbag_helium", hbag_helium_s, He); + hbag_helium->SetLineColor(kBlue); + + //------------------------------downstream foil--------------------------------------------------------------------- + TGeoTube* downstream_foil_s = new TGeoTube("downstream_foil_s", downstream_foil_rmin, downstream_foil_rmax, downstream_foil_length/2); + TGeoVolume* downstream_foil = new TGeoVolume("downstream_foil", downstream_foil_s, Ti); + downstream_foil->SetLineColor(kBlack); + + //------------------------------downstream bag endcap--------------------------------------------------------------------- + TGeoTube* downstream_bag_endcap_s = new TGeoTube("downstream_bag_endcap_s", 0., hbag_endcap_downstream_r, hbag_endcap_length/2); + TGeoVolume* downstream_bag_endcap = new TGeoVolume("downstream_bag_endcap", downstream_bag_endcap_s, LDPE); + downstream_bag_endcap->SetLineColor(kOrange); + + //----------------Bellow with flanges----------------------------- bellow_ass->AddNode(bellow_flange_0, 1, ctr_b0); @@ -611,6 +720,19 @@ void create_bpipe_geometry_gen(const char* geoTag = "v24f", double beam_deflecti full_assembly->AddNode(psd_tube_coupling_3, 1, ctr_pipe_coupling_3); full_assembly->AddNode(vacuum_psd_tube_coupling_3, 1, ctr_pipe_coupling_3); } + if (bpipe_type==bag){ + full_assembly->AddNode(upstream_foil,1,ctr_pipe_coupling_foil); + full_assembly->AddNode(upstream_bag_endcap,1,ctr_hbag_endcap_upstream); + full_assembly->AddNode(hbag,1,ctr_hbag); + full_assembly->AddNode(hbag_helium,1,ctr_hbag); + full_assembly->AddNode(downstream_bag_endcap,1,ctr_hbag_endcap_downstream); + } + + if (bpipe_type==conical){ + full_assembly->AddNode(c_pipe,1,ctr_c_pipe); + full_assembly->AddNode(c_pipe_vacuum,1,ctr_c_pipe); + full_assembly->AddNode(downstream_foil,1,ctr_foil_downstream); + } //beampipe->AddNode(full_assembly,1, new TGeoTranslation(0, 0, 0*mm)); // --- close the geometry