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/HadrontherapyRunAction.cc

    r1230 r1313  
    2727// See more at: http://g4advancedexamples.lngs.infn.it/Examples/hadrontherapy
    2828
     29
    2930#include "HadrontherapyRunAction.hh"
    3031#include "HadrontherapyEventAction.hh"
     
    3839#include "HadrontherapyRunAction.hh"
    3940
     41
     42#include "HadrontherapyAnalysisManager.hh"
     43#include "HadrontherapyMatrix.hh"
     44
    4045HadrontherapyRunAction::HadrontherapyRunAction()
    4146{
     
    4853void HadrontherapyRunAction::BeginOfRunAction(const G4Run* aRun)
    4954{       
    50    G4RunManager::GetRunManager()->SetRandomNumberStore(true);
    51    G4cout << "Run " << aRun -> GetRunID() << " starts ..." << G4endl;
     55    G4RunManager::GetRunManager()-> SetRandomNumberStore(true);
     56    G4cout << "Run " << aRun -> GetRunID() << " starts ..." << G4endl;
    5257
    53    electromagnetic = 0;
    54    hadronic = 0;
     58    // Warning! any beamOn will reset all data (dose, fluence, histograms, etc)!
     59    //
     60
     61    // Initialize matrix with energy of primaries clearing data inside
     62    if (HadrontherapyMatrix::GetInstance())
     63    {
     64        HadrontherapyMatrix::GetInstance() -> Initialize();
     65    }
     66
     67#ifdef G4ANALYSIS_USE_ROOT
     68    HadrontherapyAnalysisManager::GetInstance() -> flush();     // Finalize the root file
     69    // Initialize root analysis ----> book
     70    HadrontherapyAnalysisManager::GetInstance() -> book();
     71#endif
     72    electromagnetic = 0;
     73    hadronic = 0;
    5574}
    5675
    5776void HadrontherapyRunAction::EndOfRunAction(const G4Run*)
    5877{
    59   //   G4cout << " Summary of Run " << aRun -> GetRunID() <<" :"<< G4endl;
    60   //G4cout << "Number of electromagnetic processes of primary particles in the phantom:"
    61   //     << electromagnetic << G4endl;
    62   //G4cout << "Number of hadronic processes of primary particles in the phantom:"
    63   //     << hadronic << G4endl;
     78    // Store dose & fluence data to ASCII & ROOT files
     79    if ( HadrontherapyMatrix::GetInstance() )
     80    {
     81        HadrontherapyMatrix::GetInstance() -> TotalEnergyDeposit();
     82        HadrontherapyMatrix::GetInstance() -> StoreDoseFluenceAscii();
     83
     84#ifdef G4ANALYSIS_USE_ROOT
     85        if (HadrontherapyAnalysisManager::GetInstance())
     86        {
     87            HadrontherapyMatrix::GetInstance() -> StoreDoseFluenceRoot();
     88        }
     89#endif
     90    }
     91
     92    //G4cout << " Summary of Run " << aRun -> GetRunID() <<" :"<< G4endl;
     93    //G4cout << "Number of electromagnetic processes of primary particles in the phantom:"
     94    //     << electromagnetic << G4endl;
     95    //G4cout << "Number of hadronic processes of primary particles in the phantom:"
     96    //     << hadronic << G4endl;
    6497}
    6598void HadrontherapyRunAction::AddEMProcess()
     
    72105}
    73106
    74 
    75 
Note: See TracChangeset for help on using the changeset viewer.