Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:02:16

0001 #include "FWCore/Utilities/interface/Exception.h"
0002 
0003 #include "CondFormats/HcalObjects/interface/OOTPileupCorrectionColl.h"
0004 
0005 bool OOTPileupCorrectionColl::exists(const std::string& name, const std::string& category) const {
0006   DataMap::const_iterator dit = data_.find(category);
0007   if (dit == data_.end())
0008     return false;
0009   else
0010     return !(dit->second.find(name) == dit->second.end());
0011 }
0012 
0013 std::shared_ptr<AbsOOTPileupCorrection> OOTPileupCorrectionColl::get(const std::string& name,
0014                                                                      const std::string& category) const {
0015   DataMap::const_iterator dit = data_.find(category);
0016   if (dit == data_.end())
0017     throw cms::Exception("In OOTPileupCorrectionColl::get: unknown category");
0018   PtrMap::const_iterator pit = dit->second.find(name);
0019   if (pit == dit->second.end())
0020     throw cms::Exception("In OOTPileupCorrectionColl::get: unknown name");
0021   return pit->second;
0022 }
0023 
0024 bool OOTPileupCorrectionColl::operator==(const OOTPileupCorrectionColl& r) const {
0025   if (data_.size() != r.data_.size())
0026     return false;
0027   DataMap::const_iterator dit = data_.begin();
0028   const DataMap::const_iterator end = data_.end();
0029   DataMap::const_iterator rit = r.data_.begin();
0030   for (; dit != end; ++dit, ++rit) {
0031     if (dit->first != rit->first)
0032       return false;
0033     if (dit->second.size() != rit->second.size())
0034       return false;
0035     PtrMap::const_iterator pit = dit->second.begin();
0036     const PtrMap::const_iterator pend = dit->second.end();
0037     PtrMap::const_iterator rpit = rit->second.begin();
0038     for (; pit != pend; ++pit, ++rpit) {
0039       if (pit->first != rpit->first)
0040         return false;
0041       if (*(pit->second) != *(rpit->second))
0042         return false;
0043     }
0044   }
0045   return true;
0046 }