17 #include "TDirectory.h"
19 #include "Riostream.h"
26 #if ROOT_VERSION_CODE <= ROOT_VERSION(5,34,19)
31 TNamed(
"Go4Element",
"This is a Go4 EventElement"),
37 fbKeepContents(kFALSE)
40 GO4TRACE((15,
"TGo4EventElement::TGo4EventElement()",__LINE__, __FILE__));
44 TNamed(name,
"This is a Go4 EventElement"),
50 fbKeepContents(kFALSE)
52 GO4TRACE((15,
"TGo4EventElement::TGo4EventElement(const char*)",__LINE__, __FILE__));
60 fIdentifier(aBaseCat),
67 GO4TRACE((15,
"TGo4EventElement::~TGo4EventElement()",__LINE__, __FILE__));
72 GO4TRACE((12,
"TGo4EventElement::CheckEventSource(const char*)",__LINE__, __FILE__));
78 GO4TRACE((12,
"TGo4EventElement::PrintEvent()",__LINE__, __FILE__));
94 if ((name==0) || (strlen(name)==0))
return this;
96 if (strcmp(name,
".")==0)
return this;
98 if (strcmp(name,
"..")==0)
return GetParent();
109 TString searchname = GetName();
110 if (searchname.Length()>0) {
112 topb = tree->FindBranch(searchname.Data());
117 if (topb==0) topb = (TBranch*) tree->GetListOfBranches()->First();
119 Int_t index = tree->GetListOfBranches()->IndexOf(topb);
130 if (branch==0)
return 0;
132 TString cad = branch->GetName();
134 TTree* tree = branch->GetTree();
144 TClass* cl = *var_ptr ? (*var_ptr)->IsA() : 0;
145 tree->SetBranchAddress(cad.Data(), var_ptr, 0, cl, kOther_t,
true);
149 tree->SetBranchStatus(cad.Data(), 1);
151 tree->SetBranchStatus(cad.Data(), 1);
158 TString name = GetName();
159 #if ROOT_VERSION_CODE <= ROOT_VERSION(5,34,19)
161 gTree->SetBranchStatus(name.Data(), 0);
163 gTree->SetBranchStatus(name.Data(), 0);
164 TGo4Log::Info(
"-I- Deactivating elements at location : %s", name.Data());
166 TGo4Log::Warn(
"-W- Could not deactivate() event element %s in this ROOT Version, do not use!", name.Data());
172 TString name=GetName();
173 #if ROOT_VERSION_CODE <= ROOT_VERSION(5,34,19)
175 gTree->SetBranchStatus(name.Data(), 1);
177 gTree->SetBranchStatus(name.Data(), 1);
178 TGo4Log::Info(
"-I- Activating elements at location : %s", name.Data());
180 TGo4Log::Warn(
"-W- Could not activate() element %s in this ROOT Version, do not use!", name.Data());
197 TGo4Log::Error(
"Event %s, mismatch between event source and event class", GetName());
222 return res==0 ? 1 : res;
232 TDirectory* filsav = gDirectory;
234 if (sample!=0)
delete *sample;
236 TTree* thetree =
new TTree(clone->GetName(),
"Single Event Tree");
237 thetree->SetDirectory(0);
238 if (sample) *sample = clone;
239 thetree->Branch(
"Go4EventSample", clone->ClassName(), sample ? sample : &clone, 64000, 99);
242 if (sample==0)
delete clone;
253 std::cout << std::endl;
virtual TGo4EventElement * GetChild(const char *name)
virtual Bool_t CheckEventClass(TClass *cl)
virtual ~TGo4EventElement(void)
static void Warn(const char *text,...)
virtual void deactivate()
virtual void PrintEvent()
Bool_t CheckEventSource(const char *classname)
virtual Bool_t BuildEvent(TGo4EventElement *dest)
virtual void Clear(Option_t *t="")
virtual TTree * CreateSampleTree(TGo4EventElement **sample=0)
TGo4EventElement * GetParent() const
Int_t GetEventStatus() const
virtual void synchronizeWithTree(TTree *tree, TGo4EventElement **var_ptr=0)
virtual void Print(Option_t *option="") const
Bool_t fbKeepContents
Debug level.
TGo4EventSource * fxEventSource
static void Error(const char *text,...)
static void Info(const char *text,...)
virtual Int_t activateBranch(TBranch *branch, Int_t index=0, TGo4EventElement **var_ptr=0)