- Timestamp:
- Jun 14, 2010, 3:54:58 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/examples/advanced/hadrontherapy/src/HadrontherapyEventAction.cc
r1230 r1313 24 24 // ******************************************************************** 25 25 // 26 // $Id: HadrontherapyEventAction.cc; 27 // See more at: http://g4advancedexamples.lngs.infn.it/Examples/hadrontherapy 28 26 // $Id: HadrontherapyEventAction.cc; 27 // 28 // See more at: http://workgroup.lngs.infn.it/geant4lns 29 // 30 // ---------------------------------------------------------------------------- 31 // GEANT 4 - Hadrontherapy example 32 // ---------------------------------------------------------------------------- 33 // Code developed by: 34 // 35 // G.A.P. Cirrone(a)*, G. Candiano, F. Di Rosa(a), S. Guatelli(b), G. Russo(a) 36 // 37 // (a) Laboratori Nazionali del Sud 38 // of the National Institute for Nuclear Physics, Catania, Italy 39 // (b) National Institute for Nuclear Physics Section of Genova, genova, Italy 40 // 41 // * cirrone@lns.infn.it 42 // -------------------------------------------------------------- 29 43 #include "G4Event.hh" 30 44 #include "G4EventManager.hh" 31 45 #include "G4HCofThisEvent.hh" 32 46 #include "G4VHitsCollection.hh" 33 #include "G4TrajectoryContainer.hh"34 #include "G4Trajectory.hh"35 #include "G4VVisManager.hh"36 47 #include "G4SDManager.hh" 37 48 #include "G4VVisManager.hh" 49 38 50 #include "HadrontherapyEventAction.hh" 39 51 #include "HadrontherapyDetectorHit.hh" … … 64 76 //printing survey 65 77 if (evtNb%printModulo == 0) 66 G4cout << "\n---> Begin of Event: " << evtNb << G4endl;78 G4cout << "\n---> Begin of Event: " << evtNb << G4endl; 67 79 68 80 G4SDManager* pSDManager = G4SDManager::GetSDMpointer(); 69 81 if(hitsCollectionID == -1) 70 82 hitsCollectionID = pSDManager -> GetCollectionID("HadrontherapyDetectorHitsCollection"); 83 71 84 } 72 85 73 86 ///////////////////////////////////////////////////////////////////////////// 74 87 void HadrontherapyEventAction::EndOfEventAction(const G4Event* evt) 75 { 88 { 76 89 if(hitsCollectionID < 0) 77 90 return; 78 91 G4HCofThisEvent* HCE = evt -> GetHCofThisEvent(); 79 92 93 // Clear voxels hit list 94 HadrontherapyMatrix* matrix = HadrontherapyMatrix::GetInstance(); 95 if (matrix) matrix -> ClearHitTrack(); 96 80 97 if(HCE) 81 98 { … … 83 100 if(CHC) 84 101 { 85 matrix = HadrontherapyMatrix::getInstance();86 102 if(matrix) 87 103 { … … 101 117 } 102 118 } 103 // Extract the trajectories and draw them in the visualisation104 105 if (G4VVisManager::GetConcreteInstance())106 {107 G4TrajectoryContainer * trajectoryContainer = evt -> GetTrajectoryContainer();108 G4int n_trajectories = 0;109 if (trajectoryContainer) n_trajectories = trajectoryContainer -> entries();110 111 for (G4int i = 0; i < n_trajectories; i++)112 {113 G4Trajectory* trj = (G4Trajectory*)114 ((*(evt -> GetTrajectoryContainer()))[i]);115 if(drawFlag == "all") trj -> DrawTrajectory(50);116 else if((drawFlag == "charged")&&(trj -> GetCharge() != 0.))117 trj -> DrawTrajectory(50);118 else if ((drawFlag == "neutral")&&(trj -> GetCharge() == 0.))119 trj -> DrawTrajectory(50);120 }121 }122 119 } 123 120
Note: See TracChangeset
for help on using the changeset viewer.