Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cbmroot
Manage
Activity
Members
Labels
Plan
Wiki
Redmine
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Computing
cbmroot
Commits
52331a29
Commit
52331a29
authored
1 year ago
by
Eoin Clerkin
Browse files
Options
Downloads
Patches
Plain Diff
Adds basic creation macro
parent
7867ed93
No related branches found
No related tags found
1 merge request
!1338
CAD conversion tools and procedure
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
macro/geometry/cad2root/Create_Geometry.C
+83
-0
83 additions, 0 deletions
macro/geometry/cad2root/Create_Geometry.C
with
83 additions
and
0 deletions
macro/geometry/cad2root/Create_Geometry.C
0 → 100644
+
83
−
0
View file @
52331a29
/* Copyright (C) 2023 Facility for AntiProton and Ion Research in Europe, Darmstadt
SPDX-License-Identifier: GPL-3.0-only
Authors: Eoin Clerkin [committer] */
/* Generic macro which creates root geometry from CAD */
#include
"TROOT.h"
#include
"TSystem.h"
#include
"TGeoVolume.h"
#include
"FairGeoLoader.h"
#include
"FairGeoInterface.h"
#include
"TGeoManager.h"
#include
"TGeoSystemOfUnits.h"
#include
"TGeoTube.h"
#include
"TFile.h"
#include
"TGeoCompositeShape.h"
#include
"TGeoMaterial.h"
#include
"TGeoMatrix.h"
#include
"TGeoMedium.h"
#include
"TGeoPgon.h"
#include
"TList.h"
#include
"TROOT.h"
#include
"TString.h"
#include
"TSystem.h"
#include
<iostream>
#include
<sstream>
#include
<string.h>
#include
<stdbool.h>
#include
"CbmDigitize.h"
// For CbmBaselibrary
#include
"CbmGeometryUtils.h"
/* Generic macro to create root geometry */
void
Create_Geometry
(
const
char
*
tag
=
"bmon_v23a"
,
double
Tz
=-
287
.
2075
){
using
namespace
Cbm
::
GeometryUtils
;
// gGeoManager with full list of materials and media.
TGeoManager
*
gM
=
(
TGeoManager
*
)
pop_TGeoManager
(
tag
);
// Create a top volume (assembly)
TGeoVolume
*
top
=
new
TGeoVolumeAssembly
(
tag
);
gM
->
SetTopVolume
(
top
);
int
inum
=
0
;
// Importing of geometries from CAD, via stl and gdml
#include
"PARTS.C"
// Everything else
#include
"EXTRAS.C"
// Writing to disk
char
fileName
[
100
];
strcpy
(
fileName
,
tag
);
strcat
(
fileName
,
".geo.root"
);
TFile
*
output
=
TFile
::
Open
(
fileName
,
"RECREATE"
);
top
->
Write
();
// Write to fileName
TGeoTranslation
*
mat
=
new
TGeoTranslation
(
0
,
0
,
Tz
);
mat
->
Write
();
// Write Translation
output
->
Close
();
// End
printf
(
"Successfully completed.
\n
"
);
printf
(
"******************************************************
\n
"
);
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment