source: trunk/examples/advanced/medical_linac/src/MedLinacEventAction.cc@ 809

Last change on this file since 809 was 807, checked in by garnier, 17 years ago

update

File size: 3.2 KB
Line 
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// $Id: MedLinacEventAction.cc,v 1.5 2006/06/29 16:04:23 gunter Exp $
27//
28//
29// Code developed by: M. Piergentili
30//
31
32#include "MedLinacEventAction.hh"
33#include "MedLinacPhantomHit.hh"
34#include "MedLinacPhantomSD.hh"
35#include "MedLinacDetectorConstruction.hh"
36#include "G4Event.hh"
37#include "G4EventManager.hh"
38#include "G4HCofThisEvent.hh"
39#include "G4VHitsCollection.hh"
40#include "G4TrajectoryContainer.hh"
41#include "G4Trajectory.hh"
42#include "G4VVisManager.hh"
43#include "G4SDManager.hh"
44#include "G4UImanager.hh"
45#include "G4ios.hh"
46
47#ifdef G4ANALYSIS_USE
48#include"MedLinacAnalysisManager.hh"
49#endif
50
51
52 // Retrieve information about the energy deposit in the phantom ...
53
54MedLinacEventAction::MedLinacEventAction() :
55 drawFlag("all" )
56{
57 }
58
59
60MedLinacEventAction::~MedLinacEventAction()
61{
62 }
63
64void MedLinacEventAction::BeginOfEventAction(const G4Event*)
65{
66}
67
68
69void MedLinacEventAction::EndOfEventAction(const G4Event* evt)
70{
71 // extract the trajectories and draw them ...
72
73 if (G4VVisManager::GetConcreteInstance())
74 {
75 G4TrajectoryContainer * trajectoryContainer = evt->GetTrajectoryContainer();
76 G4int n_trajectories = 0;
77 if (trajectoryContainer) n_trajectories = trajectoryContainer->entries();
78
79 for (G4int i=0; i<n_trajectories; i++)
80 {
81 G4Trajectory* trj = (G4Trajectory*)
82 ((*(evt->GetTrajectoryContainer()))[i]);
83 if(drawFlag == "all") trj->DrawTrajectory(50);
84 else if((drawFlag == "charged")&&(trj->GetCharge() != 0.))
85 trj->DrawTrajectory(50);
86 else if ((drawFlag == "neutral")&&(trj->GetCharge() == 0.))
87 trj->DrawTrajectory(50);
88 }
89 }
90 }
91
92
93
94
Note: See TracBrowser for help on using the repository browser.