Resetting of TClonesArray done with clear, if implemented for the class in the TCA...
authorkleinb <kleinb@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 25 Oct 2010 20:29:24 +0000 (20:29 +0000)
committerkleinb <kleinb@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 25 Oct 2010 20:29:24 +0000 (20:29 +0000)
STEER/AliESDEvent.cxx

index e7034e5..019d4d7 100644 (file)
@@ -358,7 +358,15 @@ void AliESDEvent::Reset()
        ((TClonesArray*)pObject)->Delete();
       }
       else if(!pObject->InheritsFrom(TCollection::Class())){
-       ResetWithPlacementNew(pObject);
+       TClass *pClass = TClass::GetClass(pObject->ClassName());
+       if (pClass && pClass->GetListOfMethods()->FindObject("Clear")) {
+         AliDebug(1, Form("Clear for object %s class %s", pObject->GetName(), pObject->ClassName()));
+         pObject->Clear();
+       }
+       else {
+         AliDebug(1, Form("ResetWithPlacementNew for object %s class %s", pObject->GetName(), pObject->ClassName()));
+         ResetWithPlacementNew(pObject);
+       }
       }
       else{
        AliWarning(Form("No reset for %s \n",