CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_6/src/CalibCalorimetry/HcalAlgos/src/HcalPulseContainmentManager.cc

Go to the documentation of this file.
00001 #include "CalibCalorimetry/HcalAlgos/interface/HcalPulseContainmentManager.h"
00002 
00003 HcalPulseContainmentManager::HcalPulseContainmentManager(float max_fracerror ) 
00004 : entries_(),
00005   shapes_(),
00006   max_fracerror_(max_fracerror)
00007 {
00008 }
00009 
00010 
00011 void HcalPulseContainmentManager::beginRun(edm::EventSetup const & es)
00012 {
00013 
00014   shapes_.beginRun(es);
00015 }
00016 
00017 
00018 void HcalPulseContainmentManager::endRun()
00019 {
00020   shapes_.endRun();
00021 }
00022 
00023 
00024 double HcalPulseContainmentManager::correction(const HcalDetId & detId, 
00025                                                int toAdd, float fixedphase_ns, double fc_ampl)
00026 {
00027 
00028   /*
00029           int sub     = detId.subdet();
00030           int depth   = detId.depth();
00031           int inteta  = detId.ieta();
00032           int intphi  = detId.iphi();
00033           
00034           std::cout << "* HcalPulseContainmentManager::correction,   cell:" 
00035                     << " sub, ieta, iphi, depth = " 
00036                     << sub << "  " << inteta << "  " << intphi 
00037                     << "  " << depth  << "  toAaa= " << toAdd 
00038                     <<"  phase = " << fixedphase_ns << "  ampl = " 
00039                     << fc_ampl 
00040                     << std::endl;
00041   */
00042 
00043   return get(detId, toAdd, fixedphase_ns)->getCorrection(fc_ampl);
00044 }
00045 
00046 
00047 const HcalPulseContainmentCorrection * 
00048 HcalPulseContainmentManager::get(const HcalDetId & detId, int toAdd, float fixedphase_ns)
00049 {
00050   // const HcalPulseShape * shape = &(shapes_.shape(detId));
00051   const HcalPulseShape * shape = &(shapes_.shapeForReco(detId));
00052   for(std::vector<HcalPulseContainmentEntry>::const_iterator entryItr = entries_.begin();
00053       entryItr != entries_.end(); ++entryItr)
00054   {
00055     if (entryItr->shape_ == shape && entryItr->toAdd_ == toAdd && entryItr->fixedphase_ns_ == fixedphase_ns)
00056     {
00057         return &entryItr->correction_;
00058     }
00059   }
00060 
00061   /*
00062           int sub     = detId.subdet();
00063           int depth   = detId.depth();
00064           int inteta  = detId.ieta();
00065           int intphi  = detId.iphi();
00066           
00067           std::cout << "* HcalPulseContainmentManager::get new entry,  cell:" 
00068                     << " sub, ieta, iphi, depth = " 
00069                     << sub << "  " << inteta << "  " << intphi 
00070                     << "  " << depth   
00071                     << std::endl;
00072   */
00073 
00074   // didn't find it.  Make one.
00075   HcalPulseContainmentEntry entry(toAdd, fixedphase_ns, shape,
00076     HcalPulseContainmentCorrection(shape, toAdd, fixedphase_ns, max_fracerror_));
00077   entries_.push_back(entry);
00078   return &(entries_.back().correction_);
00079 } 
00080