Dear Ganis,
Thanks! This works very well if I use the “MySel” argument instead of the actual TSelector. That is
TChain *inTree = new TChain("usertree");
inTree->Add(inFileName);
TString workingDirectory = TString::Format("%s/", gSystem->WorkingDirectory());
TString selectorLibrary = workingDirectory + "MySel.so";
TProof *proof = TProof::Open("workers=8");
proof->Load(selectorLibrary,kTRUE);
inTree->SetProof(proof);
MySel *s = new MySel();
Long64_t nentries=100000; Option_t *option="";
inTree->Process("MySel",option,nentries,0); //this works
//inTree->Process(s,option,nentries,0); //this doesn't
The former option also gives one complaint:
Warning in <TOutputListSelectorDataMap::SetDataMembers()>: potential memory leak: replacing data member `outTree' != 0. Please initialize outTree to 0 in constructor MySel::MySel()
Implementing this is trivial. But it made me realize that the Process call invokes the constructor, which was not clear.
One question: does the Process call always invoke the constructor?
Because I would generally prefer to pass the TSelector as argument, and this is only possible if it has already been constructed.
If I create a MySel object and pass it to Process, I get a segfault that is no doubt due to the redundant calls to the constructor:
+++ Starting PROOF-Lite with 8 workers +++
Opening connections to workers: OK (8 workers)
Setting up worker servers: OK (8 workers)
PROOF set to parallel mode (8 workers)
12:36:12 220663 Wrk-0.0 | Info in <TProofServLite::HandleCache>: loading macro MySel.so ...
12:36:12 220671 Wrk-0.4 | Info in <TProofServLite::HandleCache>: loading macro MySel.so ...
12:36:12 220665 Wrk-0.1 | Info in <TProofServLite::HandleCache>: loading macro MySel.so ...
12:36:12 220675 Wrk-0.6 | Info in <TProofServLite::HandleCache>: loading macro MySel.so ...
12:36:12 220667 Wrk-0.2 | Info in <TProofServLite::HandleCache>: loading macro MySel.so ...
12:36:12 220673 Wrk-0.5 | Info in <TProofServLite::HandleCache>: loading macro MySel.so ...
12:36:12 220669 Wrk-0.3 | Info in <TProofServLite::HandleCache>: loading macro MySel.so ...
12:36:12 220677 Wrk-0.7 | Info in <TProofServLite::HandleCache>: loading macro MySel.so ...
***class instance created***
Info in <TProofLite::SetQueryRunning>: starting query: 1
Info in <TProofQueryResult::SetRunning>: nwrks: 8
-->Client beginning...
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: 8
Validating files: OK (1 files)
*** Break *** segmentation violation
===========================================================
There was a crash.
This is the entire stack trace of all threads:
===========================================================
#0 0x00002b500c5c865e in waitpid () from /lib64/libc.so.6
#1 0x00002b500c55a609 in do_system () from /lib64/libc.so.6
#2 0x00002b5006a86338 in TUnixSystem::StackTrace (this=0x17434d0) at /scratch/bkw1a/root_v5.34.28/core/unix/src/TUnixSystem.cxx:2419
#3 0x00002b5006a851b3 in TUnixSystem::DispatchSignals (this=0x17434d0, sig=kSigSegmentationViolation) at /scratch/bkw1a/root_v5.34.28/core/unix/src/TUnixSystem.cxx:1294
#4 <signal handler called>
#5 0x00002b500669c0cb in TBuffer& operator<< <TTree>(TBuffer&, TTree const*) () from /nv/blue/mgv4ce/testing/MySel.so
#6 0x00002b500669b1d0 in MySel::Streamer(TBuffer&) () from /nv/blue/mgv4ce/testing/MySel.so
#7 0x00002b5007dc398e in Streamer (this=0x7ffdce848040, actualObjectStart=0x1f7cf60, actualClass=0x1fd36f0) at /scratch/bkw1a/root_v5.34.28/build/include/TClass.h:451
#8 TBufferFile::WriteObjectClass (this=0x7ffdce848040, actualObjectStart=0x1f7cf60, actualClass=0x1fd36f0) at /scratch/bkw1a/root_v5.34.28/io/io/src/TBufferFile.cxx:2605
#9 0x00002b5007dc0564 in TBufferFile::WriteObjectAny (this=0x7ffdce848040, obj=<value optimized out>, ptrClass=0x1a74530) at /scratch/bkw1a/root_v5.34.28/io/io/src/TBufferFile.cxx:2659
#10 0x00002b5006a2a990 in operator<< (this=<value optimized out>, b=...) at /scratch/bkw1a/root_v5.34.28/build/include/TBuffer.h:401
#11 TList::Streamer (this=<value optimized out>, b=...) at /scratch/bkw1a/root_v5.34.28/core/cont/src/TList.cxx:1070
#12 0x00002b5007dc398e in Streamer (this=0x7ffdce848040, actualObjectStart=0x1b1bb80, actualClass=0x1f7d2e0) at /scratch/bkw1a/root_v5.34.28/build/include/TClass.h:451
#13 TBufferFile::WriteObjectClass (this=0x7ffdce848040, actualObjectStart=0x1b1bb80, actualClass=0x1f7d2e0) at /scratch/bkw1a/root_v5.34.28/io/io/src/TBufferFile.cxx:2605
#14 0x00002b5007dc051f in TBufferFile::WriteObjectAny (this=0x7ffdce848040, obj=0x1b1bb80, ptrClass=0x1f7d2e0) at /scratch/bkw1a/root_v5.34.28/io/io/src/TBufferFile.cxx:2662
#15 0x00002b500b189789 in operator<< <TList> (buf=..., obj=0x1b1bb80) at /scratch/bkw1a/root_v5.34.28/build/include/TBuffer.h:388
#16 0x00002b500b4d530c in TProofPlayerLite::Process (this=0x1b1b9e0, dset=<value optimized out>, selector_file=<value optimized out>, option=0x0, nentries=0, first=0) at /scratch/bkw1a/root_v5.34.28/proof/proofplayer/src/TProofPlayerLite.cxx:266
#17 0x00002b500b4d4278 in TProofPlayerLite::Process (this=0x1b1b9e0, dset=0x1f2daf0, selector=<value optimized out>, option=0x7ffdce848469 "", nentries=100000, first=0) at /scratch/bkw1a/root_v5.34.28/proof/proofplayer/src/TProofPlayerLite.cxx:97
#18 0x00002b500b149946 in TProofLite::Process (this=0x1a6dfa0, dset=0x1f2daf0, selector=0x0, option=<value optimized out>, nentries=100000, first=0) at /scratch/bkw1a/root_v5.34.28/proof/proof/src/TProofLite.cxx:1313
#19 0x00002b500b18eec4 in TProof::Process (this=0x1a6dfa0, dset=<value optimized out>, selector=<value optimized out>, option=<value optimized out>, nentries=<value optimized out>, first=<value optimized out>) at /scratch/bkw1a/root_v5.34.28/proof/proof/src/TProof.cxx:5687
#20 0x0000000000402311 in main ()
===========================================================
The lines below might hint at the cause of the crash.
If they do not help you then please submit a bug report at
http://root.cern.ch/bugs. Please post the ENTIRE stack trace
from above as an attachment in addition to anything else
that might help us fixing this issue.
===========================================================
#5 0x00002b500669c0cb in TBuffer& operator<< <TTree>(TBuffer&, TTree const*) () from /nv/blue/mgv4ce/testing/MySel.so
#6 0x00002b500669b1d0 in MySel::Streamer(TBuffer&) () from /nv/blue/mgv4ce/testing/MySel.so
#7 0x00002b5007dc398e in Streamer (this=0x7ffdce848040, actualObjectStart=0x1f7cf60, actualClass=0x1fd36f0) at /scratch/bkw1a/root_v5.34.28/build/include/TClass.h:451
#8 TBufferFile::WriteObjectClass (this=0x7ffdce848040, actualObjectStart=0x1f7cf60, actualClass=0x1fd36f0) at /scratch/bkw1a/root_v5.34.28/io/io/src/TBufferFile.cxx:2605
#9 0x00002b5007dc0564 in TBufferFile::WriteObjectAny (this=0x7ffdce848040, obj=<value optimized out>, ptrClass=0x1a74530) at /scratch/bkw1a/root_v5.34.28/io/io/src/TBufferFile.cxx:2659
#10 0x00002b5006a2a990 in operator<< (this=<value optimized out>, b=...) at /scratch/bkw1a/root_v5.34.28/build/include/TBuffer.h:401
#11 TList::Streamer (this=<value optimized out>, b=...) at /scratch/bkw1a/root_v5.34.28/core/cont/src/TList.cxx:1070
#12 0x00002b5007dc398e in Streamer (this=0x7ffdce848040, actualObjectStart=0x1b1bb80, actualClass=0x1f7d2e0) at /scratch/bkw1a/root_v5.34.28/build/include/TClass.h:451
#13 TBufferFile::WriteObjectClass (this=0x7ffdce848040, actualObjectStart=0x1b1bb80, actualClass=0x1f7d2e0) at /scratch/bkw1a/root_v5.34.28/io/io/src/TBufferFile.cxx:2605
#14 0x00002b5007dc051f in TBufferFile::WriteObjectAny (this=0x7ffdce848040, obj=0x1b1bb80, ptrClass=0x1f7d2e0) at /scratch/bkw1a/root_v5.34.28/io/io/src/TBufferFile.cxx:2662
#15 0x00002b500b189789 in operator<< <TList> (buf=..., obj=0x1b1bb80) at /scratch/bkw1a/root_v5.34.28/build/include/TBuffer.h:388
#16 0x00002b500b4d530c in TProofPlayerLite::Process (this=0x1b1b9e0, dset=<value optimized out>, selector_file=<value optimized out>, option=0x0, nentries=0, first=0) at /scratch/bkw1a/root_v5.34.28/proof/proofplayer/src/TProofPlayerLite.cxx:266
#17 0x00002b500b4d4278 in TProofPlayerLite::Process (this=0x1b1b9e0, dset=0x1f2daf0, selector=<value optimized out>, option=0x7ffdce848469 "", nentries=100000, first=0) at /scratch/bkw1a/root_v5.34.28/proof/proofplayer/src/TProofPlayerLite.cxx:97
#18 0x00002b500b149946 in TProofLite::Process (this=0x1a6dfa0, dset=0x1f2daf0, selector=0x0, option=<value optimized out>, nentries=100000, first=0) at /scratch/bkw1a/root_v5.34.28/proof/proof/src/TProofLite.cxx:1313
#19 0x00002b500b18eec4 in TProof::Process (this=0x1a6dfa0, dset=<value optimized out>, selector=<value optimized out>, option=<value optimized out>, nentries=<value optimized out>, first=<value optimized out>) at /scratch/bkw1a/root_v5.34.28/proof/proof/src/TProof.cxx:5687
#20 0x0000000000402311 in main ()
===========================================================
~~~class instance destroyed~~~
If there is no way to pass the TSelector, I am still happy! I got a nice speed-up!
Many Thanks!