Open jbrage opened 1 year ago
little footnote: it will probably suffer from bin resolution.
If model is not too complicated, we can put into MC directly and score at run time using exact energies of each particle.
just saying:
#include "scoring/models/user/sh_user.h"
/**
* @brief User defined scoring.
*
* @details This function is invoked when using the USER detector.
* Any attached filters are applied before calling this function.
* The output of this function will be summed in a data structure data[].
* The summed result will be divided with the total number or primaries which was simulated.
* Then the strucutre will be written to disk.
* Note that this method does not have any division enabled. E.g. if you wish to calculate doseaveraged let
* you must make two detectors which you then can divide by yourself afterwards.
* These functions may be called from a step, or a position.
* If called from score_pos, then fluence = 0.0, isstep == 0, and usc.st is undefined.
* If called from score_step then fluence > 0.0, isstep == 1, and usc.pos is undefined.
*
*
* @param[in] usc - User-structure holding all possible relevant information.
*
* @returns anything the user desires. The value returned by this function will be added (+=) to the currnet data[idx].
*
* @author Niels Bassler
*/
double sh_score_user1(struct userscore usc) {
return usc.fluence; /* example how to score fluence */
}
double sh_score_user2(struct userscore usc) {
return usc.fluence; /* example how to score fluence */
}
where:
#ifndef _SH_SCORING_MODELS_USER
#define _SH_SCORING_MODELS_USER
#include "sh_particle.h"
#include "scoring/sh_score.h"
struct userscore {
struct estimator est; /* also the current geo struct */
struct page pag; /* all data about this detector */
struct step st; /* all data on this particlar step */
struct position pos; /* if not a step, then it is a single position */
struct particle part; /* all data about this particle */
double fluence; /* fluence from this particular score step [/cm**2] */
double energy; /* average kinetic energy of particle in [MeV] */
double dose; /* dose in this step fraction [MeV/g] */
double let; /* unrestricted LET calculated of in current medium from average kinetic energy [MeV/cm] */
double idx; /* geometry bin index, i.e. this step-fraction belongs to data[idx]. */
double frac; /* relative fraction of this step which goes into this geometry bin idx */
double mstpr; /* mass stopping power ratio in case user did override of medium or density */
char isstep; /* if called from score_step, this is == 1. If called from score_pos, this is == 0 */
};
double sh_score_user1(struct userscore usc);
double sh_score_user2(struct userscore usc);
#endif /* _SH_SCORING_MODELS_USER */
:-)
@jbrage what energy bin config did you have in mind? 1000 log bins from 0 to T_initial * 1.1 ?
What about recording phasespace file in some plane at the target ?
@nbassler that would be great with those bins, yes!
Also phasespace would be handy.
@nbassler that would be great with those bins, yes!
heeh... log 0 doesn't compute. Lower bound 10 keV/n? (Transport stops 25 keV/n IIRC) Upper will be also be in per nucleon (not per amu).
To accurate model the detector response in the mixed particle fields in the SOBP, it would be beneficial to have particle spectra in the target volume