GSI Object Oriented Online Offline (Go4)  GO4-6.2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4AnalysisObjectManager.cxx
Go to the documentation of this file.
1 // $Id: TGo4AnalysisObjectManager.cxx 3501 2022-01-21 17:00:34Z linev $
2 //-----------------------------------------------------------------------
3 // The GSI Online Offline Object Oriented (Go4) Project
4 // Experiment Data Processing at EE department, GSI
5 //-----------------------------------------------------------------------
6 // Copyright (C) 2000- GSI Helmholtzzentrum fuer Schwerionenforschung GmbH
7 // Planckstr. 1, 64291 Darmstadt, Germany
8 // Contact: http://go4.gsi.de
9 //-----------------------------------------------------------------------
10 // This software can be used under the license agreements as stated
11 // in Go4License.txt file which is part of the distribution.
12 //-----------------------------------------------------------------------
13 
15 
16 #include "TRegexp.h"
17 #include "TMultiGraph.h"
18 #include "TKey.h"
19 #include "TObjArray.h"
20 #include "TArrayF.h"
21 #include "TFolder.h"
22 #include "TFile.h"
23 #include "TList.h"
24 #include "TMutex.h"
25 #include "TBranch.h"
26 
27 #include "TH2.h"
28 #include "TCanvas.h"
29 #include "TCutG.h"
30 #include "TROOT.h"
31 #include "TTree.h"
32 #include "TDataMember.h"
33 #include "TBaseClass.h"
34 
35 #include "TGo4Log.h"
36 #include "TGo4LockGuard.h"
37 #include "TGo4ObjectStatus.h"
38 #include "TGo4BranchStatus.h"
39 #include "TGo4Parameter.h"
40 #include "TGo4Condition.h"
41 #include "TGo4WinCond.h"
42 #include "TGo4PolyCond.h"
43 #include "TGo4HistogramEntry.h"
44 #include "TGo4TreeHistogramEntry.h"
45 #include "TGo4DynamicList.h"
47 #include "TGo4HistogramStatus.h"
48 #include "TGo4TreeStructure.h"
49 
50 #include "TGo4EventStore.h"
51 #include "TGo4EventSource.h"
52 #include "TGo4EventProcessor.h"
53 #include "TGo4BackStore.h"
54 
55 #include "TGo4Picture.h"
56 #include "TGo4CompositeEvent.h"
57 #include "TGo4ParameterStatus.h"
58 #include "TGo4MemberStatus.h"
59 #include "TGo4AnalysisImp.h"
60 
61 const char* TGo4AnalysisObjectManager::fgcTOPDYNAMICLIST = "Go4DynamicList";
62 const char* TGo4AnalysisObjectManager::fgcTOPFOLDER = "Go4";
63 const char* TGo4AnalysisObjectManager::fgcHISTFOLDER = "Histograms";
64 const char* TGo4AnalysisObjectManager::fgcDYNFOLDER = "DynamicLists";
65 const char* TGo4AnalysisObjectManager::fgcCONDFOLDER = "Conditions";
66 const char* TGo4AnalysisObjectManager::fgcPARAFOLDER = "Parameters";
67 const char* TGo4AnalysisObjectManager::fgcTREEFOLDER = "Trees";
68 const char* TGo4AnalysisObjectManager::fgcPICTFOLDER = "Pictures";
69 const char* TGo4AnalysisObjectManager::fgcCANVFOLDER = "Canvases";
70 const char* TGo4AnalysisObjectManager::fgcANALYSISFOLDER = "EventObjects";
71 const char* TGo4AnalysisObjectManager::fgcEVENTFOLDER = "Events";
72 const char* TGo4AnalysisObjectManager::fgcSRCFOLDER = "EventSources";
73 const char* TGo4AnalysisObjectManager::fgcSTOREFOLDER = "EventStores";
74 const char* TGo4AnalysisObjectManager::fgcPROCFOLDER = "EventProcessors";
75 const char* TGo4AnalysisObjectManager::fgcUSRFOLDER = "UserObjects";
76 const char* TGo4AnalysisObjectManager::fgcTMPFOLDER = "Go4-tmp";
77 
94 
95 
96 
97 #define fguSUBFOLDERMAXLEN 1024
98 
100  TNamed(name,"The Go4 Analysis Object Manager"),
101  fxGo4Dir(0),fxHistogramDir(0),fxConditionDir(0), fxParameterDir(0),
102  fxDynListDir(0),fxUserDir(0), fxTreeDir(0), fxPictureDir(0), fxCanvasDir(0),
103  fxStoreDir(0), fxSourceDir(0), fxProcessorDir(0), fxEventDir(0),
104  fxAnalysisDir(0), fxTempFolder(0),
105  fxMatchList(0), fxMatchIterator(0),
106  fiDynListCount(0), fiDynListInterval(0),
107  fbCreatedinMake(kFALSE), fbSuppressLoadHistograms(kFALSE), fbSortedOrder(kFALSE)
108 {
109  fxDirMutex = new TMutex(kTRUE);
110  fxGo4Dir = gROOT->GetRootFolder()->AddFolder(fgcTOPFOLDER,"The Go4 Object folder");
111  fxGo4Dir->SetOwner(kTRUE); // top go4 dir owns subfolders
112  gROOT->GetListOfBrowsables()->Add(fxGo4Dir, fxGo4Dir->GetName());
113  fxHistogramDir = fxGo4Dir->AddFolder(fgcHISTFOLDER,"All Histogram objects");
114  fxHistogramDir->SetOwner(kTRUE);
115  fxConditionDir = fxGo4Dir->AddFolder(fgcCONDFOLDER,"All Condition objects");
116  fxConditionDir->SetOwner(kTRUE);
117  fxParameterDir = fxGo4Dir->AddFolder(fgcPARAFOLDER,"All Parameter objects");
118  fxParameterDir->SetOwner(kTRUE);
119  fxDynListDir = fxGo4Dir->AddFolder(fgcDYNFOLDER,"Dynamic List Instances");
120  fxDynListDir->SetOwner(kTRUE);
121  fxTreeDir = fxGo4Dir->AddFolder(fgcTREEFOLDER,"References to trees");
122  fxTreeDir->SetOwner(kFALSE); // tree dir does not own objects,
123  fxPictureDir = fxGo4Dir->AddFolder(fgcPICTFOLDER,"Picture objects");
124  fxPictureDir->SetOwner(kTRUE);
125  fxCanvasDir = fxGo4Dir->AddFolder(fgcCANVFOLDER,"All TCanvases");
126  fxCanvasDir->SetOwner(kTRUE);
127  fxAnalysisDir = fxGo4Dir->AddFolder(fgcANALYSISFOLDER,"Event objects of current analysis");
128  fxAnalysisDir->SetOwner(kTRUE); // owns folders, but not objects in folders
129  fxStoreDir = fxAnalysisDir->AddFolder(fgcSTOREFOLDER,"References to event stores");
130  fxStoreDir->SetOwner(kFALSE); // event classes dir does not own objects,
131  fxSourceDir = fxAnalysisDir->AddFolder(fgcSRCFOLDER,"References to event sources");
132  fxSourceDir->SetOwner(kFALSE); // event classes dir does not own objects,
133  fxProcessorDir = fxAnalysisDir->AddFolder(fgcPROCFOLDER,"References to event processors");
134  fxProcessorDir->SetOwner(kFALSE); // event classes dir does not own objects,
135  fxEventDir = fxAnalysisDir->AddFolder(fgcEVENTFOLDER,"References to event structures");
136  fxEventDir->SetOwner(kFALSE); // event classes dir does not own objects,
137  fxUserDir = fxGo4Dir->AddFolder(fgcUSRFOLDER,"For User Objects");
138 
139  // FIXME: SL, 2.01.2012 why owner flag is disabled here, causes memory leak when destroyed
140  fxGo4Dir->SetOwner(kFALSE);
141 
142  fxTempFolder = gROOT->GetRootFolder()->AddFolder(fgcTMPFOLDER,"The Go4 temporary object folder");
143  fxTempFolder->SetOwner(kFALSE);
144 
145  gROOT->GetListOfCleanups()->Add(this);
146 }
147 
149  TNamed(),
150  fxGo4Dir(0),fxHistogramDir(0),fxConditionDir(0),
151  fxDynListDir(0), fxUserDir(0), fxTreeDir(0), fxPictureDir(0), fxCanvasDir(0),
152  fxStoreDir(0), fxSourceDir(0), fxProcessorDir(0), fxEventDir(0),
153  fxAnalysisDir(0), fxTempFolder(0),
154  fiDynListCount(0), fiDynListInterval(0),
155  fbCreatedinMake(kFALSE), fbSuppressLoadHistograms(kFALSE), fbSortedOrder(kFALSE)
156 {
157  // ctor for streamer only!
158 
159  gROOT->GetListOfCleanups()->Add(this);
160 }
161 
162 
164 {
165  gROOT->GetListOfCleanups()->Remove(this);
166 
167  delete fxMatchIterator;
168  delete fxMatchList;
169  gROOT->GetListOfBrowsables()->Remove(fxGo4Dir);
170  //std::cout <<"Removed all folders from list of browsables" << std::endl;
171 
172  gROOT->GetRootFolder()->Remove(fxTempFolder);
173  gROOT->GetRootFolder()->Remove(fxGo4Dir);
174 
175  // disable canvas clear - does not work for some reasons
176  fxCanvasDir->Clear();
177 
178  fxHistogramDir->Clear();
179  fxConditionDir->Clear();
180  fxParameterDir->Clear();
181  fxDynListDir->Clear();
182  fxUserDir->Clear();
183  fxTreeDir->Clear();
184  fxPictureDir->Clear();
185 
186  fxEventDir->Clear();
187  fxProcessorDir->Clear();
188  fxStoreDir->Clear();
189  fxSourceDir->Clear();
190  fxGo4Dir->Clear();
191  fxTempFolder->Clear();
192 
193  //std::cout <<"Cleared all folders" << std::endl;
194  delete fxTempFolder;
195  //std::cout <<"deleted temporary folder" << std::endl;
196  delete fxGo4Dir;
197  //std::cout <<"deleted top folder" << std::endl;
198 
199  delete fxDirMutex;
200 }
201 
203 {
204  if ((obj!=0) && (obj!=this)) {
205  // remove objects from canvas folder - it may happen that canvas automatically deleted
206  if (fxCanvasDir) fxCanvasDir->RecursiveRemove(obj);
207  }
208 }
209 
210 
211 Bool_t TGo4AnalysisObjectManager::AddObject(TNamed * anything, const char* subfolder, Bool_t replace)
212 {
213  GO4TRACE((11,"TGo4AnalysisObjectManager::AddObject(TNamed *)",__LINE__, __FILE__));
214  // unspecified objects are only allowed to put into userdir
215  return (AddObjectToFolder(anything,fxUserDir,subfolder,replace));
216 }
217 
218 Bool_t TGo4AnalysisObjectManager::RemoveObject(const char * name, Bool_t del)
219 {
220  return RemoveObjectFromFolder(name, fxUserDir, del);
221 }
222 
223 
224 TObject* TGo4AnalysisObjectManager::GetAsTObject(const char * name, const char* folder)
225 {
226  GO4TRACE((11,"TGo4AnalysisObjectManager::GetAsTObject(const char*, const char*)",__LINE__, __FILE__));
227  //
228  TObject* ob(0);
229  TFolder* searchfold(fxGo4Dir);
230  if((folder!=0) && (strcmp(folder,fgcTOPFOLDER)!=0))
231  searchfold = FindSubFolder(fxGo4Dir, folder, kFALSE);
232  if(searchfold) {
233  ob = FindObjectInFolder(searchfold, name);
234  //std::cout << "found object in top folder :" << ob << std::endl;
235  if(ob && ob->InheritsFrom(TTree::Class())) ob=0; // disable sending tree to gui!
236  if(ob && ob->InheritsFrom(TFolder::Class())) ob=0; // disable sending complete folder
237  if(ob && ob->InheritsFrom(TGo4EventElement::Class())) ob=0; // disable events
238  if(ob && ob->InheritsFrom(TGo4EventSource::Class())) ob=0; // disable events
239  if(ob && ob->InheritsFrom(TGo4EventStore::Class())) ob=0; // disable events
240  if(ob && ob->InheritsFrom(TGo4EventProcessor::Class())) ob=0; // disable events
241  }
242  if(ob) {
243  TGo4Analysis::Instance()->Message(0,"AnalysisObjectManager - found object %s of class %s",
244  ob->GetName(), ob->ClassName());
245  } else {
246  TGo4Analysis::Instance()->Message(0,"!!! AnalysisObjectManager - no such object %s !!!",
247  name);
248  }
249  return ob;
250 }
251 
252 
253 
254 TNamed * TGo4AnalysisObjectManager::GetObject(const char * name, const char* folder)
255 {
256  return dynamic_cast<TNamed*> (GetAsTObject(name, folder));
257 }
258 
259 
261 {
262  GO4TRACE((11,"TGo4AnalysisObjectManager::ClearObject(char *)",__LINE__, __FILE__));
263  Bool_t rev=kTRUE;
264  TGo4LockGuard dirguard(fxDirMutex);
265  TObject* ob = fxGo4Dir->FindObjectAny(name);
266  if(ob!=0)
267  {
268  if(ob->InheritsFrom(TFolder::Class()))
269  rev=ClearFolder(dynamic_cast<TFolder*>(ob));
270  else
271  rev=ClearObject(ob);
272  }
273  return rev;
274 }
275 
276 
278 {
279  Bool_t rev=kFALSE;
280  TGo4LockGuard dirguard(fxDirMutex);
281  TObject* ob= fxGo4Dir->FindObjectAny(name);
282  if(ob!=0)
283  {
284  if(ob->InheritsFrom(TFolder::Class()))
285  rev=DeleteFolder(dynamic_cast<TFolder*>(ob));
286  else
287  rev=DeleteObject(ob);
288  }
289  return rev;
290 }
291 
292 Bool_t TGo4AnalysisObjectManager::ProtectObjects(const char* name, const Option_t* flags)
293 {
294  Bool_t rev = kFALSE;
295  TGo4LockGuard dirguard(fxDirMutex);
296  TObject* ob= fxGo4Dir->FindObjectAny(name);
297  if(ob!=0)
298  {
299  if(ob->InheritsFrom(TFolder::Class()))
300  rev=ProtectFolder(dynamic_cast<TFolder*>(ob), flags);
301  else
302  rev=ProtectObject(ob, flags);
303  }
304  return rev;
305 }
306 
308  TGo4CompositeEvent* compevent,
309  Int_t startindex, Int_t* skip,
310  const char* name, const char* title)
311 {
312  GO4TRACE((11,"TGo4AnalysisObjectManager::CreateCompositeBranchFolder(TObjArray*,...)",__LINE__, __FILE__));
313  if (branchlist==0) return 0;
314 
315  if (compevent==0) return CreateBranchFolder(branchlist,name,title);
316 
317  Int_t lastindex=0;
318  if(startindex==1)
319  // top event: scan everything
320  lastindex = startindex + branchlist->GetLast();
321  else
322  // subevent: scan only own members
323  lastindex = startindex + compevent->getNElements();
324 
325  TFolder* subnames=0;
326  TList* nameslist = new TList;
327  TGo4ObjectStatus* state;
328  TObjArray* csubevents = compevent->getListOfComposites();
329 
330  Int_t skippedentries=0;
331  Int_t offset=0;
332  for(Int_t i=startindex; i<lastindex;i++) {
333  //std::cout <<"i+offset="<<i+offset << std::endl;
334  TClass* cl=0;
335  TObject* entry=branchlist->At(i+offset);
336  if((entry!=0) && entry->InheritsFrom(TBranch::Class())) {
337  // found subfolder, process it recursively
338  TBranch* currentbranch= dynamic_cast<TBranch*> (entry);
339  TObjArray* currentbranchlist=0;
340  if (currentbranch!=0) {
341  currentbranchlist=currentbranch->GetListOfBranches();
342  cl=gROOT->GetClass(currentbranch->GetClassName());
343  }
344  if((cl!=0) && cl->InheritsFrom(TGo4CompositeEvent::Class())) {
345  // subevent is also composite event, treat next n branches as subbranches:
346  TGo4CompositeEvent* subevent=0;
347  TString branchname(currentbranch->GetName());
348  Ssiz_t leng = branchname.Length();
349  branchname.Resize(leng-1); // strip dot from branchname
350  //std::cout <<"searching for composite sub event "<< branchname.Data() << std::endl;
351  if(csubevents!=0)
352  subevent = dynamic_cast<TGo4CompositeEvent *>(csubevents->FindObject(branchname.Data()));
353 
354  if((subevent!=0) && subevent->getNElements()>0) {
355  //std::cout <<"found composite subevent "<< subevent->GetName() << std::endl;
356  // found subbranch, add it to folder struct
357 
358  subnames=CreateCompositeBranchFolder(branchlist,
359  subevent,
360  i+offset+1, &skippedentries,
361  subevent->GetName(),
362  subevent->GetTitle());
363  nameslist->AddLast(subnames);
364  offset+=skippedentries;
365  //std::cout <<"skipped:"<<skippedentries<<", i:"<<i << std::endl;
366  //std::cout <<"offset:"<<offset<< std::endl;
367  // now process subbranchlist currentbranchlist of compevent,
368  // add members of this folder to existing folder subnames!
369  TFolder* temp=CreateBranchFolder(currentbranchlist,
370  "dummy",
371  "dummy");
372  subnames->GetListOfFolders()->AddAll(temp->GetListOfFolders());
373  }
374  else
375  {
376  //std::cout <<"composite subevent is basic member..." << std::endl;
377  // subevent not in list, normal operation:
378  //state=new TGo4ObjectStatus(dynamic_cast<TNamed*> (entry) );
379  //nameslist->AddLast(state);
380  if(currentbranchlist!=0)
381  {
382  if(currentbranchlist->IsEmpty())
383  {
384  // subbranchlist is empty, add status object to folder
385  state=new TGo4BranchStatus(currentbranch);
386  nameslist->AddLast(state);
387  }
388  else
389  {
390  subnames=CreateBranchFolder(currentbranchlist,
391  currentbranch->GetName(),
392  currentbranch->GetTitle());
393  nameslist->AddLast(subnames);
394  }
395  } // if(currentbranchlist)
396  } //if(subevent && subevent->getNElements()>0)
397  } // if(cl && cl->InheritsFrom(TGo4CompositeEvent))
398  else
399  {
400  // subevent is not a composite event, normal operation:
401  // state=new TGo4ObjectStatus(dynamic_cast<TNamed*> (entry) );
402  // nameslist->AddLast(state);
403  if(currentbranchlist!=0)
404  {
405  if(currentbranchlist->IsEmpty())
406  {
407  // subbranchlist is empty, add status object to folder
408  state=new TGo4BranchStatus(currentbranch);
409  nameslist->AddLast(state);
410  }
411  else
412  {
413  subnames=CreateBranchFolder(currentbranchlist,
414  currentbranch->GetName(),
415  currentbranch->GetTitle());
416  nameslist->AddLast(subnames);
417  }
418  }
419  //std::cout <<"added entry"<< entry->GetName() << std::endl;
420  }
421  }
422  else
423  {
424  break;
425  // if(entry)
426  // std::cout <<"ERROR: no branch in branchlist, class:"<< entry->ClassName() << std::endl;
427  // else
428  // std::cout << "ZERO entry in branchlist"<< std::endl;
429 
430  } //if(entry->InheritsFrom(TBranch))
431  } // for()
432 
433  *skip=lastindex+offset-startindex;
434  TFolder* fold = fxTempFolder->AddFolder(name,title,nameslist);
435  fold->SetOwner(kTRUE);
436  fxTempFolder->Remove(fold);
437  return fold;
438 }
439 
441 {
442  GO4TRACE((11,"TGo4AnalysisObjectManager::CreateTreeStructure(TTree*)",__LINE__, __FILE__));
443  //
444  TGo4TreeStructure* tstructure=0;
445  if(thetree)
446  {
447  const char* treename=thetree->GetName();
448  const char* treetitle=thetree->GetTitle();
449  TGo4Analysis::Instance()->Message(0,"AnalysisObjectManager - creating structure of tree %s",
450  treename);
451  TObjArray* branchlist=thetree->GetListOfBranches();
452  tstructure= new TGo4TreeStructure(treename);
453  tstructure->fxTopFolder=CreateBranchFolder(branchlist,treename,treetitle, kTRUE);
454  }
455  else {}
456  return tstructure;
457 }
458 
460 {
461  GO4TRACE((11,"TGo4AnalysisObjectManager::CreateTreeStructure(const char *)",__LINE__, __FILE__));
462  TTree* thetree=0;
463  if(fxTreeDir)
464  {
465  thetree=dynamic_cast<TTree*> (fxTreeDir->FindObjectAny(treename));
466  }
467  else
468  {
469  thetree=0;
470  }
471  return (CreateTreeStructure(thetree));
472 }
473 
474 
475 TFolder* TGo4AnalysisObjectManager::CreateMembersFolder(TObject* obj, const char* membrfoldername, TClass* cl)
476 {
477  if(cl==0) return 0;
478  TList* nameslist= new TList;
479 
480  // now process baseclasses of event:
481  TIter biter(cl->GetListOfBases());
482  TObject* bob=0;
483  while((bob=biter()) !=0) {
484  TBaseClass* baseclass = dynamic_cast<TBaseClass*>(bob);
485  if(baseclass==0) continue;
486 
487  // we have a baseclass
488  TClass* bclass=baseclass->GetClassPointer();
489  if(bclass==0) continue;
490 
491  if(!strcmp(bclass->GetName(),"TNamed")) continue; // suppress bases above
492 
493  // recursively find out members of all baseclasses
494  TFolder* subfold = CreateMembersFolder(0, bclass->GetName(), bclass);
495  if(subfold!=0)
496  nameslist->AddLast(subfold);
497  } // while((bob=baseiter->Next()) !=0)
498 
499  TIter miter(cl->GetListOfDataMembers());
500  TObject* nob=0;
501  // scan members of this event class:
502  while((nob=miter()) !=0) {
503  TDataMember* mem = dynamic_cast<TDataMember*>(nob);
504  if((mem==0) || mem->IsaPointer()) continue; // suppress heap aggregates
505  // later, we might scan these recursively
506 
507  TString sbuf;
508 
509  switch(mem->GetArrayDim()) {
510  case 1:
511  sbuf = TString::Format("%s[%d]", mem->GetName(), mem->GetMaxIndex(0));
512  break;
513 
514  case 2:
515  sbuf = TString::Format("%s[%d][%d]", mem->GetName(), mem->GetMaxIndex(0), mem->GetMaxIndex(1));
516  break;
517 
518  default:
519  sbuf = mem->GetName();
520  }
521 
522  TGo4MemberStatus* state = new TGo4MemberStatus(sbuf.Data(), mem->GetFullTypeName());
523  nameslist->AddLast(state);
524  } // while
525 
526  // now process components of composite event
527  if ((obj!=0) && (obj->InheritsFrom(TGo4CompositeEvent::Class()))) {
528 
529  TObjArray* arr =((TGo4CompositeEvent*)obj)->getElements();
530 
531  if (arr!=0)
532  for (Int_t n=0;n<=arr->GetLast();n++) {
533  TGo4EventElement* elem = (TGo4EventElement*) arr->At(n);
534  if (elem==0) continue;
535  TFolder* subfold = CreateMembersFolder(elem, elem->GetName(), elem->IsA());
536  if(subfold!=0)
537  nameslist->AddLast(subfold);
538  }
539  }
540 
541  TFolder* memberfolder = fxTempFolder->AddFolder(membrfoldername, TString("Object of class ") + cl->GetName(), nameslist);
542  fxTempFolder->Remove(memberfolder);
543  memberfolder->SetOwner(kTRUE);
544  return memberfolder;
545 }
546 
547 Bool_t TGo4AnalysisObjectManager::AddHistogram(TH1 * his, const char* subfolder, Bool_t replace)
548 {
549  GO4TRACE((11,"TGo4AnalysisObjectManager::AddHistogram(TH1*)",__LINE__, __FILE__));
550  Bool_t rev = AddObjectToFolder(his, fxHistogramDir, subfolder, replace, kTRUE);
551  // for histograms: add with unique object names within histogramdir
552  // to avoid errors in TTree::Draw()
553  if(rev && his) his->SetDirectory(gROOT); // assign histo to the top dir, no file!
554  return rev;
555 }
556 
557 TH1* TGo4AnalysisObjectManager::MakeTH1(const char* histotype,
558  const char* foldername,
559  const char* histoname,
560  Int_t nbinsx,
561  Axis_t xlow,
562  Axis_t xup,
563  const char* title,
564  const char* xtitle,
565  const char* ytitle) {
566 
567  TString htype(histotype);
568  htype.ToUpper();
569  if (htype.Length()==0) htype = "I";
570  TClass* cl = 0;
571 
572  switch (htype[0]) {
573  case 'C' : cl = TH1C::Class(); break;
574  case 'D' : cl = TH1D::Class(); break;
575  case 'F' : cl = TH1F::Class(); break;
576  case 'I' : cl = TH1I::Class(); break;
577  case 'S' : cl = TH1S::Class(); break;
578  default : cl = TH1I::Class();
579  }
580 
581  TH1* histo = (TH1*) TestObject(fxHistogramDir, foldername, histoname, cl);
582 
583  if (histo) return histo;
584 
585  switch(htype[0]) {
586  case 'C' : histo = new TH1C(histoname, histoname, nbinsx, xlow, xup); break;
587  case 'D' : histo = new TH1D(histoname, histoname, nbinsx, xlow, xup); break;
588  case 'F' : histo = new TH1F(histoname, histoname, nbinsx, xlow, xup); break;
589  case 'I' : histo = new TH1I(histoname, histoname, nbinsx, xlow, xup); break;
590  case 'S' : histo = new TH1S(histoname, histoname, nbinsx, xlow, xup); break;
591  default : histo = new TH1I(histoname, histoname, nbinsx, xlow, xup);
592  }
593 
594  if (title) histo->SetTitle(title);
595  if (xtitle) histo->SetXTitle(xtitle);
596  if (ytitle) histo->SetYTitle(ytitle);
597  AddHistogram(histo, foldername);
598  return histo;
599 }
600 
601 TH2* TGo4AnalysisObjectManager::MakeTH2(const char* histotype,
602  const char* foldername,
603  const char* histoname,
604  Int_t nbinsx,
605  Axis_t xlow,
606  Axis_t xup,
607  Int_t nbinsy,
608  Axis_t ylow,
609  Axis_t yup,
610  const char* title,
611  const char* xtitle,
612  const char* ytitle) {
613  TString htype(histotype);
614  htype.ToUpper();
615  if (htype.Length()==0) htype = "I";
616 
617  TClass* cl = 0;
618 
619  switch (htype[0]) {
620  case 'C' : cl = TH2C::Class(); break;
621  case 'D' : cl = TH2D::Class(); break;
622  case 'F' : cl = TH2F::Class(); break;
623  case 'I' : cl = TH2I::Class(); break;
624  case 'S' : cl = TH2S::Class(); break;
625  default : cl = TH2I::Class();
626  }
627 
628  TH2* histo = (TH2*) TestObject(fxHistogramDir, foldername, histoname, cl);
629 
630  if (histo) return histo;
631 
632  switch(htype[0]) {
633  case 'C' : histo = new TH2C(histoname, histoname, nbinsx, xlow, xup, nbinsy, ylow, yup); break;
634  case 'D' : histo = new TH2D(histoname, histoname, nbinsx, xlow, xup, nbinsy, ylow, yup); break;
635  case 'F' : histo = new TH2F(histoname, histoname, nbinsx, xlow, xup, nbinsy, ylow, yup); break;
636  case 'I' : histo = new TH2I(histoname, histoname, nbinsx, xlow, xup, nbinsy, ylow, yup); break;
637  case 'S' : histo = new TH2S(histoname, histoname, nbinsx, xlow, xup, nbinsy, ylow, yup); break;
638  default : histo = new TH2I(histoname, histoname, nbinsx, xlow, xup, nbinsy, ylow, yup);
639  }
640 
641  if (title) histo->SetTitle(title);
642  if (xtitle) histo->SetXTitle(xtitle);
643  if (ytitle) histo->SetYTitle(ytitle);
644  AddHistogram(histo, foldername);
645  return histo;
646 }
647 
648 TFolder * TGo4AnalysisObjectManager::CreateBranchFolder(TObjArray* branchlist,
649  const char* name,
650  const char* title,
651  Bool_t istopbranch)
652 {
653  GO4TRACE((11,"TGo4AnalysisObjectManager::CreateBranchFolder(TObjArray*)",__LINE__, __FILE__));
654  if (branchlist==0) return 0;
655 
656  TList* nameslist= new TList;
657  TGo4ObjectStatus* state;
658  Int_t cursor=0;
659  TObject* entry = 0;
660  TIter iter(branchlist);
661  while((entry=iter()) !=0) {
662  if(entry->InheritsFrom(TBranch::Class())) {
663  // found subfolder, process it recursively
664  TBranch* subbranch= dynamic_cast<TBranch*> (entry);
665  TObjArray* subbranchlist = subbranch->GetListOfBranches();
666  if(subbranchlist!=0) {
667  if(subbranchlist->IsEmpty()) {
668  // subbranchlist is empty, add status object to folder
669  state=new TGo4BranchStatus(subbranch);
670  nameslist->AddLast(state);
671  } else {
672  // found subbranchlist
673  // test for composite event:
674 
675  TFolder* subnames = 0;
676 
677  TClass* cl = gROOT->GetClass(subbranch->GetClassName());
678  if((cl!=0) && cl->InheritsFrom(TGo4CompositeEvent::Class()) && istopbranch) {
679  // search for composite event of that name in Go4 (only if top level call)
680  TGo4CompositeEvent* cevent=0;
681  TString branchname(subbranch->GetName());
682  Ssiz_t leng = branchname.Length();
683  branchname.Resize(leng-1); // strip dot from branchname
684  //std::cout <<"searching for composite event "<< branchname.Data() << std::endl;
685  cevent = dynamic_cast<TGo4CompositeEvent*> (GetEventStructure(branchname.Data()));
686  if(cevent!=0) {
687  //std::cout <<"found top comp event" << std::endl;
688  Int_t skippedentries=0;
689  // we pass complete top branchlist to method
690  subnames = CreateCompositeBranchFolder(
691  branchlist,cevent,cursor+1,
692  &skippedentries,
693  cevent->GetName(),
694  cevent->GetTitle());
695  // skip comp subelements in iterator:
696  //std::cout <<"top skipped:"<<skippedentries<< std::endl;
697  // now process subbranchlist of top compevent,
698  // add members of this folder to existing folder subnames!
699  TFolder* temp = CreateBranchFolder(subbranchlist, "dummy","dummy");
700  subnames->GetListOfFolders()->AddAll(temp->GetListOfFolders());
701  for(Int_t t=0;t<skippedentries;++t) {
702  iter();
703  cursor++;
704  }
705  } else {
706  //std::cout <<"not found top comp event" << std::endl;
707  subnames=CreateBranchFolder(subbranchlist,
708  subbranch->GetName(),
709  subbranch->GetTitle());
710  }
711  } else {
712  //std::cout <<"no class or not top branch" << std::endl;
713  subnames=CreateBranchFolder(subbranchlist,
714  subbranch->GetName(), subbranch->GetTitle());
715  }
716  nameslist->AddLast(subnames);
717  } // if(subbranchlist->IsEmpty())
718  } else {
719  // no subbranchlist, should not happen...
720  // add status object to folder
721  state=new TGo4BranchStatus(subbranch);
722  nameslist->AddLast(state);
723  } // if(subbranchlist)
724  }
725  cursor++;
726  } // while((entry=iter()) !=0)
727 
728  TFolder* fold = fxTempFolder->AddFolder(name,title,nameslist);
729  fold->SetOwner(kTRUE);
730  fxTempFolder->Remove(fold);
731  return fold;
732 }
733 
734 Bool_t TGo4AnalysisObjectManager::AddTree(TTree* tree, const char* subfolder)
735 {
736  GO4TRACE((11,"TGo4AnalysisObjectManager::AddTree(TTree*, char*)",__LINE__, __FILE__));
737  return (AddObjectToFolder(tree,fxTreeDir,subfolder,kFALSE));
738 }
739 
740 Bool_t TGo4AnalysisObjectManager::RemoveTree(TTree * tree, const char* stepname)
741 {
742  GO4TRACE((11,"TGo4AnalysisObjectManager::RemoveTree(TTree*, const char*)",__LINE__, __FILE__));
743  if (tree==0) return kFALSE;
744 
745  TGo4LockGuard listguard(fxDirMutex);
746  fxTreeDir->Remove(tree);
747  return kTRUE;
748 }
749 
751 {
752  GO4TRACE((11,"TGo4AnalysisObjectManager::GetHistogram(char *)",__LINE__, __FILE__));
753  TH1* rev = dynamic_cast<TH1*> (FindObjectInFolder(fxHistogramDir, name));
754  if(rev==0) rev = dynamic_cast<TH1*> (FindObjectInFolder(fxUserDir, name)); // also check user objects dir
755  return rev;
756 }
757 
758 TTree * TGo4AnalysisObjectManager::GetTree(const char * name)
759 {
760  GO4TRACE((11,"TGo4AnalysisObjectManager::GetTree(char *)",__LINE__, __FILE__));
761  return dynamic_cast<TTree*> (FindObjectInFolder(fxTreeDir, name));
762 }
763 
764 Bool_t TGo4AnalysisObjectManager::RemoveHistogram(const char * name, Bool_t del)
765 {
766  GO4TRACE((11,"TGo4AnalysisObjectManager::RemoveHistogram(char*)",__LINE__, __FILE__));
767  //
768  return RemoveObjectFromFolder(name, fxHistogramDir, del);
769 }
770 
771 
773 {
774  GO4TRACE((11,"TGo4AnalysisObjectManager::AddAnalysisCondition(TGo4Condition *)",__LINE__, __FILE__));
775  return(AddObjectToFolder(con,fxConditionDir,subfolder,kTRUE));
776 }
777 
779  Bool_t counter, TFolder* parent)
780 {
781  GO4TRACE((11,"TGo4AnalysisObjectManager::SetAnalysisCondition(char*, TGo4Condition*, Bool_t)",__LINE__, __FILE__));
782 
783  if(con==0) return kFALSE;
784 
785  TGo4LockGuard listguard(fxDirMutex);
786  Bool_t rev(kFALSE);
787  TFolder* topfolder=0;
788  if(parent)
789  topfolder=parent;
790  else
791  topfolder=fxConditionDir;
792 
793  TObject* searchresult=topfolder->FindObjectAny(name);
794  if(searchresult==0)
795  searchresult=fxUserDir->FindObjectAny(name);
796  // condition may be under user objects folder if not found in topfolder
797  TGo4Condition* oldcon(0);
798  if(searchresult && searchresult->InheritsFrom(TGo4Condition::Class())) {
799  oldcon= dynamic_cast<TGo4Condition *> (searchresult);
800  } else
801  if (searchresult && searchresult->InheritsFrom(TFolder::Class())) {
802  // this is for the case that condition has same name as its folder!
803  TFolder* subf=dynamic_cast<TFolder*>(searchresult);
804  searchresult=subf->FindObjectAny(name);
805  oldcon= dynamic_cast<TGo4Condition *> (searchresult);
806  }
807  if(oldcon!=0) {
808  // update existing condition of given name
809  rev = oldcon->UpdateFrom(con,counter);
810  //std::cout << "++++ Updated condition "<< name<<" from condition "<< con->GetName() << std::endl;
811  //oldcon->PrintCondition(true);
812  } else {
813  // condition not yet exisiting, add external condition
814  TGo4Condition* clonedcon = dynamic_cast<TGo4Condition*>(con->Clone());
815 
816  TGo4PolyCond::CleanupSpecials(); // remove reference to cloned cut
817 
818  const char* separ = strrchr(name, '/');
819  if (separ!=0) {
820  TString fname(name, separ-name);
821  rev=AddObjectToFolder(clonedcon,topfolder,fname.Data(),kTRUE,kFALSE,kFALSE);
822  } else
823  rev=AddObjectToFolder(clonedcon,topfolder,0,kTRUE,kFALSE,kFALSE);
824 
825  }
826  return rev;
827 }
828 
829 TGo4Condition * TGo4AnalysisObjectManager::GetAnalysisCondition(const char * name, const char* cond_cl)
830 {
831  GO4TRACE((11,"TGo4AnalysisObjectManager::GetAnalysisCondition(char*)",__LINE__, __FILE__));
832  TGo4Condition* cond = dynamic_cast<TGo4Condition*> (FindObjectInFolder(fxConditionDir, name));
833  // some users have their conditions rather in user folder...
834  if(cond==0) cond = dynamic_cast<TGo4Condition*> (FindObjectInFolder(fxUserDir, name));
835 
836  if ((cond!=0) && (cond_cl!=0))
837  if(!cond->InheritsFrom(cond_cl)) cond = 0;
838 
839  return cond;
840 }
841 
843  const char* conditionname,
844  Double_t xlow,
845  Double_t xup,
846  const char* bindhistogram,
847  Bool_t invert)
848 {
849  TGo4WinCond* wcond = (TGo4WinCond*)
850  TestObject(fxConditionDir, foldername, conditionname, TGo4WinCond::Class());
851 
852  if (wcond) return wcond;
853 
854  wcond = new TGo4WinCond(conditionname);
855  wcond->SetValues(xlow, xup);
856  if (bindhistogram!=0)
857  wcond->SetHistogram(bindhistogram);
858  if (invert) wcond->Invert(invert);
859  AddAnalysisCondition(wcond, foldername);
860  return wcond;
861 }
862 
864  const char* conditionname,
865  Double_t xlow,
866  Double_t xup,
867  Double_t ylow,
868  Double_t yup,
869  const char* bindhistogram,
870  Bool_t invert)
871 {
872  TGo4WinCond* wcond = (TGo4WinCond*)
873  TestObject(fxConditionDir, foldername, conditionname, TGo4WinCond::Class());
874 
875  if (wcond) return wcond;
876 
877  wcond = new TGo4WinCond(conditionname);
878  wcond->SetValues(xlow, xup, ylow, yup);
879  if (bindhistogram!=0)
880  wcond->SetHistogram(bindhistogram);
881  if (invert) wcond->Invert(invert);
882  AddAnalysisCondition(wcond, foldername);
883  return wcond;
884 }
885 
887  const char* conditionname,
888  Int_t size,
889  Float_t (*points)[2],
890  const char* bindhistogram,
891  Bool_t invert)
892 {
893  TGo4PolyCond* pcond = (TGo4PolyCond*)
894  TestObject(fxConditionDir, foldername, conditionname, TGo4PolyCond::Class());
895 
896  if (pcond) return pcond;
897 
898  TArrayF fullx(size+1), fully(size+1);
899  int numpoints = size;
900 
901  for (int i=0;i<numpoints;i++) {
902  fullx[i] = points[i][0];
903  fully[i] = points[i][1];
904  }
905 
906  // connect first and last points
907  if ((fullx[0]!=fullx[numpoints-1]) || (fully[0]!=fully[numpoints-1])) {
908  fullx[numpoints] = fullx[0];
909  fully[numpoints] = fully[0];
910  numpoints++;
911  }
912 
913  TCutG mycat("initialcut", numpoints, fullx.GetArray(), fully.GetArray());
914  pcond = new TGo4PolyCond(conditionname);
915  pcond->SetValues(&mycat);
916  if (bindhistogram!=0)
917  pcond->SetHistogram(bindhistogram);
918  if (invert) pcond->Invert(invert);
919  AddAnalysisCondition(pcond, foldername);
920  return pcond;
921 }
922 
923 
925 {
926  GO4TRACE((11,"TGo4AnalysisObjectManager::RemoveAnalysisCondition(char*)",__LINE__, __FILE__));
927  return RemoveObjectFromFolder(name, fxConditionDir, kTRUE);
928 }
929 
930 TGo4ObjectStatus * TGo4AnalysisObjectManager::CreateObjectStatus(const char * name, const char* folder)
931 {
932  TNamed* object=GetObject(name, folder);
933  return CreateObjectStatus(object);
934 }
935 
937 {
938  if(obj==0) return 0;
939 
940  if(obj->InheritsFrom(TH1::Class()))
941  return new TGo4HistogramStatus(dynamic_cast<TH1*> (obj),fullinfo);
942 
943  if(obj->InheritsFrom(TGo4Parameter::Class()))
944  return new TGo4ParameterStatus(dynamic_cast<TGo4Parameter*> (obj), fullinfo);
945 
946  return new TGo4ObjectStatus(obj);
947 }
948 
950 {
951  GO4TRACE((11,"TGo4AnalysisObjectManager::CreateNamesList()",__LINE__, __FILE__));
952  TGo4LockGuard listguard(fxDirMutex);
953  TGo4AnalysisObjectNames* namesobject=0;
954  //fxTempFolder->Clear();
955  const char* name = TGo4Analysis::Instance()->GetName();
956  if ((name==0) || (strlen(name)==0)) name = "Go4NamesList";
957  namesobject= new TGo4AnalysisObjectNames(name);
958  namesobject->fxTopFolder=CreateNamesFolder(fxGo4Dir);
959  TGo4PolyCond::CleanupSpecials(); // remove references to cloned TCutG in status
960  return namesobject;
961 }
962 
963 TFolder * TGo4AnalysisObjectManager::CreateNamesFolder(TFolder * objectfolder)
964 {
965  GO4TRACE((11,"TGo4AnalysisObjectManager::CreateNamesFolder(TFolder*)",__LINE__, __FILE__));
966  if (objectfolder==0) return 0;
967 
968  TList* nameslist= new TList;
969  TIter listiter(objectfolder->GetListOfFolders());
970  TObject* entry;
971  while((entry=listiter())!=0) {
972  if(entry->InheritsFrom(TFolder::Class())) {
973  // found subfolder, process it recursively
974  //std::cout <<"##### parsing folder "<< entry->GetName() << std::endl;
975  TFolder* subobj= dynamic_cast<TFolder*> (entry);
976  TFolder* subnames = CreateNamesFolder(subobj);
977  nameslist->AddLast(subnames);
978  } else
979 
980  if (entry->InheritsFrom(TTree::Class())) {
981  // treestructure should be ObjectStatus?
982  TTree* subobj= dynamic_cast<TTree*> (entry);
983  TGo4TreeStructure* treestruct=CreateTreeStructure(subobj);
984  nameslist->AddLast(treestruct);
985  } else
986 
987  if(entry->InheritsFrom(TGo4EventElement::Class())) {
988  TFolder* evfolder = CreateMembersFolder(entry, entry->GetName(), entry->IsA());
989  if (evfolder!=0)
990  nameslist->AddLast(evfolder);
991  } else {
992 
993  TGo4ObjectStatus*state = CreateObjectStatus(entry,kFALSE); // do not use full status info for nameslist
994  if(state!=0)
995  nameslist->AddLast(state);
996  }
997  } // while
998 
999  TFolder* namesfolder = fxTempFolder->AddFolder(objectfolder->GetName(),objectfolder->GetTitle(),nameslist);
1000  fxTempFolder->Remove(namesfolder);
1001  namesfolder->SetOwner(kTRUE);
1002 
1003  return namesfolder;
1004 }
1005 
1007 {
1008  return fxGo4Dir;
1009 }
1010 
1012 {
1013  GO4TRACE((11,"TGo4AnalysisObjectManager::AddEventStore(TGo4EventStore*)",__LINE__, __FILE__));
1014  return (AddObjectToFolder(store,fxStoreDir,0,kFALSE));
1015 }
1016 
1018 {
1019  GO4TRACE((11,"TGo4AnalysisObjectManager::RemoveEventStore(TGo4EventStore*)",__LINE__, __FILE__));
1020  Bool_t rev=kFALSE;
1021  if(store)
1022  {
1023  TGo4LockGuard listguard(fxDirMutex);
1024  fxStoreDir->Remove(store);
1025  rev=kTRUE;
1026  }
1027  else
1028  {
1029  rev=kFALSE;
1030  }
1031  return rev;
1032 }
1033 
1035 {
1036  GO4TRACE((11,"TGo4AnalysisObjectManager::AddEventSource(TGo4EventSource*)",__LINE__, __FILE__));
1037  return (AddObjectToFolder(source,fxSourceDir,0,kFALSE));
1038 }
1039 
1041 {
1042  GO4TRACE((11,"TGo4AnalysisObjectManager::RemoveEventSource(TGo4EventSource*)",__LINE__, __FILE__));
1043  Bool_t rev=kFALSE;
1044  if(source)
1045  {
1046  TGo4LockGuard listguard(fxDirMutex);
1047  fxSourceDir->Remove(source);
1048  rev=kTRUE;
1049  }
1050  else
1051  {
1052  rev=kFALSE;
1053  }
1054  return rev;
1055 }
1057 {
1058  GO4TRACE((11,"TGo4AnalysisObjectManager::AddEventProcessor(TGo4EventProcessor*)",__LINE__, __FILE__));
1059  return (AddObjectToFolder(pro,fxProcessorDir,0,kFALSE));
1060 }
1061 
1063 {
1064  GO4TRACE((11,"TGo4AnalysisObjectManager::RemoveEventProcessor(TGo4EventProcessr*)",__LINE__, __FILE__));
1065  Bool_t rev=kFALSE;
1066  if(pro)
1067  {
1068  TGo4LockGuard listguard(fxDirMutex);
1069  fxProcessorDir->Remove(pro);
1070  rev=kTRUE;
1071  }
1072  else
1073  {
1074  rev=kFALSE;
1075  }
1076  return rev;
1077 }
1079 {
1080  GO4TRACE((11,"TGo4AnalysisObjectManager::AddEventStructure(TGo4EventElement*)",__LINE__, __FILE__));
1081  return (AddObjectToFolder(ev,fxEventDir,0,kFALSE));
1082 }
1083 
1085 {
1086  GO4TRACE((11,"TGo4AnalysisObjectManager::RemoveEventStructure(TGo4EventElement*)",__LINE__, __FILE__));
1087  Bool_t rev=kFALSE;
1088  if(ev!=0) {
1089  TGo4LockGuard listguard(fxDirMutex);
1090  fxEventDir->Remove(ev);
1091  // remove pointers to event data from all dynamic lists:
1092  CleanupDynamicLists(ev);
1093  rev=kTRUE;
1094  }
1095  return rev;
1096 }
1097 
1099 {
1100  GO4TRACE((11,"TGo4AnalysisObjectManager::GetEvenStructure(char *)",__LINE__, __FILE__));
1101 
1102  if ((name==0) || (strlen(name)==0)) return 0;
1103 
1104  TString path(name);
1105  TGo4EventElement* curr(0);
1106 
1107  while (path.Length()>0) {
1108  Int_t pos = path.Index("/");
1109  if (pos==0) { path.Remove(0, 1); continue; }
1110 
1111  TString sub = path;
1112  if (pos>0) { sub.Resize(pos); path.Remove(0, pos+1); }
1113  else { path.Clear(); }
1114 
1115  if (curr==0)
1116  curr = dynamic_cast<TGo4EventElement*> (FindObjectInFolder(fxEventDir, sub.Data()));
1117  else {
1118  TGo4EventElement* chld = curr->GetChild(sub.Data());
1119  // this is artefact of folder structures in go4 browser
1120  // event can have subfolder which corresponds to the subevent
1121  // but it also could have subfolder which corresponds to parent class
1122  // in second case just ignore all other artificial subfolders
1123  if ((chld==0) && curr->InheritsFrom(sub.Data())) return curr;
1124  curr = chld;
1125  }
1126 
1127  if (curr==0) return 0;
1128  }
1129 
1130  return curr;
1131 }
1132 
1134 {
1135  if(entry) entry->Reset();
1136  return AddObjectToFolder(entry, fxDynListDir, 0, kTRUE, kFALSE, kFALSE);
1137 }
1138 
1140 {
1141  GO4TRACE((11,"TGo4AnalysisObjectManager::ResetBackStores()",__LINE__, __FILE__));
1142  Bool_t rev=kTRUE;
1143  TIter iter(fxStoreDir->GetListOfFolders());
1144  TObject* entry = 0;
1145  while((entry=iter()) !=0) {
1146  TGo4BackStore* bs= dynamic_cast<TGo4BackStore*>(entry);
1147  if(bs!=0) bs->Reset(clearflag);
1148  } // while
1149  return rev;
1150 }
1151 
1153 {
1154  GO4TRACE((14,"TGo4AnalysisObjectManager::CloseAnalysis()",__LINE__, __FILE__));
1156  fiDynListCount=0;
1157  TGo4Analysis::Instance()->Message(0,"Analysis Object Manager -- Dynamic List was reset.");
1158 }
1159 
1161 {
1162  if(!file) return;
1163  TGo4Analysis::Instance()->Message(0,"Analysis Object Manager -- Saving objects to file %s",file->GetName());
1164  fxGo4Dir->RecursiveRemove(fxTreeDir); // do not save the trees twice!
1165  fxGo4Dir->RecursiveRemove(fxAnalysisDir); // do not save eventclass refs
1167  //fxGo4Dir->Write(0, TObject::kOverwrite);
1170  TDirectory* savdir=gDirectory;
1171  file->cd();
1172  // file->Delete("T*;*"); // remove old contents (get rid of deleted dynamic objects)
1173  // note: we always use RECREATE option on saving now. No need to cleanup old file!
1175  file->Write(0,TObject::kOverwrite); // write all appended objects and subdirs
1176  savdir->cd();
1177  RemoveFromDir(fxGo4Dir,file); // prevent object deletion on closing the file
1179  fxGo4Dir->Add(fxTreeDir);
1180  fxGo4Dir->Add(fxAnalysisDir);
1181 }
1182 Bool_t TGo4AnalysisObjectManager::AddParameter(TGo4Parameter * par, const char* subfolder)
1183 {
1184  GO4TRACE((11,"TGo4AnalysisObjectManager::AddParameter(TGo4Parameter *)",__LINE__, __FILE__));
1185  return (AddObjectToFolder(par,fxParameterDir,subfolder,kTRUE));
1186 }
1187 
1188 Bool_t TGo4AnalysisObjectManager::SetParameter(const char* name, TGo4Parameter * par, TFolder* parent)
1189 {
1190  GO4TRACE((11,"TGo4AnalysisObjectManager::SetParameter(const char*, TGo4Parameter*)",__LINE__, __FILE__));
1191 
1192  if (par==0) return kFALSE;
1193 
1194  Bool_t rev(kFALSE);
1195  TFolder* topfolder = parent ? parent : fxParameterDir;
1196  TGo4Parameter* oldpar= dynamic_cast<TGo4Parameter*> (topfolder->FindObjectAny(name));
1197  if(oldpar!=0) {
1198  // update existing parameter of given name
1199  rev = oldpar->UpdateFrom(par);
1200  TGo4Log::Info("Updated parameter %s from parameter %s", name, par->GetName());
1201  //oldpar->PrintParameter();
1202  } else {
1203  // parameter not yet existing, add external parameter as a copy:
1204  TGo4Parameter* clonedpar=dynamic_cast<TGo4Parameter*>(par->Clone());
1205 
1206  const char* separ = strrchr(name, '/');
1207  if (separ!=0) {
1208  TString fname(name, separ-name);
1209  rev=AddObjectToFolder(clonedpar,topfolder, fname.Data(), kTRUE);
1210  TGo4Log::Info("Added new parameter %s to folder %s/%s", clonedpar->GetName(), topfolder->GetName(), fname.Data());
1211  } else
1212  rev=AddObjectToFolder(clonedpar,topfolder,0,kTRUE);
1213  }
1214  return rev;
1215 }
1216 
1217 Bool_t TGo4AnalysisObjectManager::SetParameterStatus(const char* name, TGo4ParameterStatus* status, TFolder* parent)
1218 {
1219  GO4TRACE((11,"TGo4AnalysisObjectManager::SetParameter(char*, TGo4Parameter*)",__LINE__, __FILE__));
1220 
1221  if (status==0) return kFALSE;
1222 
1223  Bool_t rev (kFALSE);
1224  TFolder* topfolder = (parent!=0) ? parent : fxParameterDir;
1225 
1226  TGo4Parameter* oldpar= dynamic_cast<TGo4Parameter*> (topfolder->FindObjectAny(name));
1227  if(oldpar!=0) {
1228  // update existing parameter of given name
1229  rev = status->UpdateParameterValues(oldpar);
1230  } else {
1231  // parameter not yet existing, add external parameter as a copy:
1232  TGo4Parameter* clonedpar = status->CreateParameter();
1233  // find out destination folder for new parameter from name:
1234 
1235  const char* separ = strrchr(name, '/');
1236  if (separ!=0) {
1237  TString fname(name, separ-name);
1238  rev=AddObjectToFolder(clonedpar,topfolder, fname.Data(), kTRUE);
1239  } else {
1240  rev=AddObjectToFolder(clonedpar,topfolder,0,kTRUE);
1241  }
1242  }
1243  return rev;
1244 }
1245 
1246 TGo4Parameter * TGo4AnalysisObjectManager::GetParameter(const char * name, const char* parameter_class)
1247 {
1248  GO4TRACE((11,"TGo4AnalysisObjectManager::GetParameter(char*)",__LINE__, __FILE__));
1249  TGo4Parameter* rev=dynamic_cast<TGo4Parameter *> (FindObjectInFolder(fxParameterDir,name));
1250  if(rev==0) rev= dynamic_cast<TGo4Parameter *> (FindObjectInFolder(fxUserDir,name));
1251  if ((rev!=0) && (parameter_class!=0))
1252  if (!rev->InheritsFrom(parameter_class)) rev=0;
1253  return rev;
1254 }
1255 
1257 {
1258  GO4TRACE((11,"TGo4AnalysisObjectManager::RemoveParameter(char*)",__LINE__, __FILE__));
1259  return RemoveObjectFromFolder(name, fxParameterDir, kTRUE);
1260 }
1261 
1262 Bool_t TGo4AnalysisObjectManager::AddPicture(TGo4Picture * pic, const char* subfolder)
1263 {
1264  GO4TRACE((11,"TGo4AnalysisObjectManager::AddPicture(TGo4Picture *)",__LINE__, __FILE__));
1265  if(!pic) return kFALSE;
1266 
1267  //pic->LocateObjectsFrom(fxGo4Dir);
1268  return (AddObjectToFolder(pic,fxPictureDir,subfolder,kTRUE));
1269 }
1270 
1271 Bool_t TGo4AnalysisObjectManager::SetPicture(const char* name, TGo4Picture * pic, TFolder* parent)
1272 {
1273  GO4TRACE((11,"TGo4AnalysisObjectManager::SetPicture(char*, TGo4Picture*)",__LINE__, __FILE__));
1274 
1275  if (pic==0) return kFALSE;
1276 
1277  Bool_t rev(kTRUE);
1278  TFolder* topfolder=0;
1279  if(parent)
1280  topfolder=parent;
1281  else
1282  topfolder=fxPictureDir;
1283 
1284  TGo4Picture* oldpic = dynamic_cast<TGo4Picture *> (topfolder->FindObjectAny(name));
1285  if(oldpic!=0) {
1286  // update existing picture of given name
1287  oldpic->UpdateFrom(pic);
1288  // std::cout << "++++ Updated picture "<< name<<" from picture "<< pic->GetName() << std::endl;
1289  } else {
1290  // picture not yet exisiting, add external as a copy:
1291  TGo4Picture* clonedpic = dynamic_cast<TGo4Picture*>(pic->Clone());
1292  // find out destination folder for new pic from name:
1293 
1294  const char* separ = strrchr(name, '/');
1295  if (separ!=0) {
1296  TString fname(name, separ-name);
1297  rev = AddObjectToFolder(clonedpic, topfolder, fname.Data(),kTRUE);
1298  } else
1299  rev = AddObjectToFolder(clonedpic, topfolder, 0, kTRUE);
1300  }
1301  return rev;
1302 }
1303 
1305 {
1306  GO4TRACE((11,"TGo4AnalysisObjectManager::GetPicture(char*)",__LINE__, __FILE__));
1307  TGo4Picture* rev=dynamic_cast<TGo4Picture *> (FindObjectInFolder(fxPictureDir, name));
1308  if(rev==0) rev=dynamic_cast<TGo4Picture *> (FindObjectInFolder(fxUserDir, name));
1309  return rev;
1310 }
1311 
1313 {
1314  GO4TRACE((11,"TGo4AnalysisObjectManager::RemovePicture(char*)",__LINE__, __FILE__));
1315  return RemoveObjectFromFolder(name, fxPictureDir, kTRUE);
1316 }
1317 
1318 Bool_t TGo4AnalysisObjectManager::AddCanvas(TCanvas * can, const char* subfolder)
1319 {
1320  GO4TRACE((11,"TGo4AnalysisObjectManager::AddCanvas(TCanvas *)",__LINE__, __FILE__));
1321 
1322  Bool_t rev = AddObjectToFolder(can,fxCanvasDir,subfolder,kFALSE);
1323 
1324  if (rev && can) can->SetBit(kMustCleanup);
1325 
1326  // do not remove canvas from global list - it has effect on normal ROOT methods
1327 // if(rev && can) gROOT->GetListOfCanvases()->Remove(can);
1328 
1329  return rev;
1330 }
1331 
1332 TCanvas * TGo4AnalysisObjectManager::GetCanvas(const char * name)
1333 {
1334  GO4TRACE((11,"TGo4AnalysisObjectManager::GetPicture(char*)",__LINE__, __FILE__));
1335  TCanvas* rev=dynamic_cast<TCanvas*> (FindObjectInFolder(fxCanvasDir, name));
1336  if(rev==0) rev=dynamic_cast<TCanvas*> (FindObjectInFolder(fxCanvasDir, name));
1337  return rev;
1338 }
1339 
1341 {
1342  GO4TRACE((11,"TGo4AnalysisObjectManager::RemovePicture(char*)",__LINE__, __FILE__));
1343  return RemoveObjectFromFolder(name, fxCanvasDir, kTRUE);
1344 }
1345 
1346 
1348 {
1349  GO4TRACE((11,"TGo4AnalysisObjectManager::LoadObjects(TFile*)",__LINE__, __FILE__));
1350  Bool_t rev=kFALSE;
1351  if(obfile)
1352  {
1353  TObject* ob=obfile->Get(TGo4AnalysisObjectManager::fgcTOPFOLDER);
1354  TFolder* top= dynamic_cast<TFolder*>(ob);
1355  if(top)
1356  {
1357  // kept for backward compatibility: read folder struct directly
1358  //std::cout << "found top go4 folder "<< std::endl;
1359  rev=LoadFolder(top,fxGo4Dir,kFALSE);
1360  }
1361  else
1362  {
1363  // new: convert directory structure of file into folders
1364  //std::cout <<"LoadObjects with Dirscan..." << std::endl;
1365  rev=LoadFolder(obfile,fxGo4Dir,kFALSE);
1366  }
1367  TGo4PolyCond::CleanupSpecials(); // remove references to file cuts
1369  }
1370 
1371  return rev;
1372 }
1373 
1375 {
1377 }
1378 
1380 {
1381  fiDynListCount++;
1382  // normally, all entries are processed eventwise
1383  // except for treehistogramentries
1384  Bool_t processtrees = (fiDynListCount % fiDynListInterval)==0;
1386  if(processtrees) ResetBackStores();
1387 }
1388 
1390 {
1392 }
1393 
1395  const char* histo,
1396  const char* hevx, const char* hmemx,
1397  const char* hevy, const char* hmemy,
1398  const char* hevz, const char* hmemz,
1399  const char* condition,
1400  const char* cevx, const char* cmemx,
1401  const char* cevy, const char* cmemy)
1402 {
1403  if(name==0 || histo==0 || hevx==0 || hmemx==0) return kFALSE;
1404  TGo4HistogramEntry* entry = new TGo4HistogramEntry(name);
1405 
1406  entry->SetHistogramName(histo);
1407 
1408  if ((hevx!=0) && (hmemx!=0)) {
1409  entry->SetHisEventName(0, hevx);
1410  entry->SetHisVarName(0, hmemx);
1411  }
1412 
1413  if ((hevy!=0) && (hmemy!=0)) {
1414  entry->SetHisEventName(1, hevy);
1415  entry->SetHisVarName(1, hmemy);
1416  }
1417 
1418  if ((hevz!=0) && (hmemz!=0)) {
1419  entry->SetHisEventName(2, hevz);
1420  entry->SetHisVarName(2, hmemz);
1421  }
1422 
1423  if((condition!=0) && (cevx!=0) && (cmemx!=0)) {
1424  entry->SetConditionName(condition);
1425  entry->SetConEventName(0, cevx);
1426  entry->SetConVarName(0, cmemx);
1427  if((cevy!=0) && (cmemy!=0)) {
1428  entry->SetConEventName(1, cevy);
1429  entry->SetConVarName(1, cmemy);
1430  }
1431  }
1432 
1433  return AddDynamicEntry(entry);
1434 }
1435 
1436 Bool_t TGo4AnalysisObjectManager::AddTreeHistogram(const char* hisname, const char* treename, const char* varexp, const char* cutexp)
1437 {
1438  GO4TRACE((11,"TGo4AnalysisObjectManager::AddTreeHistogram(char*,...)",__LINE__, __FILE__));
1439  //
1440  Bool_t rev=kFALSE;
1441  TGo4TreeHistogramEntry* tentry =
1442  new TGo4TreeHistogramEntry(hisname, treename, varexp, cutexp);
1443  if(AddDynamicEntry(tentry)) {
1444  TGo4Analysis::Instance()->Message(0,"Analysis added tree histogram %s to dynamic list", tentry->GetName());
1445  rev=kTRUE;
1446  } else {
1447  TGo4Analysis::Instance()->Message(0,"!!! Analysis AddTreeHistogram- ERROR: entry %s already exists !!!", tentry->GetName());
1448  delete tentry;
1449  }
1450  return rev;
1451 }
1452 
1453 
1455 {
1456  return RemoveObjectFromFolder(entryname, fxDynListDir, kTRUE);
1457 }
1458 
1459 
1460 TFolder* TGo4AnalysisObjectManager::FindSubFolder(TFolder* parent, const char* subfolder, Bool_t create)
1461 {
1462  GO4TRACE((11,"TGo4AnalysisObjectManager::FindSubFolder(TFolder*, const char*, Bool_t)",__LINE__, __FILE__));
1463  TGo4LockGuard dirguard(fxDirMutex);
1464  TFolder* result = 0;
1465  if (parent==0) return 0;
1466  if (subfolder==0) return parent;
1467  const char* separ = strchr(subfolder,'/'); // find end of first subfolder string
1468  if(separ!=0) {
1469  // we have subfolder of subfolder, process recursively
1470  TString subname(subfolder, separ - subfolder);
1471 
1472  //std::cout <<" fffffff Searching for subfolder "<< subname << std::endl;
1473  TFolder* nextsubfolder = FindSubFolder(parent, subname.Data(), create); // get folder directly under parent
1474  result = FindSubFolder(nextsubfolder, separ+1,create); // search rest of path in this folder
1475  } else {
1476  // only one level of subfolder, find it directly
1477  TIter listiter(parent->GetListOfFolders());
1478  TObject *entry, *bigger_entry = 0;
1479  while ((entry = listiter()) != 0) {
1480  if (entry->InheritsFrom(TFolder::Class())) {
1481  int cmp = strcmp(subfolder, entry->GetName());
1482  if (cmp == 0) {
1483  result = dynamic_cast<TFolder *>(entry);
1484  break;
1485  }
1486  if ((cmp < 0) && !bigger_entry && IsSortedOrder()) {
1487  bigger_entry = entry;
1488  // break; // we cannot break loop while folders may exists in non-sorted order
1489  }
1490  }
1491  }
1492 
1493  if(!result && create) {
1494  TList *lst = 0;
1495  if (IsSortedOrder() && bigger_entry)
1496  lst = dynamic_cast<TList *> (parent->GetListOfFolders());
1497  if (lst) {
1498  result = new TFolder(subfolder,"UserFolder");
1499  lst->AddBefore(bigger_entry, result);
1500  } else {
1501  result = parent->AddFolder(subfolder,"UserFolder"); // create new subfolder if not found
1502  }
1503  }
1504  } // if (endname!=0)
1505  return result;
1506 }
1507 
1508 
1510  TFolder* fold,
1511  const char* subfolder,
1512  Bool_t replace,
1513  Bool_t uniquename,
1514  Bool_t resetbits)
1515 {
1516  GO4TRACE((11,"TGo4AnalysisObjectManager::AddObjectToFolder(TObject *, TFolder*, const char*, Bool_t)",__LINE__, __FILE__));
1517 
1518  TGo4LockGuard dirguard(fxDirMutex);
1519  if(fold==0) return kFALSE;
1520 
1521  if (ob==0) {
1522  GO4TRACE((12,"TGo4AnalysisObjectManager::AddObjectToFolder - zero object",__LINE__, __FILE__));
1523  return kFALSE;
1524  }
1525 
1526  if(resetbits) {
1527  ob->ResetBit(TGo4Status::kGo4NoReset);
1528  ob->ResetBit(TGo4Status::kGo4CanDelete); // default behavior: allow reset, disable delete
1529  }
1530 
1531  TString subname;
1532  if (subfolder && (strlen(subfolder)!=0)) {
1533  subname = subfolder;
1534  if (subname[subname.Length()-1] == '/')
1535  subname.Resize(subname.Length()-1);
1536  }
1537 
1538  TObject* oldob=0;
1539  if(uniquename) {
1540  // look for object of identical name anywhere in top folder
1541  oldob=fold->FindObjectAny( ob->GetName() );
1542  } else {
1543  TString obname;
1544 
1545  if (subname.Length()>0)
1546  obname = subname + "/" + ob->GetName();
1547  else
1548  obname = ob->GetName();
1549 
1550  // only check for objects that are in given subfolder
1551  oldob = fold->FindObjectAny(obname.Data());
1552  }
1553 
1554  // is object already in folder?
1555  if(oldob) {
1556  //yes, shall we replace? check if pointers are identical first!
1557  if(replace && ob!=oldob) {
1558  // remove old reference before adding new one:
1559  fold->RecursiveRemove(oldob);
1560  CleanupDynamicLists(oldob);
1561 
1562  // std::cout << "Delete object " << oldob << " name = " << oldob->GetName() << " isgpad = " << (oldob == gPad) << std::endl;
1563 
1564  delete oldob;
1565  } else {
1566 
1567  //std::cout << "Find old object " << oldob << " name = " << oldob->GetName() << endl;
1568 
1569  return kFALSE; // do not overwrite old one
1570  }
1571  }
1572 
1573  TFolder* addDir = 0;
1574  if(subfolder)
1575  addDir = FindSubFolder(fold, subname, kTRUE);
1576  if(!addDir) addDir = fold;
1577  // if(subfolder)
1578  addDir->Add(ob);
1579 
1580  return kTRUE;
1581 }
1582 
1583 
1584 Bool_t TGo4AnalysisObjectManager::RemoveObjectFromFolder(const char* fullname, TFolder* fold, Bool_t isDel)
1585 {
1586  GO4TRACE((11,"TGo4AnalysisObjectManager::RemoveObjectFromFolder(const char*, TFolder*, Bool_t)",__LINE__, __FILE__));
1587  //
1588  if(fold==0) return kFALSE;
1589  TGo4LockGuard dirguard(fxDirMutex);
1590  TObject* obj = 0;
1591  Int_t buflen = fguSUBFOLDERMAXLEN;
1592  char buffer[fguSUBFOLDERMAXLEN];
1593  if(fullname) {
1594  strncpy(buffer,fullname,buflen-10);
1595  obj = fold->FindObjectAny(buffer);
1596  }
1597 
1598  if(obj!=0) {
1599  fold->RecursiveRemove(obj);
1600  CleanupDynamicLists(obj);
1601  if (isDel) delete obj;
1602  TGo4Analysis::Instance()->Message(0,"Analysis: removed object %s",buffer);
1603  return kTRUE;
1604  }
1605 
1606  TGo4Analysis::Instance()->Message(0,"!!! Analysis: removing object %s FAILED !!!",buffer);
1607  return kFALSE;
1608 }
1609 
1610 Bool_t TGo4AnalysisObjectManager::LoadFolder(TFolder* source, TFolder* destination, Bool_t replace)
1611 {
1612  if (source==0) return kFALSE;
1613  GO4TRACE((11,"TGo4AnalysisObjectManager::LoadFolder(TFolder*, TFolder*, Bool_t replace)",__LINE__, __FILE__));
1614  TGo4LockGuard dirguard(fxDirMutex);
1615  Bool_t rev=kTRUE;
1616  TIter folderiter(source->GetListOfFolders());
1617  TObject* ob=0;
1618  while(( ob=folderiter() ) !=0)
1619  {
1620  if(ob->InheritsFrom(TFolder::Class()))
1621  {
1622  TFolder* subfolder =dynamic_cast<TFolder*> (ob);
1623  if(subfolder)
1624  {
1625  //std::cout <<"LLLLLL Load folder scanning subfolder "<< subfolder->GetName() << std::endl;
1626  TFolder* subdest=FindSubFolder(destination,subfolder->GetName(), kTRUE);
1627  LoadFolder(subfolder,subdest,replace); // recursively scan all subfolders
1628  }
1629  }
1630  else
1631  {
1632  rev=PutToFolder(ob,destination,replace);
1633  }
1634  } // while(..)
1635  return rev;
1636 }
1637 
1638 Bool_t TGo4AnalysisObjectManager::LoadFolder(TDirectory* source, TFolder* destination, Bool_t replace)
1639 {
1640  GO4TRACE((11,"TGo4AnalysisObjectManager::LoadFolder(TDirectory*, TFolder*, Bool_t replace)",__LINE__, __FILE__));
1641  if(!source || !destination) return kFALSE;
1642  TGo4LockGuard dirguard(fxDirMutex);
1643  Bool_t rev=kTRUE;
1644  TDirectory* savdir=gDirectory;
1645  source->cd(); // this is necessary to let the TKey::ReadObj work!
1646  source->ReadKeys();
1647  TIter keyiter(source->GetListOfKeys());
1648  TObject* keyob=0;
1649  TKey* key=0;
1650  while(( keyob=keyiter() ) !=0)
1651  {
1652  key=dynamic_cast<TKey*>(keyob);
1653  if(key==0)
1654  {
1655  TGo4Analysis::Instance()->Message(3,"Analysis LoadFolder: ZERO key in directory %s",
1656  source->GetName());
1657  return kFALSE;
1658  }
1659  //std::cout <<"Reading key "<<key->GetName() << std::endl;
1660  TObject* ob = key->ReadObj();
1661  if(ob==0)
1662  {
1663  TGo4Analysis::Instance()->Message(2,"Analysis LoadFolder: Retrying to read key %s ...",
1664  key->GetName());
1665  ob=source->Get(key->GetName());
1666  if(ob==0)
1667  {
1668  TGo4Analysis::Instance()->Message(3,"Analysis LoadFolder: Failed to read key %s !",
1669  key->GetName());
1670  return kFALSE;
1671  }
1672  }
1673 
1674  if(ob->InheritsFrom(TDirectory::Class()))
1675  {
1676  TDirectory* subdir =dynamic_cast<TDirectory*> (ob);
1677  if(subdir)
1678  {
1679  //std::cout <<"LLLLLL Load folder dir scanning for subdir "<< subdir->GetName() << std::endl;
1680  Bool_t inpicturefolder=kFALSE;
1681  if(!strcmp(subdir->GetName(),fgcPICTFOLDER)) inpicturefolder=kTRUE;
1682  if(inpicturefolder) fbSuppressLoadHistograms=kTRUE;
1683  TFolder* subdest=FindSubFolder(destination,subdir->GetName(), kTRUE);
1684  rev=LoadFolder(subdir,subdest,replace); // recursively scan all subfolders
1685  if(inpicturefolder) fbSuppressLoadHistograms=kFALSE;
1686  }
1687  }
1688  else
1689  {
1690  rev=PutToFolder(ob,destination,replace);
1691  }
1692  } // while(..)
1693  savdir->cd();
1694  return rev;
1695 }
1696 
1697 Bool_t TGo4AnalysisObjectManager::PutToFolder(TObject* ob, TFolder* destination, Bool_t replace)
1698 {
1699  if(!ob || !destination) return kFALSE;
1700  Bool_t rev=kTRUE;
1701  //std::cout <<"put to folder for "<<ob->GetName() << std::endl;
1702  if (ob->InheritsFrom(TGo4DynamicEntry::Class())) {
1703  // new autosave file structure will save dynamic entries independently:
1704  TGo4DynamicEntry* dentry =dynamic_cast<TGo4DynamicEntry*> ( ob->Clone() ); // deep copy of source object!
1705  AddDynamicEntry(dentry);
1706  //std::cout <<"Added dynamic entry from file: "<<dentry->GetName() << std::endl;
1707  } else
1708  if(ob->InheritsFrom(TGo4Parameter::Class())) {
1709  // parameters never replaced, but updated
1710  TGo4Parameter* par = dynamic_cast<TGo4Parameter*>(ob);
1711  SetParameter(ob->GetName(),par,destination);
1712  } else
1713  if(ob->InheritsFrom(TGo4Picture::Class())) {
1714  // pictures never replaced, but updated
1715  TGo4Picture* pic =dynamic_cast<TGo4Picture*>(ob);
1716  //std::cout <<"LLLLLoad Folder SetsPicture!!!!!" << std::endl;
1717  SetPicture(ob->GetName(),pic,destination);
1718  } else
1719  if(ob->InheritsFrom(TGo4Condition::Class())) {
1720  // conditions not replaced, but updated
1721  TGo4Condition* con =dynamic_cast<TGo4Condition*>(ob);
1722  SetAnalysisCondition(ob->GetName(),con,kTRUE, destination);
1723  } else
1724  if(ob->InheritsFrom(TH1::Class())) {
1725  if(fbSuppressLoadHistograms) return kFALSE;
1726  // test: do not clone histos, but change dir from asf file to memory
1727  TH1* his = dynamic_cast<TH1*>(ob);
1728  if(AddObjectToFolder(his,destination,0,replace,kFALSE,kFALSE)) {
1729  his->SetDirectory(gROOT); // set directory for histos, needed for TTree::Draw
1730  TGo4Analysis::Instance()->Message(0,"Analysis LoadFolder: Histogram %s was loaded.",
1731  his->GetName());
1732  //std::cout <<"Changed directory of histo "<<his->GetName() << std::endl;
1733  }
1734  } else
1735  if(ob->InheritsFrom(TCanvas::Class())) {
1736  TObject* addob = ob->Clone(); // deep copy of source object!
1737  if(AddObjectToFolder(addob, destination, 0, replace)) {
1738  TGo4Analysis::Instance()->Message(0,"Analysis LoadFolder: Object %s was loaded.", addob->GetName());
1739  } else {
1740  // object already there and noreplace set: delete clone
1741  delete addob;
1742  if (gPad==addob) gPad = 0;
1743  }
1744  } else {
1745  //std::cout << "Make object clone " << ob->GetName() << " class = " << ob->ClassName() << std::endl;
1746 
1747  TObject* addob = ob->Clone(); // deep copy of source object!
1748  if(AddObjectToFolder(addob,destination,0,replace)) {
1749  TGo4Analysis::Instance()->Message(0,"Analysis LoadFolder: Object %s was loaded.", addob->GetName());
1750  } else {
1751  delete addob;
1752  }
1753  }
1754  return rev;
1755 }
1756 
1757 
1758 
1760 {
1761  if (source==0) return kFALSE;
1762  TGo4LockGuard dirguard(fxDirMutex);
1763  Bool_t rev=kTRUE;
1764  TIter folderiter(source->GetListOfFolders());
1765  TObject* ob=0;
1766  while(( ob=folderiter() ) !=0) {
1767  if(ob->InheritsFrom(TFolder::Class())) {
1768  TFolder* subfolder =dynamic_cast<TFolder*> (ob);
1769  if(subfolder)
1770  {
1771  TDirectory* currentdir=gDirectory;
1772  const char* subfoldername=subfolder->GetName();
1773  TDirectory* subdir=dynamic_cast<TDirectory*>(currentdir->Get(subfoldername));
1774  if(subdir==0)
1775  {
1776  subdir=currentdir->mkdir(subfoldername,"subdir");
1777  //std::cout <<"SSSS Save folder created subdir "<<subfoldername << std::endl;
1778  }
1779  else
1780  {
1781  //std::cout <<"SSSS Save folder found existing subdir "<<subfoldername << std::endl;
1782  }
1783 
1784  if(subdir)
1785  {
1786  subdir->cd();
1787  //std::cout <<"SSSS Save folder scanning subfolder "<< subfolder->GetName() << std::endl;
1788  SaveFolder(subfolder); // recursively scan all subfolders
1789  }
1790  else
1791  {
1792  TGo4Analysis::Instance()->Message(2,"Analysis SaveFolder: Could not assign subdirectory %s to folder.",
1793  subfoldername);
1794  }
1795  currentdir->cd();
1796  }
1797  } else
1798  AppendToDir(ob,gDirectory);
1799  } // while(..)
1800  return rev;
1801 }
1802 
1803 void TGo4AnalysisObjectManager::AppendToDir(TObject* ob, TDirectory* dir)
1804 {
1805  if(!ob || !dir) return;
1806  // note: we do not check for old objects anymore, because
1807  // file is generally cleaned up before writing now JA
1808  //TObject* oldob=dir->Get(ob->GetName());
1809  //if(oldob)
1810  // {
1813  // }
1814  dir->Append(ob);
1815 }
1816 
1817 void TGo4AnalysisObjectManager::RemoveFromDir(TFolder* fold, TDirectory* dir)
1818 {
1819  if((fold==0) || (dir==0)) return;
1820 
1821  TIter iter(fold->GetListOfFolders());
1822  TObject* ob = 0;
1823  while((ob = iter()) !=0) {
1824  if(ob->InheritsFrom(TFolder::Class())) {
1825  TFolder* subfolder =dynamic_cast<TFolder*> (ob);
1826  if(subfolder!=0)
1827  RemoveFromDir(subfolder,dir); // recursively scan all subfolders
1828  } else
1829  dir->RecursiveRemove(ob);
1830  }
1831 }
1832 
1833 Int_t TGo4AnalysisObjectManager::PrintFolder(TFolder* fold, Option_t* opt, const char* expression)
1834 {
1835  if(fold==0) return 0;
1836 
1837  GO4TRACE((11,"TGo4AnalysisObjectManager::PrintFolder(TFolder*, Option_t*)",__LINE__, __FILE__));
1838  TGo4LockGuard dirguard(fxDirMutex);
1839  Int_t totalsize=0;
1840  TROOT::IndentLevel();
1841  TROOT::IncreaseDirLevel();
1842  std::cout <<"+Folder "<<fold->GetName()<<" content:" << std::endl;
1843  TIter listiter(fold->GetListOfFolders());
1844  TObject* ob=0;
1845  while((ob=listiter())!=0) {
1846  if(ob->InheritsFrom(TFolder::Class()))
1847  totalsize+=PrintFolder(dynamic_cast<TFolder*>(ob),opt,expression);
1848  else
1849  if(IsMatching(ob->GetName(),expression)) {
1850  TROOT::IndentLevel();
1851  ob->Print(opt);
1853  if(temp!=0) totalsize += temp->GetObjectSize();
1854  delete temp;
1855  }
1856  } // while
1857  TROOT::DecreaseDirLevel();
1858  TROOT::IndentLevel();
1859  std::cout <<"++++End "<<fold->GetName()<<"++++++++++" << std::endl;
1860  return totalsize;
1861 }
1862 
1864 {
1865  GO4TRACE((11,"TGo4AnalysisObjectManager::ClearFolder(TFolder*, Option_t*)",__LINE__, __FILE__));
1866  if(fold==0) return kFALSE;
1867  TGo4LockGuard dirguard(fxDirMutex);
1868  TIter iter(fold->GetListOfFolders());
1869  TObject* ob=0;
1870  while((ob=iter())!=0)
1871  if(ob->InheritsFrom(TFolder::Class()))
1872  ClearFolder(dynamic_cast<TFolder*>(ob));
1873  else
1874  ClearObject(ob);
1875  return kTRUE;
1876 }
1877 
1879 {
1880  GO4TRACE((11,"TGo4AnalysisObjectManager::ClearObject(TObject*)",__LINE__, __FILE__));
1881  Bool_t rev=kFALSE;
1882  if(ob)
1883  {
1884  if(ob->TestBit(TGo4Status::kGo4NoReset)) return kFALSE;
1885  rev=kTRUE;
1886  if(ob->InheritsFrom(TH1::Class()))
1887  {
1888  TH1* his= dynamic_cast<TH1*>(ob);
1889  if (his) his->Reset(); // histogram has no Clear implementation!
1890  }
1891  else if(ob->InheritsFrom(TGo4DynamicEntry::Class()))
1892  {
1893  TGo4DynamicEntry* entry = dynamic_cast<TGo4DynamicEntry*>(ob);
1894  if (entry!=0) entry->Reset(); // dynamic entry has no Clear implementation!
1895  }
1896  else if(ob->InheritsFrom(TGo4Picture::Class()))
1897  {
1898  TGo4Picture* pic = dynamic_cast<TGo4Picture*>(ob);
1899  if (pic) pic->Reset(); // picture has no Clear implementation!
1900  }
1901  else if(ob->InheritsFrom(TGraph::Class()))
1902  {
1903  TGraph* gr= dynamic_cast<TGraph*>(ob);
1904  if (gr) {
1905  //Int_t pn=gr->GetN();
1906  gr->Set(0); // clear array of points
1907  //gr->Set(pn); // this should set all to 0 (JAM we don't want this for time plots!)
1908  }
1909  }
1910  else if(ob->InheritsFrom(TMultiGraph::Class()))
1911  {
1912  TMultiGraph* mg= dynamic_cast<TMultiGraph*>(ob);
1913  if (mg) {
1914  TIter liter(mg->GetListOfGraphs());
1915  TObject* gr = 0;
1916  while((gr=liter())!=0)
1917  ClearObject(gr);
1918  }
1919  }
1920  else if(ob->InheritsFrom(TGo4EventElement::Class()))
1921  {
1922  // nop, we do not allow a user clear from gui
1923  // on any event
1924  rev=kFALSE;
1925  }
1926  else if(ob->InheritsFrom(TTree::Class()))
1927  {
1928  // nop, we do not allow a user clear from gui
1929  // on any tree
1930  rev=kFALSE;
1931  }
1932  else
1933  {
1934  ob->Clear();
1935  // use virtual Clear of all objects
1936  // make sure that TNamed::Clear is overwritten in subclasses
1937  }
1938  }
1939  return rev;
1940 }
1941 
1942 
1944 {
1945  GO4TRACE((11,"TGo4AnalysisObjectManager::DeleteFolder(TFolder*, Option_t*)",__LINE__, __FILE__));
1946  if (fold==0) return kFALSE;
1947 
1948  TGo4LockGuard dirguard(fxDirMutex);
1949  TIter iter(fold->GetListOfFolders());
1950  TObject* ob=0;
1951  while((ob=iter())!=0)
1952  if(ob->InheritsFrom(TFolder::Class()))
1953  DeleteFolder(dynamic_cast<TFolder*>(ob));
1954  else
1955  DeleteObject(ob);
1956  return kTRUE;
1957 }
1958 
1960 {
1961  GO4TRACE((11,"TGo4AnalysisObjectManager::DeleteObject(TObject*)",__LINE__, __FILE__));
1962  if(ob==0 || !ob->TestBit(TGo4Status::kGo4CanDelete) ) return kFALSE;
1963  fxGo4Dir->RecursiveRemove(ob);
1964  CleanupDynamicLists(ob);
1965  delete ob;
1966  return kTRUE;
1967 }
1968 
1969 Bool_t TGo4AnalysisObjectManager::ProtectFolder(TFolder* fold, const Option_t* flags)
1970 {
1971  if(fold==0) return kFALSE;
1972  TGo4LockGuard dirguard(fxDirMutex);
1973  TIter listiter(fold->GetListOfFolders());
1974  TObject* ob=0;
1975  while((ob=listiter.Next())!=0)
1976  if(ob->InheritsFrom(TFolder::Class()))
1977  ProtectFolder(dynamic_cast<TFolder*>(ob), flags);
1978  else
1979  ProtectObject(ob, flags);
1980  return kTRUE;
1981 }
1982 
1983 Bool_t TGo4AnalysisObjectManager::ProtectObject(TObject* ob, const Option_t* flags)
1984 {
1985  if((ob==0) || (flags==0)) return kFALSE;
1986  TString opt=flags;
1987  if(opt.Contains("+D")) ob->ResetBit(TGo4Status::kGo4CanDelete);
1988  if(opt.Contains("-D")) ob->SetBit(TGo4Status::kGo4CanDelete);
1989  if(opt.Contains("+C")) ob->SetBit(TGo4Status::kGo4NoReset);
1990  if(opt.Contains("-C")) ob->ResetBit(TGo4Status::kGo4NoReset);
1991  return kTRUE;
1992 }
1993 
1995 {
1996  GO4TRACE((11,"TGo4AnalysisObjectManager::CleanupDynamicLists(TNamed*)",__LINE__, __FILE__));
1997  TGo4LockGuard dirguard(fxDirMutex);
1998  if (oldobject==0) return;
1999  // scan all dynamic lists for this object:
2000  if(oldobject->InheritsFrom(TH1::Class()) ||
2001  oldobject->InheritsFrom(TGo4Condition::Class()) ||
2002  oldobject->InheritsFrom(TGo4EventElement::Class()))
2004 }
2005 
2006 
2008 {
2009  GO4TRACE((11,"TGo4AnalysisObjectManager::PrintConditions(const char*)",__LINE__, __FILE__));
2010  Int_t totalsize = PrintFolder(fxConditionDir, "*", expression);
2011  std::cout << "___________________________________________________________" << std::endl;
2012  std::cout << "Total size of all conditions is: " << totalsize << " bytes." << std::endl;
2013 }
2014 
2016 {
2017  GO4TRACE((11,"TGo4AnalysisObjectManager::PrintHistograms(const char*)",__LINE__, __FILE__));
2018  Int_t totalsize = PrintFolder(fxHistogramDir, "*", expression);
2019  std::cout << "___________________________________________________________" << std::endl;
2020  std::cout << "Total size of all histograms is: " << totalsize << " bytes." << std::endl;
2021 }
2022 
2024 {
2025  GO4TRACE((11,"TGo4AnalysisObjectManager::PrintParameters(const char*)",__LINE__, __FILE__));
2026  Int_t totalsize = PrintFolder(fxParameterDir, "*", expression);
2027  std::cout << "___________________________________________________________" << std::endl;
2028  std::cout << "Total size of all parameters is: " << totalsize << " bytes." << std::endl;
2029 }
2030 
2031 
2033  const char* folder,
2034  Bool_t reset)
2035 {
2036  if(reset) {
2037  delete fxMatchIterator;
2038  delete fxMatchList;
2039  fxMatchList=CreateObjectList(expr,folder);
2040  fxMatchIterator=fxMatchList->MakeIterator();
2041  }
2042  return fxMatchIterator->Next();
2043 }
2044 
2045 TList* TGo4AnalysisObjectManager::CreateObjectList(const char* expr, const char* folder)
2046 {
2047  TGo4LockGuard dirguard(fxDirMutex);
2048  TFolder* searchfold;
2049  if(folder==0 || !strcmp(folder,fgcTOPFOLDER))
2050  searchfold=fxGo4Dir; // default: search topfolder
2051  else
2052  searchfold=FindSubFolder(fxGo4Dir, folder, kFALSE);
2053  return (CreateObjectList(expr, searchfold));
2054 }
2055 
2056 
2057 TList* TGo4AnalysisObjectManager::CreateObjectList(const char* expr, TFolder* fold)
2058 {
2059  TList* result = new TList;
2060  if(fold!=0) {
2061  TIter iter(fold->GetListOfFolders());
2062  TObject* entry=0;
2063  while((entry = iter())!=0) {
2064  if(entry->InheritsFrom(TFolder::Class())) {
2065  TFolder* subfold=dynamic_cast<TFolder*>(entry);
2066  TList* sublist=CreateObjectList(expr,subfold);
2067  // add sublist contents to our result list:
2068  result->AddAll(sublist);
2069  } else
2070  if(entry->InheritsFrom(TTree::Class())) {
2071  } else // disable sending tree to gui!
2072  if(entry->InheritsFrom(TGo4EventElement::Class())) {
2073  } else // disable events
2074  if(entry->InheritsFrom(TGo4EventSource::Class())) {
2075  } else // disable events
2076  if(entry->InheritsFrom(TGo4EventStore::Class())) {
2077  } else // disable events
2078  if(entry->InheritsFrom(TGo4EventProcessor::Class())) {
2079  } else { // disable events
2080  if(IsMatching(entry->GetName(),expr))
2081  result->AddLast(entry);
2082  }
2083  } // while
2084  } // if(fold)
2085  return result;
2086 }
2087 
2088 Bool_t TGo4AnalysisObjectManager::IsMatching(const char* string, const char* expression)
2089 {
2090  if(expression==0) return kTRUE;
2091  Bool_t ismatching=kFALSE;
2092  TString entrystring=string;
2093  TRegexp reg(expression,kTRUE);
2094  if(!strcmp(expression,"*"))
2095  ismatching=kTRUE; // take all in this folder
2096  // else if (strstr(expression,string))
2097  // ismatching=kTRUE; // expression just contained in name
2098  else if (entrystring.Index(reg,0)!=kNPOS)
2099  ismatching=kTRUE; // root regular expression class
2100  else
2101  ismatching=kFALSE;
2102  return ismatching;
2103 }
2104 
2105 
2106 TObject* TGo4AnalysisObjectManager::FindObjectInFolder(TFolder* folder, const char* fullname)
2107 {
2108  GO4TRACE((12,"TGo4AnalysisObjectManager::FindObjectInFolder(TFolder*, const char*)",__LINE__, __FILE__));
2109  TGo4LockGuard listguard(fxDirMutex);
2110 
2111  return folder ? folder->FindObjectAny(fullname) : 0;
2112 }
2113 
2114 
2115 TObject* TGo4AnalysisObjectManager::TestObject(TFolder* folder,
2116  const char* &pathname,
2117  const char* objectname,
2118  const TClass* cl)
2119 {
2120  TString fullname;
2121  if ((pathname!=0) && (strlen(pathname)==0)) pathname = 0;
2122  if (pathname) {
2123  fullname = pathname;
2124  fullname += "/";
2125  }
2126  fullname += objectname;
2127 
2128  TObject* obj = FindObjectInFolder(folder, fullname);
2129 
2130  if ((obj!=0) && (!obj->InheritsFrom(cl))) {
2131  RemoveObjectFromFolder(fullname, folder, kTRUE);
2132  obj = 0;
2133  }
2134 
2135  fbCreatedinMake = (obj==0);
2136  return obj;
2137 }
2138 
2139 Bool_t TGo4AnalysisObjectManager::FindObjectPathName(TObject* obj, TString& pathname, TFolder* fold)
2140 {
2141  if (obj==0) return kFALSE;
2142 
2143  if (fold==0) fold = fxGo4Dir;
2144 
2145  if (fold->GetListOfFolders()->FindObject(obj)==obj) {
2146  pathname = "";
2147  return kTRUE;
2148  }
2149 
2150  TIter iter(fold->GetListOfFolders());
2151  TObject* sub = 0;
2152 
2153  while ((sub = iter())!=0) {
2154  if (!sub->InheritsFrom(TFolder::Class())) continue;
2155  if (FindObjectPathName(obj, pathname, (TFolder*) sub)) {
2156  if (pathname.Length()==0)
2157  pathname = sub->GetName();
2158  else
2159  pathname = TString(sub->GetName()) + "/" + pathname;
2160  return kTRUE;
2161  }
2162  }
2163 
2164  return kFALSE;
2165 }
virtual void Reset()
Bool_t SetParameter(const char *name, TGo4Parameter *par, TFolder *parent=0)
TGo4PolyCond * MakePolyCond(const char *foldername, const char *conditionname, Int_t size, Float_t(*points)[2], const char *bindhistogram=0, Bool_t invert=kFALSE)
Bool_t SetAnalysisCondition(const char *name, TGo4Condition *con, Bool_t counter=kTRUE, TFolder *parent=0)
TFolder * CreateCompositeBranchFolder(TObjArray *branchlist, TGo4CompositeEvent *compevent, Int_t startindex, Int_t *skip, const char *name, const char *title)
Bool_t ProtectObject(TObject *ob, const Option_t *flags)
Bool_t RemoveObjectFromFolder(const char *fullname, TFolder *fold, Bool_t isDel)
Bool_t RemoveEventProcessor(TGo4EventProcessor *pro)
Bool_t RemoveEventStructure(TGo4EventElement *ev)
static void CleanupPointerInEntries(TFolder *folder, TObject *obj)
virtual TGo4EventElement * GetChild(const char *name)
void UpdateFrom(TGo4Picture *source, TClass *selectedobjclass=0)
Bool_t AddObject(TNamed *anything, const char *subfolder=0, Bool_t replace=kTRUE)
virtual Bool_t UpdateFrom(TGo4Condition *cond, Bool_t counts)
Bool_t AddDynamicEntry(TGo4DynamicEntry *entry)
TFolder * CreateBranchFolder(TObjArray *branchlist, const char *name, const char *title, Bool_t istopbranch=kFALSE)
Bool_t IsMatching(const char *string, const char *expression)
void Reset(Bool_t onlyclearflag=kFALSE)
Bool_t RemovePicture(const char *name)
void SetConditionName(const char *name)
static const char * GetTOPDYNAMICLIST()
void RemoveFromDir(TFolder *fold, TDirectory *dir)
Short_t getNElements() const
Bool_t ClearObjects(const char *name)
Bool_t DeleteObjects(const char *name)
Bool_t RemoveObject(const char *name, Bool_t del=kTRUE)
TGo4Picture * GetPicture(const char *name)
Bool_t AddCanvas(TCanvas *can, const char *subfolder=0)
Bool_t AddPicture(TGo4Picture *pic, const char *subfolder=0)
Bool_t RemoveDynamicEntry(const char *entryname)
TH1 * GetHistogram(const char *name)
void SetConEventName(Int_t ix, const char *name)
static void CleanupSpecials()
void SetHistogramName(const char *name)
TObjArray * getListOfComposites(Bool_t toplevel=kTRUE)
Bool_t FindObjectPathName(TObject *obj, TString &pathname, TFolder *fold=0)
TList * CreateObjectList(const char *expr, const char *folder=0)
void PrintConditions(const char *expression=0)
Bool_t UpdateParameterValues(TGo4Parameter *par)
Bool_t ProtectFolder(TFolder *fold, const Option_t *flags)
TGo4EventElement * GetEventStructure(const char *name)
Bool_t AddHistogram(TH1 *his, const char *subfolder=0, Bool_t replace=kTRUE)
Bool_t RemoveEventStore(TGo4EventStore *store)
Bool_t AddEventProcessor(TGo4EventProcessor *pro)
Bool_t AddEventSource(TGo4EventSource *source)
TGo4Parameter * CreateParameter()
TObject * FindObjectInFolder(TFolder *folder, const char *fullname)
Bool_t AddAnalysisCondition(TGo4Condition *con, const char *subfolder=0)
static void ResetEntries(TFolder *folder)
TObject * TestObject(TFolder *folder, const char *&pathname, const char *objectname, const TClass *cl)
Bool_t PutToFolder(TObject *ob, TFolder *destination, Bool_t replace=kFALSE)
void PrintHistograms(const char *expression=0)
TH1 * MakeTH1(const char *histotype, const char *foldername, const char *histoname, Int_t nbinsx, Axis_t xlow, Axis_t xup, const char *title=0, const char *xtitle=0, const char *ytitle=0)
TFolder * CreateNamesFolder(TFolder *objectfolder)
Bool_t RemoveEventSource(TGo4EventSource *source)
TObject * GetAsTObject(const char *name, const char *folder=0)
void AppendToDir(TObject *ob, TDirectory *dir)
Bool_t RemoveCanvas(const char *name)
Bool_t AddEventStore(TGo4EventStore *store)
void Message(Int_t prio, const char *text,...)
Bool_t AddParameter(TGo4Parameter *par, const char *subfolder=0)
TFolder * FindSubFolder(TFolder *parent, const char *subfolder, Bool_t create=kTRUE)
Bool_t RemoveTree(TTree *tree, const char *stepname=0)
Bool_t ResetBackStores(Bool_t clearflag=kFALSE)
void SetHistogram(const char *name)
void Reset()
Definition: TGo4Picture.h:225
Bool_t AddTree(TTree *tree, const char *subfolder=0)
TGo4Parameter * GetParameter(const char *name, const char *parameter_class=0)
void SetHisEventName(Int_t ix, const char *name)
TGo4AnalysisObjectNames * CreateNamesList()
TObject * NextMatchingObject(const char *expr, const char *folder, Bool_t reset)
virtual void SetValues(Double_t low1, Double_t up1)
#define fguSUBFOLDERMAXLEN
virtual const char * GetName() const
TGo4Condition * GetAnalysisCondition(const char *name, const char *cond_cl=0)
Bool_t RemoveAnalysisCondition(const char *name)
void CleanupDynamicLists(TObject *oldobject)
Int_t PrintFolder(TFolder *fold, Option_t *opt, const char *expression=0)
static void PrintEntries(TFolder *folder)
#define GO4TRACE(X)
Definition: TGo4Log.h:26
Bool_t RemoveHistogram(const char *name, Bool_t del=kTRUE)
void PrintParameters(const char *expression=0)
virtual Bool_t UpdateFrom(TGo4Parameter *rhs)
TFolder * CreateMembersFolder(TObject *obj, const char *membrfoldername, TClass *cl)
TGo4ObjectStatus * CreateObjectStatus(const char *name, const char *folder=0)
Bool_t ProtectObjects(const char *name, const Option_t *flags)
Bool_t AddTreeHistogram(const char *hisname, const char *treename, const char *varexp, const char *cutexp)
void SetConVarName(Int_t ix, const char *name)
TGo4WinCond * MakeWindowCond(const char *foldername, const char *conditionname, Double_t xlow, Double_t xup, const char *bindhistogram=0, Bool_t invert=kFALSE)
Bool_t SetPicture(const char *name, TGo4Picture *pic, TFolder *parent=0)
TNamed * GetObject(const char *name, const char *folder=0)
Bool_t RemoveParameter(const char *name)
Bool_t SetParameterStatus(const char *name, TGo4ParameterStatus *par, TFolder *parent=0)
static const char * GetANALYSISFOLDER()
Bool_t AddDynamicHistogram(const char *name, const char *histo, const char *hevx, const char *hmemx, const char *hevy=0, const char *hmemy=0, const char *hevz=0, const char *hmemz=0, const char *condition=0, const char *cevx=0, const char *cmemx=0, const char *cevy=0, const char *cmemy=0)
TH2 * MakeTH2(const char *histotype, const char *foldername, const char *histoname, Int_t nbinsx, Axis_t xlow, Axis_t xup, Int_t nbinsy, Axis_t ylow, Axis_t yup, const char *title=0, const char *xtitle=0, const char *ytitle=0)
Bool_t AddEventStructure(TGo4EventElement *ev)
Bool_t LoadObjects(TFile *statusfile)
Int_t GetObjectSize() const
static TGo4Analysis * Instance()
TTree * GetTree(const char *name)
TGo4TreeStructure * CreateTreeStructure(TTree *thetree)
static void Info(const char *text,...)
Definition: TGo4Log.cxx:297
Bool_t LoadFolder(TFolder *source, TFolder *destination, Bool_t replace=kFALSE)
Bool_t AddObjectToFolder(TObject *ob, TFolder *fold, const char *subfolder=0, Bool_t replace=kTRUE, Bool_t uniquename=kFALSE, Bool_t resetbits=kTRUE)
TCanvas * GetCanvas(const char *name)
virtual void Invert(Bool_t on)
virtual void RecursiveRemove(TObject *obj)
void SetHisVarName(Int_t ix, const char *name)
static void ProcessEntries(TFolder *folder, Bool_t processtrees, Int_t interval)