zoukankan      html  css  js  c++  java
  • geant4 一些问题

    geant4 一些问题


    图形界面显示的问题

    报错: 

    1 libGL error: No matching fbConfigs or visuals found 
    2 libGL error: failed to load driver: swrast
    • 是显卡的问题,目前没有解决方法,但也没有影响。

    可视化界面中粒子径迹颜色含义

    • 电荷+,蓝色;不带电,绿色;电荷负,红色。
    • gamma,绿色;电子,红色;正电子,蓝色;中子,黄色;质子,蓝绿色。

    trackingAction是用来做什么的?

    • trackingAction和EventAvtion、steppingAction、runAction是四个在G4中需要继承的基类,但是steppingAction和trackingAction可以不去继承,如果使用了灵敏探测器,那么则不需要从steppingAction、trackingAction中提取信息。

    如何添加 stepAction ?

    1. 在代码中添加 steppingAction.hh 与 steppingAction.cc 文件。
    2. 在 ActionInitialization.cc 中,把 steppingAction 写入到 runManager 中。
       1 void ActionInitialization::Build() const
       2 {
       3   RootIO* rootIO = new RootIO(saveFlag);
       4   EventAction* eventAction = new EventAction();
       5 
       6   SetUserAction(new PrimaryGeneratorAction());
       7   SetUserAction(new RunAction(rootIO));
       8   SetUserAction(eventAction);
       9   SetUserAction(new SteppingAction(new DetectorConstruction(),
      10                                    eventAction,
      11                                    rootIO));
      12 }

    如何获取 particleName ?

    •  aStep->GetTrack()->GetDynamicParticle()->GetDefinition()->GetParticleName() 
    •  theTrack->GetDefinition()->GetParticleName() 
    •  track->GetParticleDefinition()->GetParticleName() 

    解决一个警告的报错

    In file included from /opt/root61206/include/TDirectory.h:24:0,
                     from /opt/root61206/include/TDirectoryFile.h:24,
                     from /opt/root61206/include/TFile.h:26,
                     from /media/DATA2T/han/Simulation/source/Si/src/EventAction.cc:19:
    /opt/root61206/include/TBuffer.h: In member function ‘virtual void TBuffer::ReadStdString(std::string&)’:
    /opt/root61206/include/TBuffer.h:287:54: warning: declaration of ‘s’ shadows a global declaration [-Wshadow]
        virtual inline void ReadStdString(std::string &s) { ReadStdString(&s); }
    • 是由于 G4SystemOfUnits.hh 头文件导致的,把不需要该头文件的位置注释掉即可,比如 RunAction,EventAction 类。
    • 除了在 DetectorConsitruction 和 PrimaryGeneratorAction 类中,其他地方都可以不需要 G4SystemOfUnits.hh 头文件。
    • 类似的问题可以参考 https://root-forum.cern.ch/t/silence-warning-messages-during-a-geant4-project-compilation/20525/12
  • 相关阅读:
    c#文件读取
    asp.net页面缓存学习
    JQuery学习
    如何在asp.net后台调用前台代码
    c#文件操作二
    oracler主键自动增长
    C#委托学习
    小技巧:DIV中显示字符不完整的解决方法
    英文名字的误区及起名方法
    SharePoint 2010 中提供的母版页
  • 原文地址:https://www.cnblogs.com/kurrrr/p/13661862.html
Copyright © 2011-2022 走看看