void CRPropa2EventOutput3D::process(Candidate *c) const { char buffer[256]; // max. 256 characters per line size_t p = 0; // length of line p += sprintf(buffer + p, "%i ", convertToCRPropa2NucleusId(c->current.getId())); p += sprintf(buffer + p, "%i ", convertToCRPropa2NucleusId(c->source.getId())); const Vector3d &ipos = c->source.getPosition() / Mpc; p += sprintf(buffer + p, "%.4f %.4f %.4f ", ipos.x, ipos.y, ipos.z); double iPhi = c->source.getDirection().getPhi(); double iTheta = c->source.getDirection().getTheta(); double iE = c->source.getEnergy() / EeV; p += sprintf(buffer + p, "%.4f %.4f %.4f ", iE, iPhi, iTheta); double t = comoving2LightTravelDistance(c->getTrajectoryLength()) / Mpc; p += sprintf(buffer + p, "%.4f ", t); const Vector3d &pos = c->current.getPosition() / Mpc; p += sprintf(buffer + p, "%.4f %.4f %.4f ", pos.x, pos.y, pos.z); double phi = c->current.getDirection().getPhi(); double theta = c->current.getDirection().getTheta(); double E = c->current.getEnergy() / EeV; p += sprintf(buffer + p, "%.4f %.4f %.4f\n", E, phi, theta); #pragma omp critical outfile.write(buffer, p); }
void CRPropa2ROOTTrajectoryOutput3D::process(Candidate *c) const { Vector3d pos = c->current.getPosition(); Vector3d dir = c->current.getDirection(); TThread::Lock(); #pragma omp critical { Ntuple->Fill(c->current.getId(), c->source.getId(), comoving2LightTravelDistance(c->getTrajectoryLength()) / Mpc, comoving2LightTravelDistance(pos.x) / Mpc, comoving2LightTravelDistance(pos.y) / Mpc, comoving2LightTravelDistance(pos.z) / Mpc, dir.x, dir.y, dir.z, c->current.getEnergy() / EeV); } TThread::UnLock(); }
void CRPropa2ROOTTrajectoryOutput1D::process(Candidate *c) const { TThread::Lock(); #pragma omp critical { Ntuple->Fill(convertToCRPropa2NucleusId(c->current.getId()), convertToCRPropa2NucleusId(c->source.getId()), comoving2LightTravelDistance(c->current.getPosition().x) / Mpc, c->current.getEnergy() / EeV); } TThread::UnLock(); }
void CRPropa2TrajectoryOutput1D::process(Candidate *c) const { char buffer[256]; size_t p = 0; p += sprintf(buffer + p, "%.4f ", comoving2LightTravelDistance(c->current.getPosition().x) / Mpc); p += sprintf(buffer + p, "%i ", convertToCRPropa2NucleusId(c->current.getId())); p += sprintf(buffer + p, "%.4f\n", c->current.getEnergy() / EeV); #pragma omp critical outfile.write(buffer, p); }
void CRPropa2EventOutput1D::process(Candidate *c) const { char buffer[256]; size_t p = 0; p += sprintf(buffer + p, "%i ", convertToCRPropa2NucleusId(c->current.getId())); p += sprintf(buffer + p, "%.4f ", c->current.getEnergy() / EeV); double t = comoving2LightTravelDistance(c->getTrajectoryLength()) / Mpc; p += sprintf(buffer + p, "%.4f ", t); p += sprintf(buffer + p, "%i ", convertToCRPropa2NucleusId(c->source.getId())); p += sprintf(buffer + p, "%.4f\n", c->source.getEnergy() / EeV); #pragma omp critical outfile.write(buffer, p); }
void CRPropa2TrajectoryOutput3D::process(Candidate *c) const { char buffer[256]; size_t p = 0; p += sprintf(buffer + p, "%i ", convertToCRPropa2NucleusId(c->current.getId())); p += sprintf(buffer + p, "%i ", convertToCRPropa2NucleusId(c->source.getId())); double t = comoving2LightTravelDistance(c->getTrajectoryLength()) / Mpc; p += sprintf(buffer + p, "%.4f ", t); const Vector3d &pos = c->current.getPosition() / Mpc; p += sprintf(buffer + p, "%.4f %.4f %.4f ", pos.x, pos.y, pos.z); const Vector3d &mom = c->current.getMomentum() / EeV; p += sprintf(buffer + p, "%.4g %.4g %.4g ", mom.x, mom.y, mom.z); p += sprintf(buffer + p, "%.4f\n", c->current.getEnergy() / EeV); #pragma omp critical outfile.write(buffer, p); }
void CRPropa2EventOutput3D::process(Candidate *c) const { if (not (c->hasProperty("Detected"))) return; // remove flag so that the particle is not written to output again in the next step c->removeProperty("Detected"); char buffer[256]; // max. 256 characters per line size_t p = 0; // length of line p += sprintf(buffer + p, "%i ", convertToCRPropa2NucleusId(c->current.getId())); p += sprintf(buffer + p, "%i ", convertToCRPropa2NucleusId(c->source.getId())); const Vector3d &ipos = c->source.getPosition() / Mpc; p += sprintf(buffer + p, "%.4f %.4f %.4f ", ipos.x, ipos.y, ipos.z); double iPhi = c->source.getDirection().getPhi(); double iTheta = c->source.getDirection().getTheta(); double iE = c->source.getEnergy() / EeV; p += sprintf(buffer + p, "%.4f %.4f %.4f ", iE, iPhi, iTheta); double t = comoving2LightTravelDistance(c->getTrajectoryLength()) / Mpc; p += sprintf(buffer + p, "%.4f ", t); const Vector3d &pos = c->current.getPosition() / Mpc; p += sprintf(buffer + p, "%.4f %.4f %.4f ", pos.x, pos.y, pos.z); double phi = c->current.getDirection().getPhi(); double theta = c->current.getDirection().getTheta(); double E = c->current.getEnergy() / EeV; p += sprintf(buffer + p, "%.4f %.4f %.4f\n", E, phi, theta); #pragma omp critical { outfile.write(buffer, p); outfile.flush(); } }
void CRPropa2EventOutput1D::process(Candidate *c) const { if (not (c->hasProperty("Detected"))) return; // remove flag so that the particle is not written to output again in the next step c->removeProperty("Detected"); char buffer[256]; size_t p = 0; p += sprintf(buffer + p, "%i ", convertToCRPropa2NucleusId(c->current.getId())); p += sprintf(buffer + p, "%.4f ", c->current.getEnergy() / EeV); double t = comoving2LightTravelDistance(c->getTrajectoryLength()) / Mpc; p += sprintf(buffer + p, "%.4f ", t); p += sprintf(buffer + p, "%i ", convertToCRPropa2NucleusId(c->source.getId())); p += sprintf(buffer + p, "%.4f\n", c->source.getEnergy() / EeV); #pragma omp critical { outfile.write(buffer, p); outfile.flush(); } }
void CRPropa2ROOTEventOutput3D::process(Candidate *c) const { Vector3d ipos = c->source.getPosition(); Vector3d pos = c->current.getPosition(); TThread::Lock(); #pragma omp critical { Ntuple->Fill(convertToCRPropa2NucleusId(c->current.getId()), convertToCRPropa2NucleusId(c->source.getId()), comoving2LightTravelDistance(ipos.x) / Mpc, comoving2LightTravelDistance(ipos.y) / Mpc, comoving2LightTravelDistance(ipos.z) / Mpc, c->source.getEnergy() / EeV, c->source.getDirection().getTheta(), c->source.getDirection().getPhi(), comoving2LightTravelDistance(c->getTrajectoryLength()) / Mpc, comoving2LightTravelDistance(pos.x) / Mpc, comoving2LightTravelDistance(pos.y) / Mpc, comoving2LightTravelDistance(pos.z) / Mpc, c->current.getEnergy() / EeV, c->current.getDirection().getTheta(), c->current.getDirection().getPhi()); } TThread::UnLock(); }