Ignore:
Timestamp:
Jun 14, 2010, 3:54:58 PM (14 years ago)
Author:
garnier
Message:

geant4.9.4 beta rc0

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/examples/advanced/hadrontherapy/src/HadrontherapyEventAction.cc

    r1230 r1313  
    2424// ********************************************************************
    2525//
    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// --------------------------------------------------------------
    2943#include "G4Event.hh"
    3044#include "G4EventManager.hh"
    3145#include "G4HCofThisEvent.hh"
    3246#include "G4VHitsCollection.hh"
    33 #include "G4TrajectoryContainer.hh"
    34 #include "G4Trajectory.hh"
    35 #include "G4VVisManager.hh"
    3647#include "G4SDManager.hh"
    3748#include "G4VVisManager.hh"
     49
    3850#include "HadrontherapyEventAction.hh"
    3951#include "HadrontherapyDetectorHit.hh"
     
    6476  //printing survey
    6577  if (evtNb%printModulo == 0)
    66     G4cout << "\n---> Begin of Event: " << evtNb << G4endl;
     78     G4cout << "\n---> Begin of Event: " << evtNb << G4endl;
    6779   
    6880  G4SDManager* pSDManager = G4SDManager::GetSDMpointer();
    6981  if(hitsCollectionID == -1)
    7082    hitsCollectionID = pSDManager -> GetCollectionID("HadrontherapyDetectorHitsCollection");
     83 
    7184}
    7285
    7386/////////////////////////////////////////////////////////////////////////////
    7487void HadrontherapyEventAction::EndOfEventAction(const G4Event* evt)
    75 {  
     88{
    7689  if(hitsCollectionID < 0)
    7790  return;
    7891  G4HCofThisEvent* HCE = evt -> GetHCofThisEvent();
    79  
     92
     93  // Clear voxels hit list
     94  HadrontherapyMatrix* matrix = HadrontherapyMatrix::GetInstance();
     95  if (matrix) matrix -> ClearHitTrack();
     96
    8097  if(HCE)
    8198  {
     
    83100    if(CHC)
    84101     {
    85            matrix = HadrontherapyMatrix::getInstance(); 
    86102       if(matrix)
    87103          {
     
    101117    }
    102118  }
    103   // Extract the trajectories and draw them in the visualisation
    104 
    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     }
    122119}
    123120
Note: See TracChangeset for help on using the changeset viewer.