Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
GeoModel
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
GeoModelDev
GeoModel
Commits
3085a89f
Commit
3085a89f
authored
1 year ago
by
Marilena Bandieramonte
Browse files
Options
Downloads
Patches
Plain Diff
Update HelloGeoRead2G4 example
parent
a5d6dd32
No related branches found
No related tags found
1 merge request
!199
Update GeoModelExamples
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
GeoModelExamples/HelloGeoRead2G4/main.cpp
+18
-29
18 additions, 29 deletions
GeoModelExamples/HelloGeoRead2G4/main.cpp
with
18 additions
and
29 deletions
GeoModelExamples/HelloGeoRead2G4/main.cpp
+
18
−
29
View file @
3085a89f
// Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
// Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
/*
/*
* HelloGeo.cpp
* HelloGeo
ReadG4
.cpp
*
*
* Author: Riccardo Maria BIANCHI @ CERN
* Author: Riccardo Maria BIANCHI @ CERN
* Created on: Nov, 2018
* Created on: Nov, 2018
* Updated on: Jul, 2023 by Marilena Bandieramonte
*
*
*/
*/
...
@@ -31,44 +32,32 @@
...
@@ -31,44 +32,32 @@
#define SYSTEM_OF_UNITS GeoModelKernelUnits // so we will get, e.g., 'GeoModelKernelUnits::cm'
#define SYSTEM_OF_UNITS GeoModelKernelUnits // so we will get, e.g., 'GeoModelKernelUnits::cm'
// GeoModelExperiment* createTheExperiment(GeoPhysVol* world)
int
main
(
int
argc
,
char
*
argv
[])
// {
// if (world == nullptr)
// {
// // Setup the 'World' volume from which everything else will be suspended
// double densityOfAir=0.1;
// const GeoMaterial* worldMat = new GeoMaterial("std::Air", densityOfAir);
// const GeoBox* worldBox = new GeoBox(1000*SYSTEM_OF_UNITS::cm, 1000*SYSTEM_OF_UNITS::cm, 1000*SYSTEM_OF_UNITS::cm);
// const GeoLogVol* worldLog = new GeoLogVol("WorldLog", worldBox, worldMat);
// world = new GeoPhysVol(worldLog);
// }
// // Setup the 'Experiment' manager
// GeoModelExperiment* theExperiment = new GeoModelExperiment(world);
// return theExperiment;
// }
// TODO: int main(int argc, char *argv[])
int
main
()
{
{
// Set a valid local geometry db path before first run
if
(
argc
!=
2
)
static
const
std
::
string
path
=
"../geometry.db"
;
{
fprintf
(
stderr
,
"
\n
ERROR!
\n
Usage: %s geometry.db
\n\n
"
,
argv
[
0
]);
return
1
;
}
// Get the input SQLite '.db' file containing the geometry
std
::
string
line
;
std
::
string
fileName
;
fileName
=
argv
[
1
];
std
::
cout
<<
"Using this SQLite '.db' file:"
<<
fileName
<<
std
::
endl
;
std
::
cout
<<
"Using this DB file:"
<<
path
<<
std
::
endl
;
// check if DB file exists. If not, return.
// check if DB file exists. If not, return.
// FIXME: TODO: this check should go in the 'GMDBManager' constructor.
// FIXME: TODO: this check should go in the 'GMDBManager' constructor.
std
::
ifstream
infile
(
path
.
c_str
());
std
::
ifstream
infile
(
fileName
.
c_str
());
if
(
infile
.
good
()
)
{
if
(
!
infile
.
good
()
)
{
std
::
cout
<<
"
\n\t
ERROR!! A '"
<<
path
<<
"' file
exists already!! Please, remove, move, or rename it
before running this program. Exiting..."
;
std
::
cout
<<
"
\n\t
ERROR!! A '"
<<
fileName
<<
"' file
does not exist!! Please, check the path of the input file
before running this program. Exiting..."
;
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
infile
.
close
();
infile
.
close
();
// open the DB
// open the DB
GMDBManager
*
db
=
new
GMDBManager
(
path
);
GMDBManager
*
db
=
new
GMDBManager
(
fileName
);
/* Open database */
/* Open database */
if
(
db
->
checkIsDBOpen
())
{
if
(
db
->
checkIsDBOpen
())
{
...
...
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