exit status legend:

    1: natural death, no tumor, before the 1st screening round
    2: natural death, undetected tumor, before the first screening round
    3: self-detected tumor before the 1st screening round

    4: natural death, no tumor, between screening rounds
    5: natural death, undetected tumor, between screening rounds
    6: self-detected tumor between screening rounds
    7: screening-detected tumor

    8: natural death, no tumor, after the last screening round
    9: natural death, undetected tumor, after the last screening round
   10: self-detected tumor after the last screening round


    enum Status             // labels in data.cc
    {
        PRESENT,            // 0

        NATURAL_PRE,        // 1 natural death before the 1st screening round
        UNDETECTED_PRE,     // 2 nat. death, undetected tumor, before 1st scr.
        SELF_PRE,           // 3 self-detected tumor before 1st scr.
                          
        NATURAL_DURING,     // 4 nat. death between screening rounds
        UNDETECTED_DURING,  // 5 nat. death, undetected tumor, between scr.
        SELF_DURING,        // 6 self-detected tumor between scr. rounds
        SCREEN_DETECTED,    // 7 screening-detected tumor
                          
        NATURAL_POST,       // 8 nat. death after the last screening round
        UNDETECTED_POST,    // 9 nat. death, undetected tumor, afer last scr.
        SELF_POST,          // 10 self-detected tumor after last scr. round

        Status_END   
    };


At the case initialization the following parameters are determined
(loop/naturaldeathage.cc, tumor/reset.cc): 

    1. The case's natural death age         (d_deathAge, d_naturalDeathAge)
    2. Whether or not a tumor starts        (d_tumor.selfDetectable())
       and if so:
        3. the tumor's self-detection age   (d_tumor.selfDetectAge())
        4. the tumor's onset age            (d_tumor.onset())
        5. the tumor's death age            (d_tumor.deathAge())


Time scale, starting at birth:

                d_deathAge
    |----...----|

            screening round ages (normally multiple y ages are defined)
            x           y
    |-------|-----------|------------>
        A          B            C
      pre-      screening       post-  
      scr.      rounds          scr

Since phases A and B's descriptions are identical, they're merged in a single
phase (A). In A it is checked whether the screening age x is the age of the
1st screening round or not. If not, there's, e.g., no interval cancer.


phase:      (loop/screening.cc)

    A:  (loop/leaving.cc)

        no tumor.at(x):         // A1
            nat. death <= x ?
                // death age = nat. death age 
                // (already determined at case initialization)
                case leaves because of nat. death (LEFT_PRE or LEFT_DURING)

        [else]  // A2: a tumor exists at x
        nat. death < x and not selfDetectableBefore(nat.death) ?    // A3
                // death age = nat. death age 
                // (already determined at case initialization)
            determine tumor characteristics at the nat.death age 
            deathAge = natural death age
            case leaves at natural death (UNDETECTED_PRE/DURING)
        [else]

        selfDetectableBefore(x) ?   // A4
            determine tumor characteristics at the self-detection age 
            death age = tumor death age based on self detect age
            addCost treathmentCosts at selfDetectAge

            if x is the first screening round:
                case leaves at self-detect age
            else
                intervalCancer at x // case leaves (loop/intervalcancer.cc)
                
        [else]

        continue: screen at x (loop/screen.cc)),

        -------------------------------------------------
        (loop/intervalcancer.cc)
            update statistics like 
                #intervals in the current round 
                whether or not the case would actually attend round x, 
                the treatment costs
            case leaves at the self-detection age

        -------------------------------------------------
        (loop/screen.cc)
            add the costs of the used screening mode(s)
            no tumor at x:
                    // death age = nat. death age 
                    // (already determined at case initialization)
                at a false positive decision: add the costs of the 
                screening at x
            else:
                determine tumor characteristics at x
                at a false negative decision: 
                    update some statistics
                else:   (tumor detected at screening round x)
                    nat.death age < tumor death age?
                            // death age = nat. death age 
                            // (already determined at case initialization)
                        case leaves at x, registering the nat. death age
                    else
                        death age = tumor death age
                        case leaves at x, registering the tumor death age


    B == A

    C:  (loop/postscreen.cc)
        nothing happens if the case has already left the simulation

        no tumor beyond y?  // C1
                // death age = nat. death age 
                // (already determined at case initialization)
            case leaves at nat. death age
        [else]  // C2
        determine tumor characteristics at the self-detection age

new:    self-detection age < nat.death age ?
            addCost treathmentCosts at selfDetectAge

        determine the tumor-caused death age
        deathAge = min(tumor death age, natural death age)

        self-detection age < nat.death age ?
            case leaves at self-detection age,
        [else]
            case leaves at nat.death age, but a tumor is present 
            (added the new state 7:
                "undetected tumor and natural death after the last screening
                 round")




