@@ -37,29 +37,45 @@ const int nbcrystals = 2544;
3737
3838bool isCrystalInstalled (Int_t alvType , Int_t alveolusCopy , Int_t instCry []);
3939
40- void CreateCarbonFiberBackSide (TGeoVolume * pWorld ,
41- TGeoMedium * med ,
42- TGeoCombiTrans * disCalMes ,
43- TGeoCombiTrans * disCalWix );
44-
45- void create_califa_geo_selector (const std ::string expNumber = "nominal" , std ::string geoTag = "full" )
40+ void CreateHoldingStructure (TGeoVolume * pWorld ,
41+ TGeoVolume * holding_structure ,
42+ TGeoMedium * med1 ,
43+ TGeoMedium * med2 ,
44+ TGeoCombiTrans * disCalMes ,
45+ TGeoCombiTrans * disCalWix );
46+
47+ void create_califa_geo_selector (const std ::string expNumber = "nominal" ,
48+ std ::string geoTag = "full" ,
49+ bool fMakeStr = false)
4650{
47- auto fRefRot = std ::make_unique < TGeoRotation > ();
48- TGeoManager * gGeoMan = nullptr ;
49-
50- // ------- Load media from media file -------------------------
51- FairGeoLoader * geoLoad = new FairGeoLoader ("TGeo" , "FairGeoLoader" );
52- FairGeoInterface * geoFace = geoLoad -> getGeoInterface ();
5351 TString geoPath = gSystem -> Getenv ("VMCWORKDIR" );
5452 if (geoPath .IsNull ())
5553 {
5654 std ::cerr << "\033[35mERROR: VMCWORKDIR is not defined\033[0m" << std ::endl ;
5755 gApplication -> Terminate ();
5856 }
57+
58+ TString geoStru = geoPath + "/califa/geobase/files/califa_holding_structure.root" ;
59+ geoStru .ReplaceAll ("//" , "/" );
60+ TFile * f = TFile ::Open (geoStru .Data ());
61+ auto StruGeom = (static_cast < TGeoManager * > (f -> Get ("CalifaHoldingStructure" )));
62+
63+ auto StruVol = StruGeom -> GetTopVolume ();
64+ auto holding_structure = (static_cast < TGeoVolume * > (StruVol -> Clone ("CalifaHoldingStructureGeo" )));
65+ f -> Close ();
66+ delete StruGeom ;
67+
68+ auto fRefRot = std ::make_unique < TGeoRotation > ();
69+ TGeoManager * gGeoMan = nullptr ;
70+
71+ // ------- Load media from media file -------------------------
72+ FairGeoLoader * geoLoad = new FairGeoLoader ("TGeo" , "FairGeoLoader" );
73+ FairGeoInterface * geoFace = geoLoad -> getGeoInterface ();
74+
5975 TString medFile = geoPath + "/geometry/media_r3b.geo" ;
6076 medFile .ReplaceAll ("./" , "/" );
6177 medFile .ReplaceAll ("//" , "/" );
62- geoFace -> setMediaFile (medFile );
78+ geoFace -> setMediaFile (medFile . Data () );
6379 geoFace -> readMedia ();
6480 gGeoMan = gGeoManager ;
6581 bool isCepaUsed = true;
@@ -214,7 +230,7 @@ void create_califa_geo_selector(const std::string expNumber = "nominal", std::st
214230
215231 // ------- Geometry file name (output) ------------------------
216232 TString geoFileName = geoPath + "/geometry/califa_" ;
217- geoFileName = geoFileName + geoTag + ".geo.root" ;
233+ geoFileName = geoFileName + geoTag + ( fMakeStr ? "_stru" : "" ) + ".geo.root" ;
218234 geoFileName .ReplaceAll ("//" , "/" );
219235
220236 // ----------------- Get and create the required media -------
@@ -281,12 +297,17 @@ void create_califa_geo_selector(const std::string expNumber = "nominal", std::st
281297 auto tgeotrans1 = new TGeoCombiTrans ("tgeotrans1" , 0 , 0 , 0. , fRefRot .get ());
282298 tgeotrans1 -> RegisterYourself ();
283299
284- auto mother_outer = new TGeoTube ("mother_outer" , 0. , 75 . , (52 . + 70. ) / 2. );
300+ auto mother_outer = new TGeoTube ("mother_outer" , 0. , 81 . , (58 . + 73.5 ) / 2. );
285301 auto inner_hole = new TGeoTube ("inner_hole" , 0. , 29. , 130. / 2. );
286302 auto mother_endcap = new TGeoSphere ("mother_endcap" , 38. , 73.5 , 7. , 90. , 0. , 360. );
287303
304+ auto mother_endcap2 = new TGeoPgon ("mother_endcap2" , 0 , 360 , 16 , 2 );
305+ mother_endcap2 -> DefineSection (0 , 54. , 40. , 80. );
306+ mother_endcap2 -> DefineSection (1 , 85. , 12. , 34. );
307+
288308 auto califa_mother = new TGeoCompositeShape (
289- "califa_mother" , "mother_outer:tgeotrans0 - inner_hole:tgeotrans0 + mother_endcap:tgeotrans1" );
309+ "califa_mother" ,
310+ "mother_outer:tgeotrans0 - inner_hole:tgeotrans0 + mother_endcap:tgeotrans1 + mother_endcap2:tgeotrans1" );
290311
291312 auto pWorld = std ::make_unique < TGeoVolume > ("CalifaWorld ", califa_mother, pAirMedium);
292313 top -> AddNode (pWorld .get (), 0 , tgeotrans1 );
@@ -1456,10 +1477,9 @@ void create_califa_geo_selector(const std::string expNumber = "nominal", std::st
14561477
14571478 for (size_t j = 0 ; j < 8 ; j ++ )
14581479 { // rotation around Z
1459-
14601480 auto disp_halfCEPA = (j < 4 ) ? DisplCalifa [0 ] : DisplCalifa [1 ];
14611481
1462- rotAlvFinal_CEPA [i * 8 + j ] = new TGeoRotation (rotOnZ_CEPA [j ] * (* rotAlv_CEPA [i ]));
1482+ rotAlvFinal_CEPA [i * 8 + j ] = new TGeoRotation (( rotOnZ_CEPA [j ]) * (* rotAlv_CEPA [i ]));
14631483 alv_cm_rot_CEPA [i ] = (rotationOnZ_CEPA [j ]) * alv_cm_CEPA [i ];
14641484
14651485 if (isCrystalInstalled (i + 24 , j , installedCrystals .data ())) // alveoli number stars in 24 for CEPA
@@ -1475,7 +1495,8 @@ void create_califa_geo_selector(const std::string expNumber = "nominal", std::st
14751495 }
14761496 }
14771497
1478- // CreateCarbonFiberBackSide(pWorld.get(), pCarbonFibreMedium, dispCalMes, dispCalWix);
1498+ if (fMakeStr )
1499+ CreateHoldingStructure (pWorld .get (), holding_structure , pCarbonFibreMedium , pAlMedium , dispCalMes , dispCalWix );
14791500
14801501 gGeoMan -> CloseGeometry ();
14811502 gGeoMan -> CheckOverlaps (0.001 );
@@ -1533,10 +1554,23 @@ bool isCrystalInstalled(Int_t alvType, Int_t alveolusCopy, Int_t instCry[])
15331554 return found ;
15341555}
15351556
1536- void CreateCarbonFiberBackSide (TGeoVolume * word , TGeoMedium * med , TGeoCombiTrans * disCalMes , TGeoCombiTrans * disCalWix )
1557+ void CreateHoldingStructure (TGeoVolume * world ,
1558+ TGeoVolume * holding_structure ,
1559+ TGeoMedium * med1 ,
1560+ TGeoMedium * med2 ,
1561+ TGeoCombiTrans * disCalMes ,
1562+ TGeoCombiTrans * disCalWix )
15371563{
1538- auto carbonfiber = new TGeoConeSeg ("CarbonFiberCone" , 1. , 42. , 42.04 , 61.96 , 62. , -90 , 90 );
1539- auto CarbonFiberBack = new TGeoVolume ("CarbonFiberBack" , carbonfiber , med );
1564+ const int numSides = 16 ;
1565+ const double phiStart = 0. ;
1566+ const double phiTotal = 360. ;
1567+ const int numZPlanes = 2 ;
1568+
1569+ auto carbonfiber = new TGeoPgon ("CarbonFiberCone" , -90. , 180. , 8 , numZPlanes );
1570+ carbonfiber -> DefineSection (0 , -50.44 , 58.36 - 0.6 , 58.4 - 0.6 );
1571+ carbonfiber -> DefineSection (1 , -48.54 , 42.0 , 42.04 );
1572+
1573+ auto CarbonFiberBack = new TGeoVolume ("CarbonFiberBack" , carbonfiber , med1 );
15401574 CarbonFiberBack -> SetVisLeaves (kTRUE );
15411575 CarbonFiberBack -> SetLineColor (19 );
15421576
@@ -1553,18 +1587,174 @@ void CreateCarbonFiberBackSide(TGeoVolume* word, TGeoMedium* med, TGeoCombiTrans
15531587 return new TGeoCombiTrans (trans ); // still needs to be a pointer for ROOT
15541588 };
15551589
1590+ const double offsetX = 0.5 ; // 0.5 cm
15561591 auto rot1 = new TGeoRotation ();
1557- rot1 -> RotateX (180 );
1558-
15591592 auto rot2 = new TGeoRotation ();
1560- rot2 -> RotateX (180 );
15611593 rot2 -> RotateZ (180 );
15621594
1563- auto trans1 = make_trans (0.05 , 0.0 , -49.54 , rot1 , disCalMes );
1564- auto trans2 = make_trans (-0.05 , 0.0 , -49.54 , rot2 , disCalWix );
1595+ auto trans1 = make_trans (0.05 , 0.0 , 0.0 , rot1 , disCalMes );
1596+ auto trans2 = make_trans (-0.05 , 0.0 , 0.0 , rot2 , disCalWix );
1597+
1598+ world -> AddNode (CarbonFiberBack , 1 , trans1 );
1599+ world -> AddNode (CarbonFiberBack , 2 , trans2 );
1600+
1601+ auto rot10 = new TGeoRotation ();
1602+ rot10 -> RotateY (-90.0 );
1603+ rot10 -> RotateZ (-90.0 );
1604+
1605+ auto vmatrix0 = new TGeoCombiTrans (0. , 0. , 0. , rot10 );
1606+ vmatrix0 -> RegisterYourself ();
1607+ auto vmatrix1 = new TGeoCombiTrans (- offsetX , 0. , 0. , rot1 );
1608+ vmatrix1 -> RegisterYourself ();
1609+
1610+ auto hstr = (static_cast < TGeoVolume * > (holding_structure -> Clone ()));
1611+ auto shape0 = hstr -> GetShape ();
1612+
1613+ auto rot20 = new TGeoRotation ();
1614+ rot20 -> RotateZ (180.0 );
1615+ auto vmatrix2 = new TGeoCombiTrans (offsetX , 0. , 0. , rot20 );
1616+ vmatrix2 -> RegisterYourself ();
1617+
1618+ auto trans3 = make_trans (- offsetX , 0.0 , 0.0 , rot1 , disCalMes );
1619+ auto trans4 = make_trans (offsetX , 0.0 , 0.0 , rot2 , disCalWix );
1620+
1621+ // world->AddNode(hstr, 0, vmatrix1);
1622+
1623+ auto pgon0 = new TGeoPgon ("Outer_cyl0" , phiStart , phiTotal , numSides , numZPlanes );
1624+ pgon0 -> DefineSection (0 , -90.0 , 64.7 , 100. );
1625+ pgon0 -> DefineSection (1 , 90. , 64.7 , 100. );
1626+
1627+ auto pgon1 = new TGeoPgon ("Inner_cyl0" , phiStart , phiTotal , numSides , numZPlanes );
1628+ pgon1 -> DefineSection (0 , -60.0 , 0.0 , 58.4 );
1629+ pgon1 -> DefineSection (1 , 52.1 , 0.0 , 58.4 );
1630+
1631+ // auto volCone = new TGeoVolume("str1", pgon1, med2);
1632+ // volCone->SetLineColor(17);
1633+ // world->AddNode(volCone, 1);
1634+
1635+ auto pgon2 = new TGeoPgon ("cone2" , phiStart , phiTotal , numSides , numZPlanes );
1636+ pgon2 -> DefineSection (0 , 53.1 , 0.0 , 55.0 );
1637+ pgon2 -> DefineSection (1 , 84.5 , 0.0 , 9.5 );
1638+
1639+ // auto volCone2 = new TGeoVolume("str2", pgon2, med2);
1640+ // world->AddNode(volCone2, 1);
1641+
1642+ auto pgon3 = new TGeoPgon ("cone3" , phiStart , phiTotal , numSides , numZPlanes );
1643+ pgon3 -> DefineSection (0 , 60.0 , 0.0 , 20.0 );
1644+ pgon3 -> DefineSection (1 , 114.5 , 0.0 , 40. );
1645+
1646+ // auto volCone3 = new TGeoVolume("str3", pgon3, med2);
1647+ // world->AddNode(volCone3, 1);
15651648
1566- word -> AddNode (CarbonFiberBack , 0 , trans1 );
1567- word -> AddNode (CarbonFiberBack , 1 , trans2 );
1649+ auto pgon4 = new TGeoPgon ("cone4" , phiStart , phiTotal , numSides , numZPlanes );
1650+ pgon4 -> DefineSection (0 , 53.1 + 8. , 55.5 , 72.0 );
1651+ pgon4 -> DefineSection (1 , 84.5 + 9. , 9.5 , 9.5 + 7. );
1652+
1653+ // auto volCone4 = new TGeoVolume("str4", pgon4, med2);
1654+ // world->AddNode(volCone4, 1);
1655+
1656+ auto pSubHolding0 = new TGeoSubtraction (shape0 , pgon0 , vmatrix0 , 0 );
1657+
1658+ auto holdingComp0 = new TGeoCompositeShape ("holdingComp0 ", pSubHolding0 );
1659+
1660+ auto pSubHolding1 = new TGeoSubtraction (holdingComp0 , pgon1 , 0 , 0 );
1661+
1662+ auto holdingComp1 = new TGeoCompositeShape ("holdingComp1 ", pSubHolding1 );
1663+
1664+ auto pSubHolding2 = new TGeoSubtraction (holdingComp1 , pgon2 , 0 , 0 );
1665+
1666+ auto holdingComp2 = new TGeoCompositeShape ("holdingComp2 ", pSubHolding2 );
1667+
1668+ auto pSubHolding3 = new TGeoSubtraction (holdingComp2 , pgon3 , 0 , 0 );
1669+
1670+ auto holdingComp3 = new TGeoCompositeShape ("holdingComp3 ", pSubHolding3 );
1671+
1672+ auto pSubHolding4 = new TGeoSubtraction (holdingComp3 , pgon4 , 0 , 0 );
1673+
1674+ auto holdingComp4 = new TGeoCompositeShape ("holdingComp4 ", pSubHolding4 );
1675+
1676+ auto box_mother1 = new TGeoBBox ("box_mother1 ", 12.7 / 2., 15., 13.1 / 2.);
1677+ // auto volbox = new TGeoVolume("volbox1", box_mother1, med2);
1678+ // volbox->SetLineColor(3);
1679+
1680+ auto box_mother2 = new TGeoBBox ("box_mother2" , 19.1 / 2. , 3. , 19.3 / 2. );
1681+ // auto volbox2 = new TGeoVolume("volbox2", box_mother2, med2);
1682+ // volbox2->SetLineColor(3);
1683+
1684+ auto box_tape = new TGeoBBox ("box_tape" , 17. / 2. , 0.15 , 16.3 / 2. );
1685+ // auto volbox_tape = new TGeoVolume("volbox_tape", box_tape, med2);
1686+ // volbox_tape->SetLineColor(19);
1687+
1688+ TGeoCompositeShape * GeoCompObj ;
1689+ std ::vector < double > disz = { -31.1 , -6.2 , 18. , 31.1 + 10.4 , 65. };
1690+ for (size_t j = 0 ; j < 4 ; j ++ )
1691+ for (size_t i = 0 ; i < 8 ; i ++ )
1692+ {
1693+ auto rot22 = new TGeoRotation ();
1694+ auto ang = -11.25 - 22.5 * i ;
1695+ rot22 -> RotateZ (ang );
1696+ auto xi = 58.4 * TMath ::Cos ((90. + ang ) * TMath ::DegToRad ());
1697+ auto yi = 58.4 * TMath ::Sin ((90. + ang ) * TMath ::DegToRad ());
1698+ auto vmatrix22 = new TGeoCombiTrans (xi , yi , disz [j ], rot22 );
1699+ vmatrix22 -> RegisterYourself ();
1700+ // world->AddNode(volbox, i, vmatrix22);
1701+
1702+ if (i == 0 )
1703+ {
1704+ auto phole = new TGeoSubtraction (holdingComp4 , box_mother1 , 0 , vmatrix22 );
1705+ TString name = TString ::Format ("hole1_%zu" , i + 8 * j );
1706+ GeoCompObj = new TGeoCompositeShape (name .Data (), phole );
1707+ }
1708+ else
1709+ {
1710+ auto phole = new TGeoSubtraction (GeoCompObj , box_mother1 , 0 , vmatrix22 );
1711+ TString name = TString ::Format ("hole1_%zu" , i + 8 * j );
1712+ GeoCompObj = new TGeoCompositeShape (name .Data (), phole );
1713+ }
1714+ }
1715+
1716+ for (size_t j = 0 ; j < 5 ; j ++ )
1717+ for (size_t i = 0 ; i < 8 ; i ++ )
1718+ {
1719+ auto rot22 = new TGeoRotation ();
1720+ auto ang = -11.25 - 22.5 * i ;
1721+ rot22 -> RotateZ (ang );
1722+ auto xi = 63.55 * TMath ::Cos ((90. + ang ) * TMath ::DegToRad ());
1723+ auto yi = 63.55 * TMath ::Sin ((90. + ang ) * TMath ::DegToRad ());
1724+ auto vmatrix22 = new TGeoCombiTrans (xi , yi , disz [j ], rot22 );
1725+ vmatrix22 -> RegisterYourself ();
1726+ // world->AddNode(volbox2, i, vmatrix22);
1727+
1728+ auto phole = new TGeoSubtraction (GeoCompObj , box_mother2 , 0 , vmatrix22 );
1729+ TString name = TString ::Format ("hole2_%zu" , i + 8 * j );
1730+ GeoCompObj = new TGeoCompositeShape (name .Data (), phole );
1731+ }
1732+
1733+ for (size_t j = 0 ; j < 4 ; j ++ )
1734+ for (size_t i = 0 ; i < 8 ; i ++ )
1735+ {
1736+ auto rot22 = new TGeoRotation ();
1737+ auto ang = -11.25 - 22.5 * i ;
1738+ rot22 -> RotateZ (ang );
1739+ auto xi = 60.7 * TMath ::Cos ((90. + ang ) * TMath ::DegToRad ());
1740+ auto yi = 60.7 * TMath ::Sin ((90. + ang ) * TMath ::DegToRad ());
1741+ auto vmatrix22 = new TGeoCombiTrans (xi , yi , disz [j ], rot22 );
1742+ vmatrix22 -> RegisterYourself ();
1743+
1744+ // auto trs = make_trans(xi-offsetX, yi, disz[j], rot22, disCalMes);
1745+ // world->AddNode(volbox_tape, i+1, trs);
1746+
1747+ auto tape = new TGeoUnion (GeoCompObj , box_tape , 0 , vmatrix22 );
1748+ TString name = TString ::Format ("tape_%zu" , i + 8 * j );
1749+ GeoCompObj = new TGeoCompositeShape (name .Data (), tape );
1750+ }
1751+
1752+ // Final holding structure
1753+ auto holding_structure_final = new TGeoVolume ("Holding_Structure ", GeoCompObj , med2 );
1754+ holding_structure_final -> SetVisLeaves (kTRUE );
1755+ holding_structure_final -> SetLineColor (16 );
1756+ world -> AddNode (holding_structure_final , 1 , trans3 );
1757+ world -> AddNode (holding_structure_final , 2 , trans4 );
15681758}
15691759
15701760void create_califa_geo (const int index = 0 )
@@ -1589,6 +1779,10 @@ void create_califa_geo(const int index = 0)
15891779 {
15901780 create_califa_geo_selector ("g249" );
15911781 }
1782+ else if (index == 6 )
1783+ {
1784+ create_califa_geo_selector ("nominal" , "full" , true);
1785+ }
15921786 else
15931787 {
15941788 create_califa_geo_selector ();
0 commit comments