gfields
example.cc
Go to the documentation of this file.
1 // gfields
2 #include "gfieldOptions.h"
3 #include "gmagneto.h"
4 
5 // c++
6 #include <iostream>
7 
8 using namespace std;
9 
10 int main(int argc, char *argv[]) {
11 
12  // Initialize GOptions (parsed from YAML or another source)
13  GOptions *gopts = new GOptions(argc, argv, gfields::defineOptions());
14 
15  // Create a GMagneto instance to manage fields
16  GMagneto *magneto = new GMagneto(gopts);
17 
18  string field_name = "dipole";
19 
20  // Check if a specific field exists
21  if (magneto->isField(field_name)) {
22 // GField *field = magneto->getField(field_name);
23 // G4FieldManager *fieldManager = magneto->getFieldMgr(field_name);
24  } else {
25  cout << "Field " << field_name << " was not found." << endl;
26  }
27 
28  return EXIT_SUCCESS;
29 }
Represents a world containing collections of GFields and G4FieldManagers.
Definition: gmagneto.h:15
bool isField(std::string name)
Checks if a field with the given name exists.
Definition: gmagneto.h:43
int main(int argc, char *argv[])
Definition: example.cc:10
GOptions defineOptions()