Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 
0002 /*
0003  *  See header file for a description of this class.
0004  *
0005  *  \author G. Cerminara - CERN
0006  */
0007 
0008 #include "CondFormats/DTObjects/interface/DTRecoUncertainties.h"
0009 #include "DataFormats/MuonDetId/interface/DTWireId.h"
0010 #include <iostream>
0011 
0012 using std::cout;
0013 using std::endl;
0014 using std::map;
0015 using std::vector;
0016 
0017 DTRecoUncertainties::DTRecoUncertainties() {}
0018 
0019 DTRecoUncertainties::~DTRecoUncertainties() {}
0020 
0021 float DTRecoUncertainties::get(const DTWireId& wireid, unsigned int index) const {
0022   // FIXME: what to do in case the superlayerId is not found in the map?
0023   // FIXME: any check on the type?
0024   map<uint32_t, vector<float> >::const_iterator slIt = payload.find(wireid.superlayerId().rawId());
0025   if (slIt == payload.end()) {
0026     cout << "[DTRecoUncertainties]***Error: the SLId: " << wireid.superlayerId() << " is not in the paylaod map!"
0027          << endl;
0028     // FIXME: what to do here???
0029     return -1.;
0030   } else if (vector<float>::size_type(index) >= (*slIt).second.size()) {
0031     cout << "[DTRecoUncertainties]***Error: requesting parameter index: " << index << " for vector of size "
0032          << (*slIt).second.size() << endl;
0033     // FIXME: what to do here???
0034     return -1.;
0035   }
0036 
0037   return (*slIt).second[index];
0038 }
0039 
0040 void DTRecoUncertainties::set(const DTWireId& wireid, const std::vector<float>& values) {
0041   payload[wireid.superlayerId()] = values;
0042 }
0043 
0044 DTRecoUncertainties::const_iterator DTRecoUncertainties::begin() const { return payload.begin(); }
0045 
0046 DTRecoUncertainties::const_iterator DTRecoUncertainties::end() const { return payload.end(); }