| 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: PhotInRun.cc,v 1.6 2006/06/29 16:25:23 gunter Exp $
|
|---|
| 28 | // GEANT4 tag $Name: $
|
|---|
| 29 | //
|
|---|
| 30 |
|
|---|
| 31 | //#define debug
|
|---|
| 32 |
|
|---|
| 33 | #include "PhotInRun.hh"
|
|---|
| 34 |
|
|---|
| 35 | G4Allocator<PhotInRun> anPhotInRunAllocator;
|
|---|
| 36 |
|
|---|
| 37 | PhotInRun::PhotInRun()
|
|---|
| 38 | {
|
|---|
| 39 | #ifdef debug
|
|---|
| 40 | G4cout<<"PhotInRun::PhotInRun Conctructor is called"<<G4endl;
|
|---|
| 41 | #endif
|
|---|
| 42 | for(G4int i=0; i<PhotInDiNSections; i++)
|
|---|
| 43 | {
|
|---|
| 44 | totE[i] = 0.;
|
|---|
| 45 | totL[i] = 0.;
|
|---|
| 46 | nStep[i] = 0;
|
|---|
| 47 | nGamma[i] = 0;
|
|---|
| 48 | nElectron[i] = 0;
|
|---|
| 49 | nPositron[i] = 0;
|
|---|
| 50 | eMinGamma[i] = DBL_MAX;
|
|---|
| 51 | eMinElectron[i] = DBL_MAX;
|
|---|
| 52 | eMinPositron[i] = DBL_MAX;
|
|---|
| 53 | }
|
|---|
| 54 | }
|
|---|
| 55 |
|
|---|
| 56 | PhotInRun::~PhotInRun() {}
|
|---|
| 57 |
|
|---|
| 58 | void PhotInRun::RecordEvent(const G4Event* evt)
|
|---|
| 59 | {
|
|---|
| 60 | G4HCofThisEvent* HCE = evt->GetHCofThisEvent();
|
|---|
| 61 | if(!HCE) return;
|
|---|
| 62 | #ifdef debug
|
|---|
| 63 | G4cout<<"PhotInRun::RecordEvent: record event # "<<numberOfEvent<<G4endl;
|
|---|
| 64 | #endif
|
|---|
| 65 | numberOfEvent++;
|
|---|
| 66 | for(G4int j=0; j<PhotInDiNSections; j++)
|
|---|
| 67 | {
|
|---|
| 68 | nGamma[j] += PhotInStackingAction::GetNGamma(j);
|
|---|
| 69 | nElectron[j] += PhotInStackingAction::GetNElectron(j);
|
|---|
| 70 | nPositron[j] += PhotInStackingAction::GetNPositron(j);
|
|---|
| 71 | if(eMinGamma[j]>PhotInStackingAction::GetEMinGamma(j))
|
|---|
| 72 | { eMinGamma[j] = PhotInStackingAction::GetEMinGamma(j); }
|
|---|
| 73 | if(eMinElectron[j]>PhotInStackingAction::GetEMinElectron(j))
|
|---|
| 74 | { eMinElectron[j] = PhotInStackingAction::GetEMinElectron(j); }
|
|---|
| 75 | if(eMinPositron[j]>PhotInStackingAction::GetEMinPositron(j))
|
|---|
| 76 | { eMinPositron[j] = PhotInStackingAction::GetEMinPositron(j); }
|
|---|
| 77 | }
|
|---|
| 78 | PhotInCalorHitsCollection* CHC = 0;
|
|---|
| 79 | for(G4int i=0; i<PhotInDiNSections; i++)
|
|---|
| 80 | {
|
|---|
| 81 | if (HCE) CHC = (PhotInCalorHitsCollection*)(HCE->GetHC(i));
|
|---|
| 82 | if (CHC)
|
|---|
| 83 | {
|
|---|
| 84 | G4int nHit = CHC->entries();
|
|---|
| 85 | for (G4int ii=0;ii<nHit;ii++)
|
|---|
| 86 | {
|
|---|
| 87 | totE[i] += (*CHC)[ii]->GetEDepos();
|
|---|
| 88 | totL[i] += (*CHC)[ii]->GetTrackL();
|
|---|
| 89 | nStep[i]+= (*CHC)[ii]->GetNSteps();
|
|---|
| 90 | }
|
|---|
| 91 | }
|
|---|
| 92 | }
|
|---|
| 93 | #ifdef debug
|
|---|
| 94 | G4cout<<"PhotInRun::RecordEvent: End "<<G4endl;
|
|---|
| 95 | #endif
|
|---|
| 96 | }
|
|---|