1 |
loizides |
1.1 |
// $Id: Ref.cc,v 1.1 2009/02/17 14:57:29 bendavid Exp $
|
2 |
|
|
|
3 |
|
|
#include "MitAna/DataCont/interface/RefResolver.h"
|
4 |
|
|
|
5 |
|
|
#include <TObject.h>
|
6 |
|
|
#include <TRefTable.h>
|
7 |
|
|
#include <TProcessID.h>
|
8 |
|
|
#include <TROOT.h>
|
9 |
|
|
#include "MitAna/TAM/interface/TAMSelector.h"
|
10 |
|
|
|
11 |
|
|
ClassImp(mithep::RefResolver)
|
12 |
|
|
|
13 |
|
|
using namespace mithep;
|
14 |
|
|
|
15 |
|
|
//--------------------------------------------------------------------------------------------------
|
16 |
|
|
TObject *RefResolver::GetObjectWithID(UInt_t uid, TProcessID *pid)
|
17 |
|
|
{
|
18 |
|
|
// Return pointer to object with given uid/pid.
|
19 |
|
|
|
20 |
|
|
static TAMSelector *sel = 0;
|
21 |
|
|
|
22 |
|
|
#if 0
|
23 |
|
|
if (!sel) {
|
24 |
|
|
TObject *optr = gROOT->GetListOfSpecials()->FindObject("mithep::Selector");
|
25 |
|
|
if (optr)
|
26 |
|
|
sel = dynamic_cast<TAMSelector*>(optr);
|
27 |
|
|
} else {
|
28 |
|
|
if (!gROOT->GetListOfSpecials()->FindObject(sel))
|
29 |
|
|
sel = 0;
|
30 |
|
|
}
|
31 |
|
|
|
32 |
|
|
if (sel)
|
33 |
|
|
return sel->GetObjectWithID(uid,pid);
|
34 |
|
|
#endif
|
35 |
|
|
// no explicit TAM proxy present, fall back to standard Root calls and check if
|
36 |
|
|
// the reference can be found in the TRefTable
|
37 |
|
|
TRefTable *table = TRefTable::GetRefTable();
|
38 |
|
|
if (table) {
|
39 |
|
|
table->SetUID(uid, pid);
|
40 |
|
|
table->Notify();
|
41 |
|
|
}
|
42 |
|
|
|
43 |
|
|
return pid->GetObjectWithID(uid);
|
44 |
|
|
}
|