HI, I am using these two files on root 4.01/02:
Its working till the chainmc.MakeProxy method but crashing after that. This code worked fine without the AddFriend method when I was using:
chainsr.MakeProxy() and chainsr.Process()
thanks for your time and help - debdatta.
file 1: testsumenergy.C
{
// usage:
// root[0] .x testsumenergy.C
//
// tested with root cvs development version dated August 18, 2004,
// but root files generated previous to this date can be used as input.
gSystem -> Load(“libTreePlayer.so”);
TChain chainmc (“NtpMC”);
chainmc.Add("/plvm/debdatta/neardet/truth/n1430304*.root");
TChain chainsr (“NtpSR”);
chainsr.Add("/plvm/debdatta/neardet/truth/n1430304*.root");
chainmc.AddFriend(“NtpSR”);
chainmc.MakeProxy(“withfriend”,“sumenergy.C”,"",“nohist”);
chainmc.Process(“withfriend.h+”);
}
file 2: sumenergy.C
double sumenergy() {
cout<<NtpSR.evthdr.nevent<<endl;
}