722 Double_t tubeLengthArr[] = { 140.0, 140.0 /
cos(2.9 *
PI / 180.0), 118.5,
723 98.5, 78.5, 58.5, 38.5, 18.5 };
725 TCanvas *
c =
new TCanvas(
"c",
"c", 0, 0, 900, 900);
726 TString vmcWorkdir = getenv(
"VMCWORKDIR");
731 TFile*
fi =
new TFile(fGeoFile,
"RECREATE");
732 cout <<
"Output file = " << fGeoFile << endl;
734 FairGeoLoader*
geoLoad =
new FairGeoLoader(
"TGeo",
"FairGeoLoader");
735 FairGeoInterface *
geoFace = geoLoad->getGeoInterface();
736 geoFace->setMediaFile(vmcWorkdir +
"/geometry/media_pnd.geo");
737 geoFace->readMedia();
739 FairGeoMedia *
Media = geoFace->getMedia();
740 FairGeoBuilder *
geobuild = geoLoad->getGeoBuilder();
742 FairGeoMedium *SttAir = Media->getMedium(
"air");
743 FairGeoMedium *SttAluminum = Media->getMedium(
"Aluminum");
744 FairGeoMedium *SttPVC = Media->getMedium(
"PVC");
745 FairGeoMedium *SttMylar = Media->getMedium(
"mylar");
746 FairGeoMedium *SttArCO2 = Media->getMedium(
"ArCO2");
747 FairGeoMedium *SttArCO22b = Media->getMedium(
"STTmix9010_2bar");
748 FairGeoMedium *SttCopper = Media->getMedium(
"copper");
749 FairGeoMedium *SttReW = Media->getMedium(
"ReW");
750 FairGeoMedium *SttCuBe2 = Media->getMedium(
"CuBe2");
751 FairGeoMedium *SttABS = Media->getMedium(
"ABS");
753 Int_t
nmed = geobuild->createMedium(SttAir);
755 nmed = geobuild->createMedium(SttAluminum);
757 nmed = geobuild->createMedium(SttPVC);
759 nmed = geobuild->createMedium(SttMylar);
760 nmed = geobuild->createMedium(SttArCO2);
761 nmed = geobuild->createMedium(SttArCO22b);
762 nmed = geobuild->createMedium(SttCopper);
763 nmed = geobuild->createMedium(SttReW);
764 nmed = geobuild->createMedium(SttCuBe2);
765 nmed = geobuild->createMedium(SttABS);
767 TGeoVolume *tube, *
top, *halfSide;
772 TGeoManager*
gGeoMan = (TGeoManager*) gROOT->FindObject(
"FAIRGeom");
775 top =
new TGeoVolumeAssembly(
"top");
776 sttVol =
new TGeoVolumeAssembly(
"stt02assembly0");
777 halfSide =
new TGeoVolumeAssembly(
"sttHalfSide");
781 std::vector<TGeoVolume*> tubeArr;
782 for (Int_t
i = 0;
i < 8;
i++) {
785 Double_t wireLength = tubeLength + 2.0;
788 TGeoVolume *tubeTemp;
789 TGeoVolume *cap, *EndCap, *CrimpPin, *Wire, *MylarLayer, *AlLayer1,
790 *AlLayer2, *RetainingRing, *SpringSmallRing, *SpringBigRing,
792 TGeoPcon *WireCoveredL2, *WireCoveredL3;
793 std::string tubeType =
"tubeType"+ std::to_string(
i);
794 std::string tubeName =
"tubestt02-"+ std::to_string(
i);
795 tubeTemp =
new TGeoVolumeAssembly(tubeName.c_str());
796 cap =
new TGeoVolumeAssembly(
"Cap");
798 WireCoveredL2 =
new TGeoPgon(
"WireCoveredLayer2", 0, 360, 80, 16);
799 WireCoveredL2->DefineSection(0, 0, (.1 + (.040 + .025) / 2) / 2 + 0.03,
801 WireCoveredL2->DefineSection(1, 0.025,
802 (.1 + (.040 + .025) / 2) / 2 + 0.05, .15);
803 WireCoveredL2->DefineSection(2, 0.03, (.1 + (.040 + .025) / 2) / 2,
805 WireCoveredL2->DefineSection(3, 0.045, (.1 + (.040 + .025) / 2) / 2,
807 WireCoveredL2->DefineSection(4, 0.045, (.1 + (.040 + .025) / 2) / 2,
809 WireCoveredL2->DefineSection(5, 0.15, (.1 + (.040 + .025) / 2) / 2,
811 WireCoveredL2->DefineSection(6, 0.15, (.1 + (.040 + .025) / 2) / 2,
813 WireCoveredL2->DefineSection(7, 0.5, (.1 + (.040 + .025) / 2) / 2, .15);
814 WireCoveredL2->DefineSection(8, 0.5, (.1 + (.040 + .025) / 2) / 2, .45);
815 WireCoveredL2->DefineSection(9, 0.55, (.1 + (.040 + .025) / 2) / 2,
817 WireCoveredL2->DefineSection(10, 0.55, (.1 + (.040 + .025) / 2) / 2,
819 WireCoveredL2->DefineSection(11, 0.58, (.1 + (.040 + .025) / 2) / 2,
821 WireCoveredL2->DefineSection(12, 0.58, (.1 + (.040 + .025) / 2) / 2,
823 WireCoveredL2->DefineSection(13, 0.7, (.1 + (.040 + .025) / 2) / 2, .1);
824 WireCoveredL2->DefineSection(14, 0.7, .03, .1);
825 WireCoveredL2->DefineSection(15, 0.8, .03, .1);
827 WireCoveredL3 =
new TGeoPgon(
"WireCoveredLayer3", 0, 360, 200, 3);
828 WireCoveredL3->DefineSection(0, 0, 0.45, 0.4975000);
829 WireCoveredL3->DefineSection(1, 0.7, 0.45, 0.4975000);
830 WireCoveredL3->DefineSection(2, 0.8, 0.45, 0.4975 - .0268);
832 TGeoTranslation *
t1 =
new TGeoTranslation(
"t1", 0, 0, 0.5);
833 t1->RegisterYourself();
835 TGeoTube *GasTubeShape;
836 GasTubeShape =
new TGeoTube(
"gts", 0, .04, 1.0);
837 TGeoTranslation *
t2 =
new TGeoTranslation(
"t2", 0, 0.35, 0.5);
838 t2->RegisterYourself();
840 TGeoCompositeShape *EndCapShape =
new TGeoCompositeShape(
"EndCapShape",
841 "WireCoveredLayer3:t1 + WireCoveredLayer2 - gts:t2");
842 EndCap =
new TGeoVolume(
"EndCapShape", EndCapShape,
844 EndCap->SetLineColor(8);
846 TGeoTube *CrimpPinShape;
850 CrimpPinShape =
new TGeoTube(
"CrimpPinShape", 0.002,
851 (0.1 + (.040 + .025) / 2) / 2, crimpPinLength / 2);
852 CrimpPin =
new TGeoVolume(
"w1", CrimpPinShape,
854 CrimpPin->SetLineColor(25);
855 TGeoTranslation *
t3 =
new TGeoTranslation(
"t3", 0, 0,
856 0.7 - crimpPinLength / 2);
857 t3->RegisterYourself();
860 TGeoTube *SmallRingShape;
861 SmallRingShape =
new TGeoTube(
"SmallRingShape", 0.2, 0.23, .01748);
862 SpringSmallRing =
new TGeoVolume(
"SRS", SmallRingShape,
864 SpringSmallRing->SetLineColor(5);
866 TGeoTube *BigRingShape;
867 BigRingShape =
new TGeoTube(
"BigRingShape", 0.995 / 2 - .03, 0.995 / 2,
869 SpringBigRing =
new TGeoVolume(
"BRS", BigRingShape,
871 SpringBigRing->SetLineColor(5);
875 gGeoManager->GetMedium(
"PVC"), 0.115, 0.25, 0.0525, 125, 55);
876 RetainingRing->SetLineColor(35);
880 WireShape =
new TGeoTube(
"WireShape", 0, 0.001, wireLength / 2);
881 Wire =
new TGeoVolume(
"Wire", WireShape,
gGeoManager->GetMedium(
"ReW"));
882 Wire->SetLineColor(15);
886 std::string tempt5 = tubeType +
"t5";
887 TGeoTranslation *t5 =
new TGeoTranslation(tempt5.c_str(), 0, 0,
888 tubeLength / 2 + 0.35);
889 t5->RegisterYourself();
891 std::string tempt6 = tubeType +
"t6";
892 TGeoTranslation *t6 =
new TGeoTranslation(tempt6.c_str(), 0, 0,
893 -tubeLength / 2 - 0.35);
894 t6->RegisterYourself();
897 TGeoTube *AlLayerShape1;
898 std::string tempal1 = tubeType +
"AluminiumLayerShape1";
899 AlLayerShape1 =
new TGeoTube(tempal1.c_str(), 0.4975000, 0.4975030,
901 AlLayer1 =
new TGeoVolume(
"al1", AlLayerShape1,
903 AlLayer1->SetLineColor(10);
905 TGeoTube *MylarShape;
906 std::string tempml1 = tubeType +
"MylarLayerShape1";
907 MylarShape =
new TGeoTube(tempml1.c_str(), 0.4975030, 0.5002030,
909 MylarLayer =
new TGeoVolume(
"ml1", MylarShape,
912 MylarLayer->SetLineColor(9);
914 TGeoTube *AlLayerShape2;
915 std::string tempal2 = tubeType +
"AluminiumLayerShape2";
916 AlLayerShape2 =
new TGeoTube(tempal2.c_str(), 0.5002030, 0.5002060,
918 AlLayer2 =
new TGeoVolume(
"al2", AlLayerShape2,
920 AlLayer2->SetLineColor(10);
927 std::string tempt4 = tubeType +
"t4";
928 TGeoTranslation *t4 =
new TGeoTranslation(tempt4.c_str(), 0, 0,
929 0.7 - crimpPinLength / 2 - tubeLength/2);
930 t4->RegisterYourself();
934 std::string temptr1 = tubeType +
"tr1";
935 TGeoCombiTrans *tr1 =
new TGeoCombiTrans(temptr1.c_str(), 0, 0,
936 tubeLength/2 + .35,
new TGeoRotation(
"d", 0, 180, 180));
937 tr1->RegisterYourself();
939 std::string tempt7 = tubeType +
"t7";
940 TGeoTranslation *t7 =
new TGeoTranslation(tempt7.c_str(), 0, 0,
941 -.7 +tubeLength/2 + crimpPinLength / 2);
942 t7->RegisterYourself();
944 TGeoTube *NobleGasTubeShape;
945 std::string tempgs = tubeType +
"GasShape";
946 NobleGasTubeShape =
new TGeoTube(tempgs.c_str(), 0, 0.4970 - fac,
947 (tubeLength - 0.4) / 2.0 - fac);
949 std::string tempStr = tempgs
950 +
" -( EndCapShape:"+ tempt6 +
"+ EndCapShape:" + temptr1
951 +
"+ CrimpPinShape:" + tempt4 +
" + CrimpPinShape:" + tempt7
953 TGeoCompositeShape *NobleGasShape =
new TGeoCompositeShape(
"r",
955 NobleGas =
new TGeoVolume(
"ArCO2Sensitive", NobleGasShape,
957 NobleGas->SetLineColor(20);
961 testShape =
new TGeoTube(
"testShape", 0, 0.995 / 2, 0.1);
962 testVol =
new TGeoVolume(
"e1", testShape,
964 testVol->SetLineColor(8);
966 cap->AddNode(CrimpPin, 0, t3);
967 cap->AddNode(EndCap, 1);
968 cap->AddNode(SpringSmallRing, 2,
new TGeoTranslation(
"t", 0, 0, 0.2));
969 cap->AddNode(SpringSmallRing, 3,
new TGeoTranslation(
"t", 0, 0, 0.3));
970 cap->AddNode(SpringSmallRing, 4,
new TGeoTranslation(
"t", 0, 0, 0.4));
971 cap->AddNode(SpringBigRing, 5,
972 new TGeoTranslation(
"t", 0, 0, 0.5 - .02));
973 cap->AddNode(RetainingRing, 6,
974 new TGeoTranslation(
"t", 0, 0, 0.045 + 0.0525));
976 tubeTemp->AddNode(Wire, 1);
977 tubeTemp->AddNode(cap, 2,t6);
978 tubeTemp->AddNode(cap, 3, tr1);
979 tubeTemp->AddNode(NobleGas, 0);
980 tubeTemp->AddNode(AlLayer1, 4);
981 tubeTemp->AddNode(MylarLayer, 5);
982 tubeTemp->AddNode(AlLayer2, 6);
983 tubeArr.push_back(tubeTemp);
993 std::vector<TGeoVolume*> sectorArr;
994 for (Int_t sector = 0; sector < 3; sector++) {
999 std::string
name =
"sector-" + to_string(sector);
1001 geoTemp =
new TGeoVolumeAssembly(name.c_str());
1002 for (Int_t mPart = 0; mPart < 8; mPart++) {
1006 Double_t startingPointRow, startingPointCol;
1007 Int_t sIndex[10][2], eIndex[10][2];
1008 Int_t parity = 0, nRow, stack;
1012 Int_t dPar0 = 0, dPar1 = 0;
1014 Double_t stackArraymPart7[8] = { 0, 20, 19, 16, 15, 12, 9, 4 };
1015 Double_t dPar0mPart7[8] = { 0,-1, -1, 0, 0, 0, 0, -1 };
1016 Double_t dPar1mPart7[8] = { 0, -4, -2, 0, 0, 0, 0, -1 };
1022 else if(sector == 2) {
1037 sttRadius = 17.563 - 0.878 * 3;
1044 sttRadius = 21.076 - 0.878;
1054 sttRadius = 26.616 - 0.878- 0.878;
1062 sttRadius = 24.724 - 0.878- 0.878;
1071 sttRadius = 30.4 - 0.878- 0.878;
1079 sttRadius = 28.508 - 0.878- 0.878;
1086 sttRadius = 33.37 - 0.878 * 3;
1095 sttRadius = 35.126 - 0.878;
1100 for (Int_t
i = parity;
i < nRow + parity;
i++) {
1101 if (
i == 0 && mPart == 0) {
1104 }
else if (
i == 1 && mPart == 0) {
1113 eIndex[
i][0] = stackArraymPart7[
i];
1114 eIndex[
i][1] = stackArraymPart7[
i];
1116 eIndex[
i][0] = stackArraymPart7[
i]
1118 eIndex[
i][1] = stackArraymPart7[
i]
1120 }
else if (sector == 2) {
1121 eIndex[
i][0] = stackArraymPart7[
i]
1123 eIndex[
i][1] = stackArraymPart7[
i]
1128 eIndex[
i][0] = stack + dPar0 - 4 * tDeg * tDeg;
1130 eIndex[
i][1] = stack + dPar1 - 4 * tDeg * tDeg;
1137 startingPointRow = sttRadius;
1139 for (Int_t
i = parity;
i < nRow + parity;
i++) {
1141 TGeoVolume *tubeLayer;
1142 Int_t layer = layerStart +
i;
1144 layer = layerStart + i - 1;
1146 std::string tubeLayerName =
"strawLayer-"
1147 + std::to_string(layer);
1148 tubeLayer =
new TGeoVolumeAssembly(tubeLayerName.c_str());
1151 startingPointCol = tubeRadius;
1153 startingPointCol = tubeRadius * 2;
1154 if (sIndex[i][0] == 0 || sIndex[i][1] == 0) {
1155 Int_t colindex = eIndex[
i][1];
1157 tubeLayer->AddNode(tubeArr[0],colindex ,
1158 new TGeoCombiTrans(
"tr",
1159 startingPointRow + i * 0.878, 0, 0,
1160 new TGeoRotation(
"r", 0, deg * tDeg,
1167 for (Int_t l = 0; l <= 1; l++) {
1168 for (Int_t j = sIndex[i][l]; j < eIndex[
i][l]; j++) {
1172 colindex = (eIndex[
i][1] - sIndex[
i][1]) + p;
1175 colindex = (eIndex[
i][1] - sIndex[
i][1]) - 1;
1177 colindex = colindex + (j - sIndex[
i][l]) * sign;
1179 tubeLayer->AddNode(tubeArr[0], colindex,
1180 new TGeoCombiTrans(
"tr",
1181 startingPointRow + i * 0.878,
1182 (startingPointCol + j * tubeRadius * 2)
1184 new TGeoRotation(
"d", 0, deg * tDeg,
1192 for (Int_t k = 2; k < 8; k++) {
1198 TGeoCombiTrans *trad1 =
new TGeoCombiTrans(
"tr",
1199 startingPointRow + i * 0.878,
1201 * ((startingPointCol
1202 + (k + eIndex[i][(1 + tDeg) / 2]
1203 - 2) * tubeRadius * 2)- (tubeLengthArr[1]
1204 - tubeLengthArr[k])/2
1208 -(tubeLengthArr[1] - tubeLengthArr[k] )
1209 *
cos(2.9 *
PI / 180.0)/2,
new TGeoRotation(
"r", 0, deg * tDeg, 0));
1210 trad1->RegisterYourself();
1212 TGeoCombiTrans *trad2 =
1213 new TGeoCombiTrans(
"tr",
1214 startingPointRow + i * 0.878,
1216 * ((startingPointCol
1225 - tubeLengthArr[k])/2
1229 (tubeLengthArr[1] - tubeLengthArr[k] )
1230 *
cos(2.9 *
PI / 180.0)/2,
1231 new TGeoRotation(
"r", 0, deg * tDeg,
1233 trad2->RegisterYourself();
1234 tubeLayer->AddNode(tubeArr[k], 1 - (1 + tDeg) / 2, trad1);
1237 tubeLayer->AddNode(tubeArr[k], (1 + tDeg) / 2, trad2);
1241 geoTemp->AddNode(tubeLayer, 0);
1244 sectorArr.push_back(geoTemp);
1247 halfSide->AddNode(sectorArr[0], 0,
1248 new TGeoCombiTrans(0, 0, 4 + tubeLengthArr[0] / 2,
1249 new TGeoRotation(
"d", 0, 0, -60)));
1250 halfSide->AddNode(sectorArr[1], 0,
1251 new TGeoTranslation(0, 0, 4.0 + tubeLengthArr[0] / 2));
1252 halfSide->AddNode(sectorArr[2], 0,
1253 new TGeoCombiTrans(0, 0, 4 + tubeLengthArr[0] / 2,
1254 new TGeoRotation(
"d", 0, 0, 60)));
1257 new TGeoTranslation(0, 0, 0));
1259 new TGeoTranslation(0, 0, -.5));
1261 sttVol->AddNode(halfSide, 0,
new TGeoTranslation(
"t1", 0, 0, -34.7));
1262 sttVol->AddNode(halfSide, 1,
1263 new TGeoCombiTrans( 0, 0, -34.7,
1264 new TGeoRotation(
"d", 0, 0, 180)));
1266 top->AddNode(sttVol, 0);
1275 std::cout <<
gGeoManager->GetVisOption() << std::endl;
friend F32vec4 cos(const F32vec4 &a)
friend F32vec4 sin(const F32vec4 &a)
TGeoVolume * constructMechanicalFrame()
TGeoManager * gGeoManager
FairGeoBuilder * geobuild
FairGeoInterface * geoFace
TGeoVolume * constructGasManifold()