Go to the documentation of this file.00001 #include "SimCalorimetry/HcalZeroSuppressionProducers/src/HcalSimpleAmplitudeZS.h"
00002 #include "DataFormats/HcalDigi/interface/HcalDigiCollections.h"
00003 #include "DataFormats/Common/interface/EDCollection.h"
00004 #include "DataFormats/Common/interface/Handle.h"
00005 #include "FWCore/Framework/interface/Selector.h"
00006 #include "FWCore/Framework/interface/ESHandle.h"
00007 #include "FWCore/Framework/interface/EventSetup.h"
00008 #include "CalibFormats/HcalObjects/interface/HcalCoderDb.h"
00009 #include "CalibFormats/HcalObjects/interface/HcalCalibrations.h"
00010 #include "CalibFormats/HcalObjects/interface/HcalDbService.h"
00011 #include "CalibFormats/HcalObjects/interface/HcalDbRecord.h"
00012 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00013 #include "FWCore/Utilities/interface/Exception.h"
00014 using namespace std;
00015
00016 #include <iostream>
00017
00018 HcalSimpleAmplitudeZS::HcalSimpleAmplitudeZS(edm::ParameterSet const& conf):
00019 inputLabel_(conf.getParameter<edm::InputTag>("digiLabel"))
00020 {
00021 const edm::ParameterSet& psHBHE=conf.getParameter<edm::ParameterSet>("hbhe");
00022 bool markAndPass=psHBHE.getParameter<bool>("markAndPass");
00023 hbhe_=std::auto_ptr<HcalZSAlgoEnergy>(new HcalZSAlgoEnergy(markAndPass,
00024 psHBHE.getParameter<int>("level"),
00025 psHBHE.getParameter<int>("firstSample"),
00026 psHBHE.getParameter<int>("samplesToAdd"),
00027 psHBHE.getParameter<bool>("twoSided")));
00028 produces<HBHEDigiCollection>();
00029
00030 const edm::ParameterSet& psHO=conf.getParameter<edm::ParameterSet>("ho");
00031 markAndPass=psHO.getParameter<bool>("markAndPass");
00032 ho_=std::auto_ptr<HcalZSAlgoEnergy>(new HcalZSAlgoEnergy(markAndPass,
00033 psHO.getParameter<int>("level"),
00034 psHO.getParameter<int>("firstSample"),
00035 psHO.getParameter<int>("samplesToAdd"),
00036 psHO.getParameter<bool>("twoSided")));
00037 produces<HODigiCollection>();
00038
00039 const edm::ParameterSet& psHF=conf.getParameter<edm::ParameterSet>("hf");
00040 markAndPass=psHO.getParameter<bool>("markAndPass");
00041 hf_=std::auto_ptr<HcalZSAlgoEnergy>(new HcalZSAlgoEnergy(markAndPass,
00042 psHF.getParameter<int>("level"),
00043 psHF.getParameter<int>("firstSample"),
00044 psHF.getParameter<int>("samplesToAdd"),
00045 psHF.getParameter<bool>("twoSided")));
00046 produces<HFDigiCollection>();
00047
00048 }
00049
00050 HcalSimpleAmplitudeZS::~HcalSimpleAmplitudeZS() {
00051 }
00052
00053 void HcalSimpleAmplitudeZS::produce(edm::Event& e, const edm::EventSetup& eventSetup)
00054 {
00055
00056 edm::ESHandle<HcalDbService> conditions;
00057 eventSetup.get<HcalDbRecord>().get(conditions);
00058
00059
00060 {
00061 hbhe_->prepare(&(*conditions));
00062 edm::Handle<HBHEDigiCollection> digi;
00063 e.getByLabel(inputLabel_,digi);
00064
00065
00066 std::auto_ptr<HBHEDigiCollection> zs(new HBHEDigiCollection);
00067
00068 hbhe_->suppress(*(digi.product()),*zs);
00069
00070 edm::LogInfo("HcalZeroSuppression") << "Suppression (HBHE) input " << digi->size() << " digis, output " << zs->size() << " digis";
00071
00072
00073 e.put(zs);
00074 hbhe_->done();
00075 }
00076 {
00077 ho_->prepare(&(*conditions));
00078 edm::Handle<HODigiCollection> digi;
00079 e.getByLabel(inputLabel_,digi);
00080
00081
00082 std::auto_ptr<HODigiCollection> zs(new HODigiCollection);
00083
00084 ho_->suppress(*(digi.product()),*zs);
00085
00086 edm::LogInfo("HcalZeroSuppression") << "Suppression (HO) input " << digi->size() << " digis, output " << zs->size() << " digis";
00087
00088
00089 e.put(zs);
00090 ho_->done();
00091 }
00092 {
00093 hf_->prepare(&(*conditions));
00094 edm::Handle<HFDigiCollection> digi;
00095 e.getByLabel(inputLabel_,digi);
00096
00097
00098 std::auto_ptr<HFDigiCollection> zs(new HFDigiCollection);
00099
00100 hf_->suppress(*(digi.product()),*zs);
00101
00102 edm::LogInfo("HcalZeroSuppression") << "Suppression (HF) input " << digi->size() << " digis, output " << zs->size() << " digis";
00103
00104
00105 e.put(zs);
00106 hf_->done();
00107 }
00108
00109 }