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/TestEm12/src/EventAc << 23 // $Id: EventAction.cc,v 1.1 2005/07/22 11:08:48 maire Exp $ 27 /// \brief Implementation of the EventAction c << 24 // GEANT4 tag $Name: geant4-08-00 $ 28 // << 29 // 25 // 30 //....oooOO0OOooo........oooOO0OOooo........oo 26 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 31 //....oooOO0OOooo........oooOO0OOooo........oo 27 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 32 28 33 #include "EventAction.hh" 29 #include "EventAction.hh" 34 30 >> 31 #include "RunAction.hh" >> 32 #include "EventActionMessenger.hh" 35 #include "HistoManager.hh" 33 #include "HistoManager.hh" 36 #include "Run.hh" << 37 34 38 #include "G4RunManager.hh" << 35 #include "G4Event.hh" >> 36 #include "G4TrajectoryContainer.hh" >> 37 #include "G4Trajectory.hh" >> 38 #include "G4VVisManager.hh" >> 39 >> 40 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 41 >> 42 EventAction::EventAction(RunAction* run, HistoManager* histo) >> 43 :runAct(run), drawFlag("none"), printModulo(10000), histoManager(histo) >> 44 { >> 45 eventMessenger = new EventActionMessenger(this); >> 46 } 39 47 40 //....oooOO0OOooo........oooOO0OOooo........oo 48 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 41 49 42 void EventAction::BeginOfEventAction(const G4E << 50 EventAction::~EventAction() 43 { 51 { 44 // energy deposited per event << 52 delete eventMessenger; 45 fTotalEdep = 0.; << 46 } 53 } 47 54 48 //....oooOO0OOooo........oooOO0OOooo........oo 55 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 49 56 50 void EventAction::EndOfEventAction(const G4Eve << 57 void EventAction::BeginOfEventAction(const G4Event* evt) 51 { 58 { 52 // plot energy deposited per event << 59 G4int evtNb = evt->GetEventID(); >> 60 >> 61 //printing survey >> 62 if (evtNb%printModulo == 0) >> 63 G4cout << "\n---> Begin of Event: " << evtNb << G4endl; >> 64 >> 65 //energy deposited per event >> 66 totalEdep = 0.; >> 67 } >> 68 >> 69 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 70 >> 71 void EventAction::EndOfEventAction(const G4Event* evt) >> 72 { >> 73 //plot energy deposited per event 53 // 74 // 54 if (fTotalEdep > 0.) { << 75 if (totalEdep > 0.) { 55 Run* run = static_cast<Run*>(G4RunManager: << 76 runAct->AddEdep(totalEdep); 56 run->AddEdep(fTotalEdep); << 77 histoManager->FillHisto(2,totalEdep); 57 G4AnalysisManager* analysisManager = G4Ana << 78 } 58 analysisManager->FillH1(2, fTotalEdep); << 79 >> 80 //trajectories >> 81 // >> 82 if (G4VVisManager::GetConcreteInstance()) >> 83 { >> 84 G4TrajectoryContainer* trajectoryContainer = evt->GetTrajectoryContainer(); >> 85 G4int n_trajectories = 0; >> 86 if (trajectoryContainer) n_trajectories = trajectoryContainer->entries(); >> 87 for(G4int i=0; i<n_trajectories; i++) >> 88 { G4Trajectory* trj = (G4Trajectory*) >> 89 ((*(evt->GetTrajectoryContainer()))[i]); >> 90 if (drawFlag == "all") trj->DrawTrajectory(1000); >> 91 else if ((drawFlag == "charged")&&(trj->GetCharge() != 0.)) >> 92 trj->DrawTrajectory(1000); >> 93 } 59 } 94 } 60 } 95 } 61 96 62 //....oooOO0OOooo........oooOO0OOooo........oo 97 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 98 >> 99 63 100