Geant4 Cross Reference |
1 // 1 2 // ******************************************* 3 // * License and Disclaimer 4 // * 5 // * The Geant4 software is copyright of th 6 // * the Geant4 Collaboration. It is provided 7 // * conditions of the Geant4 Software License 8 // * LICENSE and available at http://cern.ch/ 9 // * include a list of copyright holders. 10 // * 11 // * Neither the authors of this software syst 12 // * institutes,nor the agencies providing fin 13 // * work make any representation or warran 14 // * regarding this software system or assum 15 // * use. Please see the license in the file 16 // * for the full disclaimer and the limitatio 17 // * 18 // * This code implementation is the result 19 // * technical work of the GEANT4 collaboratio 20 // * By using, copying, modifying or distri 21 // * any work based on the software) you ag 22 // * use in resulting scientific publicati 23 // * acceptance of all terms of the Geant4 Sof 24 // ******************************************* 25 // 26 // Authors: Susanna Guatelli and Francesco Rom 27 // susanna@uow.edu.au, francesco.romano@ct.inf 28 // 29 30 #include <stdlib.h> 31 #include "AnalysisManager.hh" 32 #include "G4UnitsTable.hh" 33 #include "G4SystemOfUnits.hh" 34 35 #include "AnalysisMessenger.hh" 36 37 AnalysisManager::AnalysisManager(AnalysisMesse 38 { 39 factoryOn = false; 40 41 // Initialization 42 // histograms 43 //for (G4int k=0; k<MaxHisto; k++) fHistId[k 44 45 // Initialization ntuple 46 for (G4int k=0; k<MaxNtCol; k++) fNtColId[k] 47 48 //h10 = 0; 49 //h20 = 0; 50 51 messenger = analysisMessenger; 52 } 53 54 AnalysisManager::~AnalysisManager() 55 { 56 } 57 58 void AnalysisManager::book(G4bool addExtraNt) 59 { 60 G4AnalysisManager* manager = G4AnalysisManag 61 62 manager->SetVerboseLevel(2); 63 64 extraNt = addExtraNt; 65 66 usingRoot = messenger -> IsRootOutput(); 67 68 // Create an output file 69 G4String fileName; 70 if( usingRoot == true ) fileName = "experime 71 else fileName = "experimental_microdosimetry 72 73 // Create directories (not supported by csv) 74 if( usingRoot == true ) manager->SetNtupleDi 75 76 77 G4bool fileOpen = manager->OpenFile(fileName 78 if (!fileOpen) { 79 G4cout << "\n---> HistoManager::book(): ca 80 << fileName << G4endl; 81 return; 82 } 83 84 manager->SetFirstNtupleId(1); 85 86 //Create Primary Energy Ntuple 87 manager -> CreateNtuple("101", "Primary Ener 88 fNtColId[0] = manager -> CreateNtupleDColumn 89 manager -> FinishNtuple(); 90 91 //Create Energy Deposition and Path Length w 92 manager -> CreateNtuple("102", "Edep"); 93 fNtColId[1] = manager -> CreateNtupleDColumn 94 fNtColId[2] = manager -> CreateNtupleDColumn 95 if( extraNt == true ) fNtColId[3] = manager 96 manager -> FinishNtuple(); 97 98 //creating a ntuple, containing the informat 99 manager -> CreateNtuple("103", "secondary"); 100 fNtColId[4] = manager -> CreateNtupleDColumn 101 fNtColId[5] = manager -> CreateNtupleDColumn 102 fNtColId[6] = manager -> CreateNtupleDColumn 103 manager -> FinishNtuple(); 104 105 // if the telescope is in use, add an exta n 106 if( extraNt == true) 107 { 108 manager -> CreateNtuple("104", "secondSt 109 fNtColId[7] = manager -> CreateNtupleDCo 110 fNtColId[8] = manager -> CreateNtupleICo 111 manager -> FinishNtuple(); 112 } 113 114 factoryOn = true; 115 } 116 117 118 void AnalysisManager::SetPrimaryEnergy(G4doubl 119 { 120 G4AnalysisManager* manager = G4AnalysisManag 121 manager -> FillNtupleDColumn(1, fNtColId[0], 122 manager -> AddNtupleRow(1); 123 } 124 125 void AnalysisManager::StoreEnergyDeposition(G4 126 { 127 G4AnalysisManager* manager = G4AnalysisManag 128 manager -> FillNtupleDColumn(2, fNtColId[1], 129 manager -> FillNtupleDColumn(2, fNtColId[2], 130 if( extraNt == true ) manager -> FillNtupleI 131 // the event ID is only useful when the 4t 132 manager -> AddNtupleRow(2); 133 } 134 135 void AnalysisManager::FillSecondaries(G4int AA 136 { 137 138 G4AnalysisManager* manager = G4AnalysisManag 139 manager -> FillNtupleDColumn(3, fNtColId[4], 140 manager -> FillNtupleDColumn(3, fNtColId[5], 141 manager -> FillNtupleDColumn(3, fNtColId[6], 142 manager -> AddNtupleRow(3); 143 } 144 145 void AnalysisManager::StoreSecondStageEnergyDe 146 { 147 if( extraNt == true ) 148 { 149 G4AnalysisManager* manager = G4AnalysisMan 150 manager -> FillNtupleDColumn(4, fNtColId[7 151 manager -> FillNtupleIColumn(4, fNtColId[8 152 manager -> AddNtupleRow(4); 153 } 154 } 155 156 void AnalysisManager::finish() 157 { 158 if (factoryOn) 159 { 160 G4AnalysisManager* manager = G4AnalysisMan 161 manager -> Write(); 162 manager -> CloseFile(); 163 factoryOn = false; 164 } 165 } 166 167 168 169 170 171 172 173 174 175 176 177 178 179