Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46

/*
 *  See header file for a description of this class.
 *
 *  \author G. Cerminara - CERN
 */

#include "CondFormats/DTObjects/interface/DTRecoUncertainties.h"
#include "DataFormats/MuonDetId/interface/DTWireId.h"
#include <iostream>

using std::cout;
using std::endl;
using std::map;
using std::vector;

DTRecoUncertainties::DTRecoUncertainties() {}

DTRecoUncertainties::~DTRecoUncertainties() {}

float DTRecoUncertainties::get(const DTWireId& wireid, unsigned int index) const {
  // FIXME: what to do in case the superlayerId is not found in the map?
  // FIXME: any check on the type?
  map<uint32_t, vector<float> >::const_iterator slIt = payload.find(wireid.superlayerId().rawId());
  if (slIt == payload.end()) {
    cout << "[DTRecoUncertainties]***Error: the SLId: " << wireid.superlayerId() << " is not in the paylaod map!"
         << endl;
    // FIXME: what to do here???
    return -1.;
  } else if (vector<float>::size_type(index) >= (*slIt).second.size()) {
    cout << "[DTRecoUncertainties]***Error: requesting parameter index: " << index << " for vector of size "
         << (*slIt).second.size() << endl;
    // FIXME: what to do here???
    return -1.;
  }

  return (*slIt).second[index];
}

void DTRecoUncertainties::set(const DTWireId& wireid, const std::vector<float>& values) {
  payload[wireid.superlayerId()] = values;
}

DTRecoUncertainties::const_iterator DTRecoUncertainties::begin() const { return payload.begin(); }

DTRecoUncertainties::const_iterator DTRecoUncertainties::end() const { return payload.end(); }