98 TGeoVolume *detector = gGeoManager->FindVolumeFast(
"Detector");
100 LOG(ERROR) <<
"no Detector volume found ";
104 InitMedium(
"aluminium");
105 TGeoMedium *aluminium = gGeoManager->GetMedium(
"aluminium");
107 TGeoMedium *steel = gGeoManager->GetMedium(
"steel");
112 InitMedium(
"DTGasMixture");
113 TGeoMedium *DTGasMixture = gGeoManager->GetMedium(
"DTGasMixture");
118 Double_t fCellWidth =
conf_floats[
"DriftTube/cellWidth"];
119 Double_t fCellHeight =
conf_floats[
"DriftTube/cellHeight"];
120 Double_t fCellLength =
conf_floats[
"DriftTube/cellLength"];
121 Double_t fIBeamThickness =
conf_floats[
"DriftTube/IBeamThickness"];
122 Double_t fIBeamWingThickness =
conf_floats[
"DriftTube/IBeamWingThickness"];
123 Double_t fIBeamWingWidth =
conf_floats[
"DriftTube/IBeamWingWidth"];
125 Double_t fPlateThickness =
conf_floats[
"DriftTube/plateThickness"];
126 Double_t fPlateWidth =
conf_floats[
"DriftTube/plateWidth"];
127 Double_t fPlateLength =
conf_floats[
"DriftTube/plateLength"];
129 Double_t fcoverPlateThickness =
conf_floats[
"DriftTube/coverPlateThickness"];
130 Double_t fcoverPlateWidth =
conf_floats[
"DriftTube/coverPlateWidth"];
131 Double_t fcoverPlateLength =
conf_floats[
"DriftTube/coverPlateLength"];
132 Double_t fAnodeRad =
conf_floats[
"DriftTube/anodeRad"];
134 Double_t fFrameThickness =
conf_floats[
"DriftTube/frameThickness"];
135 Double_t fFrameWidth =
conf_floats[
"DriftTube/frameWidth"];
136 Double_t fFrameLength =
conf_floats[
"DriftTube/frameLength"];
137 Double_t fFrameHoleThickness =
conf_floats[
"DriftTube/frameHoleThickness"];
138 Double_t fFrameHoleWidth =
conf_floats[
"DriftTube/frameHoleWidth"];
139 Double_t fFrameHoleLength =
conf_floats[
"DriftTube/frameHoleLength"];
140 Double_t fFrameTopThickness =
conf_floats[
"DriftTube/frameTopThickness"];
142 Double_t fSideBarThickness =
conf_floats[
"DriftTube/sideBarThickness"];
143 Double_t fSideBarWidth =
conf_floats[
"DriftTube/sideBarWidth"];
144 Double_t fSideBarLength =
conf_floats[
"DriftTube/sideBarLength"];
145 Int_t nPlanes =
conf_ints[
"DriftTube/nPlanes"];
146 Int_t nLayers =
conf_ints[
"DriftTube/nLayers"];
147 Int_t nCells =
conf_ints[
"DriftTube/nCells"];
151 std::map<int, TVector3> edge_DriftTube;
157 std::map<int, TVector3> LocCellDT;
165 TVector3 displacement;
169 TGeoBBox *beam =
new TGeoBBox(
"beam", fIBeamWingWidth / 2, fCellHeight / 2, fCellLength / 2);
172 new TGeoTubeSeg(
"tube", 0., fCellHeight / 2 - fIBeamWingThickness + 1e-4, fCellLength / 2 + 1e-4, 270., 90.);
173 TGeoRotation *rot1 =
new TGeoRotation(
"rot1", 0., 0., 180.);
174 TGeoCombiTrans *transRbeam =
new TGeoCombiTrans(fIBeamWingWidth / 2 + 1e-4, 0., 0., rot1);
175 transRbeam->SetName(
"transRbeam");
176 transRbeam->RegisterYourself();
177 TGeoCompositeShape *IbeamShape =
new TGeoCompositeShape(
"IbeamShape",
"beam-(tube:transRbeam)");
178 TGeoVolume *volIbeam =
new TGeoVolume(
"volIbeam", IbeamShape, aluminium);
179 volIbeam->SetLineColor(kGray + 3);
181 TGeoBBox *cellEnvelope =
182 new TGeoBBox(
"cellEnvelope", fCellWidth / 2 - 1e-5, fCellHeight / 2 - 1e-5, fCellLength / 2 - 1e-5);
183 TGeoCombiTrans *transR =
new TGeoCombiTrans((fCellWidth - fIBeamWingWidth) / 2, 0., 0., rot1);
184 transR->SetName(
"transR");
185 transR->RegisterYourself();
186 TGeoCombiTrans *transL =
new TGeoCombiTrans(TGeoTranslation(-(fCellWidth - fIBeamWingWidth) / 2, 0., 0.),
187 TGeoRotation(
"rot0", 0., 0., 0.));
188 transL->SetName(
"transL");
189 transL->RegisterYourself();
191 TGeoTube *anode =
new TGeoTube(
"anode", 0., fAnodeRad, fCellLength / 2);
192 TGeoTranslation *t0 =
new TGeoTranslation(
"t0", 0, 0, 0);
193 t0->RegisterYourself();
195 TGeoCompositeShape *cellShape =
196 new TGeoCompositeShape(
"cellShape",
"cellEnvelope-anode:t0-IbeamShape:transR-IbeamShape:transL");
197 TGeoVolume *volGasCell =
new TGeoVolume(
"volGasCell", cellShape, DTGasMixture);
199 AddSensitiveVolume(volGasCell);
200 volGasCell->SetLineColor(kBlue - 2);
201 volGasCell->SetTransparency(50);
204 TGeoVolume *volAnode =
new TGeoVolume(
"volAnode", anode, steel);
205 volAnode->SetLineColor(kViolet);
207 TGeoVolume *volCell =
new TGeoVolumeAssembly(
"volCell");
208 volCell->AddNode(volGasCell, 1);
209 volCell->AddNode(volAnode, 2);
211 TGeoBBox *IbeamBox =
dynamic_cast<TGeoBBox *
>(volIbeam->GetShape());
212 TGeoBBox *cellBox =
dynamic_cast<TGeoBBox *
>(volGasCell->GetShape());
216 TGeoBBox *halfFrameOuterBox =
new TGeoBBox(
"halfFrameOuterBox", fFrameWidth / 2, fFrameLength / 2, fFrameThickness / 2);
218 TGeoBBox *halfFrameHole =
219 new TGeoBBox(
"halfFrameHole", fFrameHoleWidth / 2, fFrameHoleLength / 2, fFrameHoleThickness / 2 );
220 TGeoBBox *halfFrameTopBox =
new TGeoBBox(
"halfFrameTopBox", fFrameWidth / 2, fFrameLength / 2, fFrameTopThickness / 2);
221 TGeoTranslation *t1 =
new TGeoTranslation(
"t1", 0, 0, fFrameThickness/2 + fFrameTopThickness / 2);
222 t1->RegisterYourself();
223 TGeoCompositeShape *frameShape =
new TGeoCompositeShape(
"frameShape",
"halfFrameOuterBox-halfFrameHole:t0+halfFrameTopBox:t1");
224 TGeoVolume *volFrame =
new TGeoVolume(
"volFrame", frameShape, aluminium);
225 volFrame->SetLineColor(kGray + 4);
227 TGeoBBox *sideBar =
new TGeoBBox(
"sideBar", fSideBarWidth /2 , fSideBarLength /2, fSideBarThickness /2);
228 TGeoVolume *volSideBar =
new TGeoVolume(
"volSideBar", sideBar, aluminium);
229 volSideBar->SetLineColor(kGray + 5);
232 TGeoBBox *plate =
new TGeoBBox(
"plate", fPlateWidth / 2, fPlateThickness / 2, fPlateLength / 2);
233 TGeoVolume *volPlate =
new TGeoVolume(
"volPlate", plate, aluminium);
234 volPlate->SetLineColor(kGray);
235 TGeoBBox *coverPlate =
236 new TGeoBBox(
"coverPlate", fcoverPlateWidth / 2, fcoverPlateThickness / 2, fcoverPlateLength / 2);
237 TGeoVolume *volCoverPlate =
new TGeoVolume(
"volCoverPlate", coverPlate, aluminium);
238 volCoverPlate->SetLineColor(kGray + 2);
241 double DTlayerBox_x{};
243 for (
auto &&plane : TSeq(nPlanes)) {
244 TGeoVolumeAssembly *volDTplane =
new TGeoVolumeAssembly(
"volDriftTubePlane");
245 volDTplane->AddNode(volCoverPlate, 1,
new TGeoTranslation(fcoverPlateWidth / 2, fcoverPlateThickness / 2, 0.));
246 for (
auto &&layer : TSeq(nLayers)) {
247 TGeoVolumeAssembly *volDTlayer =
new TGeoVolumeAssembly(
"volLayer");
248 for (
auto &&cell : TSeq(nCells)) {
251 new TGeoTranslation(IbeamBox->GetDX() + cell * (2 * cellBox->GetDX()), fCellHeight / 2, 0.));
253 volCell,
int(4e4 + plane * 1e3 + layer * 1e2 + cell),
254 new TGeoTranslation(cellBox->GetDX() + cell * (cellBox->GetDX() * 2), fCellHeight / 2, 0.));
257 new TGeoCombiTrans(-IbeamBox->GetDX() + cellBox->GetDX() * 2 + cell * (cellBox->GetDX() * 2),
258 fCellHeight / 2, 0., rot1));
262 new TGeoTranslation( -fcoverPlateWidth/ 2 + nCells*(cellBox->GetDX()+IbeamBox->GetDX()) + (layer+1) % 2 * cellBox->GetDX(),
263 fcoverPlateThickness + layer * (fPlateThickness + 2 * IbeamBox->GetDY()), 0));
265 for (
auto &&side : TSeq(2)) {
268 new TGeoCombiTrans(TGeoTranslation( side* fcoverPlateWidth,
269 fSideBarLength/2 + fcoverPlateThickness + layer * (fPlateThickness + 2 * IbeamBox->GetDY()),
271 TGeoRotation(
"rot_all", 90, 90., 90.)));
273 if (layer != nLayers - 1) {
274 volDTplane->AddNode(volPlate, 0,
275 new TGeoTranslation( fcoverPlateWidth/ 2,
276 fPlateThickness / 2 + fcoverPlateThickness + 2 * IbeamBox->GetDY() +
277 layer * (fPlateThickness + 2 * IbeamBox->GetDY()),
281 volDTplane->AddNode(volCoverPlate, 1,
282 new TGeoTranslation( fcoverPlateWidth / 2,
283 fcoverPlateThickness / 2 + fcoverPlateThickness + 2 * IbeamBox->GetDY() +
284 (nLayers - 1) * (fPlateThickness + 2 * IbeamBox->GetDY()),
287 volDTplane->AddNode(volFrame, 2,
288 new TGeoTranslation( fcoverPlateWidth / 2,
289 ( 3 * fPlateThickness + 2 * fcoverPlateThickness + nLayers * 2*IbeamBox->GetDY()) / 2,
290 fcoverPlateLength / 2 + fFrameThickness/2 ));
291 volDTplane->AddNode(volFrame, 2,
292 new TGeoTranslation( fcoverPlateWidth / 2,
293 ( 3 * fPlateThickness + 2 * fcoverPlateThickness + nLayers * 2*IbeamBox->GetDY()) / 2,
294 - fcoverPlateLength / 2 - fFrameThickness/2 - fFrameTopThickness ));
295 displacement = edge_DriftTube[plane + 1] + LocCellDT[plane+1];
296 detector->AddNode(volDTplane, plane,
297 new TGeoCombiTrans(TGeoTranslation(displacement.X(), displacement.Y(), displacement.Z()),
298 TGeoRotation(
"rot3", -(plane + 1) * 90., 90., 0)));