Exemple #1
0
void EGS_TrackScoring::setApplication(EGS_Application *App) {
    EGS_AusgabObject::setApplication(App);
    if( !app ) return;
    if( m_pts ) { delete m_pts; m_pts = 0; }
    if( m_bufSize < 1 ) m_bufSize = 1024;
    string fname(app->getOutputFile()); fname += m_fnExtra;
    if( !egsIsAbsolutePath(fname) ) fname = egsJoinPath(app->getAppDir(),fname);
    int i_parallel = -1;
    if( app->getNparallel() > 1 ) i_parallel = app->getIparallel();
    if( i_parallel >= 0 ) {
        char buf[16]; sprintf(buf,"_w%d",i_parallel); fname += buf;
    }
    fname += ".ptracks";
    m_pts = new EGS_ParticleTrackContainer(fname.c_str(),m_bufSize);

    description = "\nParticle Track Scoring (";
    description += name; description += ")\n";
    description += "======================================================\n";
    description += " - Scoring photon tracks       = ";
    description += m_score_photons ? "YES\n" : "NO\n";
    description += " - Scoring electron tracks     = ";
    description += m_score_electrons ? "YES\n" : "NO\n";
    description += " - Scoring positron tracks     = ";
    description += m_score_positrons ? "YES\n" : "NO\n";
    description += " - First event to score        = ";
    char buf[32];
    sprintf(buf,"%lld\n",m_start); description += buf;
    description += " - Last event to score         = ";
    sprintf(buf,"%lld\n",m_stop); description += buf;
    description += " - Track buffer size           = ";
    sprintf(buf,"%d\n",m_bufSize); description += buf;
    description += " - Output file name            = "; description += fname;
    description += "\n\n";
}
EGS_ObjectFactory::EGS_ObjectFactory(const string &dsoPath, int where) {
    //egsWarning("Creating object factory at 0x%x\n",this);
    if (egsIsAbsolutePath(dsoPath)) {
        dso_path = dsoPath;
    }
    else {
        static const char *locations[] = {"HEN_HOUSE","EGS_HOME"};
        int i = !where ? 0 : 1;
        char *loc = getenv(locations[i]);
        if (!loc)
            egsFatal("EGS_ObjectFactory: the environment variable "
                     "%s must be defined\n",locations[i]);
        dso_path = egsJoinPath(loc,dsoPath);
    }
}