| Message: Transport Matrices | Not Logged In (login) |
|
Dear Geant4 Users,
I had initially used a C program called raytrace to set up transport matrices and am working on changing it to a C++ program that will transport electrons to the Cerenkov target. To do this, I started with the Transport Matrix as follows: void ExN02PrimaryGeneratorAction::InitializeTransportMatrix() {
float T[6][6][6],R[6][6],in[6],outvec[6],Zo,z;
ifstream indata; FILE *file; char fname[50]; int using_x_direction,j,k,i,dum; static int set_up= FALSE,ray_number;
for(i=0;i<6;i++)
for(j=0;j<6;j++)
outvec[i] = 0;
for(k=0;k<6;k++)
T[i][j][k] = 0.0;
for(i=0;i<5;i++)
{
for(j=0;j<6;j++)
{
for(k=0;k<=j;k++)
fstream file("shms.dat");
if (!file){
cerr << "Failed to open file\n";
exit(EXIT_FAILURE);
}
fscanf(file,"shms.dat",&dum,&dum,&(T[i][j][k]) );
fscanf(file,"shms.dat");
indata.open("shms.dat");
fscanf(file,"shms.dat ",&(R[j][i]));
outvec[i] += R[i][j]*in[j];
for(k=0;k<6;k++)
outvec[i] += T[i][j][k]*in[j]*in[k];
}
}
fclose( file );
Now, I need to use the function void ExN02PrimaryGeneratorAction::TransportTargetToCerenkov()
{}
in order to transport the electrons to the Cerenkov mirrors/target and observe the photon pattersn created as a result. I was wondering had anything to add as far as how to set up a code that will transport the electrons after the transport matrix is initialized. Thanks in Advance, EA
|
|
to: |