| [807] | 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 | //
|
|---|
| [1337] | 27 | // $Id: F01EventAction.cc,v 1.7 2010/06/06 04:55:22 perl Exp $
|
|---|
| 28 | // GEANT4 tag $Name: geant4-09-04-beta-01 $
|
|---|
| [807] | 29 | //
|
|---|
| 30 | //
|
|---|
| 31 |
|
|---|
| 32 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
|---|
| 33 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
|---|
| 34 |
|
|---|
| 35 | #include "F01EventAction.hh"
|
|---|
| 36 |
|
|---|
| 37 | #include "F01RunAction.hh"
|
|---|
| 38 |
|
|---|
| 39 | #include "F01CalorHit.hh"
|
|---|
| 40 | #include "F01EventActionMessenger.hh"
|
|---|
| 41 |
|
|---|
| 42 | #include "G4Event.hh"
|
|---|
| 43 | #include "G4EventManager.hh"
|
|---|
| 44 | #include "G4HCofThisEvent.hh"
|
|---|
| 45 | #include "G4VHitsCollection.hh"
|
|---|
| 46 | #include "G4SDManager.hh"
|
|---|
| 47 | #include "G4ios.hh"
|
|---|
| 48 | #include "G4UnitsTable.hh"
|
|---|
| 49 | #include "Randomize.hh"
|
|---|
| 50 |
|
|---|
| 51 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
|---|
| 52 |
|
|---|
| 53 | F01EventAction::F01EventAction(F01RunAction* F01RA)
|
|---|
| 54 | : calorimeterCollID(-1), eventMessenger(0),
|
|---|
| 55 | runaction(F01RA), verboselevel(0),
|
|---|
| 56 | drawFlag("all"), printModulo(10000)
|
|---|
| 57 | {
|
|---|
| 58 | eventMessenger = new F01EventActionMessenger(this);
|
|---|
| 59 | }
|
|---|
| 60 |
|
|---|
| 61 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
|---|
| 62 |
|
|---|
| 63 | F01EventAction::~F01EventAction()
|
|---|
| 64 | {
|
|---|
| 65 | delete eventMessenger;
|
|---|
| 66 | }
|
|---|
| 67 |
|
|---|
| 68 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
|---|
| 69 |
|
|---|
| 70 | void F01EventAction::BeginOfEventAction(const G4Event* evt)
|
|---|
| 71 | {
|
|---|
| 72 | G4int evtNb = evt->GetEventID();
|
|---|
| 73 | if (evtNb%printModulo == 0)
|
|---|
| 74 | G4cout << "\n---> Begin of Event: " << evtNb << G4endl;
|
|---|
| 75 |
|
|---|
| 76 | if(verboselevel>1)
|
|---|
| 77 | G4cout << "<<< Event " << evtNb << " started." << G4endl;
|
|---|
| 78 |
|
|---|
| 79 | if (calorimeterCollID==-1)
|
|---|
| 80 | {
|
|---|
| 81 | G4SDManager * SDman = G4SDManager::GetSDMpointer();
|
|---|
| 82 | calorimeterCollID = SDman->GetCollectionID("CalCollection");
|
|---|
| 83 | }
|
|---|
| 84 | }
|
|---|
| 85 |
|
|---|
| 86 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
|---|
| 87 |
|
|---|
| 88 | void F01EventAction::EndOfEventAction(const G4Event* evt)
|
|---|
| 89 | {
|
|---|
| 90 | if(verboselevel>0)
|
|---|
| 91 | G4cout << "<<< Event " << evt->GetEventID() << " ended." << G4endl;
|
|---|
| 92 |
|
|---|
| 93 |
|
|---|
| 94 | //save rndm status
|
|---|
| 95 | if (runaction->GetRndmFreq() == 2)
|
|---|
| 96 | {
|
|---|
| 97 | CLHEP::HepRandom::saveEngineStatus("endOfEvent.rndm");
|
|---|
| 98 | G4int evtNb = evt->GetEventID();
|
|---|
| 99 | if (evtNb%printModulo == 0)
|
|---|
| 100 | {
|
|---|
| 101 | G4cout << "\n---> End of Event: " << evtNb << G4endl;
|
|---|
| 102 | CLHEP::HepRandom::showEngineStatus();
|
|---|
| 103 | }
|
|---|
| 104 | }
|
|---|
| 105 | }
|
|---|
| 106 |
|
|---|
| 107 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
|---|
| 108 |
|
|---|
| 109 | G4int F01EventAction::GetEventno()
|
|---|
| 110 | {
|
|---|
| 111 | G4int evno = fpEventManager->GetConstCurrentEvent()->GetEventID() ;
|
|---|
| 112 | return evno ;
|
|---|
| 113 | }
|
|---|
| 114 |
|
|---|
| 115 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
|---|
| 116 |
|
|---|
| 117 | void F01EventAction::setEventVerbose(G4int level)
|
|---|
| 118 | {
|
|---|
| 119 | verboselevel = level ;
|
|---|
| 120 | }
|
|---|
| 121 |
|
|---|
| 122 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
|---|