R3BROOT
R3B analysis software
Loading...
Searching...
No Matches
create_neuland_geo.C
Go to the documentation of this file.
1/******************************************************************************
2 * Copyright (C) 2023 GSI Helmholtzzentrum für Schwerionenforschung GmbH *
3 * Copyright (C) 2023-2025 Members of R3B Collaboration *
4 * *
5 * This software is distributed under the terms of the *
6 * GNU General Public Licence (GPL) version 3, *
7 * copied verbatim in the file "LICENSE". *
8 * *
9 * In applying this license GSI does not waive the privileges and immunities *
10 * granted to it by virtue of its status as an Intergovernmental Organization *
11 * or submit itself to any jurisdiction. *
12 ******************************************************************************/
13
15#include "TGeoManager.h"
16#include "TMath.h"
17#include <iomanip>
18#include <iostream>
19
28
29void create_neuland_geo(const Int_t nPlanes = 26 /*, const TString geoTag = "v2022.5"*/)
30{
31 new FairGeoLoader("TGeo", "FairGeoLoader");
32 gGeoManager->SetName("NEULANDgeom");
33
34 TGeoVolume* volPaddle = BuildPaddleVolume();
35 TGeoRotation* rot0 = nullptr;
36 TGeoRotation* rot90 = new TGeoRotation();
37 rot90->RotateZ(90.);
38
39 TGeoVolume* volNeuland = new TGeoVolumeAssembly("volNeuland");
40 Int_t nindex = 0, nPlane = 0;
42 b += gPaddleDistance * 2)
43 {
44 nPlane++;
46 a += gPaddleDistance * 2)
47 {
48 nindex++;
49 if (nPlane % 2 == 1)
50 {
51 volNeuland->AddNode(volPaddle, nindex, new TGeoTranslation(0, a, b));
52 }
53 else
54 {
55 volNeuland->AddNode(volPaddle, nindex, new TGeoCombiTrans(a, 0, b, rot90));
56 }
57 }
58 }
59
60 TGeoVolume* top = new TGeoVolumeAssembly("TOP");
61 gGeoManager->SetTopVolume(top);
62 top->AddNode(volNeuland, 1, new TGeoCombiTrans(0., 0., 0., rot0));
63
64 // --------------- Finish -----------------------------------------------
65 gGeoManager->CloseGeometry();
66 gGeoManager->CheckOverlaps(0.001);
67 gGeoManager->PrintOverlaps();
68 gGeoManager->Test();
69
70 // ------- Geometry file name (output) ----------------------------------
71 TString geoFileName = TString::Format("%s/geometry/neuland_%ddp.geo.root",
72 TString(gSystem->Getenv("VMCWORKDIR")).Data(),
73 // geoTag.Data(),
74 nPlanes / 2);
75 TFile geoFile(geoFileName, "RECREATE");
76 top->Write();
77 geoFile.Close();
78
79 std::cout << std::endl;
80 std::cout << "Done. " << nindex << " Paddles in " << nPlane << " Planes" << std::endl;
81 std::cout << std::endl;
82 std::cout << "\033[34m Creating geometry:\033[0m "
83 << "\033[33m" << geoFileName << " \033[0m" << std::endl;
84 std::cout << "Macro finished successfully." << std::endl;
85}
void create_neuland_geo(const Int_t nPlanes=26)
Comments:
const Int_t gPaddlesPerPlane
const Double_t gPaddleDistance
TGeoVolume * BuildPaddleVolume()
A paddle consists of the scintillator volume, wrapped with Al and Tape.
constexpr Int_t nPlanes