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 | #include "G4AtomicTransitionManager.hh" |
---|
27 | #include "globals.hh" |
---|
28 | #include "G4ios.hh" |
---|
29 | #include <vector> |
---|
30 | #include "AIDA/AIDA.h" |
---|
31 | |
---|
32 | int main(int argc, char* argv[]){ |
---|
33 | |
---|
34 | |
---|
35 | G4int Z = 0; |
---|
36 | G4int shellId = -1; |
---|
37 | G4int shellIndex = -1; |
---|
38 | G4double totFluoProb; |
---|
39 | |
---|
40 | |
---|
41 | AIDA::ITree* tree; |
---|
42 | AIDA::IAnalysisFactory* analysisFactory; |
---|
43 | AIDA::ITupleFactory* tupleFactory; |
---|
44 | AIDA::ITuple* tupleFluoProb; |
---|
45 | |
---|
46 | analysisFactory = AIDA_createAnalysisFactory(); |
---|
47 | AIDA::ITreeFactory* treeFactory = analysisFactory->createTreeFactory(); |
---|
48 | tree = treeFactory->create("Probabilities.xml","xml",false,true); |
---|
49 | tupleFactory = analysisFactory->createTupleFactory(*tree); |
---|
50 | // Book tuple column names |
---|
51 | std::vector<std::string> columnNames; |
---|
52 | // Book tuple column types |
---|
53 | std::vector<std::string> columnTypes; |
---|
54 | |
---|
55 | columnNames.push_back("AtomicNumber"); |
---|
56 | columnNames.push_back("ShellId"); |
---|
57 | columnNames.push_back("Probability"); |
---|
58 | |
---|
59 | columnTypes.push_back("int"); |
---|
60 | columnTypes.push_back("int"); |
---|
61 | columnTypes.push_back("double"); |
---|
62 | tupleFluoProb = tupleFactory->create("10", "Totale shell probabilities", columnNames, columnTypes, ""); |
---|
63 | assert(tupleFluoProb); |
---|
64 | |
---|
65 | // G4cout <<argc<<G4endl; |
---|
66 | // G4cout <<argv[1]<<G4endl; |
---|
67 | // G4cout <<argv[2]<<G4endl; |
---|
68 | |
---|
69 | if (argv[1]) {Z= atoi(argv[1]);} |
---|
70 | else { |
---|
71 | G4cout << "Enter Z " << G4endl; |
---|
72 | G4cin >> Z; |
---|
73 | } |
---|
74 | if ( argc==3 ) {shellId = atoi(argv[2]);} |
---|
75 | else if (argc != 2){ |
---|
76 | G4cout <<" Select the Id of the Fluo vacancy "<<G4endl; |
---|
77 | G4cin>> shellId; |
---|
78 | } |
---|
79 | |
---|
80 | G4AtomicTransitionManager* transManager = G4AtomicTransitionManager::Instance(); |
---|
81 | |
---|
82 | G4int zStart, zEnd; |
---|
83 | G4bool totalFlag; |
---|
84 | if (Z == 0) { |
---|
85 | zStart = 6; |
---|
86 | zEnd = 100; |
---|
87 | totalFlag = true; |
---|
88 | } |
---|
89 | else { |
---|
90 | zStart = Z; |
---|
91 | zEnd = Z+1; |
---|
92 | } |
---|
93 | for (Z=zStart; Z<zEnd; Z++){ |
---|
94 | |
---|
95 | |
---|
96 | G4int shellNumber = transManager->NumberOfReachableShells(Z); |
---|
97 | |
---|
98 | |
---|
99 | |
---|
100 | for (shellIndex=0; shellIndex<shellNumber; shellIndex++) { |
---|
101 | |
---|
102 | if (shellId == -1) { |
---|
103 | shellIndex = -1; |
---|
104 | break; |
---|
105 | } |
---|
106 | if (transManager->Shell(Z,shellIndex)->ShellId() == shellId) { |
---|
107 | G4cout << "ShellId "<< shellId <<" matches the index: " << shellIndex << G4endl; |
---|
108 | break; |
---|
109 | } |
---|
110 | |
---|
111 | else if (shellIndex == shellNumber-1 ) { |
---|
112 | G4cout << "ShellId " << shellId << " not available. " << G4endl; |
---|
113 | return 0; |
---|
114 | } |
---|
115 | } |
---|
116 | |
---|
117 | |
---|
118 | G4int shellStart, shellEnd; |
---|
119 | if (shellIndex == -1 ) { |
---|
120 | shellStart = 0; |
---|
121 | shellEnd = shellNumber; |
---|
122 | } |
---|
123 | else { |
---|
124 | shellStart = shellIndex; |
---|
125 | shellEnd = shellIndex+1; |
---|
126 | } |
---|
127 | |
---|
128 | |
---|
129 | |
---|
130 | for (shellIndex=shellStart; shellIndex<shellEnd; shellIndex++) { |
---|
131 | |
---|
132 | // G4cout << "Testing G4FluoTransition "<<G4endl; |
---|
133 | // std::vector<G4double> transEnergies = transManager->ReachableShell(Z,shellIndex)->TransitionEnergies(); |
---|
134 | // std::vector<G4int> transIds = transManager->ReachableShell(Z,shellIndex)->OriginatingShellIds(); |
---|
135 | //std::vector<G4double> transProbs = transManager->ReachableShell(Z,shellIndex)->TransitionProbabilities(); |
---|
136 | G4int currentShellId = transManager->Shell(Z,shellIndex)->ShellId(); |
---|
137 | if (shellId == -1) { |
---|
138 | G4cout << "ShellId: "<< currentShellId; |
---|
139 | } |
---|
140 | totFluoProb = transManager->TotalRadiativeTransitionProbability(Z,shellIndex); |
---|
141 | |
---|
142 | G4cout << "Total Probability that a radiative transition occurs: " << |
---|
143 | totFluoProb <<G4endl; |
---|
144 | if (totalFlag) { |
---|
145 | tupleFluoProb->fill(0,Z); |
---|
146 | tupleFluoProb->fill(1,currentShellId); |
---|
147 | tupleFluoProb->fill(2,totFluoProb); |
---|
148 | tupleFluoProb->addRow(); |
---|
149 | } |
---|
150 | } |
---|
151 | } |
---|
152 | tree->commit(); // Write histos in file. |
---|
153 | tree->close(); |
---|
154 | } |
---|
155 | |
---|
156 | // G4cout << "Number of shells: " << transManager->NumberOfShells(Z)<<G4endl; |
---|
157 | |
---|
158 | // G4cout<< "Number of Fluo vacancies: "<<transManager->NumberOfReachableShells(Z)<<G4endl; |
---|
159 | |
---|
160 | // G4cout << "Testing G4AtomicShell" << G4endl; |
---|
161 | |
---|
162 | |
---|
163 | |
---|
164 | |
---|
165 | // G4cout << "Select the index of the subshell whose binding energy you need: " << G4endl; |
---|
166 | // G4cin >> subShell; |
---|
167 | |
---|
168 | |
---|
169 | |
---|
170 | // G4cout << "SubShell binding energy: " << transManager->Shell(Z,subShell)->BindingEnergy() << G4endl; |
---|
171 | |
---|
172 | // G4cout << "Testing G4AtomicShell" << G4endl; |
---|
173 | // G4int shellIndex; |
---|
174 | |
---|
175 | |
---|
176 | |
---|
177 | // for (G4int trans=0; trans<transIds.size(); trans++) { |
---|
178 | // |
---|
179 | // G4cout << "The transition starts from the shell: " << transIds[trans] << G4endl; |
---|
180 | // G4cout << "The transition starts from the shell: " << |
---|
181 | // |
---|
182 | // |
---|
183 | // transManager->ReachableShell(Z,shellIndex)->OriginatingShellId(trans) << G4endl; |
---|
184 | // |
---|
185 | // |
---|
186 | // G4cout << " Transition energy: " << transEnergies[trans] << G4endl; |
---|
187 | // G4cout << "Transition energy: " << |
---|
188 | // transManager->ReachableShell(Z,shellIndex)->TransitionEnergy(trans) << G4endl; |
---|
189 | // |
---|
190 | // G4cout << "Transition probability: " << transProbs[trans] << G4endl; |
---|
191 | // G4cout << "Transition probability: " << |
---|
192 | // transManager->ReachableShell(Z,shellIndex)->TransitionProbability(trans) << G4endl; |
---|
193 | // } |
---|