#include "TProofChain.h"
#include "TDSet.h"
#include "TList.h"
#include "TProof.h"
#include "TROOT.h"
#include "TEventList.h"
#include "TEntryList.h"
ClassImp(TProofChain)
TProofChain::TProofChain() : TChain()
{
fChain = 0;
fTree = 0;
fSet = 0;
fDirectory = gDirectory;
fDrawFeedback = 0;
}
TProofChain::TProofChain(TChain *chain) : TChain()
{
fChain = chain;
fTree = 0;
fSet = chain ? new TDSet((const TChain &)(*chain)) : 0;
fDirectory = gDirectory;
fDrawFeedback = 0;
if (gProof)
gProof->AddChain(chain);
}
TProofChain::~TProofChain()
{
if (fChain) {
SafeDelete(fSet);
TIter nxp(gROOT->GetListOfSockets());
TObject *o = 0;
TProof *p = 0;
while ((o = nxp()))
if ((p = dynamic_cast<TProof *>(o)))
p->RemoveChain(fChain);
fChain = 0;
} else {
fSet = 0;
}
SafeDelete(fTree);
fDirectory = 0;
}
TProofChain::TProofChain(TDSet *dset, Bool_t gettreeheader)
{
fChain = 0;
fTree = 0;
fSet = dset;
fDirectory = gDirectory;
fDrawFeedback = 0;
if (gProof) {
ConnectProof();
if (gettreeheader && dset)
fTree = gProof->GetTreeHeader(dset);
}
}
void TProofChain::Browse(TBrowser *b)
{
fSet->Browse(b);
}
Long64_t TProofChain::Draw(const char *varexp, const TCut &selection,
Option_t *option, Long64_t nentries, Long64_t firstentry)
{
if (!gProof) {
Error("Draw", "no active PROOF session");
return -1;
}
ConnectProof();
if (fDrawFeedback)
gProof->SetDrawFeedbackOption(fDrawFeedback, option);
fReadEntry = firstentry;
if (fEntryList) {
fSet->SetEntryList(fEntryList);
} else if (fEventList) {
fSet->SetEntryList(fEventList);
}
Long64_t rv = fSet->Draw(varexp, selection, option, nentries, firstentry);
return rv;
}
Long64_t TProofChain::Draw(const char *varexp, const char *selection,
Option_t *option,Long64_t nentries, Long64_t firstentry)
{
if (!gProof) {
Error("Draw", "no active PROOF session");
return -1;
}
ConnectProof();
if (fDrawFeedback)
gProof->SetDrawFeedbackOption(fDrawFeedback, option);
fReadEntry = firstentry;
if (fEntryList) {
fSet->SetEntryList(fEntryList);
} else if (fEventList) {
fSet->SetEntryList(fEventList);
}
Long64_t rv = fSet->Draw(varexp, selection, option, nentries, firstentry);
return rv;
}
TBranch *TProofChain::FindBranch(const char* branchname)
{
return (fTree ? fTree->FindBranch(branchname) : (TBranch *)0);
}
TLeaf *TProofChain::FindLeaf(const char* searchname)
{
return (fTree ? fTree->FindLeaf(searchname) : (TLeaf *)0);
}
TBranch *TProofChain::GetBranch(const char *name)
{
return (fTree ? fTree->GetBranch(name) : (TBranch *)0);
}
Bool_t TProofChain::GetBranchStatus(const char *branchname) const
{
return (fTree ? fTree->GetBranchStatus(branchname) : kFALSE);
}
TVirtualTreePlayer *TProofChain::GetPlayer()
{
if (!fTree)
if (gProof) {
fTree = gProof->GetTreeHeader(fSet);
ConnectProof();
}
return (fTree ? fTree->GetPlayer() : (TVirtualTreePlayer *)0);
}
Long64_t TProofChain::Process(const char *filename, Option_t *option,
Long64_t nentries, Long64_t firstentry)
{
if (fEntryList) {
fSet->SetEntryList(fEntryList);
} else if (fEventList) {
fSet->SetEntryList(fEventList);
}
return fSet->Process(filename, option, nentries, firstentry);
}
Long64_t TProofChain::Process(TSelector *selector, Option_t *option,
Long64_t nentries, Long64_t firstentry)
{
if (selector || option || nentries || firstentry) { }
Warning("Process", "not implemented");
return -1;
}
void TProofChain::SetDebug(Int_t level, Long64_t min, Long64_t max)
{
TTree::SetDebug(level, min, max);
}
void TProofChain::SetName(const char *name)
{
TTree::SetName(name);
}
Long64_t TProofChain::GetEntries() const
{
return (fTree ? fTree->GetMaxEntryLoop() : (Long64_t)(-1));
}
Long64_t TProofChain::GetEntries(const char *)
{
return Long64_t(-1);
}
void TProofChain::Progress(Long64_t total, Long64_t processed)
{
if (gROOT->IsInterrupted() && gProof)
gProof->StopProcess(kTRUE);
if (total) { }
fReadEntry = processed;
}
Long64_t TProofChain::GetReadEntry() const
{
return fReadEntry;
}
void TProofChain::ReleaseProof()
{
if (!gProof)
return;
gProof->Disconnect("Progress(Long64_t,Long64_t)",
this, "Progress(Long64_t,Long64_t)");
if (fDrawFeedback)
gProof->DeleteDrawFeedback(fDrawFeedback);
fDrawFeedback = 0;
}
void TProofChain::ConnectProof()
{
if (gProof && !fDrawFeedback) {
fDrawFeedback = gProof->CreateDrawFeedback();
gProof->Connect("Progress(Long64_t,Long64_t)", "TProofChain",
this, "Progress(Long64_t,Long64_t)");
}
}
Last update: Thu Jan 17 09:01:35 2008
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.