3 |
|
// |
4 |
|
// Ref |
5 |
|
// |
6 |
< |
// Templated reimplimentation of TRef |
6 |
> |
// Templated reimplimentation of our own TRef. |
7 |
|
// |
8 |
|
// Authors: J.Bendavid |
9 |
|
//-------------------------------------------------------------------------------------------------- |
15 |
|
#include <TRefTable.h> |
16 |
|
#include <TProcessID.h> |
17 |
|
#include <TError.h> |
18 |
< |
#include "MitAna/TAM/interface/TAMSelector.h" |
18 |
> |
#include "MitAna/DataCont/interface/RefResolver.h" |
19 |
|
#include "MitAna/DataCont/interface/ProcIDRef.h" |
20 |
|
|
21 |
|
namespace mithep |
24 |
|
class Ref |
25 |
|
{ |
26 |
|
public: |
27 |
< |
Ref() : fPID(0), fUID(0) {} |
27 |
> |
Ref() : fPID(0), fUID(0) {} |
28 |
|
Ref(const ArrayElement *ae) { SetObject(ae); } |
29 |
< |
virtual ~Ref() {} |
29 |
> |
virtual ~Ref() {} |
30 |
|
|
31 |
|
Bool_t IsNull() const { return fUID==0 ? kTRUE : kFALSE; } |
32 |
|
Bool_t IsValid() const { return !IsNull(); } |
40 |
|
|
41 |
|
protected: |
42 |
|
TObject *GetObject() const; |
43 |
– |
|
44 |
– |
static Bool_t fOptimizedLoading; |
45 |
– |
ProcIDRef fPID;//|| |
46 |
– |
UInt_t fUID; |
43 |
|
|
44 |
< |
ClassDef(Ref, 1) // Base class of all our collections |
44 |
> |
ProcIDRef fPID; //||process id corresponding to referenced object |
45 |
> |
UInt_t fUID; //unique id of the referenced object |
46 |
> |
|
47 |
> |
ClassDef(Ref, 1) // Templated implementation of our own TRef |
48 |
|
}; |
49 |
|
} |
50 |
|
|
52 |
|
template<class ArrayElement> |
53 |
|
TObject *mithep::Ref<ArrayElement>::GetObject() const |
54 |
|
{ |
55 |
< |
// Return entry at given index. Code adapted from TRef::GetObject(). |
55 |
> |
// Return pointer to object. Code adapted from TRef::GetObject(). |
56 |
|
|
57 |
|
if (IsNull()) |
58 |
|
return 0; |
59 |
|
|
60 |
< |
TProcessID *pid= fPID.Pid(); |
62 |
< |
|
60 |
> |
TProcessID *pid = fPID.Pid(); |
61 |
|
if (!pid) { |
62 |
|
Fatal("GetObject","Process id pointer is null!"); |
63 |
|
return 0; |
68 |
|
return 0; |
69 |
|
} |
70 |
|
|
71 |
< |
//try to autoload from TAM |
74 |
< |
TAMSelector *tSel = TAMSelector::GetEvtSelector(); |
75 |
< |
if (tSel) { |
76 |
< |
return tSel->GetObjectWithID(fUID,pid); |
77 |
< |
} |
78 |
< |
|
79 |
< |
//no TAM proxy present, fall back to standard Root calls |
80 |
< |
|
81 |
< |
//the reference may be in the TRefTable |
82 |
< |
TRefTable *table = TRefTable::GetRefTable(); |
83 |
< |
if (table) { |
84 |
< |
table->SetUID(fUID, pid); |
85 |
< |
table->Notify(); |
86 |
< |
} |
87 |
< |
|
88 |
< |
return pid->GetObjectWithID(fUID); |
89 |
< |
|
71 |
> |
return RefResolver::GetObjectWithID(fUID,pid); |
72 |
|
} |
73 |
|
|
74 |
|
//-------------------------------------------------------------------------------------------------- |
108 |
|
return kTRUE; |
109 |
|
else |
110 |
|
return kFALSE; |
129 |
– |
|
111 |
|
} |
112 |
|
|
113 |
|
//-------------------------------------------------------------------------------------------------- |
129 |
|
fPID.SetPid(TProcessID::GetSessionProcessID()); |
130 |
|
fUID = TProcessID::AssignID(const_cast<ArrayElement*>(ae)); |
131 |
|
} |
151 |
– |
|
132 |
|
} |
153 |
– |
|
133 |
|
#endif |