Geant4 程序编写中的常用代码
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:xxxxxxx或QQ:xxxxxx 处理(尽可能给您提供完整文档),感谢您的支持与谅解。
} for(int i=0;iE2) { G4cout << \above \ return; } G4int index = static_cast ((E2-Energy)/dE); index = NCHN-1-index; if(index<0) index = 0; TData[index] += Data; } //Record tally data(single-channel). void MyDataRecorder::AddData(G4double Data) { TData[0] += Data; } //Calculating relative errors. void MyDataRecorder::CalErr() { for(G4int i=0;i1 && MyData[i]>0) { rerr[i]=sqrt( sumD2[i]- MyData[i]*MyData[i]/NPS )/MyData[i]; } } } //Updating data after each event, it should be called at the end of each event. void MyDataRecorder::UpdateThisEvent() { for(int i=0; i 1) { if(total>0) totalerr = sqrt( totalSD2 - total*total/NPS )/total; dataFile << std::scientific << std::setprecision(4) << \ << std::setprecision(5) << total/NPS/factor << \ << std::fixed << std::setprecision(4) << totalerr << G4endl; } //cnscott的博客 cnscott.blog.163.com dataFile << \ dataFile << \ dataFile << \ if(!message.isNull()) dataFile << message << G4endl; dataFile.close(); G4cout<< \\\\<< FileName << \is created instead.\<
Geant4 程序编写中的常用代码.doc
将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印