Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • le.koch/cbmroot
  • patrick.pfistner_AT_kit.edu/cbmroot
  • lena.rossel_AT_stud.uni-frankfurt.de/cbmroot
  • i.deppner/cbmroot
  • fweig/cbmroot
  • karpushkin_AT_inr.ru/cbmroot
  • v.akishina/cbmroot
  • rishat.sultanov_AT_cern.ch/cbmroot
  • l_fabe01_AT_uni-muenster.de/cbmroot
  • pwg-c2f/cbmroot
  • j.decuveland/cbmroot
  • a.toia/cbmroot
  • i.vassiliev/cbmroot
  • n.herrmann/cbmroot
  • o.lubynets/cbmroot
  • se.gorbunov/cbmroot
  • cornelius.riesen_AT_physik.uni-giessen.de/cbmroot
  • zhangqn17_AT_mails.tsinghua.edu.cn/cbmroot
  • bartosz.sobol/cbmroot
  • ajit.kumar/cbmroot
  • computing/cbmroot
  • a.agarwal_AT_vecc.gov.in/cbmroot
  • osingh/cbmroot
  • wielanek_AT_if.pw.edu.pl/cbmroot
  • malgorzata.karabowicz.stud_AT_pw.edu.pl/cbmroot
  • m.shiroya/cbmroot
  • s.roy/cbmroot
  • p.-a.loizeau/cbmroot
  • a.weber/cbmroot
  • ma.beyer/cbmroot
  • d.klein/cbmroot
  • d.smith/cbmroot
  • mvdsoft/cbmroot
  • d.spicker/cbmroot
  • y.h.leung/cbmroot
  • aksharma/cbmroot
  • m.deveaux/cbmroot
  • mkunold/cbmroot
  • h.darwish/cbmroot
  • pk.sharma_AT_vecc.gov.in/cbmroot
  • f_fido01_AT_uni-muenster.de/cbmroot
  • g.kozlov/cbmroot
  • d.emschermann/cbmroot
  • evgeny.lavrik/cbmroot
  • v.friese/cbmroot
  • f.uhlig/cbmroot
  • ebechtel_AT_ikf.uni-frankfurt.de/cbmroot
  • a.senger/cbmroot
  • praisig/cbmroot
  • s.lebedev/cbmroot
  • redelbach_AT_compeng.uni-frankfurt.de/cbmroot
  • p.subramani/cbmroot
  • a_meye37_AT_uni-muenster.de/cbmroot
  • om/cbmroot
  • o.golosov/cbmroot
  • l.chlad/cbmroot
  • a.bercuci/cbmroot
  • d.ramirez/cbmroot
  • v.singhal/cbmroot
  • h.schiller/cbmroot
  • apuntke/cbmroot
  • f.zorn/cbmroot
  • rubio_AT_physi.uni-heidelberg.de/cbmroot
  • p.chudoba/cbmroot
  • apuntke/mcbmroot
  • r.karabowicz/cbmroot
