Openmp and TTree:GetEntry()

I have two solutions that both seem to work on my trivial test case. The first is what I suggested. That is to use

omp_set_lock(&getEventLock);

and

omp_unset_lock(&getEventLock);

around the GetEvent.
The second is what StephanH suggested and divide the data in to n chunks, one for each thread, and then open the input root file in each thread with a new, local instance of the TTree in each thread.
I find StephanH’s solution better, as the locking could hypothetically have significant speed costs. Attached is a tar file with my code that (1) writes a root file on which testTree.tar (17.5 KB) to test things (writeTestTree.cc), (2) read the root file using locks (testTree.cc), and (3) reads the root file using multiple instances of the TTree (testTree2.cc).

Paul