Some thoughts on parallizing STAR

 
Parallelization of starsim is possible, utilizing either an event parallel or track parallel execution model.  The links are to papers describing previous efforts to parallelize geant 3.  It would be relatively straightforward to bring existing parallel G3 code into the STAR framework, apply STAR-specific patches and to integrate into starsim.  However, it is not clear that we stand to gain significantly from the effort.  (1) A typical simulation job spends ~10% of its time in event generation (starsim/geant), with the remainder in digitization (slow simulators) and reconstruction; (2) starsim is nearing the end of its life cycle.
 
However, parallelization of the digitization (slow simulator) phase may provide some significant gains for a reasonable effort.  Consider the code in the EEMC slow simulator which performs digitization of the EEMC tower response.  (I have stripped comments and null pointer protections for clarity).  Because the iterations of the for loop over sectors are completely independent of each other, we can execute each iteration in parallel.  Using OpenMP, we can parallelize this loop by providing a single compiler directive.  In fact, we could go further and execute the inner loops in parallel as well, since each hit in the towers is independent.