37 #ifndef EGS_PHSP_SCORING_
38 #define EGS_PHSP_SCORING_
47 #ifdef BUILD_PHSP_SCORING_DLL
48 #define EGS_PHSP_SCORING_EXPORT __declspec(dllexport)
50 #define EGS_PHSP_SCORING_EXPORT __declspec(dllimport)
52 #define EGS_PHSP_SCORING_LOCAL
56 #ifdef HAVE_VISIBILITY
57 #define EGS_PHSP_SCORING_EXPORT __attribute__ ((visibility ("default")))
58 #define EGS_PHSP_SCORING_LOCAL __attribute__ ((visibility ("hidden")))
60 #define EGS_PHSP_SCORING_EXPORT
61 #define EGS_PHSP_SCORING_LOCAL
260 if (ocharge==0 || 1+abs(app->top_p.q)==ocharge) {
262 int ir = app->top_p.ir;
263 int latch = app->top_p.latch;
266 if (!(latch & bsmc()) || (oformat==0 && score_mc)) {
269 phsp_before = phsp_geom->isInside(x);
273 phsp_after = phsp_geom->isInside(x);
274 if (phsp_after != phsp_before) {
275 if (scoredir == 0 || (scoredir == 1 && phsp_after) ||
276 (scoredir == 2 && phsp_before)) {
277 storeParticle(current_case);
280 latch = (latch | bsmc());
281 app->setLatch(latch);
286 else if (score_type==1) {
293 if (from_to[ir_before].size()>0 && ir_before != ir_after) {
294 for (
int i=0; i< from_to[ir_before].size(); i++) {
295 if (ir_after == from_to[ir_before][i]) {
296 storeParticle(current_case);
297 latch = (latch | bsmc());
298 app->setLatch(latch);
312 if (ocharge==0 || 1+abs(app->top_p.q)==ocharge) {
314 int latch = app->top_p.latch;
317 if (!(latch & bsmc()) || (oformat==0 && score_mc)) {
320 phsp_before = phsp_geom->isInside(x);
324 phsp_after = phsp_geom->isInside(x);
325 if (phsp_after != phsp_before) {
326 if (scoredir == 0 || (scoredir == 1 && phsp_after) ||
327 (scoredir == 2 && phsp_before)) {
328 storeParticle(current_case);
331 latch = (latch | bsmc());
332 app->setLatch(latch);
337 else if (score_type==1) {
344 if (from_to[ir_before].size()>0 && ir_before != ir_after) {
345 for (
int i=0; i< from_to[ir_before].size(); i++) {
346 if (ir_after == from_to[ir_before][i]) {
347 storeParticle(current_case);
348 latch = (latch | bsmc());
349 app->setLatch(latch);
362 if (iarg == 0 || iarg == 5) {
378 phsp_geom = phspgeom;
381 void setEntryExitReg(
const vector <int> from_reg,
const vector <int> to_reg) {
387 void setOType(
const int phspouttype) {
388 oformat = phspouttype;
392 void setOutDir(
const string outdir) {
396 void setParticleType(
const int ptype) {
400 void setScoreDir(
const int sdir) {
404 void setMuScore(
const int imuscore) {
413 void setScoreMC(
const int iscoremc) {
426 void setXYZconst(
bool xyzisconst[3],
float xyzconst[3]) {
427 for (
int i=0; i<3; i++) {
428 xyz_is_const[i] = xyzisconst[i];
429 xyzscore[i]=xyzconst[i];
433 void storeParticle(EGS_I64 ncase);
435 int flushBuffer()
const;
437 void openPhspFile()
const;
451 EGS_Float E, x, y, z, u, v, w, wt, mu;
455 static unsigned int bclr() {
456 return ~((1 << 30) | (1 << 29));
458 static unsigned int bsqe() {
461 static unsigned int bsqp() {
472 latch = (p.latch & bclr());
474 latch = (latch | bsqe());
477 latch = (latch | bsqp());
484 wt = p.w >= 0 ? p.wt : -p.wt;
494 int iaea_n_extra_float, iaea_n_extra_long;
495 int iaea_i_latch, iaea_i_mu;
497 bool xyz_is_const[3];
500 char *phsp_fname_char;
509 static unsigned int bsmc() {
513 mutable int phsp_index;
515 mutable fstream phsp_file;
520 mutable bool first_flush;
526 EGS_I64 current_case;
546 vector <int> fromreg;
548 vector <vector <int> > from_to;
549 int ir_before, ir_after;
A phase space scoring object: header.
EGS_AusgabObject interface class header file.
virtual int processEvent(EGS_Application::AusgabCall iarg)=0
Process an ausgab call for event iarg.
virtual bool storeState(ostream &data_out) const
Store the source state into the stream data_out.
AusgabCall
Possible calls to the user scoring function ausgab().
A class representing 3D vectors.
Base geometry class. Every geometry class must be derived from EGS_BaseGeometry.
virtual bool needsCall(EGS_Application::AusgabCall iarg) const
Is the ausgab call iarg relevant for this object?
virtual bool setState(istream &data_in)
Set the ausgab object state based on data from the stream data_in.
virtual void reportResults()
Report results.
virtual bool addState(istream &data_in)
Add data from the stream data_in to the ausgab object state.
EGS_ScoringSingle and EGS_ScoringArray class header file.
EGS_BaseGeometry class header file.
virtual void setCurrentCase(EGS_I64 ncase)
Set the current event.
virtual void setApplication(EGS_Application *App)
Set the application this object belongs to.
EGS_Application class header file.
Base class for advanced EGSnrc C++ applications.