ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitProd/TreeFiller/interface/AssociationMap.h
(Generate patch)

Comparing UserCode/MitProd/TreeFiller/interface/AssociationMap.h (file contents):
Revision 1.3 by bendavid, Wed Jul 2 19:29:27 2008 UTC vs.
Revision 1.6 by loizides, Wed Sep 10 03:30:22 2008 UTC

# Line 4 | Line 4
4   // Association Map
5   //
6   // Wrapper for std::map, used to resolve links during tree filling.
7 // This class needs work! CL.
7   //
8   // Authors: J.Bendavid, C.Loizides
9   //--------------------------------------------------------------------------------------------------
10  
11 < #ifndef TREEFILLER_ASSOCIATIONMAP_H
12 < #define TREEFILLER_ASSOCIATIONMAP_H
11 > #ifndef MITPROD_TREEFILLER_ASSOCIATIONMAP_H
12 > #define MITPROD_TREEFILLER_ASSOCIATIONMAP_H
13  
14   #include <map>
15   #include <TObject.h>
# Line 28 | Line 27 | namespace mithep
27        ~AssociationMap() {}
28        
29        void       Add(EdmClass edmObj, MitClass mitObj);
30 <      EdmClass   GetEdmRef(MitClass mitObj) const;
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 +      bool       HasMit(EdmClass edmObj)    const;
35        void       Reset()                          { fwdMap_.clear(); revMap_.clear(); }
36        void       SetEdmProductId(Int_t id)        { edmProductId_ = id; }
37  
# Line 59 | Line 59 | inline MitClass mithep::AssociationMap<E
59    if (iter != fwdMap_.end())
60      return iter->second;
61    else throw edm::Exception(edm::errors::Configuration, "AssociationMap::GetMit()\n")
62 <        << "Error! Edm Object not found in AssociationMap." << std::endl;
62 >         << "Error! EDM Object (" << typeid(edmObj).name()
63 >         << ") not found in AssociationMap (" << typeid(*this).name() << ")." << std::endl;
64   }
65        
66   //--------------------------------------------------------------------------------------------------
67   template <class EdmClass, class MitClass>
68 < inline EdmClass mithep::AssociationMap<EdmClass,MitClass>::GetEdmRef(MitClass mitObj) const
68 > inline EdmClass mithep::AssociationMap<EdmClass,MitClass>::GetEdm(MitClass mitObj) const
69   {
70    typename revMapType::const_iterator iter = revMap_.find(mitObj);
71    if (iter != revMap_.end())
72      return iter->second;
73 <  else throw edm::Exception(edm::errors::Configuration, "AssociationMap::GetEdmRef()\n")
74 <        << "Error! mithep Object not found in AssociationMap." << std::endl;
73 >  else throw edm::Exception(edm::errors::Configuration, "AssociationMap::GetEdm()\n")
74 >         << "Error! MITHEP Object (" << typeid(mitObj).name()
75 >         << ") not found in AssociationMap (" << typeid(*this).name() << ")." << std::endl;
76 > }
77 >
78 > //--------------------------------------------------------------------------------------------------
79 > template <class EdmClass, class MitClass>
80 > inline bool mithep::AssociationMap<EdmClass,MitClass>::HasMit(EdmClass edmObj) const
81 > {
82 >  typename fwdMapType::const_iterator iter = fwdMap_.find(edmObj);
83 >
84 >  if (iter != fwdMap_.end())
85 >    return true;
86 >  else
87 >    return false;
88   }
89   #endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines