CMS 3D CMS Logo

HcalRealisticZS.cc

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 using namespace std;
00011 
00012 #include <iostream>
00013 
00014 HcalRealisticZS::HcalRealisticZS(edm::ParameterSet const& conf):
00015   inputLabel_(conf.getParameter<edm::InputTag>("digiLabel"))
00016 {
00017   int mode=conf.getParameter<int>("mode");
00018   HcalZeroSuppressionAlgo::ZSMode zmode;
00019   switch (mode) {
00020   case(0): zmode=HcalZeroSuppressionAlgo::zs_SingleChannel; break;
00021   case(1): zmode=HcalZeroSuppressionAlgo::zs_TriggerTowerOR; break;
00022   case(2): zmode=HcalZeroSuppressionAlgo::zs_AllDepthsOR; break;
00023   default:
00024     edm::LogWarning("Hcal") << "Unknown zero suppression mode " << mode << " for HBHE. Using single-channel mode.";
00025     zmode=HcalZeroSuppressionAlgo::zs_SingleChannel; 
00026   }
00027 
00028   algo_=std::auto_ptr<HcalZSAlgoRealistic>(new HcalZSAlgoRealistic(zmode,
00029                                                            conf.getParameter<int>("HBlevel"),
00030                                                            conf.getParameter<int>("HElevel"),
00031                                                            conf.getParameter<int>("HOlevel"),
00032                                                                    conf.getParameter<int>("HFlevel")));
00033 
00034   produces<HBHEDigiCollection>();
00035   produces<HODigiCollection>();
00036   produces<HFDigiCollection>();
00037     
00038 }
00039     
00040 HcalRealisticZS::~HcalRealisticZS() {
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   e.getByLabel(inputLabel_,hbhe);
00051   
00052   // create empty output
00053   std::auto_ptr<HBHEDigiCollection> zs_hbhe(new HBHEDigiCollection);
00054   
00055   e.getByLabel(inputLabel_,ho);
00056   
00057   // create empty output
00058   std::auto_ptr<HODigiCollection> zs_ho(new HODigiCollection);
00059   
00060   e.getByLabel(inputLabel_,hf);
00061   
00062   // create empty output
00063   std::auto_ptr<HFDigiCollection> zs_hf(new HFDigiCollection);
00064   
00065   // run the algorithm
00066   algo_->suppress(*(hbhe.product()),*zs_hbhe);
00067   algo_->suppress(*(ho.product()),*zs_ho);
00068   algo_->suppress(*(hf.product()),*zs_hf);
00069   
00070   edm::LogInfo("HcalZeroSuppression") << "Suppression (HBHE) input " << hbhe->size() << " digis, output " << zs_hbhe->size() << " digis" 
00071                                       <<  " (HO) input " << ho->size() << " digis, output " << zs_ho->size() << " digis"
00072                                       <<  " (HF) input " << hf->size() << " digis, output " << zs_hf->size() << " digis";
00073   
00074 
00075     // return result
00076     e.put(zs_hbhe);
00077     e.put(zs_ho);
00078     e.put(zs_hf);
00079 
00080 }

Generated on Tue Jun 9 17:46:31 2009 for CMSSW by  doxygen 1.5.4