00001 //------------------------------------------------------------- 00002 // Go4 Release Package v3.04-01 (build 30401) 00003 // 28-November-2008 00004 //--------------------------------------------------------------- 00005 // The GSI Online Offline Object Oriented (Go4) Project 00006 // Experiment Data Processing at EE department, GSI 00007 //--------------------------------------------------------------- 00008 // 00009 //Copyright (C) 2000- Gesellschaft f. Schwerionenforschung, GSI 00010 // Planckstr. 1, 64291 Darmstadt, Germany 00011 //Contact: http://go4.gsi.de 00012 //---------------------------------------------------------------- 00013 //This software can be used under the license agreements as stated 00014 //in Go4License.txt file which is part of the distribution. 00015 //---------------------------------------------------------------- 00016 #include "TGo4DrawObjProxy.h" 00017 00018 #include "TList.h" 00019 #include "THStack.h" 00020 #include "TMultiGraph.h" 00021 00022 TGo4DrawObjProxy::TGo4DrawObjProxy(TObject* obj, Bool_t owner, Bool_t doclear) : 00023 TGo4ObjectProxy(obj, owner), 00024 fDoClear(doclear) 00025 { 00026 } 00027 00028 TGo4DrawObjProxy::~TGo4DrawObjProxy() 00029 { 00030 if (fDoClear) TryToClearObject(); 00031 } 00032 00033 Bool_t TGo4DrawObjProxy::RemoveRegisteredObject(TObject* obj) 00034 { 00035 if (obj == fObject) TryToClearObject(); 00036 return TGo4ObjectProxy::RemoveRegisteredObject(obj); 00037 } 00038 00039 void TGo4DrawObjProxy::TryToClearObject() 00040 { 00041 if (fObject==0) return; 00042 if (fObject->InheritsFrom(THStack::Class())) { 00043 THStack* hs = (THStack*) fObject; 00044 if (hs->GetHists()) 00045 hs->GetHists()->Clear(); 00046 } else 00047 if (fObject->InheritsFrom(TMultiGraph::Class())) { 00048 TMultiGraph* mgr = (TMultiGraph*) fObject; 00049 if (mgr->GetListOfGraphs()) 00050 mgr->GetListOfGraphs()->Clear(); 00051 } 00052 } 00053 00054 //----------------------------END OF GO4 SOURCE FILE ---------------------