| 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: G4BremAngularGeneratorTest.cc,v 1.6 2006/06/29 19:43:39 gunter Exp $
|
|---|
| 28 | // GEANT4 tag $Name: geant4-09-04-ref-00 $
|
|---|
| 29 | //
|
|---|
| 30 | // -------------------------------------------------------------------
|
|---|
| 31 | // GEANT 4 class file --- Copyright CERN 1998
|
|---|
| 32 | // CERN Geneva Switzerland
|
|---|
| 33 | //
|
|---|
| 34 | //
|
|---|
| 35 | // File name: G4BremAngularGeneratorTest.cc
|
|---|
| 36 | //
|
|---|
| 37 | // Author: Francesco Longo
|
|---|
| 38 | //
|
|---|
| 39 | // Creation date: 04 january 2001
|
|---|
| 40 | //
|
|---|
| 41 | // Modifications: Luciano Pandola (27 november 2002)
|
|---|
| 42 | // Adapted in order to test G4PenelopeBremsstrahlung
|
|---|
| 43 | // Minor modification in n-tuple filling
|
|---|
| 44 | // Updated analysis to AIDA 3.0
|
|---|
| 45 | //
|
|---|
| 46 | // Pedro Rodrigues (24 March 2003)
|
|---|
| 47 | // Adapted in order to test angular generators for
|
|---|
| 48 | // G4LowEnergyBremsstrahlung
|
|---|
| 49 | //
|
|---|
| 50 | // -------------------------------------------------------------------
|
|---|
| 51 |
|
|---|
| 52 | #include "globals.hh"
|
|---|
| 53 | #include "G4ios.hh"
|
|---|
| 54 |
|
|---|
| 55 | #include <fstream>
|
|---|
| 56 | #include <iomanip>
|
|---|
| 57 |
|
|---|
| 58 | #include "G4Material.hh"
|
|---|
| 59 | #include "G4MaterialTable.hh"
|
|---|
| 60 | #include "G4LowEnergyBremsstrahlung.hh"
|
|---|
| 61 | #include "G4VBremAngularDistribution.hh"
|
|---|
| 62 | #include "G4ModifiedTsai.hh"
|
|---|
| 63 | #include "G4Generator2BS.hh"
|
|---|
| 64 | #include "G4Generator2BN.hh"
|
|---|
| 65 |
|
|---|
| 66 | #include "AIDA/IManagedObject.h"
|
|---|
| 67 | #include <memory>
|
|---|
| 68 | #include "AIDA/IAnalysisFactory.h"
|
|---|
| 69 | #include "AIDA/ITreeFactory.h"
|
|---|
| 70 | #include "AIDA/ITree.h"
|
|---|
| 71 | #include "AIDA/IHistogramFactory.h"
|
|---|
| 72 | #include "AIDA/IHistogram1D.h"
|
|---|
| 73 | #include "AIDA/IHistogram2D.h"
|
|---|
| 74 | #include "AIDA/IHistogram3D.h"
|
|---|
| 75 | #include "AIDA/ITupleFactory.h"
|
|---|
| 76 | #include "AIDA/ITuple.h"
|
|---|
| 77 |
|
|---|
| 78 | int main()
|
|---|
| 79 | {
|
|---|
| 80 |
|
|---|
| 81 | // Setup
|
|---|
| 82 |
|
|---|
| 83 | // -------------------------------------------------------------------
|
|---|
| 84 |
|
|---|
| 85 | // ---- HBOOK initialization
|
|---|
| 86 | std::auto_ptr< AIDA::IAnalysisFactory > af( AIDA_createAnalysisFactory() );
|
|---|
| 87 | std::auto_ptr< AIDA::ITreeFactory > tf (af->createTreeFactory());
|
|---|
| 88 | std::auto_ptr< AIDA::ITree > tree (tf->create("brem_angular_test.hbook","hbook",false,true));
|
|---|
| 89 | G4cout << "Tree store: " << tree->storeName() << G4endl;
|
|---|
| 90 | std::auto_ptr< AIDA::IHistogramFactory > hf (af->createHistogramFactory(*tree));
|
|---|
| 91 | std::auto_ptr< AIDA::IHistogram1D> histo_1 (hf->createHistogram1D("1","Polar Angle", 100,0.,3.14159));
|
|---|
| 92 | // Interactive set-up
|
|---|
| 93 | G4int nIterations = 1;
|
|---|
| 94 | G4cout << "How many interactions at generator level ?" << G4endl;
|
|---|
| 95 | G4cin >> nIterations;
|
|---|
| 96 | if (nIterations <= 0) G4Exception("Wrong input");
|
|---|
| 97 |
|
|---|
| 98 |
|
|---|
| 99 | G4int gType;
|
|---|
| 100 | G4cout << "Modified Tsai Generator [1]" << G4endl;
|
|---|
| 101 | G4cout << "2BS Generator [2]" << G4endl;
|
|---|
| 102 | G4cout << "2BN Generator [3]" << G4endl;
|
|---|
| 103 | G4cin >> gType;
|
|---|
| 104 | if ( !(gType < 4)) G4Exception("Wrong input");
|
|---|
| 105 |
|
|---|
| 106 | G4VBremAngularDistribution* angularDistribution = 0;
|
|---|
| 107 |
|
|---|
| 108 | if (gType == 1)
|
|---|
| 109 | {
|
|---|
| 110 | angularDistribution = new G4ModifiedTsai("TsaiGenerator");
|
|---|
| 111 | }
|
|---|
| 112 |
|
|---|
| 113 | if(gType == 2)
|
|---|
| 114 | {
|
|---|
| 115 | angularDistribution = new G4Generator2BS("2BSGenerator");
|
|---|
| 116 | }
|
|---|
| 117 |
|
|---|
| 118 | if(gType == 3)
|
|---|
| 119 | {
|
|---|
| 120 | angularDistribution = new G4Generator2BN("2BNGenerator");
|
|---|
| 121 | }
|
|---|
| 122 |
|
|---|
| 123 | angularDistribution->PrintGeneratorInformation();
|
|---|
| 124 |
|
|---|
| 125 | G4double initEnergy = 1*MeV;
|
|---|
| 126 | G4cout << "Enter the initial electron/positron energy E (MeV)" << G4endl;
|
|---|
| 127 | G4cin >> initEnergy ;
|
|---|
| 128 | initEnergy = initEnergy*MeV;
|
|---|
| 129 |
|
|---|
| 130 | if (initEnergy <= 0.) G4Exception("Wrong input");
|
|---|
| 131 |
|
|---|
| 132 | G4double finalEnergy = 0*MeV;
|
|---|
| 133 | G4cout << "Enter the final electron/positron energy E (MeV)" << G4endl;
|
|---|
| 134 | G4cin >> finalEnergy;
|
|---|
| 135 | finalEnergy = finalEnergy*MeV;
|
|---|
| 136 |
|
|---|
| 137 | if (finalEnergy < 0.) G4Exception("Wrong input");
|
|---|
| 138 |
|
|---|
| 139 | G4int Z = 0;
|
|---|
| 140 | G4cout << "Enter the atomic number " << G4endl;
|
|---|
| 141 | G4cin >> Z;
|
|---|
| 142 | if(Z <= 0) G4Exception("Wrong input");
|
|---|
| 143 |
|
|---|
| 144 | G4double kineticEnergy = initEnergy;
|
|---|
| 145 | G4double finalKineticEnergy = finalEnergy;
|
|---|
| 146 |
|
|---|
| 147 | for(G4int k = 0; k < nIterations; k++){
|
|---|
| 148 | G4double theta = angularDistribution->PolarAngle(kineticEnergy,finalKineticEnergy,Z);
|
|---|
| 149 | histo_1->fill(theta);
|
|---|
| 150 | }
|
|---|
| 151 |
|
|---|
| 152 | G4cout << "Committing.............." << G4endl;
|
|---|
| 153 | tree->commit();
|
|---|
| 154 | G4cout << "Closing the tree........" << G4endl;
|
|---|
| 155 | tree->close();
|
|---|
| 156 |
|
|---|
| 157 | delete angularDistribution;
|
|---|
| 158 |
|
|---|
| 159 | G4cout << "END OF THE MAIN PROGRAM" << G4endl;
|
|---|
| 160 | return 0;
|
|---|
| 161 |
|
|---|
| 162 | }
|
|---|
| 163 |
|
|---|
| 164 |
|
|---|
| 165 |
|
|---|
| 166 |
|
|---|
| 167 |
|
|---|
| 168 |
|
|---|
| 169 |
|
|---|
| 170 |
|
|---|
| 171 |
|
|---|
| 172 |
|
|---|
| 173 |
|
|---|
| 174 |
|
|---|
| 175 |
|
|---|
| 176 |
|
|---|
| 177 |
|
|---|
| 178 |
|
|---|
| 179 |
|
|---|