00001 #ifndef RecoLocalCalo_EcalRecProducers_EcalUncalibRecHitRecWorkerGlobal_hh 00002 #define RecoLocalCalo_EcalRecProducers_EcalUncalibRecHitRecWorkerGlobal_hh 00003 00015 #include "RecoLocalCalo/EcalRecProducers/interface/EcalUncalibRecHitWorkerBaseClass.h" 00016 #include "RecoLocalCalo/EcalRecAlgos/interface/EcalUncalibRecHitRecWeightsAlgo.h" 00017 #include "RecoLocalCalo/EcalRecAlgos/interface/EcalUncalibRecHitRecChi2Algo.h" 00018 #include "RecoLocalCalo/EcalRecAlgos/interface/EcalUncalibRecHitRatioMethodAlgo.h" 00019 #include "RecoLocalCalo/EcalRecAlgos/interface/EcalUncalibRecHitLeadingEdgeAlgo.h" 00020 #include "FWCore/Framework/interface/ESHandle.h" 00021 #include "CondFormats/EcalObjects/interface/EcalTimeCalibConstants.h" 00022 #include "CondFormats/EcalObjects/interface/EcalTimeOffsetConstant.h" 00023 #include "CondFormats/EcalObjects/interface/EcalPedestals.h" 00024 #include "CondFormats/EcalObjects/interface/EcalGainRatios.h" 00025 #include "CondFormats/EcalObjects/interface/EcalWeightXtalGroups.h" 00026 #include "CondFormats/EcalObjects/interface/EcalTBWeights.h" 00027 #include "CondFormats/EcalObjects/interface/EcalSampleMask.h" 00028 #include "SimCalorimetry/EcalSimAlgos/interface/EBShape.h" 00029 #include "SimCalorimetry/EcalSimAlgos/interface/EEShape.h" 00030 00031 00032 namespace edm { 00033 class Event; 00034 class EventSetup; 00035 class ParameterSet; 00036 } 00037 00038 class EcalUncalibRecHitWorkerGlobal : public EcalUncalibRecHitWorkerBaseClass { 00039 00040 public: 00041 EcalUncalibRecHitWorkerGlobal(const edm::ParameterSet&); 00042 virtual ~EcalUncalibRecHitWorkerGlobal() {}; 00043 00044 void set(const edm::EventSetup& es); 00045 bool run(const edm::Event& evt, const EcalDigiCollection::const_iterator & digi, EcalUncalibratedRecHitCollection & result); 00046 00047 protected: 00048 00049 double pedVec[3]; 00050 double pedRMSVec[3]; 00051 double gainRatios[3]; 00052 00053 edm::ESHandle<EcalPedestals> peds; 00054 edm::ESHandle<EcalGainRatios> gains; 00055 00056 template < class C > int isSaturated(const C & digi); 00057 00058 double timeCorrectionEB(float ampliEB); 00059 double timeCorrectionEE(float ampliEE); 00060 00061 // weights method 00062 edm::ESHandle<EcalWeightXtalGroups> grps; 00063 edm::ESHandle<EcalTBWeights> wgts; 00064 const EcalWeightSet::EcalWeightMatrix* weights[2]; 00065 const EcalWeightSet::EcalChi2WeightMatrix* chi2mat[2]; 00066 EcalUncalibRecHitRecWeightsAlgo<EBDataFrame> weightsMethod_barrel_; 00067 EcalUncalibRecHitRecWeightsAlgo<EEDataFrame> weightsMethod_endcap_; 00068 const EEShape testbeamEEShape; // used in the chi2 00069 const EBShape testbeamEBShape; // can be replaced by simple shape arrays of float in the future 00070 00071 // determie which of the samples must actually be used by ECAL local reco 00072 edm::ESHandle<EcalSampleMask> sampleMaskHand_; 00073 00074 // ratio method 00075 std::vector<double> EBtimeFitParameters_; 00076 std::vector<double> EEtimeFitParameters_; 00077 std::vector<double> EBamplitudeFitParameters_; 00078 std::vector<double> EEamplitudeFitParameters_; 00079 std::pair<double,double> EBtimeFitLimits_; 00080 std::pair<double,double> EEtimeFitLimits_; 00081 bool doEBtimeCorrection_; 00082 bool doEEtimeCorrection_; 00083 std::vector<double> EBtimeCorrAmplitudeBins_; 00084 std::vector<double> EBtimeCorrShiftBins_; 00085 std::vector<double> EEtimeCorrAmplitudeBins_; 00086 std::vector<double> EEtimeCorrShiftBins_; 00087 EcalUncalibRecHitRatioMethodAlgo<EBDataFrame> ratioMethod_barrel_; 00088 EcalUncalibRecHitRatioMethodAlgo<EEDataFrame> ratioMethod_endcap_; 00089 00090 double EBtimeConstantTerm_; 00091 double EBtimeNconst_; 00092 double EEtimeConstantTerm_; 00093 double EEtimeNconst_; 00094 double outOfTimeThreshG12pEB_; 00095 double outOfTimeThreshG12mEB_; 00096 double outOfTimeThreshG61pEB_; 00097 double outOfTimeThreshG61mEB_; 00098 double outOfTimeThreshG12pEE_; 00099 double outOfTimeThreshG12mEE_; 00100 double outOfTimeThreshG61pEE_; 00101 double outOfTimeThreshG61mEE_; 00102 double amplitudeThreshEB_; 00103 double amplitudeThreshEE_; 00104 double ebSpikeThresh_; 00105 00106 // leading edge method 00107 edm::ESHandle<EcalTimeCalibConstants> itime; 00108 edm::ESHandle<EcalTimeOffsetConstant> offtime; 00109 std::vector<double> ebPulseShape_; 00110 std::vector<double> eePulseShape_; 00111 EcalUncalibRecHitLeadingEdgeAlgo<EBDataFrame> leadingEdgeMethod_barrel_; 00112 EcalUncalibRecHitLeadingEdgeAlgo<EEDataFrame> leadingEdgeMethod_endcap_; 00113 00114 // chi2 method 00115 bool kPoorRecoFlagEB_; 00116 bool kPoorRecoFlagEE_; 00117 double chi2ThreshEB_; 00118 double chi2ThreshEE_; 00119 std::vector<double> EBchi2Parameters_; 00120 std::vector<double> EEchi2Parameters_; 00121 }; 00122 00123 #endif