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 // 23 // 27 // ******************************************* 24 // ********************************************************************** 28 // * 25 // * * 29 // * GEANT 4 xray_telescope 26 // * GEANT 4 xray_telescope advanced example * 30 // * 27 // * * 31 // * MODULE: XrayTelRunAction.cc 28 // * MODULE: XrayTelRunAction.cc * 32 // * ------- 29 // * ------- * 33 // * 30 // * * 34 // * Version: 0.5 31 // * Version: 0.5 * 35 // * Date: 16/10/01 32 // * Date: 16/10/01 * 36 // * Author: R Nartallo 33 // * Author: R Nartallo * 37 // * Organisation: ESA/ESTEC, Noordwijk, 34 // * Organisation: ESA/ESTEC, Noordwijk, THe Netherlands * 38 // * 35 // * * 39 // ******************************************* 36 // ********************************************************************** 40 // 37 // 41 // CHANGE HISTORY 38 // CHANGE HISTORY 42 // -------------- 39 // -------------- 43 // 40 // 44 // 07.11.2001 M.G. Pia 41 // 07.11.2001 M.G. Pia 45 // - Modified the analysis management 42 // - Modified the analysis management 46 // - Small design iteration 43 // - Small design iteration 47 // 44 // 48 // 16.10.2001 R. Nartallo 45 // 16.10.2001 R. Nartallo 49 // - Updated "/vis" commands to new versions 46 // - Updated "/vis" commands to new versions 50 // - Clean up code to avoid 'pedantic' and 'AN 47 // - Clean up code to avoid 'pedantic' and 'ANSI' compiler warnings 51 // 48 // 52 // 30.11.2000 R. Nartallo 49 // 30.11.2000 R. Nartallo 53 // - Add pre-processor directives to compile w 50 // - Add pre-processor directives to compile without analysis option 54 // 51 // 55 // 16.11.2000 A. Pfeiffer 52 // 16.11.2000 A. Pfeiffer 56 // - Implementation of analysis manager call 53 // - Implementation of analysis manager call 57 // 54 // 58 // 06.11.2000 R.Nartallo 55 // 06.11.2000 R.Nartallo 59 // - First implementation of xray_telescope Ph 56 // - First implementation of xray_telescope Physics list 60 // - Based on Chandra and XMM models 57 // - Based on Chandra and XMM models 61 // 58 // 62 // 59 // 63 // ******************************************* 60 // ********************************************************************** 64 61 65 #include "XrayTelRunAction.hh" << 66 #include "XrayTelAnalysis.hh" << 67 << 68 #include "G4SystemOfUnits.hh" << 69 #include "G4Run.hh" 62 #include "G4Run.hh" 70 #include "G4UImanager.hh" 63 #include "G4UImanager.hh" 71 #include "G4VVisManager.hh" 64 #include "G4VVisManager.hh" >> 65 #include "XrayTelRunAction.hh" >> 66 #include "XrayTelAnalysis.hh" 72 67 73 XrayTelRunAction::XrayTelRunAction() 68 XrayTelRunAction::XrayTelRunAction() >> 69 :nEnteringTracks(0), totEnteringEnergy(0.) 74 { } 70 { } 75 71 76 72 77 XrayTelRunAction::~XrayTelRunAction() 73 XrayTelRunAction::~XrayTelRunAction() 78 { } 74 { } 79 75 80 76 81 void XrayTelRunAction::BeginOfRunAction(const 77 void XrayTelRunAction::BeginOfRunAction(const G4Run* aRun) 82 { 78 { 83 G4int runN = aRun->GetRunID(); 79 G4int runN = aRun->GetRunID(); 84 if (IsMaster()) << 80 if ( runN % 1000 == 0 ) 85 G4cout << "### Run : " << runN << " (maste << 81 G4cout << "### Run : " << runN << G4endl; 86 else << 82 87 G4cout << "### Run : " << runN << " (worke << 83 if (G4VVisManager::GetConcreteInstance()) { >> 84 G4UImanager* UI = G4UImanager::GetUIpointer(); >> 85 UI->ApplyCommand("/vis/scene/notifyHandlers"); >> 86 } >> 87 >> 88 nEnteringTracks = 0; >> 89 totEnteringEnergy = 0.; 88 90 89 // Book histograms and ntuples 91 // Book histograms and ntuples 90 XrayTelAnalysis* analysis = XrayTelAnalysis: 92 XrayTelAnalysis* analysis = XrayTelAnalysis::getInstance(); 91 analysis->book(IsMaster()); << 93 analysis->book(); 92 } 94 } 93 95 94 96 95 void XrayTelRunAction::EndOfRunAction(const G4 97 void XrayTelRunAction::EndOfRunAction(const G4Run* ) 96 { 98 { 97 XrayTelAnalysis* analysis = XrayTelAnalysis: 99 XrayTelAnalysis* analysis = XrayTelAnalysis::getInstance(); 98 analysis->finish(IsMaster()); << 100 analysis->finish(); >> 101 >> 102 if (G4VVisManager::GetConcreteInstance()) >> 103 G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/update"); >> 104 >> 105 G4cout << "End of Run summary" << G4endl << G4endl; >> 106 >> 107 G4cout << "Total Entering Detector : " << nEnteringTracks << G4endl; >> 108 G4cout << "Total Entering Detector Energy : " >> 109 << totEnteringEnergy/MeV >> 110 << " MeV" >> 111 << G4endl; >> 112 } >> 113 >> 114 >> 115 void XrayTelRunAction::Update(G4double energy) >> 116 { >> 117 nEnteringTracks++; >> 118 totEnteringEnergy += energy; 99 } 119 } >> 120 >> 121 >> 122 100 123 101 124 102 125 103 126 104 127 105 128 106 129 107 130 108 131 109 132 110 133 111 134 112 135 113 136 114 137 115 138 116 139 117 140 118 141 119 142 120 143 121 144