For people having a multi (e.g. dual) core computer, it is possible to exploit all the available CPUs by using PROOF-Lite. N.B. PROOF-Lite doesn't work on Windows yet and it requires to use a selector composed of a source file and a header file. You can download both files from there: ProofEventSelector.h ProofEventSelector.C or on the linux terminal
wget https://raw.githubusercontent.com/root-mirror/training/master/old-files/ProofEventSelector.C
wget https://raw.githubusercontent.com/root-mirror/training/master/old-files/ProofEventSelector.h
Then you can simply use it like this:
TProof::Open("");
// create a TChain instead of a TTree
TChain *chain = new TChain("EventTree", "Event Data Chain");
// add our file
chain->Add("http://root.cern/files/introtutorials/eventdata.root");
// tell the chain that we want to use PROOF
chain->SetProof();
// run the selector
chain->Process("ProofEventSelector.C+");
For the functions used, see the documentation of the TChain constructor and TChain::Add().
You need to register the histogram in your selector's output list, by passing it to GetOutputList()->Add(hist), ideally right after you have created it with new TH1F(...). If you don't add it to the output list, PROOF cannot know that this histogram is the result of the analysis.
Note: If the network is good, try to take this file instead: http://root.cern/files/introtutorials/eventdata-10k.root
, it contains more events.
Then the TChain::Process() call is the same than before, but it will now use all your CPUs!