735{
736 TGeoVolume *
top=gGeoManager->GetTopVolume();
737 TGeoVolume *tShield = new TGeoVolumeAssembly("MuonShieldArea");
739 TGeoMedium *steel =gGeoManager->GetMedium("steel");
741 TGeoMedium *iron =gGeoManager->GetMedium("iron");
743 TGeoMedium *concrete =gGeoManager->GetMedium("Concrete");
744
747 TGeoUniformMagField *magFieldIron = new TGeoUniformMagField(0.,ironField,0.);
748 TGeoUniformMagField *RetField = new TGeoUniformMagField(0.,-ironField,0.);
749 TGeoUniformMagField *ConRField = new TGeoUniformMagField(-ironField,0.,0.);
750 TGeoUniformMagField *ConLField = new TGeoUniformMagField(ironField,0.,0.);
751 TGeoUniformMagField *fields[4] = {magFieldIron,RetField,ConRField,ConLField};
752
753 std::vector<TString> magnetName;
754 std::vector<FieldDirection> fieldDirection;
755 std::vector<Double_t> dXIn, dYIn, dXOut, dYOut, dZf, midGapIn, midGapOut,
756 HmainSideMagIn, HmainSideMagOut, gapIn, gapOut,
Z;
757 const Int_t nMagnets =
Initialize(magnetName, fieldDirection, dXIn, dYIn, dXOut, dYOut, dZf,
758 midGapIn, midGapOut, HmainSideMagIn, HmainSideMagOut, gapIn,
759 gapOut, Z);
760
761
765 dA/6.,dA/6.,dA/6.,dA/6.,
dZ0/3.,0,0,dA/12.,dA/12.,0,0,
zEndOfAbsorb - 5.*
dZ0/3.,0,
false);
767 dA/2.,dA/2.,dA/2.,dA/2.,
dZ0*2./3.,0,0,dA/4.,dA/4.,0,0,
zEndOfAbsorb - 2.*
dZ0/3.,0,
false);
768 TGeoBBox* fullAbsorber =
new TGeoBBox(
"fullAbsorber", dA, dA,
dZ0/3.);
769 TGeoBBox* cutOut =
new TGeoBBox(
"cutout", dA/3.+20*cm, dA/3.+20*cm,
dZ0/3.+0.1*
mm);
770 TGeoSubtraction *subtraction = new TGeoSubtraction("fullAbsorber","cutout");
771 TGeoCompositeShape *Tc = new TGeoCompositeShape("passiveAbsorberStopSubtr", subtraction);
772 TGeoVolume* passivAbsorber = new TGeoVolume("passiveAbsorberStop-1",Tc, iron);
773 tShield->AddNode(passivAbsorber, 1,
new TGeoTranslation(0,0,
zEndOfAbsorb - 5.*
dZ0/3.));
775 float mField = 1.6 *
tesla;
776 TGeoUniformMagField *fieldsAbsorber[4] = {
777 new TGeoUniformMagField(0., mField, 0.),
778 new TGeoUniformMagField(0., -mField, 0.),
779 new TGeoUniformMagField(-mField, 0., 0.),
780 new TGeoUniformMagField(mField, 0., 0.)
781 };
782
783 for (Int_t nM = (
fDesign == 7) ? 0 : 1; nM < 2; nM++) {
784 CreateMagnet(magnetName[nM], iron, tShield, fieldsAbsorber,
785 fieldDirection[nM], dXIn[nM], dYIn[nM], dXOut[nM],
786 dYOut[nM], dZf[nM], midGapIn[nM], midGapOut[nM],
787 HmainSideMagIn[nM], HmainSideMagOut[nM], gapIn[nM],
788 gapOut[nM], Z[nM], true, false);
789 }
790
791 std::vector<TGeoTranslation*> mag_trans;
792
794 auto mag1 =
new TGeoTranslation(
"mag1", 0, 0, -
dZ2);
795 mag1->RegisterYourself();
796 mag_trans.push_back(mag1);
797 }
798 auto mag2 =
new TGeoTranslation(
"mag2", 0, 0, +
dZ1);
799 mag2->RegisterYourself();
800 mag_trans.push_back(mag2);
801
802 Double_t zgap = 10;
803 Double_t absorber_offset = zgap;
804 Double_t absorber_half_length = (dZf[0] + dZf[1]) + zgap / 2.;
805 auto abs =
new TGeoBBox(
"absorber", 3.95 *
m, 3.4 *
m, absorber_half_length);
806 const std::vector<TString> absorber_magnets =
807 (
fDesign == 7) ? std::vector<TString>{
"MagnAbsorb1",
"MagnAbsorb2"} : std::vector<TString>{
"MagnAbsorb2"};
808 const std::vector<TString> magnet_components =
fDesign == 7 ? std::vector<TString>{
809 "_MiddleMagL", "_MiddleMagR", "_MagRetL", "_MagRetR",
810 "_MagCLB", "_MagCLT", "_MagCRT", "_MagCRB",
811 "_MagTopLeft", "_MagTopRight", "_MagBotLeft", "_MagBotRight",
812 }: std::vector<TString>{
813 "_MiddleMagL", "_MiddleMagR", "_MagRetL", "_MagRetR",
814 "_MagTopLeft", "_MagTopRight", "_MagBotLeft", "_MagBotRight",
815 };
816 TString absorber_magnet_components;
817 for (auto &&magnet_component : magnet_components) {
818
819 absorber_magnet_components +=
820 ("-" + absorber_magnets[0] + magnet_component + ":" +
821 mag_trans[0]->GetName());
823 absorber_magnet_components +=
824 ("-" + absorber_magnets[1] + magnet_component + ":" +
825 mag_trans[1]->GetName());
826 }
827 }
828 TGeoCompositeShape *absorberShape = new TGeoCompositeShape(
829 "Absorber", "absorber" + absorber_magnet_components);
830
831
832 TGeoVolume *absorber = new TGeoVolume("AbsorberVol", absorberShape, iron);
833 absorber->SetLineColor(42);
834 tShield->AddNode(absorber, 1,
new TGeoTranslation(0, 0,
zEndOfAbsorb + absorber_half_length + absorber_offset));
835
837 auto coatBox =
new TGeoBBox(
"coat", 10 *
m - 1 *
mm, 10 *
m - 1 *
mm, absorber_half_length);
838 auto coatShape = new TGeoCompositeShape("CoatShape", "coat-absorber");
839 auto coat = new TGeoVolume("CoatVol", coatShape, concrete);
840 tShield->AddNode(coat, 1,
new TGeoTranslation(0, 0,
zEndOfAbsorb + absorber_half_length + absorber_offset ));
841 TGeoVolume *coatWall = gGeoManager->MakeBox(
"CoatWall",concrete,10 *
m - 1 *
mm, 10 *
m - 1 *
mm, 7 * cm - 1 *
mm);
842 coatWall->SetLineColor(kRed);
843 tShield->AddNode(coatWall, 1,
new TGeoTranslation(0, 0,
zEndOfAbsorb + 2*absorber_half_length + absorber_offset+7 * cm));
844
845 }
846 std::array<double, 9> fieldScale = {{1., 1., 1., 1., 1., 1., 1., 1., 1.}};
848 {
849 Double_t lengthSum = 0.;
850 for (
int i = 2;
i < 9; ++
i)
851 {
853 }
855 fieldScale[0] = 1.;
856 fieldScale[1] = 1.;
857 try
858 {
860 }
861 catch(const std::out_of_range& e)
862 {
863 Fatal( "ShipMuonShield", "Exception out of range for --coMuonShield occurred \n");
864 }
865 }
866 for (Int_t nM = 2; nM <= (nMagnets - 1); nM++) {
867 Double_t ironField_s =
fField * fieldScale[nM] *
tesla;
868 TGeoUniformMagField *magFieldIron_s = new TGeoUniformMagField(0.,ironField_s,0.);
869 TGeoUniformMagField *RetField_s = new TGeoUniformMagField(0.,-ironField_s,0.);
870 TGeoUniformMagField *ConRField_s = new TGeoUniformMagField(-ironField_s,0.,0.);
871 TGeoUniformMagField *ConLField_s = new TGeoUniformMagField(ironField_s,0.,0.);
872 TGeoUniformMagField *fields_s[4] = {magFieldIron_s,RetField_s,ConRField_s,ConLField_s};
873 CreateMagnet(magnetName[nM], iron, tShield, fields_s, fieldDirection[nM],
874 dXIn[nM], dYIn[nM], dXOut[nM], dYOut[nM], dZf[nM],
875 midGapIn[nM], midGapOut[nM], HmainSideMagIn[nM],
876 HmainSideMagOut[nM], gapIn[nM], gapOut[nM], Z[nM], nM==8,
fStepGeo);
877
879 Double_t dymax = std::max(dYIn[nM] + dXIn[nM], dYOut[nM] + dXOut[nM]);
880 Double_t dymin = std::min(dYIn[nM] + dXIn[nM], dYOut[nM] + dXOut[nM]);
882 (dYIn[nM] + dXIn[nM] - dYOut[nM] - dXOut[nM]) / (2 * dZf[nM]);
883 Double_t w1 = 2 * dXIn[nM] + std::max(20., gapIn[nM]);
884 Double_t w2 = 2 * dXOut[nM] + std::max(20., gapOut[nM]);
885 Double_t anti_overlap = 0.1;
886 Double_t h1 = 0.5 * (dYIn[nM] + dXIn[nM] + anti_overlap - 10 *
m +
fFloor);
887 Double_t h2 = 0.5 * (dYOut[nM] + dXOut[nM] + anti_overlap - 10 *
m +
fFloor);
888 Double_t
length = std::min(0.5 *
m, std::abs(dZf[nM]/2. - 5 * cm));
889 std::array<Double_t, 16> verticesIn = {
890 -w1, -h1,
891 +w1, -h1,
892 +w1, +h1,
893 -w1, +h1,
896 +w1, +h1,
897 -w1, +h1,
898 };
899 std::array<Double_t, 16> verticesOut = {
902 +w2, +h2,
903 -w2, +h2,
904 -w2, -h2,
905 +w2, -h2,
906 +w2, +h2,
907 -w2, +h2,
908 };
910 {
911
912
913 TGeoVolume *pillar1 =
914 gGeoManager->MakeArb8(TString::Format("pillar_%d", 2 * nM - 1),
915 steel, length, verticesIn.data());
916 TGeoVolume *pillar2 =
917 gGeoManager->MakeArb8(TString::Format("pillar_%d", 2 * nM), steel,
918 length, verticesOut.data());
919 pillar1->SetLineColor(kGreen-5);
920 pillar2->SetLineColor(kGreen-5);
921 tShield->AddNode(pillar1, 1, new TGeoTranslation(
922 0, -0.5 * (dYIn[nM] + dXIn[nM] + 10 *
m -
fFloor),
923 Z[nM] - dZf[nM] + length));
924 tShield->AddNode(pillar2, 1, new TGeoTranslation(
925 0, -0.5 * (dYOut[nM] + dXOut[nM] + 10 *
m -
fFloor),
926 Z[nM] + dZf[nM] - length));
927 }
928 }
929
930 } else {
933
934 for (Int_t nM = 0; nM < (nMagnets - 1); nM++) {
935 CreateMagnet(magnetName[nM],iron,tShield,fields,fieldDirection[nM],
936 dXIn[nM],dYIn[nM],dXOut[nM],dYOut[nM],dZf[nM],
937 midGapIn[nM],midGapOut[nM],HmainSideMagIn[nM],HmainSideMagOut[nM],
938 gapIn[nM],gapOut[nM],Z[nM],0,
fStepGeo);
939 }
940 }
941 Double_t dX1 = dXIn[0];
942 Double_t dY = dYIn[0];
943
944
945 top->AddNode(tShield, 1);
946
947
950 TGeoBBox *box1 =
new TGeoBBox(
"box1", 10*
m,10*
m,dZ);
951 TGeoBBox *box2 =
new TGeoBBox(
"box2", 15*
m,15*
m,dZ);
952 TGeoCompositeShape *compRockS = new TGeoCompositeShape("compRockS", "box2-box1");
953 TGeoVolume *rockS = new TGeoVolume("rockS", compRockS, concrete);
954 rockS->SetLineColor(11);
955 rockS->SetTransparency(50);
956 top->AddNode(rockS, 1,
new TGeoTranslation(0, 0, ZT ));
957
959 TGeoBBox *box3 =
new TGeoBBox(
"box3", 15*
m, 15*
m,dZD/2.);
960 TGeoBBox *box4 =
new TGeoBBox(
"box4", 10*
m, 10*
m,dZD/2.);
961
963
964 TGeoBBox *box5 =
new TGeoBBox(
"shield_floor", 10 *
m,
fFloor / 2.,
966 TGeoVolume *floor = new TGeoVolume("floorM", box5, concrete);
967 floor->SetLineColor(11);
968 top->AddNode(floor, 1,
new TGeoTranslation(0, -10 *
m +
fFloor / 2.,
971 }
972 TGeoCompositeShape *compRockD =
973 new TGeoCompositeShape("compRockD", "(box3-box4)");
974 TGeoVolume *rockD = new TGeoVolume("rockD", compRockD, concrete);
975 rockD->SetLineColor(11);
976 rockD->SetTransparency(50);
977 top->AddNode(rockD, 1,
new TGeoTranslation(0, 0,
zEndOfAbsorb + 2*dZ + dZD/2.));
978
979 } else {
980 Fatal(
"ShipMuonShield",
"Design %i does not match implemented designs",
fDesign);
981 }
982}
Int_t Initialize(std::vector< TString > &magnetName, std::vector< FieldDirection > &fieldDirection, std::vector< Double_t > &dXIn, std::vector< Double_t > &dYIn, std::vector< Double_t > &dXOut, std::vector< Double_t > &dYOut, std::vector< Double_t > &dZ, std::vector< Double_t > &midGapIn, std::vector< Double_t > &midGapOut, std::vector< Double_t > &HmainSideMagIn, std::vector< Double_t > &HmainSideMagOut, std::vector< Double_t > &gapIn, std::vector< Double_t > &gapOut, std::vector< Double_t > &Z)
void CreateMagnet(TString magnetName, TGeoMedium *medium, TGeoVolume *tShield, TGeoUniformMagField *fields[4], FieldDirection fieldDirection, Double_t dX, Double_t dY, Double_t dX2, Double_t dY2, Double_t dZ, Double_t middleGap, Double_t middleGap2, Double_t HmainSideMag, Double_t HmainSideMag2, Double_t gap, Double_t gap2, Double_t Z, Bool_t NotMagnet, Bool_t stepGeo)
Int_t InitMedium(TString name)
void CreateTube(TString tubeName, TGeoMedium *medium, Double_t dX, Double_t dY, Double_t dZ, Int_t color, TGeoVolume *top, Double_t x_translation, Double_t y_translation, Double_t z_translation)
real(mps) slope
track slope