CMS 3D CMS Logo

HcalZSAlgoRealistic.cc

Go to the documentation of this file.
00001 #include "SimCalorimetry/HcalZeroSuppressionAlgos/interface/HcalZSAlgoRealistic.h"
00002 #include <iostream>
00003 
00004 HcalZSAlgoRealistic::HcalZSAlgoRealistic(HcalZeroSuppressionAlgo::ZSMode mode, int levelHB, int levelHE, int levelHO, int levelHF) : 
00005   HcalZeroSuppressionAlgo(mode),
00006   thresholdHB_(levelHB),
00007   thresholdHE_(levelHE),
00008   thresholdHO_(levelHO),
00009   thresholdHF_(levelHF)
00010 {
00011 }
00012 
00013 namespace ZSRealistic_impl {
00014 
00015   template <class DIGI> 
00016   bool keepMe(const DIGI& inp, int threshold) {
00017     bool keepIt=false;
00018 
00019     //determine the sum of 2 timeslices
00020 
00021     for (int i=0; i< inp.size()-1 && !keepIt; i++) {
00022       int sum=0;
00023       for (int j=i; j<(i+2); j++){
00024         sum+=inp[j].adc();
00025         //pedsum+=pedave;
00026       }
00027       if (sum>=threshold) keepIt=true;
00028     }
00029     return keepIt;
00030   }
00031 }
00032 
00033 
00034 bool HcalZSAlgoRealistic::shouldKeep(const HBHEDataFrame& digi) const {
00035   if (digi.id().subdet()==HcalBarrel) return ZSRealistic_impl::keepMe<HBHEDataFrame>(digi,thresholdHB_);
00036   else return ZSRealistic_impl::keepMe<HBHEDataFrame>(digi,thresholdHE_);
00037 }
00038 
00039 bool HcalZSAlgoRealistic::shouldKeep(const HODataFrame& digi) const {
00040   return ZSRealistic_impl::keepMe<HODataFrame>(digi,thresholdHO_);
00041 }
00042 bool HcalZSAlgoRealistic::shouldKeep(const HFDataFrame& digi) const {
00043   return ZSRealistic_impl::keepMe<HFDataFrame>(digi,thresholdHF_);
00044 }

Generated on Tue Jun 9 17:46:30 2009 for CMSSW by  doxygen 1.5.4