PROOF and multi trees

Hello,
I have 3 trees in the same ROOT file, I use MakeSelector on my 3 trees to generate my code. If I use the code generate for the fisrt tree, I can draw one variable of the tree with ROOT and PROOF (ROOT 5.16.00).
Now I would like to access for the same event the variables of the tree1,2 and 3. I used this code :[code]Tree2 bis;
Tree3 bis2;

void Tree1::Begin(TTree * /tree/)
{
TString option = GetOption();
}

void Tree1::SlaveBegin(TTree * tree)
{
// Tree2
TFile *f = new TFile("/direct/usatlas+groups+higgs/tarrade/Samples/HiggsToTauTau-00-00-44/user.TARRADEFabien.misal1_mc12.005334.HerwigVBFH120tautaulh.A12.0.6.7.NewTest_atlfast.AAN.AANT1._00001.root");
TTree fast = (TTree)f->Get(“FastSim0”);

//printf(“new tree Tree2\n”);
bis.Init(fast);

// Tree3
TFile *f1 = new TFile("/direct/usatlas+groups+higgs/tarrade/Samples/HiggsToTauTau-00-00-44/user.TARRADEFabien.misal1_mc12.005334.HerwigVBFH120tautaulh.A12.0.6.7.NewTest_atlfast.AAN.AANT1._00001.root");
TTree truth = (TTree)f1->Get(“Truth0”);

//printf(“new tree Tree3 \n”);
bis2.Init(truth);

//initialize the Tree branch addresses("");
Init(tree);

TString option = GetOption();

hhiggsmass = new TH1F(“hhiggsmass”,“higgs mass”,40,0,200000);
hhiggsmass_fast = new TH1F(“hhiggsmass_fast”,“higgs mass fast sim”,40,0,200000);
hhiggsmass_truth = new TH1F(“hhiggsmass_truth”,“higgs mass fast sim”,40,0,200000);

fOutput->Add(hhiggsmass);
fOutput->Add(hhiggsmass_fast);
fOutput->Add(hhiggsmass_truth);
}

Bool_t Tree1::Process(Long64_t entry)
{
//fChain->GetTree()->GetEntry(entry);
b_Higgs_N->GetEntry(entry);
b_Higgs_m->GetEntry(entry);

//fill some histograms
if(Higgs_N>0){
hhiggsmass->Fill( (*Higgs_m)[0] );
}

//new
//bis.fChain->GetTree()->GetEntry(entry);
bis.b_Higgs_N->GetEntry(entry);
bis.b_Higgs_m->GetEntry(entry);

//fill some histograms
if(bis.Higgs_N>0){
hhiggsmass_fast->Fill( (*bis.Higgs_m)[0] );
}

//bis2.fChain->GetTree()->GetEntry(entry);
bis2.b_Higgs_N->GetEntry(entry);
bis2.b_Higgs_m->GetEntry(entry);

//fill some histograms
if(bis2.Higgs_N>0){
hhiggsmass_truth->Fill( (*bis2.Higgs_m)[0] );
}
return kTRUE;
}

void Tree1::SlaveTerminate()
{
}

void Tree1::Terminate()
{
hhiggsmass = dynamic_cast<TH1F*>(fOutput->FindObject(“hhiggsmass”));
hhiggsmass_fast = dynamic_cast<TH1F*>(fOutput->FindObject(“hhiggsmass_fast”));
hhiggsmass_truth = dynamic_cast<TH1F*>(fOutput->FindObject(“hhiggsmass_truth”));

//create the canvas for the h1analysis fit
gStyle->SetOptFit();
TCanvas *c1 = new TCanvas(“c1”,“example”,10,10,800,600);
c1->SetBottomMargin(0.15);
hhiggsmass_fast->SetLineColor(4);
hhiggsmass_truth->SetLineColor(2);
hhiggsmass->GetXaxis()->SetTitle(“Higgs mass”);
hhiggsmass->GetXaxis()->SetTitleOffset(1.4);
hhiggsmass_truth->Draw("");
hhiggsmass_fast->Draw(“SAME”);
hhiggsmass->Draw(“SAME”);
}[/code]

It works fine with ROOT but crash with PROOF !!! :[code]

Master-0: grand total: sent 0 objects, size: 0 bytes
Info in TProof::CollectInputFrom: got 1036 from 0
Info in TProof::CollectInputFrom: kPROOF_SETIDLE: enter
Info in TProof::CollectInputFrom: got 1004 from 0
Info in TProof::CollectInputFrom: got 1005 from 0
Info in TProof::CollectInputFrom: kPROOF_LOGDONE:0: status 0 parallel 24
Info in TProofPlayerRemote::Process: Call Terminate()

*** Break *** segmentation violation
(no debugging symbols found)
Using host libthread_db library “/lib/tls/libthread_db.so.1”.
Attaching to program: /proc/29207/exe, process 29207
(no debugging symbols found)…done.
[Thread debugging using libthread_db enabled]
[New Thread -1208297792 (LWP 29207)]
[New Thread -1210692688 (LWP 29213)]
(no debugging symbols found)…done.

