1 |
// $Id: FillerElectrons.h,v 1.11 2008/11/03 18:11:09 bendavid Exp $
|
2 |
|
3 |
#ifndef DataFormats_Common_RefToBaseToPtr_h
|
4 |
#define DataFormats_Common_RefToBaseToPtr_h
|
5 |
|
6 |
/*----------------------------------------------------------------------
|
7 |
|
8 |
Ref: A function template for conversion from RefToBase to Ptr
|
9 |
|
10 |
----------------------------------------------------------------------*/
|
11 |
/*
|
12 |
----------------------------------------------------------------------*/
|
13 |
|
14 |
#include "DataFormats/Common/interface/RefToBase.h"
|
15 |
#include "DataFormats/Common/interface/Ptr.h"
|
16 |
|
17 |
namespace mitedm {
|
18 |
template <typename T>
|
19 |
edm::Ptr<T> refToBaseToPtr(
|
20 |
edm::RefToBase<T> const& ref) {
|
21 |
if (ref.get() == 0 && ref.productGetter() != 0) {
|
22 |
return edm::Ptr<T>(ref.id(), ref.key(), ref.productGetter());
|
23 |
}
|
24 |
else
|
25 |
return edm::Ptr<T>(ref.id(), ref.get(), ref.key());
|
26 |
}
|
27 |
}
|
28 |
#endif
|