1313#include < DetectorsBase/MaterialManager.h>
1414#include < TGeoTube.h>
1515#include < TVirtualMC.h>
16- #include " TGeoManager.h" // for TGeoManager, gGeoManager
17- #include " TGeoMaterial.h" // for TGeoMaterial
18- #include " TGeoMedium.h" // for TGeoMedium
19- #include " TGeoVolume.h" // for TGeoVolume
16+ #include " TGeoManager.h" // for TGeoManager, gGeoManager
17+ #include " TGeoMaterial.h" // for TGeoMaterial
18+ #include " TGeoMedium.h" // for TGeoMedium
19+ #include " TGeoVolume.h" // for TGeoVolume
20+ #include " TGeoCompositeShape.h" // forTGeoCompositeShape
2021// force availability of assert
2122#ifdef NDEBUG
2223#undef NDEBUG
@@ -28,17 +29,19 @@ using namespace o2::passive;
2829Alice3Pipe::Alice3Pipe () : Alice3PassiveBase{" Alice3PIPE" , " " } {}
2930Alice3Pipe::Alice3Pipe (const char * name,
3031 const char * title,
31- float innerRho,
32+ bool isTRKActivated,
33+ float rMinInnerPipe,
3234 float innerThickness,
3335 float innerLength,
34- float outerRho ,
36+ float rMinOuterPipe ,
3537 float outerThickness,
3638 float outerLength)
3739 : Alice3PassiveBase{name, title},
38- mBeInnerPipeRmax {innerRho},
40+ mIsTRKActivated {isTRKActivated},
41+ mBeInnerPipeRmin {rMinInnerPipe},
3942 mBeInnerPipeThick {innerThickness},
4043 mInnerIpHLength {innerLength},
41- mBeOuterPipeRmax {outerRho },
44+ mBeOuterPipeRmin {rMinOuterPipe },
4245 mBeOuterPipeThick {outerThickness},
4346 mOuterIpHLength {outerLength}
4447{
@@ -92,35 +95,69 @@ void Alice3Pipe::ConstructGeometry()
9295 LOG (FATAL) << " Could not find the top volume" ;
9396 }
9497
98+ // ---------------- Outermost Be pipe around the IP ----------
99+ // Outer pipe has to be filled with vacuum. There we have also TRK layers, which we don't want to depend on the pipe volume.
100+ // Eventually, we will depend on some information passed from the outside.
101+ // For A3PIP-only simulations, we don't want TRK's shade.
102+ // Strategy used here is to use a composite shape where shapes of TRK layers are subtracted to the vacuum volume
103+ TGeoTube* outerBeTube = new TGeoTube (" OUT_PIPEsh" , mBeOuterPipeRmin , mBeOuterPipeRmin + mBeOuterPipeThick , mOuterIpHLength );
104+ TGeoVolume* outerBeTubeVolume = new TGeoVolume (" OUT_PIPE" , outerBeTube, kMedBe );
105+ outerBeTubeVolume->SetLineColor (kBlue );
106+
107+ TGeoTube* outerBerylliumTubeVacuumBase = new TGeoTube (" OUT_PIPEVACUUM_BASEsh" , mBeInnerPipeRmin + mBeInnerPipeThick , mBeOuterPipeRmin , mOuterIpHLength ); // Vacuum filling for outer pipe
108+ TGeoCompositeShape* outerBerylliumTubeVacuumComposite; // Composite volume to subctract to vacuum
109+ TGeoVolume* outerBerylliumTubeVacuumVolume; // Final volume to be used
110+
111+ TString compositeFormula{" OUT_PIPEVACUUM_BASEsh" }; // If pipe is alone we won't subctract anything
112+ TString subtractorsFormula;
113+
114+ if (!mIsTRKActivated ) {
115+ std::vector<TGeoTube*> trkLayerShapes;
116+ std::vector<std::array<float , 3 >> layersQuotas = {std::array<float , 3 >{0 .5f , 15 .f , 50 .e -4 }, // TODO: Set layers dynamically. {radius, zLen, thickness}
117+ std::array<float , 3 >{1 .2f , 15 .f , 50 .e -4 },
118+ std::array<float , 3 >{2 .5f , 15 .f , 50 .e -4 }};
119+
120+ subtractorsFormula = " TRKLAYER_0sh" ; // First volume to be subctracted (at least one has to be provided)
121+ for (auto iLayer{0 }; iLayer < layersQuotas.size (); ++iLayer) { // Create TRK layers shapes
122+ auto & layerData = layersQuotas[iLayer];
123+ trkLayerShapes.emplace_back (new TGeoTube (Form (" TRKLAYER_%dsh" , iLayer), layerData[0 ], layerData[0 ] + layerData[2 ], layerData[1 ] / 2 ));
124+ if (iLayer > 0 ) {
125+ subtractorsFormula += Form (" +TRKLAYER_%dsh" , iLayer);
126+ }
127+ }
128+ LOG (DEBUG) << " Subtractors formula before: " << subtractorsFormula;
129+ subtractorsFormula = Form (" -(%s)" , subtractorsFormula.Data ());
130+ LOG (DEBUG) << " Subtractors formula after: " << subtractorsFormula;
131+
132+ outerBerylliumTubeVacuumComposite = new TGeoCompositeShape (" OUT_PIPEVACUUMsh" , (compositeFormula + subtractorsFormula).Data ());
133+ outerBerylliumTubeVacuumVolume = new TGeoVolume (" OUT_PIPEVACUUM" , outerBerylliumTubeVacuumComposite, kMedVac );
134+ } else {
135+ outerBerylliumTubeVacuumVolume = new TGeoVolume (" OUT_PIPEVACUUM" , outerBerylliumTubeVacuumBase, kMedVac );
136+ }
137+
138+ outerBerylliumTubeVacuumVolume->SetVisibility (1 );
139+ outerBerylliumTubeVacuumVolume->SetTransparency (50 );
140+ outerBerylliumTubeVacuumVolume->SetLineColor (kGreen );
141+
142+ // outerBeTubeVolume->AddNode(outerBerylliumTubeVacuumVolume, 1, gGeoIdentity);
143+ barrel->AddNode (outerBerylliumTubeVacuumVolume, 1 , new TGeoTranslation (0 , 30 .f , 0 ));
144+
145+ barrel->AddNode (outerBeTubeVolume, 1 , new TGeoTranslation (0 , 30 .f , 0 )); // Add to surrounding geometry
146+
95147 // ---------------- Innermost Be pipe around the IP ----------
96148 TGeoTube* innerBeTube =
97- new TGeoTube (" INN_PIPEsh" , mBeInnerPipeRmax - mBeInnerPipeThick , mBeInnerPipeRmax , mInnerIpHLength );
149+ new TGeoTube (" INN_PIPEsh" , mBeInnerPipeRmin , mBeInnerPipeRmin + mBeInnerPipeThick , mInnerIpHLength );
98150 TGeoVolume* innerBeTubeVolume = new TGeoVolume (" INN_PIPE" , innerBeTube, kMedBe );
99151 innerBeTubeVolume->SetLineColor (kRed );
100152
101153 TGeoTube* berylliumTubeVacuum =
102- new TGeoTube (" INN_PIPEVACUUMsh" , 0 ., mBeInnerPipeRmax , mInnerIpHLength );
103- TGeoVolume* innerBerylliumTubeVacuumVolume = new TGeoVolume (" INN_PIPEMOTHER" , berylliumTubeVacuum, kMedVac );
104- innerBerylliumTubeVacuumVolume->AddNode (innerBeTubeVolume, 1 , gGeoIdentity );
154+ new TGeoTube (" INN_PIPEVACUUMsh" , 0 ., mBeInnerPipeRmin , mInnerIpHLength );
155+ TGeoVolume* innerBerylliumTubeVacuumVolume = new TGeoVolume (" INN_PIPEVACUUM" , berylliumTubeVacuum, kMedVac );
105156 innerBerylliumTubeVacuumVolume->SetVisibility (0 );
106157 innerBerylliumTubeVacuumVolume->SetLineColor (kGreen );
107158
108- barrel->AddNode (innerBerylliumTubeVacuumVolume, 1 , gGeoIdentity );
109-
110- // ---------------- Outermost Be pipe around the IP ----------
111- TGeoTube* outerBeTube =
112- new TGeoTube (" OUT_PIPEsh" , mBeOuterPipeRmax - mBeOuterPipeThick , mBeOuterPipeRmax , mOuterIpHLength );
113- TGeoVolume* outerBeTubeVolume = new TGeoVolume (" OUT_PIPE" , outerBeTube, kMedBe );
114- outerBeTubeVolume->SetLineColor (kBlue );
115-
116- TGeoTube* outerBerylliumTubeVacuum =
117- new TGeoTube (" OUT_PIPEVACUUMsh" , 0 ., mBeOuterPipeRmax , mOuterIpHLength );
118- TGeoVolume* outerBerylliumTubeVacuumVolume = new TGeoVolume (" OUT_PIPEMOTHER" , outerBerylliumTubeVacuum, kMedVac );
119- outerBerylliumTubeVacuumVolume->AddNode (outerBeTubeVolume, 1 , gGeoIdentity );
120- outerBerylliumTubeVacuumVolume->SetVisibility (0 );
121- outerBerylliumTubeVacuumVolume->SetLineColor (kGreen );
122-
123- barrel->AddNode (outerBerylliumTubeVacuumVolume, 1 , gGeoIdentity );
159+ innerBeTubeVolume->AddNode (innerBerylliumTubeVacuumVolume, 1 , gGeoIdentity );
160+ barrel->AddNode (innerBeTubeVolume, 1 , new TGeoTranslation (0 , 30 .f , 0 ));
124161}
125162
126163void Alice3Pipe::createMaterials ()
0 commit comments