Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:58:41

0001 /**
0002 */
0003 
0004 #include "Calibration/EcalCalibAlgos/interface/L3CalibBlock.h"
0005 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0006 #include "TH1F.h"
0007 #include "TFile.h"
0008 
0009 // -----------------------------------------------------
0010 
0011 L3CalibBlock::L3CalibBlock(const int numberOfElements, const int keventweight)
0012     : VEcalCalibBlock(numberOfElements), m_L3AlgoUniv(new MinL3AlgoUniv<unsigned int>(keventweight)) {
0013   reset();
0014 }
0015 
0016 // -----------------------------------------------------
0017 
0018 L3CalibBlock::~L3CalibBlock() { delete m_L3AlgoUniv; }
0019 
0020 // -----------------------------------------------------
0021 
0022 void L3CalibBlock::Fill(std::map<int, double>::const_iterator MapBegin,
0023                         std::map<int, double>::const_iterator MapEnd,
0024                         double pTk,
0025                         double pSubtract,
0026                         double sigma) {
0027   // to feed the L3 algo
0028   std::vector<float> energy;
0029   std::vector<unsigned int> position;
0030   // loop over the energies map
0031   for (std::map<int, double>::const_iterator itMap = MapBegin; itMap != MapEnd; ++itMap) {
0032     // translation into vectors for the L3 algo
0033     position.push_back(itMap->first);
0034     energy.push_back(itMap->second);
0035   }  // loop over the energies map
0036   m_L3AlgoUniv->addEvent(energy, position, pTk - pSubtract);
0037 
0038   return;
0039 }
0040 
0041 // ------------------------------------------------------------
0042 
0043 int L3CalibBlock::solve(int usingBlockSolver, double min, double max) {
0044   m_coefficients = m_L3AlgoUniv->getSolution();
0045   return 0;
0046 }
0047 
0048 // ------------------------------------------------------------
0049 
0050 void L3CalibBlock::reset() {
0051   //PG FIXME could it be it is not wanted to be reset?
0052   m_L3AlgoUniv->resetSolution();
0053   return;
0054 }