Dear experts,
I am new to PROOF, and trying to make a toy analysis with it. I went through some documents, but mostly are explaining the structure of the Selector, and I was trying to make a TPROOF work first. The error message that I got in the log is:
Error in TProofServLite::HandleSocketInput. It seems that there is some issue when collecting the output, but I don’t know why it happens and how to fix it. Apologize is the question is too naive.
I have a few NanoAOD root files (the file contains several flat trees), and I made a TSelector based on the “Events” Tree. I made a very simple TSelector, and used the following code in root interface:
root [1] #include "Events.h"
root [2] TChain *chain = new TChain("Events");
root [3] chain->Add("~/eos/NanoAODv2_skimmed/Era_2018/Background/DYJetsToLL_M-50/skimmed_nano_1.root");
root [4] TProof *proof = TProof::Open("workers=1");
+++ Starting PROOF-Lite with 1 workers +++
Opening connections to workers: OK (1 workers)
Setting up worker servers: OK (1 workers)
PROOF set to parallel mode (1 worker)
root [5] proof->Load("Events.C");
09:44:44 9473 Wrk-0.0 | Info in <TProofServLite::HandleCache>: loading macro Events.C ...
root [6] Events *e = new Events();
root [7] chain->SetProof();
root [8] chain->Process((TSelector *)e);
Info in <TProofLite::SetQueryRunning>: starting query: 1
Info in <TProofQueryResult::SetRunning>: nwrks: 1
Looking up for exact location of files: OK (1 files)
Looking up for exact location of files: OK (1 files)
Info in <TPacketizer::TPacketizer>: Initial number of workers: 1
Validating files: OK (1 files)
Warning in <TSelector::Terminate>: histogram not foundsending)
Lite-0: all output objects have been merged
The Events.h is the automatic generated one from Events->MakeSelector(), but with an extra public member for the output Histogram:
TH1F *fHisto;
The Events.C is the automatic generated one with the modified Begin(), SlaveBegin(), Process(Long64_t entry) and Terminate() functions:
void Events::Begin(TTree * /*tree*/) {
TString option = GetOption();
fHisto = 0;
}
void Events::SlaveBegin(TTree * /*tree*/) {
TString option = GetOption();
// Create the histogram
fHisto = new TH1F("histo", "leadingMuPt", 200, 0, 200);
fHisto->GetYaxis()->SetTitle("number of events");
fHisto->GetXaxis()->SetTitle("leadingMuPt");
//adding histo to selector output list
fOutput->Add(fHisto);
}
Bool_t Events::Process(Long64_t entry) {
fReader.SetLocalEntry(entry);
if (*nMuon > 0) fHisto->Fill(Muon_pt[0]); // nMuon is defined in Events.h with TTreeReaderValue<UInt_t> nMuon = {fReader, "nMuon"}; Muon_pt is defined as TTreeReaderArray<Float_t> Muon_pt = {fReader, "Muon_pt"};
return kTRUE;
}
void Events::Terminate() {
TCanvas *c1 = new TCanvas("c1","Proof ProofEvent canvas",200,10,700,700);
fHisto = dynamic_cast<TH1F *>(fOutput->FindObject(Form("histo")));
if (fHisto) {
fHisto->Draw("h");
// Final update
c1->cd();
c1->Update();
} else {
Warning("Terminate", "histogram not found");
}
}
Please read tips for efficient and successful posting and posting code
_ROOT Version:6.22/09
_Platform:linux bash shell, cmsplc interactive node
_Compiler: root interface, g++