1 | // |
---|
2 | // ******************************************************************** |
---|
3 | // * License and Disclaimer * |
---|
4 | // * * |
---|
5 | // * The Geant4 software is copyright of the Copyright Holders of * |
---|
6 | // * the Geant4 Collaboration. It is provided under the terms and * |
---|
7 | // * conditions of the Geant4 Software License, included in the file * |
---|
8 | // * LICENSE and available at http://cern.ch/geant4/license . These * |
---|
9 | // * include a list of copyright holders. * |
---|
10 | // * * |
---|
11 | // * Neither the authors of this software system, nor their employing * |
---|
12 | // * institutes,nor the agencies providing financial support for this * |
---|
13 | // * work make any representation or warranty, express or implied, * |
---|
14 | // * regarding this software system or assume any liability for its * |
---|
15 | // * use. Please see the license in the file LICENSE and URL above * |
---|
16 | // * for the full disclaimer and the limitation of liability. * |
---|
17 | // * * |
---|
18 | // * This code implementation is the result of the scientific and * |
---|
19 | // * technical work of the GEANT4 collaboration. * |
---|
20 | // * By using, copying, modifying or distributing the software (or * |
---|
21 | // * any work based on the software) you agree to acknowledge its * |
---|
22 | // * use in resulting scientific publications, and indicate your * |
---|
23 | // * acceptance of all terms of the Geant4 Software license. * |
---|
24 | // ******************************************************************** |
---|
25 | // |
---|
26 | // |
---|
27 | // $Id: G4PenelopeAnnihilationTest.cc,v 1.4 2006/06/29 19:44:14 gunter Exp $ |
---|
28 | // GEANT4 tag $Name: geant4-09-03-cand-01 $ |
---|
29 | // |
---|
30 | // ------------------------------------------------------------------- |
---|
31 | // GEANT 4 class file --- Copyright CERN 1998 |
---|
32 | // CERN Geneva Switzerland |
---|
33 | // |
---|
34 | // |
---|
35 | // File name: G4PenelopeGammaConversionTest.cc |
---|
36 | // |
---|
37 | // Author: Francesco Longo |
---|
38 | // |
---|
39 | // Creation date: 04 january 2001 |
---|
40 | // |
---|
41 | // Modifications: Luciano Pandola (03 july 2003) |
---|
42 | // Adapted in order to test G4PenelopeAnnihilationTest |
---|
43 | // Minor modification in n-tuple filling |
---|
44 | // Updated analysis to AIDA 3.0 |
---|
45 | // |
---|
46 | // ------------------------------------------------------------------- |
---|
47 | |
---|
48 | #include "globals.hh" |
---|
49 | #include "G4ios.hh" |
---|
50 | |
---|
51 | #include "G4ParticleDefinition.hh" |
---|
52 | #include "G4ParticleTypes.hh" |
---|
53 | #include "G4ParticleTable.hh" |
---|
54 | #include "G4Material.hh" |
---|
55 | #include "G4MaterialTable.hh" |
---|
56 | #include "G4VDiscreteProcess.hh" |
---|
57 | #include "G4VProcess.hh" |
---|
58 | #include "G4ProcessManager.hh" |
---|
59 | |
---|
60 | #include "G4PenelopeAnnihilation.hh" |
---|
61 | #include "G4eplusAnnihilation.hh" |
---|
62 | |
---|
63 | #include "G4EnergyLossTables.hh" |
---|
64 | #include "G4VParticleChange.hh" |
---|
65 | #include "G4ParticleChange.hh" |
---|
66 | #include "G4DynamicParticle.hh" |
---|
67 | #include "G4ForceCondition.hh" |
---|
68 | |
---|
69 | #include "G4PenelopeBremsstrahlung.hh" |
---|
70 | #include "G4PenelopeIonisation.hh" |
---|
71 | #include "G4MultipleScattering.hh" |
---|
72 | #include "G4eIonisation.hh" |
---|
73 | #include "G4eBremsstrahlung.hh" |
---|
74 | #include "G4eplusAnnihilation.hh" |
---|
75 | |
---|
76 | #include "G4ComptonScattering.hh" |
---|
77 | #include "G4PhotoElectricEffect.hh" |
---|
78 | |
---|
79 | #include "G4RunManager.hh" |
---|
80 | |
---|
81 | #include "G4Electron.hh" |
---|
82 | #include "G4Positron.hh" |
---|
83 | #include "G4Gamma.hh" |
---|
84 | |
---|
85 | #include "G4GRSVolume.hh" |
---|
86 | #include "G4Box.hh" |
---|
87 | #include "G4PVPlacement.hh" |
---|
88 | #include "G4Step.hh" |
---|
89 | #include "G4ProductionCutsTable.hh" |
---|
90 | #include "G4MaterialCutsCouple.hh" |
---|
91 | |
---|
92 | #include "G4UnitsTable.hh" |
---|
93 | #include "AIDA/IManagedObject.h" |
---|
94 | |
---|
95 | #include <memory> |
---|
96 | #include "AIDA/IAnalysisFactory.h" |
---|
97 | #include "AIDA/ITreeFactory.h" |
---|
98 | #include "AIDA/ITree.h" |
---|
99 | #include "AIDA/IHistogramFactory.h" |
---|
100 | #include "AIDA/IHistogram1D.h" |
---|
101 | #include "AIDA/IHistogram2D.h" |
---|
102 | #include "AIDA/IHistogram3D.h" |
---|
103 | #include "AIDA/ITupleFactory.h" |
---|
104 | #include "AIDA/ITuple.h" |
---|
105 | |
---|
106 | |
---|
107 | G4int main() |
---|
108 | { |
---|
109 | |
---|
110 | // Setup |
---|
111 | |
---|
112 | G4int nIterations = 100000; |
---|
113 | G4int materialId = 3; |
---|
114 | |
---|
115 | //G4cout.setf(std::ios::scientific,std::ios::floatfield ); |
---|
116 | |
---|
117 | // ------------------------------------------------------------------- |
---|
118 | |
---|
119 | // ---- HBOOK initialization |
---|
120 | |
---|
121 | std::auto_ptr< AIDA::IAnalysisFactory > af( AIDA_createAnalysisFactory() ); |
---|
122 | std::auto_ptr< AIDA::ITreeFactory > tf (af->createTreeFactory()); |
---|
123 | std::auto_ptr< AIDA::ITree > tree (tf->create("pen_ann_test.hbook","hbook",false,true)); |
---|
124 | G4cout << "Tree store: " << tree->storeName() << G4endl; |
---|
125 | std::auto_ptr< AIDA::ITupleFactory > tpf (af->createTupleFactory(*tree)); |
---|
126 | std::auto_ptr< AIDA::IHistogramFactory > hf (af->createHistogramFactory(*tree)); |
---|
127 | |
---|
128 | // ---- secondary ntuple ------ |
---|
129 | AIDA::ITuple* ntuple1 = tpf->create("1","Secondary Ntuple","double eprimary,px_1,py_1,pz_1,e_1,theta_1,px_2,py_2,pz_2,e_2,theta_2"); |
---|
130 | |
---|
131 | // ---- table ntuple ------ |
---|
132 | AIDA::ITuple* ntuple2 = tpf->create("2","Mean Free Path Ntuple","double kinen,mfp"); |
---|
133 | |
---|
134 | |
---|
135 | //--------- Materials definition --------- |
---|
136 | |
---|
137 | G4Material* Si = new G4Material("Silicon", 14., 28.055*g/mole, 2.33*g/cm3); |
---|
138 | G4Material* Fe = new G4Material("Iron", 26., 55.85*g/mole, 7.87*g/cm3); |
---|
139 | G4Material* Cu = new G4Material("Copper", 29., 63.55*g/mole, 8.96*g/cm3); |
---|
140 | G4Material* W = new G4Material("Tungsten", 74., 183.85*g/mole, 19.30*g/cm3); |
---|
141 | G4Material* Pb = new G4Material("Lead", 82., 207.19*g/mole, 11.35*g/cm3); |
---|
142 | G4Material* U = new G4Material("Uranium", 92., 238.03*g/mole, 18.95*g/cm3); |
---|
143 | |
---|
144 | G4Element* H = new G4Element ("Hydrogen", "H", 1. , 1.01*g/mole); |
---|
145 | G4Element* O = new G4Element ("Oxygen" , "O", 8. , 16.00*g/mole); |
---|
146 | G4Element* C = new G4Element ("Carbon" , "C", 6. , 12.00*g/mole); |
---|
147 | G4Element* Cs = new G4Element ("Cesium" , "Cs", 55. , 132.905*g/mole); |
---|
148 | G4Element* I = new G4Element ("Iodine" , "I", 53. , 126.9044*g/mole); |
---|
149 | |
---|
150 | G4Material* maO = new G4Material("Oxygen", 8., 16.00*g/mole, 1.1*g/cm3); |
---|
151 | |
---|
152 | G4Material* water = new G4Material ("Water" , 1.*g/cm3, 2); |
---|
153 | water->AddElement(H,2); |
---|
154 | water->AddElement(O,1); |
---|
155 | |
---|
156 | G4Material* ethane = new G4Material ("Ethane" , 0.4241*g/cm3, 2); |
---|
157 | ethane->AddElement(H,6); |
---|
158 | ethane->AddElement(C,2); |
---|
159 | |
---|
160 | G4Material* csi = new G4Material ("CsI" , 4.53*g/cm3, 2); |
---|
161 | csi->AddElement(Cs,1); |
---|
162 | csi->AddElement(I,1); |
---|
163 | |
---|
164 | |
---|
165 | // Interactive set-up |
---|
166 | |
---|
167 | G4cout << "How many interactions? " << G4endl; |
---|
168 | G4cin >> nIterations; |
---|
169 | |
---|
170 | if (nIterations <= 0) G4Exception("Wrong input"); |
---|
171 | |
---|
172 | G4double initEnergy = 1.0*MeV; |
---|
173 | G4double initX = 0.; |
---|
174 | G4double initY = 0.; |
---|
175 | G4double initZ = 1.; |
---|
176 | |
---|
177 | G4cout << "Enter the initial particle energy E (MeV)" << G4endl; |
---|
178 | G4cin >> initEnergy ; |
---|
179 | |
---|
180 | initEnergy = initEnergy*MeV; |
---|
181 | |
---|
182 | if (initEnergy < 0.) G4Exception("Wrong input"); |
---|
183 | |
---|
184 | static const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable(); |
---|
185 | |
---|
186 | G4int nMaterials = G4Material::GetNumberOfMaterials(); |
---|
187 | |
---|
188 | G4cout << "Available materials are: " << G4endl; |
---|
189 | for (G4int mat = 0; mat < nMaterials; mat++) |
---|
190 | { |
---|
191 | G4cout << mat << ") " |
---|
192 | << (*theMaterialTable)[mat]->GetName() |
---|
193 | << G4endl; |
---|
194 | } |
---|
195 | |
---|
196 | G4cout << "Which material? " << G4endl; |
---|
197 | G4cin >> materialId; |
---|
198 | |
---|
199 | G4Material* material = (*theMaterialTable)[materialId] ; |
---|
200 | |
---|
201 | G4cout << "The selected material is: " |
---|
202 | << material->GetName() |
---|
203 | << G4endl; |
---|
204 | |
---|
205 | G4double dimX = 1*mm; |
---|
206 | G4double dimY = 1*mm; |
---|
207 | G4double dimZ = 1*mm; |
---|
208 | |
---|
209 | // Geometry |
---|
210 | |
---|
211 | G4Box* theFrame = new G4Box ("Frame",dimX, dimY, dimZ); |
---|
212 | |
---|
213 | G4LogicalVolume* logicalFrame = new G4LogicalVolume(theFrame, |
---|
214 | (*theMaterialTable)[materialId], |
---|
215 | "LFrame", 0, 0, 0); |
---|
216 | logicalFrame->SetMaterial(material); |
---|
217 | |
---|
218 | G4PVPlacement* physicalFrame = new G4PVPlacement(0,G4ThreeVector(), |
---|
219 | "PFrame",logicalFrame,0,false,0); |
---|
220 | |
---|
221 | G4RunManager* rm = new G4RunManager(); |
---|
222 | G4cout << "World is defined " << G4endl; |
---|
223 | rm->GeometryHasBeenModified(); |
---|
224 | rm->DefineWorldVolume(physicalFrame); |
---|
225 | |
---|
226 | // Particle definitions |
---|
227 | |
---|
228 | G4ParticleDefinition* gamma = G4Gamma::GammaDefinition(); |
---|
229 | G4ParticleDefinition* electron = G4Electron::ElectronDefinition(); |
---|
230 | G4ParticleDefinition* positron = G4Positron::PositronDefinition(); |
---|
231 | |
---|
232 | G4ProductionCutsTable* cutsTable = G4ProductionCutsTable::GetProductionCutsTable(); |
---|
233 | G4ProductionCuts* cuts = cutsTable->GetDefaultProductionCuts(); |
---|
234 | G4double cutG=1*micrometer; |
---|
235 | G4double cutE=1*micrometer; |
---|
236 | cuts->SetProductionCut(cutG, 0); //gammas |
---|
237 | cuts->SetProductionCut(cutE, 1); //electrons |
---|
238 | cuts->SetProductionCut(cutE, 2); //positrons |
---|
239 | G4cout << "Cuts are defined " << G4endl; |
---|
240 | |
---|
241 | //G4Gamma::SetEnergyRange(2.5e-4*MeV,1e5*MeV); |
---|
242 | //G4Electron::SetEnergyRange(2.5e-4*MeV,1e5*MeV); |
---|
243 | //G4Positron::SetEnergyRange(2.5e-4*MeV,1e5*MeV); |
---|
244 | |
---|
245 | cutsTable->UpdateCoupleTable(); |
---|
246 | //cutsTable->DumpCouples(); |
---|
247 | const G4MaterialCutsCouple* theCouple = cutsTable->GetMaterialCutsCouple(material,cuts); |
---|
248 | G4int indx=theCouple->GetIndex(); |
---|
249 | |
---|
250 | // Processes |
---|
251 | |
---|
252 | |
---|
253 | G4int processType; |
---|
254 | G4cout << "Standard [1] or Penelope [2] Positron Annihilation?" << G4endl; |
---|
255 | G4cin >> processType; |
---|
256 | if ( !(processType == 1 || processType == 2)) |
---|
257 | { |
---|
258 | G4Exception("Wrong input"); |
---|
259 | } |
---|
260 | |
---|
261 | G4VProcess* positronProcess; |
---|
262 | |
---|
263 | if (processType == 1) |
---|
264 | { |
---|
265 | positronProcess = new G4eplusAnnihilation(); |
---|
266 | G4cout << "The selected model is Standard" << G4endl; |
---|
267 | } |
---|
268 | else if (processType == 2) |
---|
269 | { |
---|
270 | positronProcess = new G4PenelopeAnnihilation(); |
---|
271 | G4cout << "The selected model is Penelope" << G4endl; |
---|
272 | } |
---|
273 | |
---|
274 | G4VProcess* theeplusMultipleScattering = new G4MultipleScattering(); |
---|
275 | G4VProcess* theeplusIonisation = new G4PenelopeIonisation(); |
---|
276 | G4VProcess* theeplusBremsstrahlung = new G4PenelopeBremsstrahlung(); |
---|
277 | |
---|
278 | //---------------- |
---|
279 | // process manager |
---|
280 | //---------------- |
---|
281 | |
---|
282 | |
---|
283 | G4ForceCondition* condition; |
---|
284 | |
---|
285 | //positron |
---|
286 | |
---|
287 | G4ProcessManager* pProcessManager = new G4ProcessManager(positron); |
---|
288 | positron->SetProcessManager(pProcessManager); |
---|
289 | pProcessManager->AddProcess(positronProcess); |
---|
290 | |
---|
291 | // Create a DynamicParticle |
---|
292 | |
---|
293 | G4double eEnergy = initEnergy*MeV; |
---|
294 | G4ParticleMomentum eDirection(initX,initY,initZ); |
---|
295 | G4DynamicParticle dynamicPositron(positron,eDirection,eEnergy); |
---|
296 | |
---|
297 | dynamicPositron.DumpInfo(0); |
---|
298 | |
---|
299 | // Track |
---|
300 | |
---|
301 | G4ThreeVector aPosition(0.,0.,0.); |
---|
302 | G4double aTime = 0. ; |
---|
303 | |
---|
304 | G4Track* gTrack = new G4Track(&dynamicPositron,aTime,aPosition); |
---|
305 | |
---|
306 | G4GRSVolume* touche = new G4GRSVolume(physicalFrame, NULL, aPosition); |
---|
307 | gTrack->SetTouchableHandle(touche); //verificare!!!!!!!!!!!! |
---|
308 | |
---|
309 | |
---|
310 | // Step |
---|
311 | |
---|
312 | G4Step* step = new G4Step(); |
---|
313 | step->SetTrack(gTrack); |
---|
314 | |
---|
315 | G4StepPoint* aPoint = new G4StepPoint(); |
---|
316 | aPoint->SetPosition(aPosition); |
---|
317 | aPoint->SetMaterial(material); |
---|
318 | aPoint->SetMaterialCutsCouple(theCouple); |
---|
319 | G4double safety = 10000.*cm; |
---|
320 | aPoint->SetSafety(safety); |
---|
321 | step->SetPreStepPoint(aPoint); |
---|
322 | |
---|
323 | // Check applicability |
---|
324 | |
---|
325 | if (! (positronProcess->IsApplicable(*positron))) |
---|
326 | { |
---|
327 | G4Exception("Not Applicable"); |
---|
328 | } |
---|
329 | else |
---|
330 | { |
---|
331 | G4cout<< "applicability OK" << G4endl; |
---|
332 | } |
---|
333 | |
---|
334 | positronProcess->BuildPhysicsTable(*positron); |
---|
335 | |
---|
336 | G4cout<< "table OK" << G4endl; |
---|
337 | |
---|
338 | // Test GetMeanFreePath() |
---|
339 | // E' protected! Il membro accessibile e' DumpMeanFreePath() |
---|
340 | |
---|
341 | G4Material* apttoMaterial ; |
---|
342 | G4String MaterialName ; |
---|
343 | |
---|
344 | G4double minArg = 100*eV,maxArg = 100*GeV, argStp; |
---|
345 | const G4int pntNum = 300; |
---|
346 | G4double Tkin[pntNum+1]; |
---|
347 | G4double meanFreePath=0. ; |
---|
348 | |
---|
349 | argStp = (std::log10(maxArg)-std::log10(minArg))/pntNum; |
---|
350 | |
---|
351 | for(G4int d = 0; d < pntNum+1; d++) |
---|
352 | { |
---|
353 | Tkin[d] = std::pow(10,(std::log10(minArg) + d*argStp)); |
---|
354 | } |
---|
355 | |
---|
356 | G4double sti = 1.*mm; |
---|
357 | step->SetStepLength(sti); |
---|
358 | |
---|
359 | // for ( G4int J = 0 ; J < nMaterials ; J++ ) |
---|
360 | // { |
---|
361 | apttoMaterial = (*theMaterialTable)[materialId] ; |
---|
362 | MaterialName = apttoMaterial->GetName() ; |
---|
363 | logicalFrame->SetMaterial(apttoMaterial); |
---|
364 | |
---|
365 | gTrack->SetStep(step); |
---|
366 | |
---|
367 | G4eplusAnnihilation* positronStdProcess = |
---|
368 | (G4eplusAnnihilation*) positronProcess; |
---|
369 | G4PenelopeAnnihilation* positronPenProcess = |
---|
370 | (G4PenelopeAnnihilation*) positronProcess; |
---|
371 | |
---|
372 | for (G4int i=0 ; i<pntNum; i++) |
---|
373 | { |
---|
374 | dynamicPositron.SetKineticEnergy(Tkin[i]); |
---|
375 | if (processType == 1) |
---|
376 | { |
---|
377 | meanFreePath=positronStdProcess |
---|
378 | ->GetMeanFreePath(*gTrack, sti, condition); |
---|
379 | } |
---|
380 | else if (processType == 2) |
---|
381 | { |
---|
382 | meanFreePath=positronPenProcess |
---|
383 | ->DumpMeanFreePath(*gTrack, sti, condition); |
---|
384 | } |
---|
385 | |
---|
386 | ntuple2->fill(ntuple2->findColumn("kinen"),Tkin[i]/MeV); |
---|
387 | ntuple2->fill(ntuple2->findColumn("mfp"),meanFreePath/cm); |
---|
388 | ntuple2->addRow(); |
---|
389 | |
---|
390 | |
---|
391 | // G4cout << meanFreePath/cm << G4endl; |
---|
392 | |
---|
393 | } |
---|
394 | G4cout << "Mean Free Path OK" << G4endl; |
---|
395 | |
---|
396 | // --------- Test the DoIt |
---|
397 | |
---|
398 | G4cout << "DoIt in " << material->GetName() << G4endl; |
---|
399 | |
---|
400 | |
---|
401 | dynamicPositron.SetKineticEnergy(eEnergy); |
---|
402 | G4int iter; |
---|
403 | initEnergy += 2.0*electron_mass_c2; |
---|
404 | |
---|
405 | for (iter=0; iter<nIterations; iter++) |
---|
406 | { |
---|
407 | |
---|
408 | step->SetStepLength(1*micrometer); |
---|
409 | |
---|
410 | G4cout << "Iteration = " << iter |
---|
411 | << " - Step Length = " |
---|
412 | << step->GetStepLength()/mm << " mm " |
---|
413 | << G4endl; |
---|
414 | |
---|
415 | |
---|
416 | gTrack->SetStep(step); |
---|
417 | |
---|
418 | G4VParticleChange* dummy; |
---|
419 | |
---|
420 | G4cout << "eEnergy: " << eEnergy/MeV << " MeV" << G4endl; |
---|
421 | if (eEnergy>0.0) |
---|
422 | { |
---|
423 | dummy = positronProcess->PostStepDoIt(*gTrack, *step); |
---|
424 | G4cout << "Chiamo il Post Step " << G4endl; |
---|
425 | } |
---|
426 | else |
---|
427 | { |
---|
428 | dummy = positronProcess->AtRestDoIt(*gTrack,*step); |
---|
429 | G4cout << "Chiamo l'At Rest" << G4endl; |
---|
430 | } |
---|
431 | |
---|
432 | G4ParticleChange* particleChange = (G4ParticleChange*) dummy; |
---|
433 | |
---|
434 | // Secondaries physical quantities |
---|
435 | |
---|
436 | // Secondaries |
---|
437 | G4cout << " secondaries " << |
---|
438 | particleChange->GetNumberOfSecondaries() << G4endl; |
---|
439 | G4double px_1,py_1,pz_1,e_1,theta_1; |
---|
440 | G4double px_2,py_2,pz_2,e_2,theta_2; |
---|
441 | |
---|
442 | |
---|
443 | for (G4int i = 0; i < (particleChange->GetNumberOfSecondaries()); i++) |
---|
444 | { |
---|
445 | |
---|
446 | G4Track* finalParticle = particleChange->GetSecondary(i) ; |
---|
447 | |
---|
448 | G4double e = finalParticle->GetTotalEnergy(); |
---|
449 | G4double px = (finalParticle->GetMomentum()).x(); |
---|
450 | G4double py = (finalParticle->GetMomentum()).y(); |
---|
451 | G4double pz = (finalParticle->GetMomentum()).z(); |
---|
452 | G4double theta = (finalParticle->GetMomentum()).theta(); |
---|
453 | theta = theta/deg; //conversion in degrees |
---|
454 | if (e > initEnergy) |
---|
455 | { |
---|
456 | G4cout << "WARNING: eFinal > eInit " << G4endl; |
---|
457 | } |
---|
458 | |
---|
459 | G4String particleName = |
---|
460 | finalParticle->GetDefinition()->GetParticleName(); |
---|
461 | G4cout << "Initial energy " << eEnergy/MeV << G4endl; |
---|
462 | G4cout << "==== Final " |
---|
463 | << particleName << " " |
---|
464 | << "energy: " << e/MeV << " MeV, " |
---|
465 | << "(px,py,pz): (" |
---|
466 | << px/MeV << "," |
---|
467 | << py/MeV << "," |
---|
468 | << pz/MeV << ") MeV " |
---|
469 | << G4endl; |
---|
470 | |
---|
471 | if (particleName == "gamma") { |
---|
472 | if (i == 0) { |
---|
473 | px_1=px; |
---|
474 | py_1=py; |
---|
475 | pz_1=pz; |
---|
476 | e_1=e; |
---|
477 | theta_1=theta; |
---|
478 | } |
---|
479 | else if (i == 1) |
---|
480 | { |
---|
481 | px_2 = px; |
---|
482 | py_2 = py; |
---|
483 | pz_2 = pz; |
---|
484 | e_2 = e; |
---|
485 | theta_2 = theta; |
---|
486 | } |
---|
487 | else |
---|
488 | { |
---|
489 | G4Exception("There are more than 3 gammas?!?"); |
---|
490 | } |
---|
491 | } |
---|
492 | delete particleChange->GetSecondary(i); |
---|
493 | } |
---|
494 | |
---|
495 | // Fill the secondaries ntuple |
---|
496 | |
---|
497 | // Normalize all to the energy of primary |
---|
498 | // for gammas initEnergy=initP |
---|
499 | ntuple1->fill(ntuple1->findColumn("eprimary"),eEnergy); |
---|
500 | ntuple1->fill(ntuple1->findColumn("px_1"),px_1/initEnergy); |
---|
501 | ntuple1->fill(ntuple1->findColumn("py_1"),py_1/initEnergy); |
---|
502 | ntuple1->fill(ntuple1->findColumn("pz_1"),pz_1/initEnergy); |
---|
503 | ntuple1->fill(ntuple1->findColumn("e_1"),e_1/initEnergy); |
---|
504 | ntuple1->fill(ntuple1->findColumn("theta_1"),theta_1); |
---|
505 | ntuple1->fill(ntuple1->findColumn("px_2"),px_2/initEnergy); |
---|
506 | ntuple1->fill(ntuple1->findColumn("py_2"),py_2/initEnergy); |
---|
507 | ntuple1->fill(ntuple1->findColumn("pz_2"),pz_2/initEnergy); |
---|
508 | ntuple1->fill(ntuple1->findColumn("e_2"),e_2/initEnergy); |
---|
509 | ntuple1->fill(ntuple1->findColumn("theta_2"),theta_2); |
---|
510 | ntuple1->addRow(); |
---|
511 | particleChange->Clear(); |
---|
512 | |
---|
513 | } |
---|
514 | |
---|
515 | |
---|
516 | G4cout << "Iteration number: " << iter << G4endl; |
---|
517 | |
---|
518 | G4cout << "Committing.............." << G4endl; |
---|
519 | tree->commit(); |
---|
520 | G4cout << "Closing the tree........" << G4endl; |
---|
521 | tree->close(); |
---|
522 | |
---|
523 | delete step; |
---|
524 | |
---|
525 | |
---|
526 | G4cout << "END OF THE MAIN PROGRAM" << G4endl; |
---|
527 | return 0; |
---|
528 | } |
---|
529 | |
---|
530 | |
---|
531 | |
---|
532 | |
---|
533 | |
---|
534 | |
---|
535 | |
---|
536 | |
---|
537 | |
---|
538 | |
---|
539 | |
---|
540 | |
---|
541 | |
---|
542 | |
---|
543 | |
---|
544 | |
---|
545 | |
---|