zoukankan      html  css  js  c++  java
  • geant4 trackingAction

    geant4 trackingAction


    在 tractAction 类中实现的 PreUserTrackingAction(const G4Track* theTrack) 和 PostUserTrackingAction(const G4Track* theTrack) 的区别 ?

    通过输出,判断两者的区别

    PreUserTrackingAction track ID = 1
    PreUserTrackingAction parent ID = 0
    PreUserTrackingAction Current Step ID = 0
    PreUserTrackingAction Particle = Am241
    PreUserTrackingAction Position = (0,0,0)
    PreUserTrackingAction KineticEnergy = 0
    PreUserTrackingAction Momentum = (0,0,-0)
    PreUserTrackingAction GlobalTime = 0
    PreUserTrackingAction LocalTime = 0
    PreUserTrackingAction ProperTime = 0
    
    PostUserTrackingAction track ID = 1
    PostUserTrackingAction parent ID = 0
    PostUserTrackingAction Current Step ID = 1
    PostUserTrackingAction Particle = Am241
    PostUserTrackingAction Position = (0,0,0)
    PostUserTrackingAction KineticEnergy = 0
    PostUserTrackingAction Momentum = (0,0,-0)
    PostUserTrackingAction GlobalTime = 4.03267e+18
    PostUserTrackingAction LocalTime = 4.03267e+18
    PostUserTrackingAction ProperTime = 4.03267e+18
    
    
    PreUserTrackingAction track ID = 3
    PreUserTrackingAction parent ID = 1
    PreUserTrackingAction Current Step ID = 0
    PreUserTrackingAction Particle = alpha
    PreUserTrackingAction Position = (0,0,0)
    PreUserTrackingAction KineticEnergy = 5.4429
    PreUserTrackingAction Momentum = (16.6282,-161.089,-119.912)
    PreUserTrackingAction GlobalTime = 4.03267e+18
    PreUserTrackingAction LocalTime = 0
    PreUserTrackingAction ProperTime = 0
    
    PostUserTrackingAction track ID = 3
    PostUserTrackingAction parent ID = 1
    PostUserTrackingAction Current Step ID = 154
    PostUserTrackingAction Particle = alpha
    PostUserTrackingAction Position = (1.48547,-13.0785,-9.85898)
    PostUserTrackingAction KineticEnergy = 0
    PostUserTrackingAction Momentum = (0,-0,-0)
    PostUserTrackingAction GlobalTime = 4.03267e+18
    PostUserTrackingAction LocalTime = 1.10012
    PostUserTrackingAction ProperTime = 1.09875
    • PreUserTrackingAction() 和 PostUserTrackingAction() 指的是同一个 track.
    • PreUserTrackingAction() 返回的是该 track 第一个 step 提取出的信息。
    • PostUserTrackingAction() 返回的是该 track 最后一个step 提取出的信息。

    从 trackAction 中可以提取哪些信息?

    • trackID
    • parent ID
    • current step ID
    • particle name
    • current step position
    • current step kinetic energy
    • current step momentum
    • golbal time: 从 event 起点到当前 step 的时间,单位是 ns
    • local time: 从 tarck 起点到当前 step 的时间
    • proper time: time in its rest frame since the track was created

    解释 GlobalTime

    使用 241Am 放射源,其半衰期为 432.6 y,模拟 10w 次事件,提取 trackID = 1 时,postuserTrackingAction 中的 GlobalTime. 理论上,将提取得到的 GlobalTime 做直方图,是指数衰减的曲线。实际的模拟结果如下,这里横坐标是 GlobalTime/432.6y 的结果,理论上该曲线为 $y = 100000e^{-0.693t}$,实际的拟合结果很接近。

    代码如下:Am241Life.cc

     1 const double half_life = 432.6*365*24*3600*1000000000;
     2 
     3 void Am241Life()
     4 {
     5   ifstream file;
     6   file.open("hanX3Copy", ifstream::in);
     7   if (!file) {
     8     cout << "cannot open the file." << endl;
     9     return ;
    10   }
    11 
    12   cout << "half time = " << half_life << endl;
    13   vector<double> life_unit;
    14   double life_ns;
    15   
    16   while (1) {
    17     file >> life_ns;
    18     if (!file.good()) break;
    19     life_unit.push_back((double)life_ns/half_life);
    20   }
    21 
    22   file.close();
    23 
    24   cout << life_unit.size() << endl;
    25   for (int i=0; i<10; i++) {
    26     cout << life_unit[i] << endl;
    27   }
    28 
    29   TH1D* h1 = new TH1D("h1","h1",10,0.,10.);
    30   vector<double>::iterator it;
    31   for (it = life_unit.begin() ; it != life_unit.end(); ++it) {
    32     h1->Fill(*it);
    33   }
    34 
    35   h1->Draw();
    36 }

    这说明,在使用时间作为 kill track 的限制时,要排除掉第一个 trackID 的 GlobalTime.

  • 相关阅读:
    Codeforces Round #313 (Div. 2) D. Equivalent Strings 解题心得
    UVA
    2015 HUAS Summer Contest#1~A
    2015 HUAS Summer Training#2~D
    2015 HUAS Summer Training#2~C
    2015 HUAS Summer Training#2~E
    2015 HUAS Summer Training#2~A
    2015 HUAS Provincial Select Contest #1
    2015 HUAS Provincial Select Contest #1~F
    2015 HUAS Provincial Select Contest #2~A
  • 原文地址:https://www.cnblogs.com/kurrrr/p/13704060.html
Copyright © 2011-2022 走看看