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 (scoredir == 1 && ir < 0) {
272 if (!(latch & bsmc()) || (oformat==0 && score_mc)) {
275 phsp_before = phsp_geom->isInside(x);
279 phsp_after = phsp_geom->isInside(x);
280 if (phsp_after != phsp_before) {
281 if (scoredir == 0 || (scoredir == 1 && phsp_after) ||
282 (scoredir == 2 && phsp_before)) {
283 storeParticle(current_case);
286 latch = (latch | bsmc());
287 app->setLatch(latch);
292 else if (score_type==1) {
299 if (from_to[ir_before].size()>0 && ir_before != ir_after) {
300 for (
int i=0; i< from_to[ir_before].size(); i++) {
301 if (ir_after == from_to[ir_before][i]) {
302 storeParticle(current_case);
303 latch = (latch | bsmc());
304 app->setLatch(latch);
318 if (scoredir == 1 && ir < 0) {
323 if (ocharge==0 || 1+abs(app->top_p.q)==ocharge) {
325 int latch = app->top_p.latch;
328 if (!(latch & bsmc()) || (oformat==0 && score_mc)) {
331 phsp_before = phsp_geom->isInside(x);
335 phsp_after = phsp_geom->isInside(x);
336 if (phsp_after != phsp_before) {
337 if (scoredir == 0 || (scoredir == 1 && phsp_after) ||
338 (scoredir == 2 && phsp_before)) {
339 storeParticle(current_case);
342 latch = (latch | bsmc());
343 app->setLatch(latch);
348 else if (score_type==1) {
355 if (from_to[ir_before].size()>0 && ir_before != ir_after) {
356 for (
int i=0; i< from_to[ir_before].size(); i++) {
357 if (ir_after == from_to[ir_before][i]) {
358 storeParticle(current_case);
359 latch = (latch | bsmc());
360 app->setLatch(latch);
373 if (iarg == 0 || iarg == 5) {
389 phsp_geom = phspgeom;
392 void setEntryExitReg(
const vector <int> from_reg,
const vector <int> to_reg) {
398 void setOType(
const int phspouttype) {
399 oformat = phspouttype;
403 void setOutDir(
const string outdir) {
407 void setParticleType(
const int ptype) {
411 void setScoreDir(
const int sdir) {
415 void setTimeScore(
const int itimescore) {
416 if (itimescore == 1) {
424 void setScoreMC(
const int iscoremc) {
437 void setXYZconst(
bool xyzisconst[3],
float xyzconst[3]) {
438 for (
int i=0; i<3; i++) {
439 xyz_is_const[i] = xyzisconst[i];
440 xyzscore[i]=xyzconst[i];
444 void storeParticle(EGS_I64 ncase);
446 int flushBuffer()
const;
448 void openPhspFile()
const;
462 EGS_Float E, x, y, z, u, v, w, wt, time;
466 static unsigned int bclr() {
467 return ~((1 << 30) | (1 << 29));
469 static unsigned int bsqe() {
472 static unsigned int bsqp() {
483 latch = (p.latch & bclr());
485 latch = (latch | bsqe());
488 latch = (latch | bsqp());
495 wt = p.w >= 0 ? p.wt : -p.wt;
505 int iaea_n_extra_float, iaea_n_extra_long;
506 int iaea_i_latch, iaea_i_time;
508 bool xyz_is_const[3];
511 char *phsp_fname_char;
520 static unsigned int bsmc() {
524 mutable int phsp_index;
526 mutable fstream phsp_file;
531 mutable bool first_flush;
537 EGS_I64 current_case;
557 vector <int> fromreg;
559 vector <vector <int> > from_to;
560 int ir_before, ir_after;
Base class for advanced EGSnrc C++ applications.
AusgabCall
Possible calls to the user scoring function ausgab().
virtual void setApplication(EGS_Application *App)
Set the application this object belongs to.
virtual int processEvent(EGS_Application::AusgabCall iarg)=0
Process an ausgab call for event iarg.
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 storeState(ostream &data_out) const
Store the source state into the stream data_out.
virtual void setCurrentCase(EGS_I64 ncase)
Set the current event.
virtual bool addState(istream &data_in)
Add data from the stream data_in to the ausgab object state.
virtual bool needsCall(EGS_Application::AusgabCall iarg) const
Is the ausgab call iarg relevant for this object?
Base geometry class. Every geometry class must be derived from EGS_BaseGeometry.
A phase space scoring object: header.
A class representing 3D vectors.
EGS_Application class header file.
EGS_AusgabObject interface class header file.
EGS_BaseGeometry class header file.
EGS_ScoringSingle and EGS_ScoringArray class header file.