0x0071e7a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
Thread 2 (Thread -1210692688 (LWP 29213)):
#0 0x0071e7a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
#1 0x00e7c1d4 in poll () from /lib/tls/libc.so.6
#2 0x03041489 in XrdClientSock::RecvRaw (this=0x9551448, buffer=0x98fd0d4, length=8, substreamid=-1, usedsubstreamid=0xb7d63eec) at XrdClientSock.cc:115
#3 0x03065875 in XrdClientPhyConnection::ReadRaw (this=0x9540df0, buf=0x98fd0d4, len=8, substreamid=-1, usedsubstreamid=0xb7d63eec) at XrdClientPhyConnection.cc:355
#4 0x03060d0a in XrdClientMessage::ReadRaw (this=0x98fd0b0, phy=0x9540df0) at XrdClientMessage.cc:149
#5 0x030648e8 in XrdClientPhyConnection::BuildMessage (this=0x9540df0, IgnoreTimeouts=true, Enqueue=true) at XrdClientPhyConnection.cc:436
#6 0x0306a1b3 in SocketReaderThread (arg=0x9540df0, thr=0x9540b68) at XrdClientPhyConnection.cc:60
#7 0x0306e066 in XrdClientThreadDispatcher (arg=0x9540b74) at XrdClientThread.cc:32
#8 0x02f425f6 in XrdOucThread_Xeq () from /afs/usatlas.bnl.gov/cernsw/lcg/external/root/5.16.00-PROOF.00/slc4_ia32_gcc34/root/lib/libProofx.so
#9 0x00db13b1 in start_thread () from /lib/tls/libpthread.so.0
#10 0x00e85f7e in clone () from /lib/tls/libc.so.6
[/code]
To run my code I use : root [1] .x chainForPROOF.C root [2] .L Tree2.C+ root [3] .L Tree3.C+ root [4] chain.Process("Tree1.C+")
Any idea ? problem with the PROOF server ? I maybe instantiate the object Tree2 and Tree3 in a wrong place ?

Thanks a lot
Cheers
Fabien

Hello,
One additional comment : the crash appear when I put these line in my code Tree1.C :
#include “Tree2.h”
#include “Tree3.h”
// create new object
//Tree2 bis;
//Tree3 bis2;

void Tree1::Begin(TTree * /tree/)

If I comment this 2 lines( and all reference to bis1 and bis2) it works with PROOF. If I uncomment :
#include “Tree2.h”
#include "Tree3.h"
it crash with PROOF but not with ROOT.

root [4] chain.Process(“Tree1.C+”)
Note: File “vector” already loaded
Starting the main code (Tree1) with process option:
Looking up for exact location of files: OK (3 files)
Validating files: OK (3 files)
Master-0: grand total: sent 0 objects, size: 0 bytes

*** Break *** segmentation violation
(no debugging symbols found)
Using host libthread_db library “/lib/tls/libthread_db.so.1”.
Attaching to program: /proc/7987/exe, process 7987
(no debugging symbols found)…done.
(no debugging symbols found)…done.
(no debugging symbols found)…done.
(no debugging symbols found)…done.
(no debugging symbols found)…done.
(no debugging symbols found)…done.
[Thread debugging using libthread_db enabled]
[New Thread -1209018688 (LWP 7987)]
[New Thread -1219826768 (LWP 7996)]
[New Thread -1209201744 (LWP 7995)]
(no debugging symbols found)…done.
(no debugging symbols found)…done.
(no debugging symbols found)…done.
(no debugging symbols found)…done.
(no debugging symbols found)…done.
(no debugging symbols found)…done.
(no debugging symbols found)…done.
(no debugging symbols found)…done.
(no debugging symbols found)…done.
(no debugging symbols found)…done.

0x00e747a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
Thread 3 (Thread -1209201744 (LWP 7995)):
#0 0x00e747a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
#1 0x01375726 in __nanosleep_nocancel () from /lib/tls/libc.so.6
#2 0x013ac2fa in usleep () from /lib/tls/libc.so.6
#3 0x016b6c82 in GarbageCollectorThread (arg=0x90e3728, thr=0x90e3420)
at XrdClientConnMgr.cc:66
#4 0x016c526a in XrdClientThreadDispatcher (arg=0x90e342c)
at XrdClientThread.cc:29
#5 0x016d26d6 in XrdOucThread_Xeq ()
from /afs/usatlas.bnl.gov/cernsw/lcg/external/root/5.14.00/slc4_ia32_gcc34/ro
ot/lib/libXrdProofd.so
#6 0x06fa83b1 in start_thread () from /lib/tls/libpthread.so.0
#7 0x013b2f7e in clone () from /lib/tls/libc.so.6

Thread 2 (Thread -1219826768 (LWP 7996)):
#0 0x00e747a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
#1 0x013a91d4 in poll () from /lib/tls/libc.so.6
#2 0x016ceb99 in XrdClientSock::RecvRaw (this=0x90e5098, buffer=0xb690844

etc …
How I can defined and use object Tree2 and Tree3 with PROOF (Standard stuff works with ROOT)?
I miss something !!
Thanks a lot for your help
Cheers
Fabien

Dear Fabien,

PROOF tree processing is driven by the main tree (in this case Tree1) which is the only code automatically distributed to the workers when you issue a Process request.
If your steering selector (i.e. Tree1) needs additional code (e.g. Tree2 and Tree3) then this code has to be loaded separately. The way to do it is explained in here: root.cern.ch/twiki/bin/view/ROOT … ddSoftware .
PAR packages, mentioned by Philippe, are the more general solution. In your case the TProof::Load way may be enough:

root[0] p = TProof::Open("master")
root [1] .x chainForPROOF.C                             
root [2] p->Load("Tree2.C+");                                    
root [3] p->Load("Tree3.C+");                                    
root [4] chain.Process("Tree1.C+") 

Please try and let us know.

G. Ganis

Hello,
Thanks a lot, now it works fine. Now I will try to use PAR packages.
Thanks again
Cheers
Fabien