66 results
Show changes
Showing
with 69 additions and 6024 deletions
...@@ -99,7 +99,7 @@ Double_t CbmMcbm2018RichPar::GetToTshift2(Int_t tdcIdx, Int_t ch) const ...@@ -99,7 +99,7 @@ Double_t CbmMcbm2018RichPar::GetToTshift2(Int_t tdcIdx, Int_t ch) const
return fToTshiftMap[tdcIdx * 33 + ch]; return fToTshiftMap[tdcIdx * 33 + ch];
} }
void CbmMcbm2018RichPar::Print() const void CbmMcbm2018RichPar::Print(Option_t*) const
{ {
LOG(info) << "Nb available TRB addresses: " << GetNaddresses(); LOG(info) << "Nb available TRB addresses: " << GetNaddresses();
......
...@@ -60,7 +60,7 @@ public: ...@@ -60,7 +60,7 @@ public:
*/ */
Double_t GetToTshift2(Int_t tdcIdx, Int_t ch) const; Double_t GetToTshift2(Int_t tdcIdx, Int_t ch) const;
void Print() const; void Print(Option_t* option = "") const;
private: // Stored in the par file private: // Stored in the par file
/** /**
......
...@@ -8,4 +8,5 @@ flib_dpb/flib_dpb ...@@ -8,4 +8,5 @@ flib_dpb/flib_dpb
ipc/ipc ipc/ipc
jsroot jsroot
googletest googletest
yaml-cpp/
xpu/
...@@ -35,6 +35,17 @@ if(DOWNLOAD_EXTERNALS) ...@@ -35,6 +35,17 @@ if(DOWNLOAD_EXTERNALS)
set(KF_DEPENDS_ON "") set(KF_DEPENDS_ON "")
endif() endif()
download_project_if_needed(PROJECT xpu
GIT_REPOSITORY "https://git.cbm.gsi.de/fweig/xpu.git"
GIT_TAG "v0.6.4"
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/xpu
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
)
Add_Subdirectory(xpu)
Include(InstallKFParticle.cmake) Include(InstallKFParticle.cmake)
Include(InstallNicaFemto.cmake) Include(InstallNicaFemto.cmake)
Include(InstallAnalysisTree.cmake) Include(InstallAnalysisTree.cmake)
...@@ -43,6 +54,8 @@ if(DOWNLOAD_EXTERNALS) ...@@ -43,6 +54,8 @@ if(DOWNLOAD_EXTERNALS)
Include(InstallParameter.cmake) Include(InstallParameter.cmake)
Include(InstallInput.cmake) Include(InstallInput.cmake)
Include(InstallGeometry.cmake) Include(InstallGeometry.cmake)
Include(InstallYamlCpp.cmake)
else() else()
# Define targets which are needed by CbmRoot but are not available # Define targets which are needed by CbmRoot but are not available
# whithout the external packages # whithout the external packages
......
set(YAMLCPP_VERSION 0579ae3d976091d7d664aa9d2527e0d0cff25763) # version 0.7.0
set(YAMLCPP_SRC_URL "https://github.com/jbeder/yaml-cpp")
set(YAMLCPP_DESTDIR "${CMAKE_BINARY_DIR}/external/YAMLCPP-prefix")
#set(YAMLCPP_BYPRODUCT "${PROJECT_BINARY_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}yaml-cpp${CMAKE_SHARED_LIBRARY_SUFFIX}")
download_project_if_needed(PROJECT yaml-cpp
GIT_REPOSITORY ${YAMLCPP_SRC_URL}
GIT_TAG ${YAMLCPP_VERSION}
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/yaml-cpp
TEST_FILE CMakeLists.txt
)
If(ProjectUpdated)
File(REMOVE_RECURSE ${YAMLCPP_DESTDIR})
Message("yaml-cpp source directory was changed so build directory was deleted")
EndIf()
ExternalProject_Add(
yaml-cpp
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/yaml-cpp
GIT_CONFIG advice.detachedHead=false
BUILD_IN_SOURCE 0
LOG_DOWNLOAD 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1
CMAKE_ARGS -DYAML_CPP_BUILD_CONTRIB=OFF
-DYAML_CPP_BUILD_TOOLS=OFF
-DYAML_CPP_BUILD_TESTS=OFF
-DYAML_BUILD_SHARED_LIBS=OFF
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
BUILD_COMMAND ${CMAKE_COMMAND} --build . --target yaml-cpp --parallel 1
BUILD_BYPRODUCTS ${PROJECT_BINARY_DIR}/external/yaml-cpp-prefix/src/yaml-cpp-build/${CMAKE_STATIC_LIBRARY_PREFIX}yaml-cpp${CMAKE_STATIC_LIBRARY_SUFFIX}
INSTALL_COMMAND ""
)
# pre-create empty directory to make INTERFACE_INCLUDE_DIRECTORIES happy
file(MAKE_DIRECTORY ${CMAKE_SOURCE_DIR}/external/yaml-cpp/include)
add_library(external::yaml-cpp STATIC IMPORTED GLOBAL)
add_dependencies(external::yaml-cpp yaml-cpp)
set_target_properties(external::yaml-cpp PROPERTIES
IMPORTED_LOCATION ${PROJECT_BINARY_DIR}/external/yaml-cpp-prefix/src/yaml-cpp-build/${CMAKE_STATIC_LIBRARY_PREFIX}yaml-cpp${CMAKE_STATIC_LIBRARY_SUFFIX}
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_SOURCE_DIR}/external/yaml-cpp/include
)
This diff is collapsed.
Geometries for mCBM
=========================================
# 1. Geometry macros
The geometry macros moved to the following folder:
geometry/<subsystem>/mcbm
/* Copyright (C) 2013-2017 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
SPDX-License-Identifier: GPL-3.0-only
Authors: Volker Friese, David Emschermann [committer] */
/******************************************************************************
** Creation of beam pipe geometry in ROOT format (TGeo).
**
** @file create_pipegeo_v16.C
** @author Volker Friese <v.friese@gsi.de>
** @date 11.10.2013
**
** The beam pipe is composed of carbon with a thickness of 0.5 mm. It is
** placed directly into the cave as mother volume.
** The pipe consists of a number of parts. Each part has a PCON
** shape. The beam pipe inside the RICH is part of the RICH geometry;
** the beam pipe geometry thus excludes the z range of the RICH in case
** the latter is present in the setup.
*****************************************************************************/
#include "TGeoManager.h"
#include <iomanip>
#include <iostream>
using namespace std;
// ------------- Other global variables -----------------------------------
// ---> TGeoManager (too lazy to write out 'Manager' all the time
TGeoManager* gGeoMan = NULL; // will be set later
// ----------------------------------------------------------------------------
// ============================================================================
// ====== Main function =====
// ============================================================================
void create_platform_v18a()
{
// ----- Define platform parts ----------------------------------------------
/** For v18a (mCBM) **/
TString geoTag = "v18a_mcbm";
// Double_t platform_angle = 25.; // rotation angle around y-axis
Double_t platform_angle = 19.; // rotation angle around y-axis
Double_t platX_offset = -230.; // offset to the right side along x-axis
Double_t sizeX = 80.0; // symmetric in x
Double_t sizeY = 200.0; // without rails
Double_t sizeZ = 500.0; // short version
// Double_t endZ = 450.0; // ends at z = 450.0
// /** For v16b (SIS 300) **/
// TString geoTag = "v16b";
// Double_t sizeX = 725.0; // symmetric in x
// Double_t sizeY = 234.0; // without rails
// Double_t sizeZ = 455.0; // long version
// Double_t endZ = 540.0; // ends at z = 450.0
// Double_t beamY = 570.0; // nominal beam height
Double_t beamY = 100.0; // nominal beam height
Double_t posX = -sizeX / 2.;
Double_t posY = -beamY + sizeY / 2.; // rest on the floor at -beamY
Double_t posZ = +sizeZ / 2.;
// --------------------------------------------------------------------------
// ------- Geometry file name (output) ----------------------------------
TString geoFileName = "platform_";
geoFileName = geoFileName + geoTag + ".geo.root";
// --------------------------------------------------------------------------
// ------- Open info file -----------------------------------------------
TString infoFileName = geoFileName;
infoFileName.ReplaceAll("root", "info");
fstream infoFile;
infoFile.open(infoFileName.Data(), fstream::out);
infoFile << "Platform geometry created with create_platform_v16.C" << std::endl << std::endl;
// --------------------------------------------------------------------------
// ------- Load media from media file -----------------------------------
FairGeoLoader* geoLoad = new FairGeoLoader("TGeo", "FairGeoLoader");
FairGeoInterface* geoFace = geoLoad->getGeoInterface();
TString geoPath = gSystem->Getenv("VMCWORKDIR");
TString medFile = geoPath + "/geometry/media.geo";
geoFace->setMediaFile(medFile);
geoFace->readMedia();
gGeoMan = gGeoManager;
// --------------------------------------------------------------------------
// ----------------- Get and create the required media -----------------
FairGeoMedia* geoMedia = geoFace->getMedia();
FairGeoBuilder* geoBuild = geoLoad->getGeoBuilder();
// ---> aluminium
FairGeoMedium* mAluminium = geoMedia->getMedium("aluminium");
if (!mAluminium) Fatal("Main", "FairMedium aluminium not found");
geoBuild->createMedium(mAluminium);
TGeoMedium* aluminium = gGeoMan->GetMedium("aluminium");
if (!aluminium) Fatal("Main", "Medium aluminium not found");
// // ---> air
// FairGeoMedium* mAir = geoMedia->getMedium("air");
// if ( ! mAir ) Fatal("Main", "FairMedium air not found");
// geoBuild->createMedium(mAir);
// TGeoMedium* air = gGeoMan->GetMedium("air");
// if ( ! air ) Fatal("Main", "Medium air not found");
// --------------------------------------------------------------------------
// -------------- Create geometry and top volume -------------------------
gGeoMan = (TGeoManager*) gROOT->FindObject("FAIRGeom");
gGeoMan->SetName("PLATFORMgeom");
TGeoVolume* top = new TGeoVolumeAssembly("top");
gGeoMan->SetTopVolume(top);
TString platformName = "platform_";
platformName += geoTag;
TGeoVolume* platform = new TGeoVolumeAssembly(platformName.Data());
// --------------------------------------------------------------------------
// ----- Create ---------------------------------------------------------
TGeoBBox* platform_base = new TGeoBBox("", sizeX / 2., sizeY / 2., sizeZ / 2.);
TGeoVolume* platform_vol = new TGeoVolume("platform", platform_base, aluminium);
platform_vol->SetLineColor(kBlue);
platform_vol->SetTransparency(70);
TGeoTranslation* platform_trans = new TGeoTranslation("", posX, posY, posZ);
platform->AddNode(platform_vol, 1, platform_trans);
infoFile << "sizeX: " << setprecision(2) << sizeX << "sizeY: " << setprecision(2) << sizeY
<< "sizeZ: " << setprecision(2) << sizeZ << endl;
infoFile << "posX : " << setprecision(2) << posX << "posY : " << setprecision(2) << posY
<< "posZ : " << setprecision(2) << posZ << endl;
// --------------- Finish -----------------------------------------------
top->AddNode(platform, 1);
cout << endl << endl;
gGeoMan->CloseGeometry();
gGeoMan->CheckOverlaps(0.001);
gGeoMan->PrintOverlaps();
gGeoMan->Test();
platform->Export(geoFileName); // an alternative way of writing the platform volume
TFile* geoFile = new TFile(geoFileName, "UPDATE");
// rotate the platform around y
TGeoRotation* platform_rotation = new TGeoRotation();
platform_rotation->RotateY(platform_angle);
// TGeoCombiTrans* platform_placement = new TGeoCombiTrans( sin( platform_angle/180.*acos(-1) ) * z1[1]/2., 0., 0., platform_rotation);
TGeoCombiTrans* platform_placement = new TGeoCombiTrans("platform_rot", platX_offset, 0., 0, platform_rotation);
// TGeoTranslation* platform_placement = new TGeoTranslation("platform_trans", 0., 0., 0.);
platform_placement->Write();
geoFile->Close();
cout << endl;
cout << "Geometry " << top->GetName() << " written to " << geoFileName << endl;
top->Draw("ogl");
infoFile.close();
}
// ============================================================================
// ====== End of main function =====
// ============================================================================
/* Copyright (C) 2013-2017 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
SPDX-License-Identifier: GPL-3.0-only
Authors: Volker Friese, David Emschermann [committer] */
/******************************************************************************
** Creation of beam pipe geometry in ROOT format (TGeo).
**
** @file create_pipegeo_v16.C
** @author Volker Friese <v.friese@gsi.de>
** @date 11.10.2013
**
** The beam pipe is composed of carbon with a thickness of 0.5 mm. It is
** placed directly into the cave as mother volume.
** The pipe consists of a number of parts. Each part has a PCON
** shape. The beam pipe inside the RICH is part of the RICH geometry;
** the beam pipe geometry thus excludes the z range of the RICH in case
** the latter is present in the setup.
*****************************************************************************/
#include "TGeoManager.h"
#include <iomanip>
#include <iostream>
using namespace std;
// ------------- Other global variables -----------------------------------
// ---> TGeoManager (too lazy to write out 'Manager' all the time
TGeoManager* gGeoMan = NULL; // will be set later
// ----------------------------------------------------------------------------
// ============================================================================
// ====== Main function =====
// ============================================================================
void create_platform_v18c()
{
// ----- Define platform parts ----------------------------------------------
/** For v18c (mCBM) **/
TString geoTag = "v18c_mcbm";
// Double_t platform_angle = 25.; // rotation angle around y-axis
// Double_t platform_angle = 19.; // rotation angle around y-axis
Double_t platform_angle = 0.; // rotation angle around y-axis
// Double_t platX_offset = -230.; // offset to the right side along x-axis
Double_t platX_offset = 0.; // offset to the right side along x-axis
Double_t sizeX = 80.0; // table width
Double_t sizeY = 80.0; // table height
Double_t sizeZ = 400.0; // table length
// Double_t endZ = 450.0; // ends at z = 450.0
// /** For v16b (SIS 300) **/
// TString geoTag = "v16b";
// Double_t sizeX = 725.0; // symmetric in x
// Double_t sizeY = 234.0; // without rails
// Double_t sizeZ = 455.0; // long version
// Double_t endZ = 540.0; // ends at z = 450.0
// Double_t beamY = 570.0; // nominal beam height
Double_t beamY = 200.0; // nominal beam height
Double_t posX = 0;
Double_t posY = -beamY + sizeY / 2.; // rest on the floor at -beamY
Double_t posZ = +sizeZ / 2.;
// --------------------------------------------------------------------------
// ------- Geometry file name (output) ----------------------------------
TString geoFileName = "platform_";
geoFileName = geoFileName + geoTag + ".geo.root";
// --------------------------------------------------------------------------
// ------- Open info file -----------------------------------------------
TString infoFileName = geoFileName;
infoFileName.ReplaceAll("root", "info");
fstream infoFile;
infoFile.open(infoFileName.Data(), fstream::out);
infoFile << "Platform geometry created with create_platform_v16.C" << std::endl << std::endl;
// --------------------------------------------------------------------------
// ------- Load media from media file -----------------------------------
FairGeoLoader* geoLoad = new FairGeoLoader("TGeo", "FairGeoLoader");
FairGeoInterface* geoFace = geoLoad->getGeoInterface();
TString geoPath = gSystem->Getenv("VMCWORKDIR");
TString medFile = geoPath + "/geometry/media.geo";
geoFace->setMediaFile(medFile);
geoFace->readMedia();
gGeoMan = gGeoManager;
// --------------------------------------------------------------------------
// ----------------- Get and create the required media -----------------
FairGeoMedia* geoMedia = geoFace->getMedia();
FairGeoBuilder* geoBuild = geoLoad->getGeoBuilder();
// // ---> aluminium
// FairGeoMedium* mAluminium = geoMedia->getMedium("aluminium");
// if ( ! mAluminium ) Fatal("Main", "FairMedium aluminium not found");
// geoBuild->createMedium(mAluminium);
// TGeoMedium* aluminium = gGeoMan->GetMedium("aluminium");
// if ( ! aluminium ) Fatal("Main", "Medium aluminium not found");
// ---> air
FairGeoMedium* mAir = geoMedia->getMedium("air");
if (!mAir) Fatal("Main", "FairMedium air not found");
geoBuild->createMedium(mAir);
TGeoMedium* air = gGeoMan->GetMedium("air");
if (!air) Fatal("Main", "Medium air not found");
// --------------------------------------------------------------------------
// -------------- Create geometry and top volume -------------------------
gGeoMan = (TGeoManager*) gROOT->FindObject("FAIRGeom");
gGeoMan->SetName("PLATFORMgeom");
TGeoVolume* top = new TGeoVolumeAssembly("top");
gGeoMan->SetTopVolume(top);
TString platformName = "platform_";
platformName += geoTag;
TGeoVolume* platform = new TGeoVolumeAssembly(platformName.Data());
// --------------------------------------------------------------------------
// ----- Create ---------------------------------------------------------
TGeoBBox* platform_base = new TGeoBBox("", sizeX / 2., sizeY / 2., sizeZ / 2.);
TGeoVolume* platform_vol = new TGeoVolume("platform", platform_base, air);
platform_vol->SetLineColor(kBlue);
platform_vol->SetTransparency(70);
TGeoTranslation* platform_trans = new TGeoTranslation("", posX, posY, posZ);
platform->AddNode(platform_vol, 1, platform_trans);
infoFile << "sizeX: " << setprecision(2) << sizeX << "sizeY: " << setprecision(2) << sizeY
<< "sizeZ: " << setprecision(2) << sizeZ << endl;
infoFile << "posX : " << setprecision(2) << posX << "posY : " << setprecision(2) << posY
<< "posZ : " << setprecision(2) << posZ << endl;
// --------------- Finish -----------------------------------------------
top->AddNode(platform, 1);
cout << endl << endl;
gGeoMan->CloseGeometry();
gGeoMan->CheckOverlaps(0.001);
gGeoMan->PrintOverlaps();
gGeoMan->Test();
platform->Export(geoFileName); // an alternative way of writing the platform volume
TFile* geoFile = new TFile(geoFileName, "UPDATE");
// rotate the platform around y
TGeoRotation* platform_rotation = new TGeoRotation();
platform_rotation->RotateY(platform_angle);
// TGeoCombiTrans* platform_placement = new TGeoCombiTrans( sin( platform_angle/180.*acos(-1) ) * z1[1]/2., 0., 0., platform_rotation);
TGeoCombiTrans* platform_placement = new TGeoCombiTrans("platform_rot", platX_offset, 0., 0, platform_rotation);
// TGeoTranslation* platform_placement = new TGeoTranslation("platform_trans", 0., 0., 0.);
platform_placement->Write();
geoFile->Close();
cout << endl;
cout << "Geometry " << top->GetName() << " written to " << geoFileName << endl;
top->Draw("ogl");
infoFile.close();
}
// ============================================================================
// ====== End of main function =====
// ============================================================================
/* Copyright (C) 2013-2018 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
SPDX-License-Identifier: GPL-3.0-only
Authors: Volker Friese, David Emschermann [committer] */
/******************************************************************************
** Creation of beam pipe geometry in ROOT format (TGeo).
**
** @file create_pipegeo_v16.C
** @author Volker Friese <v.friese@gsi.de>
** @date 11.10.2013
**
** The beam pipe is composed of carbon with a thickness of 0.5 mm. It is
** placed directly into the cave as mother volume.
** The pipe consists of a number of parts. Each part has a PCON
** shape. The beam pipe inside the RICH is part of the RICH geometry;
** the beam pipe geometry thus excludes the z range of the RICH in case
** the latter is present in the setup.
*****************************************************************************/
// 2018.08.23 - DE - shorten the table length from 400 cm to 250 cm
#include "TGeoManager.h"
#include <iomanip>
#include <iostream>
using namespace std;
// ------------- Other global variables -----------------------------------
// ---> TGeoManager (too lazy to write out 'Manager' all the time
TGeoManager* gGeoMan = NULL; // will be set later
// ----------------------------------------------------------------------------
// ============================================================================
// ====== Main function =====
// ============================================================================
void create_platform_v18d()
{
// ----- Define platform parts ----------------------------------------------
/** For v18d (mCBM) **/
TString geoTag = "v18d_mcbm";
// Double_t platform_angle = 25.; // rotation angle around y-axis
// Double_t platform_angle = 19.; // rotation angle around y-axis
Double_t platform_angle = 0.; // rotation angle around y-axis
// Double_t platX_offset = -230.; // offset to the right side along x-axis
Double_t platX_offset = 0.; // offset to the right side along x-axis
Double_t sizeX = 80.0; // table width
Double_t sizeY = 80.0; // table height
Double_t sizeZ = 250.0; // table length
// Double_t endZ = 450.0; // ends at z = 450.0
// /** For v16b (SIS 300) **/
// TString geoTag = "v16b";
// Double_t sizeX = 725.0; // symmetric in x
// Double_t sizeY = 234.0; // without rails
// Double_t sizeZ = 455.0; // long version
// Double_t endZ = 540.0; // ends at z = 450.0
// Double_t beamY = 570.0; // nominal beam height
Double_t beamY = 200.0; // nominal beam height
Double_t posX = 0;
Double_t posY = -beamY + sizeY / 2.; // rest on the floor at -beamY
Double_t posZ = +sizeZ / 2.;
// --------------------------------------------------------------------------
// ------- Geometry file name (output) ----------------------------------
TString geoFileName = "platform_";
geoFileName = geoFileName + geoTag + ".geo.root";
// --------------------------------------------------------------------------
// ------- Open info file -----------------------------------------------
TString infoFileName = geoFileName;
infoFileName.ReplaceAll("root", "info");
fstream infoFile;
infoFile.open(infoFileName.Data(), fstream::out);
infoFile << "Platform geometry created with create_platform_v16.C" << std::endl << std::endl;
// --------------------------------------------------------------------------
// ------- Load media from media file -----------------------------------
FairGeoLoader* geoLoad = new FairGeoLoader("TGeo", "FairGeoLoader");
FairGeoInterface* geoFace = geoLoad->getGeoInterface();
TString geoPath = gSystem->Getenv("VMCWORKDIR");
TString medFile = geoPath + "/geometry/media.geo";
geoFace->setMediaFile(medFile);
geoFace->readMedia();
gGeoMan = gGeoManager;
// --------------------------------------------------------------------------
// ----------------- Get and create the required media -----------------
FairGeoMedia* geoMedia = geoFace->getMedia();
FairGeoBuilder* geoBuild = geoLoad->getGeoBuilder();
// // ---> aluminium
// FairGeoMedium* mAluminium = geoMedia->getMedium("aluminium");
// if ( ! mAluminium ) Fatal("Main", "FairMedium aluminium not found");
// geoBuild->createMedium(mAluminium);
// TGeoMedium* aluminium = gGeoMan->GetMedium("aluminium");
// if ( ! aluminium ) Fatal("Main", "Medium aluminium not found");
// ---> air
FairGeoMedium* mAir = geoMedia->getMedium("air");
if (!mAir) Fatal("Main", "FairMedium air not found");
geoBuild->createMedium(mAir);
TGeoMedium* air = gGeoMan->GetMedium("air");
if (!air) Fatal("Main", "Medium air not found");
// --------------------------------------------------------------------------
// -------------- Create geometry and top volume -------------------------
gGeoMan = (TGeoManager*) gROOT->FindObject("FAIRGeom");
gGeoMan->SetName("PLATFORMgeom");
TGeoVolume* top = new TGeoVolumeAssembly("top");
gGeoMan->SetTopVolume(top);
TString platformName = "platform_";
platformName += geoTag;
TGeoVolume* platform = new TGeoVolumeAssembly(platformName.Data());
// --------------------------------------------------------------------------
// ----- Create ---------------------------------------------------------
TGeoBBox* platform_base = new TGeoBBox("", sizeX / 2., sizeY / 2., sizeZ / 2.);
TGeoVolume* platform_vol = new TGeoVolume("platform", platform_base, air);
platform_vol->SetLineColor(kBlue);
platform_vol->SetTransparency(70);
TGeoTranslation* platform_trans = new TGeoTranslation("", posX, posY, posZ);
platform->AddNode(platform_vol, 1, platform_trans);
infoFile << "sizeX: " << setprecision(2) << sizeX << "sizeY: " << setprecision(2) << sizeY
<< "sizeZ: " << setprecision(2) << sizeZ << endl;
infoFile << "posX : " << setprecision(2) << posX << "posY : " << setprecision(2) << posY
<< "posZ : " << setprecision(2) << posZ << endl;
// --------------- Finish -----------------------------------------------
top->AddNode(platform, 1);
cout << endl << endl;
gGeoMan->CloseGeometry();
gGeoMan->CheckOverlaps(0.001);
gGeoMan->PrintOverlaps();
gGeoMan->Test();
platform->Export(geoFileName); // an alternative way of writing the platform volume
TFile* geoFile = new TFile(geoFileName, "UPDATE");
// rotate the platform around y
TGeoRotation* platform_rotation = new TGeoRotation();
platform_rotation->RotateY(platform_angle);
// TGeoCombiTrans* platform_placement = new TGeoCombiTrans( sin( platform_angle/180.*acos(-1) ) * z1[1]/2., 0., 0., platform_rotation);
TGeoCombiTrans* platform_placement = new TGeoCombiTrans("platform_rot", platX_offset, 0., 0, platform_rotation);
// TGeoTranslation* platform_placement = new TGeoTranslation("platform_trans", 0., 0., 0.);
platform_placement->Write();
geoFile->Close();
cout << endl;
cout << "Geometry " << top->GetName() << " written to " << geoFileName << endl;
top->Draw("ogl");
infoFile.close();
}
// ============================================================================
// ====== End of main function =====
// ============================================================================
/* Copyright (C) 2017 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
SPDX-License-Identifier: GPL-3.0-only
Authors: David Emschermann [committer] */
//
/// \file create_MUCH_geometry_v18b.C
/// \brief Generates MUCH geometry in Root format.
///
// 2017-09-04 - PPB - mcbm - preliminary version of mini much geometry
// 2017-05-16 - DE - v17b - position the modules in a way to split layers left-right along y axis
// 2017-05-16 - DE - v17b - attribute name to module frames
// 2017-05-16 - DE - v17b - remove rim from support CompositeShape
// 2017-05-02 - PPB - v17a - Change the shape of the first absorber according to latest design
// 2017-04-27 - DE - v17a - fix GEM module positions and angles
// 2017-04-22 - PPB - v17a - Define the absorber, shield and station shapes sizes ...
// 2016-04-19 - DE - v17a - initial version derived from TRD
// in root all sizes are given in cm
#include "TClonesArray.h"
#include "TDatime.h"
#include "TFile.h"
#include "TGeoBBox.h"
#include "TGeoCompositeShape.h"
#include "TGeoCone.h"
#include "TGeoManager.h"
#include "TGeoMaterial.h"
#include "TGeoMatrix.h"
#include "TGeoMedium.h"
#include "TGeoPgon.h"
#include "TGeoTube.h"
#include "TGeoVolume.h"
#include "TGeoXtru.h"
#include "TList.h"
#include "TMath.h"
#include "TObjArray.h"
#include "TRandom3.h"
#include "TString.h"
#include "TSystem.h"
#include <cassert>
#include <fstream>
#include <iostream>
#include <stdexcept>
// Name of output file with geometry
const TString tagVersion = "v18b";
const TString geoVersion = "much_" + tagVersion;
//const TString subVersion = "_3oclock";
//const TString geoVersion = "much_" + tagVersion + subVersion;
const TString FileNameSim = geoVersion + "_mcbm.geo.root";
const TString FileNameGeo = geoVersion + "_mcbm_geo.root";
const TString FileNameInfo = geoVersion + "_mcbm.geo.info";
// Names of the different used materials which are used to build the modules
// The materials are defined in the global media.geo file
const TString KeepingVolumeMedium = "air";
const TString L = "MUCHlead";
const TString W = "MUCHwolfram";
const TString C = "MUCHcarbon";
const TString I = "MUCHiron";
const TString activemedium = "MUCHargon";
const TString spacermedium = "MUCHnoryl";
const TString coolmedium = "aluminium"; //Al cooling plates
// Universal input parameters
// The inner angle is 11 degree (polar angle); We take z = 70 cm;
//Inner radius: R_in=z*tan(theta_min) cm
// Outer angle is decided from tan(theta_max)=R_out/z
// R_out=R_in+95 cm (transverse size of the M2 module)
Double_t fMuchZ1 = 0.0; // MuchCave Zin position [cm]
Double_t fAcceptanceTanMin = 0.19; // Acceptance tangent min (11 degree)
//************************************************************
// Input parameters for MUCH stations
//********************************************
const Int_t fNst = 1; // Number of stations
// Sector-type module parameters
// Number of sectors per layer (should be even for symmetry)
// Needs to be fixed with actual numbers
Double_t fActiveLzSector = 0.3; // Active volume thickness [cm]
Double_t fSpacerR = 2.5; // Spacer width in R [cm]
Double_t fSpacerPhi = 2.5; // Spacer width in Phi [cm]
Double_t fOverlapR = 0.0; // Overlap in R direction [cm]
// Station Zceneter [cm] in the cave reference frame
Double_t fStationZ0 = 80;
Int_t fNlayers = 3; // Number of layers
Double_t fLayersDz = 10; // distance between the layers
Double_t fCoolLz = 1.0; // thickness of the cooling plate also used as support
/*
1 - detailed design (modules at two sides)
* 0 - simple design (1 module per layer)
*/
//***********************************************************
// some global variables
TGeoManager* gGeoMan = NULL; // Pointer to TGeoManager instance
TGeoVolume* gModules_station[fNst]; // Global storage for module types
// Forward declarations
void create_materials_from_media_file();
TGeoVolume* CreateStations(int ist);
TGeoVolume* CreateLayers(int istn, int ily);
void create_MUCH_geometry_v18b()
{
// Load needed material definition from media.geo file
create_materials_from_media_file();
// Get the GeoManager for later usage
gGeoMan = (TGeoManager*) gROOT->FindObject("FAIRGeom");
gGeoMan->SetVisLevel(10);
// Create the top volume
TGeoBBox* topbox = new TGeoBBox("", 1000., 1000., 2000.);
TGeoVolume* top = new TGeoVolume("top", topbox, gGeoMan->GetMedium("air"));
gGeoMan->SetTopVolume(top);
TGeoVolume* much = new TGeoVolumeAssembly(geoVersion);
top->AddNode(much, 1);
TGeoVolume* sttn = new TGeoVolumeAssembly("Station");
much->AddNode(sttn, 1);
for (Int_t istn = 0; istn < 1; istn++) { // 1 Station
gModules_station[istn] = CreateStations(istn);
sttn->AddNode(gModules_station[istn], istn);
}
gGeoMan->CloseGeometry();
gGeoMan->CheckOverlaps(0.000001);
gGeoMan->PrintOverlaps();
// gGeoMan->Test();
// const TString tagVersion = "mcbm";
// const TString subVersion = "_3oclock";
// const TString geoVersion = "much_" + tagVersion + subVersion;
// const TString FileNameSim = geoVersion + ".geo.root";
// const TString FileNameGeo = geoVersion + "_geo.root";
much->Export(FileNameSim); // an alternative way of writing the much
TFile* outfile = new TFile(FileNameSim, "UPDATE");
TGeoTranslation* much_placement = new TGeoTranslation("much_trans", 0., 0., 0.);
much_placement->Write();
outfile->Close();
outfile = new TFile(FileNameGeo, "RECREATE");
gGeoMan->Write(); // use this if you want GeoManager format in the output
outfile->Close();
top->Draw("ogl");
}
void create_materials_from_media_file()
{
// Use the FairRoot geometry interface to load the media which are already defined
FairGeoLoader* geoLoad = new FairGeoLoader("TGeo", "FairGeoLoader");
FairGeoInterface* geoFace = geoLoad->getGeoInterface();
TString geoPath = gSystem->Getenv("VMCWORKDIR");
TString geoFile = geoPath + "/geometry/media.geo";
geoFace->setMediaFile(geoFile);
geoFace->readMedia();
// Read the required media and create them in the GeoManager
FairGeoMedia* geoMedia = geoFace->getMedia();
FairGeoBuilder* geoBuild = geoLoad->getGeoBuilder();
FairGeoMedium* air = geoMedia->getMedium(KeepingVolumeMedium);
geoBuild->createMedium(air);
FairGeoMedium* MUCHiron = geoMedia->getMedium(I);
geoBuild->createMedium(MUCHiron);
FairGeoMedium* MUCHlead = geoMedia->getMedium(L);
geoBuild->createMedium(MUCHlead);
FairGeoMedium* MUCHwolfram = geoMedia->getMedium(W);
geoBuild->createMedium(MUCHwolfram);
FairGeoMedium* MUCHcarbon = geoMedia->getMedium(C);
geoBuild->createMedium(MUCHcarbon);
FairGeoMedium* MUCHargon = geoMedia->getMedium(activemedium);
geoBuild->createMedium(MUCHargon);
FairGeoMedium* MUCHnoryl = geoMedia->getMedium(spacermedium);
geoBuild->createMedium(MUCHnoryl);
FairGeoMedium* aluminium = geoMedia->getMedium(coolmedium);
// geoBuild->createMedium(MUCHcool);
geoBuild->createMedium(aluminium);
}
TGeoVolume* CreateStations(int ist)
{
TString stationName = Form("muchstation%02i", ist + 1);
TGeoVolumeAssembly* station = new TGeoVolumeAssembly(stationName); //, shStation, air);
TGeoVolume* gLayer[4];
for (int ii = 0; ii < 3; ii++) { // 3 Layers
gLayer[ii] = CreateLayers(ist, ii);
station->AddNode(gLayer[ii], ii);
}
return station;
}
TGeoVolume* CreateLayers(int istn, int ily)
{
TString layerName = Form("muchstation%02ilayer%i", istn + 1, ily + 1);
TGeoVolumeAssembly* volayer = new TGeoVolumeAssembly(layerName);
Double_t DeltaR = 97.5; // transverse dimension of the module
Double_t stGlobalZ0 = fStationZ0 + fMuchZ1; //z position of station center (midplane) [cm]
Double_t stDz = ((fNlayers - 1) * fLayersDz + fCoolLz + 2 * fActiveLzSector) / 2.;
Double_t stGlobalZ2 = stGlobalZ0 + stDz;
Double_t stGlobalZ1 = stGlobalZ0 - stDz;
Double_t rmin = stGlobalZ1 * fAcceptanceTanMin;
Double_t rmax = rmin + fSpacerR + DeltaR;
Int_t Nsector = 16.0; // need to be hard coded to match with station 1 of SIS100
//cout<<" Nsector "<<Nsector<<endl;
Double_t layerZ0 = (ily - (fNlayers - 1) / 2.) * fLayersDz;
Double_t layerGlobalZ0 = layerZ0 + stGlobalZ0;
Double_t sideDz = fCoolLz / 2. + fActiveLzSector / 2.; // distance between side's and layer's centers
Double_t moduleZ = sideDz; // Z position of the module center in the layer cs
Double_t phi0 = TMath::Pi() / Nsector; // azimuthal half widh of each module
Double_t ymin = rmin + fSpacerR;
Double_t ymax = rmax;
//define the dimensions of the trapezoidal module
Double_t dy = (ymax - ymin) / 2.; //y (length)
Double_t dx1 = ymin * TMath::Tan(phi0) + fOverlapR / TMath::Cos(phi0); // large x
Double_t dx2 = ymax * TMath::Tan(phi0) + fOverlapR / TMath::Cos(phi0); // small x
Double_t dz = fActiveLzSector / 2.; // thickness
//define the spacer dimensions
Double_t tg = (dx2 - dx1) / 2 / dy;
Double_t dd1 = fSpacerPhi * tg;
Double_t dd2 = fSpacerPhi * sqrt(1 + tg * tg);
Double_t sdx1 = dx1 + dd2 - dd1;
Double_t sdx2 = dx2 + dd2 + dd1;
Double_t sdy = dy + fSpacerR; // frame width added
Double_t sdz = dz - 0.1;
// Define the (cooling plate) diemnsions
Double_t dy_s = dy + 2.0;
Double_t dx1_s = dx1 + 2.0; // large x
Double_t dx2_s = dx2 + 2.0; // x
Double_t dz_s = fCoolLz / 2.; //
TVector3 pos;
TVector3 size = TVector3(0.0, 0.0, fActiveLzSector);
// Now start adding the GEM modules
for (Int_t iModule = 0; iModule < 1; iModule++) {
// if (iModule!=0) continue;
// Double_t phi = 2 * phi0 * (iModule + 0.5); // add 0.5 to not overlap with y-axis for left-right layer separation
// Position oof the module will depend on Phi
// Set Phi=180 degree 6 o'clock position
// Set Phi=90 degree 3 o'clock position
Double_t phi = TMath::Pi() / 2.0;
Bool_t isBack = iModule % 2;
Char_t cside = (isBack == 1) ? 'b' : 'f';
// correct the x, y positions
pos[0] = -(ymin + dy) * sin(phi);
pos[1] = (ymin + dy) * cos(phi);
// different z positions for odd/even modules
// pos[2] = (isBack ? 1 : -1)*moduleZ + layerGlobalZ0;
pos[2] = layerGlobalZ0;
TGeoMedium* argon = gGeoMan->GetMedium(activemedium); // active medium
TGeoMedium* noryl = gGeoMan->GetMedium(spacermedium); // spacer medium
TGeoMedium* aluminium = gGeoMan->GetMedium(coolmedium); // cool medium
// Define and place the trapezoidal GEM module in X-Y plane
TGeoTrap* shape = new TGeoTrap(dz, 0, phi, dy, dx1, dx2, 0, dy, dx1, dx2, 0);
// TGeoTrap* shape = new TGeoTrap(dz,0,0,dy,dx1,dx2,0,dy,dx1,dx2,0);
shape->SetName(Form("shStation%02iLayer%i%cModule%03iActiveNoHole", istn, ily, cside, iModule));
TString activeName = Form("muchstation%02ilayer%i%cactive%03igasArgon", istn + 1, ily + 1, cside, iModule + 1);
TGeoVolume* voActive = new TGeoVolume(activeName, shape, argon);
voActive->SetLineColor(kGreen);
// Define the trapezoidal spacers
TGeoTrap* shapeFrame = new TGeoTrap(sdz, 0, phi, sdy, sdx1, sdx2, 0, sdy, sdx1, sdx2, 0);
//TGeoTrap* shapeFrame = new TGeoTrap(sdz,0,0,sdy,sdx1,sdx2,0,sdy,sdx1,sdx2,0);
shapeFrame->SetName(Form("shStation%02iLayer%i%cModule%03iFullFrameNoHole", istn, ily, cside, iModule));
TString expression = Form("shStation%02iLayer%i%cModule%03iFullFrameNoHole-"
"shStation%02iLayer%i%cModule%03iActiveNoHole",
istn, ily, cside, iModule, istn, ily, cside, iModule);
TGeoCompositeShape* shFrame = new TGeoCompositeShape(
Form("shStation%02iLayer%i%cModule%03iFrameNoHole", istn, ily, cside, iModule), expression);
TString frameName = Form("muchstation%02ilayer%i%csupport%03i", istn + 1, ily + 1, cside, iModule + 1);
TGeoVolume* voFrame = new TGeoVolume(frameName, shFrame, noryl); // add a name to the frame
voFrame->SetLineColor(kMagenta);
// Define the trapezoidal (cooling plates)
// TGeoTrap* cool = new TGeoTrap(dz_s,0,phi,dy_s,dx1_s,dx2_s,0,dy_s,dx1_s,dx2_s,0);
TGeoTrap* cool = new TGeoTrap(dz_s, 0, phi, dy_s, dx1_s, dx2_s, 0, dy_s, dx1_s, dx2_s, 0);
cool->SetName(Form("shStation%02iLayer%i%cModule%03icool", istn, ily, cside, iModule));
TString CoolName = Form("muchstation%02ilayer%i%ccool%03iAluminum", istn + 1, ily + 1, cside, iModule + 1);
TGeoVolume* voCool = new TGeoVolume(CoolName, cool, aluminium);
voCool->SetLineColor(kYellow);
// Calculate the phi angle of the sector where it has to be placed
Double_t angle = 180. / TMath::Pi() * phi; // convert angle phi from rad to deg
TGeoTranslation* trans2 = new TGeoTranslation("", pos[0], pos[1], pos[2]); //for module and frame
TGeoTranslation* trans3 = new TGeoTranslation("", pos[0], pos[1], pos[2] + 0.65); //for module and frame
TGeoRotation* r2 = new TGeoRotation("r2");
//rotate in the vertical plane (per to z axis) with angle
r2->RotateZ(angle);
// give rotation to set them in horizontal plane
//r2->RotateZ(90.0);//TMath::Pi());
TGeoHMatrix* incline_mod = new TGeoHMatrix("");
(*incline_mod) = (*trans2) * (*r2); // OK
volayer->AddNode(voFrame, iModule, incline_mod); // add frame
volayer->AddNode(voActive, iModule, incline_mod); // add active volume
TGeoHMatrix* incline_mod1 = new TGeoHMatrix("");
(*incline_mod1) = (*trans3) * (*r2); // for cooling
volayer->AddNode(voCool, iModule, incline_mod1); // cooling plate
// cout<<rmin<<" "<<rmax<<" "<<pos[1]<<" "<<phi<<" "<<fActiveLzSector<<" "<<stGlobalZ0<<" "<<istn<<" "<<ily<<pos[0]<<endl;
}
return volayer;
}
/* Copyright (C) 2017 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
SPDX-License-Identifier: GPL-3.0-only
Authors: David Emschermann [committer] */
//
/// \file create_MUCH_geometry_v18c.C
/// \brief Generates MUCH geometry in Root format.
///
// 2017-10-23 - DE - mcbm - put mMUCH in 6 o'clock position on z axis, shift 15 cm up and to z = 60, 70 and 80 cm
// 2017-09-04 - PPB - mcbm - preliminary version of mini much geometry
// 2017-05-16 - DE - v17b - position the modules in a way to split layers left-right along y axis
// 2017-05-16 - DE - v17b - attribute name to module frames
// 2017-05-16 - DE - v17b - remove rim from support CompositeShape
// 2017-05-02 - PPB - v17a - Change the shape of the first absorber according to latest design
// 2017-04-27 - DE - v17a - fix GEM module positions and angles
// 2017-04-22 - PPB - v17a - Define the absorber, shield and station shapes sizes ...
// 2016-04-19 - DE - v17a - initial version derived from TRD
// in root all sizes are given in cm
#include "TClonesArray.h"
#include "TDatime.h"
#include "TFile.h"
#include "TGeoBBox.h"
#include "TGeoCompositeShape.h"
#include "TGeoCone.h"
#include "TGeoManager.h"
#include "TGeoMaterial.h"
#include "TGeoMatrix.h"
#include "TGeoMedium.h"
#include "TGeoPgon.h"
#include "TGeoTube.h"
#include "TGeoVolume.h"
#include "TGeoXtru.h"
#include "TList.h"
#include "TMath.h"
#include "TObjArray.h"
#include "TRandom3.h"
#include "TString.h"
#include "TSystem.h"
#include <cassert>
#include <fstream>
#include <iostream>
#include <stdexcept>
// Name of output file with geometry
const TString tagVersion = "v18c";
const TString geoVersion = "much_" + tagVersion;
//const TString subVersion = "_3oclock";
//const TString geoVersion = "much_" + tagVersion + subVersion;
const TString FileNameSim = geoVersion + "_mcbm.geo.root";
const TString FileNameGeo = geoVersion + "_mcbm_geo.root";
const TString FileNameInfo = geoVersion + "_mcbm.geo.info";
// Names of the different used materials which are used to build the modules
// The materials are defined in the global media.geo file
const TString KeepingVolumeMedium = "air";
const TString L = "MUCHlead";
const TString W = "MUCHwolfram";
const TString C = "MUCHcarbon";
const TString I = "MUCHiron";
const TString activemedium = "MUCHargon";
const TString spacermedium = "MUCHnoryl";
const TString coolmedium = "aluminium"; //Al cooling plates
// Universal input parameters
// The inner angle is 11 degree (polar angle); We take z = 70 cm;
//Inner radius: R_in=z*tan(theta_min) cm
// Outer angle is decided from tan(theta_max)=R_out/z
// R_out=R_in+95 cm (transverse size of the M2 module)
Double_t fMuchZ1 = 0.0; // MuchCave Zin position [cm]
Double_t fAcceptanceTanMin = 0.19; // Acceptance tangent min (11 degree)
//************************************************************
// Input parameters for MUCH stations
//********************************************
const Int_t fNst = 1; // Number of stations
// Sector-type module parameters
// Number of sectors per layer (should be even for symmetry)
// Needs to be fixed with actual numbers
Double_t fActiveLzSector = 0.3; // Active volume thickness [cm]
Double_t fSpacerR = 2.5; // Spacer width in R [cm]
Double_t fSpacerPhi = 2.5; // Spacer width in Phi [cm]
Double_t fOverlapR = 0.0; // Overlap in R direction [cm]
// Station Zceneter [cm] in the cave reference frame
//Double_t fStationZ0=80;
Double_t fStationZ0 = 70; // DE - move 10 cm upstream
Int_t fNlayers = 3; // Number of layers
Double_t fLayersDz = 10; // distance between the layers
Double_t fCoolLz = 1.0; // thickness of the cooling plate also used as support
/*
1 - detailed design (modules at two sides)
* 0 - simple design (1 module per layer)
*/
//***********************************************************
// some global variables
TGeoManager* gGeoMan = NULL; // Pointer to TGeoManager instance
TGeoVolume* gModules_station[fNst]; // Global storage for module types
// Forward declarations
void create_materials_from_media_file();
TGeoVolume* CreateStations(int ist);
TGeoVolume* CreateLayers(int istn, int ily);
void create_MUCH_geometry_v18c()
{
// Load needed material definition from media.geo file
create_materials_from_media_file();
// Get the GeoManager for later usage
gGeoMan = (TGeoManager*) gROOT->FindObject("FAIRGeom");
gGeoMan->SetVisLevel(10);
// Create the top volume
TGeoBBox* topbox = new TGeoBBox("", 1000., 1000., 2000.);
TGeoVolume* top = new TGeoVolume("top", topbox, gGeoMan->GetMedium("air"));
gGeoMan->SetTopVolume(top);
TGeoVolume* much = new TGeoVolumeAssembly(geoVersion);
top->AddNode(much, 1);
TGeoVolume* sttn = new TGeoVolumeAssembly("Station");
much->AddNode(sttn, 1);
for (Int_t istn = 0; istn < 1; istn++) { // 1 Station
gModules_station[istn] = CreateStations(istn);
sttn->AddNode(gModules_station[istn], istn);
}
gGeoMan->CloseGeometry();
gGeoMan->CheckOverlaps(0.000001);
gGeoMan->PrintOverlaps();
// gGeoMan->Test();
// const TString tagVersion = "mcbm";
// const TString subVersion = "_3oclock";
// const TString geoVersion = "much_" + tagVersion + subVersion;
// const TString FileNameSim = geoVersion + ".geo.root";
// const TString FileNameGeo = geoVersion + "_geo.root";
much->Export(FileNameSim); // an alternative way of writing the much
TFile* outfile = new TFile(FileNameSim, "UPDATE");
TGeoTranslation* much_placement = new TGeoTranslation("much_trans", 0., 0., 0.);
much_placement->Write();
outfile->Close();
outfile = new TFile(FileNameGeo, "RECREATE");
gGeoMan->Write(); // use this if you want GeoManager format in the output
outfile->Close();
top->Draw("ogl");
}
void create_materials_from_media_file()
{
// Use the FairRoot geometry interface to load the media which are already defined
FairGeoLoader* geoLoad = new FairGeoLoader("TGeo", "FairGeoLoader");
FairGeoInterface* geoFace = geoLoad->getGeoInterface();
TString geoPath = gSystem->Getenv("VMCWORKDIR");
TString geoFile = geoPath + "/geometry/media.geo";
geoFace->setMediaFile(geoFile);
geoFace->readMedia();
// Read the required media and create them in the GeoManager
FairGeoMedia* geoMedia = geoFace->getMedia();
FairGeoBuilder* geoBuild = geoLoad->getGeoBuilder();
FairGeoMedium* air = geoMedia->getMedium(KeepingVolumeMedium);
geoBuild->createMedium(air);
FairGeoMedium* MUCHiron = geoMedia->getMedium(I);
geoBuild->createMedium(MUCHiron);
FairGeoMedium* MUCHlead = geoMedia->getMedium(L);
geoBuild->createMedium(MUCHlead);
FairGeoMedium* MUCHwolfram = geoMedia->getMedium(W);
geoBuild->createMedium(MUCHwolfram);
FairGeoMedium* MUCHcarbon = geoMedia->getMedium(C);
geoBuild->createMedium(MUCHcarbon);
FairGeoMedium* MUCHargon = geoMedia->getMedium(activemedium);
geoBuild->createMedium(MUCHargon);
FairGeoMedium* MUCHnoryl = geoMedia->getMedium(spacermedium);
geoBuild->createMedium(MUCHnoryl);
FairGeoMedium* aluminium = geoMedia->getMedium(coolmedium);
// geoBuild->createMedium(MUCHcool);
geoBuild->createMedium(aluminium);
}
TGeoVolume* CreateStations(int ist)
{
TString stationName = Form("muchstation%02i", ist + 1);
TGeoVolumeAssembly* station = new TGeoVolumeAssembly(stationName); //, shStation, air);
TGeoVolume* gLayer[4];
for (int ii = 0; ii < 3; ii++) { // 3 Layers
gLayer[ii] = CreateLayers(ist, ii);
station->AddNode(gLayer[ii], ii);
}
return station;
}
TGeoVolume* CreateLayers(int istn, int ily)
{
TString layerName = Form("muchstation%02ilayer%i", istn + 1, ily + 1);
TGeoVolumeAssembly* volayer = new TGeoVolumeAssembly(layerName);
Double_t DeltaR = 97.5; // transverse dimension of the module
Double_t stGlobalZ0 = fStationZ0 + fMuchZ1; //z position of station center (midplane) [cm]
Double_t stDz = ((fNlayers - 1) * fLayersDz + fCoolLz + 2 * fActiveLzSector) / 2.;
Double_t stGlobalZ2 = stGlobalZ0 + stDz;
Double_t stGlobalZ1 = stGlobalZ0 - stDz;
Double_t rmin = stGlobalZ1 * fAcceptanceTanMin;
Double_t rmax = rmin + fSpacerR + DeltaR;
Int_t Nsector = 16.0; // need to be hard coded to match with station 1 of SIS100
//cout<<" Nsector "<<Nsector<<endl;
Double_t layerZ0 = (ily - (fNlayers - 1) / 2.) * fLayersDz;
Double_t layerGlobalZ0 = layerZ0 + stGlobalZ0;
Double_t sideDz = fCoolLz / 2. + fActiveLzSector / 2.; // distance between side's and layer's centers
Double_t moduleZ = sideDz; // Z position of the module center in the layer cs
Double_t phi0 = TMath::Pi() / Nsector; // azimuthal half widh of each module
Double_t ymin = rmin + fSpacerR;
Double_t ymax = rmax;
//define the dimensions of the trapezoidal module
Double_t dy = (ymax - ymin) / 2.; //y (length)
Double_t dx1 = ymin * TMath::Tan(phi0) + fOverlapR / TMath::Cos(phi0); // large x
Double_t dx2 = ymax * TMath::Tan(phi0) + fOverlapR / TMath::Cos(phi0); // small x
Double_t dz = fActiveLzSector / 2.; // thickness
//define the spacer dimensions
Double_t tg = (dx2 - dx1) / 2 / dy;
Double_t dd1 = fSpacerPhi * tg;
Double_t dd2 = fSpacerPhi * sqrt(1 + tg * tg);
Double_t sdx1 = dx1 + dd2 - dd1;
Double_t sdx2 = dx2 + dd2 + dd1;
Double_t sdy = dy + fSpacerR; // frame width added
Double_t sdz = dz - 0.1;
// Define the (cooling plate) diemnsions
Double_t dy_s = dy + 2.0;
Double_t dx1_s = dx1 + 2.0; // large x
Double_t dx2_s = dx2 + 2.0; // x
Double_t dz_s = fCoolLz / 2.; //
TVector3 pos;
TVector3 size = TVector3(0.0, 0.0, fActiveLzSector);
// Now start adding the GEM modules
for (Int_t iModule = 0; iModule < 1; iModule++) {
// if (iModule!=0) continue;
// Double_t phi = 2 * phi0 * (iModule + 0.5); // add 0.5 to not overlap with y-axis for left-right layer separation
// Position of the module will depend on Phi
// Set Phi=180 degree 6 o'clock position
// Set Phi=90 degree 3 o'clock position
Double_t phi = TMath::Pi() / 2.0;
Bool_t isBack = iModule % 2;
Char_t cside = (isBack == 1) ? 'b' : 'f';
// correct the x, y positions
// pos[0] = -(ymin+dy)*sin(phi);
// pos[1] = (ymin+dy)*cos(phi);
pos[0] = 0; // DE - do not displace mMUCH in x
pos[1] = 15; // DE - move upwards in y [cm]
// different z positions for odd/even modules
// pos[2] = (isBack ? 1 : -1)*moduleZ + layerGlobalZ0;
pos[2] = layerGlobalZ0;
TGeoMedium* argon = gGeoMan->GetMedium(activemedium); // active medium
TGeoMedium* noryl = gGeoMan->GetMedium(spacermedium); // spacer medium
TGeoMedium* aluminium = gGeoMan->GetMedium(coolmedium); // cool medium
// Define and place the trapezoidal GEM module in X-Y plane
TGeoTrap* shape = new TGeoTrap(dz, 0, phi, dy, dx1, dx2, 0, dy, dx1, dx2, 0);
// TGeoTrap* shape = new TGeoTrap(dz,0,0,dy,dx1,dx2,0,dy,dx1,dx2,0);
shape->SetName(Form("shStation%02iLayer%i%cModule%03iActiveNoHole", istn, ily, cside, iModule));
TString activeName = Form("muchstation%02ilayer%i%cactive%03igasArgon", istn + 1, ily + 1, cside, iModule + 1);
TGeoVolume* voActive = new TGeoVolume(activeName, shape, argon);
voActive->SetLineColor(kGreen);
// Define the trapezoidal spacers
TGeoTrap* shapeFrame = new TGeoTrap(sdz, 0, phi, sdy, sdx1, sdx2, 0, sdy, sdx1, sdx2, 0);
//TGeoTrap* shapeFrame = new TGeoTrap(sdz,0,0,sdy,sdx1,sdx2,0,sdy,sdx1,sdx2,0);
shapeFrame->SetName(Form("shStation%02iLayer%i%cModule%03iFullFrameNoHole", istn, ily, cside, iModule));
TString expression = Form("shStation%02iLayer%i%cModule%03iFullFrameNoHole-"
"shStation%02iLayer%i%cModule%03iActiveNoHole",
istn, ily, cside, iModule, istn, ily, cside, iModule);
TGeoCompositeShape* shFrame = new TGeoCompositeShape(
Form("shStation%02iLayer%i%cModule%03iFrameNoHole", istn, ily, cside, iModule), expression);
TString frameName = Form("muchstation%02ilayer%i%csupport%03i", istn + 1, ily + 1, cside, iModule + 1);
TGeoVolume* voFrame = new TGeoVolume(frameName, shFrame, noryl); // add a name to the frame
voFrame->SetLineColor(kMagenta);
// Define the trapezoidal (cooling plates)
// TGeoTrap* cool = new TGeoTrap(dz_s,0,phi,dy_s,dx1_s,dx2_s,0,dy_s,dx1_s,dx2_s,0);
TGeoTrap* cool = new TGeoTrap(dz_s, 0, phi, dy_s, dx1_s, dx2_s, 0, dy_s, dx1_s, dx2_s, 0);
cool->SetName(Form("shStation%02iLayer%i%cModule%03icool", istn, ily, cside, iModule));
TString CoolName = Form("muchstation%02ilayer%i%ccool%03iAluminum", istn + 1, ily + 1, cside, iModule + 1);
TGeoVolume* voCool = new TGeoVolume(CoolName, cool, aluminium);
voCool->SetLineColor(kYellow);
// Calculate the phi angle of the sector where it has to be placed
Double_t angle = 180. / TMath::Pi() * phi; // convert angle phi from rad to deg
TGeoTranslation* trans2 = new TGeoTranslation("", pos[0], pos[1], pos[2]); //for module and frame
TGeoTranslation* trans3 = new TGeoTranslation("", pos[0], pos[1], pos[2] + 0.65); //for module and frame
TGeoRotation* r2 = new TGeoRotation("r2");
//rotate in the vertical plane (per to z axis) with angle
// r2->RotateZ(angle);
// DE cout << "DE " << phi << endl;
// DE cout << "DE " << angle << endl;
// DE cout << "DE " << phi0 << endl;
// DE cout << "DE " << 180. / TMath::Pi() * phi0 << endl;
r2->RotateZ(180.0); // DE - 6 o'clock position
// r2->RotateZ(180.0-(180. / TMath::Pi() * phi0)); // DE - 6 o'clock position, left side vertical
// give rotation to set them in horizontal plane
//r2->RotateZ(90.0);//TMath::Pi());
TGeoHMatrix* incline_mod = new TGeoHMatrix("");
(*incline_mod) = (*trans2) * (*r2); // OK
volayer->AddNode(voFrame, iModule, incline_mod); // add frame
volayer->AddNode(voActive, iModule, incline_mod); // add active volume
TGeoHMatrix* incline_mod1 = new TGeoHMatrix("");
(*incline_mod1) = (*trans3) * (*r2); // for cooling
volayer->AddNode(voCool, iModule, incline_mod1); // cooling plate
// cout<<rmin<<" "<<rmax<<" "<<pos[1]<<" "<<phi<<" "<<fActiveLzSector<<" "<<stGlobalZ0<<" "<<istn<<" "<<ily<<pos[0]<<endl;
}
return volayer;
}
/* Copyright (C) 2017 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
SPDX-License-Identifier: GPL-3.0-only
Authors: David Emschermann [committer] */
//
/// \file create_MUCH_geometry_v18d.C
/// \brief Generates MUCH geometry in Root format.
///
// 2017-10-23 - DE - mcbm - put mMUCH in 6 o'clock position on z axis, shift 15 cm up and to z = 60, 70 and 80 cm
// 2017-09-04 - PPB - mcbm - preliminary version of mini much geometry
// 2017-05-16 - DE - v17b - position the modules in a way to split layers left-right along y axis
// 2017-05-16 - DE - v17b - attribute name to module frames
// 2017-05-16 - DE - v17b - remove rim from support CompositeShape
// 2017-05-02 - PPB - v17a - Change the shape of the first absorber according to latest design
// 2017-04-27 - DE - v17a - fix GEM module positions and angles
// 2017-04-22 - PPB - v17a - Define the absorber, shield and station shapes sizes ...
// 2016-04-19 - DE - v17a - initial version derived from TRD
// in root all sizes are given in cm
#include "TClonesArray.h"
#include "TDatime.h"
#include "TFile.h"
#include "TGeoBBox.h"
#include "TGeoCompositeShape.h"
#include "TGeoCone.h"
#include "TGeoManager.h"
#include "TGeoMaterial.h"
#include "TGeoMatrix.h"
#include "TGeoMedium.h"
#include "TGeoPgon.h"
#include "TGeoTube.h"
#include "TGeoVolume.h"
#include "TGeoXtru.h"
#include "TList.h"
#include "TMath.h"
#include "TObjArray.h"
#include "TRandom3.h"
#include "TString.h"
#include "TSystem.h"
#include <cassert>
#include <fstream>
#include <iostream>
#include <stdexcept>
// Name of output file with geometry
const TString tagVersion = "v18d";
const TString geoVersion = "much_" + tagVersion;
//const TString subVersion = "_3oclock";
//const TString geoVersion = "much_" + tagVersion + subVersion;
const TString FileNameSim = geoVersion + "_mcbm.geo.root";
const TString FileNameGeo = geoVersion + "_mcbm_geo.root";
const TString FileNameInfo = geoVersion + "_mcbm.geo.info";
// Names of the different used materials which are used to build the modules
// The materials are defined in the global media.geo file
const TString KeepingVolumeMedium = "air";
const TString L = "MUCHlead";
const TString W = "MUCHwolfram";
const TString C = "MUCHcarbon";
const TString I = "MUCHiron";
const TString activemedium = "MUCHargon";
const TString spacermedium = "MUCHnoryl";
const TString coolmedium = "aluminium"; //Al cooling plates
// Universal input parameters
// The inner angle is 11 degree (polar angle); We take z = 70 cm;
//Inner radius: R_in=z*tan(theta_min) cm
// Outer angle is decided from tan(theta_max)=R_out/z
// R_out=R_in+95 cm (transverse size of the M2 module)
Double_t fMuchZ1 = 0.0; // MuchCave Zin position [cm]
Double_t fAcceptanceTanMin = 0.19; // Acceptance tangent min (11 degree)
//************************************************************
// Input parameters for MUCH stations
//********************************************
const Int_t fNst = 1; // Number of stations
// Sector-type module parameters
// Number of sectors per layer (should be even for symmetry)
// Needs to be fixed with actual numbers
Double_t fActiveLzSector = 0.3; // Active volume thickness [cm]
Double_t fSpacerR = 2.5; // Spacer width in R [cm]
Double_t fSpacerPhi = 2.5; // Spacer width in Phi [cm]
Double_t fOverlapR = 0.0; // Overlap in R direction [cm]
// Station Zceneter [cm] in the cave reference frame
//Double_t fStationZ0=80;
Double_t fStationZ0 = 70; // DE - move 10 cm upstream
Int_t fNlayers = 3; // Number of layers
Double_t fLayersDz = 10; // distance between the layers
Double_t fCoolLz = 1.0; // thickness of the cooling plate also used as support
/*
1 - detailed design (modules at two sides)
* 0 - simple design (1 module per layer)
*/
//***********************************************************
// some global variables
TGeoManager* gGeoMan = NULL; // Pointer to TGeoManager instance
TGeoVolume* gModules_station[fNst]; // Global storage for module types
// Forward declarations
void create_materials_from_media_file();
TGeoVolume* CreateStations(int ist);
TGeoVolume* CreateLayers(int istn, int ily);
void create_MUCH_geometry_v18d()
{
// Load needed material definition from media.geo file
create_materials_from_media_file();
// Get the GeoManager for later usage
gGeoMan = (TGeoManager*) gROOT->FindObject("FAIRGeom");
gGeoMan->SetVisLevel(10);
// Create the top volume
TGeoBBox* topbox = new TGeoBBox("", 1000., 1000., 2000.);
TGeoVolume* top = new TGeoVolume("top", topbox, gGeoMan->GetMedium("air"));
gGeoMan->SetTopVolume(top);
TGeoVolume* much = new TGeoVolumeAssembly(geoVersion);
top->AddNode(much, 1);
TGeoVolume* sttn = new TGeoVolumeAssembly("Station");
much->AddNode(sttn, 1);
for (Int_t istn = 0; istn < 1; istn++) { // 1 Station
gModules_station[istn] = CreateStations(istn);
sttn->AddNode(gModules_station[istn], istn);
}
gGeoMan->CloseGeometry();
gGeoMan->CheckOverlaps(0.000001);
gGeoMan->PrintOverlaps();
// gGeoMan->Test();
// const TString tagVersion = "mcbm";
// const TString subVersion = "_3oclock";
// const TString geoVersion = "much_" + tagVersion + subVersion;
// const TString FileNameSim = geoVersion + ".geo.root";
// const TString FileNameGeo = geoVersion + "_geo.root";
much->Export(FileNameSim); // an alternative way of writing the much
TFile* outfile = new TFile(FileNameSim, "UPDATE");
TGeoTranslation* much_placement = new TGeoTranslation("much_trans", 0., 0., 0.);
much_placement->Write();
outfile->Close();
outfile = new TFile(FileNameGeo, "RECREATE");
gGeoMan->Write(); // use this if you want GeoManager format in the output
outfile->Close();
top->Draw("ogl");
}
void create_materials_from_media_file()
{
// Use the FairRoot geometry interface to load the media which are already defined
FairGeoLoader* geoLoad = new FairGeoLoader("TGeo", "FairGeoLoader");
FairGeoInterface* geoFace = geoLoad->getGeoInterface();
TString geoPath = gSystem->Getenv("VMCWORKDIR");
TString geoFile = geoPath + "/geometry/media.geo";
geoFace->setMediaFile(geoFile);
geoFace->readMedia();
// Read the required media and create them in the GeoManager
FairGeoMedia* geoMedia = geoFace->getMedia();
FairGeoBuilder* geoBuild = geoLoad->getGeoBuilder();
FairGeoMedium* air = geoMedia->getMedium(KeepingVolumeMedium);
geoBuild->createMedium(air);
FairGeoMedium* MUCHiron = geoMedia->getMedium(I);
geoBuild->createMedium(MUCHiron);
FairGeoMedium* MUCHlead = geoMedia->getMedium(L);
geoBuild->createMedium(MUCHlead);
FairGeoMedium* MUCHwolfram = geoMedia->getMedium(W);
geoBuild->createMedium(MUCHwolfram);
FairGeoMedium* MUCHcarbon = geoMedia->getMedium(C);
geoBuild->createMedium(MUCHcarbon);
FairGeoMedium* MUCHargon = geoMedia->getMedium(activemedium);
geoBuild->createMedium(MUCHargon);
FairGeoMedium* MUCHnoryl = geoMedia->getMedium(spacermedium);
geoBuild->createMedium(MUCHnoryl);
FairGeoMedium* aluminium = geoMedia->getMedium(coolmedium);
// geoBuild->createMedium(MUCHcool);
geoBuild->createMedium(aluminium);
}
TGeoVolume* CreateStations(int ist)
{
TString stationName = Form("muchstation%02i", ist + 1);
TGeoVolumeAssembly* station = new TGeoVolumeAssembly(stationName); //, shStation, air);
TGeoVolume* gLayer[4];
for (int ii = 0; ii < 3; ii++) { // 3 Layers
gLayer[ii] = CreateLayers(ist, ii);
station->AddNode(gLayer[ii], ii);
}
return station;
}
TGeoVolume* CreateLayers(int istn, int ily)
{
TString layerName = Form("muchstation%02ilayer%i", istn + 1, ily + 1);
TGeoVolumeAssembly* volayer = new TGeoVolumeAssembly(layerName);
Double_t DeltaR = 97.5; // transverse dimension of the module
Double_t stGlobalZ0 = fStationZ0 + fMuchZ1; //z position of station center (midplane) [cm]
Double_t stDz = ((fNlayers - 1) * fLayersDz + fCoolLz + 2 * fActiveLzSector) / 2.;
Double_t stGlobalZ2 = stGlobalZ0 + stDz;
Double_t stGlobalZ1 = stGlobalZ0 - stDz;
Double_t rmin = stGlobalZ1 * fAcceptanceTanMin;
Double_t rmax = rmin + fSpacerR + DeltaR;
Int_t Nsector = 16.0; // need to be hard coded to match with station 1 of SIS100
//cout<<" Nsector "<<Nsector<<endl;
Double_t layerZ0 = (ily - (fNlayers - 1) / 2.) * fLayersDz;
Double_t layerGlobalZ0 = layerZ0 + stGlobalZ0;
Double_t sideDz = fCoolLz / 2. + fActiveLzSector / 2.; // distance between side's and layer's centers
Double_t moduleZ = sideDz; // Z position of the module center in the layer cs
Double_t phi0 = TMath::Pi() / Nsector; // azimuthal half widh of each module
Double_t ymin = rmin + fSpacerR;
Double_t ymax = rmax;
//define the dimensions of the trapezoidal module
Double_t dy = (ymax - ymin) / 2.; //y (length)
Double_t dx1 = ymin * TMath::Tan(phi0) + fOverlapR / TMath::Cos(phi0); // large x
Double_t dx2 = ymax * TMath::Tan(phi0) + fOverlapR / TMath::Cos(phi0); // small x
Double_t dz = fActiveLzSector / 2.; // thickness
//define the spacer dimensions
Double_t tg = (dx2 - dx1) / 2 / dy;
Double_t dd1 = fSpacerPhi * tg;
Double_t dd2 = fSpacerPhi * sqrt(1 + tg * tg);
Double_t sdx1 = dx1 + dd2 - dd1;
Double_t sdx2 = dx2 + dd2 + dd1;
Double_t sdy = dy + fSpacerR; // frame width added
Double_t sdz = dz - 0.1;
// Define the (cooling plate) diemnsions
Double_t dy_s = dy + 2.0;
Double_t dx1_s = dx1 + 2.0; // large x
Double_t dx2_s = dx2 + 2.0; // x
Double_t dz_s = fCoolLz / 2.; //
TVector3 pos;
TVector3 size = TVector3(0.0, 0.0, fActiveLzSector);
// Now start adding the GEM modules
for (Int_t iModule = 0; iModule < 1; iModule++) {
// if (iModule!=0) continue;
// Double_t phi = 2 * phi0 * (iModule + 0.5); // add 0.5 to not overlap with y-axis for left-right layer separation
// Position of the module will depend on Phi
// Set Phi=180 degree 6 o'clock position
// Set Phi=90 degree 3 o'clock position
Double_t phi = TMath::Pi() / 2.0;
Bool_t isBack = iModule % 2;
Char_t cside = (isBack == 1) ? 'b' : 'f';
// correct the x, y positions
// pos[0] = -(ymin+dy)*sin(phi);
// pos[1] = (ymin+dy)*cos(phi);
pos[0] = 0; // DE - do not displace mMUCH in x
pos[1] = 15; // DE - move upwards in y [cm]
// different z positions for odd/even modules
// pos[2] = (isBack ? 1 : -1)*moduleZ + layerGlobalZ0;
pos[2] = layerGlobalZ0;
TGeoMedium* argon = gGeoMan->GetMedium(activemedium); // active medium
TGeoMedium* noryl = gGeoMan->GetMedium(spacermedium); // spacer medium
TGeoMedium* aluminium = gGeoMan->GetMedium(coolmedium); // cool medium
// Define and place the trapezoidal GEM module in X-Y plane
TGeoTrap* shape = new TGeoTrap(dz, 0, phi, dy, dx1, dx2, 0, dy, dx1, dx2, 0);
// TGeoTrap* shape = new TGeoTrap(dz,0,0,dy,dx1,dx2,0,dy,dx1,dx2,0);
shape->SetName(Form("shStation%02iLayer%i%cModule%03iActiveNoHole", istn, ily, cside, iModule));
TString activeName = Form("muchstation%02ilayer%i%cactive%03igasArgon", istn + 1, ily + 1, cside, iModule + 1);
TGeoVolume* voActive = new TGeoVolume(activeName, shape, argon);
voActive->SetLineColor(kGreen);
// Define the trapezoidal spacers
TGeoTrap* shapeFrame = new TGeoTrap(sdz, 0, phi, sdy, sdx1, sdx2, 0, sdy, sdx1, sdx2, 0);
//TGeoTrap* shapeFrame = new TGeoTrap(sdz,0,0,sdy,sdx1,sdx2,0,sdy,sdx1,sdx2,0);
shapeFrame->SetName(Form("shStation%02iLayer%i%cModule%03iFullFrameNoHole", istn, ily, cside, iModule));
TString expression = Form("shStation%02iLayer%i%cModule%03iFullFrameNoHole-"
"shStation%02iLayer%i%cModule%03iActiveNoHole",
istn, ily, cside, iModule, istn, ily, cside, iModule);
TGeoCompositeShape* shFrame = new TGeoCompositeShape(
Form("shStation%02iLayer%i%cModule%03iFrameNoHole", istn, ily, cside, iModule), expression);
TString frameName = Form("muchstation%02ilayer%i%csupport%03i", istn + 1, ily + 1, cside, iModule + 1);
TGeoVolume* voFrame = new TGeoVolume(frameName, shFrame, noryl); // add a name to the frame
voFrame->SetLineColor(kMagenta);
// Define the trapezoidal (cooling plates)
// TGeoTrap* cool = new TGeoTrap(dz_s,0,phi,dy_s,dx1_s,dx2_s,0,dy_s,dx1_s,dx2_s,0);
TGeoTrap* cool = new TGeoTrap(dz_s, 0, phi, dy_s, dx1_s, dx2_s, 0, dy_s, dx1_s, dx2_s, 0);
cool->SetName(Form("shStation%02iLayer%i%cModule%03icool", istn, ily, cside, iModule));
TString CoolName = Form("muchstation%02ilayer%i%ccool%03iAluminum", istn + 1, ily + 1, cside, iModule + 1);
TGeoVolume* voCool = new TGeoVolume(CoolName, cool, aluminium);
voCool->SetLineColor(kYellow);
// Calculate the phi angle of the sector where it has to be placed
Double_t angle = 180. / TMath::Pi() * phi; // convert angle phi from rad to deg
TGeoTranslation* trans2 = new TGeoTranslation("", pos[0], pos[1], pos[2]); //for module and frame
TGeoTranslation* trans3 = new TGeoTranslation("", pos[0], pos[1], pos[2] + 0.65); //for module and frame
TGeoRotation* r2 = new TGeoRotation("r2");
//rotate in the vertical plane (per to z axis) with angle
// r2->RotateZ(angle);
// DE cout << "DE " << phi << endl;
// DE cout << "DE " << angle << endl;
// DE cout << "DE " << phi0 << endl;
// DE cout << "DE " << 180. / TMath::Pi() * phi0 << endl;
// r2->RotateZ(180.0); // DE - 6 o'clock position
r2->RotateZ(180.0 - (180. / TMath::Pi() * phi0)); // DE - 6 o'clock position, left side vertical
// give rotation to set them in horizontal plane
//r2->RotateZ(90.0);//TMath::Pi());
TGeoHMatrix* incline_mod = new TGeoHMatrix("");
(*incline_mod) = (*trans2) * (*r2); // OK
volayer->AddNode(voFrame, iModule, incline_mod); // add frame
volayer->AddNode(voActive, iModule, incline_mod); // add active volume
TGeoHMatrix* incline_mod1 = new TGeoHMatrix("");
(*incline_mod1) = (*trans3) * (*r2); // for cooling
volayer->AddNode(voCool, iModule, incline_mod1); // cooling plate
// cout<<rmin<<" "<<rmax<<" "<<pos[1]<<" "<<phi<<" "<<fActiveLzSector<<" "<<stGlobalZ0<<" "<<istn<<" "<<ily<<pos[0]<<endl;
}
return volayer;
}
/* Copyright (C) 2017 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
SPDX-License-Identifier: GPL-3.0-only
Authors: David Emschermann [committer] */
//
/// \file create_MUCH_geometry_v18e.C
/// \brief Generates MUCH geometry in Root format.
///
//2017-11-10 -- PPB -- corerct the y position of the moduels to genertae much points
//2017-11-07 - PPB - change the shape of cooling plates from rectangular to sector
//2017-11-06 - PPB, VS and AM - mcbm version with actual Mv2 dimesions of the module
// 2017-10-23 - DE - mcbm - put mMUCH in 6 o'clock position on z axis, shift 15 cm up and to z = 60, 70 and 80 cm
// 2017-09-04 - PPB - mcbm - preliminary version of mini much geometry
// 2017-05-16 - DE - v17b - position the modules in a way to split layers left-right along y axis
// 2017-05-16 - DE - v17b - attribute name to module frames
// 2017-05-16 - DE - v17b - remove rim from support CompositeShape
// 2017-05-02 - PPB - v17a - Change the shape of the first absorber according to latest design
// 2017-04-27 - DE - v17a - fix GEM module positions and angles
// 2017-04-22 - PPB - v17a - Define the absorber, shield and station shapes sizes ...
// 2016-04-19 - DE - v17a - initial version derived from TRD
// in root all sizes are given in cm
#include "TClonesArray.h"
#include "TDatime.h"
#include "TFile.h"
#include "TGeoBBox.h"
#include "TGeoCompositeShape.h"
#include "TGeoCone.h"
#include "TGeoManager.h"
#include "TGeoMaterial.h"
#include "TGeoMatrix.h"
#include "TGeoMedium.h"
#include "TGeoPgon.h"
#include "TGeoTube.h"
#include "TGeoVolume.h"
#include "TGeoXtru.h"
#include "TList.h"
#include "TMath.h"
#include "TObjArray.h"
#include "TRandom3.h"
#include "TString.h"
#include "TSystem.h"
#include <cassert>
#include <fstream>
#include <iostream>
#include <stdexcept>
// Name of output file with geometry
const TString tagVersion = "_v18e";
const TString geoVersion = "much";
const TString FileNameSim = geoVersion + tagVersion + "_mcbm.geo.root";
const TString FileNameGeo = geoVersion + tagVersion + "_mcbm_geo.root";
const TString FileNameInfo = geoVersion + tagVersion + "_mcbm.geo.info";
// Names of the different used materials which are used to build the modules
// The materials are defined in the global media.geo file
const TString KeepingVolumeMedium = "air";
const TString L = "MUCHlead";
const TString W = "MUCHwolfram";
const TString C = "MUCHcarbon";
const TString I = "MUCHiron";
const TString activemedium = "MUCHargon";
const TString spacermedium = "MUCHnoryl";
const TString coolmedium = "aluminium"; //Al cooling plates
// Universal input parameters
// The inner angle is 11 degree (polar angle); We take z = 70 cm;
//Inner radius: R_in=z*tan(theta_min) cm
// Outer angle is decided from tan(theta_max)=R_out/z
// R_out=R_in+95 cm (transverse size of the M2 module)
Double_t fMuchZ1 = 0.0; // MuchCave Zin position [cm]
Double_t fAcceptanceTanMin = 0.19; // Acceptance tangent min (11 degree)
//************************************************************
// Input parameters for MUCH stations
//********************************************
const Int_t fNst = 1; // Number of stations
// Sector-type module parameters
// Number of sectors per layer (should be even for symmetry)
// Needs to be fixed with actual numbers
Double_t fActiveLzSector = 0.3; // Active volume thickness [cm]
Double_t fSpacerR1 = 2.8; // Spacer width in R at low Z[cm]
Double_t fSpacerR2 = 3.5; // Spacer width in R at high Z[cm]
Double_t fSpacerPhi = 2.8; // Spacer width in Phi [cm]
Double_t fOverlapR = 0.0; // Overlap in R direction [cm]
// Station Zceneter [cm] in the cave reference frame
//Double_t fStationZ0=80;
Double_t fStationZ0 = 70; // DE - move 10 cm upstream
Int_t fNlayers = 3; // Number of layers
Double_t fLayersDz = 10; // distance between the layers
Double_t fCoolLz = 1.0; // thickness of the cooling plate also used as support
/*
1 - detailed design (modules at two sides)
* 0 - simple design (1 module per layer)
*/
//***********************************************************
// some global variables
TGeoManager* gGeoMan = NULL; // Pointer to TGeoManager instance
TGeoVolume* gModules_station[fNst]; // Global storage for module types
// Forward declarations
void create_materials_from_media_file();
TGeoVolume* CreateStations(int ist);
TGeoVolume* CreateLayers(int istn, int ily);
void create_MUCH_geometry_v18e()
{
// Load needed material definition from media.geo file
create_materials_from_media_file();
// Get the GeoManager for later usage
gGeoMan = (TGeoManager*) gROOT->FindObject("FAIRGeom");
gGeoMan->SetVisLevel(10);
// Create the top volume
TGeoBBox* topbox = new TGeoBBox("", 1000., 1000., 2000.);
TGeoVolume* top = new TGeoVolume("top", topbox, gGeoMan->GetMedium("air"));
gGeoMan->SetTopVolume(top);
TGeoVolume* much = new TGeoVolumeAssembly(geoVersion);
top->AddNode(much, 1);
TGeoVolume* sttn = new TGeoVolumeAssembly("station"); //change name from Station ->station
much->AddNode(sttn, 1);
for (Int_t istn = 0; istn < 1; istn++) { // 1 Station
gModules_station[istn] = CreateStations(istn);
sttn->AddNode(gModules_station[istn], istn);
}
gGeoMan->CloseGeometry();
gGeoMan->CheckOverlaps(0.000001);
gGeoMan->PrintOverlaps();
// gGeoMan->Test();
much->Export(FileNameSim); // an alternative way of writing the much
TFile* outfile = new TFile(FileNameSim, "UPDATE");
TGeoTranslation* much_placement = new TGeoTranslation("much_trans", 0., 0., 0.);
much_placement->Write();
outfile->Close();
outfile = new TFile(FileNameGeo, "RECREATE");
gGeoMan->Write(); // use this if you want GeoManager format in the output
outfile->Close();
top->Draw("ogl");
}
void create_materials_from_media_file()
{
// Use the FairRoot geometry interface to load the media which are already defined
FairGeoLoader* geoLoad = new FairGeoLoader("TGeo", "FairGeoLoader");
FairGeoInterface* geoFace = geoLoad->getGeoInterface();
TString geoPath = gSystem->Getenv("VMCWORKDIR");
TString geoFile = geoPath + "/geometry/media.geo";
geoFace->setMediaFile(geoFile);
geoFace->readMedia();
// Read the required media and create them in the GeoManager
FairGeoMedia* geoMedia = geoFace->getMedia();
FairGeoBuilder* geoBuild = geoLoad->getGeoBuilder();
FairGeoMedium* air = geoMedia->getMedium(KeepingVolumeMedium);
geoBuild->createMedium(air);
FairGeoMedium* MUCHiron = geoMedia->getMedium(I);
geoBuild->createMedium(MUCHiron);
FairGeoMedium* MUCHlead = geoMedia->getMedium(L);
geoBuild->createMedium(MUCHlead);
FairGeoMedium* MUCHwolfram = geoMedia->getMedium(W);
geoBuild->createMedium(MUCHwolfram);
FairGeoMedium* MUCHcarbon = geoMedia->getMedium(C);
geoBuild->createMedium(MUCHcarbon);
FairGeoMedium* MUCHargon = geoMedia->getMedium(activemedium);
geoBuild->createMedium(MUCHargon);
FairGeoMedium* MUCHnoryl = geoMedia->getMedium(spacermedium);
geoBuild->createMedium(MUCHnoryl);
FairGeoMedium* aluminium = geoMedia->getMedium(coolmedium);
// geoBuild->createMedium(MUCHcool);
geoBuild->createMedium(aluminium);
}
TGeoVolume* CreateStations(int ist)
{
TString stationName = Form("muchstation%02i", ist + 1);
TGeoVolumeAssembly* station = new TGeoVolumeAssembly(stationName); //, shStation, air);
TGeoVolume* gLayer[4];
for (int ii = 0; ii < 3; ii++) { // 3 Layers
gLayer[ii] = CreateLayers(ist, ii);
station->AddNode(gLayer[ii], ii);
}
return station;
}
TGeoVolume* CreateLayers(int istn, int ily)
{
TString layerName = Form("muchstation%02ilayer%i", istn + 1, ily + 1);
TGeoVolumeAssembly* volayer = new TGeoVolumeAssembly(layerName);
//Double_t DeltaR=80.0; // transverse dimension of the module
Double_t stGlobalZ0 = fStationZ0 + fMuchZ1; //z position of station center (midplane) [cm]
Double_t stDz = ((fNlayers - 1) * fLayersDz + fCoolLz + 2 * fActiveLzSector) / 2.;
Double_t stGlobalZ2 = stGlobalZ0 + stDz;
Double_t stGlobalZ1 = stGlobalZ0 - stDz;
//Double_t rmin = stGlobalZ1 * fAcceptanceTanMin;
// Double_t rmax = rmin+ fSpacerR + DeltaR;
Int_t Nsector = 16.0; // need to be hard coded to match with station 1 of SIS100
//cout<<" Nsector "<<Nsector<<endl;
Double_t layerZ0 = (ily - (fNlayers - 1) / 2.) * fLayersDz;
Double_t layerGlobalZ0 = layerZ0 + stGlobalZ0;
Double_t sideDz = fCoolLz / 2. + fActiveLzSector / 2.; // distance between side's and layer's centers
Double_t moduleZ = sideDz; // Z position of the module center in the layer cs
Double_t phi0 = TMath::Pi() / Nsector; // azimuthal half widh of each module
//Double_t ymin = rmin+fSpacerR;
// Double_t ymax = rmax;
//define the dimensions of the trapezoidal module
//Use hard coded values for mini-cbm
Double_t dy = 40.0; //(ymax-ymin)/2.; //y (length)
Double_t dx1 = 3.75; //ymin*TMath::Tan(phi0)+fOverlapR/TMath::Cos(phi0); // large x
Double_t dx2 = 20; //ymax*TMath::Tan(phi0)+fOverlapR/TMath::Cos(phi0); // small x
Double_t dz = fActiveLzSector / 2.; // thickness
//define the spacer dimensions
Double_t tg = (dx2 - dx1) / 2 / dy;
Double_t dd1 = fSpacerPhi * tg;
Double_t dd2 = fSpacerPhi * sqrt(1 + tg * tg);
Double_t sdx1 = dx1 + dd2 - dd1;
Double_t sdx2 = dx2 + dd2 + dd1;
Double_t sdy1 = dy + fSpacerR1; // frame width added
Double_t sdy2 = dy + fSpacerR2; // frame width added
Double_t sdz = dz - 0.1;
// Define the (cooling plate) diemnsions (hardcoded for mcbm)
Double_t dy_s = sdy2; //46.5;//dy+2.0;
Double_t dx1_s = sdx1; //27.0; //dx1+2.0 ;// large x
Double_t dx2_s = sdx2; //27.0; //dx2+2.0;// x
Double_t dz_s = fCoolLz / 2.; //
TVector3 pos;
TVector3 size = TVector3(0.0, 0.0, fActiveLzSector);
// Now start adding the GEM modules
for (Int_t iModule = 0; iModule < 1; iModule++) {
// if (iModule!=0) continue;
// Double_t phi = 2 * phi0 * (iModule + 0.5); // add 0.5 to not overlap with y-axis for left-right layer separation
// Position of the module will depend on Phi
// Set Phi=180 degree 6 o'clock position
// Set Phi=90 degree 3 o'clock position
Double_t phi = TMath::Pi() / 2.0;
Bool_t isBack = iModule % 2;
Char_t cside = (isBack == 1) ? 'b' : 'f';
// correct the x, y positions
// pos[0] = -(ymin+dy)*sin(phi);
// pos[1] = (ymin+dy)*cos(phi);
pos[0] = 0; // DE - do not displace mMUCH in x
pos[1] = 0; //15; // DE - move upwards in y [cm]
// different z positions for odd/even modules
// pos[2] = (isBack ? 1 : -1)*moduleZ + layerGlobalZ0;
pos[2] = layerGlobalZ0;
TGeoMedium* argon = gGeoMan->GetMedium(activemedium); // active medium
TGeoMedium* noryl = gGeoMan->GetMedium(spacermedium); // spacer medium
TGeoMedium* aluminium = gGeoMan->GetMedium(coolmedium); // cool medium
// Define and place the trapezoidal GEM module in X-Y plane
TGeoTrap* shape = new TGeoTrap(dz, 0, phi, dy, dx1, dx2, 0, dy, dx1, dx2, 0);
// TGeoTrap* shape = new TGeoTrap(dz,0,0,dy,dx1,dx2,0,dy,dx1,dx2,0);
shape->SetName(Form("shStation%02iLayer%i%cModule%03iActiveNoHole", istn, ily, cside, iModule));
TString activeName = Form("muchstation%02ilayer%i%cactive%03igasArgon", istn + 1, ily + 1, cside, iModule + 1);
TGeoVolume* voActive = new TGeoVolume(activeName, shape, argon);
voActive->SetLineColor(kGreen);
// Define the trapezoidal spacers
TGeoTrap* shapeFrame = new TGeoTrap(sdz, 0, phi, sdy1, sdx1, sdx2, 0, sdy2, sdx1, sdx2, 0);
//TGeoTrap* shapeFrame = new TGeoTrap(sdz,0,0,sdy,sdx1,sdx2,0,sdy,sdx1,sdx2,0);
shapeFrame->SetName(Form("shStation%02iLayer%i%cModule%03iFullFrameNoHole", istn, ily, cside, iModule));
TString expression = Form("shStation%02iLayer%i%cModule%03iFullFrameNoHole-"
"shStation%02iLayer%i%cModule%03iActiveNoHole",
istn, ily, cside, iModule, istn, ily, cside, iModule);
TGeoCompositeShape* shFrame = new TGeoCompositeShape(
Form("shStation%02iLayer%i%cModule%03iFrameNoHole", istn, ily, cside, iModule), expression);
TString frameName = Form("muchstation%02ilayer%i%csupport%03i", istn + 1, ily + 1, cside, iModule + 1);
TGeoVolume* voFrame = new TGeoVolume(frameName, shFrame, noryl); // add a name to the frame
voFrame->SetLineColor(kMagenta);
// Define the trapezoidal (cooling plates)
// TGeoTrap* cool = new TGeoTrap(dz_s,0,phi,dy_s,dx1_s,dx2_s,0,dy_s,dx1_s,dx2_s,0);
TGeoTrap* cool = new TGeoTrap(dz_s, 0, phi, dy_s, dx1_s, dx2_s, 0, dy_s, dx1_s, dx2_s, 0);
cool->SetName(Form("shStation%02iLayer%i%cModule%03icool", istn, ily, cside, iModule));
TString CoolName = Form("muchstation%02ilayer%i%ccool%03iAluminum", istn + 1, ily + 1, cside, iModule + 1);
TGeoVolume* voCool = new TGeoVolume(CoolName, cool, aluminium);
voCool->SetLineColor(kYellow);
// Calculate the phi angle of the sector where it has to be placed
Double_t angle = 180. / TMath::Pi() * phi; // convert angle phi from rad to deg
TGeoTranslation* trans2 = new TGeoTranslation("", pos[0], pos[1], pos[2]); //for module and frame
TGeoTranslation* trans3 = new TGeoTranslation("", pos[0], pos[1], pos[2] + 0.65); //for module and frame
TGeoRotation* r2 = new TGeoRotation("r2");
//rotate in the vertical plane (per to z axis) with angle
// r2->RotateZ(angle);
// DE cout << "DE " << phi << endl;
// DE cout << "DE " << angle << endl;
// DE cout << "DE " << phi0 << endl;
// DE cout << "DE " << 180. / TMath::Pi() * phi0 << endl;
// r2->RotateZ(180.0); // DE - 6 o'clock position
r2->RotateZ(180.0 - (180. / TMath::Pi() * phi0)); // DE - 6 o'clock position, left side vertical
// r2->RotateZ(180.0-11.25); // DE - 6 o'clock position, left side vertical
// give rotation to set them in horizontal plane
//r2->RotateZ(90.0);//TMath::Pi());
TGeoHMatrix* incline_mod = new TGeoHMatrix("");
(*incline_mod) = (*trans2) * (*r2); // OK
volayer->AddNode(voFrame, iModule, incline_mod); // add frame
volayer->AddNode(voActive, iModule, incline_mod); // add active volume
TGeoHMatrix* incline_mod1 = new TGeoHMatrix("");
(*incline_mod1) = (*trans3) * (*r2); // for cooling
volayer->AddNode(voCool, iModule, incline_mod1); // cooling plate
}
return volayer;
}
/* Copyright (C) 2017 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
SPDX-License-Identifier: GPL-3.0-only
Authors: David Emschermann [committer] */
//
/// \file create_MUCH_geometry_v18e.C
/// \brief Generates MUCH geometry in Root format.
///
// 2017-11-06 - PPB, VS and AM - v18e - mMUCH version with actual Mv2 dimesions of the module
// 2017-10-23 - DE - mcbm - put mMUCH in 6 o'clock position on z axis, shift 15 cm up and to z = 60, 70 and 80 cm
// 2017-09-04 - PPB - mcbm - preliminary version of mini much geometry
// 2017-05-16 - DE - v17b - position the modules in a way to split layers left-right along y axis
// 2017-05-16 - DE - v17b - attribute name to module frames
// 2017-05-16 - DE - v17b - remove rim from support CompositeShape
// 2017-05-02 - PPB - v17a - Change the shape of the first absorber according to latest design
// 2017-04-27 - DE - v17a - fix GEM module positions and angles
// 2017-04-22 - PPB - v17a - Define the absorber, shield and station shapes sizes ...
// 2016-04-19 - DE - v17a - initial version derived from TRD
// in root all sizes are given in cm
#include "TClonesArray.h"
#include "TDatime.h"
#include "TFile.h"
#include "TGeoBBox.h"
#include "TGeoCompositeShape.h"
#include "TGeoCone.h"
#include "TGeoManager.h"
#include "TGeoMaterial.h"
#include "TGeoMatrix.h"
#include "TGeoMedium.h"
#include "TGeoPgon.h"
#include "TGeoTube.h"
#include "TGeoVolume.h"
#include "TGeoXtru.h"
#include "TList.h"
#include "TMath.h"
#include "TObjArray.h"
#include "TRandom3.h"
#include "TString.h"
#include "TSystem.h"
#include <cassert>
#include <fstream>
#include <iostream>
#include <stdexcept>
// Name of output file with geometry
const TString tagVersion = "_v18e";
const TString geoVersion = "much";
//const TString subVersion = "_3oclock";
//const TString geoVersion = "much_" + tagVersion + subVersion;
const TString FileNameSim = geoVersion + tagVersion + "_mcbm.geo.root";
const TString FileNameGeo = geoVersion + tagVersion + "_mcbm_geo.root";
const TString FileNameInfo = geoVersion + tagVersion + "_mcbm.geo.info";
// Names of the different used materials which are used to build the modules
// The materials are defined in the global media.geo file
const TString KeepingVolumeMedium = "air";
const TString L = "MUCHlead";
const TString W = "MUCHwolfram";
const TString C = "MUCHcarbon";
const TString I = "MUCHiron";
const TString activemedium = "MUCHargon";
const TString spacermedium = "MUCHnoryl";
const TString coolmedium = "aluminium"; //Al cooling plates
// Universal input parameters
// The inner angle is 11 degree (polar angle); We take z = 70 cm;
//Inner radius: R_in=z*tan(theta_min) cm
// Outer angle is decided from tan(theta_max)=R_out/z
// R_out=R_in+95 cm (transverse size of the M2 module)
Double_t fMuchZ1 = 0.0; // MuchCave Zin position [cm]
Double_t fAcceptanceTanMin = 0.19; // Acceptance tangent min (11 degree)
//************************************************************
// Input parameters for MUCH stations
//********************************************
const Int_t fNst = 1; // Number of stations
// Sector-type module parameters
// Number of sectors per layer (should be even for symmetry)
// Needs to be fixed with actual numbers
Double_t fActiveLzSector = 0.3; // Active volume thickness [cm]
Double_t fSpacerR1 = 2.8; // Spacer width in R at low Z[cm]
Double_t fSpacerR2 = 3.5; // Spacer width in R at high Z[cm]
Double_t fSpacerPhi = 2.8; // Spacer width in Phi [cm]
Double_t fOverlapR = 0.0; // Overlap in R direction [cm]
// Station Zceneter [cm] in the cave reference frame
//Double_t fStationZ0=80;
Double_t fStationZ0 = 70; // DE - move 10 cm upstream
Int_t fNlayers = 3; // Number of layers
Double_t fLayersDz = 10; // distance between the layers
Double_t fCoolLz = 1.0; // thickness of the cooling plate also used as support
/*
1 - detailed design (modules at two sides)
* 0 - simple design (1 module per layer)
*/
//***********************************************************
// some global variables
TGeoManager* gGeoMan = NULL; // Pointer to TGeoManager instance
TGeoVolume* gModules_station[fNst]; // Global storage for module types
// Forward declarations
void create_materials_from_media_file();
TGeoVolume* CreateStations(int ist);
TGeoVolume* CreateLayers(int istn, int ily);
void create_MUCH_geometry_v18e()
{
// Load needed material definition from media.geo file
create_materials_from_media_file();
// Get the GeoManager for later usage
gGeoMan = (TGeoManager*) gROOT->FindObject("FAIRGeom");
gGeoMan->SetVisLevel(10);
// Create the top volume
TGeoBBox* topbox = new TGeoBBox("", 1000., 1000., 2000.);
TGeoVolume* top = new TGeoVolume("top", topbox, gGeoMan->GetMedium("air"));
gGeoMan->SetTopVolume(top);
TGeoVolume* much = new TGeoVolumeAssembly(geoVersion);
top->AddNode(much, 1);
TGeoVolume* sttn = new TGeoVolumeAssembly("station"); //change name from Station ->station
much->AddNode(sttn, 1);
for (Int_t istn = 0; istn < 1; istn++) { // 1 Station
gModules_station[istn] = CreateStations(istn);
sttn->AddNode(gModules_station[istn], istn);
}
gGeoMan->CloseGeometry();
gGeoMan->CheckOverlaps(0.000001);
gGeoMan->PrintOverlaps();
// gGeoMan->Test();
// const TString tagVersion = "mcbm";
// const TString subVersion = "_3oclock";
// const TString geoVersion = "much_" + tagVersion + subVersion;
// const TString FileNameSim = geoVersion + ".geo.root";
// const TString FileNameGeo = geoVersion + "_geo.root";
much->Export(FileNameSim); // an alternative way of writing the much
TFile* outfile = new TFile(FileNameSim, "UPDATE");
TGeoTranslation* much_placement = new TGeoTranslation("much_trans", 0., 0., 0.);
much_placement->Write();
outfile->Close();
outfile = new TFile(FileNameGeo, "RECREATE");
gGeoMan->Write(); // use this if you want GeoManager format in the output
outfile->Close();
top->Draw("ogl");
}
void create_materials_from_media_file()
{
// Use the FairRoot geometry interface to load the media which are already defined
FairGeoLoader* geoLoad = new FairGeoLoader("TGeo", "FairGeoLoader");
FairGeoInterface* geoFace = geoLoad->getGeoInterface();
TString geoPath = gSystem->Getenv("VMCWORKDIR");
TString geoFile = geoPath + "/geometry/media.geo";
geoFace->setMediaFile(geoFile);
geoFace->readMedia();
// Read the required media and create them in the GeoManager
FairGeoMedia* geoMedia = geoFace->getMedia();
FairGeoBuilder* geoBuild = geoLoad->getGeoBuilder();
FairGeoMedium* air = geoMedia->getMedium(KeepingVolumeMedium);
geoBuild->createMedium(air);
FairGeoMedium* MUCHiron = geoMedia->getMedium(I);
geoBuild->createMedium(MUCHiron);
FairGeoMedium* MUCHlead = geoMedia->getMedium(L);
geoBuild->createMedium(MUCHlead);
FairGeoMedium* MUCHwolfram = geoMedia->getMedium(W);
geoBuild->createMedium(MUCHwolfram);
FairGeoMedium* MUCHcarbon = geoMedia->getMedium(C);
geoBuild->createMedium(MUCHcarbon);
FairGeoMedium* MUCHargon = geoMedia->getMedium(activemedium);
geoBuild->createMedium(MUCHargon);
FairGeoMedium* MUCHnoryl = geoMedia->getMedium(spacermedium);
geoBuild->createMedium(MUCHnoryl);
FairGeoMedium* aluminium = geoMedia->getMedium(coolmedium);
// geoBuild->createMedium(MUCHcool);
geoBuild->createMedium(aluminium);
}
TGeoVolume* CreateStations(int ist)
{
TString stationName = Form("muchstation%02i", ist + 1);
TGeoVolumeAssembly* station = new TGeoVolumeAssembly(stationName); //, shStation, air);
TGeoVolume* gLayer[4];
for (int ii = 0; ii < 3; ii++) { // 3 Layers
gLayer[ii] = CreateLayers(ist, ii);
station->AddNode(gLayer[ii], ii);
}
return station;
}
TGeoVolume* CreateLayers(int istn, int ily)
{
TString layerName = Form("muchstation%02ilayer%i", istn + 1, ily + 1);
TGeoVolumeAssembly* volayer = new TGeoVolumeAssembly(layerName);
//Double_t DeltaR=80.0; // transverse dimension of the module
Double_t stGlobalZ0 = fStationZ0 + fMuchZ1; //z position of station center (midplane) [cm]
Double_t stDz = ((fNlayers - 1) * fLayersDz + fCoolLz + 2 * fActiveLzSector) / 2.;
Double_t stGlobalZ2 = stGlobalZ0 + stDz;
Double_t stGlobalZ1 = stGlobalZ0 - stDz;
//Double_t rmin = stGlobalZ1 * fAcceptanceTanMin;
// Double_t rmax = rmin+ fSpacerR + DeltaR;
Int_t Nsector = 16.0; // need to be hard coded to match with station 1 of SIS100
//cout<<" Nsector "<<Nsector<<endl;
Double_t layerZ0 = (ily - (fNlayers - 1) / 2.) * fLayersDz;
Double_t layerGlobalZ0 = layerZ0 + stGlobalZ0;
Double_t sideDz = fCoolLz / 2. + fActiveLzSector / 2.; // distance between side's and layer's centers
Double_t moduleZ = sideDz; // Z position of the module center in the layer cs
Double_t phi0 = TMath::Pi() / Nsector; // azimuthal half widh of each module
//Double_t ymin = rmin+fSpacerR;
// Double_t ymax = rmax;
//define the dimensions of the trapezoidal module
//Use hard coded values for mini-cbm
Double_t dy = 40.0; //(ymax-ymin)/2.; //y (length)
Double_t dx1 = 3.75; //ymin*TMath::Tan(phi0)+fOverlapR/TMath::Cos(phi0); // large x
Double_t dx2 = 20; //ymax*TMath::Tan(phi0)+fOverlapR/TMath::Cos(phi0); // small x
Double_t dz = fActiveLzSector / 2.; // thickness
//define the spacer dimensions
Double_t tg = (dx2 - dx1) / 2 / dy;
Double_t dd1 = fSpacerPhi * tg;
Double_t dd2 = fSpacerPhi * sqrt(1 + tg * tg);
Double_t sdx1 = dx1 + dd2 - dd1;
Double_t sdx2 = dx2 + dd2 + dd1;
Double_t sdy1 = dy + fSpacerR1; // frame width added
Double_t sdy2 = dy + fSpacerR2; // frame width added
Double_t sdz = dz - 0.1;
// Define the (cooling plate) diemnsions (hardcoded for mcbm)
Double_t dy_s = 46.5; //dy+2.0;
Double_t dx1_s = 27.0; //dx1+2.0 ;// large x
Double_t dx2_s = 27.0; //dx2+2.0;// x
Double_t dz_s = fCoolLz / 2.; //
TVector3 pos;
TVector3 size = TVector3(0.0, 0.0, fActiveLzSector);
// Now start adding the GEM modules
for (Int_t iModule = 0; iModule < 1; iModule++) {
// if (iModule!=0) continue;
// Double_t phi = 2 * phi0 * (iModule + 0.5); // add 0.5 to not overlap with y-axis for left-right layer separation
// Position of the module will depend on Phi
// Set Phi=180 degree 6 o'clock position
// Set Phi=90 degree 3 o'clock position
Double_t phi = TMath::Pi() / 2.0;
Bool_t isBack = iModule % 2;
Char_t cside = (isBack == 1) ? 'b' : 'f';
// correct the x, y positions
// pos[0] = -(ymin+dy)*sin(phi);
// pos[1] = (ymin+dy)*cos(phi);
pos[0] = 0; // DE - do not displace mMUCH in x
pos[1] = 15; // DE - move upwards in y [cm]
// different z positions for odd/even modules
// pos[2] = (isBack ? 1 : -1)*moduleZ + layerGlobalZ0;
pos[2] = layerGlobalZ0;
TGeoMedium* argon = gGeoMan->GetMedium(activemedium); // active medium
TGeoMedium* noryl = gGeoMan->GetMedium(spacermedium); // spacer medium
TGeoMedium* aluminium = gGeoMan->GetMedium(coolmedium); // cool medium
// Define and place the trapezoidal GEM module in X-Y plane
TGeoTrap* shape = new TGeoTrap(dz, 0, phi, dy, dx1, dx2, 0, dy, dx1, dx2, 0);
// TGeoTrap* shape = new TGeoTrap(dz,0,0,dy,dx1,dx2,0,dy,dx1,dx2,0);
shape->SetName(Form("shStation%02iLayer%i%cModule%03iActiveNoHole", istn, ily, cside, iModule));
TString activeName = Form("muchstation%02ilayer%i%cactive%03igasArgon", istn + 1, ily + 1, cside, iModule + 1);
TGeoVolume* voActive = new TGeoVolume(activeName, shape, argon);
voActive->SetLineColor(kGreen);
// Define the trapezoidal spacers
TGeoTrap* shapeFrame = new TGeoTrap(sdz, 0, phi, sdy1, sdx1, sdx2, 0, sdy2, sdx1, sdx2, 0);
//TGeoTrap* shapeFrame = new TGeoTrap(sdz,0,0,sdy,sdx1,sdx2,0,sdy,sdx1,sdx2,0);
shapeFrame->SetName(Form("shStation%02iLayer%i%cModule%03iFullFrameNoHole", istn, ily, cside, iModule));
TString expression = Form("shStation%02iLayer%i%cModule%03iFullFrameNoHole-"
"shStation%02iLayer%i%cModule%03iActiveNoHole",
istn, ily, cside, iModule, istn, ily, cside, iModule);
TGeoCompositeShape* shFrame = new TGeoCompositeShape(
Form("shStation%02iLayer%i%cModule%03iFrameNoHole", istn, ily, cside, iModule), expression);
TString frameName = Form("muchstation%02ilayer%i%csupport%03i", istn + 1, ily + 1, cside, iModule + 1);
TGeoVolume* voFrame = new TGeoVolume(frameName, shFrame, noryl); // add a name to the frame
voFrame->SetLineColor(kMagenta);
// Define the trapezoidal (cooling plates)
// TGeoTrap* cool = new TGeoTrap(dz_s,0,phi,dy_s,dx1_s,dx2_s,0,dy_s,dx1_s,dx2_s,0);
TGeoTrap* cool = new TGeoTrap(dz_s, 0, phi, dy_s, dx1_s, dx2_s, 0, dy_s, dx1_s, dx2_s, 0);
cool->SetName(Form("shStation%02iLayer%i%cModule%03icool", istn, ily, cside, iModule));
TString CoolName = Form("muchstation%02ilayer%i%ccool%03iAluminum", istn + 1, ily + 1, cside, iModule + 1);
TGeoVolume* voCool = new TGeoVolume(CoolName, cool, aluminium);
voCool->SetLineColor(kYellow);
// Calculate the phi angle of the sector where it has to be placed
Double_t angle = 180. / TMath::Pi() * phi; // convert angle phi from rad to deg
TGeoTranslation* trans2 = new TGeoTranslation("", pos[0], pos[1], pos[2]); //for module and frame
TGeoTranslation* trans3 = new TGeoTranslation("", pos[0], pos[1], pos[2] + 0.65); //for module and frame
TGeoRotation* r2 = new TGeoRotation("r2");
//rotate in the vertical plane (per to z axis) with angle
// r2->RotateZ(angle);
// DE cout << "DE " << phi << endl;
// DE cout << "DE " << angle << endl;
// DE cout << "DE " << phi0 << endl;
// DE cout << "DE " << 180. / TMath::Pi() * phi0 << endl;
// r2->RotateZ(180.0); // DE - 6 o'clock position
r2->RotateZ(180.0 - (180. / TMath::Pi() * phi0)); // DE - 6 o'clock position, left side vertical
// give rotation to set them in horizontal plane
//r2->RotateZ(90.0);//TMath::Pi());
TGeoHMatrix* incline_mod = new TGeoHMatrix("");
(*incline_mod) = (*trans2) * (*r2); // OK
volayer->AddNode(voFrame, iModule, incline_mod); // add frame
volayer->AddNode(voActive, iModule, incline_mod); // add active volume
TGeoHMatrix* incline_mod1 = new TGeoHMatrix("");
(*incline_mod1) = (*trans3) * (*r2); // for cooling
volayer->AddNode(voCool, iModule, incline_mod1); // cooling plate
}
return volayer;
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.