00001 #include "RecoLocalCalo/EcalRecAlgos/interface/ESRecHitSimAlgo.h" 00002 #include "FWCore/MessageLogger/interface/MessageLogger.h" 00003 00004 // ESRecHitSimAlgo author : Chia-Ming, Kuo 00005 00006 ESRecHitSimAlgo::ESRecHitSimAlgo(int gain, int pedestal, double MIPADC, double MIPkeV) : 00007 gain_(gain), ped_(pedestal), MIPADC_(MIPADC), MIPkeV_(MIPkeV) 00008 { 00009 00010 // pulse height parametrization 00011 // 0 : old gain in ORCA 00012 // 1 : low gain for data taking 00013 // 2 : high gain for calibration 00014 if (gain_ == 0) { 00015 pw[0] = -1.12521; 00016 pw[1] = 0.877968; 00017 pw[2] = 0.247238; 00018 } 00019 else if (gain_ == 1) { 00020 pw[0] = -0.0772417; 00021 pw[1] = 0.8168024; 00022 pw[2] = 0.3857636; 00023 } 00024 else if (gain_ == 2) { 00025 pw[0] = -0.01687177; 00026 pw[1] = 0.77676196; 00027 pw[2] = 0.416363; 00028 } 00029 00030 LogDebug("ESRecHitSimAlgo") << "ESRecHitSimAlgo : Gain "<<gain_<<" Weights : "<<pw[0]<<" "<<pw[1]<<" "<<pw[2]; 00031 } 00032 00033 double ESRecHitSimAlgo::EvalAmplitude(const ESDataFrame& digi) const { 00034 00035 float energy = 0; 00036 float adc[3]; 00037 00038 for (int i=0; i<digi.size(); i++) { 00039 energy += pw[i]*(digi.sample(i).adc()-ped_); 00040 LogDebug("ESRecHitSimAlgo") << "ESRecHitSimAlgo : Digi "<<i<<" ADC counts "<<digi.sample(i).adc()<<" Ped "<<ped_; 00041 adc[i] = digi.sample(i).adc(); 00042 } 00043 if (gain_>0) energy *= MIPkeV_/MIPADC_; 00044 00045 // convert to GeV 00046 energy /= 1000000.; 00047 00048 return energy; 00049 } 00050 00051 EcalRecHit ESRecHitSimAlgo::reconstruct(const ESDataFrame& digi) const { 00052 00053 float energy = 0; 00054 00055 energy = EvalAmplitude(digi); 00056 00057 DetId detId = digi.id(); 00058 00059 LogDebug("ESRecHitSimAlgo") << "ESRecHitSimAlgo : reconstructed energy "<<energy; 00060 00061 return EcalRecHit(digi.id(), energy, 0); 00062 } 00063