A problem of the example PDB4DNA

in the eventaction::endofeventaction()

// the following fuction is to calculate the strand break number

question one :slight_smile:

when using the multithread , the function is performed in the unique thread, i wonder that we should performe the function after the accumulate the energy deposit from all threads

question two :slight_smile:

the fucntion is performed in the eventaction function, if we should transfer the fuction into runaction.

In multithreaded running, each event is processed in a separate thread. Events do not interact with one another or contribute to one another. That’s why the strand-breaking is done per thread, and why it is done in EventAction.

I get it, although the deposit energy is acquired by the separate thread, the result of strand- breaking is based on the total deposit energy from all the thread . for example .

threshold is 1.

thread one: deposit energy is 0.5 < threshold, strand is not breaked.

thread two : deposit energy is 0.5 < threshold, strand is not breaked.
thread three : deposit energy is 0.5 < threshold, strand is not breaked.

but the total energy 1.5 > threshold , i think we should check that the strand has been breaked. if we check the result in the event action , we will underestimate the number of strand breaks.

I’m not explaining it well. You run your simulation, and you type /run/beamOn 50 at the end. That generates fifty entirely separate, uncorrelated simulations. The energy from each of those separate events does not add together. Each one is independent.

If you run single threaded, then those events are generate one after another after another. If you run multithreaded, then each event gets farmed out to a thread. But they are still independent, and you do not sum up the energies from different events.

thanks your reply. to calculate the DNA strand break, there are two examples.
one is from the geant4 example pdb4dna. in this example, the calculation of DSB is performed in the end event action.
another example is from IDDRRA_project. in this project ,the author performs the calculation of DSB after the simulation with the python. the relevant code can be gained in the github.
in the python script,

with open (infile, β€˜r’) as fp:
line = fp.readline()

while line:
    line = fp.readline()
    spl = line.split()
    if len(spl) == 3:
        if spl[0] == 'A':
            nucl1 = int(spl[1])
            edep1 = float(spl[2])
            totEdep += edep1
            ssb1e[nucl1] += edep1

        elif spl[0] == 'B':
            nucl2 = int(spl[1])
            edep2 = float(spl[2])
            totEdep += edep2
            ssb2e[nucl2] += edep2

now, i think that the different author wants to do different research.