CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch13/src/SimCalorimetry/HcalSimAlgos/src/HcalSiPMRecovery.cc

Go to the documentation of this file.
00001 #include "SimCalorimetry/HcalSimAlgos/interface/HcalSiPMRecovery.h"
00002 
00003 HcalSiPMRecovery::HcalSiPMRecovery(double recoveryTime) : 
00004   theRecoveryTime(recoveryTime), theIntegral(0) {
00005 }
00006 
00007 HcalSiPMRecovery::~HcalSiPMRecovery() {
00008 }
00009 
00010 int HcalSiPMRecovery::getIntegral(double time) {
00011   int recoveredPixels = 0;
00012   std::multimap<double, int>::iterator past;
00013   for (past = theHistory.begin(); 
00014        past != theHistory.lower_bound(time-theRecoveryTime); ++past) { 
00015     recoveredPixels += past->second;
00016   }
00017   theHistory.erase(theHistory.begin(), past);
00018   theIntegral -= recoveredPixels;
00019   return theIntegral;
00020 }
00021 
00022 void HcalSiPMRecovery::addToHistory(double time, int pixels) {
00023   theHistory.insert(std::pair<double, int>(time,pixels));
00024   theIntegral += pixels;
00025 }
00026 
00027 void HcalSiPMRecovery::clearHistory() {
00028   theHistory.clear();
00029   theIntegral = 0;
00030 }