5 |
|
// |
6 |
|
// Wrapper for std::map, used to resolve links during tree filling. |
7 |
|
// |
8 |
< |
// Authors: J.Bendavid, C.Loizides |
8 |
> |
// Authors: C.Paus, J.Bendavid, C.Loizides |
9 |
|
//-------------------------------------------------------------------------------------------------- |
10 |
|
|
11 |
|
#ifndef MITPROD_TREEFILLER_ASSOCIATIONMAP_H |
19 |
|
{ |
20 |
|
template <class EdmClass, class MitClass> class AssociationMap : public TObject |
21 |
|
{ |
22 |
+ |
public: |
23 |
|
typedef std::map<EdmClass, MitClass> fwdMapType; |
24 |
|
typedef std::map<MitClass, EdmClass> revMapType; |
25 |
|
|
26 |
< |
public: |
27 |
< |
AssociationMap() : edmProductId_(0) {} |
28 |
< |
~AssociationMap() {} |
29 |
< |
|
30 |
< |
void Add(EdmClass edmObj, MitClass mitObj); |
31 |
< |
EdmClass GetEdm(MitClass mitObj) const; |
32 |
< |
Int_t GetEdmProductId() const { return edmProductId_; } |
33 |
< |
Int_t GetEntries() const { return fwdMap_.size(); } |
34 |
< |
MitClass GetMit(EdmClass edmObj) const; |
35 |
< |
const char *GetBrName() const { return brname_.c_str(); } |
36 |
< |
bool HasMit(EdmClass edmObj) const; |
37 |
< |
void Reset() { fwdMap_.clear(); revMap_.clear(); } |
38 |
< |
void SetEdmProductId(Int_t id) { edmProductId_ = id; } |
39 |
< |
void SetBrName(const std::string &n) { brname_ = n; } |
40 |
< |
void SetBrName(const char *n) { brname_ = n; } |
41 |
< |
|
42 |
< |
protected: |
43 |
< |
fwdMapType fwdMap_; //map between edm ref and mit ptr |
44 |
< |
revMapType revMap_; //map between mit ptr and edm ref |
45 |
< |
Int_t edmProductId_; //product id for consistency check |
46 |
< |
std::string brname_; //branch name of MIT objects |
26 |
> |
AssociationMap() : edmProductId_(0) {} |
27 |
> |
~AssociationMap() {} |
28 |
> |
|
29 |
> |
void Add(EdmClass edmObj, MitClass mitObj); |
30 |
> |
EdmClass GetEdm(MitClass mitObj) const; |
31 |
> |
Int_t GetEdmProductId() const { return edmProductId_; } |
32 |
> |
Int_t GetEntries() const { return fwdMap_.size(); } |
33 |
> |
MitClass GetMit(EdmClass edmObj) const; |
34 |
> |
const char *GetBrName() const { return brname_.c_str(); } |
35 |
> |
bool HasMit(EdmClass edmObj) const; |
36 |
> |
void Reset() { fwdMap_.clear(); revMap_.clear(); } |
37 |
> |
void SetEdmProductId(Int_t id) { edmProductId_ = id; } |
38 |
> |
void SetBrName(const std::string &n) { brname_ = n; } |
39 |
> |
void SetBrName(const char *n) { brname_ = n; } |
40 |
> |
const fwdMapType &FwdMap() const { return fwdMap_; } |
41 |
> |
const revMapType &RevMap() const { return revMap_; } |
42 |
> |
|
43 |
> |
protected: |
44 |
> |
fwdMapType fwdMap_; //map between edm ref and mit ptr |
45 |
> |
revMapType revMap_; //map between mit ptr and edm ref |
46 |
> |
Int_t edmProductId_; //product id for consistency check |
47 |
> |
std::string brname_; //branch name of MIT objects |
48 |
|
}; |
49 |
|
} |
50 |
|
|