| [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 | //
|
|---|
| 27 | // $Id: PhotInEventAction.cc,v 1.6 2006/06/29 16:25:13 gunter Exp $
|
|---|
| 28 | // GEANT4 tag $Name: $
|
|---|
| 29 | //
|
|---|
| 30 |
|
|---|
| 31 | //#define debug
|
|---|
| 32 |
|
|---|
| 33 | #include "PhotInEventAction.hh"
|
|---|
| 34 |
|
|---|
| 35 | G4int PhotInEventAction::verboseLevel=0;
|
|---|
| 36 |
|
|---|
| 37 | PhotInEventAction::PhotInEventAction()
|
|---|
| 38 | {
|
|---|
| 39 | #ifdef debug
|
|---|
| 40 | G4cout<<"PhotInEventAction::Constructor is called"<<G4endl;
|
|---|
| 41 | #endif
|
|---|
| 42 | for(G4int i=0; i<PhotInDiNSections; i++) calorimeterCollID[i] = -1; // Reset CalorCollect
|
|---|
| 43 | }
|
|---|
| 44 |
|
|---|
| 45 | PhotInEventAction::~PhotInEventAction(){}
|
|---|
| 46 |
|
|---|
| 47 | void PhotInEventAction::BeginOfEventAction(const G4Event*)
|
|---|
| 48 | {
|
|---|
| 49 | for(G4int i=0; i<PhotInDiNSections; i++)
|
|---|
| 50 | {
|
|---|
| 51 | if(calorimeterCollID[i]==-1) // Name the unnamed CalorimeterCollections in the Begining
|
|---|
| 52 | {
|
|---|
| 53 | G4String colName=PhotInColNms[i];
|
|---|
| 54 | #ifdef debug
|
|---|
| 55 | G4cout<<"PhotInEventAction::BeginOfEventAction:Col#"<<i<<",create="<<colName<<G4endl;
|
|---|
| 56 | #endif
|
|---|
| 57 | calorimeterCollID[i] = G4SDManager::GetSDMpointer()->GetCollectionID(colName);
|
|---|
| 58 | }
|
|---|
| 59 | }
|
|---|
| 60 | #ifdef debug
|
|---|
| 61 | G4cout<<"PhotInEventAction::BeginOfEventAction: End of Begin"<<G4endl;
|
|---|
| 62 | #endif
|
|---|
| 63 | }
|
|---|
| 64 |
|
|---|
| 65 | void PhotInEventAction::EndOfEventAction(const G4Event* evt)
|
|---|
| 66 | {
|
|---|
| 67 | #ifdef debug
|
|---|
| 68 | G4cerr<<"PhotInEventAction::EndOfEventAction: is called"<<G4endl;
|
|---|
| 69 | #endif
|
|---|
| 70 | if(verboseLevel==0) return; // Report of the Collection made in SD during this Event
|
|---|
| 71 | if(evt->GetEventID()>4 && (evt->GetEventID())%10>(verboseLevel-1)) return; // Only first
|
|---|
| 72 |
|
|---|
| 73 | G4HCofThisEvent* HCE = evt->GetHCofThisEvent();
|
|---|
| 74 | if(!HCE) return; // There is no collected information for this Event
|
|---|
| 75 | #ifdef debug
|
|---|
| 76 | G4cerr<<"PhotInEventAction::EndOfEventAction:(HCE#0), Event="<<evt->GetEventID()<<G4endl;
|
|---|
| 77 | #endif
|
|---|
| 78 | PhotInCalorHitsCollection* CHC = 0;
|
|---|
| 79 | for(G4int i=0; i<PhotInDiNSections; i++) // Make final sums for each collection and print
|
|---|
| 80 | {
|
|---|
| 81 | G4double totE=0.;
|
|---|
| 82 | G4double totL=0.;
|
|---|
| 83 | G4int nStep=0;
|
|---|
| 84 |
|
|---|
| 85 | if (HCE) CHC = (PhotInCalorHitsCollection*)(HCE->GetHC(calorimeterCollID[i]));
|
|---|
| 86 | if (CHC)
|
|---|
| 87 | {
|
|---|
| 88 | G4int nHit = CHC->entries();
|
|---|
| 89 | for (G4int ii=0; ii<nHit; ii++)
|
|---|
| 90 | {
|
|---|
| 91 | totE += (*CHC)[ii]->GetEDepos();
|
|---|
| 92 | totL += (*CHC)[ii]->GetTrackL();
|
|---|
| 93 | nStep += (*CHC)[ii]->GetNSteps();
|
|---|
| 94 | }
|
|---|
| 95 | }
|
|---|
| 96 | G4cout<<PhotInColNms[i]<<" : "<<G4endl;
|
|---|
| 97 | G4cout<<" total energy deposition : "<<std::setw(7)<<G4BestUnit(totE,"Energy")<<G4endl;
|
|---|
| 98 | // @@ Change after modification of PhotInStackingAction
|
|---|
| 99 | //G4cout<<" number of particles generated :"<<G4endl
|
|---|
| 100 | // <<" gamma "<<PhotInStackingAction::GetNGamma(i)
|
|---|
| 101 | // <<" e- "<<PhotInStackingAction::GetNElectron(i)
|
|---|
| 102 | // <<" e+ "<<PhotInStackingAction::GetNPositron(i)<< G4endl;
|
|---|
| 103 | // @@ Change after modification of PhotInStackingAction
|
|---|
| 104 | //G4cout<<" minimum kinetic energy of generated secondaries :"<<G4endl
|
|---|
| 105 | // <<" gamma "<<G4BestUnit(PhotInStackingAction::GetEMinGamma(i),"Energy")
|
|---|
| 106 | // <<" e- "<<G4BestUnit(PhotInStackingAction::GetEMinElectron(i),"Energy")
|
|---|
| 107 | // <<" e+ "<<G4BestUnit(PhotInStackingAction::GetEMinPositron(i),"Energy")
|
|---|
| 108 | // <<G4endl;
|
|---|
| 109 | G4cout<<" total track length of neutrons ="<<G4BestUnit(totL,"Length")<<" consists of "
|
|---|
| 110 | <<nStep<<" steps, meanStepLength="<<G4BestUnit(totL/nStep,"Length")<<G4endl;
|
|---|
| 111 | //@@ This can be written to the file !!
|
|---|
| 112 | }
|
|---|
| 113 | #ifdef debug
|
|---|
| 114 | G4cerr<<"PhotInEventAction::EndOfEventAction: End of End"<<G4endl;
|
|---|
| 115 | #endif
|
|---|
| 116 | }
|
|---|