Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
WLSEventAction.cc
Go to the documentation of this file.
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 // $Id: WLSEventAction.cc 90240 2015-05-21 09:08:13Z gcosmo $
27 //
30 //
31 //
32 #include "WLSEventAction.hh"
33 
34 #include "WLSRunAction.hh"
35 
37 
38 #include "WLSPhotonDetHit.hh"
39 
40 #include "G4Event.hh"
41 #include "G4EventManager.hh"
42 #include "WLSTrajectory.hh"
43 #include "G4TrajectoryContainer.hh"
44 #include "G4VVisManager.hh"
45 #include "G4SDManager.hh"
46 
47 #include "Randomize.hh"
48 
49 // Purpose: Accumulates statistics regarding hits
50 // in the PhotonDet detector
51 
52 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
53 
55  : fRunAction(runaction), fVerboseLevel(0)
56 {
57  fMPPCCollID = 0;
58 
59  fEventMessenger = new WLSEventActionMessenger(this);
60 }
61 
62 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
63 
65 {
66  delete fEventMessenger;
67 }
68 
69 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
70 
72 {
73  G4int evtNb = evt->GetEventID();
74 
75  if(fVerboseLevel>0)
76  G4cout << "<<< Event " << evtNb << " started." << G4endl;
77 }
78 
79 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
80 
81 #include "G4Threading.hh"
82 
84 {
85  if (fVerboseLevel>0)
86  G4cout << "<<< Event " << evt->GetEventID() << " ended." << G4endl;
87 
88  if (fRunAction->GetRndmFreq() == 2)
89  {
90  std::ostringstream os;
91  os<<"endOfEvent_"<<G4Threading::G4GetThreadId()<<".rndm";
92  G4Random::saveEngineStatus(os.str().c_str());
93  }
94 
95  // Get Hits from the detector if any
97  G4String colName = "PhotonDetHitCollection";
98  fMPPCCollID = SDman->GetCollectionID(colName);
99 
100  G4HCofThisEvent* HCE = evt->GetHCofThisEvent();
101  WLSPhotonDetHitsCollection* mppcHC = 0;
102 
103  // Get the hit collections
104  if (HCE)
105  {
106  if (fMPPCCollID>=0) mppcHC =
107  (WLSPhotonDetHitsCollection*)(HCE->GetHC(fMPPCCollID));
108  }
109 
110  // Get hit information about photons that reached the detector in this event
111  if (mppcHC)
112  {
113 // G4int n_hit = mppcHC->entries();
114  }
115 }
116 
117 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
118 
120 {
122 }
123 
124 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
125 
127 {
128  fVerboseLevel = level;
129 }
void SetEventVerbose(G4int)
virtual ~WLSEventAction()
G4VHitsCollection * GetHC(G4int i)
G4int GetCollectionID(G4String colName)
Definition: G4SDManager.cc:135
WLSEventAction(WLSRunAction *)
virtual void EndOfEventAction(const G4Event *)
Definition of the WLSPhotonDetHit class.
G4EventManager * fpEventManager
int G4int
Definition: G4Types.hh:78
Definition of the WLSEventActionMessenger class.
G4int GetEventID() const
Definition: G4Event.hh:151
G4GLOB_DLL std::ostream G4cout
Definition of the WLSRunAction class.
virtual void BeginOfEventAction(const G4Event *)
Definition of the WLSTrajectory class.
G4int GetRndmFreq()
Definition: WLSRunAction.hh:59
static G4SDManager * GetSDMpointer()
Definition: G4SDManager.cc:40
#define G4endl
Definition: G4ios.hh:61
Definition of the WLSEventAction class.
G4HCofThisEvent * GetHCofThisEvent() const
Definition: G4Event.hh:185
const G4Event * GetConstCurrentEvent()
G4int G4GetThreadId()
Definition: G4Threading.cc:144