test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HcalSiPMRecovery.cc
Go to the documentation of this file.
2 
3 HcalSiPMRecovery::HcalSiPMRecovery(double recoveryTime) :
4  theRecoveryTime(recoveryTime), theIntegral(0) {
5 }
6 
8 }
9 
11  int recoveredPixels = 0;
12  std::multimap<double, int>::iterator past;
13  for (past = theHistory.begin();
14  past != theHistory.lower_bound(time-theRecoveryTime); ++past) {
15  recoveredPixels += past->second;
16  }
17  theHistory.erase(theHistory.begin(), past);
18  theIntegral -= recoveredPixels;
19  return theIntegral;
20 }
21 
22 void HcalSiPMRecovery::addToHistory(double time, int pixels) {
23  theHistory.insert(std::pair<double, int>(time,pixels));
24  theIntegral += pixels;
25 }
26 
28  theHistory.clear();
29  theIntegral = 0;
30 }
HcalSiPMRecovery(double recoveryTime=250.)
int getIntegral(double time)
std::multimap< double, int > theHistory
void addToHistory(double time, int pixels)