Go to the documentation of this file.00001 #include "SimCalorimetry/HcalZeroSuppressionAlgos/interface/HcalZSAlgoRealistic.h"
00002 #include <iostream>
00003
00004 HcalZSAlgoRealistic::HcalZSAlgoRealistic(bool mp, int levelHB, int levelHE, int levelHO, int levelHF) :
00005 HcalZeroSuppressionAlgo(mp),
00006 thresholdHB_(levelHB),
00007 thresholdHE_(levelHE),
00008 thresholdHO_(levelHO),
00009 thresholdHF_(levelHF)
00010 {
00011 usingDBvalues = false;
00012 }
00013
00014 HcalZSAlgoRealistic::HcalZSAlgoRealistic(bool mp) :
00015 HcalZeroSuppressionAlgo(mp)
00016 {
00017 thresholdHB_ = -1;
00018 thresholdHE_ = -1;
00019 thresholdHO_ = -1;
00020 thresholdHF_ = -1;
00021 usingDBvalues = true;
00022 }
00023
00024
00025
00026
00027
00028 bool HcalZSAlgoRealistic::keepMe(const HBHEDataFrame& inp, int threshold, uint32_t hbhezsmask) const{
00029
00030 bool keepIt=false;
00031
00032 if ((usingDBvalues) && (threshold < 0) && (m_dbService != 0)){
00033 threshold = (m_dbService->getHcalZSThreshold(inp.id()))->getValue();
00034 }
00035
00036
00037 for (int i=0; i< inp.size()-1 && !keepIt; i++) {
00038 int sum=0;
00039
00040 for (int j=i; j<(i+2); j++){
00041 sum+=inp[j].adc();
00042
00043 }
00044 if ((hbhezsmask&(1<<i)) !=0) continue;
00045 else if (sum>=threshold) keepIt=true;
00046 }
00047 return keepIt;
00048 }
00049
00050
00051 bool HcalZSAlgoRealistic::keepMe(const HODataFrame& inp, int threshold, uint32_t hozsmask) const{
00052
00053 bool keepIt=false;
00054
00055 if ((usingDBvalues) && (threshold < 0) && (m_dbService != 0)){
00056 threshold = (m_dbService->getHcalZSThreshold(inp.id()))->getValue();
00057 }
00058
00059
00060 for (int i=0; i< inp.size()-1 && !keepIt; i++) {
00061 int sum=0;
00062
00063 for (int j=i; j<(i+2); j++){
00064 sum+=inp[j].adc();
00065
00066 }
00067 if ((hozsmask&(1<<i)) !=0) continue;
00068 else if (sum>=threshold) keepIt=true;
00069 }
00070 return keepIt;
00071 }
00072
00073
00074 bool HcalZSAlgoRealistic::keepMe(const HFDataFrame& inp, int threshold, uint32_t hfzsmask) const{
00075
00076 bool keepIt=false;
00077
00078 if ((usingDBvalues) && (threshold < 0) && (m_dbService != 0)){
00079 threshold = (m_dbService->getHcalZSThreshold(inp.id()))->getValue();
00080 }
00081
00082
00083 for (int i=0; i< inp.size()-1 && !keepIt; i++) {
00084 int sum=0;
00085
00086 for (int j=i; j<(i+2); j++){
00087 sum+=inp[j].adc();
00088
00089 }
00090 if ((hfzsmask&(1<<i)) !=0) continue;
00091 else if (sum>=threshold) keepIt=true;
00092 }
00093 return keepIt;
00094 }
00095
00096
00097 bool HcalZSAlgoRealistic::shouldKeep(const HBHEDataFrame& digi) const{
00098
00099 if (digi.id().subdet()==HcalBarrel)
00100 return keepMe(digi,thresholdHB_,digi.zsCrossingMask());
00101 else return keepMe(digi,thresholdHE_,digi.zsCrossingMask());
00102 }
00103
00104 bool HcalZSAlgoRealistic::shouldKeep(const HODataFrame& digi) const{
00105 return keepMe(digi,thresholdHO_,digi.zsCrossingMask());
00106 }
00107
00108 bool HcalZSAlgoRealistic::shouldKeep(const HFDataFrame& digi) const{
00109 return keepMe(digi,thresholdHF_,digi.zsCrossingMask());
00110 }