Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer << 3 // * DISCLAIMER * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th << 5 // * The following disclaimer summarizes all the specific disclaimers * 6 // * the Geant4 Collaboration. It is provided << 6 // * of contributors to this software. The specific disclaimers,which * 7 // * conditions of the Geant4 Software License << 7 // * govern, are listed with their locations in: * 8 // * LICENSE and available at http://cern.ch/ << 8 // * http://cern.ch/geant4/license * 9 // * include a list of copyright holders. << 10 // * 9 // * * 11 // * Neither the authors of this software syst 10 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 11 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 12 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 13 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file << 14 // * use. * 16 // * for the full disclaimer and the limitatio << 17 // * 15 // * * 18 // * This code implementation is the result << 16 // * This code implementation is the intellectual property of the * 19 // * technical work of the GEANT4 collaboratio << 17 // * GEANT4 collaboration. * 20 // * By using, copying, modifying or distri << 18 // * By copying, distributing or modifying the Program (or any work * 21 // * any work based on the software) you ag << 19 // * based on the Program) you indicate your acceptance of this * 22 // * use in resulting scientific publicati << 20 // * statement, and all its terms. * 23 // * acceptance of all terms of the Geant4 Sof << 24 // ******************************************* 21 // ******************************************************************** 25 // 22 // 26 /// \file electromagnetic/TestEm1/src/EventAct << 27 /// \brief Implementation of the EventAction c << 28 // 23 // >> 24 // $Id: EventAction.cc,v 1.3 2004/03/15 11:09:36 maire Exp $ >> 25 // GEANT4 tag $Name: geant4-07-00-patch-01 $ 29 // 26 // >> 27 // 30 28 31 //....oooOO0OOooo........oooOO0OOooo........oo 29 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 32 //....oooOO0OOooo........oooOO0OOooo........oo 30 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 33 31 34 #include "EventAction.hh" 32 #include "EventAction.hh" 35 33 36 #include "HistoManager.hh" << 34 #include "EventActionMessenger.hh" 37 #include "Run.hh" << 38 35 39 #include "G4Event.hh" 36 #include "G4Event.hh" 40 #include "G4RunManager.hh" << 37 #include "G4TrajectoryContainer.hh" >> 38 #include "G4Trajectory.hh" >> 39 #include "G4VVisManager.hh" 41 #include "G4UnitsTable.hh" 40 #include "G4UnitsTable.hh" 42 41 43 //....oooOO0OOooo........oooOO0OOooo........oo 42 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 44 43 45 void EventAction::BeginOfEventAction(const G4E << 44 EventAction::EventAction() >> 45 :drawFlag("none"),printModulo(10000),eventMessenger(0) 46 { 46 { 47 fTotalEnergyDeposit = 0.; << 47 eventMessenger = new EventActionMessenger(this); 48 fNIEL = 0.; << 49 fEnergyLeak = 0.; << 50 } 48 } 51 49 52 //....oooOO0OOooo........oooOO0OOooo........oo 50 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 53 51 54 void EventAction::EndOfEventAction(const G4Eve << 52 EventAction::~EventAction() 55 { 53 { 56 //get Run << 54 delete eventMessenger; 57 Run* run = static_cast<Run*>( << 58 G4RunManager::GetRunManager()->Ge << 59 if (fEnergyLeak > 0.) run->AddEleak(fEnergyL << 60 << 61 G4AnalysisManager::Instance()->FillH1(4, fTo << 62 G4AnalysisManager::Instance()->FillH1(7, fNI << 63 G4AnalysisManager::Instance()->FillH1(8, fEn << 64 G4AnalysisManager::Instance()->FillH1(9, fTo << 65 } 55 } 66 56 67 //....oooOO0OOooo........oooOO0OOooo........oo 57 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 58 >> 59 void EventAction::BeginOfEventAction(const G4Event* evt) >> 60 { >> 61 G4int evtNb = evt->GetEventID(); >> 62 >> 63 //printing survey >> 64 if (evtNb%printModulo == 0) >> 65 G4cout << "\n---> Begin of Event: " << evtNb << G4endl; >> 66 >> 67 //additional initializations >> 68 TotalEnergyDeposit = 0.; >> 69 } >> 70 >> 71 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 72 >> 73 void EventAction::EndOfEventAction(const G4Event* evt) >> 74 { >> 75 if (drawFlag != "none") G4cout << " Energy deposit: " >> 76 << G4BestUnit(TotalEnergyDeposit,"Energy") >> 77 << G4endl; >> 78 >> 79 if (G4VVisManager::GetConcreteInstance()) >> 80 { >> 81 G4TrajectoryContainer* trajectoryContainer = evt->GetTrajectoryContainer(); >> 82 G4int n_trajectories = 0; >> 83 if (trajectoryContainer) n_trajectories = trajectoryContainer->entries(); >> 84 for(G4int i=0; i<n_trajectories; i++) >> 85 { G4Trajectory* trj = (G4Trajectory*) >> 86 ((*(evt->GetTrajectoryContainer()))[i]); >> 87 if (drawFlag == "all") trj->DrawTrajectory(1000); >> 88 else if ((drawFlag == "charged")&&(trj->GetCharge() != 0.)) >> 89 trj->DrawTrajectory(1000); >> 90 } >> 91 } >> 92 } >> 93 >> 94 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 95 >> 96 68 97