Why multi-threading?
- When you work offline (batch-style analysis, etc) you fill your histograms, and write them out when the data file is processed. You look at them later, fit them, analyze them, etc. Easy.
- For online monitoring, you want to work with your histograms, display them at will, clear them, fit them, store them, whatever, while they are being filled in the background by your monitoring task.
- At any time, you want your prompt (or a GUI) active so that you can give commands.
- Until recently, ROOT couldn’t do that easily. You get the prompt back only after the processing has finished or has been suspended
- Unless you built commands into your process loop to actually display histograms, you can see them only after processing has stopped or has been suspended (Timer).
- “Stop processing” is something you don’t like too much in online monitoring -- you don’t want to miss events and miss the detector problem.
- That’s where threads come in -- one thread fills, another waits for your command.