source: trunk/source/processes/electromagnetic/standard/test/eegg.cc@ 1330

Last change on this file since 1330 was 1199, checked in by garnier, 16 years ago

nvx fichiers dans CVS

File size: 3.8 KB
RevLine 
[1199]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// GEANT 4 class file --- Copyright CERN 1998
28// CERN Geneva Switzerland
29//
30//
31// File name: eegg -> unit test of e+e- -> gg model
32//
33// Author: V.Ivanchenko
34//
35// Creation date: 19 October 2006
36//
37// Modifications:
38//
39// -------------------------------------------------------------------
40
41#include "globals.hh"
42#include "G4eeToTwoGammaModel.hh"
43#include "G4eeToTwoGammaModel82.hh"
44#include "G4MaterialCutsCouple.hh"
45#include "G4DynamicParticle.hh"
46#include "G4ThreeVector.hh"
47#include "G4Positron.hh"
48#include "G4ios.hh"
49#include "TFile.h"
50#include "TH1F.h"
51#include <iostream>
52#include <fstream>
53#include <string>
54#include <iomanip>
55#include <vector>
56
57int main(int argc, char** argv)
58{
59 // G4int verbose = 2;
60 G4int nstat = 10000;
61 G4double energy = 10.*GeV;
62 G4double etot = energy + 2.0*electron_mass_c2;
63
64 G4MaterialCutsCouple* couple = 0;
65 G4ThreeVector dir(0.0,0.0,1.0);
66 G4DynamicParticle* dp0 = new G4DynamicParticle(G4Positron::Positron(),
67 dir,energy);
68 G4DynamicParticle* dp;
69
70 G4eeToTwoGammaModel* eegg =
71 new G4eeToTwoGammaModel(G4Positron::Positron(),"eegg");
72 G4eeToTwoGammaModel82* eegg82 =
73 new G4eeToTwoGammaModel82(G4Positron::Positron(),"eegg82");
74
75 std::vector<G4DynamicParticle*>* vdp;
76
77 TFile tree("eegg10gev.root","RECREATE","eegg");
78
79 TH1D* h1 = new TH1D( "h1","Gamma Energy",120,0,1);
80 TH1D* h2 = new TH1D( "h2","Gamma Energy",120,0,1);
81 TH1D* h3 = new TH1D( "h3","cos(theta) lab",100,-1,1);
82 TH1D* h4 = new TH1D( "h4","cos(theta) lab",100,-1,1);
83
84 G4int i, j, n;
85
86 for(i=0; i<nstat; i++) {
87 vdp = eegg->SampleSecondaries(couple,dp0,0,0);
88 n = vdp->size();
89 for(j=0; j<n; j++) {
90 dp = (*vdp)[j];
91 h1->Fill(dp->GetKineticEnergy()/etot);
92 h3->Fill(dp->GetMomentumDirection().z());
93 delete dp;
94 }
95 delete vdp;
96 vdp = eegg82->SampleSecondaries(couple,dp0,0,0);
97 n = vdp->size();
98 for(j=0; j<n; j++) {
99 dp = (*vdp)[j];
100 h2->Fill(dp->GetKineticEnergy()/etot);
101 h4->Fill(dp->GetMomentumDirection().z());
102 delete dp;
103 }
104 delete vdp;
105 }
106 tree.Write();
107 tree.Close();
108
109 return 0;
110}
111
112
113
114
115
116
117
118
Note: See TracBrowser for help on using the repository browser.