Difference between revisions of "LH2 target"
Line 69: | Line 69: | ||
G4double targetSize = 0.5*fTargetLength; // Half length of the Target | G4double targetSize = 0.5*fTargetLength; // Half length of the Target | ||
G4double trackerSize = 0.5*fTrackerLength; // Half length of the Tracker | G4double trackerSize = 0.5*fTrackerLength; // Half length of the Tracker | ||
+ | </pre> | ||
+ | |||
+ | ===Recording Moller Events=== | ||
+ | Moller scattering does not have a GEANT4 specific setting, so the file '''ExN02SteppingVerbose.cc''' was edited to record only events that would correspond to Moller events. Since Moller scattering is simply electron-electron scattering, we can look for events where electron ionization is the process in the data stream. We will limit this to only particles with a parentID of 0 and 1 representing the parent and daughter (Moller) electrons. This eliminates second generation Moller scatterings, which only ocur about 2 times out of 1E6 incoming electrons. This method also eliminates Delta Rays or Knock-on-Electrons. | ||
+ | |||
+ | |||
+ | The file ExN02SteppingVerbose.cc is read for each step in the GEANT4 simulation, so recording the momentum, position, and energies of the electrons before and after the collision can be found in multiple loops. | ||
+ | |||
+ | |||
+ | On the first pass of SteppingVerbose, the data is recorded into a temporary variable set. The physical process of ionization occurs after the collision of the two electrons. This implies that the data could possible be the initial state of the incoming electron. This is read every time to be prepared for the subsequent pass where the process of ionization (scattering) is active. | ||
+ | <pre> | ||
+ | void ExN02SteppingVerbose::StepInfo() | ||
+ | { | ||
+ | . | ||
+ | . | ||
+ | . | ||
+ | if(fTrack->GetDefinition()->GetPDGEncoding()==11 && fStep->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()!="eIoni" && fTrack->GetParentID()==0) | ||
+ | { | ||
+ | Temp_Energy=fTrack->GetKineticEnergy(); | ||
+ | Temp_Mom_x=fTrack->GetMomentum().x(); | ||
+ | Temp_Mom_y=fTrack->GetMomentum().y(); | ||
+ | Temp_Mom_z=fTrack->GetMomentum().z(); | ||
+ | Temp_Pos_x=fTrack->GetPosition().x(); | ||
+ | Temp_Pos_y=fTrack->GetPosition().y(); | ||
+ | Temp_Pos_z=fTrack->GetPosition().z(); | ||
+ | } | ||
+ | </pre> | ||
+ | |||
+ | On a pass afterwards, the data is read into a variable for the final state when the physical state is ionization, representing the Moller scattering. The the temporary variable is read into the initial state. | ||
+ | |||
+ | <pre> | ||
+ | if( fTrack->GetDefinition()->GetPDGEncoding()==11 && fStep->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="eIoni" && fTrack->GetParentID()==0) | ||
+ | { | ||
+ | Final_Energy= fTrack->GetKineticEnergy(); | ||
+ | Final_Mom_x=fTrack->GetMomentum().x(); | ||
+ | Final_Mom_y=fTrack->GetMomentum().y(); | ||
+ | Final_Mom_z=fTrack->GetMomentum().z(); | ||
+ | Final_Pos_x=fTrack->GetPosition().x(); | ||
+ | Final_Pos_y=fTrack->GetPosition().y(); | ||
+ | Final_Pos_z=fTrack->GetPosition().z(); | ||
+ | |||
+ | Init_Energy=Temp_Energy; | ||
+ | Init_Mom_x=Temp_Mom_x; | ||
+ | Init_Mom_y=Temp_Mom_y; | ||
+ | Init_Mom_z=Temp_Mom_z; | ||
+ | Init_Pos_x=Temp_Pos_x; | ||
+ | Init_Pos_y=Temp_Pos_y; | ||
+ | Init_Pos_z=Temp_Pos_z; | ||
+ | |||
+ | } | ||
+ | </pre> | ||
+ | |||
+ | This will write the data to an external file only for a 1st generation daughter particle and an active trigger. Afterwards, the trigger is turned off so that the recording process can start again. | ||
+ | |||
+ | <pre> | ||
+ | if(fTrack->GetDefinition()->GetPDGEncoding()==11 && fTrack->GetParentID()==1 && trigger==1 ) | ||
+ | { | ||
+ | outfile | ||
+ | //G4cout | ||
+ | << Init_Energy<< " " | ||
+ | << Init_Mom_x << " " | ||
+ | << Init_Mom_y << " " | ||
+ | << Init_Mom_z << " " | ||
+ | << Init_Pos_x << " " | ||
+ | << Init_Pos_y << " " | ||
+ | << Init_Pos_z << " " | ||
+ | << Final_Energy << " " | ||
+ | << Final_Mom_x << " " | ||
+ | << Final_Mom_y << " " | ||
+ | << Final_Mom_z << " " | ||
+ | << Final_Pos_x << " " | ||
+ | << Final_Pos_y << " " | ||
+ | << Final_Pos_z << " " | ||
+ | << Mol_Energy << " " | ||
+ | << Mol_Mom_x << " " | ||
+ | << Mol_Mom_y << " " | ||
+ | << Mol_Mom_z << " " | ||
+ | << Mol_Pos_x << " " | ||
+ | << Mol_Pos_y << " " | ||
+ | << Mol_Pos_z << " " | ||
+ | << G4endl; | ||
+ | trigger=0; | ||
+ | } | ||
+ | . | ||
+ | . | ||
+ | . | ||
+ | } | ||
+ | </pre> | ||
+ | |||
+ | On a later pass, the condition that the parentID no longer represents the parent. This implies that the particle a Moller electron and the data is recorded into the Moller final state. The trigger is activated, which on the next pass of the program will allow a printout of all Moller Scattering data. | ||
+ | |||
+ | <pre> | ||
+ | void ExN02SteppingVerbose::TrackingStarted() | ||
+ | { | ||
+ | . | ||
+ | . | ||
+ | . | ||
+ | if(fTrack->GetDefinition()->GetPDGEncoding()==11 && fTrack->GetParentID()>0) | ||
+ | { | ||
+ | Mol_Energy=fTrack->GetKineticEnergy(); | ||
+ | Mol_Mom_x=fTrack->GetMomentum().x(); | ||
+ | Mol_Mom_y=fTrack->GetMomentum().y(); | ||
+ | Mol_Mom_z=fTrack->GetMomentum().z(); | ||
+ | Mol_Pos_x=fTrack->GetPosition().x(); | ||
+ | Mol_Pos_y=fTrack->GetPosition().y(); | ||
+ | Mol_Pos_z=fTrack->GetPosition().z(); | ||
+ | trigger=1; | ||
+ | } | ||
+ | . | ||
+ | . | ||
+ | . | ||
+ | } | ||
+ | </pre> | ||
+ | |||
+ | |||
+ | Running the simulation | ||
+ | <pre> | ||
+ | cmake . | ||
+ | make -f Makefile | ||
+ | ./exampleN02 run4.mac>/dev/null | ||
+ | </pre> | ||
+ | |||
+ | Where the run4.mac file is | ||
+ | <pre> | ||
+ | /gun/particle e- | ||
+ | /gun/energy 11 GeV | ||
+ | /event/verbose 0 | ||
+ | /tracking/verbose 1 | ||
+ | /run/beamOn 40000000 | ||
</pre> | </pre> |
Revision as of 22:41, 28 March 2016
Detector Material and Construction
Using GEANT4, the ExampleN02 file was edited to run for a NH3 target. The file ExN02DetectorConstruction.cc was edited with
//--------- Material definition --------- G4double a, z; G4double density, temperature, pressure; //Liquid Hydrogen G4Material* LH2 = new G4Material("Hydrogen", z=2., a=2.02*g/mole, density=0.07*g/cm3, kStateGas,3*kelvin,1.7e5*pascal);
The target is a cylinder with a 1.5 cm diameter and 1 cm thickness following dimensions listed on page 8 of File:PHY02-33.pdf
//--------- Sizes of the principal geometrical components (solids) --------- NbOfChambers = 1; ChamberWidth = 1.5*cm; ChamberSpacing = 40*cm; fTrackerLength = (NbOfChambers+1)*ChamberSpacing; // Full length of Tracker fTargetLength = 1.0 * cm; // Full length of Target TargetMater = NH3; ChamberMater = BadVacuum; //fWorldLength= 1.2 *(fTargetLength+fTrackerLength); fWorldLength= 1.2 *(10+fTrackerLength)+100 *cm; G4double targetSize = 0.5*fTargetLength; // Half length of the Target G4double trackerSize = 0.5*fTrackerLength; // Half length of the Tracker
Detector Material and Construction
Using GEANT4, the ExampleN02 file was edited to run for a NH3 target. The file ExN02DetectorConstruction.cc was edited with
//--------- Material definition --------- G4double a, z; G4double density, temperature, pressure; //Liquid Hydrogen G4Material* LH2 = new G4Material("Hydrogen", z=2., a=2.02*g/mole, density=0.07*g/cm3, kStateGas,3*kelvin,1.7e5*pascal);
The target is a cylinder with a 1.5 cm diameter and 1 cm thickness following dimensions listed on page 8 of File:PHY02-33.pdf
//--------- Sizes of the principal geometrical components (solids) --------- NbOfChambers = 1; ChamberWidth = 1.5*cm; ChamberSpacing = 40*cm; fTrackerLength = (NbOfChambers+1)*ChamberSpacing; // Full length of Tracker fTargetLength = 1.0 * cm; // Full length of Target TargetMater = NH3; ChamberMater = BadVacuum; //fWorldLength= 1.2 *(fTargetLength+fTrackerLength); fWorldLength= 1.2 *(10+fTrackerLength)+100 *cm; G4double targetSize = 0.5*fTargetLength; // Half length of the Target G4double trackerSize = 0.5*fTrackerLength; // Half length of the Tracker
Recording Moller Events
Moller scattering does not have a GEANT4 specific setting, so the file ExN02SteppingVerbose.cc was edited to record only events that would correspond to Moller events. Since Moller scattering is simply electron-electron scattering, we can look for events where electron ionization is the process in the data stream. We will limit this to only particles with a parentID of 0 and 1 representing the parent and daughter (Moller) electrons. This eliminates second generation Moller scatterings, which only ocur about 2 times out of 1E6 incoming electrons. This method also eliminates Delta Rays or Knock-on-Electrons.
The file ExN02SteppingVerbose.cc is read for each step in the GEANT4 simulation, so recording the momentum, position, and energies of the electrons before and after the collision can be found in multiple loops.
On the first pass of SteppingVerbose, the data is recorded into a temporary variable set. The physical process of ionization occurs after the collision of the two electrons. This implies that the data could possible be the initial state of the incoming electron. This is read every time to be prepared for the subsequent pass where the process of ionization (scattering) is active.
void ExN02SteppingVerbose::StepInfo() { . . . if(fTrack->GetDefinition()->GetPDGEncoding()==11 && fStep->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()!="eIoni" && fTrack->GetParentID()==0) { Temp_Energy=fTrack->GetKineticEnergy(); Temp_Mom_x=fTrack->GetMomentum().x(); Temp_Mom_y=fTrack->GetMomentum().y(); Temp_Mom_z=fTrack->GetMomentum().z(); Temp_Pos_x=fTrack->GetPosition().x(); Temp_Pos_y=fTrack->GetPosition().y(); Temp_Pos_z=fTrack->GetPosition().z(); }
On a pass afterwards, the data is read into a variable for the final state when the physical state is ionization, representing the Moller scattering. The the temporary variable is read into the initial state.
if( fTrack->GetDefinition()->GetPDGEncoding()==11 && fStep->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="eIoni" && fTrack->GetParentID()==0) { Final_Energy= fTrack->GetKineticEnergy(); Final_Mom_x=fTrack->GetMomentum().x(); Final_Mom_y=fTrack->GetMomentum().y(); Final_Mom_z=fTrack->GetMomentum().z(); Final_Pos_x=fTrack->GetPosition().x(); Final_Pos_y=fTrack->GetPosition().y(); Final_Pos_z=fTrack->GetPosition().z(); Init_Energy=Temp_Energy; Init_Mom_x=Temp_Mom_x; Init_Mom_y=Temp_Mom_y; Init_Mom_z=Temp_Mom_z; Init_Pos_x=Temp_Pos_x; Init_Pos_y=Temp_Pos_y; Init_Pos_z=Temp_Pos_z; }
This will write the data to an external file only for a 1st generation daughter particle and an active trigger. Afterwards, the trigger is turned off so that the recording process can start again.
if(fTrack->GetDefinition()->GetPDGEncoding()==11 && fTrack->GetParentID()==1 && trigger==1 ) { outfile //G4cout << Init_Energy<< " " << Init_Mom_x << " " << Init_Mom_y << " " << Init_Mom_z << " " << Init_Pos_x << " " << Init_Pos_y << " " << Init_Pos_z << " " << Final_Energy << " " << Final_Mom_x << " " << Final_Mom_y << " " << Final_Mom_z << " " << Final_Pos_x << " " << Final_Pos_y << " " << Final_Pos_z << " " << Mol_Energy << " " << Mol_Mom_x << " " << Mol_Mom_y << " " << Mol_Mom_z << " " << Mol_Pos_x << " " << Mol_Pos_y << " " << Mol_Pos_z << " " << G4endl; trigger=0; } . . . }
On a later pass, the condition that the parentID no longer represents the parent. This implies that the particle a Moller electron and the data is recorded into the Moller final state. The trigger is activated, which on the next pass of the program will allow a printout of all Moller Scattering data.
void ExN02SteppingVerbose::TrackingStarted() { . . . if(fTrack->GetDefinition()->GetPDGEncoding()==11 && fTrack->GetParentID()>0) { Mol_Energy=fTrack->GetKineticEnergy(); Mol_Mom_x=fTrack->GetMomentum().x(); Mol_Mom_y=fTrack->GetMomentum().y(); Mol_Mom_z=fTrack->GetMomentum().z(); Mol_Pos_x=fTrack->GetPosition().x(); Mol_Pos_y=fTrack->GetPosition().y(); Mol_Pos_z=fTrack->GetPosition().z(); trigger=1; } . . . }
Running the simulation
cmake . make -f Makefile ./exampleN02 run4.mac>/dev/null
Where the run4.mac file is
/gun/particle e- /gun/energy 11 GeV /event/verbose 0 /tracking/verbose 1 /run/beamOn 40000000