全文预览

Geant4 程序编写中的常用代码

上传者:非学无以广才 |  格式:docx  |  页数:12 |  大小:0KB

文档介绍
nel). void MyDataRecorder::AddData(G4double Energy,G4double Data) {if(Energy>E2) {G4cout <<"Warring: Partile energy \""<<Energy <<"Mev\" is above "<<E2/MeV <<"MeV" <<G4endl; return; }G4int index =static_cast<G4int> ((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;i<NCHN;i++) {if(NPS>1 &&MyData[i]>0) {rerr[i]=sqrt( sumD2[i]- MyData[i]*MyData[i]/NPS )/MyData[i]; }}}//Updating data after each event, itshould becalled atthe end ofeach event. void MyDataRecorder::UpdateThisEvent() {for(int i=0; i<NCHN; i++) {if( TData[i]!=0 ){MyData[i] +=TData[i]; sumD2[i] +=TData[i]*TData[i]; TData[i]=0;

收藏

分享

举报
下载此文档