77{
78
81 (G4RunManager::GetRunManager()->GetUserDetectorConstruction());
82
83
85
86
87 G4StepPoint* preStepPoint = step->GetPreStepPoint();
88 G4StepPoint* postStepPoint = step->GetPostStepPoint();
89
90
92 ->GetVolume()->GetLogicalVolume();
93
94
95 G4Track* track = step->GetTrack();
96 G4int ID = track->GetTrackID();
97 G4String partName = track->GetDefinition()->GetParticleName();
98
99
100 G4double PrimaryWeight = 1.;
101 if (partName == "gamma" && ID==1) {
102 PrimaryWeight = track->GetWeight();
104 }
105
106
107 if (volume !=
fPhantom || partName !=
"gamma" || ID!=1)
return;
108
109
110 G4int eventNumber = G4RunManager::GetRunManager()
111 ->GetCurrentEvent()->GetEventID();
115 }
116
117
119 if (postStepPoint->GetProcessDefinedStep() != NULL) {
120 Process = postStepPoint->GetProcessDefinedStep()->GetProcessName();
121 } else {
122 Process = "UserLimit";
123 }
124
125 G4int ProcIndex = -1;
126 if (Process == "Transportation" || Process == "CoupledTransportation"
127 || Process == "UserLimit") {
128 ProcIndex = 0;
129 }
130 if (Process == "Rayl" || Process == "biasWrapper(Rayl)") {
131 ProcIndex = 1;
134 }
135 if (Process == "compt" || Process == "biasWrapper(compt)") {
136 ProcIndex = 2;
139 }
140 if (Process == "phot" || Process == "biasWrapper(phot)") ProcIndex = 3;
141 if (Process == "conv" || Process == "biasWrapper(conv)") ProcIndex = 4;
142 if (Process == "photonNuclear" ||
143 Process == "biasWrapper(photonNuclear)") {
144 ProcIndex = 5;
145 }
146 if (Process == "PowderDiffraction" ||
147 Process == "biasWrapper(PowderDiffraction)") {
148 ProcIndex = 6;
151 }
152
153
154
155 G4ThreeVector mom1 = preStepPoint->GetMomentumDirection();
156 G4ThreeVector mom2 = postStepPoint->GetMomentumDirection();
157 G4double theta = mom1.angle(mom2);
158
159
160 G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
161 if (theta > 1e-6) {
162 analysisManager->FillNtupleIColumn(1,0,ProcIndex);
163 analysisManager->FillNtupleDColumn(1,1,
164 preStepPoint->GetKineticEnergy()/CLHEP::keV);
165 analysisManager->FillNtupleDColumn(1,2,theta/CLHEP::deg);
166 analysisManager->FillNtupleDColumn(1,3,track->GetWeight());
167 analysisManager->AddNtupleRow(1);
168 }
169}
G4LogicalVolume * GetPhantom() const
void UpdateEventWeight(G4double ew)