00001 // $Id: TGo4DrawObjProxy.cxx 478 2009-10-29 12:26:09Z linev $ 00002 //----------------------------------------------------------------------- 00003 // The GSI Online Offline Object Oriented (Go4) Project 00004 // Experiment Data Processing at EE department, GSI 00005 //----------------------------------------------------------------------- 00006 // Copyright (C) 2000- GSI Helmholtzzentrum für Schwerionenforschung GmbH 00007 // Planckstr. 1, 64291 Darmstadt, Germany 00008 // Contact: http://go4.gsi.de 00009 //----------------------------------------------------------------------- 00010 // This software can be used under the license agreements as stated 00011 // in Go4License.txt file which is part of the distribution. 00012 //----------------------------------------------------------------------- 00013 00014 #include "TGo4DrawObjProxy.h" 00015 00016 #include "TList.h" 00017 #include "THStack.h" 00018 #include "TMultiGraph.h" 00019 00020 TGo4DrawObjProxy::TGo4DrawObjProxy(TObject* obj, Bool_t owner, Bool_t doclear) : 00021 TGo4ObjectProxy(obj, owner), 00022 fDoClear(doclear) 00023 { 00024 } 00025 00026 TGo4DrawObjProxy::~TGo4DrawObjProxy() 00027 { 00028 if (fDoClear) TryToClearObject(); 00029 } 00030 00031 Bool_t TGo4DrawObjProxy::RemoveRegisteredObject(TObject* obj) 00032 { 00033 if (obj == fObject) TryToClearObject(); 00034 return TGo4ObjectProxy::RemoveRegisteredObject(obj); 00035 } 00036 00037 void TGo4DrawObjProxy::TryToClearObject() 00038 { 00039 if (fObject==0) return; 00040 if (fObject->InheritsFrom(THStack::Class())) { 00041 THStack* hs = (THStack*) fObject; 00042 if (hs->GetHists()) 00043 hs->GetHists()->Clear(); 00044 } else 00045 if (fObject->InheritsFrom(TMultiGraph::Class())) { 00046 TMultiGraph* mgr = (TMultiGraph*) fObject; 00047 if (mgr->GetListOfGraphs()) 00048 mgr->GetListOfGraphs()->Clear(); 00049 } 00050 }