Go to the documentation of this file.00001 #include "SimCalorimetry/HcalZeroSuppressionProducers/src/HcalRealisticZS.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 "FWCore/MessageLogger/interface/MessageLogger.h"
00009 #include "FWCore/Utilities/interface/Exception.h"
00010 #include "CalibFormats/HcalObjects/interface/HcalDbRecord.h"
00011
00012 using namespace std;
00013
00014 #include <iostream>
00015
00016 HcalRealisticZS::HcalRealisticZS(edm::ParameterSet const& conf):
00017 inputLabel_(conf.getParameter<edm::InputTag>("digiLabel"))
00018 {
00019 bool markAndPass=conf.getParameter<bool>("markAndPass");
00020
00021 algo_=std::auto_ptr<HcalZSAlgoRealistic>(new HcalZSAlgoRealistic(markAndPass));
00022
00023
00024
00025
00026 if ( conf.getParameter<int>("useConfigZSvalues") )
00027 algo_=std::auto_ptr<HcalZSAlgoRealistic>(new HcalZSAlgoRealistic(markAndPass,
00028 conf.getParameter<int>("HBlevel"),
00029 conf.getParameter<int>("HElevel"),
00030 conf.getParameter<int>("HOlevel"),
00031 conf.getParameter<int>("HFlevel")));
00032
00033 produces<HBHEDigiCollection>();
00034 produces<HODigiCollection>();
00035 produces<HFDigiCollection>();
00036
00037 }
00038
00039 HcalRealisticZS::~HcalRealisticZS() {
00040 algo_->clearDbService();
00041 }
00042
00043 void HcalRealisticZS::produce(edm::Event& e, const edm::EventSetup& eventSetup)
00044 {
00045
00046 edm::Handle<HBHEDigiCollection> hbhe;
00047 edm::Handle<HODigiCollection> ho;
00048 edm::Handle<HFDigiCollection> hf;
00049
00050 edm::ESHandle<HcalDbService> conditions;
00051 eventSetup.get<HcalDbRecord>().get(conditions);
00052 algo_->setDbService(conditions.product());
00053
00054 e.getByLabel(inputLabel_,hbhe);
00055
00056
00057 std::auto_ptr<HBHEDigiCollection> zs_hbhe(new HBHEDigiCollection);
00058
00059 e.getByLabel(inputLabel_,ho);
00060
00061
00062 std::auto_ptr<HODigiCollection> zs_ho(new HODigiCollection);
00063
00064 e.getByLabel(inputLabel_,hf);
00065
00066
00067 std::auto_ptr<HFDigiCollection> zs_hf(new HFDigiCollection);
00068
00069
00070
00071 algo_->suppress(*(hbhe.product()),*zs_hbhe);
00072 algo_->suppress(*(ho.product()),*zs_ho);
00073 algo_->suppress(*(hf.product()),*zs_hf);
00074
00075
00076 edm::LogInfo("HcalZeroSuppression") << "Suppression (HBHE) input " << hbhe->size() << " digis, output " << zs_hbhe->size() << " digis"
00077 << " (HO) input " << ho->size() << " digis, output " << zs_ho->size() << " digis"
00078 << " (HF) input " << hf->size() << " digis, output " << zs_hf->size() << " digis";
00079
00080
00081
00082 e.put(zs_hbhe);
00083 e.put(zs_ho);
00084 e.put(zs_hf);
00085
00086 }