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.2 by loizides, Tue Jul 1 21:11:12 2008 UTC vs.
Revision 1.5 by sixie, Mon Aug 18 11:10:31 2008 UTC

# Line 14 | Line 14
14  
15   #include <map>
16   #include <TObject.h>
17 + #include "FWCore/MessageLogger/interface/MessageLogger.h"
18  
19   namespace mithep
20   {
# Line 27 | Line 28 | namespace mithep
28        ~AssociationMap() {}
29        
30        void       Add(EdmClass edmObj, MitClass mitObj);
31 <      EdmClass   GetEdmRef(MitClass mitObj) const;
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 +      bool       HasMit(EdmClass edmObj)    const;
36        void       Reset()                          { fwdMap_.clear(); revMap_.clear(); }
37        void       SetEdmProductId(Int_t id)        { edmProductId_ = id; }
38  
# Line 57 | Line 59 | inline MitClass mithep::AssociationMap<E
59  
60    if (iter != fwdMap_.end())
61      return iter->second;
62 <  else return 0;
62 >  else throw edm::Exception(edm::errors::Configuration, "AssociationMap::GetMit()\n")
63 >         << "Error! EDM Object (" << typeid(edmObj).name()
64 >         << ") not found in AssociationMap (" << typeid(*this).name() << ")." << std::endl;
65   }
66        
67   //--------------------------------------------------------------------------------------------------
68   template <class EdmClass, class MitClass>
69 < inline EdmClass mithep::AssociationMap<EdmClass,MitClass>::GetEdmRef(MitClass mitObj) const
69 > inline EdmClass mithep::AssociationMap<EdmClass,MitClass>::GetEdm(MitClass mitObj) const
70   {
71    typename revMapType::const_iterator iter = revMap_.find(mitObj);
72    if (iter != revMap_.end())
73      return iter->second;
74 <  else return 0;
74 >  else throw edm::Exception(edm::errors::Configuration, "AssociationMap::GetEdm()\n")
75 >         << "Error! MITHEP Object (" << typeid(mitObj).name()
76 >         << ") not found in AssociationMap (" << typeid(*this).name() << ")." << std::endl;
77   }
78 +
79 + //--------------------------------------------------------------------------------------------------
80 + template <class EdmClass, class MitClass>
81 + inline bool mithep::AssociationMap<EdmClass,MitClass>::HasMit(EdmClass edmObj) const
82 + {
83 +  typename fwdMapType::const_iterator iter = fwdMap_.find(edmObj);
84 +
85 +  if (iter != fwdMap_.end())
86 +    return true;
87 +  else
88 +    return false;
89 + }
90 +      
91   #endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines