Dear experts,
I’m trying to use PROOF-Lite with TSelector, but it doesn’t work.
I have the following class derived from TSelector:
class Analysis : public TSelector
{
public:
Analysis(/*argument */);
~Analysis();
/// === TSelector methods
virtual Int_t Version() const {return 1;}
virtual void Begin(TTree *);
virtual void SlaveBegin(TTree *tree);
virtual void Init(TTree *tree);
virtual Bool_t Notify();
virtual Bool_t Process(Long64_t entry);
virtual void SetOption(const char *option) { fOption = option; }
virtual void SetObject(TObject *obj) { fObject = obj; }
virtual void SetInputList(TList *input) {fInput = input;}
virtual TList *GetOutputList() const { return fOutput; }
virtual void SlaveTerminate();
virtual void Terminate();
TChain *GetChain() { return chain; }
private:
TChain *chain; // the loaded chain depends on the arguments passed to the constructor
TH1D *hist;
};
void Analysis::SlaveBegin(TTree *tree)
{
hist = new TH1D("hist", "hist", 100, 0, 1);
fOutput->Add(hist);
}
void Analysis::Init(TTree *tree)
{
chain = dynamic_cast<TChain *>(tree);
}
Bool_t Analysis::Process(Long64_t entry)
{
chain->GetTree()->GetEntry(entry);
/* other code: cuts, etc */
hist->Fill(chain->GetLeaf("var")->GetValue());
return true;
}
void MonthlyFluxClass::Terminate()
{
hist = dynamic_cast<TH1D *>(fOutput->FindObject("hist"));
TFile output("test.root", "RECREATE");
hist->Write();
output.Close();
}
If I process the chain without PROOF, everything works (i.e. hist is filled and saved in test.root)
Analysis *analysis = new Analysis(/*arguments*/);
TVirtualTreePlayer *tp = analysis->GetChain()->GetPlayer();
tp->Process((TSelector *)analysis, "", analysis->GetChain()->GetEntries(), 0);
If I use PROOF-Lite, the chain is processed in 1 second (which is impossible: it takes ~20 min with one core, so with 6 cores it should take at least ~3 min) and hist is always NULL in Terminate
TProofLite *proof = new TProofLite("workers=6");
Analysis *analysis = new Analysis(/*arguments*/);
proof->Process((TSelector *)analysis, analysis->GetChain()->GetEntries());
The PROOF query progress dialog says that it processed the correct number of events in the chain and also the logs show that the events are processed (there are lot of lines like “13:48:42 12334 Wrk-0.1 | SvcMsg in TProofPlayerSlave::CheckMemUsage: Memory 104024 virtual 26496 resident event 3975382”).
It looks that for some reason if I use proof, Process exit immediately and hist is not added to the TSelectorList, but I cannot debug it because of this problem: [Logging output of PROOF-Lite
Am I using PROOF in the wrong way?
Thanks.