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 // 27 /// \file PhysChemIO.cc 28 /// \brief Implementation of the PhysChemIO cl 29 30 #include "PhysChemIO.hh" 31 #include "SteppingAction.hh" 32 #include "Analysis.hh" 33 #include "G4Track.hh" 34 #include "G4NavigationHistory.hh" 35 #include "G4RunManager.hh" 36 37 #ifdef USE_MPI 38 #include "G4MPImanager.hh" 39 #endif 40 41 //....oooOO0OOooo........oooOO0OOooo........oo 42 43 PhysChemIO::PhysChemIO(SteppingAction* stepAct 44 fSteppingAction(stepAction) 45 {;} 46 47 //....oooOO0OOooo........oooOO0OOooo........oo 48 49 void PhysChemIO::CreateWaterMolecule(G4int ele 50 G4double / 51 const G4Tr 52 { 53 //L.T. Anh: to correct electronicLevel in 54 //see in G4DNAChemistryManager::CreateWate 55 electronicLevel = 4 - electronicLevel; 56 //Rel pos 57 G4ThreeVector relPos; 58 auto touchable = theIncomingTrack->GetStep 59 relPos = touchable->GetHistory()->GetTopTr 60 61 // Get the flag of the current volume 62 G4int volumeFlag =fSteppingAction->SetupVo 63 theIncomingTrack->GetStep()->GetPreSte 64 65 if( volumeFlag == 161 // voxelStraight 66 || volumeFlag == 162 // voxelRight 67 || volumeFlag == 163 // voxelLeft 68 || volumeFlag == 164 // voxelUp 69 || volumeFlag == 165 // voxelDown 70 || volumeFlag == 261 // voxelStraight 71 || volumeFlag == 262 // voxelRight2 72 || volumeFlag == 263 // voxelLeft2 73 || volumeFlag == 264 // voxelUp2 74 || volumeFlag == 265) // voxelDown2 75 { 76 // Get the volume copy number 77 G4int volumeCpNum = touchable->GetCopy 78 //theIncomingTrack->GetStep()->GetPreS 79 80 // Default flag values 81 G4String motherVolumeName = ""; 82 G4int motherVolumeFlag = -1; 83 G4int motherVolumeCpNum = -1; 84 85 // Mother volume informations 86 87 // Be sure there is a mother volume to 88 if(theIncomingTrack->GetStep()->GetPre 89 { 90 G4VPhysicalVolume* motherVol = the 91 92 // General infos 93 motherVolumeName = motherVol->GetN 94 motherVolumeFlag = fSteppingAction 95 motherVolumeCpNum = motherVol->Get 96 } 97 G4int eventId = G4RunManager::GetRunMa 98 #ifdef USE_MPI 99 auto g4MPI = G4MPImanager::GetManager( 100 if (g4MPI->IsSlave()) { // update even 101 G4int rank = g4MPI->GetRank(); 102 eventId += g4MPI->GetEventsInMaste 103 } 104 #endif 105 106 InfoForChemGeo aInfo; 107 aInfo.fType = 1; // water=1 108 aInfo.fState = electronicModif ; 109 aInfo.fElectronicLevel = electronicLev 110 aInfo.fX = theIncomingTrack->GetPositi 111 aInfo.fY = theIncomingTrack->GetPositi 112 aInfo.fZ = theIncomingTrack->GetPositi 113 aInfo.fParentTrackID = theIncomingTrac 114 aInfo.fEventNumber = eventId; 115 aInfo.fVolume = volumeFlag ; 116 aInfo.fVolumeCopyNumber = volumeCpNum; 117 aInfo.fMotherVolume = motherVolumeFlag 118 aInfo.fMotherVolumeCopyNumber = mother 119 aInfo.fRelX = relPos.x()/nm; 120 aInfo.fRelY = relPos.y()/nm; 121 aInfo.fRelZ = relPos.z()/nm; 122 Analysis::GetAnalysis()->AddInfoForChe 123 } 124 } 125 126 //....oooOO0OOooo........oooOO0OOooo........oo 127 128 void PhysChemIO::CreateSolvatedElectron(const 129 { 130 G4ThreeVector pos; 131 if(finalPosition) pos = *finalPosition; 132 else pos = theIncomingTrack->GetPosition() 133 134 // Rel pos 135 G4ThreeVector relPos; 136 const G4VTouchable* touchable = theIncomin 137 relPos = touchable->GetHistory()->GetTopTr 138 139 // Current volume infos 140 G4int volumeFlag = fSteppingAction->SetupV 141 theIncomingTrack->GetStep()->GetPreSte 142 if( volumeFlag == 161 // voxelStraight 143 || volumeFlag == 162 // voxelRight 144 || volumeFlag == 163 // voxelLeft 145 || volumeFlag == 164 // voxelUp 146 || volumeFlag == 165 // voxelDown 147 || volumeFlag == 261 // voxelStraight 148 || volumeFlag == 262 // voxelRight2 149 || volumeFlag == 263 // voxelLeft2 150 || volumeFlag == 264 // voxelUp2 151 || volumeFlag == 265) // voxelDown2 152 { 153 G4int volumeCpNum = touchable->GetCopy 154 155 G4String motherVolumeName = ""; 156 G4int motherVolumeFlag = -1; 157 G4int motherVolumeCpNum = -1; 158 159 // Mother volume informations 160 // Be sure there is a mother volume to 161 if(theIncomingTrack->GetStep()->GetPre 162 { 163 G4VPhysicalVolume* motherVol = the 164 // General infos 165 motherVolumeName = motherVol->GetN 166 motherVolumeFlag = fSteppingAction 167 motherVolumeCpNum = motherVol->Get 168 } 169 G4int eventId = G4RunManager::GetRunMa 170 #ifdef USE_MPI 171 auto g4MPI = G4MPImanager::GetManager( 172 if (g4MPI->IsSlave()) { // update even 173 G4int rank = g4MPI->GetRank(); 174 eventId += g4MPI->GetEventsInMaste 175 } 176 #endif 177 178 InfoForChemGeo aInfo; 179 aInfo.fType = 2; // / solvated electro 180 aInfo.fState = -1; // no state for sol 181 aInfo.fElectronicLevel = -1; // no ele 182 aInfo.fX = pos.x()/nm; 183 aInfo.fY = pos.y()/nm; 184 aInfo.fZ = pos.z()/nm; 185 aInfo.fParentTrackID = theIncomingTrac 186 aInfo.fEventNumber = eventId; 187 aInfo.fVolume = volumeFlag ; 188 aInfo.fVolumeCopyNumber = volumeCpNum 189 aInfo.fMotherVolume = motherVolumeFlag 190 aInfo.fMotherVolumeCopyNumber = mothe 191 aInfo.fRelX = relPos.x()/nm; 192 aInfo.fRelY = relPos.y()/nm; 193 aInfo.fRelZ = relPos.z()/nm; 194 Analysis::GetAnalysis()->AddInfoForChe 195 } 196 } 197 198 //....oooOO0OOooo........oooOO0OOooo........oo