Scoring

Creating a scorer

Geant4 provides several classes to score different quantities in the selected volumes. GAMOS provides all the Geant4 functionality through user commands and also some extra functionality that we describe in this section.

The first thing you should do to use GAMOS scoring is to create a multifunctional detector [ 17 ] and associate it with a list of logical volumes, with the user command

/gamos/scoring/createMFDetector MFD_NAME LOGICAL_VOLUME_NAME(s)

where MFD_NAME is the detector name that will be used later. and LOGICAL_VOLUME_NAME(s) is a list of logical volumes that you associate to this detector.

Then you should add to the detector one of the GAMOS scorers, or your own ones, with the user command

/gamos/scoring/addScorer2MFD SCORER_NAME SCORER_CLASS MFD_NAME SCORER_PARAMETERS

SCORER_NAME is a name you give to the scorer to be used later, SCORER_CLASS is one of the available scorer classes, MFD_NAME is one of the multifunctional detectors created above and SCORER_PARAMETERS are the optional parameters a scorer may need (see below for the description of the scorers). You may repeat this command to associate several scorers to the same detector.

To each of the defined scorers you can add a filter, to select for which track conditions the scoring will be done:

/gamos/scoring/addFilter2Scorer FILTER_NAME/CLASS SCORER_NAME

FILTER_NAME/CLASS is the name of a GmVFilter class or the name you gave to a filter built from a filter class by using the command /gamos/filter (see section on Filters) and SCORER_NAME is one of the scorers defined above.

You may repeat this command to associate several filters to the same scorer. See section on Filters for a description of the available filters and how to create your own one.

By default a different count is scored for each of the copies of the selected volumes with different copy number. This is managed by the scorer classifier GmScorerClassifierBy1Ancestor. The user can attach different classifiers to the different scorers so that the counts are done in different ways:

/gamos/scoring/assignClassifier2Scorer CLASSIFIER_NAME/CLASS SCORER_NAME

CLASSIFIER_NAME/CLASS is the name of a GmVClassifier class or the name you gave to a classifier built from a classifier class by using the command /gamos/classifier (see section on Classifiers) and SCORER_NAME is one of the scorers defined above.

Finally you may select the format of the scoring results by associating one of the available scorer printers for each scorer,

/gamos/scoring/addPrinter2Scorer PRINTER_NAME SCORER_NAME

PRINTER_NAME is the name of a GmVPSPrinter class or the name you gave to a printer built from a printer class by using the command /gamos/printer (see section on Scorer printers below) and SCORER_NAME is one of the scorers defined above.

If no printer is attached to a scorer, it will use the printer type GmG4PSPrinterG4cout.

The scoring is done by default taking into account the track weight, except for the scorers when it is explicitly mentioned (see scorers description). If you do not want to take weights into account you can switch them off with the command

/gamos/scoring/useTrackWeight SCORER_NAME FALSE

The quantities scored are given per event by default. If you want the score without dividing by the number of events, use the command

/gamos/scoring/printByEvent PRINTER_NAME FALSE

The error in the scored quantity per voxel is also calculated by default, using the following formula:

sqrt{ (SumV2*nEvents - SumV*SumV) / (nEvents-1)} / nEvents

where nEvents is the total number of events in the run, SumV is the sum of the scored quantity value times its weight (i.e. the scored quantity itself) and SumV2 is the sum of squares of scored quantity value times its weight.

When the scoring is done per event, this sum of squares is done summing first all the values times its weight belonging to all the particles of the same event and then squaring this quantity. In this way the correlations between particles of the same event is properly taken into account. If the scoring is not by event, the error calculation uses the same formula, but the sum of squares is not done summing the contribution of the particles of the same event, but squaring each contribution individually.

Calculating the errors makes it necessary to store the square of the weights, increasing substantially the memory usage and CPU time. If you want to deactivate this option for a scorer, use the command

/gamos/scoring/scoreErrors SCORER_NAME FALSE

SCORER_NAME is one of the scorers defined above.

As mentioned above the errors that are calculated taking into account the number of events. You have to be careful then if you set to off the option of scoring by event and keep on the option of calculating the errors. In the default GAMOS scorer printers, the errors are printed are relative, i.e. the error divided by the value, so no caution is necessary, but be careful if you define a printer yourself.

Each scorer has a default unit (see section below), but it can be overridden with the command:

/gamos/scoring/scorerUnit SCORER_NAME UNIT_NAME UNIT_VALUE