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 /// \file RE06/src/RE06Run.cc 27 /// \brief Implementation of the RE06Run class 28 // 29 // 30 31 #include "RE06Run.hh" 32 33 #include "G4Event.hh" 34 #include "G4HCofThisEvent.hh" 35 #include "G4SDManager.hh" 36 37 //....oooOO0OOooo........oooOO0OOooo........oo 38 39 RE06Run::RE06Run() : G4Run() 40 { 41 G4String detName[6] = {"Calor-A_abs", "Calor 42 "Calor-B_gap", "Calor 43 44 G4String primNameSum[6] = {"eDep", "nGamma", 45 46 G4String primNameMin[3] = {"minEkinGamma", " 47 48 G4String paraName[3] = {"Calor-AP_para", "Ca 49 50 G4SDManager* SDMan = G4SDManager::GetSDMpoin 51 G4String fullName; 52 size_t i, j; 53 for (i = 0; i < 6; i++) { 54 for (j = 0; j < 6; j++) { 55 fullName = detName[i] + "/" + primNameSu 56 fColIDSum[i][j] = SDMan->GetCollectionID 57 } 58 for (j = 0; j < 3; j++) { 59 fullName = detName[i] + "/" + primNameMi 60 fColIDMin[i][j] = SDMan->GetCollectionID 61 } 62 } 63 for (i = 0; i < 3; i++) { 64 for (j = 0; j < 6; j++) { 65 fullName = paraName[i] + "/" + primNameS 66 fColIDPara[i][j] = SDMan->GetCollectionI 67 } 68 } 69 } 70 71 //....oooOO0OOooo........oooOO0OOooo........oo 72 73 RE06Run::~RE06Run() 74 { 75 ; 76 } 77 78 //....oooOO0OOooo........oooOO0OOooo........oo 79 80 void RE06Run::RecordEvent(const G4Event* evt) 81 { 82 G4HCofThisEvent* HCE = evt->GetHCofThisEvent 83 if (!HCE) return; 84 numberOfEvent++; 85 size_t i, j; 86 for (i = 0; i < 6; i++) { 87 for (j = 0; j < 6; j++) { 88 G4THitsMap<G4double>* evtMap = (G4THitsM 89 fMapSum[i][j] += *evtMap; 90 } 91 92 for (j = 0; j < 3; j++) { 93 G4THitsMap<G4double>* evtMap = (G4THitsM 94 std::map<G4int, G4double*>::iterator itr 95 for (; itr != evtMap->GetMap()->end(); i 96 G4int key = (itr->first); 97 G4double val = *(itr->second); 98 G4double* mapP = fMapMin[i][j][key]; 99 if (mapP && (val > *mapP)) continue; 100 fMapMin[i][j].set(key, val); 101 } 102 } 103 } 104 for (i = 0; i < 3; i++) { 105 for (j = 0; j < 6; j++) { 106 G4THitsMap<G4double>* evtMap = (G4THitsM 107 fMapPara[i][j] += *evtMap; 108 } 109 } 110 } 111 112 //....oooOO0OOooo........oooOO0OOooo........oo 113 void RE06Run::Merge(const G4Run* aRun) 114 { 115 const RE06Run* localRun = static_cast<const 116 117 for (G4int i = 0; i < 6; i++) { 118 for (G4int j = 0; j < 6; j++) { 119 fMapSum[i][j] += localRun->fMapSum[i][j] 120 } 121 122 for (G4int j = 0; j < 3; j++) { 123 std::map<G4int, G4double*>::iterator itr 124 for (; itr != localRun->fMapMin[i][j].Ge 125 G4int key = itr->first; 126 G4double val = *(itr->second); 127 G4double* mapP = fMapMin[i][j][key]; 128 if (!mapP || val < *mapP) fMapMin[i][j 129 } 130 } 131 } 132 133 for (G4int i = 0; i < 3; i++) { 134 for (G4int j = 0; j < 6; j++) { 135 fMapPara[i][j] += localRun->fMapPara[i][ 136 } 137 } 138 139 G4Run::Merge(aRun); 140 } 141 142 //....oooOO0OOooo........oooOO0OOooo........oo 143 G4double RE06Run::GetTotal(const G4THitsMap<G4 144 { 145 G4double tot = 0.; 146 if (map.GetSize() == 0) return tot; 147 std::map<G4int, G4double*>::iterator itr = m 148 for (; itr != map.GetMap()->end(); itr++) { 149 tot += *(itr->second); 150 } 151 return tot; 152 } 153 154 //....oooOO0OOooo........oooOO0OOooo........oo 155 156 G4double RE06Run::FindMinimum(const G4THitsMap 157 { 158 G4double val = DBL_MAX; 159 160 if (map.GetSize() == 0) return val; 161 std::map<G4int, G4double*>::iterator itr = m 162 for (; itr != map.GetMap()->end(); itr++) { 163 if (val > *(itr->second)) val = *(itr->sec 164 } 165 return val; 166 } 167 168 //....oooOO0OOooo........oooOO0OOooo........oo 169