3 /**************************************************************************
4 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
6 * Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
7 * for The ALICE Off-line Project. *
9 * Permission to use, copy, modify and distribute this software and its *
10 * documentation strictly for non-commercial purposes is hereby granted *
11 * without fee, provided that the above copyright notice appears in all *
12 * copies and that both the copyright notice and this permission notice *
13 * appear in the supporting documentation. The authors make no claims *
14 * about the suitability of this software for any purpose. It is *
15 * provided "as is" without express or implied warranty. *
16 **************************************************************************/
18 /** @file AliHLTConfiguration.cxx
19 @author Matthias Richter
21 @brief Implementation of HLT configuration handler.
29 #include "AliHLTConfiguration.h"
30 #include "AliHLTConfigurationHandler.h"
31 #include "AliHLTTask.h"
32 #include "AliHLTComponent.h"
33 #include "AliHLTComponentHandler.h"
37 /** ROOT macro for the implementation of ROOT specific class methods */
38 ClassImp(AliHLTConfiguration)
40 AliHLTConfiguration::AliHLTConfiguration()
52 fListSrcElement=fListSources.begin();
55 AliHLTConfiguration::AliHLTConfiguration(const char* id, const char* component, const char* sources, const char* arguments)
58 fComponent(component),
59 fStringSources(sources),
63 fArguments(arguments),
67 fListSrcElement=fListSources.begin();
68 if (id && component) {
69 if (fConfigurationHandler) {
70 fConfigurationHandler->RegisterConfiguration(this);
72 HLTError("no configuration handler set, abort registration");
77 AliHLTConfiguration::AliHLTConfiguration(const AliHLTConfiguration&)
91 fListSrcElement=fListSources.begin();
92 HLTFatal("copy constructor untested");
95 AliHLTConfiguration& AliHLTConfiguration::operator=(const AliHLTConfiguration&)
97 HLTFatal("assignment operator untested");
101 AliHLTConfiguration::~AliHLTConfiguration()
103 if (fConfigurationHandler) {
104 if (fConfigurationHandler->FindConfiguration(fID)!=NULL) {
105 fConfigurationHandler->RemoveConfiguration(this);
110 for (int i=0; i<fArgc; i++) {
119 /* the global configuration handler which is used to automatically register the configuration
121 AliHLTConfigurationHandler* AliHLTConfiguration::fConfigurationHandler=NULL;
123 int AliHLTConfiguration::GlobalInit(AliHLTConfigurationHandler* pHandler)
126 if (fConfigurationHandler!=NULL) {
127 fConfigurationHandler->Logging(kHLTLogWarning, "AliHLTConfiguration::GlobalInit", HLT_DEFAULT_LOG_KEYWORD, "configuration handler already initialized, overriding object %p", fConfigurationHandler);
129 fConfigurationHandler=pHandler;
133 int AliHLTConfiguration::GlobalDeinit()
136 fConfigurationHandler=NULL;
140 const char* AliHLTConfiguration::GetName() const {
143 return TObject::GetName();
146 AliHLTConfiguration* AliHLTConfiguration::GetSource(const char* id)
148 AliHLTConfiguration* pSrc=NULL;
150 // first check the current element
151 if (fListSrcElement!=fListSources.end() && strcmp(id, (*fListSrcElement)->GetName())==0) {
152 pSrc=*fListSrcElement;
156 pSrc=GetFirstSource();
158 if (strcmp(id, pSrc->GetName())==0)
160 pSrc=GetNextSource();
167 AliHLTConfiguration* AliHLTConfiguration::GetFirstSource()
169 AliHLTConfiguration* pSrc=NULL;
170 if (fNofSources>=0 || ExtractSources()) {
171 fListSrcElement=fListSources.begin();
172 if (fListSrcElement!=fListSources.end()) pSrc=*fListSrcElement;
177 AliHLTConfiguration* AliHLTConfiguration::GetNextSource()
179 AliHLTConfiguration* pSrc=NULL;
181 if (fListSrcElement!=fListSources.end() && (++fListSrcElement)!=fListSources.end())
182 pSrc=*fListSrcElement;
187 int AliHLTConfiguration::SourcesResolved(int bAuto)
190 if (fNofSources>=0 || bAuto && (iResult=ExtractSources())>=0) {
191 //HLTDebug("fNofSources=%d", fNofSources);
192 //HLTDebug("list size = %d", fListSources.size());
193 iResult=fNofSources==(int)fListSources.size();
198 int AliHLTConfiguration::InvalidateSource(AliHLTConfiguration* pConf)
202 vector<AliHLTConfiguration*>::iterator element=fListSources.begin();
203 while (element!=fListSources.end()) {
204 if (*element==pConf) {
205 fListSources.erase(element);
206 fListSrcElement=fListSources.end();
207 // there is no need to re-evaluate until there was a new configuration registered
208 // -> postpone the invalidation, its done in AliHLTConfigurationHandler::RegisterConfiguration
209 //InvalidateSources();
220 void AliHLTConfiguration::PrintStatus()
222 HLTLogKeyword("configuration status");
223 HLTMessage("status of configuration \"%s\" (%p)", GetName(), this);
224 if (fComponent) HLTMessage(" - component: \"%s\"", fComponent);
225 else HLTMessage(" - component string invalid");
226 if (fStringSources) HLTMessage(" - sources: \"%s\"", fStringSources);
227 else HLTMessage(" - no sources");
228 if (SourcesResolved(1)<=0)
229 HLTMessage(" there are unresolved sources");
230 AliHLTConfiguration* pSrc=GetFirstSource();
232 HLTMessage(" source \"%s\" (%p) resolved", pSrc->GetName(), pSrc);
233 pSrc=GetNextSource();
237 int AliHLTConfiguration::GetArguments(const char*** pArgv)
242 *pArgv=(const char**)fArgv;
250 int AliHLTConfiguration::ExtractSources()
254 if (fStringSources!=NULL) {
255 vector<char*> tgtList;
256 fListSources.clear();
257 if ((iResult=InterpreteString(fStringSources, tgtList))>=0) {
258 fNofSources=tgtList.size();
259 vector<char*>::iterator element=tgtList.begin();
260 while ((element=tgtList.begin())!=tgtList.end()) {
261 if (fConfigurationHandler) {
262 AliHLTConfiguration* pConf=fConfigurationHandler->FindConfiguration(*element);
264 HLTDebug("source \"%s\" inserted", pConf->GetName());
265 fListSources.push_back(pConf);
267 HLTError("can not find source \"%s\"", (*element));
270 } else if (iResult>=0) {
272 HLTFatal("global configuration handler not initialized, can not resolve sources");
275 tgtList.erase(element);
277 fListSrcElement=fListSources.begin();
283 int AliHLTConfiguration::ExtractArguments()
286 if (fArguments!=NULL) {
287 vector<char*> tgtList;
288 if ((iResult=InterpreteString(fArguments, tgtList))>=0) {
289 fArgc=tgtList.size();
290 //HLTDebug("found %d arguments", fArgc);
292 fArgv = new char*[fArgc];
294 vector<char*>::iterator element=tgtList.begin();
296 while (element!=tgtList.end()) {
297 //HLTDebug("assign arguments %d (%s)", i, *element);
298 fArgv[i++]=(*element);
310 int AliHLTConfiguration::InterpreteString(const char* arg, vector<char*>& argList)
314 //HLTDebug("interprete \"%s\"", arg);
318 if (arg[i]==0 || arg[i]==' ') {
320 char* pEntry= new char[i-prec+1];
322 strncpy(pEntry, &arg[prec], i-prec);
323 pEntry[i-prec]=0; // terminate string
324 //HLTDebug("create string \"%s\", insert at %d", pEntry, argList.size());
325 argList.push_back(pEntry);
330 } else if (prec==-1) prec=i;
331 } while (arg[i++]!=0 && iResult>=0);
338 int AliHLTConfiguration::FollowDependency(const char* id, TList* pTgtList)
342 AliHLTConfiguration* pDep=NULL;
343 if ((pDep=GetSource(id))!=NULL) {
344 if (pTgtList) pTgtList->Add(pDep);
347 pDep=GetFirstSource();
348 while (pDep && iResult==0) {
349 if ((iResult=pDep->FollowDependency(id, pTgtList))>0) {
350 if (pTgtList) pTgtList->AddFirst(pDep);
353 pDep=GetNextSource();
362 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
364 /** ROOT macro for the implementation of ROOT specific class methods */
367 AliHLTTask::AliHLTTask()
369 fpConfiguration(NULL),
374 fpBlockDataArray(NULL),
375 fBlockDataArraySize(0)
379 AliHLTTask::AliHLTTask(AliHLTConfiguration* pConf)
381 fpConfiguration(pConf),
386 fpBlockDataArray(NULL),
387 fBlockDataArraySize(0)
391 AliHLTTask::AliHLTTask(const AliHLTTask&)
395 fpConfiguration(NULL),
400 fpBlockDataArray(NULL),
401 fBlockDataArraySize(0)
403 HLTFatal("copy constructor untested");
406 AliHLTTask& AliHLTTask::operator=(const AliHLTTask&)
408 HLTFatal("assignment operator untested");
412 AliHLTTask::~AliHLTTask()
414 if (fpComponent) delete fpComponent;
416 if (fpBlockDataArray) delete[] fpBlockDataArray;
417 fpBlockDataArray=NULL;
420 int AliHLTTask::Init(AliHLTConfiguration* pConf, AliHLTComponentHandler* pCH)
423 if (fpConfiguration!=NULL && fpConfiguration!=pConf) {
424 HLTWarning("overriding previous reference to configuration object %p (%s) by %p",
425 fpConfiguration, GetName(), pConf);
427 if (pConf!=NULL) fpConfiguration=pConf;
428 if (fpConfiguration) {
431 const char** argv=NULL;
432 if ((iResult=fpConfiguration->GetArguments(&argv))>=0) {
433 argc=iResult; // just to make it clear
434 iResult=pCH->CreateComponent(fpConfiguration->GetComponentID(), NULL, argc, argv, fpComponent);
437 HLTError("can not find component \"%s\"", fpConfiguration->GetComponentID());
441 HLTError("component handler instance needed for task initialization");
445 HLTError("configuration object instance needed for task initialization");
451 int AliHLTTask::Deinit()
456 const char *AliHLTTask::GetName() const
459 return fpConfiguration->GetName();
460 return TObject::GetName();
463 AliHLTConfiguration* AliHLTTask::GetConf() const
465 return fpConfiguration;
468 AliHLTComponent* AliHLTTask::GetComponent() const
473 AliHLTTask* AliHLTTask::FindDependency(const char* id)
475 AliHLTTask* pTask=NULL;
477 pTask=(AliHLTTask*)fListDependencies.FindObject(id);
482 int AliHLTTask::FollowDependency(const char* id, TList* pTgtList)
486 AliHLTTask* pDep=NULL;
487 if ((pDep=(AliHLTTask*)fListDependencies.FindObject(id))!=NULL) {
488 if (pTgtList) pTgtList->Add(pDep);
491 TObjLink* lnk=fListDependencies.FirstLink();
492 while (lnk && iResult==0) {
493 pDep=(AliHLTTask*)lnk->GetObject();
495 if ((iResult=pDep->FollowDependency(id, pTgtList))>0) {
496 if (pTgtList) pTgtList->AddFirst(pDep);
511 void AliHLTTask::PrintDependencyTree(const char* id, int bFromConfiguration)
513 HLTLogKeyword("task dependencies");
516 if (bFromConfiguration) {
518 iResult=fpConfiguration->FollowDependency(id, &tgtList);
522 iResult=FollowDependency(id, &tgtList);
524 HLTMessage(" task \"%s\": dependency level %d ", GetName(), iResult);
525 TObjLink* lnk=tgtList.FirstLink();
527 char* pSpace = new char[iResult+1];
529 memset(pSpace, 32, iResult);
532 TObject* obj=lnk->GetObject();
533 HLTMessage(" %s^-- %s ", &pSpace[i--], obj->GetName());
543 /* this function is most likely depricated
544 int AliHLTTask::InsertBlockData(AliHLTComponent_BlockData* pBlock, AliHLTTask* pSource)
551 int AliHLTTask::SetDependency(AliHLTTask* pDep)
555 if (FindDependency(pDep->GetName())==NULL) {
556 fListDependencies.Add(pDep);
566 int AliHLTTask::CheckDependencies()
569 AliHLTConfiguration* pSrc=fpConfiguration->GetFirstSource();
571 if (FindDependency(pSrc->GetName())==NULL) {
572 //HLTDebug("dependency \"%s\" unresolved", pSrc->GetName());
575 pSrc=fpConfiguration->GetNextSource();
581 int AliHLTTask::Depends(AliHLTTask* pTask)
585 if (fpConfiguration) {
586 iResult=fpConfiguration->GetSource(pTask->GetName())!=NULL;
588 //HLTDebug("task \"%s\" depends on \"%s\"", GetName(), pTask->GetName());
590 //HLTDebug("task \"%s\" independend of \"%s\"", GetName(), pTask->GetName());
601 AliHLTTask* AliHLTTask::FindTarget(const char* id)
603 AliHLTTask* pTask=NULL;
605 pTask=(AliHLTTask*)fListTargets.FindObject(id);
610 int AliHLTTask::SetTarget(AliHLTTask* pTgt)
614 if (FindTarget(pTgt->GetName())==NULL) {
615 fListTargets.Add(pTgt);
625 /* this function is most likely depricated
626 int AliHLTTask::BuildBlockDataArray(AliHLTComponent_BlockData*& pBlockData)
633 int AliHLTTask::StartRun()
636 int iNofInputDataBlocks=0;
637 AliHLTComponent* pComponent=GetComponent();
639 // determine the number of input data blocks provided from the source tasks
640 TObjLink* lnk=fListDependencies.FirstLink();
641 while (lnk && iResult>=0) {
642 AliHLTTask* pSrcTask=(AliHLTTask*)lnk->GetObject();
644 if ((iResult=pSrcTask->GetNofMatchingDataTypes(this))>0) {
645 iNofInputDataBlocks+=iResult;
646 } else if (iResult==0) {
647 HLTWarning("source task %s (%p) does not provide any matching data type for task %s (%p)", pSrcTask->GetName(), pSrcTask, GetName(), this);
649 HLTError("task %s (%p): error getting matching data types for source task %s (%p)", GetName(), this, pSrcTask->GetName(), pSrcTask);
656 if (fpBlockDataArray) {
657 HLTWarning("block data array for task %s (%p) was not cleaned", GetName(), this);
658 delete [] fpBlockDataArray;
659 fpBlockDataArray=NULL;
660 fBlockDataArraySize=0;
664 //iResult=Init( AliHLTComponentEnvironment* environ, void* environ_param, int argc, const char** argv );
666 // allocate internal task varables for bookkeeping aso.
667 fpBlockDataArray=new AliHLTComponent_BlockData[iNofInputDataBlocks];
668 if (fpBlockDataArray) {
669 fBlockDataArraySize=iNofInputDataBlocks;
671 HLTError("memory allocation failed");
676 HLTError("task %s (%p) does not have a component", GetName(), this);
682 int AliHLTTask::EndRun()
688 int AliHLTTask::ProcessTask()
691 if (fpComponent && fpBlockDataArray) {
692 int iSourceDataBlock=0;
693 int iInputDataVolume=0;
695 int iNofInputDataBlocks=0;
696 /* TODO: the assumption of only one output data type per component is the current constraint
697 * later it should be checked how many output blocks of the source component match the input
698 * data types of the consumer component (GetNofMatchingDataBlocks). If one assumes that a
699 * certain output block is always been produced, the initialization could be done in the
700 * StartRun. Otherwise the fpBlockDataArray has to be adapted each time.
702 iNofInputDataBlocks=fListDependencies.GetSize(); // one block per source
703 // is not been used since the allocation was done in StartRun, but check the size
704 if (iNofInputDataBlocks>fBlockDataArraySize) {
705 HLTError("block data array too small");
708 AliHLTTask* pSrcTask=NULL;
709 TList subscribedTaskList;
710 TObjLink* lnk=fListDependencies.FirstLink();
712 // subscribe to all source tasks
713 while (lnk && iResult>=0) {
714 pSrcTask=(AliHLTTask*)lnk->GetObject();
716 if (pSrcTask->GetNofMatchingDataBlocks(this)<fBlockDataArraySize-iSourceDataBlock) {
717 if ((iResult=pSrcTask->Subscribe(this, &fpBlockDataArray[iSourceDataBlock],fBlockDataArraySize-iSourceDataBlock))>0) {
718 for (int i=0; i<iResult; i++) {
719 iInputDataVolume+=fpBlockDataArray[i+iSourceDataBlock].fSize;
720 // put the source task as many times into the list as it provides data blocks
721 // makes the bookkeeping for the data release easier
722 subscribedTaskList.Add(pSrcTask);
724 iSourceDataBlock+=iResult;
725 HLTDebug("Task %s (%p) successfully subscribed to %d data blocks of task %s (%p)", GetName(), this, iResult, pSrcTask->GetName(), pSrcTask);
728 HLTError("Task %s (%p): subscription to task %s (%p) failed with error %d", GetName(), this, pSrcTask->GetName(), pSrcTask, iResult);
732 HLTFatal("Task %s (%p): too little space in data block array for subscription to task %s (%p)", GetName(), this, pSrcTask->GetName(), pSrcTask);
736 HLTFatal("fatal internal error in ROOT list handling");
744 long unsigned int iConstBase=0;
745 double fInputMultiplier=0;
746 fpComponent->GetOutputDataSize(iConstBase, fInputMultiplier);
747 int iOutputDataSize=int(fInputMultiplier*iInputDataVolume) + iConstBase;
748 AliHLTUInt8_t* pTgtBuffer=fpDataBuffer->GetTargetBuffer(iOutputDataSize);
749 AliHLTComponent_EventData evtData;
750 AliHLTComponent_TriggerData trigData;
751 AliHLTUInt32_t size=iOutputDataSize;
752 AliHLTUInt32_t outputBlockCnt=0;
753 AliHLTComponent_BlockData* outputBlocks=NULL;
754 AliHLTComponent_EventDoneData* edd;
755 if (pTgtBuffer!=NULL || iOutputDataSize==0) {
756 iResult=fpComponent->ProcessEvent(evtData, fpBlockDataArray, trigData, pTgtBuffer, size, outputBlockCnt, outputBlocks, edd);
761 // now release all buffers which we have subscribed to
763 lnk=subscribedTaskList.FirstLink();
765 pSrcTask=(AliHLTTask*)lnk->GetObject();
768 if ((iTempRes=pSrcTask->Release(&fpBlockDataArray[iSourceDataBlock], this))>=0) {
769 HLTDebug("Task %s (%p) successfully released task %s (%p)", GetName(), this, pSrcTask->GetName(), pSrcTask);
771 HLTError("Task %s (%p): realease of task %s (%p) failed with error %d", GetName(), this, pSrcTask->GetName(), pSrcTask, iTempRes);
774 HLTFatal("fatal internal error in ROOT list handling");
777 subscribedTaskList.Remove(lnk);
778 lnk=subscribedTaskList.FirstLink();
781 if (subscribedTaskList.GetSize()>0) {
782 HLTError("task %s (%p): could not release all data buffers", GetName(), this);
785 HLTError("internal failure: task not initialized");
791 int AliHLTTask::GetNofMatchingDataBlocks(const AliHLTTask* pConsumerTask)
796 iResult=fpDataBuffer->FindMatchingDataBlocks(pConsumerTask->GetComponent(), NULL);
798 HLTFatal("internal data buffer missing");
807 int AliHLTTask::GetNofMatchingDataTypes(const AliHLTTask* pConsumerTask)
811 AliHLTComponent* pComponent=GetComponent();
816 iResult=pComponent->FindMatchingDataTypes(pConsumerTask->GetComponent(), NULL);
818 HLTFatal("task initialization failed");
827 int AliHLTTask::Subscribe(const AliHLTTask* pConsumerTask, AliHLTComponent_BlockData* pBlockDesc, int iArraySize)
832 iResult=fpDataBuffer->Subscribe(pConsumerTask->GetComponent(), pBlockDesc, iArraySize);
834 HLTFatal("internal data buffer missing");
843 int AliHLTTask::Release(AliHLTComponent_BlockData* pBlockDesc, const AliHLTTask* pConsumerTask)
846 if (pConsumerTask && pBlockDesc) {
848 iResult=fpDataBuffer->Release(pBlockDesc, pConsumerTask->GetComponent());
850 HLTFatal("internal data buffer missing");
859 /* this function is most likely depricated
860 int AliHLTTask::ClearSourceBlocks()
867 void AliHLTTask::PrintStatus()
869 HLTLogKeyword("task properties");
871 HLTMessage(" component: %s (%p)", fpComponent->GetComponentID(), fpComponent);
873 HLTMessage(" no component set!");
875 if (fpConfiguration) {
876 AliHLTConfiguration* pSrc=fpConfiguration->GetFirstSource();
878 const char* pQualifier="unresolved";
879 if (FindDependency(pSrc->GetName()))
880 pQualifier="resolved";
881 HLTMessage(" source: %s (%s)", pSrc->GetName(), pQualifier);
882 pSrc=fpConfiguration->GetNextSource();
884 TObjLink* lnk = fListTargets.FirstLink();
886 TObject *obj = lnk->GetObject();
887 HLTMessage(" target: %s", obj->GetName());
891 HLTMessage(" task \"%s\" not initialized", GetName());
895 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
897 TList AliHLTConfigurationHandler::fListConfigurations;
898 TList AliHLTConfigurationHandler::fListDynamicConfigurations;
900 /** ROOT macro for the implementation of ROOT specific class methods */
901 ClassImp(AliHLTConfigurationHandler)
903 AliHLTConfigurationHandler::AliHLTConfigurationHandler()
907 AliHLTConfigurationHandler::~AliHLTConfigurationHandler()
909 TObjLink* lnk=fListDynamicConfigurations.FirstLink();
911 TObject* obj=lnk->GetObject();
912 if (fListConfigurations.FindObject(obj->GetName())==NULL) {
913 HLTDebug("delete dynamic configuration \"%s\"", obj->GetName());
920 int AliHLTConfigurationHandler::RegisterConfiguration(AliHLTConfiguration* pConf)
924 if (FindConfiguration(pConf->GetName()) == NULL) {
925 fListConfigurations.Add(pConf);
926 //HLTDebug("configuration \"%s\" registered", pConf->GetName());
928 // mark all configurations with unresolved dependencies for re-evaluation
929 TObjLink* lnk=fListConfigurations.FirstLink();
931 AliHLTConfiguration* pSrc=(AliHLTConfiguration*)lnk->GetObject();
932 if (pSrc && pSrc!=pConf && pSrc->SourcesResolved()!=1) {
933 pSrc->InvalidateSources();
939 HLTWarning("configuration \"%s\" already registered", pConf->GetName());
947 int AliHLTConfigurationHandler::CreateConfiguration(const char* id, const char* component, const char* sources, const char* arguments)
950 AliHLTConfiguration* pConf= new AliHLTConfiguration(id, component, sources, arguments);
952 // the configuration will be registered automatically, if this failes the configuration
953 // is missing -> delete it
954 if (FindConfiguration(id)==NULL) {
959 fListDynamicConfigurations.Add(pConf);
962 HLTError("system error: object allocation failed");
968 void AliHLTConfigurationHandler::PrintConfigurations()
970 HLTLogKeyword("configuration listing");
971 HLTMessage("registered configurations:");
972 TObjLink *lnk = fListConfigurations.FirstLink();
974 TObject *obj = lnk->GetObject();
975 HLTMessage(" %s", obj->GetName());
980 int AliHLTConfigurationHandler::RemoveConfiguration(const char* id)
984 AliHLTConfiguration* pConf=NULL;
985 if ((pConf=FindConfiguration(id))!=NULL) {
986 iResult=RemoveConfiguration(pConf);
988 HLTWarning("can not find configuration \"%s\"", id);
997 int AliHLTConfigurationHandler::RemoveConfiguration(AliHLTConfiguration* pConf)
1001 // remove the configuration from the list
1002 fListConfigurations.Remove(pConf);
1003 // remove cross links in the remaining configurations
1004 TObjLink* lnk=fListConfigurations.FirstLink();
1005 while (lnk && iResult>=0) {
1006 AliHLTConfiguration* pRem=(AliHLTConfiguration*)lnk->GetObject();
1008 pRem->InvalidateSource(pConf);
1018 AliHLTConfiguration* AliHLTConfigurationHandler::FindConfiguration(const char* id)
1020 AliHLTConfiguration* pConf=NULL;
1022 pConf=(AliHLTConfiguration*)fListConfigurations.FindObject(id);