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] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /processes/electromagnetic/dna/utils/src/G4PhysChemIO.cc (Version 11.3.0) and /processes/electromagnetic/dna/utils/src/G4PhysChemIO.cc (Version 4.1)


  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  * G4PhysChemIO.cc                                
 28  *                                                
 29  *  Created on: 3 févr. 2017                     
 30  *      Author: matkara                           
 31  */                                               
 32                                                   
 33 #include "G4PhysChemIO.hh"                        
 34 #include "G4SystemOfUnits.hh"                     
 35 #include "G4Track.hh"                             
 36 #include "G4VAnalysisManager.hh"                  
 37                                                   
 38 using namespace std;                              
 39                                                   
 40 //--------------------------------------------    
 41                                                   
 42 namespace G4PhysChemIO{                           
 43                                                   
 44 FormattedText::FormattedText(){                   
 45   fRunID = -1;                                    
 46   fEventID = -1;                                  
 47   fFileInitialized = false;                       
 48 }                                                 
 49                                                   
 50 //--------------------------------------------    
 51                                                   
 52 FormattedText::~FormattedText(){                  
 53   CloseFile();                                    
 54 }                                                 
 55                                                   
 56 //--------------------------------------------    
 57                                                   
 58 void FormattedText::InitializeFile()              
 59 {                                                 
 60   if(fFileInitialized) return;                    
 61                                                   
 62   fOfstream << std::setprecision(6) << std::sc    
 63   fOfstream << setw(11) << left << "#Parent ID    
 64   << setw(14) << "Elec Modif" << setw(13) << "    
 65   << setw(22) << "X pos of parent [nm]" << set    
 66   << "Y pos of parent [nm]" << setw(22) << "Z     
 67   << setw(14) << "X pos [nm]" << setw(14) << "    
 68   << setw(14) << "Z pos [nm]" << G4endl<< setw    
 69   << setw(13) << "1)io/ex=0/1"                    
 70   << G4endl                                       
 71   << setw(21) << "#"                              
 72   << setw(13) << "2)level=0...5"                  
 73   << G4endl;                                      
 74                                                   
 75   fFileInitialized = true;                        
 76 }                                                 
 77                                                   
 78 //--------------------------------------------    
 79                                                   
 80 void FormattedText::WriteInto(const G4String&     
 81                               ios_base::openmo    
 82 {                                                 
 83   fOfstream.open(output.data(), mode);            
 84   fFileInitialized = false;                       
 85 }                                                 
 86                                                   
 87 //--------------------------------------------    
 88                                                   
 89 void FormattedText::AddEmptyLineInOutputFile()    
 90 {                                                 
 91   if(fFileInitialized) fOfstream << G4endl;       
 92 }                                                 
 93                                                   
 94 //--------------------------------------------    
 95                                                   
 96 void FormattedText::CloseFile()                   
 97 {                                                 
 98   if (!fFileInitialized) return;                  
 99                                                   
100   if (fOfstream.is_open())                        
101   {                                               
102     fOfstream.close();                            
103   }                                               
104 }                                                 
105                                                   
106 //--------------------------------------------    
107                                                   
108 void FormattedText::CreateWaterMolecule(G4int     
109                                         G4int     
110                                         G4doub    
111                                         const     
112 {                                                 
113   if(!fFileInitialized) InitializeFile();         
114                                                   
115   fOfstream << setw(11) << left << theIncoming    
116   << setw(10) << "H2O" << left << modification    
117   << ":" << right << electronicLevel << left <    
118   << std::setprecision(2) << std::fixed << set    
119   << energy / eV << std::setprecision(6) << st    
120   << setw(22)                                     
121   << (theIncomingTrack->GetPosition().x()) / n    
122   << setw(22)                                     
123   << (theIncomingTrack->GetPosition().y()) / n    
124   << setw(22)                                     
125   << (theIncomingTrack->GetPosition().z()) / n    
126   << G4endl;                                      
127 }                                                 
128                                                   
129 //--------------------------------------------    
130                                                   
131 void FormattedText::CreateSolvatedElectron(con    
132                                            G4T    
133 {                                                 
134   if(!fFileInitialized) InitializeFile();         
135                                                   
136   fOfstream << setw(11) << theIncomingTrack->G    
137   << "e_aq" << setw(14) << -1 << std::setpreci    
138   << std::fixed << setw(13)                       
139   << theIncomingTrack->GetKineticEnergy() / eV    
140   << std::setprecision(6) << std::scientific <    
141   << (theIncomingTrack->GetPosition().x()) / n    
142   << setw(22)                                     
143   << (theIncomingTrack->GetPosition().y()) / n    
144   << setw(22)                                     
145   << (theIncomingTrack->GetPosition().z()) / n    
146                                                   
147   if (finalPosition != nullptr)                   
148   {                                               
149     fOfstream << setw(14) << (finalPosition->x    
150     << (finalPosition->y()) / nanometer << set    
151     << (finalPosition->z()) / nanometer;          
152   }                                               
153                                                   
154   fOfstream << G4endl;                            
155 }                                                 
156                                                   
157 //--------------------------------------------    
158 //                                                
159 // Using G4analysis                               
160 //                                                
161                                                   
162 G4Analysis::G4Analysis(G4VAnalysisManager* ana    
163 fpAnalysisManager(analysisManager)                
164 {                                                 
165   fFileInitialized = false;                       
166   fNtupleID = -1;                                 
167 }                                                 
168                                                   
169 //--------------------------------------------    
170                                                   
171 G4Analysis::~G4Analysis()                         
172 {                                                 
173   fpAnalysisManager = nullptr;                    
174 }                                                 
175                                                   
176 //--------------------------------------------    
177                                                   
178 void G4Analysis::InitializeFile()                 
179 {                                                 
180   if (fFileInitialized) return;                   
181                                                   
182   fNtupleID = fpAnalysisManager->CreateNtuple(    
183   fpAnalysisManager->CreateNtupleIColumn(fNtup    
184   fpAnalysisManager->CreateNtupleSColumn(fNtup    
185                                                   
186   //------------------------------------------    
187   // valid for H2O only                           
188   fpAnalysisManager->CreateNtupleIColumn(fNtup    
189   // ionization = 0 / excitation = 1 / diss at    
190   fpAnalysisManager->CreateNtupleIColumn(fNtup    
191   // valid for ion and exc only                   
192   fpAnalysisManager->CreateNtupleDColumn(fNtup    
193   // valid for ion and exc only                   
194                                                   
195   //------------------------------------------    
196   fpAnalysisManager->CreateNtupleDColumn(fNtup    
197   fpAnalysisManager->CreateNtupleDColumn(fNtup    
198   fpAnalysisManager->CreateNtupleDColumn(fNtup    
199   fpAnalysisManager->CreateNtupleDColumn(fNtup    
200   fpAnalysisManager->CreateNtupleDColumn(fNtup    
201   fpAnalysisManager->CreateNtupleDColumn(fNtup    
202   fpAnalysisManager->FinishNtuple(fNtupleID);     
203                                                   
204   fFileInitialized = true;                        
205 }                                                 
206                                                   
207 //--------------------------------------------    
208                                                   
209 void G4Analysis::WriteInto(const G4String& out    
210                            ios_base::openmode)    
211 {                                                 
212   fpAnalysisManager->OpenFile(output);            
213   fFileInitialized = false;                       
214 }                                                 
215                                                   
216 //--------------------------------------------    
217                                                   
218 void G4Analysis::CloseFile()                      
219 {                                                 
220 //  fpAnalysisManager->Write();                   
221 //  fpAnalysisManager->CloseFile();               
222 }                                                 
223                                                   
224 //--------------------------------------------    
225                                                   
226 void G4Analysis::CreateWaterMolecule(G4int mod    
227                                      G4int ele    
228                                      G4double     
229                                      const G4T    
230 {                                                 
231   if(!fFileInitialized) InitializeFile();         
232                                                   
233   // parent ID                                    
234   fpAnalysisManager->FillNtupleIColumn(fNtuple    
235                                        theInco    
236                                                   
237   // molecule type                                
238   fpAnalysisManager->FillNtupleSColumn(fNtuple    
239                                                   
240   //------------------------------------------    
241   // valid for H2O only                           
242                                                   
243   // electronic modif                             
244   fpAnalysisManager->FillNtupleIColumn(fNtuple    
245   // ionization = 0 / excitation = 1 / diss at    
246   fpAnalysisManager->FillNtupleIColumn(fNtuple    
247   fpAnalysisManager->FillNtupleDColumn(fNtuple    
248                                                   
249   //------------------------------------------    
250   const G4ThreeVector& parentPos = theIncoming    
251                                                   
252   fpAnalysisManager->FillNtupleDColumn(fNtuple    
253   fpAnalysisManager->FillNtupleDColumn(fNtuple    
254   fpAnalysisManager->FillNtupleDColumn(fNtuple    
255                                                   
256   fpAnalysisManager->FillNtupleDColumn(fNtuple    
257   fpAnalysisManager->FillNtupleDColumn(fNtuple    
258   fpAnalysisManager->FillNtupleDColumn(fNtuple    
259   fpAnalysisManager->AddNtupleRow(fNtupleID);     
260 }                                                 
261                                                   
262 //--------------------------------------------    
263                                                   
264 void G4Analysis::CreateSolvatedElectron(const     
265                                         G4Thre    
266 {                                                 
267   if(!fFileInitialized) InitializeFile();         
268                                                   
269   // parent ID                                    
270   fpAnalysisManager->FillNtupleIColumn(fNtuple    
271                                        electro    
272                                                   
273   // molecule type                                
274   fpAnalysisManager->FillNtupleSColumn(fNtuple    
275                                                   
276   //------------------------------------------    
277   // valid for H2O only                           
278                                                   
279   // electronic modif                             
280   fpAnalysisManager->FillNtupleIColumn(fNtuple    
281   fpAnalysisManager->FillNtupleIColumn(fNtuple    
282   fpAnalysisManager->FillNtupleDColumn(fNtuple    
283                                        electro    
284                                                   
285   //------------------------------------------    
286   const G4ThreeVector& parentPos = electronTra    
287   const double i_nm = 1./nanometer;               
288                                                   
289   fpAnalysisManager->FillNtupleDColumn(fNtuple    
290   fpAnalysisManager->FillNtupleDColumn(fNtuple    
291   fpAnalysisManager->FillNtupleDColumn(fNtuple    
292                                                   
293   if (finalPosition != nullptr)                   
294   {                                               
295     fpAnalysisManager->FillNtupleDColumn(fNtup    
296     fpAnalysisManager->FillNtupleDColumn(fNtup    
297     fpAnalysisManager->FillNtupleDColumn(fNtup    
298   }                                               
299   else                                            
300   {                                               
301     fpAnalysisManager->FillNtupleDColumn(fNtup    
302     fpAnalysisManager->FillNtupleDColumn(fNtup    
303     fpAnalysisManager->FillNtupleDColumn(fNtup    
304   }                                               
305                                                   
306   fpAnalysisManager->AddNtupleRow(fNtupleID);     
307 }                                                 
308 }                                                 
309