CMS 3D CMS Logo

HcalTrigPrimDigiProducer.cc

Go to the documentation of this file.
00001 #include "SimCalorimetry/HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.h"
00002 #include "DataFormats/Common/interface/EDProduct.h"
00003 #include "FWCore/Framework/interface/Event.h"
00004 #include "FWCore/Framework/interface/EventSetup.h"
00005 #include "DataFormats/Common/interface/Handle.h"
00006 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00007 #include "FWCore/Framework/interface/ESHandle.h"
00008 #include "DataFormats/HcalDigi/interface/HcalDigiCollections.h"
00009 #include "DataFormats/HcalDigi/interface/HBHEDataFrame.h"
00010 #include "DataFormats/HcalDigi/interface/HFDataFrame.h"
00011 #include "DataFormats/HcalDigi/interface/HcalTriggerPrimitiveDigi.h"
00012 #include "FWCore/Framework/interface/MakerMacros.h"
00013 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00014 #include "CalibFormats/HcalObjects/interface/HcalTPGRecord.h"
00015 #include "CalibFormats/HcalObjects/interface/HcalTPGCoder.h"
00016 #include "CalibFormats/CaloTPG/interface/HcalTPGCompressor.h"
00017 #include "CalibFormats/CaloTPG/interface/CaloTPGRecord.h"
00018 #include "CalibFormats/CaloTPG/interface/CaloTPGTranscoder.h"
00019 
00020 #include <algorithm>
00021 
00022 HcalTrigPrimDigiProducer::HcalTrigPrimDigiProducer(const edm::ParameterSet& ps)
00023 : 
00024   theAlgo(ps.getParameter<bool>("peakFilter"),
00025           ps.getParameter<std::vector<double> >("weights"),
00026           ps.getParameter<int>("latency"),
00027           ps.getParameter<uint32_t>("FG_threshold")),
00028   inputLabel_(ps.getParameter<edm::InputTag>("inputLabel"))
00029 {
00030    produces<HcalTrigPrimDigiCollection>();
00031 }
00032 
00033 
00034 void HcalTrigPrimDigiProducer::produce(edm::Event& e, const edm::EventSetup& eventSetup) {
00035   edm::Handle<HBHEDigiCollection> hbheDigis;
00036   edm::Handle<HFDigiCollection>   hfDigis;
00037 
00038   e.getByLabel(inputLabel_,hbheDigis);
00039   e.getByLabel(inputLabel_,hfDigis);
00040 
00041   // get the conditions, for the decoding
00042   edm::ESHandle<HcalTPGCoder> inputCoder;
00043   eventSetup.get<HcalTPGRecord>().get(inputCoder);
00044 
00045   edm::ESHandle<CaloTPGTranscoder> outTranscoder;
00046   eventSetup.get<CaloTPGRecord>().get(outTranscoder);
00047   outTranscoder->setup(eventSetup,CaloTPGTranscoder::HcalTPG);
00048 
00049   // Step B: Create empty output
00050   std::auto_ptr<HcalTrigPrimDigiCollection> result(new HcalTrigPrimDigiCollection());
00051 
00052   // Step C: Invoke the algorithm, passing in inputs and getting back outputs.
00053   theAlgo.run(inputCoder.product(),outTranscoder->getHcalCompressor().get(),
00054               *hbheDigis,  *hfDigis, *result);
00055 
00056   //  edm::LogInfo("HcalTrigPrimDigiProducer") << "HcalTrigPrims: " << result->size();
00057 
00058   // Step D: Put outputs into event
00059   e.put(result);
00060 
00061   outTranscoder->releaseSetup();
00062 }
00063 
00064 

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