| 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: G4AugerDataTest.cc,v ????
|
|---|
| 28 | // GEANT4 tag $Name: geant4-09-03-cand-01 $
|
|---|
| 29 | //
|
|---|
| 30 | // -------------------------------------------------------------------
|
|---|
| 31 | //
|
|---|
| 32 | // File name: G4AugerDataTest
|
|---|
| 33 | //
|
|---|
| 34 | // Author: Alfonso Mantero (based on work By Elena Guardincerri)
|
|---|
| 35 | //
|
|---|
| 36 | // Creation date: 18 April 2002
|
|---|
| 37 | //
|
|---|
| 38 | // Modifications:
|
|---|
| 39 | //
|
|---|
| 40 | // -------------------------------------------------------------------
|
|---|
| 41 |
|
|---|
| 42 | #include "globals.hh"
|
|---|
| 43 | #include "G4DataVector.hh"
|
|---|
| 44 | #include "G4ios.hh"
|
|---|
| 45 | #include <fstream>
|
|---|
| 46 | #include <iomanip>
|
|---|
| 47 | #include "AIDA/AIDA.h"
|
|---|
| 48 | #include "G4AugerData.hh"
|
|---|
| 49 |
|
|---|
| 50 | int main(int argc, char* argv[])
|
|---|
| 51 | {
|
|---|
| 52 | G4cout.setf( std::ios::scientific, std::ios::floatfield );
|
|---|
| 53 |
|
|---|
| 54 | if (argc == 2) {
|
|---|
| 55 | G4int Z = atoi(argv[1]);
|
|---|
| 56 | G4AugerData* dataSet = new G4AugerData();
|
|---|
| 57 | // dataSet->LoadData(Z);
|
|---|
| 58 | G4int vac= dataSet->NumberOfVacancies(Z);
|
|---|
| 59 |
|
|---|
| 60 | AIDA::ITree* tree;
|
|---|
| 61 | AIDA::IAnalysisFactory* analysisFactory;
|
|---|
| 62 | AIDA::IHistogramFactory* cloudFactory;
|
|---|
| 63 | AIDA::ICloud1D* cloudAuger;
|
|---|
| 64 |
|
|---|
| 65 | AIDA::ITree* treeTuple;
|
|---|
| 66 | AIDA::ITupleFactory* tupleFactory;
|
|---|
| 67 | AIDA::ITuple* tupleAuger;
|
|---|
| 68 |
|
|---|
| 69 | analysisFactory = AIDA_createAnalysisFactory();
|
|---|
| 70 | AIDA::ITreeFactory* treeFactory = analysisFactory->createTreeFactory();
|
|---|
| 71 | G4String zString;
|
|---|
| 72 | std::ostringstream stream;
|
|---|
| 73 | stream << "auger" << Z << ".xml";
|
|---|
| 74 | G4String fileName = stream.str();
|
|---|
| 75 | tree = treeFactory->create(fileName,"xml",false,true);
|
|---|
| 76 | cloudFactory = analysisFactory->createHistogramFactory(*tree);
|
|---|
| 77 | cloudAuger = cloudFactory->createCloud1D("c1");
|
|---|
| 78 | assert(cloudAuger);
|
|---|
| 79 |
|
|---|
| 80 | stream.str("");
|
|---|
| 81 | stream << "augerTuple" << Z << ".hbk";
|
|---|
| 82 | G4String fileNameTuple = stream.str();
|
|---|
| 83 | treeTuple = treeFactory->create(fileNameTuple,"hbook",false,true);
|
|---|
| 84 | tupleFactory = analysisFactory->createTupleFactory(*treeTuple);
|
|---|
| 85 | // Book tuple column names
|
|---|
| 86 | std::vector<std::string> columnNames;
|
|---|
| 87 | // Book tuple column types
|
|---|
| 88 | std::vector<std::string> columnTypes;
|
|---|
| 89 | columnNames.push_back("Z");
|
|---|
| 90 | columnNames.push_back("DataType");
|
|---|
| 91 | columnNames.push_back("ShellStart");
|
|---|
| 92 | columnNames.push_back("ShellStop");
|
|---|
| 93 | columnNames.push_back("ShellOrigAuger");
|
|---|
| 94 | columnNames.push_back("Energy");
|
|---|
| 95 | columnNames.push_back("Probability");
|
|---|
| 96 | columnNames.push_back("EnUnc");
|
|---|
| 97 | columnNames.push_back("Type");
|
|---|
| 98 |
|
|---|
| 99 | columnTypes.push_back("int");
|
|---|
| 100 | columnTypes.push_back("int");
|
|---|
| 101 | columnTypes.push_back("int");
|
|---|
| 102 | columnTypes.push_back("int");
|
|---|
| 103 | columnTypes.push_back("int");
|
|---|
| 104 | columnTypes.push_back("double");
|
|---|
| 105 | columnTypes.push_back("double");
|
|---|
| 106 | columnTypes.push_back("double");
|
|---|
| 107 | columnTypes.push_back("int");
|
|---|
| 108 |
|
|---|
| 109 | tupleAuger = tupleFactory->create("10", "Total Tuple", columnNames, columnTypes, "");
|
|---|
| 110 | assert(tupleAuger);
|
|---|
| 111 |
|
|---|
| 112 | for (G4int vacancyIndex = 0; vacancyIndex<= vac-1; vacancyIndex++)
|
|---|
| 113 | {
|
|---|
| 114 |
|
|---|
| 115 | G4int n = dataSet->NumberOfTransitions(Z, vacancyIndex);
|
|---|
| 116 | G4int id = dataSet->VacancyId(Z, vacancyIndex);
|
|---|
| 117 | for (G4int initIndex = 0; initIndex < n; initIndex++){
|
|---|
| 118 | G4int startingShellId = dataSet->StartShellId(Z, vacancyIndex, initIndex);
|
|---|
| 119 | G4int nAuger = dataSet->NumberOfAuger(Z, vacancyIndex, startingShellId);
|
|---|
| 120 |
|
|---|
| 121 | for (G4int augerIndex = 0; augerIndex < nAuger; augerIndex++){
|
|---|
| 122 |
|
|---|
| 123 | G4double startingShellEnergy = dataSet-> StartShellEnergy(Z, vacancyIndex, startingShellId, augerIndex);
|
|---|
| 124 | G4int augerShellId = dataSet-> AugerShellId(Z, vacancyIndex, startingShellId, augerIndex);
|
|---|
| 125 | G4double startingShellProb = dataSet-> StartShellProb(Z, vacancyIndex, startingShellId, augerIndex);
|
|---|
| 126 |
|
|---|
| 127 | cloudAuger->fill(startingShellEnergy);
|
|---|
| 128 | tupleAuger->fill(0,Z);
|
|---|
| 129 | tupleAuger->fill(1,0);
|
|---|
| 130 | tupleAuger->fill(2,id);
|
|---|
| 131 | tupleAuger->fill(3,startingShellId);
|
|---|
| 132 | tupleAuger->fill(4,augerShellId);
|
|---|
| 133 | tupleAuger->fill(5,startingShellEnergy);
|
|---|
| 134 | tupleAuger->fill(6,startingShellProb);
|
|---|
| 135 | tupleAuger->fill(7,startingShellEnergy*0.15);
|
|---|
| 136 | tupleAuger->fill(8,0);
|
|---|
| 137 | tupleAuger->addRow();
|
|---|
| 138 |
|
|---|
| 139 | }
|
|---|
| 140 | }
|
|---|
| 141 | }
|
|---|
| 142 | tree->commit(); // Write histos in file.
|
|---|
| 143 | tree->close();
|
|---|
| 144 | treeTuple->commit(); // Write histos in file.
|
|---|
| 145 | treeTuple->close();
|
|---|
| 146 | delete dataSet;
|
|---|
| 147 | }
|
|---|
| 148 |
|
|---|
| 149 | else {
|
|---|
| 150 | G4cout << "Enter Z" << G4endl;
|
|---|
| 151 | G4int Z;
|
|---|
| 152 | G4cin >> Z;
|
|---|
| 153 |
|
|---|
| 154 | G4AugerData* dataSet = new G4AugerData();
|
|---|
| 155 |
|
|---|
| 156 | G4cout << "G4AugerData created" << G4endl;
|
|---|
| 157 |
|
|---|
| 158 |
|
|---|
| 159 | G4int vac = dataSet->NumberOfVacancies(Z);
|
|---|
| 160 |
|
|---|
| 161 | G4cout << "The atom of atomic number "<<Z<<" has "
|
|---|
| 162 | << vac<<" vacancies "<<G4endl;
|
|---|
| 163 | G4cout << "Enter the index of the main vacancy" << G4endl;
|
|---|
| 164 | G4int a, b;
|
|---|
| 165 | G4int vacancyIndex;
|
|---|
| 166 | G4cin >> a;
|
|---|
| 167 |
|
|---|
| 168 | if (a == -1)
|
|---|
| 169 | {
|
|---|
| 170 | a = 0;
|
|---|
| 171 | b = vac-1;
|
|---|
| 172 | }
|
|---|
| 173 | else { b = a;}
|
|---|
| 174 |
|
|---|
| 175 | for (vacancyIndex = a; vacancyIndex<=b; vacancyIndex++)
|
|---|
| 176 | {
|
|---|
| 177 |
|
|---|
| 178 | G4int n = dataSet->NumberOfTransitions(Z, vacancyIndex);
|
|---|
| 179 |
|
|---|
| 180 | G4cout << " Testing VacancyId..."<< G4endl;
|
|---|
| 181 |
|
|---|
| 182 |
|
|---|
| 183 | G4int id = dataSet->VacancyId(Z, vacancyIndex);
|
|---|
| 184 | G4cout << " The shell whose index is " <<vacancyIndex
|
|---|
| 185 | << " has identity " << id << G4endl;
|
|---|
| 186 | G4cout <<" Electrons can reach it from "<< n <<" shells."<<G4endl;
|
|---|
| 187 |
|
|---|
| 188 | G4int a1 = 0;
|
|---|
| 189 | G4int nMax = 0;
|
|---|
| 190 | if (a == b) {
|
|---|
| 191 | G4cout << "Enter the index of the starting shell of the electron transition" << G4endl;
|
|---|
| 192 | G4cin >> a1;
|
|---|
| 193 | nMax = n;
|
|---|
| 194 | n = a1+1;
|
|---|
| 195 |
|
|---|
| 196 | if (a1 >= nMax) G4Exception("max Index number must be less than number of available shells");
|
|---|
| 197 | }
|
|---|
| 198 | for (G4int initIndex = a1; initIndex < n; initIndex++){
|
|---|
| 199 |
|
|---|
| 200 | G4int startingShellId = dataSet->StartShellId(Z, vacancyIndex, initIndex);
|
|---|
| 201 |
|
|---|
| 202 | G4cout << " The shell whose index is " <<initIndex
|
|---|
| 203 | << " has identity " << startingShellId << G4endl;
|
|---|
| 204 |
|
|---|
| 205 | G4int nAuger = dataSet->NumberOfAuger(Z, vacancyIndex, startingShellId);
|
|---|
| 206 |
|
|---|
| 207 | G4int a2 = 0;
|
|---|
| 208 | if (a == b) {
|
|---|
| 209 | G4cout <<" Being a transition electron from here, an auger electron could came from "
|
|---|
| 210 | << nAuger <<" shells."<<G4endl;
|
|---|
| 211 | G4cout << "Enter the index of the auger electron originating shell" << G4endl;
|
|---|
| 212 | G4cin >> a2;
|
|---|
| 213 | nMax=nAuger;
|
|---|
| 214 | nAuger = a2 +1;
|
|---|
| 215 |
|
|---|
| 216 | if (a2 >= nMax) G4Exception("max Index number must be less than number of available shells");
|
|---|
| 217 | }
|
|---|
| 218 |
|
|---|
| 219 | for (G4int augerIndex = a2; augerIndex < nAuger; augerIndex++){
|
|---|
| 220 |
|
|---|
| 221 | G4cout << " Testing StartShellEnergy..."<< G4endl;
|
|---|
| 222 |
|
|---|
| 223 | G4double startingShellEnergy = dataSet-> StartShellEnergy(Z, vacancyIndex, startingShellId, augerIndex);
|
|---|
| 224 |
|
|---|
| 225 | G4cout << " Testing StartShellProb..."<< G4endl;
|
|---|
| 226 |
|
|---|
| 227 | G4double startingShellProb = dataSet-> StartShellProb(Z, vacancyIndex, startingShellId, augerIndex);
|
|---|
| 228 | G4int augerShellId = dataSet-> AugerShellId(Z, vacancyIndex, startingShellId, augerIndex);
|
|---|
| 229 | G4cout <<" The identity of the starting shell is "<<augerShellId<<G4endl;
|
|---|
| 230 | G4cout<<" The energy of the transition to the final shell is "
|
|---|
| 231 | << startingShellEnergy<< " MeV "<<G4endl;
|
|---|
| 232 | G4cout<<" The probability of the transition to the final shell is "
|
|---|
| 233 | <<startingShellProb <<G4endl;
|
|---|
| 234 |
|
|---|
| 235 |
|
|---|
| 236 | G4cout <<" The identity of the auger originating shell is "<<augerShellId<<G4endl;
|
|---|
| 237 |
|
|---|
| 238 | }
|
|---|
| 239 | }
|
|---|
| 240 | }
|
|---|
| 241 |
|
|---|
| 242 | /*
|
|---|
| 243 | G4cout << "PRINT DATA"<<G4endl;
|
|---|
| 244 |
|
|---|
| 245 | dataSet->PrintData(Z);
|
|---|
| 246 | */
|
|---|
| 247 | delete dataSet;
|
|---|
| 248 | }
|
|---|
| 249 |
|
|---|
| 250 | G4cout << "END OF THE MAIN PROGRAM" << G4endl;
|
|---|
| 251 | }
|
|---|
| 252 |
|
|---|
| 253 |
|
|---|