| [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 | // **********************************************************************
|
|---|
| 28 | // * *
|
|---|
| 29 | // * GEANT 4 xray_telescope advanced example *
|
|---|
| 30 | // * *
|
|---|
| 31 | // * MODULE: XrayTelEventAction.cc *
|
|---|
| 32 | // * ------- *
|
|---|
| 33 | // * *
|
|---|
| 34 | // * Version: 0.4 *
|
|---|
| 35 | // * Date: 06/11/00 *
|
|---|
| 36 | // * Author: R Nartallo *
|
|---|
| 37 | // * Organisation: ESA/ESTEC, Noordwijk, THe Netherlands *
|
|---|
| 38 | // * *
|
|---|
| 39 | // **********************************************************************
|
|---|
| 40 | //
|
|---|
| 41 | // CHANGE HISTORY
|
|---|
| 42 | // --------------
|
|---|
| 43 | //
|
|---|
| 44 | // 05.12.2001 R.Nartallo
|
|---|
| 45 | // - Implement "Update" function as in LowEnTest
|
|---|
| 46 | //
|
|---|
| 47 | // 06.11.2000 R.Nartallo
|
|---|
| 48 | // - First implementation of xray_telescope event action
|
|---|
| 49 | // - Based on Chandra and XMM models
|
|---|
| 50 | //
|
|---|
| 51 | //
|
|---|
| 52 | // **********************************************************************
|
|---|
| 53 |
|
|---|
| 54 | #include "G4ios.hh"
|
|---|
| 55 | #include "G4Event.hh"
|
|---|
| 56 | #include "G4EventManager.hh"
|
|---|
| 57 | #include "G4HCofThisEvent.hh"
|
|---|
| 58 | #include "G4TrajectoryContainer.hh"
|
|---|
| 59 | #include "G4Trajectory.hh"
|
|---|
| 60 | #include "G4VVisManager.hh"
|
|---|
| 61 | #include "G4UImanager.hh"
|
|---|
| 62 | #include "G4UnitsTable.hh"
|
|---|
| 63 |
|
|---|
| 64 | #include "XrayTelEventAction.hh"
|
|---|
| 65 | #include "XrayTelEventActionMessenger.hh"
|
|---|
| 66 |
|
|---|
| 67 |
|
|---|
| 68 | XrayTelEventAction::XrayTelEventAction()
|
|---|
| 69 | : drawFlag("all"),eventMessenger(0),drawEvent(false)
|
|---|
| 70 | {
|
|---|
| 71 | eventMessenger = new XrayTelEventActionMessenger(this);
|
|---|
| 72 | }
|
|---|
| 73 |
|
|---|
| 74 |
|
|---|
| 75 | XrayTelEventAction::~XrayTelEventAction()
|
|---|
| 76 | {
|
|---|
| 77 | delete eventMessenger;
|
|---|
| 78 | }
|
|---|
| 79 |
|
|---|
| 80 |
|
|---|
| 81 | void XrayTelEventAction::BeginOfEventAction(const G4Event*)
|
|---|
| 82 | {
|
|---|
| 83 | drawEvent = false;
|
|---|
| 84 | }
|
|---|
| 85 |
|
|---|
| 86 |
|
|---|
| 87 | void XrayTelEventAction::EndOfEventAction(const G4Event*)
|
|---|
| 88 | {
|
|---|
| 89 | if (drawEvent){
|
|---|
| 90 | const G4Event* evt = fpEventManager->GetConstCurrentEvent();
|
|---|
| 91 |
|
|---|
| 92 | G4TrajectoryContainer * trajectoryContainer = evt->GetTrajectoryContainer();
|
|---|
| 93 | G4int n_trajectories = 0;
|
|---|
| 94 | if ( trajectoryContainer ){
|
|---|
| 95 | n_trajectories = trajectoryContainer->entries();
|
|---|
| 96 | }
|
|---|
| 97 |
|
|---|
| 98 | if ( G4VVisManager::GetConcreteInstance() ) {
|
|---|
| 99 | for ( G4int i=0; i<n_trajectories; i++ ) {
|
|---|
| 100 | G4Trajectory* trj = (G4Trajectory*)(*(evt->GetTrajectoryContainer()))[i];
|
|---|
| 101 | if ( drawFlag == "all" ) trj->DrawTrajectory(50);
|
|---|
| 102 | else if ( (drawFlag == "charged")&&(trj->GetCharge() > 0.) )
|
|---|
| 103 | trj->DrawTrajectory(50);
|
|---|
| 104 | trj->ShowTrajectory();
|
|---|
| 105 | }
|
|---|
| 106 | }
|
|---|
| 107 | }
|
|---|
| 108 | }
|
|---|
| 109 |
|
|---|
| 110 |
|
|---|
| 111 | void XrayTelEventAction::Update()
|
|---|
| 112 | {
|
|---|
| 113 | // Update the flag identifying the event to be visualised
|
|---|
| 114 | drawEvent = true;
|
|---|
| 115 | }
|
|---|
| 116 |
|
|---|
| 117 |
|
|---|
| 118 |
|
|---|
| 119 |
|
|---|
| 120 |
|
|---|
| 121 |
|
|---|
| 122 |
|
|---|
| 123 |
|
|---|
| 124 |
|
|---|
| 125 |
|
|---|
| 126 |
|
|---|
| 127 |
|
|---|
| 128 |
|
|---|
| 129 |
|
|---|
| 130 |
|
|---|
| 131 |
|
|---|
| 132 |
|
|---|
| 133 |
|
|---|
| 134 |
|
|---|
| 135 |
|
|---|
| 136 |
|
|---|
| 137 |
|
|---|
| 138 |
|
|---|
| 139 |
|
|---|
| 140 |
|
|---|
| 141 |
|
|---|
| 142 |
|
|---|
| 143 |
|
|---|
| 144 |
|
|---|
| 145 |
|
|---|
| 146 |
|
|---|
| 147 |
|
|---|
| 148 |
|
|---|
| 149 |
|
|---|
| 150 |
|
|---|
| 151 |
|
|---|
| 152 |
|
|---|
| 153 |
|
|---|
| 154 |
|
|---|
| 155 |
|
|---|
| 156 |
|
|---|
| 157 |
|
|---|
| 158 |
|
|---|
| 159 |
|
|---|