1 | // |
---|
2 | // ******************************************************************** |
---|
3 | // * DISCLAIMER * |
---|
4 | // * * |
---|
5 | // * The following disclaimer summarizes all the specific disclaimers * |
---|
6 | // * of contributors to this software. The specific disclaimers,which * |
---|
7 | // * govern, are listed with their locations in: * |
---|
8 | // * http://cern.ch/geant4/license * |
---|
9 | // * * |
---|
10 | // * Neither the authors of this software system, nor their employing * |
---|
11 | // * institutes,nor the agencies providing financial support for this * |
---|
12 | // * work make any representation or warranty, express or implied, * |
---|
13 | // * regarding this software system or assume any liability for its * |
---|
14 | // * use. * |
---|
15 | // * * |
---|
16 | // * This code implementation is the intellectual property of the * |
---|
17 | // * GEANT4 collaboration. * |
---|
18 | // * By copying, distributing or modifying the Program (or any work * |
---|
19 | // * based on the Program) you indicate your acceptance of this * |
---|
20 | // * statement, and all its terms. * |
---|
21 | // ******************************************************************** |
---|
22 | // |
---|
23 | #include "globals.hh" |
---|
24 | #include "G4ios.hh" |
---|
25 | |
---|
26 | #include "CLHEP/Hist/TupleManager.h" |
---|
27 | #include "CLHEP/Hist/HBookFile.h" |
---|
28 | #include "CLHEP/Hist/Histogram.h" |
---|
29 | #include "CLHEP/Hist/Tuple.h" |
---|
30 | #include "Randomize.hh" |
---|
31 | |
---|
32 | #include <fstream> |
---|
33 | #include <iomanip> |
---|
34 | #include <assert.h> |
---|
35 | #include <iostream> |
---|
36 | #include <G4KineticTrack.hh> |
---|
37 | |
---|
38 | #include "G4PionMinus.hh" |
---|
39 | #include "G4VShortLivedParticle.hh" |
---|
40 | #include "G4ShortLivedConstructor.hh" |
---|
41 | #include "G4ParticleTable.hh" |
---|
42 | #include "G4ShortLivedTable.hh" |
---|
43 | |
---|
44 | int main() |
---|
45 | { |
---|
46 | // MGP ---- HBOOK initialization |
---|
47 | HepTupleManager* hbookManager; |
---|
48 | hbookManager = new HBookFile("brwig.hbook", 58); |
---|
49 | assert (hbookManager != 0); |
---|
50 | |
---|
51 | // MGP ---- Book histograms |
---|
52 | |
---|
53 | HepHistogram* hbrwig; |
---|
54 | HepHistogram* hbmass; |
---|
55 | hbrwig = hbookManager->histogram("Breit Wigner", 1000,0.,1.); |
---|
56 | assert (hbrwig != 0); |
---|
57 | hbmass = hbookManager->histogram("random mass", 1000,0.,2500.); |
---|
58 | assert (hbmass != 0); |
---|
59 | |
---|
60 | G4ParticleDefinition* pionMinus = G4PionMinus::PionMinusDefinition(); |
---|
61 | G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable(); |
---|
62 | |
---|
63 | G4ShortLivedConstructor ShortLived; |
---|
64 | ShortLived.ConstructParticle(); |
---|
65 | |
---|
66 | G4ParticleDefinition* deltaPlus = particleTable->FindParticle("delta+"); |
---|
67 | G4cout << deltaPlus->GetParticleName() << " created, type is " |
---|
68 | << deltaPlus->GetParticleType() << G4endl; |
---|
69 | |
---|
70 | G4ParticleDefinition* definition1; |
---|
71 | definition1 = deltaPlus; |
---|
72 | G4double mass1 = definition1->GetPDGMass(); |
---|
73 | G4double width1 = definition1->GetPDGWidth(); |
---|
74 | |
---|
75 | int nevt, DEBUG, nwid; |
---|
76 | cout << "Enter Debug 0/1" << G4endl; |
---|
77 | G4cin >> DEBUG; |
---|
78 | cout << " Enter number of events " << G4endl; |
---|
79 | G4cin >> nevt; |
---|
80 | cout << " Enter number of width " << G4endl; |
---|
81 | G4cin >> nwid; |
---|
82 | |
---|
83 | G4KineticTrack wig; |
---|
84 | G4double max=wig.BrWig(width1, mass1, mass1); |
---|
85 | int i=0; |
---|
86 | while(i<nevt){ |
---|
87 | // rand mass-nwid*width:mass+nwid*width |
---|
88 | G4double mass=(mass1+nwid*width1)-(G4UniformRand()*2*nwid*width1); |
---|
89 | G4double check=max*G4UniformRand(); |
---|
90 | G4double wigt=wig.BrWig(width1, mass1, mass); |
---|
91 | // fill histo |
---|
92 | hbrwig->accumulate(wigt); |
---|
93 | if(check < wigt){ |
---|
94 | hbmass->accumulate(mass); |
---|
95 | i++; |
---|
96 | } |
---|
97 | if (DEBUG == 1)cout << " w/m/xm/brwig " << width1 << " " << mass << " " << mass1 << " " << wigt << G4endl; |
---|
98 | } |
---|
99 | hbookManager->write(); |
---|
100 | return EXIT_SUCCESS; |
---|
101 | } |
---|
102 | |
---|
103 | |
---|
104 | |
---|
105 | |
---|
106 | |
---|
107 | |
---|
108 | |
---|
109 | |
---|
110 | |
---|
111 | |
---|