Hello everyone,
I am working on a simulation in which I need to create a list of certain vector values (it is NOT the position of the particle. It is just a list of vectors). I am creating this list in in RunAction.cc, but I would like to access it in the TrakingAction.cc and use those values to modify a particle position in the TrackingAction.
These are the for loops to create my list in RunAction:
std::list<G4ThreeVector> DeltaList; // create list
for(G4double i = -0.039; i < 0.039; i = i + 0.001)
{
for(G4double j = -0.039; j < 0.039; j = j + 0.001)
{
for(G4double k = -0.039; k < 0.039; k = k + 0.001)
{
Delta = G4ThreeVector(i*cm, j*cm, k*cm); // Create the vector
DeltaList.push_back(Delta); // Save the vectors in the list
}
}
}
I searched how to access a list in other class for C++ and found this ( c# - Access List from another class - Stack Overflow. ):
public class MyClass {
private List<string> myList = new List<string>();
public List<string> GetList()
{
return myList;
}
}
:::::::::::::::::::::::::::::::::::::::::::::::::::
public class CallingClass {
MyClass myClass = new MyClass();
public void GetList()
{
List<string> calledList = myClass.GetList();
///More code here...
}
}
I tired to implement this on Geant4, but it is not working at all. Does anyone know how I could access this list in the TrackingAction?
Thank you,