⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mt01eventaction.cc~

📁 利用linux环境下蒙特卡罗计算工具geant4实现伽玛射线与探测器乘积能量的模拟过程
💻 CC~
字号:
//// ********************************************************************// * DISCLAIMER                                                       *// *                                                                  *// * The following disclaimer summarizes all the specific disclaimers *// * of contributors to this software. The specific disclaimers,which *// * govern, are listed with their locations in:                      *// *   http://cern.ch/geant4/license                                  *// *                                                                  *// * Neither the authors of this software system, nor their employing *// * institutes,nor the agencies providing financial support for this *// * work  make  any representation or  warranty, express or implied, *// * regarding  this  software system or assume any liability for its *// * use.                                                             *// *                                                                  *// * This  code  implementation is the  intellectual property  of the *// * GEANT4 collaboration.                                            *// * By copying,  distributing  or modifying the Program (or any work *// * based  on  the Program)  you indicate  your  acceptance of  this *// * statement, and all its terms.                                    *// ********************************************************************////// $Id: ExN02EventAction.cc,v 1.10 2004/09/08 16:30:10 johna Exp $// GEANT4 tag $Name: geant4-07-00-patch-01 $////....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... #include "mt01EventAction.hh"#include "mt01RunAction.hh"#include "G4Event.hh"#include "G4EventManager.hh"#include "G4TrajectoryContainer.hh"#include "G4Trajectory.hh"#include "G4ios.hh"//#include "ExN04EventAction.hh"#include "mt01TrackerHit.hh"//#include "ExN04CalorimeterHit.hh"//#include "ExN04MuonHit.hh"#include "G4Event.hh"#include "G4EventManager.hh"#include "G4HCofThisEvent.hh"#include "G4VHitsCollection.hh"#include "G4TrajectoryContainer.hh"#include "G4Trajectory.hh"#include "G4VVisManager.hh"#include "G4SDManager.hh"#include "G4UImanager.hh"#include "G4ios.hh"//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... mt01EventAction::mt01EventAction(){}//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... mt01EventAction::~mt01EventAction(){}//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... void mt01EventAction::BeginOfEventAction(const G4Event*){}//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... void mt01EventAction::EndOfEventAction(const G4Event* evt){  G4int event_id = evt->GetEventID(); /* G4int myindex=0;   G4TrajectoryContainer* trajectoryContainer = evt->GetTrajectoryContainer();  G4int n_trajectories = 0;  if (trajectoryContainer) n_trajectories = trajectoryContainer->entries();        if(trackerCollID<0) return;   G4HCofThisEvent * HCE = evt->GetHCofThisEvent();  mt01TrackerHitsCollection* THC = 0;  if(HCE)  {    THC = (mt01TrackerHitsCollection*)(HCE->GetHC(trackerCollID));     }    if(THC)  {    int n_hit = THC->entries();      G4double totE = 0;    for(int i=0;i<n_hit;i++)    {      totE += (*THC)[i]->GetEdep();    }     myindex=(G4int)(totE / keV);     //energycount[myindex]=energycount[myindex]+1;        */  if( myindex<10000)       {     mytest[myindex]=mytest[myindex]+1; }// }/* switch(event_id){      case 99999:    myindex=(G4int)(EventEnergy);    energycount[myindex]=mytest[myindex]+mytest[myindex-1];   mytest[myindex]=0;   mytest[myindex-1]=0;   break;case 199999:   myindex=(G4int)(EventEnergy);    energycount[myindex]=mytest[myindex]+mytest[myindex-1];   mytest[myindex]=0;   mytest[myindex-1]=0;   break;case 299999: myindex=(G4int)(EventEnergy);   energycount[myindex]=mytest[myindex]+mytest[myindex-1];    mytest[myindex]=0;    mytest[myindex-1]=0;     break; case 399999: myindex=(G4int)(EventEnergy);  energycount[myindex]=mytest[myindex]+mytest[myindex-1];   mytest[myindex]=0;    mytest[myindex-1]=0;     break; case 499999: myindex=(G4int)(EventEnergy);  energycount[myindex]=mytest[myindex]+mytest[myindex-1];   mytest[myindex]=0;   mytest[myindex-1]=0;    break; case 599999: myindex=(G4int)(EventEnergy);  energycount[myindex]=mytest[myindex]+mytest[myindex-1];   mytest[myindex]=0;   mytest[myindex-1]=0;    break; case 699999: myindex=(G4int)(EventEnergy);   energycount[myindex]=mytest[myindex]+mytest[myindex-1];   mytest[myindex]=0;   mytest[myindex-1]=0;   break; case 799999: myindex=(G4int)(EventEnergy);  energycount[myindex]=mytest[myindex]+mytest[myindex-1];   mytest[myindex]=0;   mytest[myindex-1]=0;    break; case 899999: myindex=(G4int)(EventEnergy);   energycount[myindex]=mytest[myindex]+mytest[myindex-1];    mytest[myindex]=0;   mytest[myindex-1]=0;   break;  case 999999: myindex=(G4int)(EventEnergy);  energycount[myindex]=mytest[myindex]+mytest[myindex-1];   mytest[myindex]=0;   mytest[myindex-1]=0;    break; case 1099999: myindex=(G4int)(EventEnergy);   energycount[myindex]=mytest[myindex]+mytest[myindex-1];   mytest[myindex]=0;   mytest[myindex-1]=0;   break; case 1199999: myindex=(G4int)(EventEnergy);    energycount[myindex]=mytest[myindex]+mytest[myindex-1];   mytest[myindex]=0;   mytest[myindex-1]=0;   break;  case 1299999: myindex=(G4int)(EventEnergy);   energycount[myindex]=mytest[myindex]+mytest[myindex-1];   mytest[myindex]=0;   mytest[myindex-1]=0;   break; case 1399999: myindex=(G4int)(EventEnergy);  energycount[myindex]=mytest[myindex]+mytest[myindex-1];   mytest[myindex]=0;   mytest[myindex-1]=0;   break; case 1499999: myindex=(G4int)(EventEnergy);   energycount[myindex]=mytest[myindex]+mytest[myindex-1];   mytest[myindex]=0;   mytest[myindex-1]=0;   break; case 1599999: myindex=(G4int)(EventEnergy);   energycount[myindex]=mytest[myindex]+mytest[myindex-1];    mytest[myindex]=0;    mytest[myindex-1]=0;    break; case 1699999: myindex=(G4int)(EventEnergy);   energycount[myindex]=mytest[myindex]+mytest[myindex-1];   mytest[myindex]=0;    mytest[myindex-1]=0;    break; case 1799999: myindex=(G4int)(EventEnergy);  energycount[myindex]=mytest[myindex]+mytest[myindex-1];    mytest[myindex]=0;   mytest[myindex-1]=0;   break;case 1899999: myindex=(G4int)(EventEnergy);  energycount[myindex]=mytest[myindex]+mytest[myindex-1];    mytest[myindex]=0;   mytest[myindex-1]=0;   break; }*/}//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -