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 47 48 49 50 51 52 53 54
/**
*/

#include "Calibration/EcalCalibAlgos/interface/L3CalibBlock.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "TH1F.h"
#include "TFile.h"

// -----------------------------------------------------

L3CalibBlock::L3CalibBlock(const int numberOfElements, const int keventweight)
    : VEcalCalibBlock(numberOfElements), m_L3AlgoUniv(new MinL3AlgoUniv<unsigned int>(keventweight)) {
  reset();
}

// -----------------------------------------------------

L3CalibBlock::~L3CalibBlock() { delete m_L3AlgoUniv; }

// -----------------------------------------------------

void L3CalibBlock::Fill(std::map<int, double>::const_iterator MapBegin,
                        std::map<int, double>::const_iterator MapEnd,
                        double pTk,
                        double pSubtract,
                        double sigma) {
  // to feed the L3 algo
  std::vector<float> energy;
  std::vector<unsigned int> position;
  // loop over the energies map
  for (std::map<int, double>::const_iterator itMap = MapBegin; itMap != MapEnd; ++itMap) {
    // translation into vectors for the L3 algo
    position.push_back(itMap->first);
    energy.push_back(itMap->second);
  }  // loop over the energies map
  m_L3AlgoUniv->addEvent(energy, position, pTk - pSubtract);

  return;
}

// ------------------------------------------------------------

int L3CalibBlock::solve(int usingBlockSolver, double min, double max) {
  m_coefficients = m_L3AlgoUniv->getSolution();
  return 0;
}

// ------------------------------------------------------------

void L3CalibBlock::reset() {
  //PG FIXME could it be it is not wanted to be reset?
  m_L3AlgoUniv->resetSolution();
  return;
}