public class CGARunManager {
public CGARunManager() {
}
public native void init(String
steer, String model, String setup,
String host, String user, String passwd);
public native void
beamOn(double
[]start, double []end,
double []direction, String particle, float energy,
int nbPart);
public native String
whereAmI(double
[]position);
public native void
getSteps(Vector
cont);
public native void
getVolumeData(String
name, Vector cont);
static {
System.loadLibrary("CGA");
}
}
Its static initializer loads the libCGA.so library that includes the
CLHEP, GEANT4 and Mokka libraries.
public native void
init(String steer, String model, String setup,
String host, String user, String passwd);
The parameters of this method allow access to the MySql geometry database used by the geometry model.
steer=the content of the steering file. If not present, the
empty string ("") can be passed.
model=the model name in the geometry database. Required.
setup=the detector setup. Can be passed the empty string ("").
host=the host name where the geometry database is running. Can
be passed as ' ' if one wants to connect to the geometry database
running
on aldebaran.in2p3.fr.
user=the user name for geometry database access. Can be passed
as ' ' if one wants to log on the "consult" account on the geometry
database
running on aldebaran.in2p3.fr.
passwd=the user password for geometry database access. Can be
passed as ' ' which means passing the default password for the
"consult"
account on the geometry database running on aldebaran.in2p3.fr.
The following example shows how one could use this method:
CGARunManager run = new CGARunManager();
run.init("", "D09M1", "", "", "", "");
public native String whereAmI(double []position);
The parameters of the method are as follows:
position=the x, y, z coordinates (in centimeters) of the point.
This method returns the name of the volume (GEANT 4 logical volume) that the point is situated in.
The following example shows how one could use this method and its return value:
CGARunManager run = new CGARunManager();
double end[]={-200*Math.sin(3.1418/8), 200*Math.cos(3.1418/8), 0};
System.out.println(run.whereAmI(end));
public native void
beamOn(double
[]initial, double []final,
double []direction, String particle, float energy,
int nbPart);
The parameters of this function are:
initial: the coordinates (in centimeters) of the point from
where
the particle is shot.
final: the coordinates (in centimeters) of the final point of
the particle's trajectory. If the particle is charged, it shall be
killed
as soon as it enters the volume (layer) that the final point is
situated
in.
direction: the direction that the particle is shot.
particle: the particle's name.
energy: the particle's energy.
nbPart: the number of particles that we want to shoot.
The following example shows how one could use this function:
double start[]={-68, 169, 0};
double end[]={-200*Math.sin(3.1418/8), 200*Math.cos(3.1418/8),
0};//z = -283.5 to touch four EnvLogs
double direction[]={end[0]-start[0], end[1]-start[1],
end[2]-start[2]};
CGARunManager run = new CGARunManager();
run.beamOn(start, end, direction, "geantino", 20, 1);
public native void getSteps(Vector cont);
This method fills the "cont" Vector with objects of the class "Step", one for each step:
public class Step {
public Step() {};
public Step(String
volumeName, String materialName, double dist,
double xx, double yy, double zz, double x0, double InterLen) {
volName = volumeName;
matName = materialName;
distance = dist; nbX0 = x0; nInterLen = InterLen;
X = xx; Y = yy; Z = zz;
}
private String volName,
matName;
private double distance,
nbX0, nInterLen;
private double X, Y, Z;
public String VolName() {
return volName;}
public String MatName() {
return matName;}
public double Distance() {
return distance; }
public double X0() { return
nbX0; }
public double InterLen() {
return nInterLen; }
public double X() { return
X; }
public double Y() { return
Y; }
public double Z() { return
Z; }
}
The data members of this class are as follows:
volName=the name of the volume (GEANT 4 logical volume) that
the particle went through.
matName=the name of the material (GEANT 4 material).
distance=the distance that the particle went along in the
volume.
X, Y, Z=the x, y, z coordinates of the entrance point in the
volume.
nbX0=the number of radiation lengths in the volume that the
particle went
through.
nInterLen=the number of interaction lengths in the volume that
the particle went
through.
The following example shows how one could use the getSteps method and its return values:
CGARunManager run = new CGARunManager();
Vector vec = new Vector();
run.getSteps(vec);
for(int i = 0; i < vec.size(); i++)
System.out.println(i + " " +
((Step)vec.elementAt(i)).VolName()
+ " " + ((Step)vec.elementAt(i)).Distance() + " " +
((Step)vec.elementAt(i)).X() + " " +
((Step)vec.elementAt(i)).Y() + " " +
((Step)vec.elementAt(i)).Z() + " " +
((Step)vec.elementAt(i)).X0());
public native void getVolumeData(String name, Vector cont);
The parameters of the method are as follows:
name=the name of the (GEANT 4 logical volume) of the module
of
interest.
cont=a vector containing objects of the above shown "Step"
class,
one object for each module. This vector is filled by the function.
The following example shows how one could use this method and its return values:
CGARunManager run = new CGARunManager();
Vector vec2 = new Vector();
run.getVolumeData("EnvLog", vec2);
for(int i = 0; i < vec2.size(); i++)
System.out.println(i + " " +
((Step)vec2.elementAt(i)).VolName()
+ " " + ((Step)vec2.elementAt(i)).Distance() + " " +
((Step)vec2.elementAt(i)).X() + " " +
((Step)vec2.elementAt(i)).Y() + " " +
((Step)vec2.elementAt(i)).Z() + " " +
((Step)vec2.elementAt(i)).X0());
CGARunManager run = new CGARunManager();
LCCollection col = evt.getCollection(name);
run.setSD(col.getFlag());
int id0 = hit.getCellID0() ;
Vector cgaResult = run.cellIndex(id0);
System.out.print(" - pos from CGA: ("
+ ((Double)(cgaResult.elementAt(0))).floatValue() + ", "
+ ((Double)(cgaResult.elementAt(1))).floatValue() + ", "
+ ((Double)(cgaResult.elementAt(2))).floatValue() + ")");
Team working on the Geant4 simulation for The Next Linear Collider: